@crystallize/design-system 1.24.35 → 1.24.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.css +53 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +250 -0
- package/dist/index.mjs +249 -0
- package/package.json +1 -1
- package/src/color-picker/color-picker.tsx +100 -0
- package/src/color-picker/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/radio/radio.css +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @crystallize/design-system
|
|
2
2
|
|
|
3
|
+
## 1.24.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 92b8a39: This PR is migrating most of the get image query to next, but showcases part is left on legacy.
|
|
8
|
+
Design system is exporting colors to be used in color picker/
|
|
9
|
+
|
|
3
10
|
## 1.24.35
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/index.css
CHANGED
|
@@ -423,9 +423,59 @@
|
|
|
423
423
|
--c-color-elevate: var(--c-color-purple-50-900);
|
|
424
424
|
--c-color-overlay: 0 0 0 ;
|
|
425
425
|
}
|
|
426
|
+
.mb-3 {
|
|
427
|
+
margin-bottom: 0.75rem;
|
|
428
|
+
}
|
|
429
|
+
.ml-4 {
|
|
430
|
+
margin-left: 1rem;
|
|
431
|
+
}
|
|
426
432
|
.block {
|
|
427
433
|
display: block;
|
|
428
434
|
}
|
|
435
|
+
.h-5 {
|
|
436
|
+
height: 1.25rem;
|
|
437
|
+
}
|
|
438
|
+
.w-5 {
|
|
439
|
+
width: 1.25rem;
|
|
440
|
+
}
|
|
441
|
+
.cursor-pointer {
|
|
442
|
+
cursor: pointer;
|
|
443
|
+
}
|
|
444
|
+
.grid-cols-12 {
|
|
445
|
+
grid-template-columns: repeat(12, minmax(0, 1fr));
|
|
446
|
+
}
|
|
447
|
+
.rounded {
|
|
448
|
+
border-radius: 0.25rem;
|
|
449
|
+
}
|
|
450
|
+
.border {
|
|
451
|
+
border-width: 1px;
|
|
452
|
+
}
|
|
453
|
+
.border-solid {
|
|
454
|
+
border-style: solid;
|
|
455
|
+
}
|
|
456
|
+
.p-0 {
|
|
457
|
+
padding: 0px;
|
|
458
|
+
}
|
|
459
|
+
.p-0\.5 {
|
|
460
|
+
padding: 0.125rem;
|
|
461
|
+
}
|
|
462
|
+
.p-5 {
|
|
463
|
+
padding: 1.25rem;
|
|
464
|
+
}
|
|
465
|
+
.text-sm {
|
|
466
|
+
font-size: 0.875rem;
|
|
467
|
+
line-height: 1.25rem;
|
|
468
|
+
}
|
|
469
|
+
.font-bold {
|
|
470
|
+
font-weight: 700;
|
|
471
|
+
}
|
|
472
|
+
.capitalize {
|
|
473
|
+
text-transform: capitalize;
|
|
474
|
+
}
|
|
475
|
+
.text-gray-500-400 {
|
|
476
|
+
--tw-text-opacity: 1;
|
|
477
|
+
color: rgb(var(--c-color-gray-500-400) / var(--tw-text-opacity));
|
|
478
|
+
}
|
|
429
479
|
|
|
430
480
|
/* src/button/button.css */
|
|
431
481
|
.c-btn {
|
|
@@ -1619,6 +1669,9 @@
|
|
|
1619
1669
|
background-color: rgb(var(--c-color-gray-100-800) / var(--tw-bg-opacity));
|
|
1620
1670
|
opacity: 0.4;
|
|
1621
1671
|
}
|
|
1672
|
+
.c-radio-item:not(:disabled) {
|
|
1673
|
+
cursor: pointer;
|
|
1674
|
+
}
|
|
1622
1675
|
.c-radio-item[aria-checked=true] {
|
|
1623
1676
|
--tw-border-opacity: 1;
|
|
1624
1677
|
border-color: rgb(var(--c-color-cyan-700-200) / var(--tw-border-opacity));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes, ReactNode, ComponentPropsWithRef, ComponentProps, RefAttributes, ComponentPropsWithoutRef, LabelHTMLAttributes } from 'react';
|
|
2
|
+
import react__default, { HTMLAttributes, ReactNode, ComponentPropsWithRef, ComponentProps, RefAttributes, ComponentPropsWithoutRef, LabelHTMLAttributes, SetStateAction } from 'react';
|
|
3
3
|
import * as _radix_ui_react_dropdown_menu from '@radix-ui/react-dropdown-menu';
|
|
4
4
|
import { DropdownMenuItemProps } from '@radix-ui/react-dropdown-menu';
|
|
5
5
|
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
@@ -482,6 +482,15 @@ type CustomSwitchProps = SwitchStylesProps & Omit<SwitchProps, 'checked'> & {
|
|
|
482
482
|
};
|
|
483
483
|
declare function Switch({ size, checked, ...props }: CustomSwitchProps): JSX.Element;
|
|
484
484
|
|
|
485
|
+
type ColorPickerProps = {
|
|
486
|
+
value?: string;
|
|
487
|
+
setValue: (value: string) => void;
|
|
488
|
+
children: react__default.ReactNode;
|
|
489
|
+
isOpen: boolean;
|
|
490
|
+
setIsOpen: react__default.Dispatch<SetStateAction<boolean>>;
|
|
491
|
+
};
|
|
492
|
+
declare function ColorPicker({ value, setValue, children, isOpen, setIsOpen }: ColorPickerProps): JSX.Element;
|
|
493
|
+
|
|
485
494
|
declare const Icon: {
|
|
486
495
|
Add: react.ForwardRefExoticComponent<Pick<react.SVGProps<SVGSVGElement>, "string" | "style" | "clipPath" | "filter" | "mask" | "path" | "key" | "className" | "id" | "lang" | "tabIndex" | "role" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "width" | "height" | "stroke" | "strokeLinecap" | "name" | "type" | "to" | "href" | "target" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "end" | "orientation" | "max" | "media" | "method" | "min" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "alignmentBaseline" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "azimuth" | "baseFrequency" | "baselineShift" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clip" | "clipPathUnits" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "colorProfile" | "colorRendering" | "contentScriptType" | "contentStyleType" | "cursor" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "direction" | "display" | "divisor" | "dominantBaseline" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "fill" | "fillOpacity" | "fillRule" | "filterRes" | "filterUnits" | "floodColor" | "floodOpacity" | "focusable" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphOrientationVertical" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "imageRendering" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "letterSpacing" | "lightingColor" | "limitingConeAngle" | "local" | "markerEnd" | "markerHeight" | "markerMid" | "markerStart" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "offset" | "opacity" | "operator" | "order" | "orient" | "origin" | "overflow" | "overlinePosition" | "overlineThickness" | "paintOrder" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "pointerEvents" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rotate" | "rx" | "ry" | "scale" | "seed" | "shapeRendering" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "stopColor" | "stopOpacity" | "strikethroughPosition" | "strikethroughThickness" | "strokeDasharray" | "strokeDashoffset" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textAnchor" | "textDecoration" | "textLength" | "textRendering" | "transform" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeBidi" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "values" | "vectorEffect" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "visibility" | "vMathematical" | "widths" | "wordSpacing" | "writingMode" | "x1" | "x2" | "x" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "y" | "yChannelSelector" | "z" | "zoomAndPan"> & react.RefAttributes<SVGSVGElement>>;
|
|
487
496
|
Archive: react.ForwardRefExoticComponent<Pick<react.SVGProps<SVGSVGElement>, "string" | "style" | "clipPath" | "filter" | "mask" | "path" | "key" | "className" | "id" | "lang" | "tabIndex" | "role" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "width" | "height" | "stroke" | "strokeLinecap" | "name" | "type" | "to" | "href" | "target" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "end" | "orientation" | "max" | "media" | "method" | "min" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "alignmentBaseline" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "azimuth" | "baseFrequency" | "baselineShift" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clip" | "clipPathUnits" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "colorProfile" | "colorRendering" | "contentScriptType" | "contentStyleType" | "cursor" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "direction" | "display" | "divisor" | "dominantBaseline" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "fill" | "fillOpacity" | "fillRule" | "filterRes" | "filterUnits" | "floodColor" | "floodOpacity" | "focusable" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphOrientationVertical" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "imageRendering" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "letterSpacing" | "lightingColor" | "limitingConeAngle" | "local" | "markerEnd" | "markerHeight" | "markerMid" | "markerStart" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "offset" | "opacity" | "operator" | "order" | "orient" | "origin" | "overflow" | "overlinePosition" | "overlineThickness" | "paintOrder" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "pointerEvents" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rotate" | "rx" | "ry" | "scale" | "seed" | "shapeRendering" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "stopColor" | "stopOpacity" | "strikethroughPosition" | "strikethroughThickness" | "strokeDasharray" | "strokeDashoffset" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textAnchor" | "textDecoration" | "textLength" | "textRendering" | "transform" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeBidi" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "values" | "vectorEffect" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "visibility" | "vMathematical" | "widths" | "wordSpacing" | "writingMode" | "x1" | "x2" | "x" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "y" | "yChannelSelector" | "z" | "zoomAndPan"> & react.RefAttributes<SVGSVGElement>>;
|
|
@@ -641,4 +650,4 @@ declare const tokens: {
|
|
|
641
650
|
card: string;
|
|
642
651
|
};
|
|
643
652
|
|
|
644
|
-
export { ActionMenu, Avatar, Button, ButtonProps, Card, Checkbox, CheckboxProps, CheckboxRef, Collapsible, CollapsibleTrigger, Container, CrystallizeRichText, CrystallizeRichTextActionMenuItem, Dialog, DropdownMenu, DropdownMenuRootProps, Icon, IconButton, IconButtonProps, InlineRadio, Input, InputWithLabel, Label, Popover, Progress, Radio, RichTextEditor, Select, Slider, Spinner, StackIcon, Switch, Tag, ToastProps, Tooltip, buttonTokens, cardToken, destroyAll, showConfirm, showDialog, showError, showInfo, showWarning, toast, tokens };
|
|
653
|
+
export { ActionMenu, Avatar, Button, ButtonProps, Card, Checkbox, CheckboxProps, CheckboxRef, Collapsible, CollapsibleTrigger, ColorPicker, Container, CrystallizeRichText, CrystallizeRichTextActionMenuItem, Dialog, DropdownMenu, DropdownMenuRootProps, Icon, IconButton, IconButtonProps, InlineRadio, Input, InputWithLabel, Label, Popover, Progress, Radio, RichTextEditor, Select, Slider, Spinner, StackIcon, Switch, Tag, ToastProps, Tooltip, buttonTokens, cardToken, destroyAll, showConfirm, showDialog, showError, showInfo, showWarning, toast, tokens };
|
package/dist/index.js
CHANGED
|
@@ -40901,6 +40901,7 @@ __export(src_exports, {
|
|
|
40901
40901
|
Checkbox: () => Checkbox,
|
|
40902
40902
|
Collapsible: () => Collapsible,
|
|
40903
40903
|
CollapsibleTrigger: () => CollapsibleTrigger,
|
|
40904
|
+
ColorPicker: () => ColorPicker,
|
|
40904
40905
|
Dialog: () => Dialog,
|
|
40905
40906
|
DropdownMenu: () => DropdownMenu,
|
|
40906
40907
|
Icon: () => Icon,
|
|
@@ -41543,6 +41544,254 @@ function Switch2({ size, checked, ...props }) {
|
|
|
41543
41544
|
});
|
|
41544
41545
|
}
|
|
41545
41546
|
|
|
41547
|
+
// src/color-picker/color-picker.tsx
|
|
41548
|
+
var import_react153 = require("react");
|
|
41549
|
+
|
|
41550
|
+
// src/colors/colors.json
|
|
41551
|
+
var colors_default = {
|
|
41552
|
+
cyan: {
|
|
41553
|
+
"50": "#eefdfc",
|
|
41554
|
+
"100": "#bff6f8",
|
|
41555
|
+
"200": "#acf1f5",
|
|
41556
|
+
"300": "#73e5ed",
|
|
41557
|
+
"400": "#33d0dd",
|
|
41558
|
+
"500": "#17b3c3",
|
|
41559
|
+
"600": "#1690a4",
|
|
41560
|
+
"700": "#197385",
|
|
41561
|
+
"800": "#1d5e6d",
|
|
41562
|
+
"900": "#1c4e5d"
|
|
41563
|
+
},
|
|
41564
|
+
pink: {
|
|
41565
|
+
"50": "#fef1f9",
|
|
41566
|
+
"100": "#fee5f4",
|
|
41567
|
+
"200": "#ffccec",
|
|
41568
|
+
"300": "#ffa1db",
|
|
41569
|
+
"400": "#ff66c0",
|
|
41570
|
+
"500": "#fb39a4",
|
|
41571
|
+
"600": "#eb1782",
|
|
41572
|
+
"700": "#cd0966",
|
|
41573
|
+
"800": "#a90b54",
|
|
41574
|
+
"900": "#8d0e49"
|
|
41575
|
+
},
|
|
41576
|
+
gray: {
|
|
41577
|
+
"50": "#f5f5f6",
|
|
41578
|
+
"100": "#e4e5e9",
|
|
41579
|
+
"200": "#cccfd5",
|
|
41580
|
+
"300": "#a9aeb7",
|
|
41581
|
+
"400": "#7e8592",
|
|
41582
|
+
"500": "#626778",
|
|
41583
|
+
"600": "#545866",
|
|
41584
|
+
"700": "#4c4f5a",
|
|
41585
|
+
"800": "#40424a",
|
|
41586
|
+
"900": "#393a40"
|
|
41587
|
+
},
|
|
41588
|
+
purple: {
|
|
41589
|
+
"50": "#f7f6f9",
|
|
41590
|
+
"100": "#eeecf2",
|
|
41591
|
+
"200": "#d8d5e2",
|
|
41592
|
+
"300": "#b6b0c9",
|
|
41593
|
+
"400": "#8e85ab",
|
|
41594
|
+
"500": "#706691",
|
|
41595
|
+
"600": "#5b5178",
|
|
41596
|
+
"700": "#4b4262",
|
|
41597
|
+
"800": "#403953",
|
|
41598
|
+
"900": "#393347"
|
|
41599
|
+
},
|
|
41600
|
+
green: {
|
|
41601
|
+
"50": "#f3f8f8",
|
|
41602
|
+
"100": "#dfebee",
|
|
41603
|
+
"200": "#c3dade",
|
|
41604
|
+
"300": "#9abfc6",
|
|
41605
|
+
"400": "#699ca7",
|
|
41606
|
+
"500": "#528693",
|
|
41607
|
+
"600": "#436a77",
|
|
41608
|
+
"700": "#3b5863",
|
|
41609
|
+
"800": "#374b53",
|
|
41610
|
+
"900": "#314148"
|
|
41611
|
+
},
|
|
41612
|
+
orange: {
|
|
41613
|
+
"50": "#fff9eb",
|
|
41614
|
+
"100": "#ffedc6",
|
|
41615
|
+
"200": "#ffde99",
|
|
41616
|
+
"300": "#ffbf4a",
|
|
41617
|
+
"400": "#ffa520",
|
|
41618
|
+
"500": "#f98107",
|
|
41619
|
+
"600": "#dd5c02",
|
|
41620
|
+
"700": "#b73d06",
|
|
41621
|
+
"800": "#942e0c",
|
|
41622
|
+
"900": "#7a270d"
|
|
41623
|
+
},
|
|
41624
|
+
"s-red": {
|
|
41625
|
+
"50": "#fef2f2",
|
|
41626
|
+
"100": "#ffe1e1",
|
|
41627
|
+
"200": "#ffc8c8",
|
|
41628
|
+
"300": "#ffadad",
|
|
41629
|
+
"400": "#fd6c6c",
|
|
41630
|
+
"500": "#f53e3e",
|
|
41631
|
+
"600": "#e22020",
|
|
41632
|
+
"700": "#be1717",
|
|
41633
|
+
"800": "#9d1717",
|
|
41634
|
+
"900": "#821a1a"
|
|
41635
|
+
},
|
|
41636
|
+
"s-orange": {
|
|
41637
|
+
"50": "#fff7ed",
|
|
41638
|
+
"100": "#ffedd5",
|
|
41639
|
+
"200": "#ffd6a5",
|
|
41640
|
+
"300": "#ffbb72",
|
|
41641
|
+
"400": "#fd943a",
|
|
41642
|
+
"500": "#fc7513",
|
|
41643
|
+
"600": "#ed5909",
|
|
41644
|
+
"700": "#c4420a",
|
|
41645
|
+
"800": "#9c3410",
|
|
41646
|
+
"900": "#7d2d11"
|
|
41647
|
+
},
|
|
41648
|
+
"s-yellow": {
|
|
41649
|
+
"50": "#fefee8",
|
|
41650
|
+
"100": "#fdffb6",
|
|
41651
|
+
"200": "#fffe88",
|
|
41652
|
+
"300": "#fff744",
|
|
41653
|
+
"400": "#fee911",
|
|
41654
|
+
"500": "#eecf04",
|
|
41655
|
+
"600": "#cda201",
|
|
41656
|
+
"700": "#a47404",
|
|
41657
|
+
"800": "#875b0c",
|
|
41658
|
+
"900": "#734a10"
|
|
41659
|
+
},
|
|
41660
|
+
"s-green": {
|
|
41661
|
+
"50": "#f2ffee",
|
|
41662
|
+
"100": "#deffd8",
|
|
41663
|
+
"200": "#caffbf",
|
|
41664
|
+
"300": "#8dfd78",
|
|
41665
|
+
"400": "#53f236",
|
|
41666
|
+
"500": "#2cdb0c",
|
|
41667
|
+
"600": "#1eb603",
|
|
41668
|
+
"700": "#1b8e07",
|
|
41669
|
+
"800": "#1a700b",
|
|
41670
|
+
"900": "#165b0c"
|
|
41671
|
+
},
|
|
41672
|
+
"s-blue": {
|
|
41673
|
+
"50": "#eff5ff",
|
|
41674
|
+
"100": "#dae7ff",
|
|
41675
|
+
"200": "#bed5ff",
|
|
41676
|
+
"300": "#a0c4ff",
|
|
41677
|
+
"400": "#5d96fd",
|
|
41678
|
+
"500": "#376ffa",
|
|
41679
|
+
"600": "#214fef",
|
|
41680
|
+
"700": "#193adc",
|
|
41681
|
+
"800": "#1b31b2",
|
|
41682
|
+
"900": "#1c2f8c"
|
|
41683
|
+
},
|
|
41684
|
+
"s-purple": {
|
|
41685
|
+
"50": "#f4f3ff",
|
|
41686
|
+
"100": "#ebe8ff",
|
|
41687
|
+
"200": "#d9d5ff",
|
|
41688
|
+
"300": "#bdb2ff",
|
|
41689
|
+
"400": "#9d88fd",
|
|
41690
|
+
"500": "#7e58fa",
|
|
41691
|
+
"600": "#6f35f2",
|
|
41692
|
+
"700": "#6023de",
|
|
41693
|
+
"800": "#501dba",
|
|
41694
|
+
"900": "#431a98"
|
|
41695
|
+
},
|
|
41696
|
+
"s-pink": {
|
|
41697
|
+
"50": "#fff4ff",
|
|
41698
|
+
"100": "#ffe7ff",
|
|
41699
|
+
"200": "#ffc6ff",
|
|
41700
|
+
"300": "#fea9fa",
|
|
41701
|
+
"400": "#fc76f4",
|
|
41702
|
+
"500": "#f342e7",
|
|
41703
|
+
"600": "#d722c8",
|
|
41704
|
+
"700": "#b219a1",
|
|
41705
|
+
"800": "#921684",
|
|
41706
|
+
"900": "#771869"
|
|
41707
|
+
}
|
|
41708
|
+
};
|
|
41709
|
+
|
|
41710
|
+
// src/color-picker/color-picker.tsx
|
|
41711
|
+
var import_jsx_runtime172 = require("react/jsx-runtime");
|
|
41712
|
+
var SHADES = ["200", "300", "400", "500", "600", "700", "800"];
|
|
41713
|
+
var ORDERED_COLOR_NAMES = [
|
|
41714
|
+
"s-green",
|
|
41715
|
+
"s-red",
|
|
41716
|
+
"orange",
|
|
41717
|
+
"s-yellow",
|
|
41718
|
+
"purple",
|
|
41719
|
+
"gray",
|
|
41720
|
+
"green",
|
|
41721
|
+
"s-pink",
|
|
41722
|
+
"pink",
|
|
41723
|
+
"cyan",
|
|
41724
|
+
"s-purple",
|
|
41725
|
+
"s-blue"
|
|
41726
|
+
];
|
|
41727
|
+
function ColorPicker({ value, setValue, children, isOpen, setIsOpen }) {
|
|
41728
|
+
const [hoveredColor, setHoveredColor] = (0, import_react153.useState)(null);
|
|
41729
|
+
const colorLookupMap = (0, import_react153.useMemo)(() => {
|
|
41730
|
+
const map = /* @__PURE__ */ new Map();
|
|
41731
|
+
ORDERED_COLOR_NAMES.forEach((colorName) => {
|
|
41732
|
+
SHADES.forEach((shade) => {
|
|
41733
|
+
const color = colors_default[colorName];
|
|
41734
|
+
map.set(color[shade], `${colorName} ${shade}`);
|
|
41735
|
+
});
|
|
41736
|
+
});
|
|
41737
|
+
return map;
|
|
41738
|
+
}, []);
|
|
41739
|
+
const getColorNameAndHue = (colorValue) => {
|
|
41740
|
+
return colorLookupMap.get(colorValue) || "Color Name and Hue not found";
|
|
41741
|
+
};
|
|
41742
|
+
const displayedColorInfo = hoveredColor || value ? getColorNameAndHue(hoveredColor ?? value) : "Select a color";
|
|
41743
|
+
const handleColorSelect = (colorValue) => {
|
|
41744
|
+
setValue(colorValue);
|
|
41745
|
+
setIsOpen(false);
|
|
41746
|
+
};
|
|
41747
|
+
const handleMouseEnter = (colorValue) => setHoveredColor(colorValue);
|
|
41748
|
+
const handleMouseLeave = () => setHoveredColor(null);
|
|
41749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Popover, {
|
|
41750
|
+
open: isOpen,
|
|
41751
|
+
side: "bottom",
|
|
41752
|
+
hasArrow: true,
|
|
41753
|
+
onOpenChange: setIsOpen,
|
|
41754
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(Card, {
|
|
41755
|
+
variant: "elevate",
|
|
41756
|
+
className: " border border-solid border-border p-5",
|
|
41757
|
+
children: [
|
|
41758
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", {
|
|
41759
|
+
className: "mb-3",
|
|
41760
|
+
children: [
|
|
41761
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", {
|
|
41762
|
+
className: "text-sm font-bold capitalize",
|
|
41763
|
+
children: displayedColorInfo
|
|
41764
|
+
}),
|
|
41765
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", {
|
|
41766
|
+
className: "ml-4 text-sm italic text-gray-500-400",
|
|
41767
|
+
children: hoveredColor ?? value
|
|
41768
|
+
})
|
|
41769
|
+
]
|
|
41770
|
+
}),
|
|
41771
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", {
|
|
41772
|
+
className: "grid grid-cols-12",
|
|
41773
|
+
children: ORDERED_COLOR_NAMES.map((colorName) => /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", {
|
|
41774
|
+
children: SHADES.map((shade) => {
|
|
41775
|
+
const colorValue = colors_default[colorName][shade];
|
|
41776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", {
|
|
41777
|
+
className: "cursor-pointer rounded p-0.5",
|
|
41778
|
+
onClick: () => handleColorSelect(colorValue),
|
|
41779
|
+
onMouseEnter: () => handleMouseEnter(colorValue),
|
|
41780
|
+
onMouseLeave: handleMouseLeave,
|
|
41781
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", {
|
|
41782
|
+
className: "h-5 w-5",
|
|
41783
|
+
style: { backgroundColor: colorValue }
|
|
41784
|
+
})
|
|
41785
|
+
}, colorValue);
|
|
41786
|
+
})
|
|
41787
|
+
}, colorName))
|
|
41788
|
+
})
|
|
41789
|
+
]
|
|
41790
|
+
}),
|
|
41791
|
+
children
|
|
41792
|
+
});
|
|
41793
|
+
}
|
|
41794
|
+
|
|
41546
41795
|
// src/index.ts
|
|
41547
41796
|
init_iconography();
|
|
41548
41797
|
var tokens = {
|
|
@@ -41558,6 +41807,7 @@ var tokens = {
|
|
|
41558
41807
|
Checkbox,
|
|
41559
41808
|
Collapsible,
|
|
41560
41809
|
CollapsibleTrigger,
|
|
41810
|
+
ColorPicker,
|
|
41561
41811
|
Dialog,
|
|
41562
41812
|
DropdownMenu,
|
|
41563
41813
|
Icon,
|
package/dist/index.mjs
CHANGED
|
@@ -599,6 +599,254 @@ function Switch({ size, checked, ...props }) {
|
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
+
// src/color-picker/color-picker.tsx
|
|
603
|
+
import { useState, useMemo } from "react";
|
|
604
|
+
|
|
605
|
+
// src/colors/colors.json
|
|
606
|
+
var colors_default = {
|
|
607
|
+
cyan: {
|
|
608
|
+
"50": "#eefdfc",
|
|
609
|
+
"100": "#bff6f8",
|
|
610
|
+
"200": "#acf1f5",
|
|
611
|
+
"300": "#73e5ed",
|
|
612
|
+
"400": "#33d0dd",
|
|
613
|
+
"500": "#17b3c3",
|
|
614
|
+
"600": "#1690a4",
|
|
615
|
+
"700": "#197385",
|
|
616
|
+
"800": "#1d5e6d",
|
|
617
|
+
"900": "#1c4e5d"
|
|
618
|
+
},
|
|
619
|
+
pink: {
|
|
620
|
+
"50": "#fef1f9",
|
|
621
|
+
"100": "#fee5f4",
|
|
622
|
+
"200": "#ffccec",
|
|
623
|
+
"300": "#ffa1db",
|
|
624
|
+
"400": "#ff66c0",
|
|
625
|
+
"500": "#fb39a4",
|
|
626
|
+
"600": "#eb1782",
|
|
627
|
+
"700": "#cd0966",
|
|
628
|
+
"800": "#a90b54",
|
|
629
|
+
"900": "#8d0e49"
|
|
630
|
+
},
|
|
631
|
+
gray: {
|
|
632
|
+
"50": "#f5f5f6",
|
|
633
|
+
"100": "#e4e5e9",
|
|
634
|
+
"200": "#cccfd5",
|
|
635
|
+
"300": "#a9aeb7",
|
|
636
|
+
"400": "#7e8592",
|
|
637
|
+
"500": "#626778",
|
|
638
|
+
"600": "#545866",
|
|
639
|
+
"700": "#4c4f5a",
|
|
640
|
+
"800": "#40424a",
|
|
641
|
+
"900": "#393a40"
|
|
642
|
+
},
|
|
643
|
+
purple: {
|
|
644
|
+
"50": "#f7f6f9",
|
|
645
|
+
"100": "#eeecf2",
|
|
646
|
+
"200": "#d8d5e2",
|
|
647
|
+
"300": "#b6b0c9",
|
|
648
|
+
"400": "#8e85ab",
|
|
649
|
+
"500": "#706691",
|
|
650
|
+
"600": "#5b5178",
|
|
651
|
+
"700": "#4b4262",
|
|
652
|
+
"800": "#403953",
|
|
653
|
+
"900": "#393347"
|
|
654
|
+
},
|
|
655
|
+
green: {
|
|
656
|
+
"50": "#f3f8f8",
|
|
657
|
+
"100": "#dfebee",
|
|
658
|
+
"200": "#c3dade",
|
|
659
|
+
"300": "#9abfc6",
|
|
660
|
+
"400": "#699ca7",
|
|
661
|
+
"500": "#528693",
|
|
662
|
+
"600": "#436a77",
|
|
663
|
+
"700": "#3b5863",
|
|
664
|
+
"800": "#374b53",
|
|
665
|
+
"900": "#314148"
|
|
666
|
+
},
|
|
667
|
+
orange: {
|
|
668
|
+
"50": "#fff9eb",
|
|
669
|
+
"100": "#ffedc6",
|
|
670
|
+
"200": "#ffde99",
|
|
671
|
+
"300": "#ffbf4a",
|
|
672
|
+
"400": "#ffa520",
|
|
673
|
+
"500": "#f98107",
|
|
674
|
+
"600": "#dd5c02",
|
|
675
|
+
"700": "#b73d06",
|
|
676
|
+
"800": "#942e0c",
|
|
677
|
+
"900": "#7a270d"
|
|
678
|
+
},
|
|
679
|
+
"s-red": {
|
|
680
|
+
"50": "#fef2f2",
|
|
681
|
+
"100": "#ffe1e1",
|
|
682
|
+
"200": "#ffc8c8",
|
|
683
|
+
"300": "#ffadad",
|
|
684
|
+
"400": "#fd6c6c",
|
|
685
|
+
"500": "#f53e3e",
|
|
686
|
+
"600": "#e22020",
|
|
687
|
+
"700": "#be1717",
|
|
688
|
+
"800": "#9d1717",
|
|
689
|
+
"900": "#821a1a"
|
|
690
|
+
},
|
|
691
|
+
"s-orange": {
|
|
692
|
+
"50": "#fff7ed",
|
|
693
|
+
"100": "#ffedd5",
|
|
694
|
+
"200": "#ffd6a5",
|
|
695
|
+
"300": "#ffbb72",
|
|
696
|
+
"400": "#fd943a",
|
|
697
|
+
"500": "#fc7513",
|
|
698
|
+
"600": "#ed5909",
|
|
699
|
+
"700": "#c4420a",
|
|
700
|
+
"800": "#9c3410",
|
|
701
|
+
"900": "#7d2d11"
|
|
702
|
+
},
|
|
703
|
+
"s-yellow": {
|
|
704
|
+
"50": "#fefee8",
|
|
705
|
+
"100": "#fdffb6",
|
|
706
|
+
"200": "#fffe88",
|
|
707
|
+
"300": "#fff744",
|
|
708
|
+
"400": "#fee911",
|
|
709
|
+
"500": "#eecf04",
|
|
710
|
+
"600": "#cda201",
|
|
711
|
+
"700": "#a47404",
|
|
712
|
+
"800": "#875b0c",
|
|
713
|
+
"900": "#734a10"
|
|
714
|
+
},
|
|
715
|
+
"s-green": {
|
|
716
|
+
"50": "#f2ffee",
|
|
717
|
+
"100": "#deffd8",
|
|
718
|
+
"200": "#caffbf",
|
|
719
|
+
"300": "#8dfd78",
|
|
720
|
+
"400": "#53f236",
|
|
721
|
+
"500": "#2cdb0c",
|
|
722
|
+
"600": "#1eb603",
|
|
723
|
+
"700": "#1b8e07",
|
|
724
|
+
"800": "#1a700b",
|
|
725
|
+
"900": "#165b0c"
|
|
726
|
+
},
|
|
727
|
+
"s-blue": {
|
|
728
|
+
"50": "#eff5ff",
|
|
729
|
+
"100": "#dae7ff",
|
|
730
|
+
"200": "#bed5ff",
|
|
731
|
+
"300": "#a0c4ff",
|
|
732
|
+
"400": "#5d96fd",
|
|
733
|
+
"500": "#376ffa",
|
|
734
|
+
"600": "#214fef",
|
|
735
|
+
"700": "#193adc",
|
|
736
|
+
"800": "#1b31b2",
|
|
737
|
+
"900": "#1c2f8c"
|
|
738
|
+
},
|
|
739
|
+
"s-purple": {
|
|
740
|
+
"50": "#f4f3ff",
|
|
741
|
+
"100": "#ebe8ff",
|
|
742
|
+
"200": "#d9d5ff",
|
|
743
|
+
"300": "#bdb2ff",
|
|
744
|
+
"400": "#9d88fd",
|
|
745
|
+
"500": "#7e58fa",
|
|
746
|
+
"600": "#6f35f2",
|
|
747
|
+
"700": "#6023de",
|
|
748
|
+
"800": "#501dba",
|
|
749
|
+
"900": "#431a98"
|
|
750
|
+
},
|
|
751
|
+
"s-pink": {
|
|
752
|
+
"50": "#fff4ff",
|
|
753
|
+
"100": "#ffe7ff",
|
|
754
|
+
"200": "#ffc6ff",
|
|
755
|
+
"300": "#fea9fa",
|
|
756
|
+
"400": "#fc76f4",
|
|
757
|
+
"500": "#f342e7",
|
|
758
|
+
"600": "#d722c8",
|
|
759
|
+
"700": "#b219a1",
|
|
760
|
+
"800": "#921684",
|
|
761
|
+
"900": "#771869"
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
// src/color-picker/color-picker.tsx
|
|
766
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
767
|
+
var SHADES = ["200", "300", "400", "500", "600", "700", "800"];
|
|
768
|
+
var ORDERED_COLOR_NAMES = [
|
|
769
|
+
"s-green",
|
|
770
|
+
"s-red",
|
|
771
|
+
"orange",
|
|
772
|
+
"s-yellow",
|
|
773
|
+
"purple",
|
|
774
|
+
"gray",
|
|
775
|
+
"green",
|
|
776
|
+
"s-pink",
|
|
777
|
+
"pink",
|
|
778
|
+
"cyan",
|
|
779
|
+
"s-purple",
|
|
780
|
+
"s-blue"
|
|
781
|
+
];
|
|
782
|
+
function ColorPicker({ value, setValue, children, isOpen, setIsOpen }) {
|
|
783
|
+
const [hoveredColor, setHoveredColor] = useState(null);
|
|
784
|
+
const colorLookupMap = useMemo(() => {
|
|
785
|
+
const map = /* @__PURE__ */ new Map();
|
|
786
|
+
ORDERED_COLOR_NAMES.forEach((colorName) => {
|
|
787
|
+
SHADES.forEach((shade) => {
|
|
788
|
+
const color = colors_default[colorName];
|
|
789
|
+
map.set(color[shade], `${colorName} ${shade}`);
|
|
790
|
+
});
|
|
791
|
+
});
|
|
792
|
+
return map;
|
|
793
|
+
}, []);
|
|
794
|
+
const getColorNameAndHue = (colorValue) => {
|
|
795
|
+
return colorLookupMap.get(colorValue) || "Color Name and Hue not found";
|
|
796
|
+
};
|
|
797
|
+
const displayedColorInfo = hoveredColor || value ? getColorNameAndHue(hoveredColor ?? value) : "Select a color";
|
|
798
|
+
const handleColorSelect = (colorValue) => {
|
|
799
|
+
setValue(colorValue);
|
|
800
|
+
setIsOpen(false);
|
|
801
|
+
};
|
|
802
|
+
const handleMouseEnter = (colorValue) => setHoveredColor(colorValue);
|
|
803
|
+
const handleMouseLeave = () => setHoveredColor(null);
|
|
804
|
+
return /* @__PURE__ */ jsx18(Popover, {
|
|
805
|
+
open: isOpen,
|
|
806
|
+
side: "bottom",
|
|
807
|
+
hasArrow: true,
|
|
808
|
+
onOpenChange: setIsOpen,
|
|
809
|
+
content: /* @__PURE__ */ jsxs10(Card, {
|
|
810
|
+
variant: "elevate",
|
|
811
|
+
className: " border border-solid border-border p-5",
|
|
812
|
+
children: [
|
|
813
|
+
/* @__PURE__ */ jsxs10("div", {
|
|
814
|
+
className: "mb-3",
|
|
815
|
+
children: [
|
|
816
|
+
/* @__PURE__ */ jsx18("span", {
|
|
817
|
+
className: "text-sm font-bold capitalize",
|
|
818
|
+
children: displayedColorInfo
|
|
819
|
+
}),
|
|
820
|
+
/* @__PURE__ */ jsx18("span", {
|
|
821
|
+
className: "ml-4 text-sm italic text-gray-500-400",
|
|
822
|
+
children: hoveredColor ?? value
|
|
823
|
+
})
|
|
824
|
+
]
|
|
825
|
+
}),
|
|
826
|
+
/* @__PURE__ */ jsx18("div", {
|
|
827
|
+
className: "grid grid-cols-12",
|
|
828
|
+
children: ORDERED_COLOR_NAMES.map((colorName) => /* @__PURE__ */ jsx18("div", {
|
|
829
|
+
children: SHADES.map((shade) => {
|
|
830
|
+
const colorValue = colors_default[colorName][shade];
|
|
831
|
+
return /* @__PURE__ */ jsx18("div", {
|
|
832
|
+
className: "cursor-pointer rounded p-0.5",
|
|
833
|
+
onClick: () => handleColorSelect(colorValue),
|
|
834
|
+
onMouseEnter: () => handleMouseEnter(colorValue),
|
|
835
|
+
onMouseLeave: handleMouseLeave,
|
|
836
|
+
children: /* @__PURE__ */ jsx18("div", {
|
|
837
|
+
className: "h-5 w-5",
|
|
838
|
+
style: { backgroundColor: colorValue }
|
|
839
|
+
})
|
|
840
|
+
}, colorValue);
|
|
841
|
+
})
|
|
842
|
+
}, colorName))
|
|
843
|
+
})
|
|
844
|
+
]
|
|
845
|
+
}),
|
|
846
|
+
children
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
|
|
602
850
|
// src/index.ts
|
|
603
851
|
var tokens = {
|
|
604
852
|
button: buttonTokens,
|
|
@@ -612,6 +860,7 @@ export {
|
|
|
612
860
|
Checkbox,
|
|
613
861
|
Collapsible,
|
|
614
862
|
CollapsibleTrigger,
|
|
863
|
+
ColorPicker,
|
|
615
864
|
Dialog,
|
|
616
865
|
DropdownMenu,
|
|
617
866
|
Icon,
|
package/package.json
CHANGED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useState, useMemo, type SetStateAction } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Card } from '../card';
|
|
4
|
+
import { colors } from '../colors';
|
|
5
|
+
import { Popover } from '../popover';
|
|
6
|
+
|
|
7
|
+
const SHADES = ['200', '300', '400', '500', '600', '700', '800'] as const;
|
|
8
|
+
|
|
9
|
+
const ORDERED_COLOR_NAMES = [
|
|
10
|
+
's-green',
|
|
11
|
+
's-red',
|
|
12
|
+
'orange',
|
|
13
|
+
's-yellow',
|
|
14
|
+
'purple',
|
|
15
|
+
'gray',
|
|
16
|
+
'green',
|
|
17
|
+
's-pink',
|
|
18
|
+
'pink',
|
|
19
|
+
'cyan',
|
|
20
|
+
's-purple',
|
|
21
|
+
's-blue',
|
|
22
|
+
] as const;
|
|
23
|
+
|
|
24
|
+
type ColorPickerProps = {
|
|
25
|
+
value?: string;
|
|
26
|
+
setValue: (value: string) => void;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
isOpen: boolean;
|
|
29
|
+
setIsOpen: React.Dispatch<SetStateAction<boolean>>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function ColorPicker({ value, setValue, children, isOpen, setIsOpen }: ColorPickerProps) {
|
|
33
|
+
const [hoveredColor, setHoveredColor] = useState<string | null>(null);
|
|
34
|
+
|
|
35
|
+
const colorLookupMap = useMemo(() => {
|
|
36
|
+
const map = new Map();
|
|
37
|
+
ORDERED_COLOR_NAMES.forEach(colorName => {
|
|
38
|
+
SHADES.forEach(shade => {
|
|
39
|
+
const color = colors[colorName];
|
|
40
|
+
map.set(color[shade], `${colorName} ${shade}`);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return map;
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const getColorNameAndHue = (colorValue?: string): string => {
|
|
47
|
+
return colorLookupMap.get(colorValue) || 'Color Name and Hue not found';
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const displayedColorInfo = hoveredColor || value ? getColorNameAndHue(hoveredColor ?? value) : 'Select a color';
|
|
51
|
+
|
|
52
|
+
const handleColorSelect = (colorValue: string) => {
|
|
53
|
+
setValue(colorValue);
|
|
54
|
+
setIsOpen(false);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const handleMouseEnter = (colorValue: string) => setHoveredColor(colorValue);
|
|
58
|
+
const handleMouseLeave = () => setHoveredColor(null);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Popover
|
|
62
|
+
open={isOpen}
|
|
63
|
+
side="bottom"
|
|
64
|
+
hasArrow
|
|
65
|
+
onOpenChange={setIsOpen}
|
|
66
|
+
content={
|
|
67
|
+
<Card variant="elevate" className=" border border-solid border-border p-5">
|
|
68
|
+
<div className="mb-3">
|
|
69
|
+
<span className="text-sm font-bold capitalize">{displayedColorInfo}</span>
|
|
70
|
+
<span className="ml-4 text-sm italic text-gray-500-400">{hoveredColor ?? value}</span>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div className="grid grid-cols-12">
|
|
74
|
+
{ORDERED_COLOR_NAMES.map(colorName => (
|
|
75
|
+
<div key={colorName}>
|
|
76
|
+
{SHADES.map(shade => {
|
|
77
|
+
const colorValue = colors[colorName][shade];
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
key={colorValue}
|
|
82
|
+
className="cursor-pointer rounded p-0.5"
|
|
83
|
+
onClick={() => handleColorSelect(colorValue)}
|
|
84
|
+
onMouseEnter={() => handleMouseEnter(colorValue)}
|
|
85
|
+
onMouseLeave={handleMouseLeave}
|
|
86
|
+
>
|
|
87
|
+
<div className="h-5 w-5" style={{ backgroundColor: colorValue }} />
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
})}
|
|
91
|
+
</div>
|
|
92
|
+
))}
|
|
93
|
+
</div>
|
|
94
|
+
</Card>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
{children}
|
|
98
|
+
</Popover>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColorPicker } from './color-picker';
|
package/src/index.ts
CHANGED