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.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
+ var utils = require('@/lib/utils');
4
5
  var React = require('react');
5
6
  var ReactDOM = require('react-dom');
6
7
 
@@ -85,7 +86,6 @@ function createSlot(ownerName) {
85
86
  Slot2.displayName = `${ownerName}.Slot`;
86
87
  return Slot2;
87
88
  }
88
- var Slot$1 = /* @__PURE__ */ createSlot("Slot");
89
89
  // @__NO_SIDE_EFFECTS__
90
90
  function createSlotClone(ownerName) {
91
91
  const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
@@ -6186,8 +6186,83 @@ function isValidOrientation(orientation) {
6186
6186
  }
6187
6187
  var Root = Separator$1;
6188
6188
 
6189
+ function Avatar({ className, size = 'default', ...props }) {
6190
+ return (jsxRuntime.jsx(Root$2, { "data-slot": "avatar", "data-size": size, className: utils.cn('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 }));
6191
+ }
6192
+
6189
6193
  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}
6190
6194
 
6195
+ const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
6196
+ const cx = clsx;
6197
+ const cva = (base, config)=>(props)=>{
6198
+ var _config_compoundVariants;
6199
+ 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);
6200
+ const { variants, defaultVariants } = config;
6201
+ const getVariantClassNames = Object.keys(variants).map((variant)=>{
6202
+ const variantProp = props === null || props === void 0 ? void 0 : props[variant];
6203
+ const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
6204
+ if (variantProp === null) return null;
6205
+ const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
6206
+ return variants[variant][variantKey];
6207
+ });
6208
+ const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
6209
+ let [key, value] = param;
6210
+ if (value === undefined) {
6211
+ return acc;
6212
+ }
6213
+ acc[key] = value;
6214
+ return acc;
6215
+ }, {});
6216
+ 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)=>{
6217
+ let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
6218
+ return Object.entries(compoundVariantOptions).every((param)=>{
6219
+ let [key, value] = param;
6220
+ return Array.isArray(value) ? value.includes({
6221
+ ...defaultVariants,
6222
+ ...propsWithoutUndefined
6223
+ }[key]) : ({
6224
+ ...defaultVariants,
6225
+ ...propsWithoutUndefined
6226
+ })[key] === value;
6227
+ }) ? [
6228
+ ...acc,
6229
+ cvClass,
6230
+ cvClassName
6231
+ ] : acc;
6232
+ }, []);
6233
+ return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
6234
+ };
6235
+
6236
+ 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", {
6237
+ variants: {
6238
+ variant: {
6239
+ default: 'bg-bg-active-primary text-text-primary hover:bg-bg-active-hover-primary [a]:hover:bg-primary/80',
6240
+ outline: 'border-stroke-base-primary bg-bg-base-primary hover:bg-muted aria-expanded:bg-muted text-text-primary',
6241
+ secondary: 'bg-bg-active-secondary text-text-primary hover:bg-bg-active-hover-secondary aria-expanded:bg-secondary aria-expanded:text-text-primary',
6242
+ ghost: 'hover:bg-muted text-text-primary aria-expanded:bg-muted',
6243
+ 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',
6244
+ link: 'text-text-info underline-offset-4 hover:underline'
6245
+ },
6246
+ size: {
6247
+ default: 'h-10 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
6248
+ 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",
6249
+ 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",
6250
+ lg: 'h-11 gap-1.5 px-3 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
6251
+ icon: 'size-8',
6252
+ 'icon-xs': "size-6 [&_svg:not([class*='size-'])]:size-3",
6253
+ 'icon-sm': 'size-7',
6254
+ 'icon-lg': 'size-9'
6255
+ }
6256
+ },
6257
+ defaultVariants: {
6258
+ variant: 'default',
6259
+ size: 'default'
6260
+ }
6261
+ });
6262
+ function Button({ className, variant = 'default', size = 'default', asChild = false, ...props }) {
6263
+ return (jsxRuntime.jsx("button", { "data-slot": "button", "data-variant": variant, "data-size": size, className: utils.cn(buttonVariants({ variant, size, className })), ...props }));
6264
+ }
6265
+
6191
6266
  /**
6192
6267
  * Concatenates two arrays faster than the array spread operator.
6193
6268
  */
