elseware-ui 3.0.12 → 3.0.13

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
@@ -3,13 +3,13 @@
3
3
  var React26 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var tailwindMerge = require('tailwind-merge');
6
- var index_js$1 = require('react-icons/ai/index.js');
6
+ var index_js = require('react-icons/ai/index.js');
7
7
  var formik = require('formik');
8
8
  var index_js$2 = require('react-icons/fa/index.js');
9
9
  var classNames69 = require('classnames');
10
10
  var reactBeautifulDnd = require('react-beautiful-dnd');
11
11
  var cloudinaryReact = require('cloudinary-react');
12
- var index_js = require('react-icons/md/index.js');
12
+ var index_js$1 = require('react-icons/md/index.js');
13
13
  var index_js$3 = require('react-icons/bs/index.js');
14
14
  var framerMotion = require('framer-motion');
15
15
  var recharts = require('recharts');
@@ -5596,6 +5596,11 @@ var isMatch = (itemPath, currentPath) => {
5596
5596
  };
5597
5597
 
5598
5598
  // src/utils/styles.ts
5599
+ function extractTextColorClasses(className) {
5600
+ return className.split(/\s+/).filter(
5601
+ (token) => token.startsWith("text-") || token.startsWith("dark:text-") || token.startsWith("disabled:text-")
5602
+ ).join(" ");
5603
+ }
5599
5604
  function resolveAppearanceStyles({
5600
5605
  appearance = "solid",
5601
5606
  variant = "default",
@@ -6249,14 +6254,6 @@ var toastShapeStyles = {
6249
6254
  };
6250
6255
 
6251
6256
  // src/components/data-entry/button/base/Button.styles.ts
6252
- var buttonShapes = shapes;
6253
- var buttonIconSizes = {
6254
- xs: 14,
6255
- sm: 16,
6256
- md: 18,
6257
- lg: 20,
6258
- xl: 22
6259
- };
6260
6257
  function resolveButtonVariantStyles({
6261
6258
  appearance,
6262
6259
  variant
@@ -6270,108 +6267,171 @@ function resolveButtonVariantStyles({
6270
6267
  });
6271
6268
  }
6272
6269
 
6273
- // src/components/data-entry/button/web/Button.web.styles.ts
6274
- var webButtonSizes = {
6275
- xs: "px-2 py-1 text-xs",
6276
- sm: "px-3 py-1.5 text-sm",
6277
- md: "px-4 py-2 text-base",
6278
- lg: "px-5 py-3 text-lg",
6279
- xl: "px-6 py-4 text-xl"
6270
+ // src/components/data-entry/button/base/Button.tokens.ts
6271
+ var buttonSizeTokens = {
6272
+ xs: {
6273
+ padding: "px-2 py-1",
6274
+ text: "text-xs",
6275
+ icon: 14,
6276
+ minHeight: "min-h-[30px]",
6277
+ leading: "leading-[14px]",
6278
+ slot: "h-[14px] w-[14px]"
6279
+ },
6280
+ sm: {
6281
+ padding: "px-3 py-1.5",
6282
+ text: "text-sm",
6283
+ icon: 16,
6284
+ minHeight: "min-h-9",
6285
+ leading: "leading-4",
6286
+ slot: "h-4 w-4"
6287
+ },
6288
+ md: {
6289
+ padding: "px-4 py-2",
6290
+ text: "text-base",
6291
+ icon: 18,
6292
+ minHeight: "min-h-11",
6293
+ leading: "leading-[18px]",
6294
+ slot: "h-[18px] w-[18px]"
6295
+ },
6296
+ lg: {
6297
+ padding: "px-5 py-3",
6298
+ text: "text-lg",
6299
+ icon: 20,
6300
+ minHeight: "min-h-[50px]",
6301
+ leading: "leading-5",
6302
+ slot: "h-5 w-5"
6303
+ },
6304
+ xl: {
6305
+ padding: "px-6 py-4",
6306
+ text: "text-xl",
6307
+ icon: 22,
6308
+ minHeight: "min-h-14",
6309
+ leading: "leading-[22px]",
6310
+ slot: "h-[22px] w-[22px]"
6311
+ }
6280
6312
  };
6281
- function Button({
6282
- type: type2 = "button",
6283
- icon,
6284
- text: text10,
6285
- children: children3,
6286
- loading = false,
6287
- disabled = false,
6288
- block = false,
6289
- compact = false,
6290
- glow = true,
6291
- mode,
6292
- contentClassName,
6293
- labelClassName,
6294
- variant,
6295
- appearance,
6296
- shape,
6297
- size,
6298
- accessibilityLabel,
6299
- accessibilityRole,
6300
- accessibilityState,
6301
- testID,
6302
- className,
6303
- onMouseMove,
6304
- onClick,
6305
- onPress,
6306
- ...rest
6307
- }) {
6308
- const accessibility = accessibilityState;
6313
+ var buttonShapes = shapes;
6314
+ var buttonTextModeClassName = "border-transparent bg-transparent";
6315
+
6316
+ // src/components/data-entry/button/base/useButton.ts
6317
+ function useButton(props) {
6309
6318
  const {
6310
- shape: resolvedShape,
6311
- size: resolvedSize,
6312
- variant: resolvedVariant,
6313
- appearance: resolvedAppearance
6314
- } = useResolvedButtonConfig({
6315
- compact,
6319
+ // Consumed by the shared model
6320
+ icon,
6321
+ text: text10,
6322
+ children: children3,
6323
+ loading = false,
6324
+ disabled = false,
6325
+ block = false,
6326
+ compact = false,
6316
6327
  mode,
6317
6328
  variant,
6318
6329
  appearance,
6319
6330
  shape,
6320
- size
6321
- });
6322
- const btnRef = React26.useRef(null);
6323
- const variantStyles = resolveButtonVariantStyles({
6331
+ size,
6332
+ accessibilityState,
6333
+ onPress,
6334
+ // Owned by the platform views — pulled out here only so `rootRest` is a
6335
+ // clean pass-through (no library props leak onto the DOM / native root).
6336
+ type: _type,
6337
+ glow: _glow,
6338
+ className: _className,
6339
+ contentClassName: _contentClassName,
6340
+ labelClassName: _labelClassName,
6341
+ accessibilityLabel: _accessibilityLabel,
6342
+ accessibilityRole: _accessibilityRole,
6343
+ testID: _testID,
6344
+ onClick: _onClick,
6345
+ onMouseMove: _onMouseMove,
6346
+ ...rootRest
6347
+ } = props;
6348
+ const { shape: resolvedShape, size: resolvedSize, variant: resolvedVariant, appearance: resolvedAppearance } = useResolvedButtonConfig({ compact, mode, variant, appearance, shape, size });
6349
+ const tokens = buttonSizeTokens[resolvedSize];
6350
+ const variantClassName = resolveButtonVariantStyles({
6324
6351
  appearance: resolvedAppearance,
6325
6352
  variant: resolvedVariant
6326
6353
  });
6327
- const iconSize = buttonIconSizes[resolvedSize];
6328
- const labelContent = text10 || children3;
6329
- const resolvedIcon = typeof icon === "function" ? icon({
6330
- color: "currentColor",
6331
- size: iconSize
6332
- }) : icon;
6354
+ const label = text10 ?? children3;
6355
+ const resolvedIcon = typeof icon === "function" ? icon({ color: "currentColor", size: tokens.icon }) : icon;
6356
+ const isBusy = disabled || loading;
6357
+ return {
6358
+ size: resolvedSize,
6359
+ shape: resolvedShape,
6360
+ tokens,
6361
+ isBusy,
6362
+ isInteractive: !isBusy,
6363
+ isTextMode: mode === "text",
6364
+ block,
6365
+ loading,
6366
+ iconSize: tokens.icon,
6367
+ icon: resolvedIcon,
6368
+ label,
6369
+ hasTextLabel: typeof label === "string" || typeof label === "number",
6370
+ variantClassName,
6371
+ shapeClassName: buttonShapes[resolvedShape],
6372
+ labelColorClassName: extractTextColorClasses(variantClassName),
6373
+ selected: accessibilityState?.selected,
6374
+ onPress,
6375
+ rootRest
6376
+ };
6377
+ }
6378
+ var WEB_ROOT = "relative overflow-hidden group inline-flex items-center justify-center gap-2 transition-all duration-300";
6379
+ var Button = React26.forwardRef(function Button2(props, ref) {
6380
+ const {
6381
+ type: type2 = "button",
6382
+ glow = true,
6383
+ className,
6384
+ contentClassName,
6385
+ labelClassName,
6386
+ accessibilityLabel,
6387
+ accessibilityRole,
6388
+ testID,
6389
+ onClick,
6390
+ onMouseMove
6391
+ } = props;
6392
+ const model = useButton(props);
6393
+ const localRef = React26.useRef(null);
6394
+ const setRef = (node2) => {
6395
+ localRef.current = node2;
6396
+ if (typeof ref === "function") ref(node2);
6397
+ else if (ref) ref.current = node2;
6398
+ };
6333
6399
  const handleMouseMove = (e) => {
6334
- const btn = btnRef.current;
6335
- if (!btn || !glow) {
6336
- onMouseMove?.(e);
6337
- return;
6400
+ const btn = localRef.current;
6401
+ if (btn && glow) {
6402
+ const rect = btn.getBoundingClientRect();
6403
+ btn.style.setProperty("--glow-x", `${e.clientX - rect.left}px`);
6404
+ btn.style.setProperty("--glow-y", `${e.clientY - rect.top}px`);
6338
6405
  }
6339
- const rect = btn.getBoundingClientRect();
6340
- const x3 = e.clientX - rect.left;
6341
- const y3 = e.clientY - rect.top;
6342
- btn.style.setProperty("--glow-x", `${x3}px`);
6343
- btn.style.setProperty("--glow-y", `${y3}px`);
6344
6406
  onMouseMove?.(e);
6345
6407
  };
6346
6408
  const handleClick = (e) => {
6347
6409
  onClick?.(e);
6348
- if (!e.defaultPrevented) {
6349
- onPress?.();
6350
- }
6410
+ if (!e.defaultPrevented) model.onPress?.();
6351
6411
  };
6352
6412
  return /* @__PURE__ */ jsxRuntime.jsxs(
6353
6413
  "button",
6354
6414
  {
6355
- ...rest,
6356
- ref: btnRef,
6415
+ ...model.rootRest,
6416
+ ref: setRef,
6357
6417
  type: type2,
6358
- disabled: disabled || loading,
6418
+ disabled: model.isBusy,
6359
6419
  onClick: handleClick,
6360
6420
  onMouseMove: handleMouseMove,
6361
- "aria-disabled": disabled || loading,
6421
+ "aria-disabled": model.isBusy,
6362
6422
  "aria-label": accessibilityLabel,
6363
- "aria-pressed": accessibility?.selected === void 0 ? void 0 : Boolean(accessibility.selected),
6423
+ "aria-pressed": model.selected,
6364
6424
  "data-testid": testID,
6365
6425
  role: accessibilityRole,
6366
6426
  className: cn(
6367
- "relative overflow-hidden group inline-flex items-center justify-center gap-2 transition-all duration-300",
6368
- variantStyles,
6369
- buttonShapes[resolvedShape],
6370
- webButtonSizes[resolvedSize],
6371
- block && "w-full",
6372
- mode === "text" && "border-transparent bg-transparent",
6373
- (loading || disabled) && "brightness-75 grayscale cursor-not-allowed",
6374
- !loading && !disabled && "hover:cursor-pointer",
6427
+ WEB_ROOT,
6428
+ model.variantClassName,
6429
+ model.shapeClassName,
6430
+ model.tokens.padding,
6431
+ model.tokens.text,
6432
+ model.block && "w-full",
6433
+ model.isTextMode && buttonTextModeClassName,
6434
+ model.isBusy ? "brightness-75 grayscale cursor-not-allowed" : "hover:cursor-pointer",
6375
6435
  className
6376
6436
  ),
6377
6437
  children: [
@@ -6380,49 +6440,37 @@ function Button({
6380
6440
  {
6381
6441
  className: "pointer-events-none absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",
6382
6442
  style: {
6383
- background: `
6384
- radial-gradient(
6385
- 200px circle at var(--glow-x) var(--glow-y),
6386
- rgba(255,255,255,0.18),
6387
- transparent 50%
6388
- )
6389
- `
6443
+ background: "radial-gradient(200px circle at var(--glow-x) var(--glow-y), rgba(255,255,255,0.18), transparent 50%)"
6390
6444
  }
6391
6445
  }
6392
6446
  ),
6393
- loading && /* @__PURE__ */ jsxRuntime.jsx(index_js$1.AiOutlineLoading, { className: "animate-spin z-10" }),
6394
- resolvedIcon && /* @__PURE__ */ jsxRuntime.jsx(
6447
+ model.loading && /* @__PURE__ */ jsxRuntime.jsx(index_js.AiOutlineLoading, { className: "animate-spin z-10" }),
6448
+ model.icon && /* @__PURE__ */ jsxRuntime.jsx(
6395
6449
  "span",
6396
6450
  {
6397
6451
  className: cn(
6398
6452
  "z-10 inline-flex shrink-0 items-center justify-center leading-none",
6399
6453
  contentClassName
6400
6454
  ),
6401
- style: {
6402
- height: iconSize,
6403
- lineHeight: 0,
6404
- width: iconSize
6405
- },
6406
- children: resolvedIcon
6455
+ style: { height: model.iconSize, width: model.iconSize, lineHeight: 0 },
6456
+ children: model.icon
6407
6457
  }
6408
6458
  ),
6409
- labelContent && /* @__PURE__ */ jsxRuntime.jsx(
6459
+ model.label != null && model.label !== "" && /* @__PURE__ */ jsxRuntime.jsx(
6410
6460
  "span",
6411
6461
  {
6412
6462
  className: cn(
6413
6463
  "z-10 inline-flex items-center justify-center leading-none",
6414
6464
  labelClassName
6415
6465
  ),
6416
- style: {
6417
- minHeight: iconSize
6418
- },
6419
- children: labelContent
6466
+ style: { minHeight: model.iconSize },
6467
+ children: model.label
6420
6468
  }
6421
6469
  )
6422
6470
  ]
6423
6471
  }
6424
6472
  );
6425
- }
6473
+ });
6426
6474
  var Button_web_default = Button;
6427
6475
 
6428
6476
  // src/data/styles/shared.styles.tsx
@@ -8640,7 +8688,7 @@ var ImageInput = React26.forwardRef(
8640
8688
  }),
8641
8689
  htmlFor: `${field.name}`,
8642
8690
  children: [
8643
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-4xl text-gray-300 group-hover:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdUpload, {}) }),
8691
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-4xl text-gray-300 group-hover:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdUpload, {}) }),
8644
8692
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xl font-bold text-gray-500 group-hover:text-gray-500", children: title })
8645
8693
  ]
8646
8694
  }
@@ -8656,7 +8704,7 @@ var ImageInput = React26.forwardRef(
8656
8704
  ) }),
