@assure-one/design-system 1.43.0 → 1.44.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.
@@ -1,4 +1,4 @@
1
- import { cn, LoaderIcon, ChevronDownIcon, ChevronUpIcon, CheckIcon, MinusIcon, ChevronRightIcon, CircleIcon, FileTextIcon, EyeOffIcon, EyeIcon, XIcon, AlertTriangleIcon, UploadIcon } from './chunk-TBDTXAFH.js';
1
+ import { cn, LoaderIcon, ChevronDownIcon, ChevronUpIcon, CheckIcon, MinusIcon, ChevronRightIcon, CircleIcon, FileTextIcon, EyeOffIcon, EyeIcon, XIcon, AlertTriangleIcon, UploadIcon } from './chunk-E2URQD5A.js';
2
2
  import * as React7 from 'react';
3
3
  import { createContext, forwardRef, useMemo, useState, useRef, useCallback, useEffect, useContext, useId as useId$1, useLayoutEffect } from 'react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -3375,7 +3375,7 @@ var Input = forwardRef(function Input2({
3375
3375
  onClick: () => setShowPassword((prev) => !prev),
3376
3376
  ...slot(inputAnatomy, "password-toggle"),
3377
3377
  className: cn(
3378
- "ds:text-fg-4 ds:hover:text-fg ds:absolute ds:top-1/2 ds:right-2.5 ds:-translate-y-1/2 ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none ds:motion-reduce:transition-none",
3378
+ "ds:text-fg-4 ds:hover:text-fg ds:absolute ds:top-1/2 ds:right-1 ds:-translate-y-1/2 ds:inline-flex ds:size-7 ds:items-center ds:justify-center ds:rounded-control ds:transition-colors ds:duration-[var(--duration-fast)] ds:ease-[var(--ease-out-quart)] ds:focus-visible:[box-shadow:var(--shadow-focus-ring)] ds:focus-visible:outline-none ds:motion-reduce:transition-none",
3379
3379
  classNames?.["password-toggle"]
3380
3380
  ),
3381
3381
  "aria-label": showPassword ? messages.hidePassword : messages.showPassword,
@@ -3417,6 +3417,19 @@ var Input = forwardRef(function Input2({
3417
3417
  ] });
3418
3418
  });
3419
3419
  Input.displayName = "Input";
