get-elementa-ui 1.11.6 → 1.12.0
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.esm.js +113 -94
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +113 -94
- package/dist/index.js.map +1 -1
- package/dist/types/components/label.d.ts +4 -0
- package/dist/types/components/spinner.d.ts +2 -0
- package/dist/types/components/text.d.ts +21 -3
- package/package.json +2 -2
- package/dist/types/lib/types.d.ts +0 -22
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { cn as cn$1 } from '@/lib/utils';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import React__default, { useState, useLayoutEffect, forwardRef, createElement, useEffect } from 'react';
|
|
4
5
|
import * as ReactDOM from 'react-dom';
|
|
@@ -65,7 +66,6 @@ function createSlot(ownerName) {
|
|
|
65
66
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
66
67
|
return Slot2;
|
|
67
68
|
}
|
|
68
|
-
var Slot$1 = /* @__PURE__ */ createSlot("Slot");
|
|
69
69
|
// @__NO_SIDE_EFFECTS__
|
|
70
70
|
function createSlotClone(ownerName) {
|
|
71
71
|
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
@@ -6166,8 +6166,83 @@ function isValidOrientation(orientation) {
|
|
|
6166
6166
|
}
|
|
6167
6167
|
var Root = Separator$1;
|
|
6168
6168
|
|
|
6169
|
+
function Avatar({ className, size = 'default', ...props }) {
|
|
6170
|
+
return (jsx(Root$2, { "data-slot": "avatar", "data-size": size, className: cn$1('group/avatar border-stroke-active-primary relative flex size-8 shrink-0 overflow-hidden rounded-full border-2 select-none data-[size=lg]:size-10 data-[size=sm]:size-6', className), ...props }));
|
|
6171
|
+
}
|
|
6172
|
+
|
|
6169
6173
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
6170
6174
|
|
|
6175
|
+
const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
6176
|
+
const cx = clsx;
|
|
6177
|
+
const cva = (base, config)=>(props)=>{
|
|
6178
|
+
var _config_compoundVariants;
|
|
6179
|
+
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
6180
|
+
const { variants, defaultVariants } = config;
|
|
6181
|
+
const getVariantClassNames = Object.keys(variants).map((variant)=>{
|
|
6182
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
6183
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
6184
|
+
if (variantProp === null) return null;
|
|
6185
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
6186
|
+
return variants[variant][variantKey];
|
|
6187
|
+
});
|
|
6188
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
|
|
6189
|
+
let [key, value] = param;
|
|
6190
|
+
if (value === undefined) {
|
|
6191
|
+
return acc;
|
|
6192
|
+
}
|
|
6193
|
+
acc[key] = value;
|
|
6194
|
+
return acc;
|
|
6195
|
+
}, {});
|
|
6196
|
+
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{
|
|
6197
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
6198
|
+
return Object.entries(compoundVariantOptions).every((param)=>{
|
|
6199
|
+
let [key, value] = param;
|
|
6200
|
+
return Array.isArray(value) ? value.includes({
|
|
6201
|
+
...defaultVariants,
|
|
6202
|
+
...propsWithoutUndefined
|
|
6203
|
+
}[key]) : ({
|
|
6204
|
+
...defaultVariants,
|
|
6205
|
+
...propsWithoutUndefined
|
|
6206
|
+
})[key] === value;
|
|
6207
|
+
}) ? [
|
|
6208
|
+
...acc,
|
|
6209
|
+
cvClass,
|
|
6210
|
+
cvClassName
|
|
6211
|
+
] : acc;
|
|
6212
|
+
}, []);
|
|
6213
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
6214
|
+
};
|
|
6215
|
+
|
|
6216
|
+
const buttonVariants = cva("focus-visible:border-ring py-1 cursor-pointer active:scale-95 focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive rounded-[8px] border border-transparent font-body font-bold focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
6217
|
+
variants: {
|
|
6218
|
+
variant: {
|
|
6219
|
+
default: 'bg-bg-active-primary text-text-primary hover:bg-bg-active-hover-primary [a]:hover:bg-primary/80',
|
|
6220
|
+
outline: 'border-stroke-base-primary bg-bg-base-primary hover:bg-muted aria-expanded:bg-muted text-text-primary',
|
|
6221
|
+
secondary: 'bg-bg-active-secondary text-text-primary hover:bg-bg-active-hover-secondary aria-expanded:bg-secondary aria-expanded:text-text-primary',
|
|
6222
|
+
ghost: 'hover:bg-muted text-text-primary aria-expanded:bg-muted',
|
|
6223
|
+
destructive: 'bg-bg-destructive hover:bg-bg-hover-destructive focus-visible:ring-destructive/20 text-text-destructive focus-visible:border-destructive/40 border-stroke-destructive',
|
|
6224
|
+
link: 'text-text-info underline-offset-4 hover:underline'
|
|
6225
|
+
},
|
|
6226
|
+
size: {
|
|
6227
|
+
default: 'h-10 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
6228
|
+
xs: "h-8 gap-1 px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
6229
|
+
sm: "h-9 gap-1 px-3 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
6230
|
+
lg: 'h-11 gap-1.5 px-3 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
|
|
6231
|
+
icon: 'size-8',
|
|
6232
|
+
'icon-xs': "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
6233
|
+
'icon-sm': 'size-7',
|
|
6234
|
+
'icon-lg': 'size-9'
|
|
6235
|
+
}
|
|
6236
|
+
},
|
|
6237
|
+
defaultVariants: {
|
|
6238
|
+
variant: 'default',
|
|
6239
|
+
size: 'default'
|
|
6240
|
+
}
|
|
6241
|
+
});
|
|
6242
|
+
function Button({ className, variant = 'default', size = 'default', asChild = false, ...props }) {
|
|
6243
|
+
return (jsx("button", { "data-slot": "button", "data-variant": variant, "data-size": size, className: cn$1(buttonVariants({ variant, size, className })), ...props }));
|
|
6244
|
+
}
|
|
6245
|
+
|
|
6171
6246
|
/**
|
|
6172
6247
|
* Concatenates two arrays faster than the array spread operator.
|
|
6173
6248
|
*/
|
|
@@ -9371,82 +9446,6 @@ function cn(...inputs) {
|
|
|
9371
9446
|
return twMerge(clsx(inputs));
|
|
9372
9447
|
}
|
|
9373
9448
|
|
|
9374
|
-
function Avatar({ className, size = 'default', ...props }) {
|
|
9375
|
-
return (jsx(Root$2, { "data-slot": "avatar", "data-size": size, className: cn('group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6', className), ...props }));
|
|
9376
|
-
}
|
|
9377
|
-
|
|
9378
|
-
const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
9379
|
-
const cx = clsx;
|
|
9380
|
-
const cva = (base, config)=>(props)=>{
|
|
9381
|
-
var _config_compoundVariants;
|
|
9382
|
-
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
9383
|
-
const { variants, defaultVariants } = config;
|
|
9384
|
-
const getVariantClassNames = Object.keys(variants).map((variant)=>{
|
|
9385
|
-
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
9386
|
-
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
9387
|
-
if (variantProp === null) return null;
|
|
9388
|
-
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
9389
|
-
return variants[variant][variantKey];
|
|
9390
|
-
});
|
|
9391
|
-
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
|
|
9392
|
-
let [key, value] = param;
|
|
9393
|
-
if (value === undefined) {
|
|
9394
|
-
return acc;
|
|
9395
|
-
}
|
|
9396
|
-
acc[key] = value;
|
|
9397
|
-
return acc;
|
|
9398
|
-
}, {});
|
|
9399
|
-
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{
|
|
9400
|
-
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
9401
|
-
return Object.entries(compoundVariantOptions).every((param)=>{
|
|
9402
|
-
let [key, value] = param;
|
|
9403
|
-
return Array.isArray(value) ? value.includes({
|
|
9404
|
-
...defaultVariants,
|
|
9405
|
-
...propsWithoutUndefined
|
|
9406
|
-
}[key]) : ({
|
|
9407
|
-
...defaultVariants,
|
|
9408
|
-
...propsWithoutUndefined
|
|
9409
|
-
})[key] === value;
|
|
9410
|
-
}) ? [
|
|
9411
|
-
...acc,
|
|
9412
|
-
cvClass,
|
|
9413
|
-
cvClassName
|
|
9414
|
-
] : acc;
|
|
9415
|
-
}, []);
|
|
9416
|
-
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
9417
|
-
};
|
|
9418
|
-
|
|
9419
|
-
const buttonVariants = cva("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none", {
|
|
9420
|
-
variants: {
|
|
9421
|
-
variant: {
|
|
9422
|
-
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
|
9423
|
-
outline: 'border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
|
9424
|
-
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
|
9425
|
-
ghost: 'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
|
9426
|
-
destructive: 'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',
|
|
9427
|
-
link: 'text-primary underline-offset-4 hover:underline'
|
|
9428
|
-
},
|
|
9429
|
-
size: {
|
|
9430
|
-
default: 'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
9431
|
-
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
9432
|
-
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
9433
|
-
lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
|
|
9434
|
-
icon: 'size-8',
|
|
9435
|
-
'icon-xs': "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
9436
|
-
'icon-sm': 'size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
|
|
9437
|
-
'icon-lg': 'size-9'
|
|
9438
|
-
}
|
|
9439
|
-
},
|
|
9440
|
-
defaultVariants: {
|
|
9441
|
-
variant: 'default',
|
|
9442
|
-
size: 'default'
|
|
9443
|
-
}
|
|
9444
|
-
});
|
|
9445
|
-
function Button({ className, variant = 'default', size = 'default', asChild = false, ...props }) {
|
|
9446
|
-
const Comp = asChild ? Slot$1 : 'button';
|
|
9447
|
-
return (jsx(Comp, { "data-slot": "button", "data-variant": variant, "data-size": size, className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
9448
|
-
}
|
|
9449
|
-
|
|
9450
9449
|
/**
|
|
9451
9450
|
* @license lucide-react v0.575.0 - ISC
|
|
9452
9451
|
*
|
|
@@ -9660,11 +9659,11 @@ function SelectScrollDownButton({ className, ...props }) {
|
|
|
9660
9659
|
}
|
|
9661
9660
|
|
|
9662
9661
|
function Separator({ className, orientation = 'horizontal', decorative = true, ...props }) {
|
|
9663
|
-
return (jsx(Root, { "data-slot": "separator", decorative: decorative, orientation: orientation, className: cn('bg-
|
|
9662
|
+
return (jsx(Root, { "data-slot": "separator", decorative: decorative, orientation: orientation, className: cn$1('bg-stroke-base-primary shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch', className), ...props }));
|
|
9664
9663
|
}
|
|
9665
9664
|
|
|
9666
9665
|
function Skeleton({ className, ...props }) {
|
|
9667
|
-
return (jsx("div", { "data-slot": "skeleton", className: cn('bg-
|
|
9666
|
+
return (jsx("div", { "data-slot": "skeleton", className: cn$1('bg-bg-modal-primary animate-pulse rounded-md', className), ...props }));
|
|
9668
9667
|
}
|
|
9669
9668
|
|
|
9670
9669
|
var TextVariant;
|
|
@@ -9682,13 +9681,12 @@ var TextVariant;
|
|
|
9682
9681
|
TextVariant[TextVariant["Caption"] = 10] = "Caption";
|
|
9683
9682
|
TextVariant[TextVariant["Custom"] = 11] = "Custom";
|
|
9684
9683
|
})(TextVariant || (TextVariant = {}));
|
|
9685
|
-
|
|
9686
9684
|
/**
|
|
9687
9685
|
* This function renders the Text component for the library.
|
|
9688
9686
|
*/
|
|
9689
|
-
function Text({ variant = TextVariant.Body, color, children,
|
|
9687
|
+
function Text({ variant = TextVariant.Body, color = 'text-primary', children, className }) {
|
|
9690
9688
|
// SECTION: Constants and Variables
|
|
9691
|
-
const [
|
|
9689
|
+
const [internalClassName, setInternalClassName] = useState('');
|
|
9692
9690
|
// !SECTION: Constants and Variables
|
|
9693
9691
|
// SECTION: States
|
|
9694
9692
|
// !SECTION: States
|
|
@@ -9702,23 +9700,25 @@ function Text({ variant = TextVariant.Body, color, children, customClassName })
|
|
|
9702
9700
|
const getVariantClass = (variant) => {
|
|
9703
9701
|
switch (variant) {
|
|
9704
9702
|
case TextVariant.H1:
|
|
9705
|
-
return '
|
|
9703
|
+
return '';
|
|
9706
9704
|
case TextVariant.H2:
|
|
9707
|
-
return '
|
|
9705
|
+
return '';
|
|
9708
9706
|
case TextVariant.H3:
|
|
9709
|
-
return '
|
|
9707
|
+
return '';
|
|
9710
9708
|
case TextVariant.H4:
|
|
9711
|
-
return '
|
|
9709
|
+
return '';
|
|
9712
9710
|
case TextVariant.H5:
|
|
9713
|
-
return '
|
|
9711
|
+
return '';
|
|
9714
9712
|
case TextVariant.H6:
|
|
9715
|
-
return '
|
|
9713
|
+
return '';
|
|
9716
9714
|
case TextVariant.Body:
|
|
9717
|
-
return 'text-
|
|
9715
|
+
return 'text-sm font-body';
|
|
9718
9716
|
case TextVariant.Button:
|
|
9719
|
-
return 'text-
|
|
9717
|
+
return 'text-sm font-body';
|
|
9718
|
+
case TextVariant.Caption:
|
|
9719
|
+
return 'text-xs font-body';
|
|
9720
9720
|
default:
|
|
9721
|
-
return 'text-
|
|
9721
|
+
return 'text-sm font-body';
|
|
9722
9722
|
}
|
|
9723
9723
|
};
|
|
9724
9724
|
// !SECTION Functions
|
|
@@ -9726,11 +9726,30 @@ function Text({ variant = TextVariant.Body, color, children, customClassName })
|
|
|
9726
9726
|
// !SECTION: Event Handlers
|
|
9727
9727
|
// SECTION: Side Effects
|
|
9728
9728
|
useEffect(() => {
|
|
9729
|
-
|
|
9730
|
-
}, [variant, color,
|
|
9729
|
+
setInternalClassName(cn$1(getVariantClass(variant), color, className));
|
|
9730
|
+
}, [variant, color, className]);
|
|
9731
9731
|
// !SECTION: Side Effects
|
|
9732
9732
|
// SECTION: UI
|
|
9733
|
-
|
|
9733
|
+
switch (variant) {
|
|
9734
|
+
case TextVariant.H1:
|
|
9735
|
+
return jsx("h1", { className: internalClassName, children: children });
|
|
9736
|
+
case TextVariant.H2:
|
|
9737
|
+
return jsx("h2", { className: internalClassName, children: children });
|
|
9738
|
+
case TextVariant.H3:
|
|
9739
|
+
return jsx("h3", { className: internalClassName, children: children });
|
|
9740
|
+
case TextVariant.H4:
|
|
9741
|
+
return jsx("h4", { className: internalClassName, children: children });
|
|
9742
|
+
case TextVariant.H5:
|
|
9743
|
+
return jsx("h5", { className: internalClassName, children: children });
|
|
9744
|
+
case TextVariant.H6:
|
|
9745
|
+
return jsx("h6", { className: internalClassName, children: children });
|
|
9746
|
+
case TextVariant.Button:
|
|
9747
|
+
return jsx("span", { className: internalClassName, children: children });
|
|
9748
|
+
case TextVariant.Caption:
|
|
9749
|
+
return jsx("span", { className: internalClassName, children: children });
|
|
9750
|
+
default:
|
|
9751
|
+
return jsx("p", { className: className, children: children });
|
|
9752
|
+
}
|
|
9734
9753
|
// !SECTION: UI
|
|
9735
9754
|
}
|
|
9736
9755
|
|