@salt-ds/lab 1.0.0-alpha.43 → 1.0.0-alpha.45

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 (107) hide show
  1. package/css/salt-lab.css +46 -87
  2. package/dist-cjs/calendar/Calendar.js +7 -0
  3. package/dist-cjs/calendar/Calendar.js.map +1 -1
  4. package/dist-cjs/calendar/internal/CalendarCarousel.js +1 -1
  5. package/dist-cjs/calendar/internal/CalendarCarousel.js.map +1 -1
  6. package/dist-cjs/calendar/internal/CalendarDay.css.js +1 -1
  7. package/dist-cjs/calendar/internal/CalendarDay.js +5 -1
  8. package/dist-cjs/calendar/internal/CalendarDay.js.map +1 -1
  9. package/dist-cjs/calendar/internal/CalendarMonth.js.map +1 -1
  10. package/dist-cjs/calendar/internal/CalendarNavigation.css.js +1 -1
  11. package/dist-cjs/calendar/internal/CalendarNavigation.js +2 -6
  12. package/dist-cjs/calendar/internal/CalendarNavigation.js.map +1 -1
  13. package/dist-cjs/calendar/internal/useFocusManagement.js +3 -0
  14. package/dist-cjs/calendar/internal/useFocusManagement.js.map +1 -1
  15. package/dist-cjs/calendar/useCalendar.js +30 -2
  16. package/dist-cjs/calendar/useCalendar.js.map +1 -1
  17. package/dist-cjs/calendar/useSelection.js +5 -0
  18. package/dist-cjs/calendar/useSelection.js.map +1 -1
  19. package/dist-cjs/contact-details/ContactPrimaryInfo.js.map +1 -1
  20. package/dist-cjs/contact-details/ContactSecondaryInfo.js.map +1 -1
  21. package/dist-cjs/contact-details/ContactTertiaryInfo.js.map +1 -1
  22. package/dist-cjs/date-input/DateInput.css.js +1 -1
  23. package/dist-cjs/date-input/DateInput.js +196 -49
  24. package/dist-cjs/date-input/DateInput.js.map +1 -1
  25. package/dist-cjs/date-picker/DatePicker.js +164 -0
  26. package/dist-cjs/date-picker/DatePicker.js.map +1 -0
  27. package/dist-cjs/date-picker/DatePickerContext.js +36 -0
  28. package/dist-cjs/date-picker/DatePickerContext.js.map +1 -0
  29. package/dist-cjs/date-picker/DatePickerPanel.css.js +6 -0
  30. package/dist-cjs/date-picker/DatePickerPanel.css.js.map +1 -0
  31. package/dist-cjs/date-picker/DatePickerPanel.js +139 -0
  32. package/dist-cjs/date-picker/DatePickerPanel.js.map +1 -0
  33. package/dist-cjs/index.js +4 -0
  34. package/dist-cjs/index.js.map +1 -1
  35. package/dist-cjs/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
  36. package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
  37. package/dist-cjs/stepper-input/StepperInput.css.js +1 -1
  38. package/dist-cjs/stepper-input/StepperInput.js +25 -74
  39. package/dist-cjs/stepper-input/StepperInput.js.map +1 -1
  40. package/dist-cjs/stepper-input/useStepperInput.js +19 -63
  41. package/dist-cjs/stepper-input/useStepperInput.js.map +1 -1
  42. package/dist-es/calendar/Calendar.js +7 -0
  43. package/dist-es/calendar/Calendar.js.map +1 -1
  44. package/dist-es/calendar/internal/CalendarCarousel.js +1 -1
  45. package/dist-es/calendar/internal/CalendarCarousel.js.map +1 -1
  46. package/dist-es/calendar/internal/CalendarDay.css.js +1 -1
  47. package/dist-es/calendar/internal/CalendarDay.js +5 -1
  48. package/dist-es/calendar/internal/CalendarDay.js.map +1 -1
  49. package/dist-es/calendar/internal/CalendarMonth.js.map +1 -1
  50. package/dist-es/calendar/internal/CalendarNavigation.css.js +1 -1
  51. package/dist-es/calendar/internal/CalendarNavigation.js +3 -7
  52. package/dist-es/calendar/internal/CalendarNavigation.js.map +1 -1
  53. package/dist-es/calendar/internal/useFocusManagement.js +3 -0
  54. package/dist-es/calendar/internal/useFocusManagement.js.map +1 -1
  55. package/dist-es/calendar/useCalendar.js +32 -4
  56. package/dist-es/calendar/useCalendar.js.map +1 -1
  57. package/dist-es/calendar/useSelection.js +4 -1
  58. package/dist-es/calendar/useSelection.js.map +1 -1
  59. package/dist-es/contact-details/ContactPrimaryInfo.js.map +1 -1
  60. package/dist-es/contact-details/ContactSecondaryInfo.js.map +1 -1
  61. package/dist-es/contact-details/ContactTertiaryInfo.js.map +1 -1
  62. package/dist-es/date-input/DateInput.css.js +1 -1
  63. package/dist-es/date-input/DateInput.js +200 -53
  64. package/dist-es/date-input/DateInput.js.map +1 -1
  65. package/dist-es/date-picker/DatePicker.js +160 -0
  66. package/dist-es/date-picker/DatePicker.js.map +1 -0
  67. package/dist-es/date-picker/DatePickerContext.js +31 -0
  68. package/dist-es/date-picker/DatePickerContext.js.map +1 -0
  69. package/dist-es/date-picker/DatePickerPanel.css.js +4 -0
  70. package/dist-es/date-picker/DatePickerPanel.css.js.map +1 -0
  71. package/dist-es/date-picker/DatePickerPanel.js +135 -0
  72. package/dist-es/date-picker/DatePickerPanel.js.map +1 -0
  73. package/dist-es/index.js +2 -1
  74. package/dist-es/index.js.map +1 -1
  75. package/dist-es/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
  76. package/dist-es/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
  77. package/dist-es/stepper-input/StepperInput.css.js +1 -1
  78. package/dist-es/stepper-input/StepperInput.js +27 -76
  79. package/dist-es/stepper-input/StepperInput.js.map +1 -1
  80. package/dist-es/stepper-input/useStepperInput.js +19 -63
  81. package/dist-es/stepper-input/useStepperInput.js.map +1 -1
  82. package/dist-types/calendar/internal/CalendarMonth.d.ts +0 -1
  83. package/dist-types/calendar/useSelection.d.ts +3 -0
  84. package/dist-types/contact-details/ContactPrimaryInfo.d.ts +1 -1
  85. package/dist-types/contact-details/ContactSecondaryInfo.d.ts +1 -1
  86. package/dist-types/contact-details/ContactTertiaryInfo.d.ts +1 -1
  87. package/dist-types/contact-details/types.d.ts +1 -1
  88. package/dist-types/date-input/DateInput.d.ts +21 -7
  89. package/dist-types/date-picker/DatePicker.d.ts +55 -0
  90. package/dist-types/date-picker/DatePickerContext.d.ts +23 -0
  91. package/dist-types/date-picker/DatePickerPanel.d.ts +8 -0
  92. package/dist-types/date-picker/index.d.ts +1 -0
  93. package/dist-types/index.d.ts +1 -0
  94. package/dist-types/stepped-tracker/StepLabel/StepLabel.d.ts +4 -3
  95. package/dist-types/stepper-input/StepperInput.d.ts +43 -12
  96. package/dist-types/stepper-input/useStepperInput.d.ts +7 -288
  97. package/package.json +2 -2
  98. package/dist-cjs/stepper-input/internal/useActivationIndicatorPosition.js +0 -38
  99. package/dist-cjs/stepper-input/internal/useActivationIndicatorPosition.js.map +0 -1
  100. package/dist-cjs/stepper-input/internal/useDynamicAriaLabel.js +0 -76
  101. package/dist-cjs/stepper-input/internal/useDynamicAriaLabel.js.map +0 -1
  102. package/dist-es/stepper-input/internal/useActivationIndicatorPosition.js +0 -34
  103. package/dist-es/stepper-input/internal/useActivationIndicatorPosition.js.map +0 -1
  104. package/dist-es/stepper-input/internal/useDynamicAriaLabel.js +0 -72
  105. package/dist-es/stepper-input/internal/useDynamicAriaLabel.js.map +0 -1
  106. package/dist-types/stepper-input/internal/useActivationIndicatorPosition.d.ts +0 -2
  107. package/dist-types/stepper-input/internal/useDynamicAriaLabel.d.ts +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"useStepperInput.js","sources":["../src/stepper-input/useStepperInput.ts"],"sourcesContent":["import { KeyboardEvent, MouseEvent, MutableRefObject } from \"react\";\nimport { ButtonProps, useControlled, useId } from \"@salt-ds/core\";\nimport { InputLegacyProps as InputProps } from \"../input-legacy\";\nimport { useDynamicAriaLabel } from \"./internal/useDynamicAriaLabel\";\nimport { useSpinner } from \"./internal/useSpinner\";\nimport { StepperInputProps } from \"./StepperInput\";\n\ntype Direction = \"decrement\" | \"increment\";\n\nconst stepperDirection = {\n INCREMENT: \"increment\" as Direction,\n DECREMENT: \"decrement\" as Direction,\n};\n\n// The input should only accept numbers, decimal points, and plus/minus symbols\nconst ACCEPT_INPUT = /^[-+]?[0-9]*\\.?([0-9]+)?/g;\n\nconst callAll =\n (...fns: any[]) =>\n (...args: any[]) =>\n fns.forEach((fn) => fn && fn(...args));\n\nconst toFixedDecimalPlaces = (inputNumber: number, decimalPlaces: number) =>\n inputNumber.toFixed(decimalPlaces);\n\nconst isAllowedNonNumeric = (inputCharacter: number | string) => {\n if (typeof inputCharacter === \"number\") return;\n return (\n (\"-+\".includes(inputCharacter) && inputCharacter.length === 1) ||\n inputCharacter === \"\"\n );\n};\n\nconst toFloat = (inputValue: number | string) => {\n // Plus, minus, and empty characters are treated as 0\n if (isAllowedNonNumeric(inputValue)) return 0;\n return parseFloat(inputValue.toString());\n};\n\nconst santizedInput = (numberString: string) =>\n (numberString.match(ACCEPT_INPUT) || []).join(\"\");\n\nconst getButtonIcon = (type: Direction) =>\n type === stepperDirection.INCREMENT ? \"triangle-up\" : \"triangle-down\";\n\nexport const useStepperInput = (\n props: StepperInputProps,\n inputRef: MutableRefObject<HTMLInputElement | null>\n) => {\n const {\n block = 10,\n decimalPlaces = 0,\n defaultValue = 0,\n liveValue,\n max = Number.MAX_SAFE_INTEGER,\n min = Number.MIN_SAFE_INTEGER,\n onChange,\n step = 1,\n value,\n InputProps: inputPropsProp = {},\n } = props;\n\n const [currentValue, setCurrentValue, isControlled] = useControlled({\n controlled: value,\n default: toFixedDecimalPlaces(defaultValue, decimalPlaces),\n name: \"stepper-input\",\n });\n const inputId = useId(inputPropsProp.id);\n\n const isOutOfRange = () => {\n if (currentValue === undefined) return true;\n return toFloat(currentValue) > max || toFloat(currentValue) < min;\n };\n\n const isAtMax = () => {\n if (currentValue === undefined) return true;\n return toFloat(currentValue) >= max || (max === 0 && currentValue === \"\");\n };\n\n const isAtMin = () => {\n if (currentValue === undefined) return true;\n return toFloat(currentValue) <= min || (min === 0 && currentValue === \"\");\n };\n\n const valuesHaveDiverged = () => {\n if (liveValue === undefined || currentValue === undefined) return false;\n return (\n toFloat(toFixedDecimalPlaces(liveValue, decimalPlaces)) !==\n toFloat(currentValue)\n );\n };\n\n const { setHasAnnounced } = useDynamicAriaLabel(\n \", value out of date\",\n liveValue !== undefined,\n inputRef,\n currentValue,\n valuesHaveDiverged\n );\n\n const decrement = () => {\n if (currentValue === undefined || isAtMin()) return;\n let nextValue = currentValue === \"\" ? -step : toFloat(currentValue) - step;\n\n // Set value to `max` if it's currently out of range\n if (max !== undefined && isOutOfRange()) nextValue = max;\n\n setNextValue(nextValue);\n };\n\n const decrementBlock = () => {\n if (currentValue === undefined || isAtMin()) return;\n let nextValue =\n currentValue === \"\"\n ? block * -step\n : toFloat(currentValue) - step * block;\n\n // Set value to `max` if it's currently out of range\n if (max !== undefined && isOutOfRange()) nextValue = max;\n\n setNextValue(nextValue);\n };\n\n const increment = () => {\n if (currentValue === undefined || isAtMax()) return;\n let nextValue = currentValue === \"\" ? step : toFloat(currentValue) + step;\n\n // Set value to `min` if it's currently out of range\n if (min !== undefined && isOutOfRange()) nextValue = min;\n\n setNextValue(nextValue);\n };\n\n const incrementBlock = () => {\n if (currentValue === undefined || isAtMax()) return;\n let nextValue =\n currentValue === \"\" ? block * step : toFloat(currentValue) + step * block;\n\n // Set value to `min` if it's currently out of range\n if (min !== undefined && isOutOfRange()) nextValue = min;\n\n setNextValue(nextValue);\n };\n\n const setNextValue = (modifiedValue: number) => {\n let nextValue = modifiedValue;\n if (nextValue < min) nextValue = min;\n if (nextValue > max) nextValue = max;\n\n const roundedValue = toFixedDecimalPlaces(nextValue, decimalPlaces);\n if (isNaN(toFloat(roundedValue))) return;\n\n if (!isControlled) {\n setCurrentValue(roundedValue);\n }\n\n if (onChange) {\n onChange(roundedValue);\n }\n };\n\n const { activate: decrementSpinnerBlock, buttonDown: pgDnButtonDown } =\n useSpinner(decrementBlock, isAtMin());\n\n const { activate: decrementSpinner, buttonDown: arrowDownButtonDown } =\n useSpinner(decrement, isAtMin());\n\n const { activate: incrementSpinnerBlock, buttonDown: pgUpButtonDown } =\n useSpinner(incrementBlock, isAtMax());\n\n const { activate: incrementSpinner, buttonDown: arrowUpButtonDown } =\n useSpinner(increment, isAtMax());\n\n const handleInputBlur = () => {\n if (currentValue === undefined) return;\n\n const roundedValue = toFixedDecimalPlaces(\n toFloat(currentValue),\n decimalPlaces\n );\n\n if (\n currentValue !== \"\" &&\n !isAllowedNonNumeric(currentValue) &&\n !isControlled\n ) {\n setCurrentValue(roundedValue);\n }\n\n if (onChange) {\n onChange(roundedValue);\n }\n };\n\n const handleInputFocus = () => {\n setHasAnnounced(false);\n };\n\n const handleInputChange = (event: KeyboardEvent) => {\n const changedValue = (event.currentTarget as HTMLInputElement).value;\n\n if (!isControlled) {\n setCurrentValue(santizedInput(changedValue));\n }\n\n if (onChange) {\n onChange(santizedInput(changedValue));\n }\n };\n\n const handleInputKeyDown = (event: KeyboardEvent) => {\n if ([\"ArrowUp\", \"ArrowDown\"].includes(event.key)) {\n event.preventDefault();\n event.key === \"ArrowUp\" ? incrementSpinner() : decrementSpinner();\n }\n if ([\"PageUp\", \"PageDown\"].includes(event.key)) {\n event.preventDefault();\n event.key === \"PageUp\"\n ? incrementSpinnerBlock()\n : decrementSpinnerBlock();\n }\n };\n\n const handleButtonMouseDown = (\n event: MouseEvent<HTMLButtonElement>,\n type: Direction = stepperDirection.INCREMENT\n ) => {\n if (event.nativeEvent.button !== 0) return;\n type === stepperDirection.INCREMENT\n ? incrementSpinner()\n : decrementSpinner();\n };\n\n const handleButtonMouseUp = () => inputRef.current?.focus();\n\n const refreshCurrentValue = () => {\n const refreshedcurrentValue =\n liveValue !== undefined ? liveValue : defaultValue;\n if (refreshedcurrentValue === undefined) return;\n\n setCurrentValue(\n toFixedDecimalPlaces(toFloat(refreshedcurrentValue), decimalPlaces)\n );\n\n inputRef.current?.focus();\n\n if (onChange) {\n onChange(\n toFixedDecimalPlaces(toFloat(refreshedcurrentValue), decimalPlaces)\n );\n }\n };\n\n const getButtonProps = (\n type: Direction = stepperDirection.INCREMENT,\n buttonPropsProp: ButtonProps = {}\n ) => ({\n \"aria-hidden\": true,\n \"data-testid\": `${type}-button`,\n tabIndex: -1,\n ...buttonPropsProp,\n onMouseDown: callAll(\n (event: MouseEvent<HTMLButtonElement>) =>\n handleButtonMouseDown(event, type),\n buttonPropsProp.onMouseDown\n ),\n onMouseUp: callAll(() => handleButtonMouseUp(), buttonPropsProp.onMouseUp),\n });\n\n const getInputProps = (\n inputProps: InputProps = {}\n ): InputProps | undefined => {\n if (currentValue === undefined) return undefined;\n return {\n ...inputProps,\n inputProps: {\n role: \"spinbutton\",\n \"aria-invalid\": isOutOfRange(),\n \"aria-valuemax\": toFloat(toFixedDecimalPlaces(max, decimalPlaces)),\n \"aria-valuemin\": toFloat(toFixedDecimalPlaces(min, decimalPlaces)),\n \"aria-valuenow\": toFloat(\n toFixedDecimalPlaces(toFloat(currentValue), decimalPlaces)\n ),\n id: inputId,\n ...inputProps.inputProps,\n },\n onBlur: callAll(inputProps.onBlur, handleInputBlur),\n onChange: callAll(inputProps.onChange, handleInputChange),\n onFocus: callAll(inputProps.onFocus, handleInputFocus),\n onKeyDown: callAll(inputProps.onKeyPress, handleInputKeyDown),\n value: String(currentValue),\n };\n };\n\n return {\n decrementButtonDown: arrowDownButtonDown || pgDnButtonDown,\n getButtonIcon,\n getButtonProps,\n getInputProps,\n incrementButtonDown: arrowUpButtonDown || pgUpButtonDown,\n isAtMax,\n isAtMin,\n refreshCurrentValue,\n stepperDirection,\n valuesHaveDiverged,\n };\n};\n"],"names":[],"mappings":";;;;AASA,MAAM,gBAAmB,GAAA;AAAA,EACvB,SAAW,EAAA,WAAA;AAAA,EACX,SAAW,EAAA,WAAA;AACb,CAAA,CAAA;AAGA,MAAM,YAAe,GAAA,2BAAA,CAAA;AAErB,MAAM,OACJ,GAAA,CAAA,GAAI,GACJ,KAAA,CAAA,GAAI,IACF,KAAA,GAAA,CAAI,OAAQ,CAAA,CAAC,EAAO,KAAA,EAAA,IAAM,EAAG,CAAA,GAAG,IAAI,CAAC,CAAA,CAAA;AAEzC,MAAM,uBAAuB,CAAC,WAAA,EAAqB,aACjD,KAAA,WAAA,CAAY,QAAQ,aAAa,CAAA,CAAA;AAEnC,MAAM,mBAAA,GAAsB,CAAC,cAAoC,KAAA;A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AA;AAAA,MACxD,OAAS,EAAA,OAAA,CAAQ,UAAW,CAAA,OAAA,EAAS,gBAAgB,CAAA;AAAA,MACrD,SAAW,EAAA,OAAA,CAAQ,UAAW,CAAA,UAAA,EAAY,kBAAkB,CAAA;AAAA,MAC5D,KAAA,EAAO,OAAO,YAAY,CAAA;AAAA,KAC5B,CAAA;AAAA,GACF,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,qBAAqB,mBAAuB,IAAA,cAAA;AAAA,IAC5C,aAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,IACA,qBAAqB,iBAAqB,IAAA,cAAA;AAAA,IAC1C,OAAA;AAAA,IACA,OAAA;AAAA,IACA,mBAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"useStepperInput.js","sources":["../src/stepper-input/useStepperInput.ts"],"sourcesContent":["import {\n ChangeEvent,\n KeyboardEvent,\n MouseEvent,\n MutableRefObject,\n} from \"react\";\nimport { useControlled, useId, InputProps } from \"@salt-ds/core\";\nimport { useSpinner } from \"./internal/useSpinner\";\nimport { StepperInputProps } from \"./StepperInput\";\n\n// The input should only accept numbers, decimal points, and plus/minus symbols\nconst ACCEPT_INPUT = /^[-+]?[0-9]*\\.?([0-9]+)?/g;\n\nconst callAll =\n (...fns: any[]) =>\n (...args: any[]) =>\n fns.forEach((fn) => fn && fn(...args));\n\nconst toFixedDecimalPlaces = (inputNumber: number, decimalPlaces: number) =>\n inputNumber.toFixed(decimalPlaces);\n\nconst isAllowedNonNumeric = (inputCharacter: number | string) => {\n if (typeof inputCharacter === \"number\") return;\n return (\n (\"-+\".includes(inputCharacter) && inputCharacter.length === 1) ||\n inputCharacter === \"\"\n );\n};\n\nconst toFloat = (inputValue: number | string) => {\n // Plus, minus, and empty characters are treated as 0\n if (isAllowedNonNumeric(inputValue)) return 0;\n return parseFloat(inputValue.toString());\n};\n\nconst sanitizedInput = (numberString: string) =>\n (numberString.match(ACCEPT_INPUT) || []).join(\"\");\n\nexport const useStepperInput = (\n props: StepperInputProps,\n inputRef: MutableRefObject<HTMLInputElement | null>\n) => {\n const {\n block = 10,\n decimalPlaces = 0,\n defaultValue = 0,\n id: idProp,\n max = Number.MAX_SAFE_INTEGER,\n min = Number.MIN_SAFE_INTEGER,\n onChange,\n step = 1,\n value,\n } = props;\n\n const [currentValue, setCurrentValue, isControlled] = useControlled({\n controlled: value,\n default: toFixedDecimalPlaces(defaultValue, decimalPlaces),\n name: \"stepper-input\",\n });\n const inputId = useId(idProp);\n\n const isOutOfRange = () => {\n if (currentValue === undefined) return true;\n return toFloat(currentValue) > max || toFloat(currentValue) < min;\n };\n\n const isAtMax = () => {\n if (currentValue === undefined) return true;\n return toFloat(currentValue) >= max || (max === 0 && currentValue === \"\");\n };\n\n const isAtMin = () => {\n if (currentValue === undefined) return true;\n return toFloat(currentValue) <= min || (min === 0 && currentValue === \"\");\n };\n\n const decrement = () => {\n if (currentValue === undefined || isAtMin()) return;\n let nextValue = currentValue === \"\" ? -step : toFloat(currentValue) - step;\n\n // Set value to `max` if it's currently out of range\n if (max !== undefined && isOutOfRange()) nextValue = max;\n\n setNextValue(nextValue);\n };\n\n const decrementBlock = () => {\n if (currentValue === undefined || isAtMin()) return;\n let nextValue =\n currentValue === \"\"\n ? block * -step\n : toFloat(currentValue) - step * block;\n\n // Set value to `max` if it's currently out of range\n if (max !== undefined && isOutOfRange()) nextValue = max;\n\n setNextValue(nextValue);\n };\n\n const increment = () => {\n if (currentValue === undefined || isAtMax()) return;\n let nextValue = currentValue === \"\" ? step : toFloat(currentValue) + step;\n\n // Set value to `min` if it's currently out of range\n if (min !== undefined && isOutOfRange()) nextValue = min;\n\n setNextValue(nextValue);\n };\n\n const incrementBlock = () => {\n if (currentValue === undefined || isAtMax()) return;\n let nextValue =\n currentValue === \"\" ? block * step : toFloat(currentValue) + step * block;\n\n // Set value to `min` if it's currently out of range\n if (min !== undefined && isOutOfRange()) nextValue = min;\n\n setNextValue(nextValue);\n };\n\n const setNextValue = (modifiedValue: number) => {\n if (props.readOnly) return;\n let nextValue = modifiedValue;\n if (nextValue < min) nextValue = min;\n if (nextValue > max) nextValue = max;\n\n const roundedValue = toFixedDecimalPlaces(nextValue, decimalPlaces);\n if (isNaN(toFloat(roundedValue))) return;\n\n if (!isControlled) {\n setCurrentValue(roundedValue);\n }\n\n if (onChange) {\n onChange(roundedValue);\n }\n };\n\n const { activate: decrementSpinnerBlock, buttonDown: pgDnButtonDown } =\n useSpinner(decrementBlock, isAtMin());\n\n const { activate: decrementSpinner, buttonDown: arrowDownButtonDown } =\n useSpinner(decrement, isAtMin());\n\n const { activate: incrementSpinnerBlock, buttonDown: pgUpButtonDown } =\n useSpinner(incrementBlock, isAtMax());\n\n const { activate: incrementSpinner, buttonDown: arrowUpButtonDown } =\n useSpinner(increment, isAtMax());\n\n const handleInputBlur = () => {\n if (currentValue === undefined) return;\n\n const roundedValue = toFixedDecimalPlaces(\n toFloat(currentValue),\n decimalPlaces\n );\n\n if (\n currentValue !== \"\" &&\n !isAllowedNonNumeric(currentValue) &&\n !isControlled\n ) {\n setCurrentValue(roundedValue);\n }\n\n if (onChange) {\n onChange(roundedValue);\n }\n };\n\n const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n const changedValue = event.target.value;\n\n if (!isControlled) {\n setCurrentValue(sanitizedInput(changedValue));\n }\n\n if (onChange) {\n onChange(sanitizedInput(changedValue));\n }\n };\n\n const handleInputKeyDown = (event: KeyboardEvent) => {\n if ([\"ArrowUp\", \"ArrowDown\"].includes(event.key)) {\n event.preventDefault();\n event.key === \"ArrowUp\" ? incrementSpinner() : decrementSpinner();\n }\n if ([\"PageUp\", \"PageDown\"].includes(event.key)) {\n event.preventDefault();\n event.key === \"PageUp\"\n ? incrementSpinnerBlock()\n : decrementSpinnerBlock();\n }\n };\n\n const handleButtonMouseDown = (\n event: MouseEvent<HTMLButtonElement>,\n direction: string\n ) => {\n if (event.nativeEvent.button !== 0) return;\n direction === \"increment\" ? incrementSpinner() : decrementSpinner();\n };\n\n const handleButtonMouseUp = () => inputRef.current?.focus();\n\n const getButtonProps = (direction: string) => ({\n \"aria-hidden\": true,\n disabled:\n props.disabled || (direction === \"increment\" ? isAtMax() : isAtMin()),\n tabIndex: -1,\n onMouseDown: (event: MouseEvent<HTMLButtonElement>) =>\n handleButtonMouseDown(event, direction),\n onMouseUp: handleButtonMouseUp,\n });\n\n const getInputProps = (\n inputProps: InputProps = {}\n ): InputProps | undefined => {\n if (currentValue === undefined) return undefined;\n return {\n ...inputProps,\n inputProps: {\n role: \"spinbutton\",\n \"aria-invalid\": isOutOfRange(),\n \"aria-valuemax\": toFloat(toFixedDecimalPlaces(max, decimalPlaces)),\n \"aria-valuemin\": toFloat(toFixedDecimalPlaces(min, decimalPlaces)),\n \"aria-valuenow\": toFloat(\n toFixedDecimalPlaces(toFloat(currentValue), decimalPlaces)\n ),\n id: inputId,\n ...inputProps.inputProps,\n },\n onBlur: callAll(inputProps.onBlur, handleInputBlur),\n onChange: callAll(inputProps.onChange, handleInputChange),\n onFocus: inputProps.onFocus,\n onKeyDown: callAll(inputProps.onKeyDown, handleInputKeyDown),\n textAlign: inputProps.textAlign,\n value: String(currentValue),\n };\n };\n\n return {\n decrementButtonDown: arrowDownButtonDown || pgDnButtonDown,\n getButtonProps,\n getInputProps,\n incrementButtonDown: arrowUpButtonDown || pgUpButtonDown,\n };\n};\n"],"names":[],"mappings":";;;AAWA,MAAM,YAAe,GAAA,2BAAA,CAAA;AAErB,MAAM,OACJ,GAAA,CAAA,GAAI,GACJ,KAAA,CAAA,GAAI,IACF,KAAA,GAAA,CAAI,OAAQ,CAAA,CAAC,EAAO,KAAA,EAAA,IAAM,EAAG,CAAA,GAAG,IAAI,CAAC,CAAA,CAAA;AAEzC,MAAM,uBAAuB,CAAC,WAAA,EAAqB,aACjD,KAAA,WAAA,CAAY,QAAQ,aAAa,CAAA,CAAA;AAEnC,MAAM,mBAAA,GAAs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A,MAC3D,WAAW,UAAW,CAAA,SAAA;AAAA,MACtB,KAAA,EAAO,OAAO,YAAY,CAAA;AAAA,KAC5B,CAAA;AAAA,GACF,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,qBAAqB,mBAAuB,IAAA,cAAA;AAAA,IAC5C,cAAA;AAAA,IACA,aAAA;AAAA,IACA,qBAAqB,iBAAqB,IAAA,cAAA;AAAA,GAC5C,CAAA;AACF;;;;"}
