Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"author": "CodeZero",
"devDependencies": {
"@ark-ui/react": "^5.36.2",
"@internationalized/date": "^3.12.0",
"@babel/plugin-proposal-decorators": "^7.29.7",
"@babel/plugin-transform-class-properties": "^7.29.7",
"@codemirror/autocomplete": "^6.20.3",
Expand All @@ -29,6 +28,7 @@
"@codemirror/view": "^6.43.6",
"@dagrejs/dagre": "^3.0.0",
"@icons-pack/react-simple-icons": "^13.13.0",
"@internationalized/date": "^3.12.0",
"@lezer/common": "^1.5.2",
"@mdx-js/react": "^3.1.1",
"@radix-ui/react-checkbox": "^1.3.9",
Expand Down Expand Up @@ -61,6 +61,7 @@
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@types/react-syntax-highlighter": "^15.5.13",
"@uidotdev/usehooks": "^2.4.1",
"@uiw/codemirror-themes": "^4.25.10",
"@uiw/react-codemirror": "^4.25.10",
"@uiw/react-json-view": "^2.0.0-alpha.43",
Expand All @@ -83,6 +84,7 @@
"playwright": "1.58.1",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-hotkeys-hook": "^5.3.3",
"react-resizable-panels": "^4.9.0",
"react-zoom-pan-pinch": "^3.7.0",
"rimraf": "^6.1.3",
Expand Down Expand Up @@ -115,14 +117,14 @@
"types": "dist/index.d.ts",
"peerDependencies": {
"@ark-ui/react": "^5.36.2",
"@internationalized/date": "^3.12.0",
"@icons-pack/react-simple-icons": "^13.13.0",
"@codemirror/autocomplete": "^6.20.0",
"@codemirror/lang-json": "^6.0.2",
"@codemirror/language": "^6.12.1",
"@codemirror/lint": "^6.9.4",
"@codemirror/state": "^6.5.4",
"@codemirror/view": "^6.39.13",
"@icons-pack/react-simple-icons": "^13.13.0",
"@internationalized/date": "^3.12.0",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-context-menu": "^2.2.16",
"@radix-ui/react-dialog": "^1.1.15",
Expand All @@ -137,6 +139,7 @@
"@radix-ui/react-toggle-group": "^1.1.11",
"@radix-ui/react-tooltip": "^1.2.8",
"@tabler/icons-react": "3.41.1",
"@uidotdev/usehooks": "^2.4.1",
"@uiw/codemirror-themes": "^4.25.4",
"@uiw/react-codemirror": "^4.25.4",
"@uiw/react-json-view": "^2.0.0-alpha.43",
Expand All @@ -147,6 +150,7 @@
"motion": "^12.40.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0",
"react-hotkeys-hook": "^5.0.0",
"react-resizable-panels": "^4.3.1",
"react-zoom-pan-pinch": "^3.7.0",
"slate": "^0.124.0",
Expand Down
233 changes: 233 additions & 0 deletions src/components/form/ColorInput.style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
@use "../../styles/helpers";
@use "../../styles/box";
@use "../../styles/variables";

.color-input {

&__control {
flex: 1;
min-width: 0;
align-self: stretch;
display: flex;
align-items: center;
gap: variables.$xs;
}

&__swatch-wrapper {
position: relative;
width: 20px;
height: 20px;
border-radius: variables.$borderRadius - variables.$xs;
overflow: hidden;
flex-shrink: 0;
box-shadow: inset 0 0 0 1px helpers.borderColor(variables.$white);
}

&__transparency-grid {
position: absolute;
inset: 0;
}

// Ark sets `position: relative` inline on the swatch, so fill via width/height
// (an absolute `inset: 0` would be ignored and collapse it to 0 height).
&__swatch {
width: 100%;
height: 100%;
}

// Shown when no color has been picked yet: a neutral empty square with a slash.
&__swatch--empty {
background:
linear-gradient(to top right,
transparent calc(50% - 1px), helpers.color(variables.$white, .4),
transparent calc(50% + 1px));
}

&__value-text {
font-variant-numeric: tabular-nums;

& {
@include helpers.fontStyle();
}

&--placeholder {
opacity: .5;
}
}

&__trigger {
cursor: pointer;
display: flex;
align-items: center;
}

// ---- menu content ----

&__content {
padding: variables.$xxs;
}

&__body {
display: flex;
flex-direction: column;
gap: variables.$xs;
width: 240px;
max-width: 100%;
}

&__area {
position: relative;
width: 100%;
height: 140px;
border-radius: variables.$borderRadius - variables.$xxs;
overflow: hidden;
}

// Ark sets `position: relative` inline on the background/track, which beats a
// stylesheet `position: absolute`. So fill via width/height instead of inset.
&__area-background {
width: 100%;
height: 100%;
border-radius: inherit;
}

&__area-thumb {
width: 14px;
height: 14px;
border-radius: 50%;
border: 2px solid variables.$white;
box-shadow: 0 0 0 1px rgba(variables.$black, .35);

& {
@include helpers.noFocusStyle();
}
}

&__sliders {
display: flex;
flex-direction: column;
gap: variables.$xs;
}

&__channel-slider {
position: relative;
height: 14px;
border-radius: 999px;
overflow: hidden;

& {
@include helpers.noFocusStyle();
}
}

&__channel-slider-grid {
position: absolute;
inset: 0;
border-radius: inherit;
}

&__channel-slider-track {
width: 100%;
height: 100%;
border-radius: inherit;
}

&__channel-slider-thumb {
width: 14px;
height: 14px;
border-radius: 50%;
border: 2px solid variables.$white;
box-shadow: 0 0 0 1px rgba(variables.$black, .35);
transform: translate(-50%, -50%);

& {
@include helpers.noFocusStyle();
}
}

// ---- channel / hex inputs ----

&__channels {
display: flex;
flex-direction: column;
gap: variables.$xs;
}

&__notation {
width: 100%;

.segmented-control__item {
flex: 1;
text-align: center;
justify-content: center;
font-size: variables.$sm;
}
}

// ---- copy / paste footer ----

&__actions {
width: 100%;
gap: variables.$xs;
margin-top: variables.$xxs;

.button {
flex: 1;
gap: variables.$xxs;
justify-content: center;
align-items: center;
}
}

&__channel-row {
display: flex;
align-items: flex-end;
gap: variables.$xxs;
}

&__channel {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
flex: 1;
min-width: 0;

&--hex {
align-items: stretch;

.color-input__channel-label {
text-align: center;
}
}
}

&__channel-label {
font-size: variables.$xs;
opacity: .6;

& {
@include helpers.fontStyle();
}
}

&__channel-input {
width: 100%;
min-width: 0;
text-align: center;
padding: variables.$xxs;
border-radius: variables.$borderRadius - variables.$xxs;
font-variant-numeric: tabular-nums;

& {
@include box.box(variables.$primary, variables.$white, variables.$white);
@include helpers.noFocusStyle();
@include helpers.fontStyle();
font-size: variables.$sm;
}

&:focus, &[data-focus] {
@include box.boxActiveStyle(variables.$primary, variables.$white, variables.$white);
}
}
}
Loading