8657
8705
  loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute", children: [
8658
8706
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[200px] w-[300px] bg-black opacity-50" }),
8659
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-0 left-0 w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.AiOutlineLoading, { className: "animate-spin" }) })
8707
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-0 left-0 w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(index_js.AiOutlineLoading, { className: "animate-spin" }) })
8660
8708
  ] }),
8661
8709
  !loading && url && /* @__PURE__ */ jsxRuntime.jsx(ImageView, { imageUrl: url, alt: url ? url : "image" }),
8662
8710
  (preview || url) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 text-3xl", children: [
@@ -8666,7 +8714,7 @@ var ImageInput = React26.forwardRef(
8666
8714
  className: " text-green-600 hover:cursor-pointer",
8667
8715
  onClick: uploadImage,
8668
8716
  hidden: url ? true : false,
8669
- children: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdOutlineDone, {})
8717
+ children: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdOutlineDone, {})
8670
8718
  }
8671
8719
  ),
8672
8720
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8674,7 +8722,7 @@ var ImageInput = React26.forwardRef(
8674
8722
  {
8675
8723
  className: "text-red-500 hover:cursor-pointer",
8676
8724
  onClick: handleResetClick,
8677
- children: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdOutlineRemoveCircleOutline, {})
8725
+ children: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdOutlineRemoveCircleOutline, {})
8678
8726
  }