@@ -5,7 +5,6 @@ export interface CalendarMonthProps extends ComponentPropsWithRef<"div"> {
5
5
  date: DateValue;
6
6
  hideOutOfRangeDates?: boolean;
7
7
  renderDayContents?: CalendarDayProps["renderDayContents"];
8
- isVisible?: boolean;
9
8
  TooltipProps?: CalendarDayProps["TooltipProps"];
10
9
  }
11
10
  export declare const CalendarMonth: import("react").ForwardRefExoticComponent<Omit<CalendarMonthProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -18,6 +18,7 @@ declare type OffsetSelectionValueType = {
18
18
  startDate?: DateValue;
19
19
  endDate?: DateValue;
20
20
  };
21
+ declare type AllSelectionValueType = SingleSelectionValueType | MultiSelectionValueType | RangeSelectionValueType | OffsetSelectionValueType | null;
21
22
  export interface UseOffsetSelectionCalendarProps extends Omit<BaseUseSelectionCalendarProps<OffsetSelectionValueType>, "startDateOffset" | "endDateOffset"> {
22
23
  selectionVariant: "offset";
23
24
  startDateOffset?: (date: DateValue) => DateValue;
@@ -33,6 +34,8 @@ export interface UseSingleSelectionCalendarProps extends BaseUseSelectionCalenda
33
34
  selectionVariant: "default";
34
35
  }