@@ -9391,82 +9466,6 @@ function cn(...inputs) {
9391
9466
  return twMerge(clsx(inputs));
9392
9467
  }
9393
9468
 
9394
- function Avatar({ className, size = 'default', ...props }) {
9395
- return (jsxRuntime.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 }));
9396
- }
9397
-
9398
- const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
9399
- const cx = clsx;
9400
- const cva = (base, config)=>(props)=>{
9401
- var _config_compoundVariants;
9402
- 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);
9403
- const { variants, defaultVariants } = config;
9404
- const getVariantClassNames = Object.keys(variants).map((variant)=>{
9405
- const variantProp = props === null || props === void 0 ? void 0 : props[variant];
9406
- const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
9407
- if (variantProp === null) return null;
9408
- const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
9409
- return variants[variant][variantKey];
9410
- });
9411
- const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
9412
- let [key, value] = param;
9413
- if (value === undefined) {
9414
- return acc;
9415
- }
9416
- acc[key] = value;
9417
- return acc;
9418
- }, {});
9419
- 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)=>{
9420
- let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
9421
- return Object.entries(compoundVariantOptions).every((param)=>{
9422
- let [key, value] = param;
9423
- return Array.isArray(value) ? value.includes({
9424
- ...defaultVariants,
9425
- ...propsWithoutUndefined
9426
- }[key]) : ({
9427
- ...defaultVariants,
9428
- ...propsWithoutUndefined
9429
- })[key] === value;
9430
- }) ? [
9431
- ...acc,
9432
- cvClass,
9433
- cvClassName
9434
- ] : acc;
9435
- }, []);
9436
- return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
9437
- };
9438
-
9439
- 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", {
9440
- variants: {
9441
- variant: {
9442
- default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
9443
- 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',
9444
- secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
9445
- ghost: 'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',
9446
- 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',
9447
- link: 'text-primary underline-offset-4 hover:underline'
9448
- },
9449
- size: {
9450
- default: 'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
9451
- 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",
9452
- 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",
9453
- lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
9454
- icon: 'size-8',
9455
- 'icon-xs': "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
9456
- 'icon-sm': 'size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
9457
- 'icon-lg': 'size-9'
9458
- }
9459
- },
9460
- defaultVariants: {
9461
- variant: 'default',
9462
- size: 'default'
9463
- }
9464
- });
9465
- function Button({ className, variant = 'default', size = 'default', asChild = false, ...props }) {
9466
- const Comp = asChild ? Slot$1 : 'button';
9467
- return (jsxRuntime.jsx(Comp, { "data-slot": "button", "data-variant": variant, "data-size": size, className: cn(buttonVariants({ variant, size, className })), ...props }));
9468
- }
9469
-
9470
9469
  /**
9471
9470
  * @license lucide-react v0.575.0 - ISC
9472
9471
  *
@@ -9680,11 +9679,11 @@ function SelectScrollDownButton({ className, ...props }) {
9680
9679
  }
9681
9680
 
9682
9681
  function Separator({ className, orientation = 'horizontal', decorative = true, ...props }) {
9683
- return (jsxRuntime.jsx(Root, { "data-slot": "separator", decorative: decorative, orientation: orientation, className: cn('bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch', className), ...props }));
9682
+ return (jsxRuntime.jsx(Root, { "data-slot": "separator", decorative: decorative, orientation: orientation, className: utils.cn('bg-stroke-base-primary shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch', className), ...props }));
9684
9683
  }
9685
9684
 
9686
9685
  function Skeleton({ className, ...props }) {
9687
- return (jsxRuntime.jsx("div", { "data-slot": "skeleton", className: cn('bg-muted rounded-md animate-pulse', className), ...props }));
9686
+ return (jsxRuntime.jsx("div", { "data-slot": "skeleton", className: utils.cn('bg-bg-modal-primary animate-pulse rounded-md', className), ...props }));
9688
9687
  }
9689
9688
 
9690
9689
  var TextVariant;
@@ -9702,13 +9701,12 @@ var TextVariant;
9702
9701
  TextVariant[TextVariant["Caption"] = 10] = "Caption";
9703
9702
  TextVariant[TextVariant["Custom"] = 11] = "Custom";
9704
9703
  })(TextVariant || (TextVariant = {}));
9705
-
9706
9704
  /**
9707
9705
  * This function renders the Text component for the library.
9708
9706
  */