8679
8727
  )
8680
8728
  ] })
@@ -8830,7 +8878,7 @@ function MultiImageInput({
8830
8878
  children: [
8831
8879
  /* @__PURE__ */ jsxRuntime.jsx(ImageView, { imageUrl: url }),
8832
8880
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute left-2 top-2 inline-flex items-center gap-1 rounded bg-black/60 px-2 py-1 text-xs text-white", children: [
8833
- /* @__PURE__ */ jsxRuntime.jsx(index_js.MdDragIndicator, {}),
8881
+ /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdDragIndicator, {}),
8834
8882
  index3 + 1
8835
8883
  ] }),
8836
8884
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute right-2 top-2 flex gap-1", children: [
@@ -8841,7 +8889,7 @@ function MultiImageInput({
8841
8889
  accessibilityLabel: "Move image left",
8842
8890
  disabled: index3 === 0 || isOrganizerBusy,
8843
8891
  glow: false,
8844
- icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdKeyboardArrowLeft, {}),
8892
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdKeyboardArrowLeft, {}),
8845
8893
  onPress: () => moveImage(index3, index3 - 1),
8846
8894
  size: "xs",
8847
8895
  className: "h-8 w-8 bg-black/60 p-0 text-xl text-white hover:bg-black/80 disabled:opacity-40"
