@crystallize/design-system 1.23.0 → 1.23.2
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 +15 -0
- package/dist/index.css +30 -5
- package/dist/index.d.ts +7 -2
- package/dist/index.js +16 -4
- package/dist/index.mjs +16 -4
- package/dist/{rich-text-editor-OUGDPSPV.css → rich-text-editor-EVP7CTRQ.css} +5 -2
- package/package.json +1 -1
- package/src/dialog/dialog.css +11 -2
- package/src/select/select-root.tsx +8 -2
- package/src/select/select.css +6 -0
- package/src/switch/switch.css +25 -4
- package/src/switch/switch.tsx +17 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @crystallize/design-system
|
|
2
2
|
|
|
3
|
+
## 1.23.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c7ede0f: Add size prop to the Switch component
|
|
8
|
+
|
|
9
|
+
## 1.23.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 74818d2: This pr is adding a basic components and mutations to add an item to specific flow
|
|
14
|
+
query getFlows was moved to common hooks as it is used in different views
|
|
15
|
+
|
|
16
|
+
Also prop classname was added to Select.Container component to allow better styling
|
|
17
|
+
|
|
3
18
|
## 1.23.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/index.css
CHANGED
|
@@ -1033,11 +1033,14 @@
|
|
|
1033
1033
|
}
|
|
1034
1034
|
|
|
1035
1035
|
/* src/dialog/dialog.css */
|
|
1036
|
+
:root {
|
|
1037
|
+
--dialog-z-index: 100;
|
|
1038
|
+
}
|
|
1036
1039
|
.c-dialog {
|
|
1037
1040
|
position: fixed;
|
|
1038
1041
|
left: 50%;
|
|
1039
1042
|
top: 50%;
|
|
1040
|
-
z-index:
|
|
1043
|
+
z-index: var(--dialog-z-index);
|
|
1041
1044
|
width: auto;
|
|
1042
1045
|
min-width: 25%;
|
|
1043
1046
|
max-width: 800px;
|
|
@@ -1059,7 +1062,7 @@
|
|
|
1059
1062
|
.c-dialog-overlay {
|
|
1060
1063
|
position: fixed;
|
|
1061
1064
|
inset: 0px;
|
|
1062
|
-
z-index:
|
|
1065
|
+
z-index: var(--dialog-z-index);
|
|
1063
1066
|
background-color: rgb(var(--c-color-overlay) / 0.3);
|
|
1064
1067
|
}
|
|
1065
1068
|
.c-dialog-icon-wrapper {
|
|
@@ -1619,6 +1622,9 @@
|
|
|
1619
1622
|
outline: 2px solid transparent;
|
|
1620
1623
|
outline-offset: 2px;
|
|
1621
1624
|
}
|
|
1625
|
+
.c-dialog ~ div > .c-select-content {
|
|
1626
|
+
z-index: calc(var(--dialog-z-index) + 1);
|
|
1627
|
+
}
|
|
1622
1628
|
|
|
1623
1629
|
/* src/slider/slider.css */
|
|
1624
1630
|
.c-slider-root {
|
|
@@ -3449,10 +3455,30 @@
|
|
|
3449
3455
|
--tw-bg-opacity: 1;
|
|
3450
3456
|
background-color: rgb(var(--c-color-cyan-100-800) / var(--tw-bg-opacity));
|
|
3451
3457
|
}
|
|
3452
|
-
.c-switch-
|
|
3453
|
-
|
|
3458
|
+
.c-switch-root-sm {
|
|
3459
|
+
height: 1.5rem;
|
|
3460
|
+
width: 2.75rem;
|
|
3461
|
+
}
|
|
3462
|
+
.c-switch-root-sm .c-switch-thumb {
|
|
3454
3463
|
height: 1rem;
|
|
3455
3464
|
width: 1rem;
|
|
3465
|
+
}
|
|
3466
|
+
.c-switch-root-sm .c-switch-thumb[data-state=checked] {
|
|
3467
|
+
transform: translateX(20px);
|
|
3468
|
+
}
|
|
3469
|
+
.c-switch-root-xs {
|
|
3470
|
+
height: 1.25rem;
|
|
3471
|
+
width: 2.25rem;
|
|
3472
|
+
}
|
|
3473
|
+
.c-switch-root-xs .c-switch-thumb {
|
|
3474
|
+
height: 0.875rem;
|
|
3475
|
+
width: 0.875rem;
|
|
3476
|
+
}
|
|
3477
|
+
.c-switch-root-xs .c-switch-thumb[data-state=checked] {
|
|
3478
|
+
transform: translateX(16px);
|
|
3479
|
+
}
|
|
3480
|
+
.c-switch-thumb {
|
|
3481
|
+
display: block;
|
|
3456
3482
|
transform-origin: center;
|
|
3457
3483
|
--tw-translate-x: 0.25rem;
|
|
3458
3484
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -3464,7 +3490,6 @@
|
|
|
3464
3490
|
transition-duration: 150ms;
|
|
3465
3491
|
}
|
|
3466
3492
|
.c-switch-thumb[data-state=checked] {
|
|
3467
|
-
transform: translateX(20px);
|
|
3468
3493
|
--tw-bg-opacity: 1;
|
|
3469
3494
|
background-color: rgb(var(--c-color-green-500-400) / var(--tw-bg-opacity));
|
|
3470
3495
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -286,6 +286,7 @@ declare const Select: {
|
|
|
286
286
|
} & class_variance_authority.VariantProps<(props?: ({
|
|
287
287
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
288
288
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string> & {
|
|
289
|
+
triggerClassName?: string | undefined;
|
|
289
290
|
disabled?: boolean | undefined;
|
|
290
291
|
id?: string | undefined;
|
|
291
292
|
placeholder?: string | undefined;
|
|
@@ -446,8 +447,12 @@ type TooltipProps = TooltipStylesProps & Partial<Pick<RadixTooltip.TooltipConten
|
|
|
446
447
|
};
|
|
447
448
|
declare function Tooltip({ variant, children, content, side, align, defaultOpen, delayDuration, }: TooltipProps): JSX.Element;
|
|
448
449
|
|
|
449
|
-
type
|
|
450
|
-
declare
|
|
450
|
+
type SwitchStylesProps = VariantProps<typeof switchStyles>;
|
|
451
|
+
declare const switchStyles: (props?: ({
|
|
452
|
+
size?: "xs" | "sm" | null | undefined;
|
|
453
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
454
|
+
type SwitchProps = ComponentProps<typeof RadixSwitch.Root> & SwitchStylesProps;
|
|
455
|
+
declare function Switch({ size, ...props }: SwitchProps): JSX.Element;
|
|
451
456
|
|
|
452
457
|
declare const Icon: {
|
|
453
458
|
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" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "end" | "orientation" | "max" | "media" | "method" | "min" | "target" | "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>>;
|
package/dist/index.js
CHANGED
|
@@ -39536,13 +39536,13 @@ var selectTriggerStyles = (0, import_class_variance_authority17.cva)("c-select-t
|
|
|
39536
39536
|
}
|
|
39537
39537
|
});
|
|
39538
39538
|
var SelectContainer = (0, import_react111.forwardRef)(
|
|
39539
|
-
({ children, id, placeholder, disabled, size, ...delegated }, ref) => {
|
|
39539
|
+
({ children, id, placeholder, disabled, size, triggerClassName, ...delegated }, ref) => {
|
|
39540
39540
|
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(SelectPrimitives2.Root, {
|
|
39541
39541
|
...delegated,
|
|
39542
39542
|
children: [
|
|
39543
39543
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(SelectPrimitives2.Trigger, {
|
|
39544
39544
|
ref,
|
|
39545
|
-
className: selectTriggerStyles({ size }),
|
|
39545
|
+
className: selectTriggerStyles({ size, className: triggerClassName }),
|
|
39546
39546
|
disabled,
|
|
39547
39547
|
id,
|
|
39548
39548
|
children: [
|
|
@@ -39777,12 +39777,24 @@ toast.dismiss = import_sonner.toast.dismiss;
|
|
|
39777
39777
|
init_tooltip2();
|
|
39778
39778
|
|
|
39779
39779
|
// src/switch/switch.tsx
|
|
39780
|
+
var import_class_variance_authority21 = require("class-variance-authority");
|
|
39780
39781
|
var RadixSwitch = __toESM(require("@radix-ui/react-switch"));
|
|
39781
39782
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
39782
|
-
|
|
39783
|
+
var switchStyles = (0, import_class_variance_authority21.cva)(["c-switch-root"], {
|
|
39784
|
+
variants: {
|
|
39785
|
+
size: {
|
|
39786
|
+
xs: "c-switch-root-xs",
|
|
39787
|
+
sm: "c-switch-root-sm"
|
|
39788
|
+
}
|
|
39789
|
+
},
|
|
39790
|
+
defaultVariants: {
|
|
39791
|
+
size: "sm"
|
|
39792
|
+
}
|
|
39793
|
+
});
|
|
39794
|
+
function Switch2({ size, ...props }) {
|
|
39783
39795
|
return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(RadixSwitch.Root, {
|
|
39784
39796
|
...props,
|
|
39785
|
-
className:
|
|
39797
|
+
className: switchStyles({ size }),
|
|
39786
39798
|
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(RadixSwitch.Thumb, {
|
|
39787
39799
|
className: "c-switch-thumb"
|
|
39788
39800
|
})
|
package/dist/index.mjs
CHANGED
|
@@ -224,13 +224,13 @@ var selectTriggerStyles = cva4("c-select-trigger", {
|
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
var SelectContainer = forwardRef4(
|
|
227
|
-
({ children, id, placeholder, disabled, size, ...delegated }, ref) => {
|
|
227
|
+
({ children, id, placeholder, disabled, size, triggerClassName, ...delegated }, ref) => {
|
|
228
228
|
return /* @__PURE__ */ jsxs3(SelectPrimitives2.Root, {
|
|
229
229
|
...delegated,
|
|
230
230
|
children: [
|
|
231
231
|
/* @__PURE__ */ jsxs3(SelectPrimitives2.Trigger, {
|
|
232
232
|
ref,
|
|
233
|
-
className: selectTriggerStyles({ size }),
|
|
233
|
+
className: selectTriggerStyles({ size, className: triggerClassName }),
|
|
234
234
|
disabled,
|
|
235
235
|
id,
|
|
236
236
|
children: [
|
|
@@ -455,12 +455,24 @@ var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
|
|
|
455
455
|
toast.dismiss = sonnerToast.dismiss;
|
|
456
456
|
|
|
457
457
|
// src/switch/switch.tsx
|
|
458
|
+
import { cva as cva7 } from "class-variance-authority";
|
|
458
459
|
import * as RadixSwitch from "@radix-ui/react-switch";
|
|
459
460
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
460
|
-
|
|
461
|
+
var switchStyles = cva7(["c-switch-root"], {
|
|
462
|
+
variants: {
|
|
463
|
+
size: {
|
|
464
|
+
xs: "c-switch-root-xs",
|
|
465
|
+
sm: "c-switch-root-sm"
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
defaultVariants: {
|
|
469
|
+
size: "sm"
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
function Switch({ size, ...props }) {
|
|
461
473
|
return /* @__PURE__ */ jsx14(RadixSwitch.Root, {
|
|
462
474
|
...props,
|
|
463
|
-
className:
|
|
475
|
+
className: switchStyles({ size }),
|
|
464
476
|
children: /* @__PURE__ */ jsx14(RadixSwitch.Thumb, {
|
|
465
477
|
className: "c-switch-thumb"
|
|
466
478
|
})
|
|
@@ -1582,11 +1582,14 @@
|
|
|
1582
1582
|
}
|
|
1583
1583
|
|
|
1584
1584
|
/* src/dialog/dialog.css */
|
|
1585
|
+
:root {
|
|
1586
|
+
--dialog-z-index: 100;
|
|
1587
|
+
}
|
|
1585
1588
|
.c-dialog {
|
|
1586
1589
|
position: fixed;
|
|
1587
1590
|
left: 50%;
|
|
1588
1591
|
top: 50%;
|
|
1589
|
-
z-index:
|
|
1592
|
+
z-index: var(--dialog-z-index);
|
|
1590
1593
|
width: auto;
|
|
1591
1594
|
min-width: 25%;
|
|
1592
1595
|
max-width: 800px;
|
|
@@ -1608,7 +1611,7 @@
|
|
|
1608
1611
|
.c-dialog-overlay {
|
|
1609
1612
|
position: fixed;
|
|
1610
1613
|
inset: 0px;
|
|
1611
|
-
z-index:
|
|
1614
|
+
z-index: var(--dialog-z-index);
|
|
1612
1615
|
background-color: rgb(var(--c-color-overlay) / 0.3);
|
|
1613
1616
|
}
|
|
1614
1617
|
.c-dialog-icon-wrapper {
|
package/package.json
CHANGED
package/src/dialog/dialog.css
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--dialog-z-index: 100;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.c-dialog {
|
|
2
|
-
@apply fixed
|
|
6
|
+
@apply fixed
|
|
7
|
+
left-1/2 top-1/2
|
|
8
|
+
z-[--dialog-z-index]
|
|
9
|
+
w-auto min-w-[25%] max-w-[800px] rounded-lg bg-elevate p-14 leading-6 text-gray-500-400 shadow;
|
|
3
10
|
transform: translate(-50%, -50%);
|
|
4
11
|
|
|
5
12
|
&-overlay {
|
|
6
|
-
@apply fixed
|
|
13
|
+
@apply fixed
|
|
14
|
+
inset-0 z-[--dialog-z-index]
|
|
15
|
+
bg-overlay;
|
|
7
16
|
}
|
|
8
17
|
|
|
9
18
|
&-icon-wrapper {
|
|
@@ -21,16 +21,22 @@ const selectTriggerStyles = cva('c-select-trigger', {
|
|
|
21
21
|
export type SelectRef = HTMLButtonElement;
|
|
22
22
|
export type SelectProps = ComponentProps<typeof SelectPrimitives.Root> &
|
|
23
23
|
VariantProps<typeof selectTriggerStyles> & {
|
|
24
|
+
triggerClassName?: string;
|
|
24
25
|
disabled?: boolean;
|
|
25
26
|
id?: string;
|
|
26
27
|
placeholder?: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export const SelectContainer = forwardRef<SelectRef, SelectProps>(
|
|
30
|
-
({ children, id, placeholder, disabled, size, ...delegated }, ref) => {
|
|
31
|
+
({ children, id, placeholder, disabled, size, triggerClassName, ...delegated }, ref) => {
|
|
31
32
|
return (
|
|
32
33
|
<SelectPrimitives.Root {...delegated}>
|
|
33
|
-
<SelectPrimitives.Trigger
|
|
34
|
+
<SelectPrimitives.Trigger
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={selectTriggerStyles({ size, className: triggerClassName })}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
id={id}
|
|
39
|
+
>
|
|
34
40
|
<SelectPrimitives.Value placeholder={<span className="c-select-value">{placeholder ?? 'Select...'}</span>} />
|
|
35
41
|
<Icon.Arrow />
|
|
36
42
|
</SelectPrimitives.Trigger>
|
package/src/select/select.css
CHANGED
|
@@ -43,3 +43,9 @@
|
|
|
43
43
|
@apply bg-gray-50-900 outline-none;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
/*This is a workaround to handle z-index on dialog component that is also rendered in portal on the same level*/
|
|
48
|
+
/*Styles added to .c-dialog are added to parent div as inline styles, therefore ~ div > .c-select-content*/
|
|
49
|
+
.c-dialog ~ div > .c-select-content {
|
|
50
|
+
z-index: calc(var(--dialog-z-index) + 1);
|
|
51
|
+
}
|
package/src/switch/switch.css
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
.c-switch-root {
|
|
2
|
-
/* @apply radix-state-checked:border-[#528693] radix-state-checked:bg-neptune h-4 w-7 rounded-full border border-solid border-[#52869399] bg-[#9095a84d] p-0 focus:outline-none focus:ring-1 focus:ring-[#528693] focus:ring-offset-1 disabled:opacity-40; */
|
|
3
2
|
@apply relative h-6 w-11 rounded-full border border-solid border-purple-200-700 bg-purple-50-900 pl-0.5 transition-all hover:border-purple-300-600 focus:outline-none enabled:cursor-pointer disabled:opacity-40 data-[state=checked]:border-green-400-500 data-[state=checked]:bg-cyan-100-800;
|
|
3
|
+
|
|
4
|
+
&-sm {
|
|
5
|
+
@apply h-6 w-11;
|
|
6
|
+
|
|
7
|
+
.c-switch-thumb {
|
|
8
|
+
@apply h-4 w-4;
|
|
9
|
+
|
|
10
|
+
&[data-state='checked'] {
|
|
11
|
+
transform: translateX(20px);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-xs {
|
|
17
|
+
@apply h-5 w-9;
|
|
18
|
+
|
|
19
|
+
.c-switch-thumb {
|
|
20
|
+
@apply h-3.5 w-3.5;
|
|
21
|
+
|
|
22
|
+
&[data-state='checked'] {
|
|
23
|
+
transform: translateX(16px);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
4
27
|
}
|
|
5
28
|
|
|
6
29
|
.c-switch-thumb {
|
|
7
|
-
|
|
8
|
-
@apply block h-4 w-4 origin-center translate-x-1 rounded-full bg-purple-400-500 transition-all;
|
|
30
|
+
@apply block origin-center translate-x-1 rounded-full bg-purple-400-500 transition-all;
|
|
9
31
|
&[data-state='checked'] {
|
|
10
|
-
transform: translateX(20px);
|
|
11
32
|
@apply bg-green-500-400;
|
|
12
33
|
}
|
|
13
34
|
}
|
package/src/switch/switch.tsx
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
+
import { cva, VariantProps } from 'class-variance-authority';
|
|
2
3
|
import * as RadixSwitch from '@radix-ui/react-switch';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
type SwitchStylesProps = VariantProps<typeof switchStyles>;
|
|
6
|
+
const switchStyles = cva(['c-switch-root'], {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
xs: 'c-switch-root-xs',
|
|
10
|
+
sm: 'c-switch-root-sm',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: 'sm',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
5
17
|
|
|
6
|
-
export
|
|
18
|
+
export type SwitchProps = ComponentProps<typeof RadixSwitch.Root> & SwitchStylesProps;
|
|
19
|
+
|
|
20
|
+
export function Switch({ size, ...props }: SwitchProps) {
|
|
7
21
|
return (
|
|
8
|
-
<RadixSwitch.Root {...props} className=
|
|
22
|
+
<RadixSwitch.Root {...props} className={switchStyles({ size })}>
|
|
9
23
|
<RadixSwitch.Thumb className="c-switch-thumb" />
|
|
10
24
|
</RadixSwitch.Root>
|
|
11
25
|
);
|