3420
+ function useFormReset2(elementRef, onReset, form) {
3421
+ const latest = useRef(onReset);
3422
+ latest.current = onReset;
3423
+ useEffect(() => {
3424
+ const element = elementRef.current;
3425
+ if (!element) return;
3426
+ const owner = form ? element.ownerDocument.getElementById(form) : element.closest("form");
3427
+ if (!owner) return;
3428
+ const handle = () => latest.current?.();
3429
+ owner.addEventListener("reset", handle);
3430
+ return () => owner.removeEventListener("reset", handle);
3431
+ }, [elementRef, form]);
3432
+ }
3420
3433
  var TEXTAREA_SIZE_ROWS = {
3421
3434
  sm: "ds:min-h-(--textarea-min-height-sm) ds:px-2.5 ds:py-1.5 ds:text-xs",
3422
3435
  md: "ds:min-h-(--textarea-min-height-md) ds:px-3 ds:py-2 ds:text-(length:--control-font-size-md)",
@@ -3499,7 +3512,15 @@ var Textarea = forwardRef(function Textarea2({
3499
3512
  const fieldSize = field?.size;
3500
3513
  const recipe = size ? { variant, size } : inputSize ? { variant, inputSize } : fieldSize && fieldSize in TEXTAREA_SIZE_ROWS ? { variant, size: fieldSize } : { variant, inputSize: "md" };
3501
3514
  const resolvedSize = recipe.size ?? recipe.inputSize ?? "md";
3502
- const currentLength = typeof value === "string" ? value.length : typeof defaultValue === "string" ? defaultValue.length : 0;
3515
+ const [uncontrolledLength, setUncontrolledLength] = useState(
3516
+ () => typeof defaultValue === "string" ? defaultValue.length : 0
3517
+ );
3518
+ useFormReset2(
3519
+ internalRef,
3520
+ () => setUncontrolledLength(internalRef.current?.defaultValue.length ?? 0),
3521
+ props.form
3522
+ );
3523
+ const currentLength = typeof value === "string" ? value.length : uncontrolledLength;
3503
3524
  return /* @__PURE__ */ jsxs("div", { className: cn("ds:w-full", rootClassName), children: [
3504
3525
  label && /* @__PURE__ */ jsx(
3505
3526
  "label",
@@ -3531,6 +3552,7 @@ var Textarea = forwardRef(function Textarea2({
3531
3552
  invalid: isInvalid
3532
3553
  }),
3533
3554
  onChange: (e) => {
3555
+ if (value === void 0) setUncontrolledLength(e.target.value.length);
3534
3556
  onChange?.(e);
3535
3557
  onValueChange?.(e.target.value);
3536
3558
  adjustHeight();
@@ -3773,6 +3795,6 @@ var DocumentRow = forwardRef(function DocumentRow2({ fileName, meta, icon, appro
3773
3795
  });
3774
3796
  DocumentRow.displayName = "DocumentRow";
3775
3797
 
3776
- export { Avatar, Backdrop, Button, CONTROL_GAP_CLASSES, CONTROL_LABEL_TEXT, CONTROL_SIZE_CLASSES, Checkbox, DEFAULT_OVERLAY_MESSAGES, DISABLED_LOOK_CLASSES, DISMISS_GLYPH_CLASSES, DesignSystemContext, DismissButton, DocumentDetailActions, DocumentDetailBody, DocumentDetailHeader, DocumentDetailMetaRow, DocumentDetailPanel, DocumentDetailRequester, DocumentDetailTitle, DocumentList, DocumentListSection, DocumentRow, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EN_MESSAGES, FIELD_PARTS, FLOATING_PADDING, FLOATING_WIDTH, FieldContext, FieldsetContext, FileChip, FileUpload, FormBridge, INERT_ATTRIBUTES, INERT_CLASSES, IconButton, Input, LIST_ITEM_INDICATOR_WELL, LIST_SEPARATOR, MENU_CHECK_GLYPH, MENU_INDICATOR_WELL, MENU_INSET, MENU_ITEM_DANGER, MENU_RADIO_GLYPH, MENU_SUB_TRIGGER_CHEVRON, ModalContent, ModalDescription, ModalOverlay, ModalPortal, ModalRoot, ModalTitle, OverlayBody, OverlayDescription, OverlayFooter, OverlayHeader, OverlaySurface, OverlayTitle, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, Portal, PortalContainerContext, Pressable, SPINNER_TONE_TO_INTENT, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Spinner, TOOLTIP_DEFAULT_DELAY_MS, Textarea, ThemeScope, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, alertDialogAnatomy, badgeAnatomy, buttonBase, buttonVariants, cardAnatomy, chipAnatomy, codeAnatomy, comboboxAnatomy, commandAnatomy, contextMenuAnatomy, controlChrome, dataTableAnatomy, deprecate, dialogAnatomy, errorOnce, fieldAnatomy, fieldsetAnatomy, floatingSurfaceClasses, groupHeadingClasses, headingAnatomy, iconButtonVariants, inertHandlers, inlineAnatomy, inputVariants, isLabelable, joinIds, kbdAnatomy, labelAnatomy, linkButtonAnatomy, listItemAttributes, listItemClasses, menuIndicatorItemClasses, menuItemClasses, menuLabelClasses, menuSeparatorClasses, menuShortcutClasses, menuSubTriggerClasses, mergeRefs, microInteractions, numberInputAnatomy, optionElementId, paginationAnatomy, partId, phoneFieldAnatomy, presence, radioGroupAnatomy, resolveButtonIcons, resolveButtonStyle, searchInputAnatomy, sheetAnatomy, shellAnatomy, sideDrawerAnatomy, sidebarAnatomy, sidebarBrandSwitcherAnatomy, slot, spinnerVariants, stackAnatomy, stateAttributes, statusBadgeAnatomy, surfaceAnatomy, switchAnatomy, tableAnatomy, textAnatomy, textareaVariants, toastAnatomy, useControllableState, useDsMessages, useExitPresence, useFieldContext, useFieldControl, useFieldsetContext, useFieldsetLegend, useFieldsetState, useFormReset, useId, useImageComponent, useLinkComponent, useMergedRefs, warnLegacyButtonProps, withPortalContainer };
3777
- //# sourceMappingURL=chunk-XJKCKBHI.js.map
3778
- //# sourceMappingURL=chunk-XJKCKBHI.js.map
3798
+ export { Avatar, Backdrop, Button, CONTROL_GAP_CLASSES, CONTROL_LABEL_TEXT, CONTROL_SIZE_CLASSES, Checkbox, DEFAULT_OVERLAY_MESSAGES, DISABLED_LOOK_CLASSES, DISMISS_GLYPH_CLASSES, DesignSystemContext, DismissButton, DocumentDetailActions, DocumentDetailBody, DocumentDetailHeader, DocumentDetailMetaRow, DocumentDetailPanel, DocumentDetailRequester, DocumentDetailTitle, DocumentList, DocumentListSection, DocumentRow, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EN_MESSAGES, FIELD_PARTS, FLOATING_PADDING, FLOATING_WIDTH, FieldContext, FieldsetContext, FileChip, FileUpload, FormBridge, INERT_ATTRIBUTES, INERT_CLASSES, IconButton, Input, LIST_ITEM_INDICATOR_WELL, LIST_SEPARATOR, MENU_CHECK_GLYPH, MENU_INDICATOR_WELL, MENU_INSET, MENU_ITEM_DANGER, MENU_RADIO_GLYPH, MENU_SUB_TRIGGER_CHEVRON, ModalContent, ModalDescription, ModalOverlay, ModalPortal, ModalRoot, ModalTitle, OverlayBody, OverlayDescription, OverlayFooter, OverlayHeader, OverlaySurface, OverlayTitle, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, Portal, PortalContainerContext, Pressable, SPINNER_TONE_TO_INTENT, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Spinner, TOOLTIP_DEFAULT_DELAY_MS, Textarea, ThemeScope, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, alertDialogAnatomy, badgeAnatomy, buttonBase, buttonVariants, cardAnatomy, chipAnatomy, codeAnatomy, comboboxAnatomy, commandAnatomy, contextMenuAnatomy, controlChrome, dataTableAnatomy, deprecate, dialogAnatomy, errorOnce, fieldAnatomy, fieldsetAnatomy, floatingSurfaceClasses, groupHeadingClasses, headingAnatomy, iconButtonVariants, inertHandlers, inlineAnatomy, inputVariants, isLabelable, joinIds, kbdAnatomy, labelAnatomy, linkButtonAnatomy, listItemAttributes, listItemClasses, menuIndicatorItemClasses, menuItemClasses, menuLabelClasses, menuSeparatorClasses, menuShortcutClasses, menuSubTriggerClasses, mergeRefs, microInteractions, numberInputAnatomy, optionElementId, paginationAnatomy, partId, phoneFieldAnatomy, presence, radioGroupAnatomy, resolveButtonIcons, resolveButtonStyle, searchInputAnatomy, sheetAnatomy, shellAnatomy, sideDrawerAnatomy, sidebarAnatomy, sidebarBrandSwitcherAnatomy, slot, spinnerVariants, stackAnatomy, stateAttributes, statusBadgeAnatomy, surfaceAnatomy, switchAnatomy, tableAnatomy, textAnatomy, textareaVariants, toastAnatomy, useControllableState, useDsMessages, useExitPresence, useFieldContext, useFieldControl, useFieldsetContext, useFieldsetLegend, useFieldsetState, useFormReset, useFormReset2, useId, useImageComponent, useLinkComponent, useMergedRefs, warnLegacyButtonProps, withPortalContainer };
3799
+ //# sourceMappingURL=chunk-Z7QPHPNV.js.map
3800
+ //# sourceMappingURL=chunk-Z7QPHPNV.js.map