@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.js
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;
|
|
@@ -87,7 +94,7 @@ function getComponentProps(props, ...propDefs) {
|
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
// src/components/accordion/accordion-context.ts
|
|
90
|
-
var _react = require('react'); var React2 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react); var React17 = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React16 = _interopRequireWildcard(_react); var React19 = _interopRequireWildcard(_react); var React18 = _interopRequireWildcard(_react); var React25 = _interopRequireWildcard(_react); var React22 = _interopRequireWildcard(_react); var React23 = _interopRequireWildcard(_react); var React24 = _interopRequireWildcard(_react); var React26 = _interopRequireWildcard(_react); var React27 = _interopRequireWildcard(_react); var React28 = _interopRequireWildcard(_react); var React30 = _interopRequireWildcard(_react); var React29 = _interopRequireWildcard(_react); var React31 = _interopRequireWildcard(_react); var
|
|
97
|
+
var _react = require('react'); var React2 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react); var React17 = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React16 = _interopRequireWildcard(_react); var React19 = _interopRequireWildcard(_react); var React18 = _interopRequireWildcard(_react); var React25 = _interopRequireWildcard(_react); var React22 = _interopRequireWildcard(_react); var React23 = _interopRequireWildcard(_react); var React24 = _interopRequireWildcard(_react); var React26 = _interopRequireWildcard(_react); var React27 = _interopRequireWildcard(_react); var React28 = _interopRequireWildcard(_react); var React30 = _interopRequireWildcard(_react); var React29 = _interopRequireWildcard(_react); var React31 = _interopRequireWildcard(_react); var React36 = _interopRequireWildcard(_react);
|
|
91
98
|
var AccordionContext = React2.default.createContext(null);
|
|
92
99
|
function useAccordionContext() {
|
|
93
100
|
const context = React2.default.useContext(AccordionContext);
|
|
@@ -1470,18 +1477,10 @@ var Text = React2.default.forwardRef(
|
|
|
1470
1477
|
props,
|
|
1471
1478
|
TextPropsDefs,
|
|
1472
1479
|
MarginPropDefs,
|
|
1473
|
-
PaddingPropDefs
|
|
1474
|
-
|
|
1475
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1476
|
-
"p",
|
|
1477
|
-
{
|
|
1478
|
-
ref,
|
|
1479
|
-
...dataAttrs,
|
|
1480
|
-
className: _clsx2.default.call(void 0, "lcs-text", className),
|
|
1481
|
-
...rest,
|
|
1482
|
-
children
|
|
1483
|
-
}
|
|
1480
|
+
PaddingPropDefs,
|
|
1481
|
+
ColorPropDef
|
|
1484
1482
|
);
|
|
1483
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ref, ...dataAttrs, className: _clsx2.default.call(void 0, "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__ */ _jsxruntime.jsx.call(void 0,
|
|
1716
1716
|
"div",
|
|
@@ -3094,17 +3094,364 @@ var Separator = (props) => {
|
|
|
3094
3094
|
};
|
|
3095
3095
|
Separator.displayName = "Separator";
|
|
3096
3096
|
|
|
3097
|
+
// src/components/switch/indicator/switch-indicator.tsx
|
|
3098
|
+
|
|
3099
|
+
|
|
3100
|
+
|
|
3101
|
+
// src/components/switch/switch-context.ts
|
|
3102
|
+
|
|
3103
|
+
var SwitchContext = React2.default.createContext(
|
|
3104
|
+
null
|
|
3105
|
+
);
|
|
3106
|
+
function useSwitchContext() {
|
|
3107
|
+
const context = React2.default.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
|
|
3202
|
+
|
|
3203
|
+
var SwitchIndicator = React2.default.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__ */ _jsxruntime.jsx.call(void 0,
|
|
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: _clsx2.default.call(void 0, "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
|
+
|
|
3257
|
+
|
|
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
|
+
|
|
3277
|
+
var SwitchLabel = React2.default.forwardRef(
|
|
3278
|
+
(props, ref) => {
|
|
3279
|
+
const context = useSwitchContext();
|
|
3280
|
+
const { className, children, position } = getComponentProps(
|
|
3281
|
+
props,
|
|
3282
|
+
SwitchLabelPropDefs
|
|
3283
|
+
);
|
|
3284
|
+
React2.default.useLayoutEffect(() => {
|
|
3285
|
+
_optionalChain([context, 'access', _50 => _50.setLabelPosition, 'optionalCall', _51 => _51(_nullishCoalesce(position, () => ( "right")))]);
|
|
3286
|
+
}, [position, context.setLabelPosition]);
|
|
3287
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3288
|
+
"label",
|
|
3289
|
+
{
|
|
3290
|
+
ref,
|
|
3291
|
+
htmlFor: context.labelId,
|
|
3292
|
+
className: _clsx2.default.call(void 0, "switch-label", className),
|
|
3293
|
+
...position && { [`data-position`]: position },
|
|
3294
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { children })
|
|
3295
|
+
}
|
|
3296
|
+
);
|
|
3297
|
+
}
|
|
3298
|
+
);
|
|
3299
|
+
SwitchLabel.displayName = "Switch.Label";
|
|
3300
|
+
|
|
3301
|
+
// src/components/switch/root/switch-root.tsx
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
|
|
3307
|
+
|
|
3308
|
+
|
|
3309
|
+
|
|
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 = _react.useId.call(void 0, );
|
|
3342
|
+
const [labelPosition, setLabelPosition] = _react.useState.call(void 0, "right");
|
|
3343
|
+
const [hovered, setHovered] = _react.useState.call(void 0, false);
|
|
3344
|
+
const [focused, setFocused] = _react.useState.call(void 0, false);
|
|
3345
|
+
const validChildren = filterChildren(props.children, ALLOWED_CHILDREN7, {
|
|
3346
|
+
parentDisplayName: SwitchRoot.displayName
|
|
3347
|
+
});
|
|
3348
|
+
const { restDataAttrs } = _react.useMemo.call(void 0, () => {
|
|
3349
|
+
const { ["data-color"]: _, ...restDataAttrs2 } = dataAttrs || {};
|
|
3350
|
+
return { restDataAttrs: restDataAttrs2 };
|
|
3351
|
+
}, [dataAttrs]);
|
|
3352
|
+
const { indicator, otherChildren } = _react.useMemo.call(void 0, () => {
|
|
3353
|
+
const indicatorIndex = validChildren.findIndex(
|
|
3354
|
+
(child) => _react.isValidElement.call(void 0, 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__ */ _jsxruntime.jsx.call(void 0, SwitchIndicator, { size }),
|
|
3364
|
+
otherChildren: validChildren
|
|
3365
|
+
};
|
|
3366
|
+
}, [validChildren, size]);
|
|
3367
|
+
const contextValue = _react.useMemo.call(void 0,
|
|
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__ */ _jsxruntime.jsx.call(void 0, SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3406
|
+
"div",
|
|
3407
|
+
{
|
|
3408
|
+
className: _clsx2.default.call(void 0, "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__ */ _jsxruntime.jsx.call(void 0,
|
|
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__ */ _jsxruntime.jsx.call(void 0, "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
|
+
|
|
3097
3444
|
// src/components/theme/theme.tsx
|
|
3098
3445
|
|
|
3099
3446
|
|
|
3100
|
-
var Theme =
|
|
3101
|
-
const context =
|
|
3447
|
+
var Theme = React36.forwardRef((props, ref) => {
|
|
3448
|
+
const context = React36.useContext(ThemeContext);
|
|
3102
3449
|
const isRoot = context === void 0;
|
|
3103
3450
|
if (isRoot) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThemeRoot, { ...props, ref });
|
|
3104
3451
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 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
|
_nullishCoalesce(themeAppearance, () => ( "light"))
|
|
3118
3465
|
);
|
|
3119
|
-
const [radius, setRadius] =
|
|
3120
|
-
const [roundness2, setRoundness] =
|
|
3466
|
+
const [radius, setRadius] = React36.useState(_nullishCoalesce(themeRadius, () => ( "md")));
|
|
3467
|
+
const [roundness2, setRoundness] = React36.useState(
|
|
3121
3468
|
_nullishCoalesce(themeRoundness, () => ( "3"))
|
|
3122
3469
|
);
|
|
3123
|
-
const [spacing, setSpacing] =
|
|
3124
|
-
const value =
|
|
3470
|
+
const [spacing, setSpacing] = React36.useState(_nullishCoalesce(themeSpacing, () => ( "md")));
|
|
3471
|
+
const value = React36.useMemo(
|
|
3125
3472
|
() => ({
|
|
3126
3473
|
appearance,
|
|
3127
3474
|
radius,
|
|
@@ -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,
|
|
@@ -3225,7 +3572,7 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3225
3572
|
{
|
|
3226
3573
|
variant: "solid",
|
|
3227
3574
|
value: appearance,
|
|
3228
|
-
onValueChange: (change) => _optionalChain([onAppearanceChange, 'optionalCall',
|
|
3575
|
+
onValueChange: (change) => _optionalChain([onAppearanceChange, 'optionalCall', _52 => _52(change)]),
|
|
3229
3576
|
children: [
|
|
3230
3577
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Label, { position: "inside", children: "Theme Settings" }),
|
|
3231
3578
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Trigger, {}),
|
|
@@ -3241,7 +3588,7 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3241
3588
|
{
|
|
3242
3589
|
variant: "solid",
|
|
3243
3590
|
value: radius,
|
|
3244
|
-
onValueChange: (change) => _optionalChain([onRadiusChange, 'optionalCall',
|
|
3591
|
+
onValueChange: (change) => _optionalChain([onRadiusChange, 'optionalCall', _53 => _53(change)]),
|
|
3245
3592
|
children: [
|
|
3246
3593
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Label, { position: "inside", children: "Radius" }),
|
|
3247
3594
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Trigger, {}),
|
|
@@ -3262,7 +3609,7 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3262
3609
|
{
|
|
3263
3610
|
variant: "solid",
|
|
3264
3611
|
value: roundness2,
|
|
3265
|
-
onValueChange: (change) => _optionalChain([onRoundnessChange, 'optionalCall',
|
|
3612
|
+
onValueChange: (change) => _optionalChain([onRoundnessChange, 'optionalCall', _54 => _54(change)]),
|
|
3266
3613
|
children: [
|
|
3267
3614
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Label, { className: "min-w-40!", position: "inside", children: "Roundness" }),
|
|
3268
3615
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Trigger, {}),
|
|
@@ -3282,7 +3629,7 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3282
3629
|
{
|
|
3283
3630
|
variant: "solid",
|
|
3284
3631
|
value: spacing,
|
|
3285
|
-
onValueChange: (change) => _optionalChain([onSpacingChange, 'optionalCall',
|
|
3632
|
+
onValueChange: (change) => _optionalChain([onSpacingChange, 'optionalCall', _55 => _55(change)]),
|
|
3286
3633
|
children: [
|
|
3287
3634
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Label, { position: "inside", children: "Spacing" }),
|
|
3288
3635
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Select.Trigger, {}),
|
|
@@ -3316,5 +3663,6 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3316
3663
|
|
|
3317
3664
|
|
|
3318
3665
|
|
|
3319
|
-
|
|
3666
|
+
|
|
3667
|
+
exports.Accordion = Accordion; exports.Badge = Badge; exports.Box = Box; exports.Button = Button; exports.Checkbox = Checkbox; exports.Container = Container; exports.Panel = Panel; exports.Portal = Portal; exports.ProgressBar = ProgressBar; exports.Select = Select; exports.Separator = Separator; exports.Switch = Switch; exports.Text = Text; exports.Theme = Theme; exports.ThemeControl = ThemeControl; exports.useTheme = useTheme;
|
|
3320
3668
|
//# sourceMappingURL=index.js.map
|