@ahrowe/ui 0.23.0 → 0.24.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.
Files changed (81) hide show
  1. package/dist/esm/common/alert/alert.types.mjs.map +1 -1
  2. package/dist/esm/common/badge/badge.types.mjs.map +1 -1
  3. package/dist/esm/common/button/button.mjs +1 -1
  4. package/dist/esm/common/button/button.mjs.map +1 -1
  5. package/dist/esm/common/button/button.module.mjs +1 -1
  6. package/dist/esm/common/button/button.module.mjs.map +1 -1
  7. package/dist/esm/common/button/button.types.mjs +1 -1
  8. package/dist/esm/common/button/button.types.mjs.map +1 -1
  9. package/dist/esm/common/card/Card.mjs +1 -1
  10. package/dist/esm/common/card/Card.mjs.map +1 -1
  11. package/dist/esm/common/card/card.types.mjs.map +1 -1
  12. package/dist/esm/common/chip/chip.mjs +1 -1
  13. package/dist/esm/common/chip/chip.mjs.map +1 -1
  14. package/dist/esm/common/chip/chip.types.mjs.map +1 -1
  15. package/dist/esm/common/dropZone/dropZone.types.mjs.map +1 -1
  16. package/dist/esm/common/floatingMenu/floatingMenu.types.mjs.map +1 -1
  17. package/dist/esm/common/hooks/useCoarsePointer.mjs +2 -0
  18. package/dist/esm/common/hooks/useCoarsePointer.mjs.map +1 -0
  19. package/dist/esm/common/hooks/useSwipeDismiss.mjs +1 -1
  20. package/dist/esm/common/hooks/useSwipeDismiss.mjs.map +1 -1
  21. package/dist/esm/common/iconPicker/iconPicker.mjs +1 -1
  22. package/dist/esm/common/iconPicker/iconPicker.mjs.map +1 -1
  23. package/dist/esm/common/input/input.types.mjs.map +1 -1
  24. package/dist/esm/common/interactableDiv/interactableDiv.mjs +1 -1
  25. package/dist/esm/common/interactableDiv/interactableDiv.mjs.map +1 -1
  26. package/dist/esm/common/numberInput/index.mjs.map +1 -1
  27. package/dist/esm/common/numberInput/numberInput.mjs +1 -1
  28. package/dist/esm/common/numberInput/numberInput.mjs.map +1 -1
  29. package/dist/esm/common/numberInput/numberInput.module.mjs +1 -1
  30. package/dist/esm/common/numberInput/numberInput.module.mjs.map +1 -1
  31. package/dist/esm/common/numberInput/useStepRepeat.mjs +2 -0
  32. package/dist/esm/common/numberInput/useStepRepeat.mjs.map +1 -0
  33. package/dist/esm/common/otpInput/otpInput.types.mjs.map +1 -1
  34. package/dist/esm/common/popover/popover.types.mjs.map +1 -1
  35. package/dist/esm/common/radioGroup/radioGroup.types.mjs.map +1 -1
  36. package/dist/esm/common/sectionHeader/sectionHeader.types.mjs.map +1 -1
  37. package/dist/index.cjs +6 -6
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/style.css +1 -1
  40. package/dist/types/package/common/alert/alert.types.d.ts +1 -1
  41. package/dist/types/package/common/animatedLogo/animatedLogo.types.d.ts +11 -3
  42. package/dist/types/package/common/avatar/avatar.types.d.ts +1 -1
  43. package/dist/types/package/common/badge/badge.types.d.ts +1 -1
  44. package/dist/types/package/common/button/button.types.d.ts +10 -4
  45. package/dist/types/package/common/card/card.types.d.ts +1 -1
  46. package/dist/types/package/common/carousel/carousel.types.d.ts +1 -1
  47. package/dist/types/package/common/checkbox/checkbox.types.d.ts +1 -1
  48. package/dist/types/package/common/chip/chip.types.d.ts +2 -0
  49. package/dist/types/package/common/colorPicker/colorPicker.types.d.ts +1 -1
  50. package/dist/types/package/common/configProvider/configProvider.types.d.ts +1 -1
  51. package/dist/types/package/common/dropZone/dropZone.types.d.ts +1 -1
  52. package/dist/types/package/common/dropdown/dropdown.types.d.ts +1 -1
  53. package/dist/types/package/common/errorBoundary/errorBoundary.types.d.ts +1 -1
  54. package/dist/types/package/common/floatingMenu/floatingMenu.types.d.ts +1 -1
  55. package/dist/types/package/common/hooks/useCoarsePointer.d.ts +10 -0
  56. package/dist/types/package/common/iconPicker/iconPicker.types.d.ts +1 -1
  57. package/dist/types/package/common/input/input.types.d.ts +2 -2
  58. package/dist/types/package/common/inputDropdown/inputDropdown.types.d.ts +1 -1
  59. package/dist/types/package/common/interactableDiv/interactableDiv.d.ts +2 -2
  60. package/dist/types/package/common/kanbanBoard/kanbanBoard.types.d.ts +1 -1
  61. package/dist/types/package/common/numberInput/index.d.ts +1 -0
  62. package/dist/types/package/common/numberInput/numberInput.d.ts +3 -32
  63. package/dist/types/package/common/numberInput/numberInput.types.d.ts +61 -0
  64. package/dist/types/package/common/numberInput/useStepRepeat.d.ts +17 -0
  65. package/dist/types/package/common/optionPicker/optionPicker.types.d.ts +1 -1
  66. package/dist/types/package/common/otpInput/otpInput.types.d.ts +1 -1
  67. package/dist/types/package/common/popover/popover.types.d.ts +1 -1
  68. package/dist/types/package/common/radioGroup/radioGroup.types.d.ts +1 -1
  69. package/dist/types/package/common/rating/rating.types.d.ts +1 -1
  70. package/dist/types/package/common/searchInput/searchInput.types.d.ts +1 -1
  71. package/dist/types/package/common/sectionHeader/sectionHeader.types.d.ts +1 -1
  72. package/dist/types/package/common/slider/slider.types.d.ts +1 -1
  73. package/dist/types/package/common/switch/switch.types.d.ts +1 -1
  74. package/dist/types/package/common/tabHeader/tabHeader.types.d.ts +1 -1
  75. package/dist/types/package/common/timeInput/timeInput.types.d.ts +1 -1
  76. package/dist/types/package/common/types/baseProps.types.d.ts +20 -5
  77. package/dist/types/package/common/types/slots.types.d.ts +1 -1
  78. package/docs/Button.md +23 -2
  79. package/docs/Chip.md +1 -0
  80. package/docs/NumberInput.md +66 -2
  81. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"alert.types.mjs","names":[],"sources":["../../../../package/common/alert/alert.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport type { IconContent } from '../types/icon.types';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum AlertStyleType {\n Default = 'default',\n Info = 'info',\n Success = 'success',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport type AlertSlots = 'root' | 'icon' | 'content' | 'title' | 'description' | 'closeButton';\n\nexport interface AlertProps extends HtmlProps {\n title?: ReactNode;\n children?: ReactNode;\n styleType?: AlertStyleType;\n icon?: IconContent;\n hideIcon?: boolean;\n onClose?: () => void;\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<AlertSlots>;\n styles?: SlotStyles<AlertSlots>;\n}\n"],"mappings":"AAIA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"alert.types.mjs","names":[],"sources":["../../../../package/common/alert/alert.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport type { IconContent } from '../types/icon.types';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum AlertStyleType {\n Default = 'default',\n Info = 'info',\n Success = 'success',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport type AlertSlots = 'root' | 'icon' | 'content' | 'title' | 'description' | 'closeButton';\n\nexport interface AlertProps extends Omit<HtmlProps, 'title'> {\n title?: ReactNode;\n children?: ReactNode;\n styleType?: AlertStyleType;\n icon?: IconContent;\n hideIcon?: boolean;\n onClose?: () => void;\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<AlertSlots>;\n styles?: SlotStyles<AlertSlots>;\n}\n"],"mappings":"AAIA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"badge.types.mjs","names":[],"sources":["../../../../package/common/badge/badge.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum BadgeStyleType {\n Default = 'default',\n Primary = 'primary',\n Success = 'success',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport enum BadgePosition {\n TopRight = 'top-right',\n TopLeft = 'top-left',\n BottomRight = 'bottom-right',\n BottomLeft = 'bottom-left',\n}\n\nexport type BadgeSlots = 'badge';\n\nexport interface BadgeProps extends HtmlProps {\n count?: number;\n max?: number;\n content?: ReactNode;\n dot?: boolean;\n showZero?: boolean;\n styleType?: BadgeStyleType;\n position?: BadgePosition;\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<BadgeSlots>;\n styles?: SlotStyles<BadgeSlots>;\n}\n"],"mappings":"AAGA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,SAAA,YACA,EAAA,QAAA,WACA,EAAA,YAAA,eACA,EAAA,WAAA,eACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"badge.types.mjs","names":[],"sources":["../../../../package/common/badge/badge.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum BadgeStyleType {\n Default = 'default',\n Primary = 'primary',\n Success = 'success',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport enum BadgePosition {\n TopRight = 'top-right',\n TopLeft = 'top-left',\n BottomRight = 'bottom-right',\n BottomLeft = 'bottom-left',\n}\n\nexport type BadgeSlots = 'badge';\n\nexport interface BadgeProps extends Omit<HtmlProps, 'content'> {\n count?: number;\n max?: number;\n content?: ReactNode;\n dot?: boolean;\n showZero?: boolean;\n styleType?: BadgeStyleType;\n position?: BadgePosition;\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<BadgeSlots>;\n styles?: SlotStyles<BadgeSlots>;\n}\n"],"mappings":"AAGA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,SAAA,YACA,EAAA,QAAA,WACA,EAAA,YAAA,eACA,EAAA,WAAA,eACF,EAAA,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"./button.module.mjs";import n from"../loading/spinnerLoading/index.mjs";import{ButtonSize as r,ButtonStyleType as i,ButtonType as a}from"./button.types.mjs";import o from"../ripple/ripple.mjs";import{renderIcon as s}from"../utils/renderIcon.mjs";import c from"classnames";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={default:t.buttonStyleDefault,primary:t.buttonStylePrimary,delete:t.buttonStyleDelete},f={default:t.buttonSizeDefault,small:t.buttonSizeSmall,medium:t.buttonSizeMedium,large:t.buttonSizeLarge};function p(p){let{className:m,style:h,type:g=a.Button,styleType:_=i.Default,size:v=r.Default,onClick:y=()=>{},children:b,icon:x,isLoading:S=!1,disabled:C=!1,title:w=void 0,ref:T,classNames:E,styles:D,...O}=e(`Button`,p);return l(`button`,{...O,className:c(t.button,d[_],f[v],{[t.buttonNotAllowed]:S||C},m),style:h,type:g,onClick:y,disabled:C||S,title:w,ref:T,children:l(o,{disabled:S||C,children:l(`div`,{className:c(t.buttonBackground,E?.background),style:D?.background,children:u(`div`,{className:c(t.buttonContent,E?.content),style:D?.content,children:[S?l(`div`,{className:c(t.buttonLoadingContainer,E?.loadingContainer),style:D?.loadingContainer,children:l(n,{className:t.buttonLoadingIcon})}):null,u(`div`,{className:c(E?.label,{[t.buttonLoading]:S,[t.buttonWithIcon]:!!x}),style:D?.label,children:[x?s(x):null,b]})]})})})})}p.StyleType=i,p.Size=r,p.Type=a;export{p as default};
1
+ import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"./button.module.mjs";import n from"../loading/spinnerLoading/index.mjs";import{ButtonSize as r,ButtonStyleType as i,ButtonType as a}from"./button.types.mjs";import o from"../ripple/ripple.mjs";import{renderIcon as s}from"../utils/renderIcon.mjs";import{useRef as c}from"react";import l from"classnames";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f={default:t.buttonStyleDefault,primary:t.buttonStylePrimary,delete:t.buttonStyleDelete},p={default:t.buttonSizeDefault,small:t.buttonSizeSmall,medium:t.buttonSizeMedium,large:t.buttonSizeLarge,icon:t.buttonSizeIcon};function m(m){let{className:h,style:g,type:_=a.Button,styleType:v=i.Default,size:y=r.Default,onClick:b=()=>{},children:x,icon:S,isLoading:C=!1,disabled:w=!1,title:T=void 0,ref:E,classNames:D,styles:O,...k}=e(`Button`,m),A=c(null);function j(e){return e.detail===0&&A.current?.addRipple(),b(e)}return u(`button`,{...k,className:l(t.button,f[v],p[y],{[t.buttonNotAllowed]:C||w},h),style:g,type:_,onClick:j,disabled:w||C,title:T,ref:E,children:u(o,{ref:A,className:t.buttonRipple,disabled:C||w,children:u(`div`,{className:l(t.buttonBackground,D?.background),style:O?.background,children:d(`div`,{className:l(t.buttonContent,D?.content),style:O?.content,children:[C?u(`div`,{className:l(t.buttonLoadingContainer,D?.loadingContainer),style:O?.loadingContainer,children:u(n,{className:t.buttonLoadingIcon})}):null,d(`div`,{className:l(D?.label,{[t.buttonLoading]:C,[t.buttonWithIcon]:!!S}),style:O?.label,children:[S?s(S):null,x]})]})})})})}m.StyleType=i,m.Size=r,m.Type=a;export{m as default};
2
2
  //# sourceMappingURL=button.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.mjs","names":[],"sources":["../../../../package/common/button/button.tsx"],"sourcesContent":["import cx from 'classnames';\nimport type { ReactElement } from 'react';\n\nimport styles from './button.module.pcss';\nimport SpinnerLoading from 'components/common/loading/spinnerLoading';\nimport { ButtonStyleType, ButtonSize, ButtonType } from './button.types';\nimport type { ButtonProps } from './button.types';\nimport Ripple from '../ripple';\nimport { useComponentDefaults } from '../configProvider';\nimport { renderIcon } from '../utils/renderIcon';\n\nconst CLASS_BY_STYLE: Record<ButtonStyleType, string> = {\n default: styles.buttonStyleDefault,\n primary: styles.buttonStylePrimary,\n delete: styles.buttonStyleDelete,\n};\n\nconst CLASS_BY_SIZE: Record<ButtonSize, string> = {\n default: styles.buttonSizeDefault,\n small: styles.buttonSizeSmall,\n medium: styles.buttonSizeMedium,\n large: styles.buttonSizeLarge,\n};\n\nfunction Button(props: ButtonProps): ReactElement {\n const {\n className,\n style,\n type = ButtonType.Button,\n styleType = ButtonStyleType.Default,\n size = ButtonSize.Default,\n onClick = (): void => {},\n children,\n icon,\n isLoading = false,\n disabled = false,\n title = undefined,\n ref,\n classNames,\n styles: slotStyles,\n ...rest\n } = useComponentDefaults('Button', props);\n return (\n <button\n {...rest}\n className={cx(\n styles.button,\n CLASS_BY_STYLE[styleType],\n CLASS_BY_SIZE[size],\n {\n [styles.buttonNotAllowed]: isLoading || disabled,\n },\n className\n )}\n style={style}\n type={type}\n onClick={onClick}\n disabled={disabled || isLoading}\n title={title}\n ref={ref}\n >\n <Ripple disabled={isLoading || disabled}>\n <div className={cx(styles.buttonBackground, classNames?.background)} style={slotStyles?.background}>\n <div className={cx(styles.buttonContent, classNames?.content)} style={slotStyles?.content}>\n {isLoading ? (\n <div className={cx(styles.buttonLoadingContainer, classNames?.loadingContainer)} style={slotStyles?.loadingContainer}>\n <SpinnerLoading className={styles.buttonLoadingIcon} />\n </div>\n ) : null}\n <div\n className={cx(classNames?.label, {\n [styles.buttonLoading]: isLoading,\n [styles.buttonWithIcon]: !!icon,\n })}\n style={slotStyles?.label}\n >\n {icon ? renderIcon(icon) : null}\n {children}\n </div>\n </div>\n </div>\n </Ripple>\n </button>\n );\n}\n\nButton.StyleType = ButtonStyleType;\nButton.Size = ButtonSize;\nButton.Type = ButtonType;\n\nexport default Button;\n"],"mappings":"kaAWA,IAAM,EAAkD,CACtD,QAAS,EAAO,mBAChB,QAAS,EAAO,mBAChB,OAAQ,EAAO,iBACjB,EAEM,EAA4C,CAChD,QAAS,EAAO,kBAChB,MAAO,EAAO,gBACd,OAAQ,EAAO,iBACf,MAAO,EAAO,eAChB,EAEA,SAAS,EAAO,EAAkC,CAChD,GAAM,CACN,YACA,QACA,OAAO,EAAW,OAClB,YAAY,EAAgB,QAC5B,OAAO,EAAW,QAClB,cAAsB,CAAC,EACvB,WACA,OACA,YAAY,GACZ,WAAW,GACX,QAAQ,IAAA,GACR,MACA,aACA,OAAQ,EACR,GAAG,GACC,EAAqB,SAAU,CAAK,EACxC,OACE,EAAC,SAAD,CACE,GAAI,EACJ,UAAW,EACT,EAAO,OACP,EAAe,GACf,EAAc,GACd,EACG,EAAO,kBAAmB,GAAa,CAC1C,EACA,CACF,EACO,QACD,OACG,UACT,SAAU,GAAY,EACf,QACF,eAEL,EAAC,EAAD,CAAQ,SAAU,GAAa,WAC7B,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,iBAAkB,GAAY,UAAU,EAAG,MAAO,GAAY,oBACtF,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,cAAe,GAAY,OAAO,EAAG,MAAO,GAAY,iBAAlF,CACG,EACC,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,uBAAwB,GAAY,gBAAgB,EAAG,MAAO,GAAY,0BAClG,EAAC,EAAD,CAAgB,UAAW,EAAO,iBAAoB,CAAA,CACnD,CAAA,EACH,KACJ,EAAC,MAAD,CACE,UAAW,EAAG,GAAY,MAAO,EAC9B,EAAO,eAAgB,GACvB,EAAO,gBAAiB,CAAC,CAAC,CAC7B,CAAC,EACD,MAAO,GAAY,eALrB,CAOG,EAAO,EAAW,CAAI,EAAI,KAC1B,CACE,GACF,GACF,CAAA,CACC,CAAA,CACF,CAAA,CAEZ,CAEA,EAAO,UAAY,EACnB,EAAO,KAAO,EACd,EAAO,KAAO"}
1
+ {"version":3,"file":"button.mjs","names":[],"sources":["../../../../package/common/button/button.tsx"],"sourcesContent":["import cx from 'classnames';\nimport { useRef, type ReactElement } from 'react';\n\nimport styles from './button.module.pcss';\nimport SpinnerLoading from 'components/common/loading/spinnerLoading';\nimport { ButtonStyleType, ButtonSize, ButtonType } from './button.types';\nimport type { ButtonProps } from './button.types';\nimport Ripple from '../ripple';\nimport type { RippleHandle } from '../ripple';\nimport { useComponentDefaults } from '../configProvider';\nimport { renderIcon } from '../utils/renderIcon';\n\nconst CLASS_BY_STYLE: Record<ButtonStyleType, string> = {\n default: styles.buttonStyleDefault,\n primary: styles.buttonStylePrimary,\n delete: styles.buttonStyleDelete,\n};\n\nconst CLASS_BY_SIZE: Record<ButtonSize, string> = {\n default: styles.buttonSizeDefault,\n small: styles.buttonSizeSmall,\n medium: styles.buttonSizeMedium,\n large: styles.buttonSizeLarge,\n icon: styles.buttonSizeIcon,\n};\n\nfunction Button(props: ButtonProps): ReactElement {\n const {\n className,\n style,\n type = ButtonType.Button,\n styleType = ButtonStyleType.Default,\n size = ButtonSize.Default,\n onClick = (): void => {},\n children,\n icon,\n isLoading = false,\n disabled = false,\n title = undefined,\n ref,\n classNames,\n styles: slotStyles,\n ...rest\n } = useComponentDefaults('Button', props);\n\n const rippleRef = useRef<RippleHandle>(null);\n\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n if (event.detail === 0) rippleRef.current?.addRipple();\n return onClick(event);\n }\n\n return (\n <button\n {...rest}\n className={cx(\n styles.button,\n CLASS_BY_STYLE[styleType],\n CLASS_BY_SIZE[size],\n {\n [styles.buttonNotAllowed]: isLoading || disabled,\n },\n className\n )}\n style={style}\n type={type}\n onClick={handleClick}\n disabled={disabled || isLoading}\n title={title}\n ref={ref}\n >\n <Ripple ref={rippleRef} className={styles.buttonRipple} disabled={isLoading || disabled}>\n <div className={cx(styles.buttonBackground, classNames?.background)} style={slotStyles?.background}>\n <div className={cx(styles.buttonContent, classNames?.content)} style={slotStyles?.content}>\n {isLoading ? (\n <div className={cx(styles.buttonLoadingContainer, classNames?.loadingContainer)} style={slotStyles?.loadingContainer}>\n <SpinnerLoading className={styles.buttonLoadingIcon} />\n </div>\n ) : null}\n <div\n className={cx(classNames?.label, {\n [styles.buttonLoading]: isLoading,\n [styles.buttonWithIcon]: !!icon,\n })}\n style={slotStyles?.label}\n >\n {icon ? renderIcon(icon) : null}\n {children}\n </div>\n </div>\n </div>\n </Ripple>\n </button>\n );\n}\n\nButton.StyleType = ButtonStyleType;\nButton.Size = ButtonSize;\nButton.Type = ButtonType;\n\nexport default Button;\n"],"mappings":"icAYA,IAAM,EAAkD,CACtD,QAAS,EAAO,mBAChB,QAAS,EAAO,mBAChB,OAAQ,EAAO,iBACjB,EAEM,EAA4C,CAChD,QAAS,EAAO,kBAChB,MAAO,EAAO,gBACd,OAAQ,EAAO,iBACf,MAAO,EAAO,gBACd,KAAM,EAAO,cACf,EAEA,SAAS,EAAO,EAAkC,CAChD,GAAM,CACN,YACA,QACA,OAAO,EAAW,OAClB,YAAY,EAAgB,QAC5B,OAAO,EAAW,QAClB,cAAsB,CAAC,EACvB,WACA,OACA,YAAY,GACZ,WAAW,GACX,QAAQ,IAAA,GACR,MACA,aACA,OAAQ,EACR,GAAG,GACC,EAAqB,SAAU,CAAK,EAElC,EAAY,EAAqB,IAAI,EAE3C,SAAS,EAAY,EAA4C,CAE/D,OADI,EAAM,SAAW,GAAG,EAAU,SAAS,UAAU,EAC9C,EAAQ,CAAK,CACtB,CAEA,OACE,EAAC,SAAD,CACE,GAAI,EACJ,UAAW,EACT,EAAO,OACP,EAAe,GACf,EAAc,GACd,EACG,EAAO,kBAAmB,GAAa,CAC1C,EACA,CACF,EACO,QACD,OACN,QAAS,EACT,SAAU,GAAY,EACf,QACF,eAEL,EAAC,EAAD,CAAQ,IAAK,EAAW,UAAW,EAAO,aAAc,SAAU,GAAa,WAC7E,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,iBAAkB,GAAY,UAAU,EAAG,MAAO,GAAY,oBACtF,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,cAAe,GAAY,OAAO,EAAG,MAAO,GAAY,iBAAlF,CACG,EACC,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,uBAAwB,GAAY,gBAAgB,EAAG,MAAO,GAAY,0BAClG,EAAC,EAAD,CAAgB,UAAW,EAAO,iBAAoB,CAAA,CACnD,CAAA,EACH,KACJ,EAAC,MAAD,CACE,UAAW,EAAG,GAAY,MAAO,EAC9B,EAAO,eAAgB,GACvB,EAAO,gBAAiB,CAAC,CAAC,CAC7B,CAAC,EACD,MAAO,GAAY,eALrB,CAOG,EAAO,EAAW,CAAI,EAAI,KAC1B,CACE,GACF,GACF,CAAA,CACC,CAAA,CACF,CAAA,CAEZ,CAEA,EAAO,UAAY,EACnB,EAAO,KAAO,EACd,EAAO,KAAO"}
@@ -1,2 +1,2 @@
1
- var e={button:`button_wYLPJ`,"button-notAllowed":`button-notAllowed_xGT-E`,buttonNotAllowed:`button-notAllowed_xGT-E`,"button-loading-icon":`button-loading-icon_1pTTz`,buttonLoadingIcon:`button-loading-icon_1pTTz`,"button-content":`button-content_Q-0-4`,buttonContent:`button-content_Q-0-4`,"button-loading":`button-loading_TY6y7`,buttonLoading:`button-loading_TY6y7`,"button-loading-container":`button-loading-container_pMSta`,buttonLoadingContainer:`button-loading-container_pMSta`,"button-withIcon":`button-withIcon_IXEKA`,buttonWithIcon:`button-withIcon_IXEKA`,"button-style-default":`button-style-default_JmAqD`,buttonStyleDefault:`button-style-default_JmAqD`,"button-style-primary":`button-style-primary_Ra5i-`,buttonStylePrimary:`button-style-primary_Ra5i-`,"button-style-delete":`button-style-delete_jpTCf`,buttonStyleDelete:`button-style-delete_jpTCf`,"button-background":`button-background_9Vfo5`,buttonBackground:`button-background_9Vfo5`,"button-size-default":`button-size-default_N4HG9`,buttonSizeDefault:`button-size-default_N4HG9`,"button-size-small":`button-size-small_mn6jE`,buttonSizeSmall:`button-size-small_mn6jE`,"button-size-small-background":`button-size-small-background_KILXc`,buttonSizeSmallBackground:`button-size-small-background_KILXc`,"button-size-medium":`button-size-medium_gNVDM`,buttonSizeMedium:`button-size-medium_gNVDM`,"button-size-large":`button-size-large_xSIcS`,buttonSizeLarge:`button-size-large_xSIcS`};export{e as default};
1
+ var e={button:`button_wYLPJ`,"button-notAllowed":`button-notAllowed_xGT-E`,buttonNotAllowed:`button-notAllowed_xGT-E`,"button-loading-icon":`button-loading-icon_1pTTz`,buttonLoadingIcon:`button-loading-icon_1pTTz`,"button-content":`button-content_Q-0-4`,buttonContent:`button-content_Q-0-4`,"button-loading":`button-loading_TY6y7`,buttonLoading:`button-loading_TY6y7`,"button-loading-container":`button-loading-container_pMSta`,buttonLoadingContainer:`button-loading-container_pMSta`,"button-withIcon":`button-withIcon_IXEKA`,buttonWithIcon:`button-withIcon_IXEKA`,"button-style-default":`button-style-default_JmAqD`,buttonStyleDefault:`button-style-default_JmAqD`,"button-style-primary":`button-style-primary_Ra5i-`,buttonStylePrimary:`button-style-primary_Ra5i-`,"button-style-delete":`button-style-delete_jpTCf`,buttonStyleDelete:`button-style-delete_jpTCf`,"button-background":`button-background_9Vfo5`,buttonBackground:`button-background_9Vfo5`,"button-size-default":`button-size-default_N4HG9`,buttonSizeDefault:`button-size-default_N4HG9`,"button-size-small":`button-size-small_mn6jE`,buttonSizeSmall:`button-size-small_mn6jE`,"button-size-small-background":`button-size-small-background_KILXc`,buttonSizeSmallBackground:`button-size-small-background_KILXc`,"button-size-medium":`button-size-medium_gNVDM`,buttonSizeMedium:`button-size-medium_gNVDM`,"button-size-large":`button-size-large_xSIcS`,buttonSizeLarge:`button-size-large_xSIcS`,"button-size-icon":`button-size-icon_pkqwl`,buttonSizeIcon:`button-size-icon_pkqwl`,"button-ripple":`button-ripple_UGtt8`,buttonRipple:`button-ripple_UGtt8`};export{e as default};
2
2
  //# sourceMappingURL=button.module.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.module.mjs","names":[],"sources":["../../../../package/common/button/button.module.pcss"],"sourcesContent":[".button {\n appearance: none;\n -webkit-appearance: none;\n box-sizing: border-box;\n font-size: 16px;\n background: transparent;\n color: var(--text-color);\n border: 1px solid transparent;\n padding: 0;\n font-family: var(--default-font);\n border-radius: var(--default-border-radius);\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n overflow: hidden;\n\n &-notAllowed {\n cursor: not-allowed;\n filter: opacity(0.8);\n }\n\n &-loading-icon {\n width: 100% !important;\n height: 100% !important;\n }\n\n &-content {\n position: relative;\n white-space: break-spaces;\n\n div {\n text-overflow: ellipsis;\n overflow: hidden;\n }\n }\n\n &-loading {\n visibility: hidden;\n\n &-container {\n position: absolute;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n }\n\n &-withIcon {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-s);\n }\n\n &-style {\n &-default {\n background: var(--button-default-background, transparent);\n color: var(--button-default-color, var(--text-color));\n border: var(--button-default-border, 1px solid transparent);\n }\n\n &-primary {\n background: var(--primary-color);\n color: var(--text-color);\n color: var(--text-on-primary);\n\n .button-loading-icon {\n stroke: var(--text-on-primary);\n }\n }\n\n &-delete {\n background: var(--error-color);\n color: var(--text-on-delete);\n\n .button-loading-icon {\n stroke: var(--text-on-delete);\n }\n }\n }\n\n &-background {\n display: block;\n padding: 8px 12px;\n }\n\n &-size {\n &-default {\n font-size: 16px;\n }\n\n &-small {\n /* Small button is same as default for now */\n font-size: 12px;\n\n &-background {\n display: block;\n padding: 0px;\n }\n }\n\n &-medium {\n /* Medium button is same as default for now */\n font-size: 16px;\n }\n\n &-large {\n /* Large button is same as default for now */\n font-size: 20px;\n }\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"button.module.mjs","names":[],"sources":["../../../../package/common/button/button.module.pcss"],"sourcesContent":[".button {\n appearance: none;\n -webkit-appearance: none;\n box-sizing: border-box;\n font-size: 16px;\n background: transparent;\n color: var(--text-color);\n border: 1px solid transparent;\n padding: 0;\n font-family: var(--default-font);\n border-radius: var(--default-border-radius);\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n overflow: hidden;\n min-width: min-content;\n\n &-notAllowed {\n cursor: not-allowed;\n filter: opacity(0.8);\n }\n\n &-loading-icon {\n width: 100% !important;\n height: 100% !important;\n }\n\n &-content {\n position: relative;\n white-space: break-spaces;\n\n div {\n text-overflow: ellipsis;\n overflow: hidden;\n }\n }\n\n &-loading {\n visibility: hidden;\n\n &-container {\n position: absolute;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n }\n\n &-withIcon {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-s);\n }\n\n &-style {\n &-default {\n background: var(--button-default-background, transparent);\n color: var(--button-default-color, var(--text-color));\n border: var(--button-default-border, 1px solid transparent);\n }\n\n &-primary {\n background: var(--primary-color);\n color: var(--text-color);\n color: var(--text-on-primary);\n\n .button-loading-icon {\n stroke: var(--text-on-primary);\n }\n }\n\n &-delete {\n background: var(--error-color);\n color: var(--text-on-delete);\n\n .button-loading-icon {\n stroke: var(--text-on-delete);\n }\n }\n }\n\n &-background {\n display: block;\n padding: 8px 12px;\n }\n\n &-size {\n &-default {\n font-size: 16px;\n }\n\n &-small {\n /* Small button is same as default for now */\n font-size: 12px;\n\n &-background {\n display: block;\n padding: 0px;\n }\n }\n\n &-medium {\n /* Medium button is same as default for now */\n font-size: 16px;\n }\n\n &-large {\n /* Large button is same as default for now */\n font-size: 20px;\n }\n\n /* Square, padding-free button for a lone icon; the caller sets the box size. */\n &-icon {\n display: inline-flex;\n /* Inherits, unlike the other sizes: a hardcoded px value would have to be out-specified\n from another stylesheet, a specificity tie decided only by bundle order. */\n font-size: inherit;\n\n .button-ripple,\n .button-background,\n .button-content {\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n padding: 0;\n }\n }\n }\n}\n"],"mappings":""}
@@ -1,2 +1,2 @@
1
- var e=function(e){return e.Primary=`primary`,e.Default=`default`,e.Delete=`delete`,e}({}),t=function(e){return e.Default=`default`,e.Small=`small`,e.Medium=`medium`,e.Large=`large`,e}({}),n=function(e){return e.Button=`button`,e.Reset=`reset`,e.Submit=`submit`,e}({});export{t as ButtonSize,e as ButtonStyleType,n as ButtonType};
1
+ var e=function(e){return e.Primary=`primary`,e.Default=`default`,e.Delete=`delete`,e}({}),t=function(e){return e.Default=`default`,e.Small=`small`,e.Medium=`medium`,e.Large=`large`,e.Icon=`icon`,e}({}),n=function(e){return e.Button=`button`,e.Reset=`reset`,e.Submit=`submit`,e}({});export{t as ButtonSize,e as ButtonStyleType,n as ButtonType};
2
2
  //# sourceMappingURL=button.types.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.types.mjs","names":[],"sources":["../../../../package/common/button/button.types.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { IconContent } from '../types/icon.types';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum ButtonStyleType {\n Primary = 'primary',\n Default = 'default',\n Delete = 'delete',\n}\n\nexport enum ButtonSize {\n Default = 'default',\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Reset = 'reset',\n Submit = 'submit',\n}\n\nexport type ButtonSlots = 'background' | 'content' | 'loadingContainer' | 'label';\n\nexport interface ButtonProps extends HtmlProps {\n className?: string;\n style?: CSSProperties;\n type?: ButtonType;\n styleType?: ButtonStyleType;\n size?: ButtonSize;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => Promise<void> | void;\n children?: React.ReactNode;\n icon?: IconContent;\n isLoading?: boolean;\n disabled?: boolean;\n title?: string;\n ref?: React.Ref<HTMLButtonElement>;\n classNames?: SlotClassNames<ButtonSlots>;\n styles?: SlotStyles<ButtonSlots>;\n}\n"],"mappings":"AAIA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,MAAA,QACA,EAAA,OAAA,SACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,OAAA,SACA,EAAA,MAAA,QACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"button.types.mjs","names":[],"sources":["../../../../package/common/button/button.types.ts"],"sourcesContent":["import type React from 'react';\nimport type { CSSProperties } from 'react';\nimport type { IconContent } from '../types/icon.types';\nimport type { SlotClassNames, SlotStyles, DataProps } from '../types/slots.types';\n\nexport enum ButtonStyleType {\n Primary = 'primary',\n Default = 'default',\n Delete = 'delete',\n}\n\nexport enum ButtonSize {\n Default = 'default',\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n /** Square, padding-free button for a lone icon. Give it its own width/height. */\n Icon = 'icon',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Reset = 'reset',\n Submit = 'submit',\n}\n\nexport type ButtonSlots = 'background' | 'content' | 'loadingContainer' | 'label';\n\n/**\n * `DataProps` supplies the `data-*` index signature, which `ButtonHTMLAttributes` doesn't cover.\n * `type` and `onClick` below deliberately narrow their inherited counterparts.\n */\nexport interface ButtonProps extends DataProps, React.ButtonHTMLAttributes<HTMLButtonElement> {\n className?: string;\n style?: CSSProperties;\n type?: ButtonType;\n styleType?: ButtonStyleType;\n size?: ButtonSize;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => Promise<void> | void;\n children?: React.ReactNode;\n icon?: IconContent;\n isLoading?: boolean;\n disabled?: boolean;\n title?: string;\n ref?: React.Ref<HTMLButtonElement>;\n classNames?: SlotClassNames<ButtonSlots>;\n styles?: SlotStyles<ButtonSlots>;\n}\n"],"mappings":"AAKA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,MAAA,QACA,EAAA,OAAA,SACA,EAAA,MAAA,QAEA,EAAA,KAAA,QACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,OAAA,SACA,EAAA,MAAA,QACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../ripple/ripple.mjs";import n from"../interactableDiv/index.mjs";import{CardStyleType as r}from"./card.types.mjs";import i from"./card.module.mjs";import a from"classnames";import{jsx as o}from"react/jsx-runtime";var s={elevated:i.cardStyleElevated,outlined:i.cardStyleOutlined,filled:i.cardStyleFilled};function c(c){let{className:l=void 0,children:u=null,styleType:d=r.Elevated,onClick:f=void 0,tabIndex:p=null,hoverEffect:m=void 0,style:h=void 0,autoGap:g=!0,clip:_=!1,...v}=e(`Card`,c),y=!!f;return o(n,{...v,className:a(i.card,s[d],_&&i.cardClip,y&&i.cardInteractable,(y&&m!==!1||m)&&i.cardHover,l),onClick:f,tabIndex:p??(y?0:null),style:h,children:o(t,{disabled:!y,className:a(i.cardPadding,g&&i.cardGaps),style:{borderRadius:`inherit`},children:u})})}export{c as default};
1
+ import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../ripple/ripple.mjs";import n from"../interactableDiv/index.mjs";import{CardStyleType as r}from"./card.types.mjs";import i from"./card.module.mjs";import{useRef as a}from"react";import o from"classnames";import{jsx as s}from"react/jsx-runtime";var c={elevated:i.cardStyleElevated,outlined:i.cardStyleOutlined,filled:i.cardStyleFilled};function l(l){let{className:u=void 0,children:d=null,styleType:f=r.Elevated,onClick:p=void 0,tabIndex:m=null,hoverEffect:h=void 0,style:g=void 0,autoGap:_=!0,clip:v=!1,onKeyDown:y,...b}=e(`Card`,l),x=!!p,S=a(null);function C(e){x&&(e.key===`Enter`||e.key===` `)&&S.current?.addRipple(),y?.(e)}return s(n,{...b,className:o(i.card,c[f],v&&i.cardClip,x&&i.cardInteractable,(x&&h!==!1||h)&&i.cardHover,u),onClick:p,onKeyDown:C,tabIndex:m??(x?0:null),style:g,children:s(t,{ref:S,disabled:!x,className:o(i.cardPadding,_&&i.cardGaps),style:{borderRadius:`inherit`},children:d})})}export{l as default};
2
2
  //# sourceMappingURL=Card.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.mjs","names":[],"sources":["../../../../package/common/card/Card.tsx"],"sourcesContent":["import cx from 'classnames';\n\nimport { CardStyleType, type CardProps } from './card.types';\nimport styles from './card.module.pcss';\nimport InteractableDiv from '../interactableDiv';\nimport Ripple from '../ripple';\nimport { useComponentDefaults } from '../configProvider';\n\nconst CLASS_BY_STYLE: Record<CardStyleType, string> = {\n elevated: styles.cardStyleElevated,\n outlined: styles.cardStyleOutlined,\n filled: styles.cardStyleFilled,\n};\n\nfunction Card(props: CardProps) {\n const {\n className = undefined,\n children = null,\n styleType = CardStyleType.Elevated,\n onClick = undefined,\n tabIndex = null,\n hoverEffect = undefined,\n style = undefined,\n autoGap = true,\n clip = false,\n ...rest\n } = useComponentDefaults('Card', props);\n const isInteractable = !!onClick;\n\n return (\n <InteractableDiv\n {...rest}\n className={cx(\n styles.card,\n CLASS_BY_STYLE[styleType],\n clip && styles.cardClip,\n isInteractable && styles.cardInteractable,\n ((isInteractable && hoverEffect !== false) || hoverEffect) && styles.cardHover,\n className\n )}\n onClick={onClick}\n tabIndex={tabIndex ?? (isInteractable ? 0 : null)}\n style={style}\n >\n <Ripple\n disabled={!isInteractable}\n className={cx(styles.cardPadding, autoGap && styles.cardGaps)}\n style={{ borderRadius: 'inherit' }}\n >\n {children}\n </Ripple>\n </InteractableDiv>\n );\n}\n\nexport default Card;\n"],"mappings":"sTAQA,IAAM,EAAgD,CACpD,SAAU,EAAO,kBACjB,SAAU,EAAO,kBACjB,OAAQ,EAAO,eACjB,EAEA,SAAS,EAAK,EAAkB,CAC9B,GAAM,CACN,YAAY,IAAA,GACZ,WAAW,KACX,YAAY,EAAc,SAC1B,UAAU,IAAA,GACV,WAAW,KACX,cAAc,IAAA,GACd,QAAQ,IAAA,GACR,UAAU,GACV,OAAO,GACP,GAAG,GACC,EAAqB,OAAQ,CAAK,EAChC,EAAiB,CAAC,CAAC,EAEzB,OACE,EAAC,EAAD,CACE,GAAI,EACJ,UAAW,EACT,EAAO,KACP,EAAe,GACf,GAAQ,EAAO,SACf,GAAkB,EAAO,kBACvB,GAAkB,IAAgB,IAAU,IAAgB,EAAO,UACrE,CACF,EACS,UACT,SAAU,IAAa,EAAiB,EAAI,MACrC,iBAEP,EAAC,EAAD,CACE,SAAU,CAAC,EACX,UAAW,EAAG,EAAO,YAAa,GAAW,EAAO,QAAQ,EAC5D,MAAO,CAAE,aAAc,SAAU,EAEhC,UACK,CAAA,CACO,CAAA,CAErB"}
1
+ {"version":3,"file":"Card.mjs","names":[],"sources":["../../../../package/common/card/Card.tsx"],"sourcesContent":["import cx from 'classnames';\nimport React, { useRef } from 'react';\n\nimport { CardStyleType, type CardProps } from './card.types';\nimport styles from './card.module.pcss';\nimport InteractableDiv from '../interactableDiv';\nimport Ripple from '../ripple';\nimport type { RippleHandle } from '../ripple';\nimport { useComponentDefaults } from '../configProvider';\n\nconst CLASS_BY_STYLE: Record<CardStyleType, string> = {\n elevated: styles.cardStyleElevated,\n outlined: styles.cardStyleOutlined,\n filled: styles.cardStyleFilled,\n};\n\nfunction Card(props: CardProps) {\n const {\n className = undefined,\n children = null,\n styleType = CardStyleType.Elevated,\n onClick = undefined,\n tabIndex = null,\n hoverEffect = undefined,\n style = undefined,\n autoGap = true,\n clip = false,\n onKeyDown: onKeyDownProp,\n ...rest\n } = useComponentDefaults('Card', props);\n const isInteractable = !!onClick;\n\n const rippleRef = useRef<RippleHandle>(null);\n\n // Keyboard activation calls onClick directly without dispatching a DOM click, so Ripple's own\n // listener never sees it.\n function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (isInteractable && (event.key === 'Enter' || event.key === ' ')) rippleRef.current?.addRipple();\n onKeyDownProp?.(event);\n }\n\n return (\n <InteractableDiv\n {...rest}\n className={cx(\n styles.card,\n CLASS_BY_STYLE[styleType],\n clip && styles.cardClip,\n isInteractable && styles.cardInteractable,\n ((isInteractable && hoverEffect !== false) || hoverEffect) && styles.cardHover,\n className\n )}\n onClick={onClick}\n onKeyDown={handleKeyDown}\n tabIndex={tabIndex ?? (isInteractable ? 0 : null)}\n style={style}\n >\n <Ripple\n ref={rippleRef}\n disabled={!isInteractable}\n className={cx(styles.cardPadding, autoGap && styles.cardGaps)}\n style={{ borderRadius: 'inherit' }}\n >\n {children}\n </Ripple>\n </InteractableDiv>\n );\n}\n\nexport default Card;\n"],"mappings":"qVAUA,IAAM,EAAgD,CACpD,SAAU,EAAO,kBACjB,SAAU,EAAO,kBACjB,OAAQ,EAAO,eACjB,EAEA,SAAS,EAAK,EAAkB,CAC9B,GAAM,CACN,YAAY,IAAA,GACZ,WAAW,KACX,YAAY,EAAc,SAC1B,UAAU,IAAA,GACV,WAAW,KACX,cAAc,IAAA,GACd,QAAQ,IAAA,GACR,UAAU,GACV,OAAO,GACP,UAAW,EACX,GAAG,GACC,EAAqB,OAAQ,CAAK,EAChC,EAAiB,CAAC,CAAC,EAEnB,EAAY,EAAqB,IAAI,EAI3C,SAAS,EAAc,EAA4C,CAC7D,IAAmB,EAAM,MAAQ,SAAW,EAAM,MAAQ,MAAM,EAAU,SAAS,UAAU,EACjG,IAAgB,CAAK,CACvB,CAEA,OACE,EAAC,EAAD,CACE,GAAI,EACJ,UAAW,EACT,EAAO,KACP,EAAe,GACf,GAAQ,EAAO,SACf,GAAkB,EAAO,kBACvB,GAAkB,IAAgB,IAAU,IAAgB,EAAO,UACrE,CACF,EACS,UACT,UAAW,EACX,SAAU,IAAa,EAAiB,EAAI,MACrC,iBAEP,EAAC,EAAD,CACE,IAAK,EACL,SAAU,CAAC,EACX,UAAW,EAAG,EAAO,YAAa,GAAW,EAAO,QAAQ,EAC5D,MAAO,CAAE,aAAc,SAAU,EAEhC,UACK,CAAA,CACO,CAAA,CAErB"}
@@ -1 +1 @@
1
- {"version":3,"file":"card.types.mjs","names":[],"sources":["../../../../package/common/card/card.types.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ButtonStyleType } from '../button/button.types';\nimport type { HtmlProps } from '../types/slots.types';\nimport type { IconAction } from '../types/actions.types';\n\nexport enum CardStyleType {\n Elevated = 'elevated',\n Outlined = 'outlined',\n Filled = 'filled',\n}\n\nexport interface CardProps extends HtmlProps {\n className?: string | undefined;\n children?: ReactNode;\n styleType?: CardStyleType;\n onClick?: () => void;\n tabIndex?: number | null;\n hoverEffect?: boolean;\n style?: React.CSSProperties;\n autoGap?: boolean;\n clip?: boolean;\n}\n\nexport type CardHeaderAction = IconAction;\n\nexport interface CardHeaderProps {\n className?: string;\n title?: ReactNode;\n subTitle?: ReactNode;\n /** URL string → rendered as background-image. Any other ReactNode → rendered inside the thumbnail div. */\n thumbnail?: string | ReactNode;\n actions?: CardHeaderAction[] | ReactNode;\n}\n\nexport interface CardMediaProps {\n src?: string;\n alt?: string;\n}\n\nexport interface CardContentProps {\n children?: ReactNode;\n}\n\nexport interface CardAction {\n id?: string;\n label?: string;\n styleType?: ButtonStyleType;\n onClick?: () => void;\n}\n\nexport interface CardActionsProps {\n className?: string;\n /** Renders a Button for each action object. Pass `children` for custom content instead. */\n actions?: CardAction[];\n children?: ReactNode;\n}\n"],"mappings":"AAKA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,SAAA,WACA,EAAA,SAAA,WACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"card.types.mjs","names":[],"sources":["../../../../package/common/card/card.types.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ButtonStyleType } from '../button/button.types';\nimport type { HtmlProps } from '../types/slots.types';\nimport type { IconAction } from '../types/actions.types';\n\nexport enum CardStyleType {\n Elevated = 'elevated',\n Outlined = 'outlined',\n Filled = 'filled',\n}\n\n// `tabIndex` is omitted only because this component's version also accepts `null`.\nexport interface CardProps extends Omit<HtmlProps, 'tabIndex'> {\n className?: string | undefined;\n children?: ReactNode;\n styleType?: CardStyleType;\n onClick?: () => void;\n tabIndex?: number | null;\n hoverEffect?: boolean;\n style?: React.CSSProperties;\n autoGap?: boolean;\n clip?: boolean;\n}\n\nexport type CardHeaderAction = IconAction;\n\nexport interface CardHeaderProps {\n className?: string;\n title?: ReactNode;\n subTitle?: ReactNode;\n /** URL string → rendered as background-image. Any other ReactNode → rendered inside the thumbnail div. */\n thumbnail?: string | ReactNode;\n actions?: CardHeaderAction[] | ReactNode;\n}\n\nexport interface CardMediaProps {\n src?: string;\n alt?: string;\n}\n\nexport interface CardContentProps {\n children?: ReactNode;\n}\n\nexport interface CardAction {\n id?: string;\n label?: string;\n styleType?: ButtonStyleType;\n onClick?: () => void;\n}\n\nexport interface CardActionsProps {\n className?: string;\n /** Renders a Button for each action object. Pass `children` for custom content instead. */\n actions?: CardAction[];\n children?: ReactNode;\n}\n"],"mappings":"AAKA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,SAAA,WACA,EAAA,SAAA,WACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../ripple/ripple.mjs";import n from"../actionIcon/actionIcon.mjs";import{ChipStyleType as r}from"./chip.types.mjs";import i from"./chip.module.mjs";import{useMemo as a}from"react";import o from"classnames";import{faXmarkCircle as s}from"@fortawesome/free-solid-svg-icons";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u={default:i.chipStyleDefault,primary:i.chipStylePrimary,info:i.chipStyleInfo,warn:i.chipStyleWarn,error:i.chipStyleError};function d(d){let{className:f=``,thumbnail:p=``,text:m=``,styleType:h=r.Default,showRemoveIcon:g=!1,onClick:_,onRemove:v,...y}=e(`Chip`,d),b=a(()=>{if(typeof p==`string`&&p.startsWith(`http`))return p},[p]);return c(`div`,{...y,className:o(i.chip,u[h],_&&i.chipClickable,f),onClick:_,children:c(t,{disabled:!_,style:{borderRadius:`inherit`},children:l(`div`,{className:i.chipInner,children:[p&&c(`div`,{className:i.chipThumbnail,style:b?{backgroundImage:`url(${b})`}:{},children:!b&&p}),c(`div`,{className:i.chipText,children:m}),g&&c(n,{icon:s,onClick:e=>{e.stopPropagation(),v?.()}})]})})})}export{d as default};
1
+ import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../ripple/ripple.mjs";import n from"../interactableDiv/index.mjs";import r from"../actionIcon/actionIcon.mjs";import{ChipStyleType as i}from"./chip.types.mjs";import a from"./chip.module.mjs";import{useMemo as o,useRef as s}from"react";import c from"classnames";import{faXmarkCircle as l}from"@fortawesome/free-solid-svg-icons";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f={default:a.chipStyleDefault,primary:a.chipStylePrimary,info:a.chipStyleInfo,warn:a.chipStyleWarn,error:a.chipStyleError};function p(p){let{className:m=``,thumbnail:h=``,text:g=``,styleType:_=i.Default,showRemoveIcon:v=!1,removeLabel:y=`Remove`,onClick:b,onRemove:x,...S}=e(`Chip`,p),C=s(null);function w(e){b&&(e.key===`Enter`||e.key===` `)&&C.current?.addRipple()}let T=o(()=>{if(typeof h==`string`&&h.startsWith(`http`))return h},[h]);return u(n,{...S,className:c(a.chip,f[_],b&&a.chipClickable,m),onClick:b,onKeyDown:w,children:u(t,{ref:C,disabled:!b,style:{borderRadius:`inherit`},children:d(`div`,{className:a.chipInner,children:[h&&u(`div`,{className:a.chipThumbnail,style:T?{backgroundImage:`url(${T})`}:{},children:!T&&h}),u(`div`,{className:a.chipText,children:g}),v&&u(r,{icon:l,"aria-label":y,onClick:e=>{e.stopPropagation(),x?.()}})]})})})}export{p as default};
2
2
  //# sourceMappingURL=chip.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"chip.mjs","names":[],"sources":["../../../../package/common/chip/chip.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { faXmarkCircle } from '@fortawesome/free-solid-svg-icons';\nimport cx from 'classnames';\n\nimport Ripple from '../ripple';\nimport ActionIcon from '../actionIcon';\nimport { ChipStyleType, ChipProps } from './chip.types';\nimport { useComponentDefaults } from '../configProvider';\n\nimport styles from './chip.module.pcss';\n\nconst CLASS_BY_STYLE: Record<ChipStyleType, string> = {\n default: styles.chipStyleDefault,\n primary: styles.chipStylePrimary,\n info: styles.chipStyleInfo,\n warn: styles.chipStyleWarn,\n error: styles.chipStyleError,\n};\n\nfunction Chip(props: ChipProps) {\n const {\n className = '',\n thumbnail = '',\n text = '',\n styleType = ChipStyleType.Default,\n showRemoveIcon = false,\n onClick,\n onRemove,\n ...rest\n } = useComponentDefaults('Chip', props);\n const thumbnailUrl = useMemo(() => {\n if (typeof thumbnail === 'string' && thumbnail.startsWith('http')) return thumbnail;\n return undefined;\n }, [thumbnail]);\n\n return (\n <div\n {...rest}\n className={cx(styles.chip, CLASS_BY_STYLE[styleType], onClick && styles.chipClickable, className)}\n onClick={onClick}\n >\n <Ripple disabled={!onClick} style={{ borderRadius: 'inherit' }}>\n <div className={styles.chipInner}>\n {thumbnail && (\n <div\n className={styles.chipThumbnail}\n style={thumbnailUrl ? { backgroundImage: `url(${thumbnailUrl})` } : {}}\n >\n {!thumbnailUrl && thumbnail}\n </div>\n )}\n <div className={styles.chipText}>{text}</div>\n {showRemoveIcon && <ActionIcon icon={faXmarkCircle} onClick={(e) => { e.stopPropagation(); onRemove?.(); }} />}\n </div>\n </Ripple>\n </div>\n );\n}\n\nexport default Chip;\n"],"mappings":"kaAWA,IAAM,EAAgD,CACpD,QAAS,EAAO,iBAChB,QAAS,EAAO,iBAChB,KAAM,EAAO,cACb,KAAM,EAAO,cACb,MAAO,EAAO,cAChB,EAEA,SAAS,EAAK,EAAkB,CAC9B,GAAM,CACN,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,YAAY,EAAc,QAC1B,iBAAiB,GACjB,UACA,WACA,GAAG,GACC,EAAqB,OAAQ,CAAK,EAChC,EAAe,MAAc,CACjC,GAAI,OAAO,GAAc,UAAY,EAAU,WAAW,MAAM,EAAG,OAAO,CAE5E,EAAG,CAAC,CAAS,CAAC,EAEd,OACE,EAAC,MAAD,CACE,GAAI,EACJ,UAAW,EAAG,EAAO,KAAM,EAAe,GAAY,GAAW,EAAO,cAAe,CAAS,EACvF,mBAET,EAAC,EAAD,CAAQ,SAAU,CAAC,EAAS,MAAO,CAAE,aAAc,SAAU,WAC3D,EAAC,MAAD,CAAK,UAAW,EAAO,mBAAvB,CACG,GACC,EAAC,MAAD,CACE,UAAW,EAAO,cAClB,MAAO,EAAe,CAAE,gBAAiB,OAAO,EAAa,EAAG,EAAI,CAAC,WAEpE,CAAC,GAAgB,CACf,CAAA,EAEP,EAAC,MAAD,CAAK,UAAW,EAAO,kBAAW,CAAU,CAAA,EAC3C,GAAkB,EAAC,EAAD,CAAY,KAAM,EAAe,QAAU,GAAM,CAAE,EAAE,gBAAgB,EAAG,IAAW,CAAG,CAAI,CAAA,CAC1G,GACC,CAAA,CACL,CAAA,CAET"}
1
+ {"version":3,"file":"chip.mjs","names":[],"sources":["../../../../package/common/chip/chip.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport { faXmarkCircle } from '@fortawesome/free-solid-svg-icons';\nimport cx from 'classnames';\n\nimport Ripple from '../ripple';\nimport type { RippleHandle } from '../ripple';\nimport InteractableDiv from '../interactableDiv';\nimport ActionIcon from '../actionIcon';\nimport { ChipStyleType, ChipProps } from './chip.types';\nimport { useComponentDefaults } from '../configProvider';\n\nimport styles from './chip.module.pcss';\n\nconst CLASS_BY_STYLE: Record<ChipStyleType, string> = {\n default: styles.chipStyleDefault,\n primary: styles.chipStylePrimary,\n info: styles.chipStyleInfo,\n warn: styles.chipStyleWarn,\n error: styles.chipStyleError,\n};\n\nfunction Chip(props: ChipProps) {\n const {\n className = '',\n thumbnail = '',\n text = '',\n styleType = ChipStyleType.Default,\n showRemoveIcon = false,\n removeLabel = 'Remove',\n onClick,\n onRemove,\n ...rest\n } = useComponentDefaults('Chip', props);\n const rippleRef = useRef<RippleHandle>(null);\n\n // Keyboard activation calls onClick directly without dispatching a DOM click, so Ripple's own\n // listener never sees it.\n function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (onClick && (event.key === 'Enter' || event.key === ' ')) rippleRef.current?.addRipple();\n }\n\n const thumbnailUrl = useMemo(() => {\n if (typeof thumbnail === 'string' && thumbnail.startsWith('http')) return thumbnail;\n return undefined;\n }, [thumbnail]);\n\n return (\n <InteractableDiv\n {...rest}\n className={cx(styles.chip, CLASS_BY_STYLE[styleType], onClick && styles.chipClickable, className)}\n onClick={onClick}\n onKeyDown={handleKeyDown}\n >\n <Ripple ref={rippleRef} disabled={!onClick} style={{ borderRadius: 'inherit' }}>\n <div className={styles.chipInner}>\n {thumbnail && (\n <div\n className={styles.chipThumbnail}\n style={thumbnailUrl ? { backgroundImage: `url(${thumbnailUrl})` } : {}}\n >\n {!thumbnailUrl && thumbnail}\n </div>\n )}\n <div className={styles.chipText}>{text}</div>\n {showRemoveIcon && (\n <ActionIcon\n icon={faXmarkCircle}\n aria-label={removeLabel}\n onClick={(e) => { e.stopPropagation(); onRemove?.(); }}\n />\n )}\n </div>\n </Ripple>\n </InteractableDiv>\n );\n}\n\nexport default Chip;\n"],"mappings":"0dAaA,IAAM,EAAgD,CACpD,QAAS,EAAO,iBAChB,QAAS,EAAO,iBAChB,KAAM,EAAO,cACb,KAAM,EAAO,cACb,MAAO,EAAO,cAChB,EAEA,SAAS,EAAK,EAAkB,CAC9B,GAAM,CACN,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,YAAY,EAAc,QAC1B,iBAAiB,GACjB,cAAc,SACd,UACA,WACA,GAAG,GACC,EAAqB,OAAQ,CAAK,EAChC,EAAY,EAAqB,IAAI,EAI3C,SAAS,EAAc,EAA4C,CAC7D,IAAY,EAAM,MAAQ,SAAW,EAAM,MAAQ,MAAM,EAAU,SAAS,UAAU,CAC5F,CAEA,IAAM,EAAe,MAAc,CACjC,GAAI,OAAO,GAAc,UAAY,EAAU,WAAW,MAAM,EAAG,OAAO,CAE5E,EAAG,CAAC,CAAS,CAAC,EAEd,OACE,EAAC,EAAD,CACE,GAAI,EACJ,UAAW,EAAG,EAAO,KAAM,EAAe,GAAY,GAAW,EAAO,cAAe,CAAS,EACvF,UACT,UAAW,WAEX,EAAC,EAAD,CAAQ,IAAK,EAAW,SAAU,CAAC,EAAS,MAAO,CAAE,aAAc,SAAU,WAC3E,EAAC,MAAD,CAAK,UAAW,EAAO,mBAAvB,CACG,GACC,EAAC,MAAD,CACE,UAAW,EAAO,cAClB,MAAO,EAAe,CAAE,gBAAiB,OAAO,EAAa,EAAG,EAAI,CAAC,WAEpE,CAAC,GAAgB,CACf,CAAA,EAEP,EAAC,MAAD,CAAK,UAAW,EAAO,kBAAW,CAAU,CAAA,EAC3C,GACC,EAAC,EAAD,CACE,KAAM,EACN,aAAY,EACZ,QAAU,GAAM,CAAE,EAAE,gBAAgB,EAAG,IAAW,CAAG,CACtD,CAAA,CAEA,GACC,CAAA,CACO,CAAA,CAErB"}
@@ -1 +1 @@
1
- {"version":3,"file":"chip.types.mjs","names":[],"sources":["../../../../package/common/chip/chip.types.ts"],"sourcesContent":["import type { HtmlProps } from '../types/slots.types';\n\nexport enum ChipStyleType {\n Default = 'default',\n Primary = 'primary',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport interface ChipProps extends HtmlProps {\n className?: string;\n text?: string;\n thumbnail?: React.ReactNode;\n styleType?: ChipStyleType;\n showRemoveIcon?: boolean;\n onClick?: () => void;\n onRemove?: () => void;\n}\n\nexport interface ChipContainerProps extends HtmlProps {\n className?: string;\n children?: React.ReactNode;\n inline?: boolean;\n}\n"],"mappings":"AAEA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"chip.types.mjs","names":[],"sources":["../../../../package/common/chip/chip.types.ts"],"sourcesContent":["import type { HtmlProps } from '../types/slots.types';\n\nexport enum ChipStyleType {\n Default = 'default',\n Primary = 'primary',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport interface ChipProps extends HtmlProps {\n className?: string;\n text?: string;\n thumbnail?: React.ReactNode;\n styleType?: ChipStyleType;\n showRemoveIcon?: boolean;\n /** Accessible name for the remove button. Default `'Remove'`. */\n removeLabel?: string;\n onClick?: () => void;\n onRemove?: () => void;\n}\n\nexport interface ChipContainerProps extends HtmlProps {\n className?: string;\n children?: React.ReactNode;\n inline?: boolean;\n}\n"],"mappings":"AAEA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"dropZone.types.mjs","names":[],"sources":["../../../../package/common/dropZone/dropZone.types.ts"],"sourcesContent":["import type React from 'react';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum DropZoneStatus {\n /** Nothing is happening. */\n Idle = 'idle',\n /** A file drag is somewhere in the window — the zone is \"armed\". */\n Dragging = 'dragging',\n /** A file drag is hovering directly over this zone. */\n Active = 'active',\n /** The last drop / selection was rejected. */\n Error = 'error',\n}\n\nexport enum DropZoneReturnType {\n /** Emit the raw `File` objects (default). */\n File = 'file',\n /** Read each file as a base64 data URL and emit `LoadedFile`. */\n Base64 = 'base64',\n /** Read each file as UTF-8 text and emit `LoadedFile`. */\n Text = 'text',\n}\n\nexport interface LoadedFile {\n name: string;\n size: number;\n type: string;\n lastModified: number;\n /** The FileReader result — a base64 data URL or text, depending on `returnType`. */\n data: string;\n}\n\nexport type DropZoneRejectionReason =\n /** File extension / mime type not in `acceptedTypes`. */\n | 'unacceptedType'\n /** File exceeds `maxSize`. */\n | 'tooLarge'\n /** More files than `maxFiles` were provided. */\n | 'tooMany'\n /** Reading the file (base64 / text) failed. */\n | 'readError';\n\nexport interface DropZoneRejection {\n file: File;\n reason: DropZoneRejectionReason;\n}\n\nexport interface DropZoneRenderState {\n status: DropZoneStatus;\n /** A drag is anywhere in the window (zone armed) or directly over it. */\n isDragging: boolean;\n /** A drag is directly over this zone. */\n isActive: boolean;\n disabled: boolean;\n}\n\nexport type DropZoneSlots = 'root' | 'content' | 'fileList' | 'fileItem' | 'input';\n\nexport interface DropZoneProps extends HtmlProps {\n /** Static content, or a render function that receives the live drop state. */\n children?: React.ReactNode | ((state: DropZoneRenderState) => React.ReactNode);\n\n /**\n * Accepted file types: extensions (`'.png'`), mime types (`'image/png'`),\n * or wildcards (`'image/*'`). Empty / omitted means accept everything.\n * Also drives the native picker's `accept` attribute.\n */\n acceptedTypes?: string[];\n /** Output shape for each accepted file. Default: `File`. */\n returnType?: DropZoneReturnType;\n\n /** Open the native file picker when the zone is clicked. */\n openPickerOnClick?: boolean;\n /** Allow more than one file. Default: `true`. */\n multiple?: boolean;\n /** Reject files beyond this count (extras reported via `onReject`). */\n maxFiles?: number;\n /** Reject files larger than this many bytes. */\n maxSize?: number;\n /** Accept files pasted from the clipboard while the zone is focused. */\n enablePaste?: boolean;\n /** Recurse into dropped directories. Default: `true`. */\n allowDirectories?: boolean;\n\n /** Native `capture` attribute (mobile camera / mic). */\n capture?: boolean | 'user' | 'environment';\n disabled?: boolean;\n\n /** Drop the built-in border / background styling; keep only base layout. */\n unstyled?: boolean;\n /** Render the names of `files` beneath the content. */\n showFileNames?: boolean;\n /** Files whose names are listed when `showFileNames` is set. */\n files?: (File | LoadedFile)[];\n\n onFilesChanged?: (files: (File | LoadedFile)[]) => void;\n onReject?: (rejections: DropZoneRejection[]) => void;\n onStatusChanged?: (status: DropZoneStatus) => void;\n\n className?: string;\n style?: React.CSSProperties;\n classNames?: SlotClassNames<DropZoneSlots>;\n styles?: SlotStyles<DropZoneSlots>;\n}\n"],"mappings":"AAGA,IAAY,EAAL,SAAA,EAAA,OAEL,GAAA,KAAA,OAEA,EAAA,SAAA,WAEA,EAAA,OAAA,SAEA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OAEL,GAAA,KAAA,OAEA,EAAA,OAAA,SAEA,EAAA,KAAA,QACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"dropZone.types.mjs","names":[],"sources":["../../../../package/common/dropZone/dropZone.types.ts"],"sourcesContent":["import type React from 'react';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum DropZoneStatus {\n /** Nothing is happening. */\n Idle = 'idle',\n /** A file drag is somewhere in the window — the zone is \"armed\". */\n Dragging = 'dragging',\n /** A file drag is hovering directly over this zone. */\n Active = 'active',\n /** The last drop / selection was rejected. */\n Error = 'error',\n}\n\nexport enum DropZoneReturnType {\n /** Emit the raw `File` objects (default). */\n File = 'file',\n /** Read each file as a base64 data URL and emit `LoadedFile`. */\n Base64 = 'base64',\n /** Read each file as UTF-8 text and emit `LoadedFile`. */\n Text = 'text',\n}\n\nexport interface LoadedFile {\n name: string;\n size: number;\n type: string;\n lastModified: number;\n /** The FileReader result — a base64 data URL or text, depending on `returnType`. */\n data: string;\n}\n\nexport type DropZoneRejectionReason =\n /** File extension / mime type not in `acceptedTypes`. */\n | 'unacceptedType'\n /** File exceeds `maxSize`. */\n | 'tooLarge'\n /** More files than `maxFiles` were provided. */\n | 'tooMany'\n /** Reading the file (base64 / text) failed. */\n | 'readError';\n\nexport interface DropZoneRejection {\n file: File;\n reason: DropZoneRejectionReason;\n}\n\nexport interface DropZoneRenderState {\n status: DropZoneStatus;\n /** A drag is anywhere in the window (zone armed) or directly over it. */\n isDragging: boolean;\n /** A drag is directly over this zone. */\n isActive: boolean;\n disabled: boolean;\n}\n\nexport type DropZoneSlots = 'root' | 'content' | 'fileList' | 'fileItem' | 'input';\n\nexport interface DropZoneProps extends Omit<HtmlProps, 'children'> {\n /** Static content, or a render function that receives the live drop state. */\n children?: React.ReactNode | ((state: DropZoneRenderState) => React.ReactNode);\n\n /**\n * Accepted file types: extensions (`'.png'`), mime types (`'image/png'`),\n * or wildcards (`'image/*'`). Empty / omitted means accept everything.\n * Also drives the native picker's `accept` attribute.\n */\n acceptedTypes?: string[];\n /** Output shape for each accepted file. Default: `File`. */\n returnType?: DropZoneReturnType;\n\n /** Open the native file picker when the zone is clicked. */\n openPickerOnClick?: boolean;\n /** Allow more than one file. Default: `true`. */\n multiple?: boolean;\n /** Reject files beyond this count (extras reported via `onReject`). */\n maxFiles?: number;\n /** Reject files larger than this many bytes. */\n maxSize?: number;\n /** Accept files pasted from the clipboard while the zone is focused. */\n enablePaste?: boolean;\n /** Recurse into dropped directories. Default: `true`. */\n allowDirectories?: boolean;\n\n /** Native `capture` attribute (mobile camera / mic). */\n capture?: boolean | 'user' | 'environment';\n disabled?: boolean;\n\n /** Drop the built-in border / background styling; keep only base layout. */\n unstyled?: boolean;\n /** Render the names of `files` beneath the content. */\n showFileNames?: boolean;\n /** Files whose names are listed when `showFileNames` is set. */\n files?: (File | LoadedFile)[];\n\n onFilesChanged?: (files: (File | LoadedFile)[]) => void;\n onReject?: (rejections: DropZoneRejection[]) => void;\n onStatusChanged?: (status: DropZoneStatus) => void;\n\n className?: string;\n style?: React.CSSProperties;\n classNames?: SlotClassNames<DropZoneSlots>;\n styles?: SlotStyles<DropZoneSlots>;\n}\n"],"mappings":"AAGA,IAAY,EAAL,SAAA,EAAA,OAEL,GAAA,KAAA,OAEA,EAAA,SAAA,WAEA,EAAA,OAAA,SAEA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OAEL,GAAA,KAAA,OAEA,EAAA,OAAA,SAEA,EAAA,KAAA,QACF,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"floatingMenu.types.mjs","names":[],"sources":["../../../../package/common/floatingMenu/floatingMenu.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum Align {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport type FloatingMenuSlots = 'root' | 'trigger' | 'menu' | 'menuContainer';\n\nexport interface FloatingMenuProps extends HtmlProps {\n align?: Align;\n children?: ReactNode;\n content?: ReactNode;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n dontCloseOnChildClick?: boolean;\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<FloatingMenuSlots>;\n styles?: SlotStyles<FloatingMenuSlots>;\n}"],"mappings":"AAGA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,KAAA,OACA,EAAA,MAAA,QACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"floatingMenu.types.mjs","names":[],"sources":["../../../../package/common/floatingMenu/floatingMenu.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum Align {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport type FloatingMenuSlots = 'root' | 'trigger' | 'menu' | 'menuContainer';\n\nexport interface FloatingMenuProps extends Omit<HtmlProps, 'content'> {\n align?: Align;\n children?: ReactNode;\n content?: ReactNode;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n dontCloseOnChildClick?: boolean;\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<FloatingMenuSlots>;\n styles?: SlotStyles<FloatingMenuSlots>;\n}"],"mappings":"AAGA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,KAAA,OACA,EAAA,MAAA,QACA,EAAA,OAAA,UACF,EAAA,CAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{useSyncExternalStore as e}from"react";var t=`(pointer: coarse)`;function n(){return typeof window<`u`&&typeof window.matchMedia==`function`}function r(e){if(!n())return()=>{};let r=window.matchMedia(t);return r.addEventListener(`change`,e),()=>r.removeEventListener(`change`,e)}function i(){return n()&&window.matchMedia(t).matches}function a(){return!1}function o(){return e(r,i,a)}export{o as default};
2
+ //# sourceMappingURL=useCoarsePointer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCoarsePointer.mjs","names":[],"sources":["../../../../package/common/hooks/useCoarsePointer.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nconst COARSE_POINTER_QUERY = '(pointer: coarse)';\n\nfunction supported(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n}\n\nfunction subscribe(onChange: () => void): () => void {\n if (!supported()) return () => {};\n const mql = window.matchMedia(COARSE_POINTER_QUERY);\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n}\n\nfunction getSnapshot(): boolean {\n return supported() && window.matchMedia(COARSE_POINTER_QUERY).matches;\n}\n\n/** No media query exists on the server, so the tree renders as if the pointer were fine. */\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\n/**\n * `true` when the primary pointing device is coarse (touch), kept current so a device that\n * switches input modes re-renders.\n *\n * `useSyncExternalStore` rather than `useState` + `useEffect`: callers pick *markup* with this,\n * so hydration has to start from the server's answer. Reading `matchMedia` in a `useState`\n * initialiser makes the client's first render disagree with the server's HTML.\n */\nexport function useCoarsePointer(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\nexport default useCoarsePointer;\n"],"mappings":"6CAEA,IAAM,EAAuB,oBAE7B,SAAS,GAAqB,CAC5B,OAAO,OAAO,OAAW,KAAe,OAAO,OAAO,YAAe,UACvE,CAEA,SAAS,EAAU,EAAkC,CACnD,GAAI,CAAC,EAAU,EAAG,UAAa,CAAC,EAChC,IAAM,EAAM,OAAO,WAAW,CAAoB,EAElD,OADA,EAAI,iBAAiB,SAAU,CAAQ,MAC1B,EAAI,oBAAoB,SAAU,CAAQ,CACzD,CAEA,SAAS,GAAuB,CAC9B,OAAO,EAAU,GAAK,OAAO,WAAW,CAAoB,EAAE,OAChE,CAGA,SAAS,GAA6B,CACpC,MAAO,EACT,CAUA,SAAgB,GAA4B,CAC1C,OAAO,EAAqB,EAAW,EAAa,CAAiB,CACvE"}
@@ -1,2 +1,2 @@
1
- import{useEffect as e,useRef as t,useState as n}from"react";var r=180,i=10;function a({onDismiss:a,axis:o=`x`,distanceThreshold:s=80,velocityThreshold:c=.5,disabled:l=!1,mobileOnly:u=!0}){let d=t(null),[f,p]=n(!1),[m,h]=n(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches);e(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(pointer: coarse)`),t=e=>h(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let g=l||u&&!m,_=t(null),v=t(a);return e(()=>{v.current=a}),e(()=>{let e=d.current;if(!e||g)return;function t(t,n){if(!e)return;n!==`none`&&e.offsetHeight;let r=o===`x`?`translateX(${t}px)`:`translateY(${t}px)`;e.style.transition=n,e.style.transform=r;let i=Math.max(0,1-Math.abs(t)/(s*2.5));e.style.opacity=String(i)}function n(e){let n=_.current;if(!n||e.pointerId!==n.pointerId)return;let r=e.clientX-n.startX,a=e.clientY-n.startY;if(!n.axisLocked){let e=o===`x`?r:a,t=o===`x`?a:r;if(Math.abs(e)<i&&Math.abs(t)<i)return;if(Math.abs(t)>Math.abs(e)){n.active=!1;return}n.axisLocked=!0,p(!0)}n.active&&(e.preventDefault(),n.offset=o===`x`?r:a,t(n.offset,`none`))}function a(){let i=_.current;if(_.current=null,window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a),!i||!i.active||!i.axisLocked){p(!1);return}let o=Math.max(1,Date.now()-i.startTime),l=i.offset/o;if(Math.abs(i.offset)>=s||Math.abs(l)>=c){let n=e?.getBoundingClientRect().width??0;t(Math.sign(i.offset||1)*(n+40),`transform ${r}ms ease-out, opacity ${r}ms ease-out`),setTimeout(()=>v.current(),r)}else t(0,`transform ${r}ms ease-out, opacity ${r}ms ease-out`);p(!1)}function l(t){_.current||!e||(e.style.animation=`none`,_.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:Date.now(),offset:0,axisLocked:!1,active:!0},window.addEventListener(`pointermove`,n,{passive:!1}),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a))}return e.addEventListener(`pointerdown`,l),()=>{e.removeEventListener(`pointerdown`,l),window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a)}},[o,s,c,g]),{ref:d,isDragging:f}}export{a as useSwipeDismiss};
1
+ import e from"./useCoarsePointer.mjs";import{useEffect as t,useRef as n,useState as r}from"react";var i=180,a=10;function o({onDismiss:o,axis:s=`x`,distanceThreshold:c=80,velocityThreshold:l=.5,disabled:u=!1,mobileOnly:d=!0}){let f=n(null),[p,m]=r(!1),h=e(),g=u||d&&!h,_=n(null),v=n(o);return t(()=>{v.current=o}),t(()=>{let e=f.current;if(!e||g)return;function t(t,n){if(!e)return;n!==`none`&&e.offsetHeight;let r=s===`x`?`translateX(${t}px)`:`translateY(${t}px)`;e.style.transition=n,e.style.transform=r;let i=Math.max(0,1-Math.abs(t)/(c*2.5));e.style.opacity=String(i)}function n(e){let n=_.current;if(!n||e.pointerId!==n.pointerId)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;if(!n.axisLocked){let e=s===`x`?r:i,t=s===`x`?i:r;if(Math.abs(e)<a&&Math.abs(t)<a)return;if(Math.abs(t)>Math.abs(e)){n.active=!1;return}n.axisLocked=!0,m(!0)}n.active&&(e.preventDefault(),n.offset=s===`x`?r:i,t(n.offset,`none`))}function r(){let a=_.current;if(_.current=null,window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r),!a||!a.active||!a.axisLocked){m(!1);return}let o=Math.max(1,Date.now()-a.startTime),s=a.offset/o;if(Math.abs(a.offset)>=c||Math.abs(s)>=l){let n=e?.getBoundingClientRect().width??0;t(Math.sign(a.offset||1)*(n+40),`transform ${i}ms ease-out, opacity ${i}ms ease-out`),setTimeout(()=>v.current(),i)}else t(0,`transform ${i}ms ease-out, opacity ${i}ms ease-out`);m(!1)}function o(t){_.current||!e||(e.style.animation=`none`,_.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:Date.now(),offset:0,axisLocked:!1,active:!0},window.addEventListener(`pointermove`,n,{passive:!1}),window.addEventListener(`pointerup`,r),window.addEventListener(`pointercancel`,r))}return e.addEventListener(`pointerdown`,o),()=>{e.removeEventListener(`pointerdown`,o),window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r)}},[s,c,l,g]),{ref:f,isDragging:p}}export{o as useSwipeDismiss};
2
2
  //# sourceMappingURL=useSwipeDismiss.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSwipeDismiss.mjs","names":[],"sources":["../../../../package/common/hooks/useSwipeDismiss.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nexport interface UseSwipeDismissOptions {\n /** Called once the swipe commits (past the threshold) — after the exit transition finishes,\n * not the instant the pointer is released. */\n onDismiss: () => void;\n /** Which axis the drag tracks (default `'x'`, the natural direction for a toast/notification). */\n axis?: 'x' | 'y';\n /** Distance in px past which releasing counts as a commit, regardless of speed (default `80`). */\n distanceThreshold?: number;\n /** Speed in px/ms past which releasing counts as a commit, regardless of distance (default `0.5`) —\n * lets a fast flick dismiss even if the pointer didn't travel very far. */\n velocityThreshold?: number;\n /** Disables the gesture entirely — no listeners are attached. */\n disabled?: boolean;\n /** Restricts the gesture to coarse (touch) pointers, auto-detected via `matchMedia`. On a\n * mouse/trackpad device a drag is more likely to be a text selection than an intentional\n * dismiss, and other affordances (a close button, auto-dismiss) typically already cover that\n * case. Default `true`; set `false` to allow the gesture on any pointer type. */\n mobileOnly?: boolean;\n}\n\nexport interface UseSwipeDismissResult<T extends HTMLElement> {\n /** Attach to the element that should become draggable. The hook wires up its own pointer\n * listeners on this node directly (no handlers to spread), so this is the only thing to attach. */\n ref: React.RefObject<T | null>;\n /** True for the duration of an active drag — e.g. use it to pause an auto-dismiss timer. */\n isDragging: boolean;\n}\n\nconst EXIT_TRANSITION_MS = 180;\n// Below this many px of movement, direction intent isn't decided yet — lets a vertical scroll\n// gesture that merely starts on the element pass through instead of being hijacked as a swipe.\nconst AXIS_LOCK_THRESHOLD = 10;\n\n/**\n * Drag-to-dismiss on any pointer type (touch, mouse, pen) via the Pointer Events API. Applies the\n * drag offset and a fading opacity directly to the DOM node (bypassing React state) so the visual\n * tracks the pointer at native speed, then either springs back or animates fully off-screen and\n * calls `onDismiss` once that exit transition completes.\n */\nexport function useSwipeDismiss<T extends HTMLElement>({\n onDismiss,\n axis = 'x',\n distanceThreshold = 80,\n velocityThreshold = 0.5,\n disabled = false,\n mobileOnly = true,\n}: UseSwipeDismissOptions): UseSwipeDismissResult<T> {\n const ref = useRef<T>(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const [isCoarsePointer, setIsCoarsePointer] = useState(\n () => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(pointer: coarse)').matches\n );\n useEffect(() => {\n if (typeof window.matchMedia !== 'function') return;\n const mql = window.matchMedia('(pointer: coarse)');\n const onChange = (event: MediaQueryListEvent) => setIsCoarsePointer(event.matches);\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n }, []);\n\n const effectiveDisabled = disabled || (mobileOnly && !isCoarsePointer);\n\n // Mutable across the life of one drag; doesn't need to trigger re-renders.\n const dragRef = useRef<{\n pointerId: number;\n startX: number;\n startY: number;\n startTime: number;\n offset: number;\n axisLocked: boolean;\n active: boolean;\n } | null>(null);\n\n const onDismissRef = useRef(onDismiss);\n useEffect(() => {\n onDismissRef.current = onDismiss;\n });\n\n useEffect(() => {\n const el = ref.current;\n if (!el || effectiveDisabled) return;\n\n function applyTransform(offset: number, transition: string) {\n if (!el) return;\n if (transition !== 'none') {\n // Switching straight from the live drag's `transition: none` to an animated one, in the\n // same tick as the transform change, can get coalesced into a single frame with no\n // animation in between — the element just jumps to its end state instead of sliding\n // there. Forcing a layout read first commits the current (pre-transition) position as\n // its own frame, so the transition below actually has something to animate from.\n void el.offsetHeight;\n }\n const translate = axis === 'x' ? `translateX(${offset}px)` : `translateY(${offset}px)`;\n el.style.transition = transition;\n el.style.transform = translate;\n const fade = Math.max(0, 1 - Math.abs(offset) / (distanceThreshold * 2.5));\n el.style.opacity = String(fade);\n }\n\n function onPointerMove(event: PointerEvent) {\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n\n const deltaX = event.clientX - drag.startX;\n const deltaY = event.clientY - drag.startY;\n\n if (!drag.axisLocked) {\n const primary = axis === 'x' ? deltaX : deltaY;\n const cross = axis === 'x' ? deltaY : deltaX;\n if (Math.abs(primary) < AXIS_LOCK_THRESHOLD && Math.abs(cross) < AXIS_LOCK_THRESHOLD) return;\n if (Math.abs(cross) > Math.abs(primary)) {\n // The gesture is mostly along the other axis (e.g. a page scroll) — hand it back.\n drag.active = false;\n return;\n }\n drag.axisLocked = true;\n setIsDragging(true);\n }\n\n if (!drag.active) return;\n event.preventDefault();\n drag.offset = axis === 'x' ? deltaX : deltaY;\n applyTransform(drag.offset, 'none');\n }\n\n function finishDrag() {\n const drag = dragRef.current;\n dragRef.current = null;\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', finishDrag);\n window.removeEventListener('pointercancel', finishDrag);\n if (!drag || !drag.active || !drag.axisLocked) {\n setIsDragging(false);\n return;\n }\n\n const elapsed = Math.max(1, Date.now() - drag.startTime);\n const velocity = drag.offset / elapsed;\n const committed =\n Math.abs(drag.offset) >= distanceThreshold || Math.abs(velocity) >= velocityThreshold;\n\n if (committed) {\n const width = el?.getBoundingClientRect().width ?? 0;\n const exitOffset = Math.sign(drag.offset || 1) * (width + 40);\n applyTransform(exitOffset, `transform ${EXIT_TRANSITION_MS}ms ease-out, opacity ${EXIT_TRANSITION_MS}ms ease-out`);\n setTimeout(() => onDismissRef.current(), EXIT_TRANSITION_MS);\n } else {\n applyTransform(0, `transform ${EXIT_TRANSITION_MS}ms ease-out, opacity ${EXIT_TRANSITION_MS}ms ease-out`);\n }\n setIsDragging(false);\n }\n\n function onPointerDown(event: PointerEvent) {\n if (dragRef.current || !el) return;\n // A still-\"forwards\"-filling CSS animation (e.g. the toast's entrance slide) wins the\n // cascade over an inline style.transform, so the drag offset below would silently never\n // show up on screen unless the animation is cleared first.\n el.style.animation = 'none';\n dragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startY: event.clientY,\n startTime: Date.now(),\n offset: 0,\n axisLocked: false,\n active: true,\n };\n window.addEventListener('pointermove', onPointerMove, { passive: false });\n window.addEventListener('pointerup', finishDrag);\n window.addEventListener('pointercancel', finishDrag);\n }\n\n el.addEventListener('pointerdown', onPointerDown);\n return () => {\n el.removeEventListener('pointerdown', onPointerDown);\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', finishDrag);\n window.removeEventListener('pointercancel', finishDrag);\n };\n }, [axis, distanceThreshold, velocityThreshold, effectiveDisabled]);\n\n return { ref, isDragging };\n}\n"],"mappings":"4DA8BA,IAAM,EAAqB,IAGrB,EAAsB,GAQ5B,SAAgB,EAAuC,CACrD,YACA,OAAO,IACP,oBAAoB,GACpB,oBAAoB,GACpB,WAAW,GACX,aAAa,IACsC,CACnD,IAAM,EAAM,EAAU,IAAI,EACpB,CAAC,EAAY,GAAiB,EAAS,EAAK,EAE5C,CAAC,EAAiB,GAAsB,MACtC,OAAO,OAAW,KAAe,OAAO,OAAO,YAAe,YAAc,OAAO,WAAW,mBAAmB,EAAE,OAC3H,EACA,MAAgB,CACd,GAAI,OAAO,OAAO,YAAe,WAAY,OAC7C,IAAM,EAAM,OAAO,WAAW,mBAAm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CAAC,EAAM,EAAmB,EAAmB,CAAiB,CAAC,EAE3D,CAAE,MAAK,YAAW,CAC3B"}
1
+ {"version":3,"file":"useSwipeDismiss.mjs","names":[],"sources":["../../../../package/common/hooks/useSwipeDismiss.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useCoarsePointer } from './useCoarsePointer';\n\nexport interface UseSwipeDismissOptions {\n /** Called once the swipe commits (past the threshold) — after the exit transition finishes,\n * not the instant the pointer is released. */\n onDismiss: () => void;\n /** Which axis the drag tracks (default `'x'`, the natural direction for a toast/notification). */\n axis?: 'x' | 'y';\n /** Distance in px past which releasing counts as a commit, regardless of speed (default `80`). */\n distanceThreshold?: number;\n /** Speed in px/ms past which releasing counts as a commit, regardless of distance (default `0.5`) —\n * lets a fast flick dismiss even if the pointer didn't travel very far. */\n velocityThreshold?: number;\n /** Disables the gesture entirely — no listeners are attached. */\n disabled?: boolean;\n /** Restricts the gesture to coarse (touch) pointers, auto-detected via `matchMedia`. On a\n * mouse/trackpad device a drag is more likely to be a text selection than an intentional\n * dismiss, and other affordances (a close button, auto-dismiss) typically already cover that\n * case. Default `true`; set `false` to allow the gesture on any pointer type. */\n mobileOnly?: boolean;\n}\n\nexport interface UseSwipeDismissResult<T extends HTMLElement> {\n /** Attach to the element that should become draggable. The hook wires up its own pointer\n * listeners on this node directly (no handlers to spread), so this is the only thing to attach. */\n ref: React.RefObject<T | null>;\n /** True for the duration of an active drag — e.g. use it to pause an auto-dismiss timer. */\n isDragging: boolean;\n}\n\nconst EXIT_TRANSITION_MS = 180;\n// Below this many px of movement, direction intent isn't decided yet — lets a vertical scroll\n// gesture that merely starts on the element pass through instead of being hijacked as a swipe.\nconst AXIS_LOCK_THRESHOLD = 10;\n\n/**\n * Drag-to-dismiss on any pointer type (touch, mouse, pen) via the Pointer Events API. Applies the\n * drag offset and a fading opacity directly to the DOM node (bypassing React state) so the visual\n * tracks the pointer at native speed, then either springs back or animates fully off-screen and\n * calls `onDismiss` once that exit transition completes.\n */\nexport function useSwipeDismiss<T extends HTMLElement>({\n onDismiss,\n axis = 'x',\n distanceThreshold = 80,\n velocityThreshold = 0.5,\n disabled = false,\n mobileOnly = true,\n}: UseSwipeDismissOptions): UseSwipeDismissResult<T> {\n const ref = useRef<T>(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const isCoarsePointer = useCoarsePointer();\n\n const effectiveDisabled = disabled || (mobileOnly && !isCoarsePointer);\n\n // Mutable across the life of one drag; doesn't need to trigger re-renders.\n const dragRef = useRef<{\n pointerId: number;\n startX: number;\n startY: number;\n startTime: number;\n offset: number;\n axisLocked: boolean;\n active: boolean;\n } | null>(null);\n\n const onDismissRef = useRef(onDismiss);\n useEffect(() => {\n onDismissRef.current = onDismiss;\n });\n\n useEffect(() => {\n const el = ref.current;\n if (!el || effectiveDisabled) return;\n\n function applyTransform(offset: number, transition: string) {\n if (!el) return;\n if (transition !== 'none') {\n // Switching straight from the live drag's `transition: none` to an animated one, in the\n // same tick as the transform change, can get coalesced into a single frame with no\n // animation in between — the element just jumps to its end state instead of sliding\n // there. Forcing a layout read first commits the current (pre-transition) position as\n // its own frame, so the transition below actually has something to animate from.\n void el.offsetHeight;\n }\n const translate = axis === 'x' ? `translateX(${offset}px)` : `translateY(${offset}px)`;\n el.style.transition = transition;\n el.style.transform = translate;\n const fade = Math.max(0, 1 - Math.abs(offset) / (distanceThreshold * 2.5));\n el.style.opacity = String(fade);\n }\n\n function onPointerMove(event: PointerEvent) {\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n\n const deltaX = event.clientX - drag.startX;\n const deltaY = event.clientY - drag.startY;\n\n if (!drag.axisLocked) {\n const primary = axis === 'x' ? deltaX : deltaY;\n const cross = axis === 'x' ? deltaY : deltaX;\n if (Math.abs(primary) < AXIS_LOCK_THRESHOLD && Math.abs(cross) < AXIS_LOCK_THRESHOLD) return;\n if (Math.abs(cross) > Math.abs(primary)) {\n // The gesture is mostly along the other axis (e.g. a page scroll) — hand it back.\n drag.active = false;\n return;\n }\n drag.axisLocked = true;\n setIsDragging(true);\n }\n\n if (!drag.active) return;\n event.preventDefault();\n drag.offset = axis === 'x' ? deltaX : deltaY;\n applyTransform(drag.offset, 'none');\n }\n\n function finishDrag() {\n const drag = dragRef.current;\n dragRef.current = null;\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', finishDrag);\n window.removeEventListener('pointercancel', finishDrag);\n if (!drag || !drag.active || !drag.axisLocked) {\n setIsDragging(false);\n return;\n }\n\n const elapsed = Math.max(1, Date.now() - drag.startTime);\n const velocity = drag.offset / elapsed;\n const committed =\n Math.abs(drag.offset) >= distanceThreshold || Math.abs(velocity) >= velocityThreshold;\n\n if (committed) {\n const width = el?.getBoundingClientRect().width ?? 0;\n const exitOffset = Math.sign(drag.offset || 1) * (width + 40);\n applyTransform(exitOffset, `transform ${EXIT_TRANSITION_MS}ms ease-out, opacity ${EXIT_TRANSITION_MS}ms ease-out`);\n setTimeout(() => onDismissRef.current(), EXIT_TRANSITION_MS);\n } else {\n applyTransform(0, `transform ${EXIT_TRANSITION_MS}ms ease-out, opacity ${EXIT_TRANSITION_MS}ms ease-out`);\n }\n setIsDragging(false);\n }\n\n function onPointerDown(event: PointerEvent) {\n if (dragRef.current || !el) return;\n // A still-\"forwards\"-filling CSS animation (e.g. the toast's entrance slide) wins the\n // cascade over an inline style.transform, so the drag offset below would silently never\n // show up on screen unless the animation is cleared first.\n el.style.animation = 'none';\n dragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startY: event.clientY,\n startTime: Date.now(),\n offset: 0,\n axisLocked: false,\n active: true,\n };\n window.addEventListener('pointermove', onPointerMove, { passive: false });\n window.addEventListener('pointerup', finishDrag);\n window.addEventListener('pointercancel', finishDrag);\n }\n\n el.addEventListener('pointerdown', onPointerDown);\n return () => {\n el.removeEventListener('pointerdown', onPointerDown);\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', finishDrag);\n window.removeEventListener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B,cAAe,CAAa,MACnC,CACX,EAAG,oBAAoB,cAAe,CAAa,EACnD,OAAO,oBAAoB,cAAe,CAAa,EACvD,OAAO,oBAAoB,YAAa,CAAU,EAClD,OAAO,oBAAoB,gBAAiB,CAAU,CACxD,CACF,EAAG,CAAC,EAAM,EAAmB,EAAmB,CAAiB,CAAC,EAE3D,CAAE,MAAK,YAAW,CAC3B"}
@@ -1,2 +1,2 @@
1
- import e from"../ripple/ripple.mjs";import t from"./iconPicker.module.mjs";import{useRef as n}from"react";import r from"classnames";import{FontAwesomeIcon as i}from"@fortawesome/react-fontawesome";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s(e){let{formValidator:t}=e;return t?t.touched&&t.hasError():!1}function c(e){let{isRequired:t,formValidator:n}=e;return!!(t||n?.validators.find(e=>e.validatorId===`required`))}function l({data:l=[],selectedId:u=null,label:d=``,onChange:f,formValidator:p=null,isRequired:m,className:h,style:g,classNames:_,styles:v,...y}){let b=p?p.value??null:u,x=s({formValidator:p,isRequired:m}),S=c({formValidator:p,isRequired:m}),C=n([]),w=l.findIndex(e=>e.id===b),T=w>=0?w:0;function E(e){p&&p.set(e),f?.(e)}function D(e,t){if(l.length===0)return;let n=(t+e+l.length)%l.length;C.current[n]?.focus(),E(l[n].id)}function O(e,t,n){switch(e.key){case`ArrowDown`:case`ArrowRight`:e.preventDefault(),D(1,t);break;case`ArrowUp`:case`ArrowLeft`:e.preventDefault(),D(-1,t);break;case` `:case`Enter`:e.preventDefault(),E(n);break;default:break}}return o(`div`,{...y,className:r(t.iconPicker,{[t.iconPickerError]:x},_?.root,h),style:{...v?.root,...g},children:[d&&o(`div`,{className:r(t.iconPickerLabel,_?.label),style:v?.label,children:[d,S&&` *`]}),a(`div`,{role:`radiogroup`,"aria-label":d||void 0,className:r(t.iconPickerItemContainer,_?.itemContainer),style:v?.itemContainer,children:l.map(({id:n,label:s,icon:c,customIcon:l},u)=>{let d=b===n;return o(`div`,{ref:e=>{C.current[u]=e},className:r(t.iconPickerItem,{[t.iconPickerItemSelected]:d},_?.item),style:v?.item,title:s,tabIndex:u===T?0:-1,role:`radio`,"aria-checked":d,onClick:()=>E(n),onKeyDown:e=>O(e,u,n),children:[c&&a(i,{icon:c}),l??null,a(e,{})]},n)})})]})}export{l as default};
1
+ import e from"../ripple/ripple.mjs";import t from"./iconPicker.module.mjs";import{useRef as n}from"react";import r from"classnames";import{FontAwesomeIcon as i}from"@fortawesome/react-fontawesome";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s(e){let{formValidator:t}=e;return t?t.touched&&t.hasError():!1}function c(e){let{isRequired:t,formValidator:n}=e;return!!(t||n?.validators.find(e=>e.validatorId===`required`))}function l({data:l=[],selectedId:u=null,label:d=``,onChange:f,formValidator:p=null,isRequired:m,className:h,style:g,classNames:_,styles:v,...y}){let b=p?p.value??null:u,x=s({formValidator:p,isRequired:m}),S=c({formValidator:p,isRequired:m}),C=n([]),w=n([]),T=l.findIndex(e=>e.id===b),E=T>=0?T:0;function D(e){p&&p.set(e),f?.(e)}function O(e,t){if(l.length===0)return;let n=(t+e+l.length)%l.length;C.current[n]?.focus(),D(l[n].id)}function k(e,t,n){switch(e.key){case`ArrowDown`:case`ArrowRight`:e.preventDefault(),O(1,t);break;case`ArrowUp`:case`ArrowLeft`:e.preventDefault(),O(-1,t);break;case` `:case`Enter`:e.preventDefault(),w.current[t]?.addRipple(),D(n);break;default:break}}return o(`div`,{...y,className:r(t.iconPicker,{[t.iconPickerError]:x},_?.root,h),style:{...v?.root,...g},children:[d&&o(`div`,{className:r(t.iconPickerLabel,_?.label),style:v?.label,children:[d,S&&` *`]}),a(`div`,{role:`radiogroup`,"aria-label":d||void 0,className:r(t.iconPickerItemContainer,_?.itemContainer),style:v?.itemContainer,children:l.map(({id:n,label:s,icon:c,customIcon:l},u)=>{let d=b===n;return o(`div`,{ref:e=>{C.current[u]=e},className:r(t.iconPickerItem,{[t.iconPickerItemSelected]:d},_?.item),style:v?.item,title:s,tabIndex:u===E?0:-1,role:`radio`,"aria-checked":d,onClick:()=>D(n),onKeyDown:e=>k(e,u,n),children:[c&&a(i,{icon:c}),l??null,a(e,{ref:e=>{w.current[u]=e}})]},n)})})]})}export{l as default};
2
2
  //# sourceMappingURL=iconPicker.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iconPicker.mjs","names":[],"sources":["../../../../package/common/iconPicker/iconPicker.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport cx from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport styles from './iconPicker.module.pcss';\nimport Ripple from '../ripple';\nimport type { IconPickerItem, IconPickerProps } from './iconPicker.types';\n\nfunction hasError(props: IconPickerProps): boolean {\n const { formValidator } = props;\n return formValidator ? (formValidator.touched && formValidator.hasError()) : false;\n}\n\nfunction isRequired(props: IconPickerProps): boolean {\n const { isRequired: reqProp, formValidator } = props;\n return !!(reqProp || formValidator?.validators.find(\n (v) => (v as { validatorId?: string }).validatorId === 'required'\n ));\n}\n\nexport default function IconPicker({\n data = [],\n selectedId = null,\n label = '',\n onChange,\n formValidator = null,\n isRequired: _isRequired,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n}: IconPickerProps) {\n const currentValue = formValidator ? (formValidator.value as string) ?? null : selectedId;\n const showError = hasError({ formValidator, isRequired: _isRequired });\n const required = isRequired({ formValidator, isRequired: _isRequired });\n\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n const selectedIndex = data.findIndex((item) => item.id === currentValue);\n const rovingIndex = selectedIndex >= 0 ? selectedIndex : 0;\n\n function handleSelect(id: string) {\n if (formValidator) formValidator.set(id);\n onChange?.(id);\n }\n\n function moveTo(step: 1 | -1, fromIndex: number) {\n if (data.length === 0) return;\n const next = (fromIndex + step + data.length) % data.length;\n itemRefs.current[next]?.focus();\n handleSelect(data[next].id);\n }\n\n function handleKeyDown(event: React.KeyboardEvent, index: number, id: string) {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n event.preventDefault();\n moveTo(1, index);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n event.preventDefault();\n moveTo(-1, index);\n break;\n case ' ':\n case 'Enter':\n event.preventDefault();\n handleSelect(id);\n break;\n default:\n break;\n }\n }\n\n return (\n <div\n {...rest}\n className={cx(styles.iconPicker, { [styles.iconPickerError]: showError }, classNames?.root, className)}\n style={{ ...slotStyles?.root, ...style }}\n >\n {label && (\n <div className={cx(styles.iconPickerLabel, classNames?.label)} style={slotStyles?.label}>\n {label}\n {required && ' *'}\n </div>\n )}\n <div\n role=\"radiogroup\"\n aria-label={label || undefined}\n className={cx(styles.iconPickerItemContainer, classNames?.itemContainer)}\n style={slotStyles?.itemContainer}\n >\n {data.map(({ id, label: itemLabel, icon, customIcon }: IconPickerItem, index) => {\n const checked = currentValue === id;\n return (\n <div\n key={id}\n ref={(el) => { itemRefs.current[index] = el; }}\n className={cx(\n styles.iconPickerItem,\n { [styles.iconPickerItemSelected]: checked },\n classNames?.item\n )}\n style={slotStyles?.item}\n title={itemLabel}\n tabIndex={index === rovingIndex ? 0 : -1}\n role=\"radio\"\n aria-checked={checked}\n onClick={() => handleSelect(id)}\n onKeyDown={(event) => handleKeyDown(event, index, id)}\n >\n {icon && <FontAwesomeIcon icon={icon} />}\n {customIcon ?? null}\n <Ripple />\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":"uPAOA,SAAS,EAAS,EAAiC,CACjD,GAAM,CAAE,iBAAkB,EAC1B,OAAO,EAAiB,EAAc,SAAW,EAAc,SAAS,EAAK,EAC/E,CAEA,SAAS,EAAW,EAAiC,CACnD,GAAM,CAAE,WAAY,EAAS,iBAAkB,EAC/C,MAAO,CAAC,EAAE,GAAW,GAAe,WAAW,KAC5C,GAAO,EAA+B,cAAgB,UACzD,EACF,CAEA,SAAwB,EAAW,CACjC,OAAO,CAAC,EACR,aAAa,KACb,QAAQ,GACR,WACA,gBAAgB,KAChB,WAAY,EACZ,YACA,QACA,aACA,OAAQ,EACR,GAA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KAAI,MAAO,EAAW,OAAM,cAA8B,IAAU,CAC/E,IAAM,EAAU,IAAiB,EACjC,OACE,EAAC,MAAD,CAEE,IAAM,GAAO,CAAE,EAAS,QAAQ,GAAS,CAAI,EAC7C,UAAW,EACT,EAAO,eACP,EAAG,EAAO,wBAAyB,CAAQ,EAC3C,GAAY,IACd,EACA,MAAO,GAAY,KACnB,MAAO,EACP,SAAU,IAAU,EAAc,EAAI,GACtC,KAAK,QACL,eAAc,EACd,YAAe,EAAa,CAAE,EAC9B,UAAY,GAAU,EAAc,EAAO,EAAO,CAAE,WAdtD,CAgBG,GAAQ,EAAC,EAAD,CAAuB,MAAO,CAAA,EACtC,GAAc,KACf,EAAC,EAAD,CAAS,CAAA,CACN,GAlBE,CAkBF,CAET,CAAC,CACE,CAAA,CACF,GAET"}
1
+ {"version":3,"file":"iconPicker.mjs","names":[],"sources":["../../../../package/common/iconPicker/iconPicker.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport cx from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport styles from './iconPicker.module.pcss';\nimport Ripple from '../ripple';\nimport type { RippleHandle } from '../ripple';\nimport type { IconPickerItem, IconPickerProps } from './iconPicker.types';\n\nfunction hasError(props: IconPickerProps): boolean {\n const { formValidator } = props;\n return formValidator ? (formValidator.touched && formValidator.hasError()) : false;\n}\n\nfunction isRequired(props: IconPickerProps): boolean {\n const { isRequired: reqProp, formValidator } = props;\n return !!(reqProp || formValidator?.validators.find(\n (v) => (v as { validatorId?: string }).validatorId === 'required'\n ));\n}\n\nexport default function IconPicker({\n data = [],\n selectedId = null,\n label = '',\n onChange,\n formValidator = null,\n isRequired: _isRequired,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n}: IconPickerProps) {\n const currentValue = formValidator ? (formValidator.value as string) ?? null : selectedId;\n const showError = hasError({ formValidator, isRequired: _isRequired });\n const required = isRequired({ formValidator, isRequired: _isRequired });\n\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n const rippleRefs = useRef<(RippleHandle | null)[]>([]);\n const selectedIndex = data.findIndex((item) => item.id === currentValue);\n const rovingIndex = selectedIndex >= 0 ? selectedIndex : 0;\n\n function handleSelect(id: string) {\n if (formValidator) formValidator.set(id);\n onChange?.(id);\n }\n\n function moveTo(step: 1 | -1, fromIndex: number) {\n if (data.length === 0) return;\n const next = (fromIndex + step + data.length) % data.length;\n itemRefs.current[next]?.focus();\n handleSelect(data[next].id);\n }\n\n function handleKeyDown(event: React.KeyboardEvent, index: number, id: string) {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n event.preventDefault();\n moveTo(1, index);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n event.preventDefault();\n moveTo(-1, index);\n break;\n case ' ':\n case 'Enter':\n event.preventDefault();\n // No DOM click is dispatched here, so Ripple's own listener never sees the activation.\n rippleRefs.current[index]?.addRipple();\n handleSelect(id);\n break;\n default:\n break;\n }\n }\n\n return (\n <div\n {...rest}\n className={cx(styles.iconPicker, { [styles.iconPickerError]: showError }, classNames?.root, className)}\n style={{ ...slotStyles?.root, ...style }}\n >\n {label && (\n <div className={cx(styles.iconPickerLabel, classNames?.label)} style={slotStyles?.label}>\n {label}\n {required && ' *'}\n </div>\n )}\n <div\n role=\"radiogroup\"\n aria-label={label || undefined}\n className={cx(styles.iconPickerItemContainer, classNames?.itemContainer)}\n style={slotStyles?.itemContainer}\n >\n {data.map(({ id, label: itemLabel, icon, customIcon }: IconPickerItem, index) => {\n const checked = currentValue === id;\n return (\n <div\n key={id}\n ref={(el) => { itemRefs.current[index] = el; }}\n className={cx(\n styles.iconPickerItem,\n { [styles.iconPickerItemSelected]: checked },\n classNames?.item\n )}\n style={slotStyles?.item}\n title={itemLabel}\n tabIndex={index === rovingIndex ? 0 : -1}\n role=\"radio\"\n aria-checked={checked}\n onClick={() => handleSelect(id)}\n onKeyDown={(event) => handleKeyDown(event, index, id)}\n >\n {icon && <FontAwesomeIcon icon={icon}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CAAK,EAChB,MACF,IAAK,IACL,IAAK,QACH,EAAM,eAAe,EAErB,EAAW,QAAQ,IAAQ,UAAU,EACrC,EAAa,CAAE,EACf,MACF,QACE,KACJ,CACF,CAEA,OACE,EAAC,MAAD,CACE,GAAI,EACJ,UAAW,EAAG,EAAO,WAAY,EAAG,EAAO,iBAAkB,CAAU,EAAG,GAAY,KAAM,CAAS,EACrG,MAAO,CAAE,GAAG,GAAY,KAAM,GAAG,CAAM,WAHzC,CAKG,GACC,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,gBAAiB,GAAY,KAAK,EAAG,MAAO,GAAY,eAAlF,CACG,EACA,GAAY,IACV,IAEP,EAAC,MAAD,CACE,KAAK,aACL,aAAY,GAAS,IAAA,GACrB,UAAW,EAAG,EAAO,wBAAyB,GAAY,aAAa,EACvE,MAAO,GAAY,uBAElB,EAAK,KAAK,CAAE,KAAI,MAAO,EAAW,OAAM,cAA8B,IAAU,CAC/E,IAAM,EAAU,IAAiB,EACjC,OACE,EAAC,MAAD,CAEE,IAAM,GAAO,CAAE,EAAS,QAAQ,GAAS,CAAI,EAC7C,UAAW,EACT,EAAO,eACP,EAAG,EAAO,wBAAyB,CAAQ,EAC3C,GAAY,IACd,EACA,MAAO,GAAY,KACnB,MAAO,EACP,SAAU,IAAU,EAAc,EAAI,GACtC,KAAK,QACL,eAAc,EACd,YAAe,EAAa,CAAE,EAC9B,UAAY,GAAU,EAAc,EAAO,EAAO,CAAE,WAdtD,CAgBG,GAAQ,EAAC,EAAD,CAAuB,MAAO,CAAA,EACtC,GAAc,KACf,EAAC,EAAD,CAAQ,IAAM,GAAO,CAAE,EAAW,QAAQ,GAAS,CAAI,CAAI,CAAA,CACxD,GAlBE,CAkBF,CAET,CAAC,CACE,CAAA,CACF,GAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"input.types.mjs","names":[],"sources":["../../../../package/common/input/input.types.ts"],"sourcesContent":["import React from 'react';\nimport type { FormValidator } from 'services/formValidation';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum InputType {\n Edit = 'edit',\n Phone = 'phone',\n Email = 'email',\n Iban = 'iban',\n Date = 'date',\n HasNoIcon = 'hasNoIcon',\n Search = 'searchInput',\n Password = 'password',\n}\n\nexport enum InputIconPosition {\n Left = 'left',\n Right = 'right',\n}\n\nexport type InputSlots = 'label' | 'container' | 'input' | 'suffix' | 'upperRightLabel' | 'fieldset';\n\ntype OverriddenInputAttributes =\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onMouseEnter'\n | 'onMouseLeave'\n | 'onClick'\n | 'type'\n | 'value'\n | 'min'\n | 'max'\n | 'autoComplete';\n\nexport interface InputProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, OverriddenInputAttributes>,\n HtmlProps {\n onMouseEnter?: ((event: React.MouseEvent) => void) | null;\n onMouseLeave?: ((event: React.MouseEvent) => void) | null;\n onFocus?: ((event: React.FocusEvent) => void) | null;\n onBlur?: ((event: React.FocusEvent) => void) | null;\n onChange?: ((value: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement, Element>) => void) | null;\n errorMessage?: string;\n isValid?: boolean;\n isRequired?: boolean;\n label?: string;\n name?: string;\n className?: string;\n style?: React.CSSProperties;\n value?: string | number;\n icon?: React.ReactElement | null;\n iconPosition?: InputIconPosition;\n isUppercase?: boolean;\n isRow?: boolean;\n tabIndex?: number;\n type?: InputType;\n onIconClick?: (() => void) | null;\n parse?: ((value: string) => string) | null;\n suffix?: string | React.ReactNode;\n disabled?: boolean;\n upperRightLabel?: string | React.ReactNode;\n labelInBorder?: boolean;\n showCancel?: boolean;\n onClearClicked?: (() => void) | null;\n min?: string | number | null;\n max?: string | number | null;\n placeholder?: string;\n useMatLabelStyle?: boolean;\n alwaysFloatLabel?: boolean;\n autoComplete?: string | null;\n onClick?: (() => void) | null;\n readOnly?: boolean;\n customInput?: React.ReactElement | null;\n autoFocus?: boolean;\n alwaysShowCancel?: boolean;\n formValidator?: FormValidator | null;\n multiline?: boolean;\n rows?: number;\n autoResize?: boolean;\n classNames?: SlotClassNames<InputSlots>;\n styles?: SlotStyles<InputSlots>;\n}\n"],"mappings":"AAIA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,KAAA,OACA,EAAA,MAAA,QACA,EAAA,MAAA,QACA,EAAA,KAAA,OACA,EAAA,KAAA,OACA,EAAA,UAAA,YACA,EAAA,OAAA,cACA,EAAA,SAAA,YACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"input.types.mjs","names":[],"sources":["../../../../package/common/input/input.types.ts"],"sourcesContent":["import React from 'react';\nimport type { FormValidator } from 'services/formValidation';\nimport type { SlotClassNames, SlotStyles, DataProps } from '../types/slots.types';\n\nexport enum InputType {\n Edit = 'edit',\n Phone = 'phone',\n Email = 'email',\n Iban = 'iban',\n Date = 'date',\n HasNoIcon = 'hasNoIcon',\n Search = 'searchInput',\n Password = 'password',\n}\n\nexport enum InputIconPosition {\n Left = 'left',\n Right = 'right',\n}\n\nexport type InputSlots = 'label' | 'container' | 'input' | 'suffix' | 'upperRightLabel' | 'fieldset';\n\ntype OverriddenInputAttributes =\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onMouseEnter'\n | 'onMouseLeave'\n | 'onClick'\n | 'type'\n | 'value'\n | 'min'\n | 'max'\n | 'autoComplete';\n\nexport interface InputProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, OverriddenInputAttributes>,\n DataProps {\n onMouseEnter?: ((event: React.MouseEvent) => void) | null;\n onMouseLeave?: ((event: React.MouseEvent) => void) | null;\n onFocus?: ((event: React.FocusEvent) => void) | null;\n onBlur?: ((event: React.FocusEvent) => void) | null;\n onChange?: ((value: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement, Element>) => void) | null;\n errorMessage?: string;\n isValid?: boolean;\n isRequired?: boolean;\n label?: string;\n name?: string;\n className?: string;\n style?: React.CSSProperties;\n value?: string | number;\n icon?: React.ReactElement | null;\n iconPosition?: InputIconPosition;\n isUppercase?: boolean;\n isRow?: boolean;\n tabIndex?: number;\n type?: InputType;\n onIconClick?: (() => void) | null;\n parse?: ((value: string) => string) | null;\n suffix?: string | React.ReactNode;\n disabled?: boolean;\n upperRightLabel?: string | React.ReactNode;\n labelInBorder?: boolean;\n showCancel?: boolean;\n onClearClicked?: (() => void) | null;\n min?: string | number | null;\n max?: string | number | null;\n placeholder?: string;\n useMatLabelStyle?: boolean;\n alwaysFloatLabel?: boolean;\n autoComplete?: string | null;\n onClick?: (() => void) | null;\n readOnly?: boolean;\n customInput?: React.ReactElement | null;\n autoFocus?: boolean;\n alwaysShowCancel?: boolean;\n formValidator?: FormValidator | null;\n multiline?: boolean;\n rows?: number;\n autoResize?: boolean;\n classNames?: SlotClassNames<InputSlots>;\n styles?: SlotStyles<InputSlots>;\n}\n"],"mappings":"AAIA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,KAAA,OACA,EAAA,MAAA,QACA,EAAA,MAAA,QACA,EAAA,KAAA,OACA,EAAA,KAAA,OACA,EAAA,UAAA,YACA,EAAA,OAAA,cACA,EAAA,SAAA,YACF,EAAA,CAAA,CAAA,EAEY,EAAL,SAAA,EAAA,OACL,GAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import e from"./interactableDiv.module.mjs";import t,{useCallback as n}from"react";import r from"classnames";import{jsx as i}from"react/jsx-runtime";var a=t.forwardRef(({className:t,children:a,onClick:o,onKeyDown:s,tabIndex:c=0,...l},u)=>{let d=n(e=>{(e.key===`Enter`||e.key===` `)&&(e.key===` `&&e.preventDefault(),o?.(e)),s?.(e)},[o,s]);return i(`div`,{className:r(e.interactableDiv,t),onClick:o,tabIndex:c??void 0,role:`button`,onKeyDown:d,ref:u,...l,children:a})});a.displayName=`InteractableDiv`;export{a as default};
1
+ import e from"./interactableDiv.module.mjs";import t,{useCallback as n}from"react";import r from"classnames";import{jsx as i}from"react/jsx-runtime";var a=t.forwardRef(({className:t,children:a,onClick:o,onKeyDown:s,tabIndex:c,...l},u)=>{let d=n(e=>{(e.key===`Enter`||e.key===` `)&&(e.key===` `&&e.preventDefault(),o?.(e)),s?.(e)},[o,s]);return i(`div`,{className:r(e.interactableDiv,t),onClick:o,tabIndex:c===void 0?o?0:void 0:c??void 0,role:o?`button`:void 0,onKeyDown:d,ref:u,...l,children:a})});a.displayName=`InteractableDiv`;export{a as default};
2
2
  //# sourceMappingURL=interactableDiv.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactableDiv.mjs","names":[],"sources":["../../../../package/common/interactableDiv/interactableDiv.tsx"],"sourcesContent":["import cx from 'classnames';\nimport React, { useCallback, type KeyboardEvent, type MouseEvent, type ReactElement } from 'react';\n\nimport styles from './interactableDiv.module.pcss';\nimport type { HtmlProps } from '../types/baseProps.types';\n\ninterface Properties extends HtmlProps, Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex'> {\n tabIndex?: number | null;\n}\n\nconst InteractableDiv = React.forwardRef<HTMLDivElement, Properties>(\n ({ className, children, onClick, onKeyDown, tabIndex = 0, ...props }, ref): ReactElement => {\n const onKeyDownHandler = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n if (e.key === ' ') e.preventDefault();\n onClick?.(e as unknown as MouseEvent<HTMLDivElement>);\n }\n onKeyDown?.(e);\n },\n [onClick, onKeyDown]\n );\n\n return (\n <div\n className={cx(styles.interactableDiv, className)}\n onClick={onClick}\n tabIndex={tabIndex ?? undefined}\n role=\"button\"\n onKeyDown={onKeyDownHandler}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nInteractableDiv.displayName = 'InteractableDiv';\n\nexport default InteractableDiv;\n"],"mappings":"qJAUA,IAAM,EAAkB,EAAM,YAC3B,CAAE,YAAW,WAAU,UAAS,YAAW,WAAW,EAAG,GAAG,GAAS,IAAsB,CAC1F,IAAM,EAAmB,EACtB,GAAqC,EAChC,EAAE,MAAQ,SAAW,EAAE,MAAQ,OAC7B,EAAE,MAAQ,KAAK,EAAE,eAAe,EACpC,IAAU,CAA0C,GAEtD,IAAY,CAAC,CACf,EACA,CAAC,EAAS,CAAS,CACrB,EAEA,OACE,EAAC,MAAD,CACE,UAAW,EAAG,EAAO,gBAAiB,CAAS,EACtC,UACT,SAAU,GAAY,IAAA,GACtB,KAAK,SACL,UAAW,EACN,MACL,GAAI,EAEH,UACE,CAAA,CAET,CACF,EAEA,EAAgB,YAAc"}
1
+ {"version":3,"file":"interactableDiv.mjs","names":[],"sources":["../../../../package/common/interactableDiv/interactableDiv.tsx"],"sourcesContent":["import cx from 'classnames';\nimport React, { useCallback, type KeyboardEvent, type MouseEvent, type ReactElement } from 'react';\n\nimport styles from './interactableDiv.module.pcss';\nimport type { DataProps } from '../types/baseProps.types';\n\ninterface Properties extends DataProps, Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex'> {\n tabIndex?: number | null;\n}\n\nconst InteractableDiv = React.forwardRef<HTMLDivElement, Properties>(\n ({ className, children, onClick, onKeyDown, tabIndex, ...props }, ref): ReactElement => {\n const onKeyDownHandler = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n if (e.key === ' ') e.preventDefault();\n onClick?.(e as unknown as MouseEvent<HTMLDivElement>);\n }\n onKeyDown?.(e);\n },\n [onClick, onKeyDown]\n );\n\n // Compared to undefined rather than using ??, so an explicit null still means \"no tabindex\"\n // instead of falling through to the default.\n return (\n <div\n className={cx(styles.interactableDiv, className)}\n onClick={onClick}\n tabIndex={tabIndex === undefined ? (onClick ? 0 : undefined) : (tabIndex ?? undefined)}\n role={onClick ? 'button' : undefined}\n onKeyDown={onKeyDownHandler}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nInteractableDiv.displayName = 'InteractableDiv';\n\nexport default InteractableDiv;\n"],"mappings":"qJAUA,IAAM,EAAkB,EAAM,YAC3B,CAAE,YAAW,WAAU,UAAS,YAAW,WAAU,GAAG,GAAS,IAAsB,CACtF,IAAM,EAAmB,EACtB,GAAqC,EAChC,EAAE,MAAQ,SAAW,EAAE,MAAQ,OAC7B,EAAE,MAAQ,KAAK,EAAE,eAAe,EACpC,IAAU,CAA0C,GAEtD,IAAY,CAAC,CACf,EACA,CAAC,EAAS,CAAS,CACrB,EAIA,OACE,EAAC,MAAD,CACE,UAAW,EAAG,EAAO,gBAAiB,CAAS,EACtC,UACT,SAAU,IAAa,IAAA,GAAa,EAAU,EAAI,IAAA,GAAc,GAAY,IAAA,GAC5E,KAAM,EAAU,SAAW,IAAA,GAC3B,UAAW,EACN,MACL,GAAI,EAEH,UACE,CAAA,CAET,CACF,EAEA,EAAgB,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../package/common/numberInput/index.ts"],"sourcesContent":["import NumberInput from './numberInput';\n\nexport default NumberInput;\n"],"mappings":"iCAEA,IAAA,EAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../package/common/numberInput/index.ts"],"sourcesContent":["import NumberInput from './numberInput';\n\nexport type { NumberInputProps, NumberInputArrowsLayout } from './numberInput.types';\nexport default NumberInput;\n"],"mappings":"iCAGA,IAAA,EAAe"}
@@ -1,2 +1,2 @@
1
- import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../interactableDiv/index.mjs";import n from"../input/input.mjs";import r from"./numberInput.module.mjs";import i from"react";import a from"classnames";import{FontAwesomeIcon as o}from"@fortawesome/react-fontawesome";import{faChevronDown as s,faChevronUp as c}from"@fortawesome/free-solid-svg-icons";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{NumericFormat as d}from"react-number-format";function f(f){let p=i.useRef(void 0),{value:m,onChange:h,formValidator:g,label:_,error:v,className:y,style:b,allowNegative:x=!1,decimalSeparator:S,thousandSeparator:C,prefix:w,suffix:T,decimalScale:E,fixedDecimalScale:D=!0,placeholder:O,sign:k,showArrows:A=!1,step:j=1,readOnly:M=!1,isRequired:N=!1,onKeyDown:P,...F}=e(`NumberInput`,f),[,I]=i.useState(0);i.useEffect(()=>{if(p.current=g,!g)return;let e=()=>I(e=>e+1);return g.registerOnUpdateListener(e),()=>{g.removeOnUpdateListener(e)}},[g]);let L=N||!!g?.validators.find(e=>e.validatorId===`required`),R=g==null?m:g.value,z=k!=null&&R!=null?Math.abs(Number(R)):R,B=z==null?``:String(z);function V(e){let t=e;t!==void 0&&(k===`-`&&(t=-Math.abs(t)),k===`+`&&(t=Math.abs(t))),g?.set(t??null),h?.(t)}function H(e){if(M)return;let t=(R!=null&&R!==``?Number(R):0)+e;!x&&k!==`-`&&(t=Math.max(0,t)),k===`-`&&(t=Math.min(0,t)),V(t)}function U(e){if(M){P?.(e);return}if(e.key===`ArrowUp`){e.preventDefault(),H(e.shiftKey?j*10:j);return}if(e.key===`ArrowDown`){e.preventDefault(),H(e.shiftKey?-j*10:-j);return}P?.(e)}let W=k===`-`?`-`:k===`+`?`+`:w,G=A&&!M?u(`div`,{className:r.arrows,children:[l(t,{className:r.arrowBtn,tabIndex:-1,onMouseDown:e=>{e.preventDefault(),H(e.shiftKey?j*10:j)},children:l(o,{icon:c})}),l(t,{className:r.arrowBtn,tabIndex:-1,onMouseDown:e=>{e.preventDefault(),H(e.shiftKey?-j*10:-j)},children:l(o,{icon:s})})]}):null;return l(n,{label:_,className:a(r.numberInput,y),style:b,value:B,onChange:()=>{},formValidator:null,isRequired:L,onBlur:()=>{p.current&&(p.current.touched=!0)},isValid:g?g.touched?!g.hasError():!0:!v,errorMessage:g?g.touched?g.getCurrentErrorMessage()??``:``:v??``,placeholder:O,readOnly:M,suffix:G,inputMode:E===0?`numeric`:`decimal`,customInput:l(d,{onValueChange:e=>V(e.floatValue),allowNegative:k==null?x:!1,decimalSeparator:S,thousandSeparator:C,decimalScale:E,fixedDecimalScale:D,prefix:W,suffix:T,onKeyDown:A?U:P,...F})})}export{f as default};
1
+ import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import{ButtonSize as t}from"../button/button.types.mjs";import n from"../button/button.mjs";import r from"../buttonGroup/buttonGroup.mjs";import i from"../input/input.mjs";import ee from"../hooks/useCoarsePointer.mjs";import a from"./numberInput.module.mjs";import o from"./useStepRepeat.mjs";import s from"react";import c from"classnames";import{FontAwesomeIcon as l}from"@fortawesome/react-fontawesome";import{faChevronDown as te,faChevronUp as u,faMinus as ne,faPlus as d}from"@fortawesome/free-solid-svg-icons";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{NumericFormat as re}from"react-number-format";function m({label:e,disabled:t,direction:n,onStart:r,onStop:i}){return{tabIndex:-1,disabled:t,"aria-label":e,onPointerDown:e=>{e.button!==0&&e.pointerType===`mouse`||(e.preventDefault(),r(n,e.shiftKey?10:1))},onPointerUp:i,onPointerCancel:i,onContextMenu:e=>e.preventDefault()}}function h(e){return f(`button`,{type:`button`,...m(e),className:a.arrowBtn,children:f(l,{icon:e.icon,"aria-hidden":`true`})})}function g(e){let{disabled:r,...i}=m(e);return f(n,{...i,className:a.splitBtn,size:t.Icon,disabled:r,icon:e.icon})}function _(t){let n=s.useRef(void 0),{value:l,onChange:m,formValidator:_,label:ie,error:v,className:y,style:b,allowNegative:x=!1,decimalSeparator:ae,thousandSeparator:oe,prefix:se,suffix:ce,decimalScale:S,fixedDecimalScale:C=!0,placeholder:w,sign:T,showArrows:E=!1,step:D=1,min:O,max:k,arrowsLayout:A=`auto`,increaseLabel:j=`Increase`,decreaseLabel:M=`Decrease`,readOnly:N=!1,disabled:P=!1,isRequired:le=!1,onKeyDown:F,...ue}=e(`NumberInput`,t),[,de]=s.useState(0);s.useEffect(()=>{if(n.current=_,!_)return;let e=()=>de(e=>e+1);return _.registerOnUpdateListener(e),()=>{_.removeOnUpdateListener(e)}},[_]);let fe=le||!!_?.validators.find(e=>e.validatorId===`required`),I=_==null?l:_.value,L=T!=null&&I!=null?Math.abs(Number(I)):I,R=L==null?``:String(L);function z(e){let t=e;t!==void 0&&(T===`-`&&(t=-Math.abs(t)),T===`+`&&(t=Math.abs(t))),_?.set(t??null),m?.(t)}function B(e){let t=e;return!x&&T!==`-`&&(t=Math.max(0,t)),T===`-`&&(t=Math.min(0,t)),O!==void 0&&(t=Math.max(O,t)),k!==void 0&&(t=Math.min(k,t)),t}let V=I!=null&&I!==``?Number(I):0;function H(){if(N||P||I==null||I===``)return;let e=Number(I);if(!Number.isFinite(e))return;let t=B(e);t!==e&&z(t)}function U(e){if(N||P)return!1;let t=B(V+e);return t===V?!1:(z(t),!0)}let{start:pe,stop:me}=o(e=>U(e*D));function he(e){if(e.key===`Enter`){H(),F?.(e);return}if(!G){F?.(e);return}if(e.key===`ArrowUp`){e.preventDefault(),U(e.shiftKey?D*10:D);return}if(e.key===`ArrowDown`){e.preventDefault(),U(e.shiftKey?-D*10:-D);return}F?.(e)}let W=T===`-`?`-`:T===`+`?`+`:se,ge=ee(),G=E&&!N&&!P,K=A===`split`||A===`auto`&&ge,q=B(V+D)!==V,J=B(V-D)!==V,Y={onStart:pe,onStop:me},X=G&&!K?p(`div`,{className:a.arrows,children:[f(h,{label:j,icon:u,disabled:!q,direction:1,...Y}),f(h,{label:M,icon:te,disabled:!J,direction:-1,...Y})]}):null,_e=G?{role:`spinbutton`,"aria-valuenow":Number.isFinite(V)?V:void 0,"aria-valuemin":O,"aria-valuemax":k,"aria-valuetext":R||void 0}:{},Z=_?_.touched?!_.hasError():!0:!v,Q=G&&K,$=f(i,{label:ie,className:c(a.numberInput,{[a.numberInputSplit]:Q},Q?void 0:y),style:Q?void 0:b,value:R,onChange:()=>{},formValidator:null,isRequired:fe,onBlur:()=>{H(),n.current&&(n.current.touched=!0)},isValid:Z,errorMessage:_?_.touched?_.getCurrentErrorMessage()??``:``:v??``,placeholder:w,readOnly:N,disabled:P,suffix:X,classNames:X?{suffix:a.arrowSuffix}:void 0,inputMode:S===0?`numeric`:`decimal`,customInput:f(re,{onValueChange:e=>z(e.floatValue),allowNegative:T==null?x:!1,decimalSeparator:ae,thousandSeparator:oe,decimalScale:S,fixedDecimalScale:C,prefix:W,suffix:ce,onKeyDown:he,..._e,...ue})});return Q?p(r,{className:c(a.split,{[a.splitInvalid]:!Z},y),style:b,children:[f(g,{label:M,icon:ne,disabled:!J,direction:-1,...Y}),$,f(g,{label:j,icon:d,disabled:!q,direction:1,...Y})]}):$}export{_ as default};
2
2
  //# sourceMappingURL=numberInput.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"numberInput.mjs","names":[],"sources":["../../../../package/common/numberInput/numberInput.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport cx from 'classnames';\nimport { NumericFormat, NumericFormatProps } from 'react-number-format';\nimport type { FormValidator } from 'services/formValidation';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faChevronUp, faChevronDown } from '@fortawesome/free-solid-svg-icons';\n\nimport styles from './numberInput.module.pcss';\nimport Input from '../input';\nimport InteractableDiv from '../interactableDiv';\nimport { useComponentDefaults } from '../configProvider';\n\nexport interface NumberInputProps\n extends Omit<NumericFormatProps, 'onValueChange' | 'value' | 'customInput' | 'onChange' | 'step' | 'onKeyDown'> {\n value?: number | string;\n onChange?: (value: number | undefined) => void;\n formValidator?: FormValidator | null;\n label?: string;\n error?: string;\n className?: string;\n allowNegative?: boolean;\n decimalSeparator?: string;\n thousandSeparator?: string | boolean;\n prefix?: string;\n suffix?: string;\n decimalScale?: number;\n /**\n * Whether to pad the value to exactly `decimalScale` decimals. Default `true`\n * (e.g. with `decimalScale={2}`, `12` displays as `12.00`). Set `false` to make\n * `decimalScale` an upper limit only — the user may type fewer decimals and they\n * are kept as-is (`12` stays `12`, `12.1` stays `12.1`), while anything beyond\n * `decimalScale` is still truncated.\n */\n fixedDecimalScale?: boolean;\n placeholder?: string;\n sign?: '+' | '-';\n showArrows?: boolean;\n step?: number;\n readOnly?: boolean;\n isRequired?: boolean;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n}\n\nfunction NumberInput(props: NumberInputProps): ReactElement {\n const fvRef = React.useRef<FormValidator | null | undefined>(undefined);\n const {\n value,\n onChange,\n formValidator,\n label,\n error,\n className,\n style,\n allowNegative = false,\n decimalSeparator,\n thousandSeparator,\n prefix,\n suffix,\n decimalScale,\n fixedDecimalScale = true,\n placeholder,\n sign,\n showArrows = false,\n step = 1,\n readOnly = false,\n isRequired = false,\n onKeyDown: onKeyDownProp,\n ...rest\n } = useComponentDefaults('NumberInput', props);\n const [, forceUpdate] = React.useState(0);\n React.useEffect(() => {\n fvRef.current = formValidator;\n if (!formValidator) return;\n const listener = () => forceUpdate((n) => n + 1);\n formValidator.registerOnUpdateListener(listener);\n return () => { formValidator.removeOnUpdateListener(listener); };\n }, [formValidator]);\n const computedIsRequired = isRequired || !!formValidator?.validators.find(\n (v) => (v as { validatorId?: string }).validatorId === 'required'\n );\n const rawValue = formValidator != null ? formValidator.value as number | string : value;\n // When a sign is forced, display the absolute value — the prefix character carries the sign visually.\n const displayValue = sign != null && rawValue != null ? Math.abs(Number(rawValue)) : rawValue;\n const controlledValue = displayValue != null ? String(displayValue) : '';\n\n function handleValueChange(floatValue: number | undefined) {\n let out = floatValue;\n if (out !== undefined) {\n if (sign === '-') out = -Math.abs(out);\n if (sign === '+') out = Math.abs(out);\n }\n if (formValidator != null) formValidator.set(out ?? null);\n onChange?.(out);\n }\n\n function handleStep(delta: number) {\n if (readOnly) return;\n const current = rawValue != null && rawValue !== '' ? Number(rawValue) : 0;\n let next = current + delta;\n if (!allowNegative && sign !== '-') next = Math.max(0, next);\n if (sign === '-') next = Math.min(0, next);\n handleValueChange(next);\n }\n\n function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n if (readOnly) { onKeyDownProp?.(e); return; }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n handleStep(e.shiftKey ? step * 10 : step);\n return;\n }\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n handleStep(e.shiftKey ? -step * 10 : -step);\n return;\n }\n onKeyDownProp?.(e);\n }\n\n const resolvedPrefix = sign === '-' ? '-' : sign === '+' ? '+' : prefix;\n\n const arrowSuffix = showArrows && !readOnly ? (\n <div className={styles.arrows}>\n <InteractableDiv\n className={styles.arrowBtn}\n tabIndex={-1}\n onMouseDown={(e) => { e.preventDefault(); handleStep(e.shiftKey ? step * 10 : step); }}\n >\n <FontAwesomeIcon icon={faChevronUp} />\n </InteractableDiv>\n <InteractableDiv\n className={styles.arrowBtn}\n tabIndex={-1}\n onMouseDown={(e) => { e.preventDefault(); handleStep(e.shiftKey ? -step * 10 : -step); }}\n >\n <FontAwesomeIcon icon={faChevronDown} />\n </InteractableDiv>\n </div>\n ) : null;\n\n return (\n <Input\n label={label}\n className={cx(styles.numberInput, className)}\n style={style}\n value={controlledValue}\n onChange={() => {}}\n formValidator={null}\n isRequired={computedIsRequired}\n onBlur={() => { if (fvRef.current) fvRef.current.touched = true; }}\n isValid={formValidator ? (formValidator.touched ? !formValidator.hasError() : true) : !error}\n errorMessage={formValidator ? (formValidator.touched ? (formValidator.getCurrentErrorMessage() ?? '') : '') : (error ?? '')}\n placeholder={placeholder}\n readOnly={readOnly}\n suffix={arrowSuffix}\n inputMode={decimalScale === 0 ? 'numeric' : 'decimal'}\n customInput={\n <NumericFormat\n onValueChange={(vals) => handleValueChange(vals.floatValue)}\n allowNegative={sign != null ? false : allowNegative}\n decimalSeparator={decimalSeparator}\n thousandSeparator={thousandSeparator}\n decimalScale={decimalScale}\n fixedDecimalScale={fixedDecimalScale}\n prefix={resolvedPrefix}\n suffix={suffix}\n onKeyDown={showArrows ? handleKeyDown : onKeyDownProp}\n {...rest}\n />\n }\n />\n );\n}\n\nexport default NumberInput;\n"],"mappings":"ifA4CA,SAAS,EAAY,EAAuC,CAC1D,IAAM,EAAQ,EAAM,OAAyC,IAA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eACK,oBACnB,OAAQ,EACA,SACR,UAAW,EAAa,EAAgB,EACxC,GAAI,CACL,CAAA,CAEJ,CAAA,CAEL"}
1
+ {"version":3,"file":"numberInput.mjs","names":[],"sources":["../../../../package/common/numberInput/numberInput.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport cx from 'classnames';\nimport { NumericFormat } from 'react-number-format';\nimport type { FormValidator } from 'services/formValidation';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faChevronUp, faChevronDown, faMinus, faPlus } from '@fortawesome/free-solid-svg-icons';\n\nimport styles from './numberInput.module.pcss';\nimport Input from '../input';\nimport Button from '../button';\nimport ButtonGroup from '../buttonGroup';\nimport { ButtonSize } from '../button/button.types';\nimport { useComponentDefaults } from '../configProvider';\nimport { useCoarsePointer } from '../hooks/useCoarsePointer';\nimport { useStepRepeat } from './useStepRepeat';\nimport type { NumberInputProps } from './numberInput.types';\n\nexport type { NumberInputProps, NumberInputArrowsLayout } from './numberInput.types';\n\ninterface StepButtonProps {\n label: string;\n icon: typeof faPlus;\n disabled: boolean;\n direction: 1 | -1;\n onStart: (direction: 1 | -1, multiplier: number) => void;\n onStop: () => void;\n}\n\n/** Press-and-hold behaviour shared by both stepper layouts. */\nfunction stepButtonProps({ label, disabled, direction, onStart, onStop }: StepButtonProps) {\n return {\n // The input keeps the tab stop — it carries role=\"spinbutton\", which announces the value\n // and the arrow-key affordance, so two more tab stops per field would be noise.\n tabIndex: -1,\n disabled,\n 'aria-label': label,\n // pointerdown (not click) keeps focus in the field and responds immediately on touch.\n // Deliberately no setPointerCapture: capturing retargets the following click to the captured\n // element, past the node Button's ripple listens on. useStepRepeat watches the window for\n // the release instead.\n onPointerDown: (e: React.PointerEvent<HTMLElement>) => {\n if (e.button !== 0 && e.pointerType === 'mouse') return;\n e.preventDefault();\n onStart(direction, e.shiftKey ? 10 : 1);\n },\n onPointerUp: onStop,\n onPointerCancel: onStop,\n onContextMenu: (e: React.SyntheticEvent) => e.preventDefault(),\n };\n}\n\n/** Stacked-layout chevron: borderless, sits inside the field's border. */\nfunction ChevronStepButton(props: StepButtonProps): ReactElement {\n return (\n <button type=\"button\" {...stepButtonProps(props)} className={styles.arrowBtn}>\n <FontAwesomeIcon icon={props.icon} aria-hidden=\"true\" />\n </button>\n );\n}\n\n/** Split-layout stepper: a standalone control, so a real Button. */\nfunction SplitStepButton(props: StepButtonProps): ReactElement {\n const { disabled, ...handlers } = stepButtonProps(props);\n return (\n <Button\n {...handlers}\n className={styles.splitBtn}\n size={ButtonSize.Icon}\n disabled={disabled}\n icon={props.icon}\n />\n );\n}\n\nfunction NumberInput(props: NumberInputProps): ReactElement {\n const fvRef = React.useRef<FormValidator | null | undefined>(undefined);\n const {\n value,\n onChange,\n formValidator,\n label,\n error,\n className,\n style,\n allowNegative = false,\n decimalSeparator,\n thousandSeparator,\n prefix,\n suffix,\n decimalScale,\n fixedDecimalScale = true,\n placeholder,\n sign,\n showArrows = false,\n step = 1,\n min,\n max,\n arrowsLayout = 'auto',\n increaseLabel = 'Increase',\n decreaseLabel = 'Decrease',\n readOnly = false,\n disabled = false,\n isRequired = false,\n onKeyDown: onKeyDownProp,\n ...rest\n } = useComponentDefaults('NumberInput', props);\n const [, forceUpdate] = React.useState(0);\n React.useEffect(() => {\n fvRef.current = formValidator;\n if (!formValidator) return;\n const listener = () => forceUpdate((n) => n + 1);\n formValidator.registerOnUpdateListener(listener);\n return () => { formValidator.removeOnUpdateListener(listener); };\n }, [formValidator]);\n const computedIsRequired = isRequired || !!formValidator?.validators.find(\n (v) => (v as { validatorId?: string }).validatorId === 'required'\n );\n const rawValue = formValidator != null ? formValidator.value as number | string : value;\n // When a sign is forced, display the absolute value — the prefix character carries the sign visually.\n const displayValue = sign != null && rawValue != null ? Math.abs(Number(rawValue)) : rawValue;\n const controlledValue = displayValue != null ? String(displayValue) : '';\n\n function handleValueChange(floatValue: number | undefined) {\n let out = floatValue;\n if (out !== undefined) {\n if (sign === '-') out = -Math.abs(out);\n if (sign === '+') out = Math.abs(out);\n }\n if (formValidator != null) formValidator.set(out ?? null);\n onChange?.(out);\n }\n\n function clamp(next: number): number {\n let out = next;\n if (!allowNegative && sign !== '-') out = Math.max(0, out);\n if (sign === '-') out = Math.min(0, out);\n if (min !== undefined) out = Math.max(min, out);\n if (max !== undefined) out = Math.min(max, out);\n return out;\n }\n\n const currentNumber = rawValue != null && rawValue !== '' ? Number(rawValue) : 0;\n\n /**\n * Called on blur and Enter, never per keystroke: rejecting an out-of-bounds edit as it is\n * typed swallows keystrokes on their way somewhere valid (with `max: 10`, typing `1` in front\n * of `8` to reach `18`). An empty field is skipped so a `min` is never typed in for the user.\n */\n function clampToBounds() {\n if (readOnly || disabled) return;\n if (rawValue == null || rawValue === '') return;\n const n = Number(rawValue);\n if (!Number.isFinite(n)) return;\n const next = clamp(n);\n if (next !== n) handleValueChange(next);\n }\n\n /** Returns whether the value moved, which is how useStepRepeat knows to end a hold at a bound. */\n function handleStep(delta: number): boolean {\n if (readOnly || disabled) return false;\n const next = clamp(currentNumber + delta);\n if (next === currentNumber) return false;\n handleValueChange(next);\n return true;\n }\n\n const { start: startRepeat, stop: stopRepeat } = useStepRepeat((delta) => handleStep(delta * step));\n\n function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n // Enter submits the surrounding form without ever blurring, so the blur clamp would not run.\n // Before the stepper guard, since the bounds apply with or without steppers.\n if (e.key === 'Enter') {\n clampToBounds();\n onKeyDownProp?.(e);\n return;\n }\n if (!showStepper) { onKeyDownProp?.(e); return; }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n handleStep(e.shiftKey ? step * 10 : step);\n return;\n }\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n handleStep(e.shiftKey ? -step * 10 : -step);\n return;\n }\n onKeyDownProp?.(e);\n }\n\n const resolvedPrefix = sign === '-' ? '-' : sign === '+' ? '+' : prefix;\n\n const isCoarsePointer = useCoarsePointer();\n const showStepper = showArrows && !readOnly && !disabled;\n const isSplit = arrowsLayout === 'split' || (arrowsLayout === 'auto' && isCoarsePointer);\n\n const canIncrease = clamp(currentNumber + step) !== currentNumber;\n const canDecrease = clamp(currentNumber - step) !== currentNumber;\n\n const stepperProps = { onStart: startRepeat, onStop: stopRepeat };\n\n const stackedArrows = showStepper && !isSplit ? (\n <div className={styles.arrows}>\n <ChevronStepButton\n label={increaseLabel}\n icon={faChevronUp}\n disabled={!canIncrease}\n direction={1}\n {...stepperProps}\n />\n <ChevronStepButton\n label={decreaseLabel}\n icon={faChevronDown}\n disabled={!canDecrease}\n direction={-1}\n {...stepperProps}\n />\n </div>\n ) : null;\n\n // aria-* is spread onto NumericFormat, which forwards unknown props to the DOM input.\n // Input's own cloneElement doesn't set these keys, so they survive the clone.\n const spinButtonProps = showStepper\n ? {\n role: 'spinbutton',\n 'aria-valuenow': Number.isFinite(currentNumber) ? currentNumber : undefined,\n 'aria-valuemin': min,\n 'aria-valuemax': max,\n 'aria-valuetext': controlledValue || undefined,\n }\n : {};\n\n // Shared with the split group, whose buttons have to mirror the field's invalid state — they\n // form one continuous border.\n const isValid = formValidator ? (formValidator.touched ? !formValidator.hasError() : true) : !error;\n\n // In the split layout the ButtonGroup is the root, so the consumer's className and style\n // belong there rather than on the Input.\n const isSplitGroup = showStepper && isSplit;\n\n const input = (\n <Input\n label={label}\n className={cx(styles.numberInput, { [styles.numberInputSplit]: isSplitGroup }, isSplitGroup ? undefined : className)}\n style={isSplitGroup ? undefined : style}\n value={controlledValue}\n onChange={() => {}}\n formValidator={null}\n isRequired={computedIsRequired}\n onBlur={() => { clampToBounds(); if (fvRef.current) fvRef.current.touched = true; }}\n isValid={isValid}\n errorMessage={formValidator ? (formValidator.touched ? (formValidator.getCurrentErrorMessage() ?? '') : '') : (error ?? '')}\n placeholder={placeholder}\n readOnly={readOnly}\n disabled={disabled}\n suffix={stackedArrows}\n // Input centres its suffix wrapper; this lets the chevrons claim the field's full height.\n classNames={stackedArrows ? { suffix: styles.arrowSuffix } : undefined}\n inputMode={decimalScale === 0 ? 'numeric' : 'decimal'}\n customInput={\n <NumericFormat\n onValueChange={(vals) => handleValueChange(vals.floatValue)}\n allowNegative={sign != null ? false : allowNegative}\n decimalSeparator={decimalSeparator}\n thousandSeparator={thousandSeparator}\n decimalScale={decimalScale}\n fixedDecimalScale={fixedDecimalScale}\n prefix={resolvedPrefix}\n suffix={suffix}\n onKeyDown={handleKeyDown}\n {...spinButtonProps}\n {...rest}\n />\n }\n />\n );\n\n if (!isSplitGroup) return input;\n\n return (\n // ButtonGroup collapses the doubled borders and flattens the inner corners, so the three\n // read as one control.\n <ButtonGroup className={cx(styles.split, { [styles.splitInvalid]: !isValid }, className)} style={style}>\n <SplitStepButton\n label={decreaseLabel}\n icon={faMinus}\n disabled={!canDecrease}\n direction={-1}\n {...stepperProps}\n />\n {input}\n <SplitStepButton\n label={increaseLabel}\n icon={faPlus}\n disabled={!canIncrease}\n direction={1}\n {...stepperProps}\n />\n </ButtonGroup>\n );\n}\n\nexport default NumberInput;\n"],"mappings":"4rBA8BA,SAAS,EAAgB,CAAE,QAAO,WAAU,YAAW,UAAS,UAA2B,CACzF,MAAO,CAGL,SAAU,GACV,WACA,aAAc,EAKd,cAAgB,GAAuC,CACjD,EAAE,SAAW,GAAK,EAAE,cAAgB,UACxC,EAAE,eAAe,EACjB,EAAQ,EAAW,EAAE,SAAW,GAAK,CAAC,EACxC,EACA,YAAa,EACb,gBAAiB,EACjB,cAAgB,GAA4B,EAAE,eAAe,CAC/D,CACF,CAGA,SAAS,EAAkB,EAAsC,CAC/D,OACE,EAAC,SAAD,CAAQ,KAAK,SAAS,GAAI,EAAgB,CAAK,EAAG,UAAW,EAAO,kBAClE,EAAC,EAAD,CAAiB,KAAM,EAAM,KAAM,cAAY,MAAQ,CAAA,CACjD,CAAA,CAEZ,CAGA,SAAS,EAAgB,EAAsC,CAC7D,GAAM,CAAE,WAAU,GAAG,GAAa,EAAgB,CAAK,EACvD,OACE,EAAC,EAAD,CACE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EJ,CAAA,EAKH,OAFK,EAKH,EAAC,EAAD,CAAa,UAAW,EAAG,EAAO,MAAO,EAAG,EAAO,cAAe,CAAC,CAAQ,EAAG,CAAS,EAAU,iBAAjG,CACE,EAAC,EAAD,CACE,MAAO,EACP,KAAM,GACN,SAAU,CAAC,EACX,UAAW,GACX,GAAI,CACL,CAAA,EACA,EACD,EAAC,EAAD,CACE,MAAO,EACP,KAAM,EACN,SAAU,CAAC,EACX,UAAW,EACX,GAAI,CACL,CAAA,CACU,IArBW,CAuB5B"}
@@ -1,2 +1,2 @@
1
- var e={numberInput:`numberInput_7p2O3`,arrows:`arrows_yjRlc`,arrowBtn:`arrowBtn_DbJoa`};export{e as default};
1
+ var e={"numberInput-split":`numberInput-split_1kFLr`,numberInputSplit:`numberInput-split_1kFLr`,arrowSuffix:`arrowSuffix_QECPG`,arrows:`arrows_yjRlc`,arrowBtn:`arrowBtn_DbJoa`,split:`split_FYvfQ`,splitBtn:`splitBtn_MquuB`,"split-invalid":`split-invalid_F94dA`,splitInvalid:`split-invalid_F94dA`};export{e as default};
2
2
  //# sourceMappingURL=numberInput.module.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"numberInput.module.mjs","names":[],"sources":["../../../../package/common/numberInput/numberInput.module.pcss"],"sourcesContent":[".numberInput {}\n\n.arrows {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n border-left: 1px solid var(--border-color);\n margin: 4px 0;\n}\n\n.arrowBtn {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n color: var(--text-dark);\n padding: 0 6px;\n font-size: 0.55rem;\n line-height: 1;\n transition: color 0.15s, background 0.15s;\n\n &:hover {\n color: var(--primary-color);\n background: var(--background-accent-light);\n }\n\n &:active {\n color: var(--primary-lighter);\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"numberInput.module.mjs","names":[],"sources":["../../../../package/common/numberInput/numberInput.module.pcss"],"sourcesContent":[".numberInput {\n /* Only set when the split layout wraps this input in a flex row. */\n &-split {\n flex: 1;\n min-width: 0;\n }\n}\n\n/* ── Stacked layout: chevrons inside the field's right edge (mouse-oriented) ───────── */\n\n/* Input's `suffix` slot: stretch to the field so the chevrons get its full height. */\n.arrowSuffix {\n align-self: stretch;\n display: flex;\n padding-right: 0;\n}\n\n.arrows {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n border-left: 1px solid var(--border-color);\n /* Sitting flush against the field's edge, the chevrons' background would square off its\n rounded corner, so it is clipped. Read from --group-radius-* like Input's own border, so it\n still flattens inside a ButtonGroup. */\n overflow: hidden;\n border-top-right-radius: var(--group-radius-tr, var(--default-border-radius));\n border-bottom-right-radius: var(--group-radius-br, var(--default-border-radius));\n}\n\n.arrowBtn {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n padding: 0 0.5em;\n /* No min-height: the two halves divide the field's own height, so a stepper never makes a\n NumberInput taller than a plain Input. In em, so it tracks the field's text size. */\n min-width: 1.75em;\n font-size: 0.75em;\n line-height: 1;\n color: var(--text-dark);\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n /* So a long press reads as a hold, not a text gesture. */\n touch-action: manipulation;\n user-select: none;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n transition: color 0.15s, background 0.15s, opacity 0.15s;\n\n &:disabled {\n cursor: default;\n opacity: 0.35;\n }\n\n &:focus-visible {\n outline: 2px solid var(--focus-border-color, var(--primary-color));\n outline-offset: -2px;\n }\n\n /* (hover: hover) only — on touch a :hover state latches after a tap until you tap elsewhere. */\n @media (hover: hover) {\n &:hover:not(:disabled) {\n color: var(--primary-color);\n background: var(--background-accent-light);\n }\n }\n\n &:active:not(:disabled) {\n color: var(--primary-color);\n }\n}\n\n/* ── Split layout: full-height − / + flanking the field (touch-oriented) ───────────── */\n\n/* ButtonGroup is inline-flex; a form field fills its row instead, with the Input taking the\n slack (see .numberInput-split). The class is repeated to beat `.buttonGroup`'s own `display`\n without depending on which CSS module the bundler emits first. */\n.split.split {\n display: flex;\n width: 100%;\n}\n\n.splitBtn {\n /* Set through Button's own theme hooks: custom properties cascade, so no specificity fight.\n Same surface and border as the field, so the three read as one control.\n\n Resting state only, deliberately — Button has no :hover or :active anywhere, and press\n feedback across the library is the Ripple. */\n --button-default-background: var(--input-background);\n --button-default-color: var(--text-dark);\n --button-default-border: 1px solid var(--border-color);\n\n flex: 0 0 auto;\n /* No fixed height — ButtonGroup stretches these to the field.\n\n The width repeats Input's own height formula (`line-height: 1.25` plus the 8px/6px padding\n of `.input-field-default`) to come out square at any text size, and must follow it if that\n padding changes. `aspect-ratio: 1` cannot do this: a flex item's main size is resolved from\n its content before the stretched cross size exists. */\n align-self: stretch;\n width: calc(1.25em + 14px);\n touch-action: manipulation;\n user-select: none;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n transition: opacity 0.15s;\n\n &:disabled {\n opacity: 0.35;\n }\n\n &:focus-visible {\n outline: 2px solid var(--focus-border-color, var(--primary-color));\n outline-offset: 2px;\n }\n}\n\n/* One continuous border, so the buttons follow the field's focus and error colours — left grey,\n the group reads as a box inside a box. */\n.split:focus-within .splitBtn {\n --button-default-border: 1px solid var(--focus-border-color, var(--primary-color));\n}\n\n.split-invalid .splitBtn {\n --button-default-border: 1px solid var(--error-border-color);\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{useCallback as e,useEffect as t,useRef as n}from"react";var r=400,i=120,a=50,o=1e3;function s(s){let c=n(null),l=n(null),u=n(s);u.current=s;let d=n(null),f=e(()=>{if(c.current!==null&&(clearTimeout(c.current),c.current=null),l.current!==null&&(clearInterval(l.current),l.current=null),typeof window>`u`)return;let{onEndEvent:e}=d.current;window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`pointermove`,e),window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)},[]);d.current={stop:f,onEndEvent:e=>{e.type===`pointermove`&&e.buttons!==0||e.type===`visibilitychange`&&!document.hidden||d.current.stop()}};let p=e((e,t)=>{f();let{onEndEvent:n}=d.current;window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n),window.addEventListener(`pointermove`,n),window.addEventListener(`blur`,n),document.addEventListener(`visibilitychange`,n);let s=()=>{u.current(e*t)||f()};s(),c.current=setTimeout(()=>{c.current=null;let e=Date.now(),t=!1,n=()=>{s(),l.current!==null&&!t&&Date.now()-e>=o&&(t=!0,l.current!==null&&clearInterval(l.current),l.current=setInterval(n,a))};l.current=setInterval(n,i)},r)},[f]);return t(()=>f,[f]),{start:p,stop:f}}export{s as default};
2
+ //# sourceMappingURL=useStepRepeat.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStepRepeat.mjs","names":[],"sources":["../../../../package/common/numberInput/useStepRepeat.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\n/** Time a button must be held before the value starts repeating. */\nconst INITIAL_DELAY_MS = 400;\n/** Interval between repeats right after the hold kicks in. */\nconst SLOW_INTERVAL_MS = 120;\n/** Interval the repeat accelerates to once the hold has been going a while. */\nconst FAST_INTERVAL_MS = 50;\n/** How long the slow phase lasts before switching to `FAST_INTERVAL_MS`. */\nconst ACCELERATE_AFTER_MS = 1000;\n\nexport interface UseStepRepeatResult {\n /** Fires one step immediately, then starts the hold-to-repeat timer. */\n start: (direction: 1 | -1, multiplier: number) => void;\n /** Cancels a running repeat. Safe to call when nothing is running. */\n stop: () => void;\n}\n\n/**\n * Hold-to-repeat for the stepper buttons: one step on press, then an accelerating repeat.\n *\n * The release is watched on `window` rather than by capturing the pointer, which would retarget\n * the following click past the node Button's ripple listens on. Capture would have guaranteed a\n * `pointerup`, so the extra listeners cover the ways a press can end without one.\n *\n * `onStep` returns whether anything changed; `false` ends the repeat, so a hold at a bound stops.\n */\nexport function useStepRepeat(onStep: (delta: number) => boolean): UseStepRepeatResult {\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n // Read at repeat time, so a repeat always steps from the latest value.\n const onStepRef = useRef(onStep);\n onStepRef.current = onStep;\n\n // One stable reference to attach and detach with; `stop` and `onEndEvent` also refer to each\n // other, so both go through the ref.\n const handlersRef = useRef<{ stop: () => void; onEndEvent: (e: Event) => void }>(null!);\n\n const stop = useCallback(() => {\n if (timeoutRef.current !== null) { clearTimeout(timeoutRef.current); timeoutRef.current = null; }\n if (intervalRef.current !== null) { clearInterval(intervalRef.current); intervalRef.current = null; }\n if (typeof window === 'undefined') return;\n const { onEndEvent } = handlersRef.current;\n window.removeEventListener('pointerup', onEndEvent);\n window.removeEventListener('pointercancel', onEndEvent);\n window.removeEventListener('pointermove', onEndEvent);\n window.removeEventListener('blur', onEndEvent);\n document.removeEventListener('visibilitychange', onEndEvent);\n }, []);\n\n handlersRef.current = {\n stop,\n onEndEvent: (e: Event) => {\n // A move ends the hold only if nothing is pressed — how a mouse released outside the\n // window reports itself on re-entry.\n if (e.type === 'pointermove' && (e as PointerEvent).buttons !== 0) return;\n if (e.type === 'visibilitychange' && !document.hidden) return;\n handlersRef.current.stop();\n },\n };\n\n const start = useCallback((direction: 1 | -1, multiplier: number) => {\n stop();\n const { onEndEvent } = handlersRef.current;\n window.addEventListener('pointerup', onEndEvent);\n window.addEventListener('pointercancel', onEndEvent);\n window.addEventListener('pointermove', onEndEvent);\n window.addEventListener('blur', onEndEvent);\n document.addEventListener('visibilitychange', onEndEvent);\n\n const fire = () => { if (!onStepRef.current(direction * multiplier)) stop(); };\n fire();\n\n timeoutRef.current = setTimeout(() => {\n timeoutRef.current = null;\n const startedAt = Date.now();\n let isFast = false;\n const tick = () => {\n fire();\n if (intervalRef.current === null) return;\n if (!isFast && Date.now() - startedAt >= ACCELERATE_AFTER_MS) {\n isFast = true;\n if (intervalRef.current !== null) clearInterval(intervalRef.current);\n intervalRef.current = setInterval(tick, FAST_INTERVAL_MS);\n }\n };\n intervalRef.current = setInterval(tick,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,EAAK,EAEL,EAAW,QAAU,eAAiB,CACpC,EAAW,QAAU,KACrB,IAAM,EAAY,KAAK,IAAI,EACvB,EAAS,GACP,MAAa,CACjB,EAAK,EACD,EAAY,UAAY,MACxB,CAAC,GAAU,KAAK,IAAI,EAAI,GAAa,IACvC,EAAS,GACL,EAAY,UAAY,MAAM,cAAc,EAAY,OAAO,EACnE,EAAY,QAAU,YAAY,EAAM,CAAgB,EAE5D,EACA,EAAY,QAAU,YAAY,EAAM,CAAgB,CAC1D,EAAG,CAAgB,CACrB,EAAG,CAAC,CAAI,CAAC,EAIT,OAFA,MAAgB,EAAM,CAAC,CAAI,CAAC,EAErB,CAAE,QAAO,MAAK,CACvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"otpInput.types.mjs","names":[],"sources":["../../../../package/common/otpInput/otpInput.types.ts"],"sourcesContent":["import type React from 'react';\nimport type { FormValidator } from 'services/formValidation';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport type OtpInputSlots = 'root' | 'label' | 'inputs' | 'input' | 'separator';\n\nexport enum OtpInputCharset {\n /** Digits only (0-9). Shows a numeric mobile keyboard. */\n Numeric = 'numeric',\n /** Letters and digits. */\n Alphanumeric = 'alphanumeric',\n}\n\nexport interface OtpInputProps extends HtmlProps {\n /** Number of character boxes. Default 6. */\n length?: number;\n /** Current code as a plain string, e.g. \"123456\". */\n value?: string;\n /** Fired on every change with the full current code (may be shorter than `length`). */\n onChange?: ((value: string) => void) | null;\n /** Fired once, when the code reaches `length` characters. */\n onComplete?: ((value: string) => void) | null;\n formValidator?: FormValidator | null;\n\n /** Restricts which characters can be typed and picks the mobile keyboard. Default `numeric`. */\n charset?: OtpInputCharset;\n /** Render each box's value as a dot, like a password field. */\n masked?: boolean;\n /** Draw a small gap after these 1-based box indices, e.g. `[3]` to split 6 boxes into 3+3. */\n groupAfter?: number[];\n\n label?: string;\n isValid?: boolean;\n /** Shown in an error Tooltip on focus/hover once `isValid` is `false` (or, with a\n * `formValidator`, once it's touched and has an error). Persists until the value changes\n * `isValid`/`formValidator`'s error state itself — see `clearOnError` to auto-dismiss it. */\n errorMessage?: string;\n isRequired?: boolean;\n /** When an error newly appears (`isValid`/`formValidator` turning invalid), clear every box and\n * refocus the first one after `clearErrorDelay`, so the next attempt starts clean instead of the\n * user editing individual wrong digits (and re-triggering `onComplete` on every keystroke while\n * the code stays at full length). Default `false`. */\n clearOnError?: boolean;\n /** Delay in ms before `clearOnError` clears the boxes, so the wrong code and error message are\n * still visible for a moment first. Default `900`. */\n clearErrorDelay?: number;\n disabled?: boolean;\n /** Focuses the first empty box (or the first box) on mount. */\n autoFocus?: boolean;\n\n className?: string;\n style?: React.CSSProperties;\n classNames?: SlotClassNames<OtpInputSlots>;\n styles?: SlotStyles<OtpInputSlots>;\n}\n"],"mappings":"AAMA,IAAY,EAAL,SAAA,EAAA,OAEL,GAAA,QAAA,UAEA,EAAA,aAAA,gBACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"otpInput.types.mjs","names":[],"sources":["../../../../package/common/otpInput/otpInput.types.ts"],"sourcesContent":["import type React from 'react';\nimport type { FormValidator } from 'services/formValidation';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport type OtpInputSlots = 'root' | 'label' | 'inputs' | 'input' | 'separator';\n\nexport enum OtpInputCharset {\n /** Digits only (0-9). Shows a numeric mobile keyboard. */\n Numeric = 'numeric',\n /** Letters and digits. */\n Alphanumeric = 'alphanumeric',\n}\n\nexport interface OtpInputProps extends Omit<HtmlProps, 'onChange'> {\n /** Number of character boxes. Default 6. */\n length?: number;\n /** Current code as a plain string, e.g. \"123456\". */\n value?: string;\n /** Fired on every change with the full current code (may be shorter than `length`). */\n onChange?: ((value: string) => void) | null;\n /** Fired once, when the code reaches `length` characters. */\n onComplete?: ((value: string) => void) | null;\n formValidator?: FormValidator | null;\n\n /** Restricts which characters can be typed and picks the mobile keyboard. Default `numeric`. */\n charset?: OtpInputCharset;\n /** Render each box's value as a dot, like a password field. */\n masked?: boolean;\n /** Draw a small gap after these 1-based box indices, e.g. `[3]` to split 6 boxes into 3+3. */\n groupAfter?: number[];\n\n label?: string;\n isValid?: boolean;\n /** Shown in an error Tooltip on focus/hover once `isValid` is `false` (or, with a\n * `formValidator`, once it's touched and has an error). Persists until the value changes\n * `isValid`/`formValidator`'s error state itself — see `clearOnError` to auto-dismiss it. */\n errorMessage?: string;\n isRequired?: boolean;\n /** When an error newly appears (`isValid`/`formValidator` turning invalid), clear every box and\n * refocus the first one after `clearErrorDelay`, so the next attempt starts clean instead of the\n * user editing individual wrong digits (and re-triggering `onComplete` on every keystroke while\n * the code stays at full length). Default `false`. */\n clearOnError?: boolean;\n /** Delay in ms before `clearOnError` clears the boxes, so the wrong code and error message are\n * still visible for a moment first. Default `900`. */\n clearErrorDelay?: number;\n disabled?: boolean;\n /** Focuses the first empty box (or the first box) on mount. */\n autoFocus?: boolean;\n\n className?: string;\n style?: React.CSSProperties;\n classNames?: SlotClassNames<OtpInputSlots>;\n styles?: SlotStyles<OtpInputSlots>;\n}\n"],"mappings":"AAMA,IAAY,EAAL,SAAA,EAAA,OAEL,GAAA,QAAA,UAEA,EAAA,aAAA,gBACF,EAAA,CAAA,CAAA"}