9709
- function Text({ variant = TextVariant.Body, color, children, customClassName }) {
9707
+ function Text({ variant = TextVariant.Body, color = 'text-primary', children, className }) {
9710
9708
  // SECTION: Constants and Variables
9711
- const [className, setClassName] = React.useState('');
9709
+ const [internalClassName, setInternalClassName] = React.useState('');
9712
9710
  // !SECTION: Constants and Variables
9713
9711
  // SECTION: States
9714
9712
  // !SECTION: States
@@ -9722,23 +9720,25 @@ function Text({ variant = TextVariant.Body, color, children, customClassName })
9722
9720
  const getVariantClass = (variant) => {
9723
9721
  switch (variant) {
9724
9722
  case TextVariant.H1:
9725
- return 'text-[61px] font-heading';
9723
+ return '';
9726
9724
  case TextVariant.H2:
9727
- return 'text-[48px] font-heading';
9725
+ return '';
9728
9726
  case TextVariant.H3:
9729
- return 'text-[39px] font-heading';
9727
+ return '';
9730
9728
  case TextVariant.H4:
9731
- return 'text-[31px] font-bold font-heading';
9729
+ return '';
9732
9730
  case TextVariant.H5:
9733
- return 'text-[25px] font-bold font-heading';
9731
+ return '';
9734
9732
  case TextVariant.H6:
9735
- return 'text-[20px] font-bold font-heading';
9733
+ return '';
9736
9734
  case TextVariant.Body:
9737
- return 'text-[16px] font-body';
9735
+ return 'text-sm font-body';
9738
9736
  case TextVariant.Button:
9739
- return 'text-[16px] font-bold font-body';
9737
+ return 'text-sm font-body';
9738
+ case TextVariant.Caption:
9739
+ return 'text-xs font-body';
9740
9740
  default:
9741
- return 'text-[16px] font-body';
9741
+ return 'text-sm font-body';
9742
9742
  }
9743
9743
  };
9744
9744
  // !SECTION Functions
@@ -9746,11 +9746,30 @@ function Text({ variant = TextVariant.Body, color, children, customClassName })
9746
9746
  // !SECTION: Event Handlers
9747
9747
  // SECTION: Side Effects
9748
9748
  React.useEffect(() => {
9749
- setClassName(cn(getVariantClass(variant), color, customClassName));
9750
- }, [variant, color, customClassName]);
9749
+ setInternalClassName(utils.cn(getVariantClass(variant), color, className));
9750
+ }, [variant, color, className]);
9751
9751
  // !SECTION: Side Effects
9752
9752
  // SECTION: UI
9753
- return jsxRuntime.jsx("p", { className: className, children: children });
9753
+ switch (variant) {
9754
+ case TextVariant.H1:
9755
+ return jsxRuntime.jsx("h1", { className: internalClassName, children: children });
9756
+ case TextVariant.H2:
9757
+ return jsxRuntime.jsx("h2", { className: internalClassName, children: children });
9758
+ case TextVariant.H3:
9759
+ return jsxRuntime.jsx("h3", { className: internalClassName, children: children });
9760
+ case TextVariant.H4:
9761
+ return jsxRuntime.jsx("h4", { className: internalClassName, children: children });
9762
+ case TextVariant.H5:
9763
+ return jsxRuntime.jsx("h5", { className: internalClassName, children: children });
9764
+ case TextVariant.H6:
9765
+ return jsxRuntime.jsx("h6", { className: internalClassName, children: children });
9766
+ case TextVariant.Button:
9767
+ return jsxRuntime.jsx("span", { className: internalClassName, children: children });
9768
+ case TextVariant.Caption:
9769
+ return jsxRuntime.jsx("span", { className: internalClassName, children: children });
9770
+ default:
9771
+ return jsxRuntime.jsx("p", { className: className, children: children });
9772
+ }
9754
9773
  // !SECTION: UI
9755
9774
  }
9756
9775