@@ -8854,7 +8902,7 @@ function MultiImageInput({
8854
8902
  accessibilityLabel: "Move image right",
8855
8903
  disabled: index3 === imageUrls.length - 1 || isOrganizerBusy,
8856
8904
  glow: false,
8857
- icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdKeyboardArrowRight, {}),
8905
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdKeyboardArrowRight, {}),
8858
8906
  onPress: () => moveImage(index3, index3 + 1),
8859
8907
  size: "xs",
8860
8908
  className: "h-8 w-8 bg-black/60 p-0 text-xl text-white hover:bg-black/80 disabled:opacity-40"
@@ -8884,7 +8932,7 @@ function MultiImageInput({
8884
8932
  accessibilityLabel: "Change image",
8885
8933
  disabled: isOrganizerBusy,
8886
8934
  glow: false,
8887
- icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdUpload, {}),
8935
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdUpload, {}),
8888
8936
  onPress: () => openReplacePicker(index3),
8889
8937
  size: "sm",
8890
8938
  text: "Change",
@@ -8899,14 +8947,14 @@ function MultiImageInput({
8899
8947
  accessibilityLabel: "Delete image",
8900
8948
  disabled: isOrganizerBusy,
8901
8949
  glow: false,
8902
- icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdOutlineDelete, {}),
8950
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.MdOutlineDelete, {}),
8903
8951
  onPress: () => removeImage(index3),
8904
8952
  size: "sm",
8905
8953
  variant: "danger"
8906
8954
  }
8907
8955
  )
8908
8956
  ] }),
8909
- isReplacing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/60 text-2xl text-white", children: /* @__PURE__ */ jsxRuntime.jsx(index_js$1.AiOutlineLoading, { className: "animate-spin" }) })
8957
+ isReplacing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/60 text-2xl text-white", children: /* @__PURE__ */ jsxRuntime.jsx(index_js.AiOutlineLoading, { className: "animate-spin" }) })
8910
8958
  ]
8911
8959
  },
8912
8960
  `${url}-${index3}`
@@ -59461,6 +59509,7 @@ exports.ensureAnonymousIdStorage = ensureAnonymousIdStorage;
59461
59509
  exports.enumValues = enumValues;
59462
59510
  exports.euiToast = euiToast;
59463
59511
  exports.extractHeadings = extractHeadings;
59512
+ exports.extractTextColorClasses = extractTextColorClasses;
59464
59513
  exports.findReview = findReview;
59465
59514
  exports.formatChartLabel = formatChartLabel;
59466
59515
  exports.formatChartValue = formatChartValue;