@locus-ui/components 0.0.13 → 0.0.15
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/dist/index.css +208 -8
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +127 -3
- package/dist/index.d.ts +127 -3
- package/dist/index.js +381 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +421 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -21,11 +21,18 @@ function getComponentProps(props, ...propDefs) {
|
|
|
21
21
|
delete restProps[key];
|
|
22
22
|
if (prop.type === "boolean" || prop.type === "string" || prop.type === "number" || prop.type === "value | array" || prop.type === "reactNode" || prop.type === "function") {
|
|
23
23
|
extractedProps[key] = value;
|
|
24
|
-
if (prop.cssProperty
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (prop.cssProperty) {
|
|
25
|
+
if (value !== void 0 && value !== null) {
|
|
26
|
+
style = {
|
|
27
|
+
...style,
|
|
28
|
+
[prop.cssProperty]: prop.type === "boolean" ? value ? "1" : "0" : value
|
|
29
|
+
};
|
|
30
|
+
} else if (prop.default !== void 0) {
|
|
31
|
+
style = {
|
|
32
|
+
...style,
|
|
33
|
+
[prop.cssProperty]: prop.type === "boolean" ? prop.default ? "1" : "0" : prop.default
|
|
34
|
+
};
|
|
35
|
+
}
|
|
29
36
|
}
|
|
30
37
|
if (prop.dataAttr) {
|
|
31
38
|
if (value) dataAttrs[`data-${prop.dataAttr}`] = value;
|
|
@@ -1470,18 +1477,10 @@ var Text = React8.forwardRef(
|
|
|
1470
1477
|
props,
|
|
1471
1478
|
TextPropsDefs,
|
|
1472
1479
|
MarginPropDefs,
|
|
1473
|
-
PaddingPropDefs
|
|
1474
|
-
|
|
1475
|
-
return /* @__PURE__ */ jsx11(
|
|
1476
|
-
"p",
|
|
1477
|
-
{
|
|
1478
|
-
ref,
|
|
1479
|
-
...dataAttrs,
|
|
1480
|
-
className: clsx10("lcs-text", className),
|
|
1481
|
-
...rest,
|
|
1482
|
-
children
|
|
1483
|
-
}
|
|
1480
|
+
PaddingPropDefs,
|
|
1481
|
+
ColorPropDef
|
|
1484
1482
|
);
|
|
1483
|
+
return /* @__PURE__ */ jsx11("p", { ref, ...dataAttrs, className: clsx10("text", className), ...rest, children });
|
|
1485
1484
|
}
|
|
1486
1485
|
);
|
|
1487
1486
|
|
|
@@ -1710,7 +1709,8 @@ var Panel = React12.forwardRef((props, ref) => {
|
|
|
1710
1709
|
PaddingPropDefs,
|
|
1711
1710
|
SpacingPropDef,
|
|
1712
1711
|
RadiusPropDefs,
|
|
1713
|
-
RoundnessPropDef
|
|
1712
|
+
RoundnessPropDef,
|
|
1713
|
+
ColorPropDef
|
|
1714
1714
|
);
|
|
1715
1715
|
return /* @__PURE__ */ jsx15(
|
|
1716
1716
|
"div",
|
|
@@ -3094,17 +3094,364 @@ var Separator = (props) => {
|
|
|
3094
3094
|
};
|
|
3095
3095
|
Separator.displayName = "Separator";
|
|
3096
3096
|
|
|
3097
|
-
// src/components/
|
|
3098
|
-
import
|
|
3097
|
+
// src/components/switch/indicator/switch-indicator.tsx
|
|
3098
|
+
import clsx30 from "clsx";
|
|
3099
|
+
import React33 from "react";
|
|
3100
|
+
|
|
3101
|
+
// src/components/switch/switch-context.ts
|
|
3102
|
+
import React32 from "react";
|
|
3103
|
+
var SwitchContext = React32.createContext(
|
|
3104
|
+
null
|
|
3105
|
+
);
|
|
3106
|
+
function useSwitchContext() {
|
|
3107
|
+
const context = React32.useContext(SwitchContext);
|
|
3108
|
+
if (!context) {
|
|
3109
|
+
throw new Error("Switch components must be used within a Switch.Root");
|
|
3110
|
+
}
|
|
3111
|
+
return context;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
// src/components/switch/root/switch-root.props.ts
|
|
3115
|
+
var SwitchVariants = ["solid", "outlined", "muted"];
|
|
3116
|
+
var SwitchRootPropsDefs = {
|
|
3117
|
+
/**
|
|
3118
|
+
* Sets the variant style of the switch ("solid" or "outlined").
|
|
3119
|
+
*/
|
|
3120
|
+
variant: {
|
|
3121
|
+
type: "enum",
|
|
3122
|
+
values: SwitchVariants,
|
|
3123
|
+
dataAttr: "variant"
|
|
3124
|
+
},
|
|
3125
|
+
/**
|
|
3126
|
+
* Sets the checked state of the switch.
|
|
3127
|
+
*
|
|
3128
|
+
* When using an uncontrolled switch, use `defaultChecked` instead.
|
|
3129
|
+
* @default undefined
|
|
3130
|
+
*/
|
|
3131
|
+
checked: {
|
|
3132
|
+
type: "boolean",
|
|
3133
|
+
dataAttr: "checked"
|
|
3134
|
+
},
|
|
3135
|
+
/**
|
|
3136
|
+
* The value of the switch (checked state).
|
|
3137
|
+
*/
|
|
3138
|
+
value: {
|
|
3139
|
+
type: "boolean"
|
|
3140
|
+
},
|
|
3141
|
+
/**
|
|
3142
|
+
* Sets the default checked state of the switch.
|
|
3143
|
+
* @default undefined
|
|
3144
|
+
*/
|
|
3145
|
+
defaultChecked: {
|
|
3146
|
+
type: "boolean"
|
|
3147
|
+
},
|
|
3148
|
+
/**
|
|
3149
|
+
* Disables the switch component.
|
|
3150
|
+
* @default undefined
|
|
3151
|
+
*/
|
|
3152
|
+
disabled: {
|
|
3153
|
+
type: "boolean",
|
|
3154
|
+
dataAttr: "disabled"
|
|
3155
|
+
},
|
|
3156
|
+
/**
|
|
3157
|
+
* Makes the switch read-only.
|
|
3158
|
+
* @default undefined
|
|
3159
|
+
*/
|
|
3160
|
+
readonly: {
|
|
3161
|
+
type: "boolean",
|
|
3162
|
+
dataAttr: "readonly"
|
|
3163
|
+
},
|
|
3164
|
+
/**
|
|
3165
|
+
* Marks the switch as required.
|
|
3166
|
+
* @default undefined
|
|
3167
|
+
*/
|
|
3168
|
+
required: {
|
|
3169
|
+
type: "boolean",
|
|
3170
|
+
dataAttr: "required"
|
|
3171
|
+
},
|
|
3172
|
+
/**
|
|
3173
|
+
* Sets the name attribute of the switch input for form control.
|
|
3174
|
+
* @default undefined
|
|
3175
|
+
*/
|
|
3176
|
+
name: {
|
|
3177
|
+
type: "string"
|
|
3178
|
+
},
|
|
3179
|
+
/**
|
|
3180
|
+
* Callback fired when the checked state changes.
|
|
3181
|
+
*
|
|
3182
|
+
* @param value - The new checked state.
|
|
3183
|
+
*/
|
|
3184
|
+
onCheckedChange: {
|
|
3185
|
+
type: "function"
|
|
3186
|
+
}
|
|
3187
|
+
};
|
|
3188
|
+
|
|
3189
|
+
// src/components/switch/indicator/switch-indicator.props.ts
|
|
3190
|
+
var SwitchIndicatorPropDefs = {
|
|
3191
|
+
/**
|
|
3192
|
+
* Sets the variant style of the switch ("solid" or "outlined").
|
|
3193
|
+
*/
|
|
3194
|
+
variant: {
|
|
3195
|
+
type: "enum",
|
|
3196
|
+
values: SwitchVariants,
|
|
3197
|
+
dataAttr: "variant"
|
|
3198
|
+
}
|
|
3199
|
+
};
|
|
3200
|
+
|
|
3201
|
+
// src/components/switch/indicator/switch-indicator.tsx
|
|
3099
3202
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
3100
|
-
var
|
|
3101
|
-
const
|
|
3203
|
+
var SwitchIndicator = React33.forwardRef((props, ref) => {
|
|
3204
|
+
const {
|
|
3205
|
+
value,
|
|
3206
|
+
setValue,
|
|
3207
|
+
hovered,
|
|
3208
|
+
color,
|
|
3209
|
+
disabled,
|
|
3210
|
+
readonly,
|
|
3211
|
+
focused,
|
|
3212
|
+
variant: contextVariant
|
|
3213
|
+
} = useSwitchContext();
|
|
3214
|
+
const { size, variant, className, style, dataAttrs } = getComponentProps(
|
|
3215
|
+
props,
|
|
3216
|
+
SwitchIndicatorPropDefs,
|
|
3217
|
+
SizePropDef
|
|
3218
|
+
);
|
|
3219
|
+
const indicatorVariant = variant || contextVariant;
|
|
3220
|
+
const handleKeyDown = (event) => {
|
|
3221
|
+
if (disabled || readonly) return;
|
|
3222
|
+
if (event.key === " " || event.key === "Enter") {
|
|
3223
|
+
event.preventDefault();
|
|
3224
|
+
setValue(!value);
|
|
3225
|
+
}
|
|
3226
|
+
};
|
|
3227
|
+
const indicatorProps = {
|
|
3228
|
+
...value && { "data-checked": true },
|
|
3229
|
+
...disabled && { "data-disabled": true },
|
|
3230
|
+
...readonly && { "data-readonly": true },
|
|
3231
|
+
...(variant || contextVariant) && { "data-variant": indicatorVariant }
|
|
3232
|
+
};
|
|
3233
|
+
return /* @__PURE__ */ jsx34(
|
|
3234
|
+
"div",
|
|
3235
|
+
{
|
|
3236
|
+
ref,
|
|
3237
|
+
style,
|
|
3238
|
+
role: "switch",
|
|
3239
|
+
"data-size": size,
|
|
3240
|
+
"data-color": color,
|
|
3241
|
+
"data-hovered": hovered,
|
|
3242
|
+
"aria-disabled": disabled,
|
|
3243
|
+
"data-focused": focused,
|
|
3244
|
+
"aria-readonly": readonly,
|
|
3245
|
+
onKeyDown: handleKeyDown,
|
|
3246
|
+
tabIndex: disabled || readonly ? -1 : 0,
|
|
3247
|
+
className: clsx30("switch-indicator", className),
|
|
3248
|
+
...indicatorProps,
|
|
3249
|
+
...dataAttrs
|
|
3250
|
+
}
|
|
3251
|
+
);
|
|
3252
|
+
});
|
|
3253
|
+
SwitchIndicator.displayName = "Switch.Indicator";
|
|
3254
|
+
|
|
3255
|
+
// src/components/switch/label/switch-label.tsx
|
|
3256
|
+
import clsx31 from "clsx";
|
|
3257
|
+
import React34 from "react";
|
|
3258
|
+
|
|
3259
|
+
// src/components/switch/label/switch-label.props.ts
|
|
3260
|
+
var labelPositions3 = ["top", "left", "right", "bottom"];
|
|
3261
|
+
var SwitchLabelPropDefs = {
|
|
3262
|
+
/**
|
|
3263
|
+
* Sets the position of the label relative to the switch.
|
|
3264
|
+
*
|
|
3265
|
+
* @example position="left" // positions the label to the left of the switch
|
|
3266
|
+
* @example position="top" // positions the label above the switch
|
|
3267
|
+
*/
|
|
3268
|
+
position: {
|
|
3269
|
+
type: "enum",
|
|
3270
|
+
values: labelPositions3,
|
|
3271
|
+
dataAttr: "position"
|
|
3272
|
+
}
|
|
3273
|
+
};
|
|
3274
|
+
|
|
3275
|
+
// src/components/switch/label/switch-label.tsx
|
|
3276
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3277
|
+
var SwitchLabel = React34.forwardRef(
|
|
3278
|
+
(props, ref) => {
|
|
3279
|
+
const context = useSwitchContext();
|
|
3280
|
+
const { className, children, position } = getComponentProps(
|
|
3281
|
+
props,
|
|
3282
|
+
SwitchLabelPropDefs
|
|
3283
|
+
);
|
|
3284
|
+
React34.useLayoutEffect(() => {
|
|
3285
|
+
context.setLabelPosition?.(position ?? "right");
|
|
3286
|
+
}, [position, context.setLabelPosition]);
|
|
3287
|
+
return /* @__PURE__ */ jsx35(
|
|
3288
|
+
"label",
|
|
3289
|
+
{
|
|
3290
|
+
ref,
|
|
3291
|
+
htmlFor: context.labelId,
|
|
3292
|
+
className: clsx31("switch-label", className),
|
|
3293
|
+
...position && { [`data-position`]: position },
|
|
3294
|
+
children: /* @__PURE__ */ jsx35(Text, { children })
|
|
3295
|
+
}
|
|
3296
|
+
);
|
|
3297
|
+
}
|
|
3298
|
+
);
|
|
3299
|
+
SwitchLabel.displayName = "Switch.Label";
|
|
3300
|
+
|
|
3301
|
+
// src/components/switch/root/switch-root.tsx
|
|
3302
|
+
import clsx32 from "clsx";
|
|
3303
|
+
import {
|
|
3304
|
+
isValidElement as isValidElement5,
|
|
3305
|
+
useId as useId3,
|
|
3306
|
+
useMemo as useMemo7,
|
|
3307
|
+
useState as useState7
|
|
3308
|
+
} from "react";
|
|
3309
|
+
import { jsx as jsx36, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3310
|
+
var ALLOWED_CHILDREN7 = [
|
|
3311
|
+
SwitchLabel.displayName,
|
|
3312
|
+
SwitchIndicator.displayName
|
|
3313
|
+
];
|
|
3314
|
+
var SwitchRoot = (props) => {
|
|
3315
|
+
const {
|
|
3316
|
+
name,
|
|
3317
|
+
size,
|
|
3318
|
+
color,
|
|
3319
|
+
variant,
|
|
3320
|
+
checked,
|
|
3321
|
+
dataAttrs,
|
|
3322
|
+
onCheckedChange,
|
|
3323
|
+
value: valueProp,
|
|
3324
|
+
disabled = false,
|
|
3325
|
+
required = false,
|
|
3326
|
+
readonly = false,
|
|
3327
|
+
defaultChecked = false
|
|
3328
|
+
} = getComponentProps(
|
|
3329
|
+
props,
|
|
3330
|
+
SwitchRootPropsDefs,
|
|
3331
|
+
AlignPropDef,
|
|
3332
|
+
MarginPropDefs,
|
|
3333
|
+
SizePropDef,
|
|
3334
|
+
ColorPropDef
|
|
3335
|
+
);
|
|
3336
|
+
const [value, setValue] = useControllableState({
|
|
3337
|
+
value: valueProp || checked,
|
|
3338
|
+
defaultValue: defaultChecked,
|
|
3339
|
+
onChange: onCheckedChange
|
|
3340
|
+
});
|
|
3341
|
+
const labelId = useId3();
|
|
3342
|
+
const [labelPosition, setLabelPosition] = useState7("right");
|
|
3343
|
+
const [hovered, setHovered] = useState7(false);
|
|
3344
|
+
const [focused, setFocused] = useState7(false);
|
|
3345
|
+
const validChildren = filterChildren(props.children, ALLOWED_CHILDREN7, {
|
|
3346
|
+
parentDisplayName: SwitchRoot.displayName
|
|
3347
|
+
});
|
|
3348
|
+
const { restDataAttrs } = useMemo7(() => {
|
|
3349
|
+
const { ["data-color"]: _, ...restDataAttrs2 } = dataAttrs || {};
|
|
3350
|
+
return { restDataAttrs: restDataAttrs2 };
|
|
3351
|
+
}, [dataAttrs]);
|
|
3352
|
+
const { indicator, otherChildren } = useMemo7(() => {
|
|
3353
|
+
const indicatorIndex = validChildren.findIndex(
|
|
3354
|
+
(child) => isValidElement5(child) && child.type.displayName === SwitchIndicator.displayName
|
|
3355
|
+
);
|
|
3356
|
+
if (indicatorIndex > -1) {
|
|
3357
|
+
return {
|
|
3358
|
+
indicator: validChildren[indicatorIndex],
|
|
3359
|
+
otherChildren: validChildren.filter((_, i) => i !== indicatorIndex)
|
|
3360
|
+
};
|
|
3361
|
+
}
|
|
3362
|
+
return {
|
|
3363
|
+
indicator: /* @__PURE__ */ jsx36(SwitchIndicator, { size }),
|
|
3364
|
+
otherChildren: validChildren
|
|
3365
|
+
};
|
|
3366
|
+
}, [validChildren, size]);
|
|
3367
|
+
const contextValue = useMemo7(
|
|
3368
|
+
() => ({
|
|
3369
|
+
name,
|
|
3370
|
+
value,
|
|
3371
|
+
color,
|
|
3372
|
+
setValue,
|
|
3373
|
+
onCheckedChange,
|
|
3374
|
+
labelId,
|
|
3375
|
+
labelPosition,
|
|
3376
|
+
setLabelPosition,
|
|
3377
|
+
variant,
|
|
3378
|
+
hovered,
|
|
3379
|
+
setHovered,
|
|
3380
|
+
focused,
|
|
3381
|
+
setFocused,
|
|
3382
|
+
disabled,
|
|
3383
|
+
readonly,
|
|
3384
|
+
required
|
|
3385
|
+
}),
|
|
3386
|
+
[
|
|
3387
|
+
name,
|
|
3388
|
+
value,
|
|
3389
|
+
color,
|
|
3390
|
+
onCheckedChange,
|
|
3391
|
+
setValue,
|
|
3392
|
+
labelId,
|
|
3393
|
+
labelPosition,
|
|
3394
|
+
hovered,
|
|
3395
|
+
focused,
|
|
3396
|
+
disabled,
|
|
3397
|
+
readonly,
|
|
3398
|
+
required
|
|
3399
|
+
]
|
|
3400
|
+
);
|
|
3401
|
+
const handleClick = () => {
|
|
3402
|
+
if (disabled || readonly) return;
|
|
3403
|
+
setValue(!value);
|
|
3404
|
+
};
|
|
3405
|
+
return /* @__PURE__ */ jsx36(SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs9(
|
|
3406
|
+
"div",
|
|
3407
|
+
{
|
|
3408
|
+
className: clsx32("switch-root", props.className),
|
|
3409
|
+
onClick: () => handleClick(),
|
|
3410
|
+
onFocus: () => setFocused(true),
|
|
3411
|
+
onBlur: () => setFocused(false),
|
|
3412
|
+
onMouseEnter: () => setHovered(true),
|
|
3413
|
+
onMouseLeave: () => setHovered(false),
|
|
3414
|
+
...restDataAttrs,
|
|
3415
|
+
children: [
|
|
3416
|
+
/* @__PURE__ */ jsx36(
|
|
3417
|
+
"div",
|
|
3418
|
+
{
|
|
3419
|
+
className: "switch-container",
|
|
3420
|
+
"data-size": size,
|
|
3421
|
+
"data-color": color,
|
|
3422
|
+
"data-checked": value,
|
|
3423
|
+
"data-hovered": hovered,
|
|
3424
|
+
"data-focused": focused,
|
|
3425
|
+
"data-variant": variant,
|
|
3426
|
+
children: indicator
|
|
3427
|
+
}
|
|
3428
|
+
),
|
|
3429
|
+
otherChildren,
|
|
3430
|
+
name && /* @__PURE__ */ jsx36("input", { type: "hidden", name, value: String(value) })
|
|
3431
|
+
]
|
|
3432
|
+
}
|
|
3433
|
+
) });
|
|
3434
|
+
};
|
|
3435
|
+
SwitchRoot.displayName = "Switch";
|
|
3436
|
+
|
|
3437
|
+
// src/components/switch/switch.tsx
|
|
3438
|
+
var Switch = Object.assign(SwitchRoot, {
|
|
3439
|
+
Root: SwitchRoot,
|
|
3440
|
+
Label: SwitchLabel,
|
|
3441
|
+
Indicator: SwitchIndicator
|
|
3442
|
+
});
|
|
3443
|
+
|
|
3444
|
+
// src/components/theme/theme.tsx
|
|
3445
|
+
import * as React36 from "react";
|
|
3446
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3447
|
+
var Theme = React36.forwardRef((props, ref) => {
|
|
3448
|
+
const context = React36.useContext(ThemeContext);
|
|
3102
3449
|
const isRoot = context === void 0;
|
|
3103
|
-
if (isRoot) return /* @__PURE__ */
|
|
3104
|
-
return /* @__PURE__ */
|
|
3450
|
+
if (isRoot) return /* @__PURE__ */ jsx37(ThemeRoot, { ...props, ref });
|
|
3451
|
+
return /* @__PURE__ */ jsx37(ThemeSub, { ...props, ref });
|
|
3105
3452
|
});
|
|
3106
3453
|
Theme.displayName = "Theme";
|
|
3107
|
-
var ThemeRoot =
|
|
3454
|
+
var ThemeRoot = React36.forwardRef((props, ref) => {
|
|
3108
3455
|
const {
|
|
3109
3456
|
appearance: themeAppearance,
|
|
3110
3457
|
radius: themeRadius,
|
|
@@ -3113,15 +3460,15 @@ var ThemeRoot = React32.forwardRef((props, ref) => {
|
|
|
3113
3460
|
children,
|
|
3114
3461
|
...rest
|
|
3115
3462
|
} = props;
|
|
3116
|
-
const [appearance, setAppearance] =
|
|
3463
|
+
const [appearance, setAppearance] = React36.useState(
|
|
3117
3464
|
themeAppearance ?? "light"
|
|
3118
3465
|
);
|
|
3119
|
-
const [radius, setRadius] =
|
|
3120
|
-
const [roundness2, setRoundness] =
|
|
3466
|
+
const [radius, setRadius] = React36.useState(themeRadius ?? "md");
|
|
3467
|
+
const [roundness2, setRoundness] = React36.useState(
|
|
3121
3468
|
themeRoundness ?? "3"
|
|
3122
3469
|
);
|
|
3123
|
-
const [spacing, setSpacing] =
|
|
3124
|
-
const value =
|
|
3470
|
+
const [spacing, setSpacing] = React36.useState(themeSpacing ?? "md");
|
|
3471
|
+
const value = React36.useMemo(
|
|
3125
3472
|
() => ({
|
|
3126
3473
|
appearance,
|
|
3127
3474
|
radius,
|
|
@@ -3134,7 +3481,7 @@ var ThemeRoot = React32.forwardRef((props, ref) => {
|
|
|
3134
3481
|
}),
|
|
3135
3482
|
[appearance, radius, roundness2, spacing]
|
|
3136
3483
|
);
|
|
3137
|
-
return /* @__PURE__ */
|
|
3484
|
+
return /* @__PURE__ */ jsx37(ThemeContext.Provider, { value, children: /* @__PURE__ */ jsx37(
|
|
3138
3485
|
"div",
|
|
3139
3486
|
{
|
|
3140
3487
|
ref,
|
|
@@ -3148,8 +3495,8 @@ var ThemeRoot = React32.forwardRef((props, ref) => {
|
|
|
3148
3495
|
) });
|
|
3149
3496
|
});
|
|
3150
3497
|
ThemeRoot.displayName = "ThemeRoot";
|
|
3151
|
-
var ThemeSub =
|
|
3152
|
-
const context =
|
|
3498
|
+
var ThemeSub = React36.forwardRef((props, ref) => {
|
|
3499
|
+
const context = React36.useContext(ThemeContext);
|
|
3153
3500
|
const {
|
|
3154
3501
|
appearance,
|
|
3155
3502
|
radius,
|
|
@@ -3172,7 +3519,7 @@ var ThemeSub = React32.forwardRef((props, ref) => {
|
|
|
3172
3519
|
onRoundnessChange: context.onRoundnessChange,
|
|
3173
3520
|
onSpacingChange: context.onSpacingChange
|
|
3174
3521
|
};
|
|
3175
|
-
return /* @__PURE__ */
|
|
3522
|
+
return /* @__PURE__ */ jsx37(ThemeContext.Provider, { value: contextProps, children: /* @__PURE__ */ jsx37(
|
|
3176
3523
|
"div",
|
|
3177
3524
|
{
|
|
3178
3525
|
ref,
|
|
@@ -3189,8 +3536,8 @@ var ThemeSub = React32.forwardRef((props, ref) => {
|
|
|
3189
3536
|
ThemeSub.displayName = "ThemeSub";
|
|
3190
3537
|
|
|
3191
3538
|
// src/components/theme/theme-control.tsx
|
|
3192
|
-
import { useEffect as useEffect7, useState as
|
|
3193
|
-
import { jsx as
|
|
3539
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
3540
|
+
import { jsx as jsx38, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3194
3541
|
function ThemeControl({ position = "bottom" }) {
|
|
3195
3542
|
const {
|
|
3196
3543
|
appearance,
|
|
@@ -3202,7 +3549,7 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3202
3549
|
spacing,
|
|
3203
3550
|
onSpacingChange
|
|
3204
3551
|
} = useTheme();
|
|
3205
|
-
const [visible, setVisible] =
|
|
3552
|
+
const [visible, setVisible] = useState9(false);
|
|
3206
3553
|
useEffect7(() => {
|
|
3207
3554
|
function handleKeyDown(event) {
|
|
3208
3555
|
if (event.altKey && event.code === "KeyT") {
|
|
@@ -3213,85 +3560,85 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3213
3560
|
document.addEventListener("keydown", handleKeyDown);
|
|
3214
3561
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
3215
3562
|
}, [visible]);
|
|
3216
|
-
return /* @__PURE__ */
|
|
3563
|
+
return /* @__PURE__ */ jsx38(Portal.Root, { open: visible, onOpenChange: setVisible, children: /* @__PURE__ */ jsx38(Portal.Content, { position, children: /* @__PURE__ */ jsxs10(
|
|
3217
3564
|
Box,
|
|
3218
3565
|
{
|
|
3219
3566
|
m: "4",
|
|
3220
3567
|
p: "4",
|
|
3221
3568
|
className: "flex flex-col gap-2 border-[rgba(var(--border-color), 0.6)]",
|
|
3222
3569
|
children: [
|
|
3223
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsxs10(
|
|
3224
3571
|
Select.Root,
|
|
3225
3572
|
{
|
|
3226
3573
|
variant: "solid",
|
|
3227
3574
|
value: appearance,
|
|
3228
3575
|
onValueChange: (change) => onAppearanceChange?.(change),
|
|
3229
3576
|
children: [
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3577
|
+
/* @__PURE__ */ jsx38(Select.Label, { position: "inside", children: "Theme Settings" }),
|
|
3578
|
+
/* @__PURE__ */ jsx38(Select.Trigger, {}),
|
|
3579
|
+
/* @__PURE__ */ jsxs10(Select.Content, { children: [
|
|
3580
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "light", children: "Light" }),
|
|
3581
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "dark", children: "Dark" })
|
|
3235
3582
|
] })
|
|
3236
3583
|
]
|
|
3237
3584
|
}
|
|
3238
3585
|
),
|
|
3239
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsxs10(
|
|
3240
3587
|
Select.Root,
|
|
3241
3588
|
{
|
|
3242
3589
|
variant: "solid",
|
|
3243
3590
|
value: radius,
|
|
3244
3591
|
onValueChange: (change) => onRadiusChange?.(change),
|
|
3245
3592
|
children: [
|
|
3246
|
-
/* @__PURE__ */
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
/* @__PURE__ */
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
/* @__PURE__ */
|
|
3252
|
-
/* @__PURE__ */
|
|
3253
|
-
/* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3593
|
+
/* @__PURE__ */ jsx38(Select.Label, { position: "inside", children: "Radius" }),
|
|
3594
|
+
/* @__PURE__ */ jsx38(Select.Trigger, {}),
|
|
3595
|
+
/* @__PURE__ */ jsxs10(Select.Content, { children: [
|
|
3596
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "none", children: "None" }),
|
|
3597
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "xs", children: "XS" }),
|
|
3598
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "sm", children: "SM" }),
|
|
3599
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "md", children: "MD" }),
|
|
3600
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "lg", children: "LG" }),
|
|
3601
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "xl", children: "XL" }),
|
|
3602
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "full", children: "FULL" })
|
|
3256
3603
|
] })
|
|
3257
3604
|
]
|
|
3258
3605
|
}
|
|
3259
3606
|
),
|
|
3260
|
-
/* @__PURE__ */
|
|
3607
|
+
/* @__PURE__ */ jsxs10(
|
|
3261
3608
|
Select.Root,
|
|
3262
3609
|
{
|
|
3263
3610
|
variant: "solid",
|
|
3264
3611
|
value: roundness2,
|
|
3265
3612
|
onValueChange: (change) => onRoundnessChange?.(change),
|
|
3266
3613
|
children: [
|
|
3267
|
-
/* @__PURE__ */
|
|
3268
|
-
/* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
3271
|
-
/* @__PURE__ */
|
|
3272
|
-
/* @__PURE__ */
|
|
3273
|
-
/* @__PURE__ */
|
|
3274
|
-
/* @__PURE__ */
|
|
3275
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx38(Select.Label, { className: "min-w-40!", position: "inside", children: "Roundness" }),
|
|
3615
|
+
/* @__PURE__ */ jsx38(Select.Trigger, {}),
|
|
3616
|
+
/* @__PURE__ */ jsxs10(Select.Content, { children: [
|
|
3617
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "1", children: "1" }),
|
|
3618
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "2", children: "2" }),
|
|
3619
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "3", children: "3" }),
|
|
3620
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "4", children: "4" }),
|
|
3621
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "5", children: "5" }),
|
|
3622
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "6", children: "6" })
|
|
3276
3623
|
] })
|
|
3277
3624
|
]
|
|
3278
3625
|
}
|
|
3279
3626
|
),
|
|
3280
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ jsxs10(
|
|
3281
3628
|
Select.Root,
|
|
3282
3629
|
{
|
|
3283
3630
|
variant: "solid",
|
|
3284
3631
|
value: spacing,
|
|
3285
3632
|
onValueChange: (change) => onSpacingChange?.(change),
|
|
3286
3633
|
children: [
|
|
3287
|
-
/* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3289
|
-
/* @__PURE__ */
|
|
3290
|
-
/* @__PURE__ */
|
|
3291
|
-
/* @__PURE__ */
|
|
3292
|
-
/* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx38(Select.Label, { position: "inside", children: "Spacing" }),
|
|
3635
|
+
/* @__PURE__ */ jsx38(Select.Trigger, {}),
|
|
3636
|
+
/* @__PURE__ */ jsxs10(Select.Content, { children: [
|
|
3637
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "xs", children: "XS" }),
|
|
3638
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "sm", children: "SM" }),
|
|
3639
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "md", children: "MD" }),
|
|
3640
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "lg", children: "LG" }),
|
|
3641
|
+
/* @__PURE__ */ jsx38(Select.Item, { value: "xl", children: "XL" })
|
|
3295
3642
|
] })
|
|
3296
3643
|
]
|
|
3297
3644
|
}
|
|
@@ -3312,6 +3659,7 @@ export {
|
|
|
3312
3659
|
ProgressBar,
|
|
3313
3660
|
Select,
|
|
3314
3661
|
Separator,
|
|
3662
|
+
Switch,
|
|
3315
3663
|
Text,
|
|
3316
3664
|
Theme,
|
|
3317
3665
|
ThemeControl,
|