35
36
  export declare type useSelectionCalendarProps = UseSingleSelectionCalendarProps | UseMultiSelectionCalendarProps | UseRangeSelectionCalendarProps | UseOffsetSelectionCalendarProps;
37
+ export declare function isRangeOrOffsetSelectionValue(selectionValue?: AllSelectionValueType): selectionValue is RangeSelectionValueType | OffsetSelectionValueType;
38
+ export declare function isRangeOrOffsetSelectionWithStartDate(selectionValue?: AllSelectionValueType): selectionValue is RangeSelectionValueType | OffsetSelectionValueType;
36
39
  export declare function useSelectionCalendar(props: useSelectionCalendarProps): {
37
40
  state: {
38
41
  selectedDate: CalendarDate | import("@internationalized/date").CalendarDateTime | import("@internationalized/date").ZonedDateTime | RangeSelectionValueType | OffsetSelectionValueType | MultiSelectionValueType | null | undefined;
@@ -1,5 +1,5 @@
1
1
  import { HTMLAttributes } from "react";
2
- export interface ContactPrimaryInfoProps extends HTMLAttributes<HTMLDivElement> {
2
+ export interface ContactPrimaryInfoProps extends Omit<HTMLAttributes<HTMLDivElement>, "color"> {
3
3
  text: string;
4
4
  }
5
5
  export declare const ContactPrimaryInfo: import("react").ForwardRefExoticComponent<ContactPrimaryInfoProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  import { IconProps } from "@salt-ds/icons";
2
2
  import { ComponentType, HTMLAttributes } from "react";
3
3
  import { ValueComponentProps } from "./types";
4
- export interface ContactSecondaryInfoProps extends HTMLAttributes<HTMLDivElement> {
4
+ export interface ContactSecondaryInfoProps extends Omit<HTMLAttributes<HTMLDivElement>, "color"> {
5
5
  icon?: ComponentType<IconProps>;
6
6
  text: string;
7
7
  ValueComponent?: ComponentType<ValueComponentProps>;
@@ -1,6 +1,6 @@
1
1
  import { IconProps } from "@salt-ds/icons";
2
2
  import { ComponentType, HTMLAttributes } from "react";
3
- export interface ContactTertiaryInfoProps extends HTMLAttributes<HTMLDivElement> {
3
+ export interface ContactTertiaryInfoProps extends Omit<HTMLAttributes<HTMLDivElement>, "color"> {
4
4
  icon?: ComponentType<IconProps>;
5
5
  text: string;
6
6
  }
@@ -1,4 +1,4 @@
1
1
  import { HTMLAttributes } from "react";
2
- export interface ValueComponentProps extends HTMLAttributes<HTMLSpanElement> {
2
+ export interface ValueComponentProps extends Omit<HTMLAttributes<HTMLSpanElement>, "color"> {
3
3
  value?: string;
4
4
  }
@@ -1,18 +1,20 @@
1
- import { ComponentPropsWithoutRef, InputHTMLAttributes, Ref } from "react";
2
- export interface DateInputProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue">, Pick<ComponentPropsWithoutRef<"input">, "disabled" | "value" | "defaultValue" | "placeholder"> {
1
+ import { ComponentPropsWithoutRef, InputHTMLAttributes, ReactNode, RefObject } from "react";
2
+ import { DateValue } from "@internationalized/date";
3
+ export interface DateInputProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue">, Pick<ComponentPropsWithoutRef<"input">, "disabled" | "placeholder"> {
4
+ ariaLabel?: string;
3
5
  /**
4
6
  * The marker to use in an empty read only DateInput.
5
7
  * Use `''` to disable this feature. Defaults to '—'.
6
8
  */
7
9
  emptyReadOnlyMarker?: string;
8
10
  /**
9
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dateInput#Attributes) applied to the `input` elements.
11
+ * End adornment component
10
12
  */
11
- inputProps?: InputHTMLAttributes<HTMLInputElement>;
13
+ endAdornment?: ReactNode;
12
14
  /**
13
- * Optional ref for the dateInput component
15
+ * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dateInput#Attributes) applied to the `input` elements.
14
16
  */
15
- inputRef?: Ref<HTMLInputElement>;
17
+ inputProps?: InputHTMLAttributes<HTMLInputElement>;
16
18
  /**
17
19
  * If `true`, the component is read only.
18
20
  */
@@ -28,6 +30,18 @@ export interface DateInputProps extends Omit<ComponentPropsWithoutRef<"div">, "d
28
30
  /**
29
31
  * Function to format the input value.
30
32
  */
31
- dateFormatter?: (input: string) => string;
33
+ dateFormatter?: (input: DateValue | undefined) => string;
34
+ /**
35
+ * Reference for the startInput;
36
+ */
37
+ startInputRef?: RefObject<HTMLInputElement>;
38
+ /**
39
+ * Reference for the endInput;
40
+ */
41
+ endInputRef?: RefObject<HTMLInputElement>;
42
+ /**
43
+ * Selection variant. Defaults to single select.
44
+ */
45
+ selectionVariant?: "default" | "range";
32
46
  }
33
47
  export declare const DateInput: import("react").ForwardRefExoticComponent<DateInputProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,55 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ import { DateValue } from "@internationalized/date";
3
+ import { CalendarProps } from "../calendar";
4
+ export interface DatePickerProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue">, Pick<ComponentPropsWithoutRef<"input">, "disabled" | "value" | "defaultValue" | "placeholder"> {
5
+ inputAriaLabel?: string;
6
+ /**
7
+ * Selection variant. Defaults to single select.
8
+ */
9
+ selectionVariant?: "default" | "range";
10
+ /**
11
+ * If `true`, the component will be disabled.
12
+ */
13
+ disabled?: boolean;
14
+ /**
15
+ * The selected date value. Use when the component is controlled.
16
+ * Can be a single date or an object with start and end dates for range selection.
17
+ */
18
+ selectedDate?: DateValue | {
19
+ startDate: DateValue;
20
+ endDate: DateValue;
21
+ };
22
+ /**
23
+ * The default date value. Use when the component is not controlled.
24
+ * Can be a single date or an object with start and end dates for range selection.
25
+ */
26
+ defaultSelectedDate?: DateValue | {
27
+ startDate: DateValue;
28
+ endDate: DateValue;
29
+ };
30
+ /**
31
+ * Props to be passed to the Calendar component.
32
+ */
33
+ CalendarProps?: Partial<Omit<CalendarProps, "selectionVariant" | "selectedDate" | "defaultSelectedDate" | "onSelectedDateChange">>;
34
+ /**
35
+ * Function to format the input value.
36
+ */
37
+ dateFormatter?: (input: DateValue | undefined) => string;
38
+ /**
39
+ * Callback function triggered when open state changes.
40
+ */
41
+ onOpenChange?: (newOpen: boolean) => void;
42
+ /**
43
+ * Display or hide the component.
44
+ */
45
+ open?: boolean;
46
+ /**
47
+ * Helper text to display in the panel
48
+ */
49
+ helperText?: string;
50
+ /**
51
+ * If `true`, the component is read only.
52
+ */
53
+ readOnly?: boolean;
54
+ }
55
+ export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,23 @@
1
+ import { UseFloatingUIReturn } from "@salt-ds/core";
2
+ import { DateValue } from "@internationalized/date";
3
+ export interface DatePickerContextValue extends Partial<Pick<UseFloatingUIReturn, "context">> {
4
+ openState: boolean;
5
+ setOpen: (newOpen: boolean) => void;
6
+ disabled: boolean;
7
+ startDate: DateValue | undefined;
8
+ defaultStartDate: DateValue | undefined;
9
+ setStartDate: (newStartDate: DateValue | undefined) => void;
10
+ startVisibleMonth: DateValue | undefined;
11
+ setStartVisibleMonth: (newStartDate: DateValue | undefined) => void;
12
+ endDate: DateValue | undefined;
13
+ endVisibleMonth: DateValue | undefined;
14
+ setEndVisibleMonth: (newStartDate: DateValue | undefined) => void;
15
+ defaultEndDate: DateValue | undefined;
16
+ setEndDate: (newEndDate: DateValue | undefined) => void;
17
+ validationStatusState: "error" | undefined;
18
+ setValidationStatus: (newStatus: "error" | undefined) => void;
19
+ selectionVariant: "default" | "range";
20
+ getPanelPosition: () => Record<string, unknown>;
21
+ }
22
+ export declare const DatePickerContext: import("react").Context<DatePickerContextValue>;
23
+ export declare function useDatePickerContext(): DatePickerContextValue;
@@ -0,0 +1,8 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ import { CalendarProps } from "../calendar";
3
+ export interface DatePickerPanelProps extends ComponentPropsWithoutRef<"div"> {
4
+ onSelect?: () => void;
5
+ helperText?: string;
6
+ CalendarProps?: Partial<Omit<CalendarProps, "selectionVariant" | "selectedDate" | "defaultSelectedDate" | "onSelectedDateChange">>;
7
+ }
8
+ export declare const DatePickerPanel: import("react").ForwardRefExoticComponent<DatePickerPanelProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ export * from "./DatePicker";
@@ -13,6 +13,7 @@ export * from "./combo-box-deprecated";
13
13
  export * from "./contact-details";
14
14
  export * from "./content-status";
15
15
  export * from "./date-input";
16
+ export * from "./date-picker";
16
17
  export * from "./deck-item";
17
18
  export * from "./deck-layout";
18
19
  export * from "./dropdown";
@@ -1,8 +1,9 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
- export interface StepLabelProps extends ComponentPropsWithoutRef<"label"> {
1
+ import { ReactNode } from "react";
2
+ import { TextProps } from "@salt-ds/core";
3
+ export interface StepLabelProps extends TextProps<"label"> {
3
4
  /**
4
5
  * The content of Step Label
5
6
  */
6
7
  children?: ReactNode;
7
8
  }
8
- export declare const StepLabel: import("react").ForwardRefExoticComponent<StepLabelProps & import("react").RefAttributes<HTMLLabelElement>>;
9
+ export declare const StepLabel: import("react").ForwardRefExoticComponent<Omit<StepLabelProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
@@ -1,22 +1,53 @@
1
- import React from "react";
2
- import { ButtonProps } from "@salt-ds/core";
3
- import { InputLegacyProps as InputProps } from "../input-legacy";
4
- export interface StepperInputProps {
5
- ButtonProps?: Partial<ButtonProps>;
6
- InputProps?: Partial<InputProps>;
1
+ import { FocusEventHandler } from "react";
2
+ import { InputProps } from "@salt-ds/core";
3
+ export interface StepperInputProps extends Omit<InputProps, "onChange" | "emptyReadOnlyMarker"> {
4
+ /**
5
+ * A multiplier applied to the `step` when the value is incremented or decremented using the PageDown/PageUp keys.
6
+ */
7
7
  block?: number;
8
- className?: string;
8
+ /**
9
+ * The number of decimal places to display.
10
+ */
9
11
  decimalPlaces?: number;
12
+ /**
13
+ * Sets the initial default value of the component.
14
+ */
10
15
  defaultValue?: number;
11
- liveValue?: number;
16
+ /**
17
+ * The maximum value that can be selected.
18
+ */
12
19
  max?: number;
20
+ /**
21
+ * The minimum value that can be selected.
22
+ */
13
23
  min?: number;
14
- onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
15
- onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void;
24
+ /**
25
+ * Whether to hide the stepper buttons. Defaults to `false`.
26
+ */
27
+ hideButtons?: boolean;
28
+ /**
29
+ * Callback when stepper input loses focus.
30
+ */
31
+ onBlur?: FocusEventHandler<HTMLInputElement>;
32
+ /**
33
+ * Callback when stepper input value is changed.
34
+ */
16
35
  onChange?: (changedValue: number | string) => void;
17
- showRefreshButton?: boolean;
36
+ /**
37
+ * Callback when stepper input gains focus.
38
+ */
39
+ onFocus?: FocusEventHandler<HTMLInputElement>;
40
+ /**
41
+ * The amount to increment or decrement the value by when using the stepper buttons or Up Arrow and Down Arrow keys.
42
+ */
18
43
  step?: number;
44
+ /**
45
+ * Determines the text alignment of the display value.
46
+ */
19
47
  textAlign?: "center" | "left" | "right";
48
+ /**
49
+ * The value of the stepper input. The component will be controlled if this prop is provided.
50
+ */
20
51
  value?: number | string;
21
52
  }
22
- export declare const StepperInput: React.ForwardRefExoticComponent<StepperInputProps & React.RefAttributes<HTMLDivElement>>;
53
+ export declare const StepperInput: import("react").ForwardRefExoticComponent<StepperInputProps & import("react").RefAttributes<HTMLDivElement>>;