@seeqdev/qomponents 0.0.111 → 0.0.113

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 (201) hide show
  1. package/dist/Accordion/Accordion.js +9 -0
  2. package/dist/Accordion/Accordion.js.map +1 -0
  3. package/dist/Accordion/Accordion.stories.js +115 -0
  4. package/dist/Accordion/Accordion.stories.js.map +1 -0
  5. package/dist/Accordion/Accordion.test.js +55 -0
  6. package/dist/Accordion/Accordion.test.js.map +1 -0
  7. package/dist/Accordion/Accordion.types.js +2 -0
  8. package/dist/Accordion/Accordion.types.js.map +1 -0
  9. package/dist/Accordion/index.js +2 -0
  10. package/dist/Accordion/index.js.map +1 -0
  11. package/dist/Alert/Alert.js +32 -0
  12. package/dist/Alert/Alert.js.map +1 -0
  13. package/dist/Alert/Alert.stories.js +45 -0
  14. package/dist/Alert/Alert.stories.js.map +1 -0
  15. package/dist/Alert/Alert.test.js +51 -0
  16. package/dist/Alert/Alert.test.js.map +1 -0
  17. package/dist/Alert/Alert.types.js +2 -0
  18. package/dist/Alert/Alert.types.js.map +1 -0
  19. package/dist/Alert/index.js +2 -0
  20. package/dist/Alert/index.js.map +1 -0
  21. package/dist/Button/Button.js +92 -0
  22. package/dist/Button/Button.js.map +1 -0
  23. package/dist/Button/Button.stories.js +100 -0
  24. package/dist/Button/Button.stories.js.map +1 -0
  25. package/dist/Button/Button.test.js +49 -0
  26. package/dist/Button/Button.test.js.map +1 -0
  27. package/dist/Button/Button.types.js +5 -0
  28. package/dist/Button/Button.types.js.map +1 -0
  29. package/dist/Button/index.js +2 -0
  30. package/dist/Button/index.js.map +1 -0
  31. package/dist/ButtonWithDropdown/ButtonWithDropdown.js +67 -0
  32. package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -0
  33. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +98 -0
  34. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +1 -0
  35. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +85 -0
  36. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +1 -0
  37. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +2 -0
  38. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +1 -0
  39. package/dist/ButtonWithDropdown/index.js +2 -0
  40. package/dist/ButtonWithDropdown/index.js.map +1 -0
  41. package/dist/ButtonWithPopover/ButtonWithPopover.js +53 -0
  42. package/dist/ButtonWithPopover/ButtonWithPopover.js.map +1 -0
  43. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +75 -0
  44. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +1 -0
  45. package/dist/ButtonWithPopover/ButtonWithPopover.test.js +82 -0
  46. package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +1 -0
  47. package/dist/ButtonWithPopover/ButtonWithPopover.types.js +2 -0
  48. package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +1 -0
  49. package/dist/ButtonWithPopover/index.js +2 -0
  50. package/dist/ButtonWithPopover/index.js.map +1 -0
  51. package/dist/Checkbox/Checkbox.js +26 -0
  52. package/dist/Checkbox/Checkbox.js.map +1 -0
  53. package/dist/Checkbox/Checkbox.stories.js +34 -0
  54. package/dist/Checkbox/Checkbox.stories.js.map +1 -0
  55. package/dist/Checkbox/Checkbox.test.js +94 -0
  56. package/dist/Checkbox/Checkbox.test.js.map +1 -0
  57. package/dist/Checkbox/Checkbox.types.js +2 -0
  58. package/dist/Checkbox/Checkbox.types.js.map +1 -0
  59. package/dist/Checkbox/index.js +2 -0
  60. package/dist/Checkbox/index.js.map +1 -0
  61. package/dist/Icon/Icon.js +55 -0
  62. package/dist/Icon/Icon.js.map +1 -0
  63. package/dist/Icon/Icon.stories.js +45 -0
  64. package/dist/Icon/Icon.stories.js.map +1 -0
  65. package/dist/Icon/Icon.test.js +55 -0
  66. package/dist/Icon/Icon.test.js.map +1 -0
  67. package/dist/Icon/Icon.types.js +16 -0
  68. package/dist/Icon/Icon.types.js.map +1 -0
  69. package/dist/Icon/index.js +2 -0
  70. package/dist/Icon/index.js.map +1 -0
  71. package/dist/InputGroup/InputGroup.js +31 -0
  72. package/dist/InputGroup/InputGroup.js.map +1 -0
  73. package/dist/InputGroup/InputGroup.stories.js +168 -0
  74. package/dist/InputGroup/InputGroup.stories.js.map +1 -0
  75. package/dist/InputGroup/InputGroup.test.js +43 -0
  76. package/dist/InputGroup/InputGroup.test.js.map +1 -0
  77. package/dist/InputGroup/InputGroup.types.d.ts +1 -1
  78. package/dist/InputGroup/InputGroup.types.js +2 -0
  79. package/dist/InputGroup/InputGroup.types.js.map +1 -0
  80. package/dist/InputGroup/index.d.ts +1 -0
  81. package/dist/InputGroup/index.js +2 -0
  82. package/dist/InputGroup/index.js.map +1 -0
  83. package/dist/Modal/Modal.js +100 -0
  84. package/dist/Modal/Modal.js.map +1 -0
  85. package/dist/Modal/Modal.stories.js +127 -0
  86. package/dist/Modal/Modal.stories.js.map +1 -0
  87. package/dist/Modal/Modal.test.js +108 -0
  88. package/dist/Modal/Modal.test.js.map +1 -0
  89. package/dist/Modal/Modal.types.js +2 -0
  90. package/dist/Modal/Modal.types.js.map +1 -0
  91. package/dist/Modal/index.js +2 -0
  92. package/dist/Modal/index.js.map +1 -0
  93. package/dist/ProgressBar/ProgressBar.types.d.ts +2 -0
  94. package/dist/SeeqActionDropdown/SeeqActionDropdown.js +48 -0
  95. package/dist/SeeqActionDropdown/SeeqActionDropdown.js.map +1 -0
  96. package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +80 -0
  97. package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js.map +1 -0
  98. package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +73 -0
  99. package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js.map +1 -0
  100. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +2 -0
  101. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js.map +1 -0
  102. package/dist/SeeqActionDropdown/index.js +2 -0
  103. package/dist/SeeqActionDropdown/index.js.map +1 -0
  104. package/dist/SeeqActionDropdown/variants.js +23 -0
  105. package/dist/SeeqActionDropdown/variants.js.map +1 -0
  106. package/dist/Select/Select.js +174 -0
  107. package/dist/Select/Select.js.map +1 -0
  108. package/dist/Select/Select.stories.js +80 -0
  109. package/dist/Select/Select.stories.js.map +1 -0
  110. package/dist/Select/Select.test.js +182 -0
  111. package/dist/Select/Select.test.js.map +1 -0
  112. package/dist/Select/Select.types.js +2 -0
  113. package/dist/Select/Select.types.js.map +1 -0
  114. package/dist/Select/index.js +3 -0
  115. package/dist/Select/index.js.map +1 -0
  116. package/dist/Slider/Slider.d.ts +6 -6
  117. package/dist/Slider/Slider.js +5 -5
  118. package/dist/Slider/Slider.js.map +1 -1
  119. package/dist/Slider/Slider.stories.d.ts +5 -5
  120. package/dist/Slider/Slider.test.d.ts +1 -1
  121. package/dist/Slider/Slider.test.js +0 -5
  122. package/dist/Slider/Slider.test.js.map +1 -1
  123. package/dist/Slider/Slider.types.d.ts +16 -13
  124. package/dist/Slider/index.d.ts +1 -1
  125. package/dist/Tabs/Tabs.js +22 -0
  126. package/dist/Tabs/Tabs.js.map +1 -0
  127. package/dist/Tabs/Tabs.stories.js +91 -0
  128. package/dist/Tabs/Tabs.stories.js.map +1 -0
  129. package/dist/Tabs/Tabs.test.js +91 -0
  130. package/dist/Tabs/Tabs.test.js.map +1 -0
  131. package/dist/Tabs/Tabs.types.js +2 -0
  132. package/dist/Tabs/Tabs.types.js.map +1 -0
  133. package/dist/Tabs/index.js +2 -0
  134. package/dist/Tabs/index.js.map +1 -0
  135. package/dist/TextArea/TextArea.js +25 -0
  136. package/dist/TextArea/TextArea.js.map +1 -0
  137. package/dist/TextArea/TextArea.stories.js +46 -0
  138. package/dist/TextArea/TextArea.stories.js.map +1 -0
  139. package/dist/TextArea/TextArea.test.js +68 -0
  140. package/dist/TextArea/TextArea.test.js.map +1 -0
  141. package/dist/TextArea/TextArea.types.js +2 -0
  142. package/dist/TextArea/TextArea.types.js.map +1 -0
  143. package/dist/TextArea/index.js +2 -0
  144. package/dist/TextArea/index.js.map +1 -0
  145. package/dist/TextField/TextField.js +79 -0
  146. package/dist/TextField/TextField.js.map +1 -0
  147. package/dist/TextField/TextField.stories.js +70 -0
  148. package/dist/TextField/TextField.stories.js.map +1 -0
  149. package/dist/TextField/TextField.test.js +39 -0
  150. package/dist/TextField/TextField.test.js.map +1 -0
  151. package/dist/TextField/TextField.types.js +2 -0
  152. package/dist/TextField/TextField.types.js.map +1 -0
  153. package/dist/TextField/index.js +2 -0
  154. package/dist/TextField/index.js.map +1 -0
  155. package/dist/ToolbarButton/ToolbarButton.js +75 -0
  156. package/dist/ToolbarButton/ToolbarButton.js.map +1 -0
  157. package/dist/ToolbarButton/ToolbarButton.stories.js +94 -0
  158. package/dist/ToolbarButton/ToolbarButton.stories.js.map +1 -0
  159. package/dist/ToolbarButton/ToolbarButton.test.js +93 -0
  160. package/dist/ToolbarButton/ToolbarButton.test.js.map +1 -0
  161. package/dist/ToolbarButton/ToolbarButton.types.js +2 -0
  162. package/dist/ToolbarButton/ToolbarButton.types.js.map +1 -0
  163. package/dist/ToolbarButton/index.js +2 -0
  164. package/dist/ToolbarButton/index.js.map +1 -0
  165. package/dist/Tooltip/QTip.stories.js +45 -0
  166. package/dist/Tooltip/QTip.stories.js.map +1 -0
  167. package/dist/Tooltip/QTip.types.js +2 -0
  168. package/dist/Tooltip/QTip.types.js.map +1 -0
  169. package/dist/Tooltip/QTipPerformance.stories.js +30 -0
  170. package/dist/Tooltip/QTipPerformance.stories.js.map +1 -0
  171. package/dist/Tooltip/Qtip.js +168 -0
  172. package/dist/Tooltip/Qtip.js.map +1 -0
  173. package/dist/Tooltip/Tooltip.js +36 -0
  174. package/dist/Tooltip/Tooltip.js.map +1 -0
  175. package/dist/Tooltip/Tooltip.stories.js +32 -0
  176. package/dist/Tooltip/Tooltip.stories.js.map +1 -0
  177. package/dist/Tooltip/Tooltip.types.js +3 -0
  178. package/dist/Tooltip/Tooltip.types.js.map +1 -0
  179. package/dist/Tooltip/TooltipPerformance.stories.js +30 -0
  180. package/dist/Tooltip/TooltipPerformance.stories.js.map +1 -0
  181. package/dist/Tooltip/index.js +3 -0
  182. package/dist/Tooltip/index.js.map +1 -0
  183. package/dist/Tooltip/qTip.utilities.js +11 -0
  184. package/dist/Tooltip/qTip.utilities.js.map +1 -0
  185. package/dist/index.d.ts +2 -0
  186. package/dist/index.esm.js +944 -16
  187. package/dist/index.esm.js.map +1 -1
  188. package/dist/index.js +943 -14
  189. package/dist/index.js.map +1 -1
  190. package/dist/styles.css +53 -6
  191. package/dist/types.js +2 -0
  192. package/dist/types.js.map +1 -0
  193. package/dist/utils/browserId.js +29 -0
  194. package/dist/utils/browserId.js.map +1 -0
  195. package/dist/utils/svg.js +20 -0
  196. package/dist/utils/svg.js.map +1 -0
  197. package/dist/utils/validateStyleDimension.js +14 -0
  198. package/dist/utils/validateStyleDimension.js.map +1 -0
  199. package/dist/utils/validateStyleDimension.test.js +20 -0
  200. package/dist/utils/validateStyleDimension.test.js.map +1 -0
  201. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1097,7 +1097,7 @@ const oppositeAlignmentMap = {
1097
1097
  start: 'end',
1098
1098
  end: 'start'
1099
1099
  };
1100
- function clamp(start, value, end) {
1100
+ function clamp$1(start, value, end) {
1101
1101
  return max$1(start, min$1(value, end));
1102
1102
  }
1103
1103
  function evaluate(value, param) {
@@ -1470,7 +1470,7 @@ const arrow$1 = options => ({
1470
1470
  const min$1$1 = minPadding;
1471
1471
  const max = clientSize - arrowDimensions[length] - maxPadding;
1472
1472
  const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1473
- const offset = clamp(min$1$1, center, max);
1473
+ const offset = clamp$1(min$1$1, center, max);
1474
1474
 
1475
1475
  // If the reference is small enough that the arrow's padding causes it to
1476
1476
  // to point to nothing for an aligned placement, adjust the offset of the
@@ -1810,14 +1810,14 @@ const shift = function (options) {
1810
1810
  const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1811
1811
  const min = mainAxisCoord + overflow[minSide];
1812
1812
  const max = mainAxisCoord - overflow[maxSide];
1813
- mainAxisCoord = clamp(min, mainAxisCoord, max);
1813
+ mainAxisCoord = clamp$1(min, mainAxisCoord, max);
1814
1814
  }
1815
1815
  if (checkCrossAxis) {
1816
1816
  const minSide = crossAxis === 'y' ? 'top' : 'left';
1817
1817
  const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1818
1818
  const min = crossAxisCoord + overflow[minSide];
1819
1819
  const max = crossAxisCoord - overflow[maxSide];
1820
- crossAxisCoord = clamp(min, crossAxisCoord, max);
1820
+ crossAxisCoord = clamp$1(min, crossAxisCoord, max);
1821
1821
  }
1822
1822
  const limitedCoords = limiter.fn({
1823
1823
  ...state,
@@ -3708,7 +3708,7 @@ function assignRef(ref, value) {
3708
3708
  * @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
3709
3709
  * @returns {MutableRefObject}
3710
3710
  */
3711
- function useCallbackRef(initialValue, callback) {
3711
+ function useCallbackRef$1(initialValue, callback) {
3712
3712
  var ref = React.useState(function () { return ({
3713
3713
  // value
3714
3714
  value: initialValue,
@@ -3749,7 +3749,7 @@ var currentValues = new WeakMap();
3749
3749
  * }
3750
3750
  */
3751
3751
  function useMergeRefs(refs, defaultValue) {
3752
- var callbackRef = useCallbackRef(defaultValue || null, function (newValue) {
3752
+ var callbackRef = useCallbackRef$1(defaultValue || null, function (newValue) {
3753
3753
  return refs.forEach(function (ref) { return assignRef(ref, newValue); });
3754
3754
  });
3755
3755
  // handle refs changes - added or removed
@@ -15942,7 +15942,7 @@ const SeeqActionDropdown = ({ seeqActionDropdownItems, trigger, id, extraClassNa
15942
15942
  })))));
15943
15943
  };
15944
15944
 
15945
- const baseClasses = 'tw-flex tw-outline-none tw-rounded-sm tw-w-full tw-relative tw-flex-wrap tw-items-stretch';
15945
+ const baseClasses = 'tw-flex tw-outline-none tw-rounded-sm tw-w-full tw-relative tw-flex-wrap';
15946
15946
  const errorClasses = 'tw-border-sq-danger-color';
15947
15947
  const borderColorClasses = [
15948
15948
  'tw-border-sq-disabled-gray',
@@ -15952,20 +15952,948 @@ const borderColorClasses = [
15952
15952
  'focus:tw-border-sq-color-dark',
15953
15953
  'active:tw-border-sq-color-dark',
15954
15954
  ].join(' ');
15955
- let borderRadius = 'tw-rounded-sm tw-rounded-r-none';
15955
+ const borderRadius = 'tw-rounded-sm tw-rounded-r-none';
15956
15956
  const fieldClasses = 'tw-leading-normal tw-outline-none tw-py-1 tw-px-3' + 'tw-p-1 tw-border-solid tw-border';
15957
15957
  const darkTheme = 'dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text disabled:dark:tw-text-sq-dark-text-lighter';
15958
15958
  const lightTheme = 'tw-text-sq-text-color disabled:tw-text-sq-darkish-gray';
15959
15959
  /**
15960
15960
  * InputGroup.
15961
15961
  */
15962
- const InputGroup = ({ readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, field, ...tooltipProps }) => {
15962
+ const InputGroup = React.forwardRef((props, ref) => {
15963
+ const { readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, field, maxLength, minLength, ...tooltipProps } = props;
15963
15964
  const tooltipData = getQTipData(tooltipProps);
15964
15965
  const appliedClasses = `${baseClasses} ${extraClassNames}`;
15965
15966
  const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${borderRadius} ${showError ? errorClasses : borderColorClasses} `;
15966
- return (React.createElement("div", { id: id, "data-testid": testId, className: appliedClasses },
15967
- field ? (React.createElement("div", { className: `tw-flex tw-flex-1 tw-cursor-pointer active:tw-z-50 ${fieldAppliedClasses}` }, field)) : (React.createElement(TextField, { readonly: readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, extraClassNames: `tw-flex tw-flex-1 tw-rounded-r-none focus:tw-z-30 ${extraClassNames}`, ...tooltipData })),
15968
- append.filter(Boolean).map((item, index) => item.variant === 'button' ? (React.createElement(Button, { key: index, extraClassNames: "tw-ml-[-1px] focus:tw-z-40 focus:tw-border tw-rounded-l-none tw-rounded-r-none last:tw-rounded-r-sm", onClick: item.buttonProps.onClick, variant: item.buttonProps.variant, icon: item.buttonProps.icon, iconColor: item.buttonProps.iconColor, testId: item.buttonProps.testId, disabled: item.buttonProps.disabled, label: item.buttonProps.label, iconStyle: item.buttonProps.iconStyle })) : (React.createElement("div", { key: index, className: `${borderColorClasses} tw-flex tw-items-center tw-justify-center tw-rounded-none tw-ml-[-1px] active:tw-z-30 active:tw-border tw-border last:tw-rounded-r-sm` }, item.element)))));
15967
+ return (React.createElement("div", { id: id, className: appliedClasses },
15968
+ field ? (React.createElement("div", { "data-testid": testId, className: `tw-flex tw-flex-1 tw-cursor-pointer active:tw-z-50 ${fieldAppliedClasses}` }, field)) : (React.createElement(TextField, { testId: testId, readonly: readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, ref: ref, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, maxLength: maxLength, minLength: minLength, extraClassNames: `tw-flex tw-flex-1 tw-w-full tw-rounded-r-none focus:tw-z-30 ${extraClassNames}`, ...tooltipData })),
15969
+ append.filter(Boolean).map((item, index) => item?.variant === 'button' ? (React.createElement(Button, { key: index, extraClassNames: "tw-ml-[-1px] focus:tw-z-40 focus:tw-border tw-rounded-l-none tw-rounded-r-none last:tw-rounded-r-sm", onClick: item.buttonProps.onClick, variant: item.buttonProps.variant, icon: item.buttonProps.icon, iconColor: item.buttonProps.iconColor, testId: item.buttonProps.testId, disabled: item.buttonProps.disabled, label: item.buttonProps.label, iconStyle: item.buttonProps.iconStyle, tooltip: item.buttonProps.tooltip, tooltipOptions: item.buttonProps.tooltipOptions, tooltipTestId: item.buttonProps.tooltipTestId, isHtmlTooltip: item.buttonProps.isHtmlTooltip, type: item.buttonProps.type, iconPosition: item.buttonProps.iconPosition })) : (React.createElement("div", { key: index, className: `${borderColorClasses} tw-flex tw-items-center tw-justify-center tw-rounded-none tw-ml-[-1px] active:tw-z-30 active:tw-border tw-border last:tw-rounded-r-sm` }, item?.element)))));
15970
+ });
15971
+
15972
+ // packages/core/number/src/number.ts
15973
+ function clamp(value, [min, max]) {
15974
+ return Math.min(max, Math.max(min, value));
15975
+ }
15976
+
15977
+ // packages/core/primitive/src/primitive.tsx
15978
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
15979
+ return function handleEvent(event) {
15980
+ originalEventHandler?.(event);
15981
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
15982
+ return ourEventHandler?.(event);
15983
+ }
15984
+ };
15985
+ }
15986
+
15987
+ // packages/react/compose-refs/src/composeRefs.tsx
15988
+ function setRef$1(ref, value) {
15989
+ if (typeof ref === "function") {
15990
+ return ref(value);
15991
+ } else if (ref !== null && ref !== void 0) {
15992
+ ref.current = value;
15993
+ }
15994
+ }
15995
+ function composeRefs$1(...refs) {
15996
+ return (node) => {
15997
+ let hasCleanup = false;
15998
+ const cleanups = refs.map((ref) => {
15999
+ const cleanup = setRef$1(ref, node);
16000
+ if (!hasCleanup && typeof cleanup == "function") {
16001
+ hasCleanup = true;
16002
+ }
16003
+ return cleanup;
16004
+ });
16005
+ if (hasCleanup) {
16006
+ return () => {
16007
+ for (let i = 0; i < cleanups.length; i++) {
16008
+ const cleanup = cleanups[i];
16009
+ if (typeof cleanup == "function") {
16010
+ cleanup();
16011
+ } else {
16012
+ setRef$1(refs[i], null);
16013
+ }
16014
+ }
16015
+ };
16016
+ }
16017
+ };
16018
+ }
16019
+ function useComposedRefs(...refs) {
16020
+ return React__namespace.useCallback(composeRefs$1(...refs), refs);
16021
+ }
16022
+
16023
+ // packages/react/context/src/createContext.tsx
16024
+ function createContextScope$1(scopeName, createContextScopeDeps = []) {
16025
+ let defaultContexts = [];
16026
+ function createContext3(rootComponentName, defaultContext) {
16027
+ const BaseContext = React__namespace.createContext(defaultContext);
16028
+ const index = defaultContexts.length;
16029
+ defaultContexts = [...defaultContexts, defaultContext];
16030
+ const Provider = (props) => {
16031
+ const { scope, children, ...context } = props;
16032
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
16033
+ const value = React__namespace.useMemo(() => context, Object.values(context));
16034
+ return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
16035
+ };
16036
+ Provider.displayName = rootComponentName + "Provider";
16037
+ function useContext2(consumerName, scope) {
16038
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
16039
+ const context = React__namespace.useContext(Context);
16040
+ if (context) return context;
16041
+ if (defaultContext !== void 0) return defaultContext;
16042
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
16043
+ }
16044
+ return [Provider, useContext2];
16045
+ }
16046
+ const createScope = () => {
16047
+ const scopeContexts = defaultContexts.map((defaultContext) => {
16048
+ return React__namespace.createContext(defaultContext);
16049
+ });
16050
+ return function useScope(scope) {
16051
+ const contexts = scope?.[scopeName] || scopeContexts;
16052
+ return React__namespace.useMemo(
16053
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
16054
+ [scope, contexts]
16055
+ );
16056
+ };
16057
+ };
16058
+ createScope.scopeName = scopeName;
16059
+ return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
16060
+ }
16061
+ function composeContextScopes$1(...scopes) {
16062
+ const baseScope = scopes[0];
16063
+ if (scopes.length === 1) return baseScope;
16064
+ const createScope = () => {
16065
+ const scopeHooks = scopes.map((createScope2) => ({
16066
+ useScope: createScope2(),
16067
+ scopeName: createScope2.scopeName
16068
+ }));
16069
+ return function useComposedScopes(overrideScopes) {
16070
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
16071
+ const scopeProps = useScope(overrideScopes);
16072
+ const currentScope = scopeProps[`__scope${scopeName}`];
16073
+ return { ...nextScopes2, ...currentScope };
16074
+ }, {});
16075
+ return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
16076
+ };
16077
+ };
16078
+ createScope.scopeName = baseScope.scopeName;
16079
+ return createScope;
16080
+ }
16081
+
16082
+ // packages/react/use-callback-ref/src/useCallbackRef.tsx
16083
+ function useCallbackRef(callback) {
16084
+ const callbackRef = React__namespace.useRef(callback);
16085
+ React__namespace.useEffect(() => {
16086
+ callbackRef.current = callback;
16087
+ });
16088
+ return React__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
16089
+ }
16090
+
16091
+ // packages/react/use-controllable-state/src/useControllableState.tsx
16092
+ function useControllableState({
16093
+ prop,
16094
+ defaultProp,
16095
+ onChange = () => {
16096
+ }
16097
+ }) {
16098
+ const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
16099
+ const isControlled = prop !== void 0;
16100
+ const value = isControlled ? prop : uncontrolledProp;
16101
+ const handleChange = useCallbackRef(onChange);
16102
+ const setValue = React__namespace.useCallback(
16103
+ (nextValue) => {
16104
+ if (isControlled) {
16105
+ const setter = nextValue;
16106
+ const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
16107
+ if (value2 !== prop) handleChange(value2);
16108
+ } else {
16109
+ setUncontrolledProp(nextValue);
16110
+ }
16111
+ },
16112
+ [isControlled, prop, setUncontrolledProp, handleChange]
16113
+ );
16114
+ return [value, setValue];
16115
+ }
16116
+ function useUncontrolledState({
16117
+ defaultProp,
16118
+ onChange
16119
+ }) {
16120
+ const uncontrolledState = React__namespace.useState(defaultProp);
16121
+ const [value] = uncontrolledState;
16122
+ const prevValueRef = React__namespace.useRef(value);
16123
+ const handleChange = useCallbackRef(onChange);
16124
+ React__namespace.useEffect(() => {
16125
+ if (prevValueRef.current !== value) {
16126
+ handleChange(value);
16127
+ prevValueRef.current = value;
16128
+ }
16129
+ }, [value, prevValueRef, handleChange]);
16130
+ return uncontrolledState;
16131
+ }
16132
+
16133
+ // packages/react/direction/src/Direction.tsx
16134
+ var DirectionContext = React__namespace.createContext(void 0);
16135
+ function useDirection(localDir) {
16136
+ const globalDir = React__namespace.useContext(DirectionContext);
16137
+ return localDir || globalDir || "ltr";
16138
+ }
16139
+
16140
+ // packages/react/use-previous/src/usePrevious.tsx
16141
+ function usePrevious(value) {
16142
+ const ref = React__namespace.useRef({ value, previous: value });
16143
+ return React__namespace.useMemo(() => {
16144
+ if (ref.current.value !== value) {
16145
+ ref.current.previous = ref.current.value;
16146
+ ref.current.value = value;
16147
+ }
16148
+ return ref.current.previous;
16149
+ }, [value]);
16150
+ }
16151
+
16152
+ // packages/react/use-layout-effect/src/useLayoutEffect.tsx
16153
+ var useLayoutEffect2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
16154
+ };
16155
+
16156
+ // packages/react/use-size/src/useSize.tsx
16157
+ function useSize(element) {
16158
+ const [size, setSize] = React__namespace.useState(void 0);
16159
+ useLayoutEffect2(() => {
16160
+ if (element) {
16161
+ setSize({ width: element.offsetWidth, height: element.offsetHeight });
16162
+ const resizeObserver = new ResizeObserver((entries) => {
16163
+ if (!Array.isArray(entries)) {
16164
+ return;
16165
+ }
16166
+ if (!entries.length) {
16167
+ return;
16168
+ }
16169
+ const entry = entries[0];
16170
+ let width;
16171
+ let height;
16172
+ if ("borderBoxSize" in entry) {
16173
+ const borderSizeEntry = entry["borderBoxSize"];
16174
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
16175
+ width = borderSize["inlineSize"];
16176
+ height = borderSize["blockSize"];
16177
+ } else {
16178
+ width = element.offsetWidth;
16179
+ height = element.offsetHeight;
16180
+ }
16181
+ setSize({ width, height });
16182
+ });
16183
+ resizeObserver.observe(element, { box: "border-box" });
16184
+ return () => resizeObserver.unobserve(element);
16185
+ } else {
16186
+ setSize(void 0);
16187
+ }
16188
+ }, [element]);
16189
+ return size;
16190
+ }
16191
+
16192
+ // packages/react/slot/src/Slot.tsx
16193
+ var Slot$1 = React__namespace.forwardRef((props, forwardedRef) => {
16194
+ const { children, ...slotProps } = props;
16195
+ const childrenArray = React__namespace.Children.toArray(children);
16196
+ const slottable = childrenArray.find(isSlottable$1);
16197
+ if (slottable) {
16198
+ const newElement = slottable.props.children;
16199
+ const newChildren = childrenArray.map((child) => {
16200
+ if (child === slottable) {
16201
+ if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
16202
+ return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
16203
+ } else {
16204
+ return child;
16205
+ }
16206
+ });
16207
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone$1, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
16208
+ }
16209
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone$1, { ...slotProps, ref: forwardedRef, children });
16210
+ });
16211
+ Slot$1.displayName = "Slot";
16212
+ var SlotClone$1 = React__namespace.forwardRef((props, forwardedRef) => {
16213
+ const { children, ...slotProps } = props;
16214
+ if (React__namespace.isValidElement(children)) {
16215
+ const childrenRef = getElementRef$1(children);
16216
+ return React__namespace.cloneElement(children, {
16217
+ ...mergeProps$1(slotProps, children.props),
16218
+ // @ts-ignore
16219
+ ref: forwardedRef ? composeRefs$1(forwardedRef, childrenRef) : childrenRef
16220
+ });
16221
+ }
16222
+ return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
16223
+ });
16224
+ SlotClone$1.displayName = "SlotClone";
16225
+ var Slottable$1 = ({ children }) => {
16226
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
16227
+ };
16228
+ function isSlottable$1(child) {
16229
+ return React__namespace.isValidElement(child) && child.type === Slottable$1;
16230
+ }
16231
+ function mergeProps$1(slotProps, childProps) {
16232
+ const overrideProps = { ...childProps };
16233
+ for (const propName in childProps) {
16234
+ const slotPropValue = slotProps[propName];
16235
+ const childPropValue = childProps[propName];
16236
+ const isHandler = /^on[A-Z]/.test(propName);
16237
+ if (isHandler) {
16238
+ if (slotPropValue && childPropValue) {
16239
+ overrideProps[propName] = (...args) => {
16240
+ childPropValue(...args);
16241
+ slotPropValue(...args);
16242
+ };
16243
+ } else if (slotPropValue) {
16244
+ overrideProps[propName] = slotPropValue;
16245
+ }
16246
+ } else if (propName === "style") {
16247
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
16248
+ } else if (propName === "className") {
16249
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
16250
+ }
16251
+ }
16252
+ return { ...slotProps, ...overrideProps };
16253
+ }
16254
+ function getElementRef$1(element) {
16255
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
16256
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
16257
+ if (mayWarn) {
16258
+ return element.ref;
16259
+ }
16260
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
16261
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
16262
+ if (mayWarn) {
16263
+ return element.props.ref;
16264
+ }
16265
+ return element.props.ref || element.ref;
16266
+ }
16267
+
16268
+ // packages/react/primitive/src/Primitive.tsx
16269
+ var NODES$1 = [
16270
+ "a",
16271
+ "button",
16272
+ "div",
16273
+ "form",
16274
+ "h2",
16275
+ "h3",
16276
+ "img",
16277
+ "input",
16278
+ "label",
16279
+ "li",
16280
+ "nav",
16281
+ "ol",
16282
+ "p",
16283
+ "span",
16284
+ "svg",
16285
+ "ul"
16286
+ ];
16287
+ var Primitive$1 = NODES$1.reduce((primitive, node) => {
16288
+ const Node = React__namespace.forwardRef((props, forwardedRef) => {
16289
+ const { asChild, ...primitiveProps } = props;
16290
+ const Comp = asChild ? Slot$1 : node;
16291
+ if (typeof window !== "undefined") {
16292
+ window[Symbol.for("radix-ui")] = true;
16293
+ }
16294
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
16295
+ });
16296
+ Node.displayName = `Primitive.${node}`;
16297
+ return { ...primitive, [node]: Node };
16298
+ }, {});
16299
+
16300
+ function createCollection(name) {
16301
+ const PROVIDER_NAME = name + "CollectionProvider";
16302
+ const [createCollectionContext, createCollectionScope] = createContextScope$1(PROVIDER_NAME);
16303
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
16304
+ PROVIDER_NAME,
16305
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
16306
+ );
16307
+ const CollectionProvider = (props) => {
16308
+ const { scope, children } = props;
16309
+ const ref = React.useRef(null);
16310
+ const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
16311
+ return /* @__PURE__ */ jsxRuntime.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
16312
+ };
16313
+ CollectionProvider.displayName = PROVIDER_NAME;
16314
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
16315
+ const CollectionSlot = React.forwardRef(
16316
+ (props, forwardedRef) => {
16317
+ const { scope, children } = props;
16318
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
16319
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
16320
+ return /* @__PURE__ */ jsxRuntime.jsx(Slot$1, { ref: composedRefs, children });
16321
+ }
16322
+ );
16323
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
16324
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
16325
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
16326
+ const CollectionItemSlot = React.forwardRef(
16327
+ (props, forwardedRef) => {
16328
+ const { scope, children, ...itemData } = props;
16329
+ const ref = React.useRef(null);
16330
+ const composedRefs = useComposedRefs(forwardedRef, ref);
16331
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
16332
+ React.useEffect(() => {
16333
+ context.itemMap.set(ref, { ref, ...itemData });
16334
+ return () => void context.itemMap.delete(ref);
16335
+ });
16336
+ return /* @__PURE__ */ jsxRuntime.jsx(Slot$1, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
16337
+ }
16338
+ );
16339
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
16340
+ function useCollection(scope) {
16341
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
16342
+ const getItems = React.useCallback(() => {
16343
+ const collectionNode = context.collectionRef.current;
16344
+ if (!collectionNode) return [];
16345
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
16346
+ const items = Array.from(context.itemMap.values());
16347
+ const orderedItems = items.sort(
16348
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
16349
+ );
16350
+ return orderedItems;
16351
+ }, [context.collectionRef, context.itemMap]);
16352
+ return getItems;
16353
+ }
16354
+ return [
16355
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
16356
+ useCollection,
16357
+ createCollectionScope
16358
+ ];
16359
+ }
16360
+
16361
+ var PAGE_KEYS = ["PageUp", "PageDown"];
16362
+ var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
16363
+ var BACK_KEYS = {
16364
+ "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
16365
+ "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
16366
+ "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
16367
+ "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
16368
+ };
16369
+ var SLIDER_NAME = "Slider";
16370
+ var [Collection, useCollection, createCollectionScope] = createCollection(SLIDER_NAME);
16371
+ var [createSliderContext, createSliderScope] = createContextScope$1(SLIDER_NAME, [
16372
+ createCollectionScope
16373
+ ]);
16374
+ var [SliderProvider, useSliderContext] = createSliderContext(SLIDER_NAME);
16375
+ var Slider$1 = React__namespace.forwardRef(
16376
+ (props, forwardedRef) => {
16377
+ const {
16378
+ name,
16379
+ min = 0,
16380
+ max = 100,
16381
+ step = 1,
16382
+ orientation = "horizontal",
16383
+ disabled = false,
16384
+ minStepsBetweenThumbs = 0,
16385
+ defaultValue = [min],
16386
+ value,
16387
+ onValueChange = () => {
16388
+ },
16389
+ onValueCommit = () => {
16390
+ },
16391
+ inverted = false,
16392
+ form,
16393
+ ...sliderProps
16394
+ } = props;
16395
+ const thumbRefs = React__namespace.useRef(/* @__PURE__ */ new Set());
16396
+ const valueIndexToChangeRef = React__namespace.useRef(0);
16397
+ const isHorizontal = orientation === "horizontal";
16398
+ const SliderOrientation = isHorizontal ? SliderHorizontal : SliderVertical;
16399
+ const [values = [], setValues] = useControllableState({
16400
+ prop: value,
16401
+ defaultProp: defaultValue,
16402
+ onChange: (value2) => {
16403
+ const thumbs = [...thumbRefs.current];
16404
+ thumbs[valueIndexToChangeRef.current]?.focus();
16405
+ onValueChange(value2);
16406
+ }
16407
+ });
16408
+ const valuesBeforeSlideStartRef = React__namespace.useRef(values);
16409
+ function handleSlideStart(value2) {
16410
+ const closestIndex = getClosestValueIndex(values, value2);
16411
+ updateValues(value2, closestIndex);
16412
+ }
16413
+ function handleSlideMove(value2) {
16414
+ updateValues(value2, valueIndexToChangeRef.current);
16415
+ }
16416
+ function handleSlideEnd() {
16417
+ const prevValue = valuesBeforeSlideStartRef.current[valueIndexToChangeRef.current];
16418
+ const nextValue = values[valueIndexToChangeRef.current];
16419
+ const hasChanged = nextValue !== prevValue;
16420
+ if (hasChanged) onValueCommit(values);
16421
+ }
16422
+ function updateValues(value2, atIndex, { commit } = { commit: false }) {
16423
+ const decimalCount = getDecimalCount(step);
16424
+ const snapToStep = roundValue(Math.round((value2 - min) / step) * step + min, decimalCount);
16425
+ const nextValue = clamp(snapToStep, [min, max]);
16426
+ setValues((prevValues = []) => {
16427
+ const nextValues = getNextSortedValues(prevValues, nextValue, atIndex);
16428
+ if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs * step)) {
16429
+ valueIndexToChangeRef.current = nextValues.indexOf(nextValue);
16430
+ const hasChanged = String(nextValues) !== String(prevValues);
16431
+ if (hasChanged && commit) onValueCommit(nextValues);
16432
+ return hasChanged ? nextValues : prevValues;
16433
+ } else {
16434
+ return prevValues;
16435
+ }
16436
+ });
16437
+ }
16438
+ return /* @__PURE__ */ jsxRuntime.jsx(
16439
+ SliderProvider,
16440
+ {
16441
+ scope: props.__scopeSlider,
16442
+ name,
16443
+ disabled,
16444
+ min,
16445
+ max,
16446
+ valueIndexToChangeRef,
16447
+ thumbs: thumbRefs.current,
16448
+ values,
16449
+ orientation,
16450
+ form,
16451
+ children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Provider, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsxRuntime.jsx(
16452
+ SliderOrientation,
16453
+ {
16454
+ "aria-disabled": disabled,
16455
+ "data-disabled": disabled ? "" : void 0,
16456
+ ...sliderProps,
16457
+ ref: forwardedRef,
16458
+ onPointerDown: composeEventHandlers(sliderProps.onPointerDown, () => {
16459
+ if (!disabled) valuesBeforeSlideStartRef.current = values;
16460
+ }),
16461
+ min,
16462
+ max,
16463
+ inverted,
16464
+ onSlideStart: disabled ? void 0 : handleSlideStart,
16465
+ onSlideMove: disabled ? void 0 : handleSlideMove,
16466
+ onSlideEnd: disabled ? void 0 : handleSlideEnd,
16467
+ onHomeKeyDown: () => !disabled && updateValues(min, 0, { commit: true }),
16468
+ onEndKeyDown: () => !disabled && updateValues(max, values.length - 1, { commit: true }),
16469
+ onStepKeyDown: ({ event, direction: stepDirection }) => {
16470
+ if (!disabled) {
16471
+ const isPageKey = PAGE_KEYS.includes(event.key);
16472
+ const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.includes(event.key);
16473
+ const multiplier = isSkipKey ? 10 : 1;
16474
+ const atIndex = valueIndexToChangeRef.current;
16475
+ const value2 = values[atIndex];
16476
+ const stepInDirection = step * multiplier * stepDirection;
16477
+ updateValues(value2 + stepInDirection, atIndex, { commit: true });
16478
+ }
16479
+ }
16480
+ }
16481
+ ) }) })
16482
+ }
16483
+ );
16484
+ }
16485
+ );
16486
+ Slider$1.displayName = SLIDER_NAME;
16487
+ var [SliderOrientationProvider, useSliderOrientationContext] = createSliderContext(SLIDER_NAME, {
16488
+ startEdge: "left",
16489
+ endEdge: "right",
16490
+ size: "width",
16491
+ direction: 1
16492
+ });
16493
+ var SliderHorizontal = React__namespace.forwardRef(
16494
+ (props, forwardedRef) => {
16495
+ const {
16496
+ min,
16497
+ max,
16498
+ dir,
16499
+ inverted,
16500
+ onSlideStart,
16501
+ onSlideMove,
16502
+ onSlideEnd,
16503
+ onStepKeyDown,
16504
+ ...sliderProps
16505
+ } = props;
16506
+ const [slider, setSlider] = React__namespace.useState(null);
16507
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setSlider(node));
16508
+ const rectRef = React__namespace.useRef(void 0);
16509
+ const direction = useDirection(dir);
16510
+ const isDirectionLTR = direction === "ltr";
16511
+ const isSlidingFromLeft = isDirectionLTR && !inverted || !isDirectionLTR && inverted;
16512
+ function getValueFromPointer(pointerPosition) {
16513
+ const rect = rectRef.current || slider.getBoundingClientRect();
16514
+ const input = [0, rect.width];
16515
+ const output = isSlidingFromLeft ? [min, max] : [max, min];
16516
+ const value = linearScale(input, output);
16517
+ rectRef.current = rect;
16518
+ return value(pointerPosition - rect.left);
16519
+ }
16520
+ return /* @__PURE__ */ jsxRuntime.jsx(
16521
+ SliderOrientationProvider,
16522
+ {
16523
+ scope: props.__scopeSlider,
16524
+ startEdge: isSlidingFromLeft ? "left" : "right",
16525
+ endEdge: isSlidingFromLeft ? "right" : "left",
16526
+ direction: isSlidingFromLeft ? 1 : -1,
16527
+ size: "width",
16528
+ children: /* @__PURE__ */ jsxRuntime.jsx(
16529
+ SliderImpl,
16530
+ {
16531
+ dir: direction,
16532
+ "data-orientation": "horizontal",
16533
+ ...sliderProps,
16534
+ ref: composedRefs,
16535
+ style: {
16536
+ ...sliderProps.style,
16537
+ ["--radix-slider-thumb-transform"]: "translateX(-50%)"
16538
+ },
16539
+ onSlideStart: (event) => {
16540
+ const value = getValueFromPointer(event.clientX);
16541
+ onSlideStart?.(value);
16542
+ },
16543
+ onSlideMove: (event) => {
16544
+ const value = getValueFromPointer(event.clientX);
16545
+ onSlideMove?.(value);
16546
+ },
16547
+ onSlideEnd: () => {
16548
+ rectRef.current = void 0;
16549
+ onSlideEnd?.();
16550
+ },
16551
+ onStepKeyDown: (event) => {
16552
+ const slideDirection = isSlidingFromLeft ? "from-left" : "from-right";
16553
+ const isBackKey = BACK_KEYS[slideDirection].includes(event.key);
16554
+ onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 });
16555
+ }
16556
+ }
16557
+ )
16558
+ }
16559
+ );
16560
+ }
16561
+ );
16562
+ var SliderVertical = React__namespace.forwardRef(
16563
+ (props, forwardedRef) => {
16564
+ const {
16565
+ min,
16566
+ max,
16567
+ inverted,
16568
+ onSlideStart,
16569
+ onSlideMove,
16570
+ onSlideEnd,
16571
+ onStepKeyDown,
16572
+ ...sliderProps
16573
+ } = props;
16574
+ const sliderRef = React__namespace.useRef(null);
16575
+ const ref = useComposedRefs(forwardedRef, sliderRef);
16576
+ const rectRef = React__namespace.useRef(void 0);
16577
+ const isSlidingFromBottom = !inverted;
16578
+ function getValueFromPointer(pointerPosition) {
16579
+ const rect = rectRef.current || sliderRef.current.getBoundingClientRect();
16580
+ const input = [0, rect.height];
16581
+ const output = isSlidingFromBottom ? [max, min] : [min, max];
16582
+ const value = linearScale(input, output);
16583
+ rectRef.current = rect;
16584
+ return value(pointerPosition - rect.top);
16585
+ }
16586
+ return /* @__PURE__ */ jsxRuntime.jsx(
16587
+ SliderOrientationProvider,
16588
+ {
16589
+ scope: props.__scopeSlider,
16590
+ startEdge: isSlidingFromBottom ? "bottom" : "top",
16591
+ endEdge: isSlidingFromBottom ? "top" : "bottom",
16592
+ size: "height",
16593
+ direction: isSlidingFromBottom ? 1 : -1,
16594
+ children: /* @__PURE__ */ jsxRuntime.jsx(
16595
+ SliderImpl,
16596
+ {
16597
+ "data-orientation": "vertical",
16598
+ ...sliderProps,
16599
+ ref,
16600
+ style: {
16601
+ ...sliderProps.style,
16602
+ ["--radix-slider-thumb-transform"]: "translateY(50%)"
16603
+ },
16604
+ onSlideStart: (event) => {
16605
+ const value = getValueFromPointer(event.clientY);
16606
+ onSlideStart?.(value);
16607
+ },
16608
+ onSlideMove: (event) => {
16609
+ const value = getValueFromPointer(event.clientY);
16610
+ onSlideMove?.(value);
16611
+ },
16612
+ onSlideEnd: () => {
16613
+ rectRef.current = void 0;
16614
+ onSlideEnd?.();
16615
+ },
16616
+ onStepKeyDown: (event) => {
16617
+ const slideDirection = isSlidingFromBottom ? "from-bottom" : "from-top";
16618
+ const isBackKey = BACK_KEYS[slideDirection].includes(event.key);
16619
+ onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 });
16620
+ }
16621
+ }
16622
+ )
16623
+ }
16624
+ );
16625
+ }
16626
+ );
16627
+ var SliderImpl = React__namespace.forwardRef(
16628
+ (props, forwardedRef) => {
16629
+ const {
16630
+ __scopeSlider,
16631
+ onSlideStart,
16632
+ onSlideMove,
16633
+ onSlideEnd,
16634
+ onHomeKeyDown,
16635
+ onEndKeyDown,
16636
+ onStepKeyDown,
16637
+ ...sliderProps
16638
+ } = props;
16639
+ const context = useSliderContext(SLIDER_NAME, __scopeSlider);
16640
+ return /* @__PURE__ */ jsxRuntime.jsx(
16641
+ Primitive$1.span,
16642
+ {
16643
+ ...sliderProps,
16644
+ ref: forwardedRef,
16645
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
16646
+ if (event.key === "Home") {
16647
+ onHomeKeyDown(event);
16648
+ event.preventDefault();
16649
+ } else if (event.key === "End") {
16650
+ onEndKeyDown(event);
16651
+ event.preventDefault();
16652
+ } else if (PAGE_KEYS.concat(ARROW_KEYS).includes(event.key)) {
16653
+ onStepKeyDown(event);
16654
+ event.preventDefault();
16655
+ }
16656
+ }),
16657
+ onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
16658
+ const target = event.target;
16659
+ target.setPointerCapture(event.pointerId);
16660
+ event.preventDefault();
16661
+ if (context.thumbs.has(target)) {
16662
+ target.focus();
16663
+ } else {
16664
+ onSlideStart(event);
16665
+ }
16666
+ }),
16667
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
16668
+ const target = event.target;
16669
+ if (target.hasPointerCapture(event.pointerId)) onSlideMove(event);
16670
+ }),
16671
+ onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
16672
+ const target = event.target;
16673
+ if (target.hasPointerCapture(event.pointerId)) {
16674
+ target.releasePointerCapture(event.pointerId);
16675
+ onSlideEnd(event);
16676
+ }
16677
+ })
16678
+ }
16679
+ );
16680
+ }
16681
+ );
16682
+ var TRACK_NAME = "SliderTrack";
16683
+ var SliderTrack = React__namespace.forwardRef(
16684
+ (props, forwardedRef) => {
16685
+ const { __scopeSlider, ...trackProps } = props;
16686
+ const context = useSliderContext(TRACK_NAME, __scopeSlider);
16687
+ return /* @__PURE__ */ jsxRuntime.jsx(
16688
+ Primitive$1.span,
16689
+ {
16690
+ "data-disabled": context.disabled ? "" : void 0,
16691
+ "data-orientation": context.orientation,
16692
+ ...trackProps,
16693
+ ref: forwardedRef
16694
+ }
16695
+ );
16696
+ }
16697
+ );
16698
+ SliderTrack.displayName = TRACK_NAME;
16699
+ var RANGE_NAME = "SliderRange";
16700
+ var SliderRange = React__namespace.forwardRef(
16701
+ (props, forwardedRef) => {
16702
+ const { __scopeSlider, ...rangeProps } = props;
16703
+ const context = useSliderContext(RANGE_NAME, __scopeSlider);
16704
+ const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider);
16705
+ const ref = React__namespace.useRef(null);
16706
+ const composedRefs = useComposedRefs(forwardedRef, ref);
16707
+ const valuesCount = context.values.length;
16708
+ const percentages = context.values.map(
16709
+ (value) => convertValueToPercentage(value, context.min, context.max)
16710
+ );
16711
+ const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
16712
+ const offsetEnd = 100 - Math.max(...percentages);
16713
+ return /* @__PURE__ */ jsxRuntime.jsx(
16714
+ Primitive$1.span,
16715
+ {
16716
+ "data-orientation": context.orientation,
16717
+ "data-disabled": context.disabled ? "" : void 0,
16718
+ ...rangeProps,
16719
+ ref: composedRefs,
16720
+ style: {
16721
+ ...props.style,
16722
+ [orientation.startEdge]: offsetStart + "%",
16723
+ [orientation.endEdge]: offsetEnd + "%"
16724
+ }
16725
+ }
16726
+ );
16727
+ }
16728
+ );
16729
+ SliderRange.displayName = RANGE_NAME;
16730
+ var THUMB_NAME = "SliderThumb";
16731
+ var SliderThumb = React__namespace.forwardRef(
16732
+ (props, forwardedRef) => {
16733
+ const getItems = useCollection(props.__scopeSlider);
16734
+ const [thumb, setThumb] = React__namespace.useState(null);
16735
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
16736
+ const index = React__namespace.useMemo(
16737
+ () => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1,
16738
+ [getItems, thumb]
16739
+ );
16740
+ return /* @__PURE__ */ jsxRuntime.jsx(SliderThumbImpl, { ...props, ref: composedRefs, index });
16741
+ }
16742
+ );
16743
+ var SliderThumbImpl = React__namespace.forwardRef(
16744
+ (props, forwardedRef) => {
16745
+ const { __scopeSlider, index, name, ...thumbProps } = props;
16746
+ const context = useSliderContext(THUMB_NAME, __scopeSlider);
16747
+ const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider);
16748
+ const [thumb, setThumb] = React__namespace.useState(null);
16749
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
16750
+ const isFormControl = thumb ? context.form || !!thumb.closest("form") : true;
16751
+ const size = useSize(thumb);
16752
+ const value = context.values[index];
16753
+ const percent = value === void 0 ? 0 : convertValueToPercentage(value, context.min, context.max);
16754
+ const label = getLabel(index, context.values.length);
16755
+ const orientationSize = size?.[orientation.size];
16756
+ const thumbInBoundsOffset = orientationSize ? getThumbInBoundsOffset(orientationSize, percent, orientation.direction) : 0;
16757
+ React__namespace.useEffect(() => {
16758
+ if (thumb) {
16759
+ context.thumbs.add(thumb);
16760
+ return () => {
16761
+ context.thumbs.delete(thumb);
16762
+ };
16763
+ }
16764
+ }, [thumb, context.thumbs]);
16765
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16766
+ "span",
16767
+ {
16768
+ style: {
16769
+ transform: "var(--radix-slider-thumb-transform)",
16770
+ position: "absolute",
16771
+ [orientation.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`
16772
+ },
16773
+ children: [
16774
+ /* @__PURE__ */ jsxRuntime.jsx(Collection.ItemSlot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsxRuntime.jsx(
16775
+ Primitive$1.span,
16776
+ {
16777
+ role: "slider",
16778
+ "aria-label": props["aria-label"] || label,
16779
+ "aria-valuemin": context.min,
16780
+ "aria-valuenow": value,
16781
+ "aria-valuemax": context.max,
16782
+ "aria-orientation": context.orientation,
16783
+ "data-orientation": context.orientation,
16784
+ "data-disabled": context.disabled ? "" : void 0,
16785
+ tabIndex: context.disabled ? void 0 : 0,
16786
+ ...thumbProps,
16787
+ ref: composedRefs,
16788
+ style: value === void 0 ? { display: "none" } : props.style,
16789
+ onFocus: composeEventHandlers(props.onFocus, () => {
16790
+ context.valueIndexToChangeRef.current = index;
16791
+ })
16792
+ }
16793
+ ) }),
16794
+ isFormControl && /* @__PURE__ */ jsxRuntime.jsx(
16795
+ BubbleInput,
16796
+ {
16797
+ name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
16798
+ form: context.form,
16799
+ value
16800
+ },
16801
+ index
16802
+ )
16803
+ ]
16804
+ }
16805
+ );
16806
+ }
16807
+ );
16808
+ SliderThumb.displayName = THUMB_NAME;
16809
+ var BubbleInput = (props) => {
16810
+ const { value, ...inputProps } = props;
16811
+ const ref = React__namespace.useRef(null);
16812
+ const prevValue = usePrevious(value);
16813
+ React__namespace.useEffect(() => {
16814
+ const input = ref.current;
16815
+ const inputProto = window.HTMLInputElement.prototype;
16816
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "value");
16817
+ const setValue = descriptor.set;
16818
+ if (prevValue !== value && setValue) {
16819
+ const event = new Event("input", { bubbles: true });
16820
+ setValue.call(input, value);
16821
+ input.dispatchEvent(event);
16822
+ }
16823
+ }, [prevValue, value]);
16824
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { style: { display: "none" }, ...inputProps, ref, defaultValue: value });
16825
+ };
16826
+ function getNextSortedValues(prevValues = [], nextValue, atIndex) {
16827
+ const nextValues = [...prevValues];
16828
+ nextValues[atIndex] = nextValue;
16829
+ return nextValues.sort((a, b) => a - b);
16830
+ }
16831
+ function convertValueToPercentage(value, min, max) {
16832
+ const maxSteps = max - min;
16833
+ const percentPerStep = 100 / maxSteps;
16834
+ const percentage = percentPerStep * (value - min);
16835
+ return clamp(percentage, [0, 100]);
16836
+ }
16837
+ function getLabel(index, totalValues) {
16838
+ if (totalValues > 2) {
16839
+ return `Value ${index + 1} of ${totalValues}`;
16840
+ } else if (totalValues === 2) {
16841
+ return ["Minimum", "Maximum"][index];
16842
+ } else {
16843
+ return void 0;
16844
+ }
16845
+ }
16846
+ function getClosestValueIndex(values, nextValue) {
16847
+ if (values.length === 1) return 0;
16848
+ const distances = values.map((value) => Math.abs(value - nextValue));
16849
+ const closestDistance = Math.min(...distances);
16850
+ return distances.indexOf(closestDistance);
16851
+ }
16852
+ function getThumbInBoundsOffset(width, left, direction) {
16853
+ const halfWidth = width / 2;
16854
+ const halfPercent = 50;
16855
+ const offset = linearScale([0, halfPercent], [0, halfWidth]);
16856
+ return (halfWidth - offset(left) * direction) * direction;
16857
+ }
16858
+ function getStepsBetweenValues(values) {
16859
+ return values.slice(0, -1).map((value, index) => values[index + 1] - value);
16860
+ }
16861
+ function hasMinStepsBetweenValues(values, minStepsBetweenValues) {
16862
+ if (minStepsBetweenValues > 0) {
16863
+ const stepsBetweenValues = getStepsBetweenValues(values);
16864
+ const actualMinStepsBetweenValues = Math.min(...stepsBetweenValues);
16865
+ return actualMinStepsBetweenValues >= minStepsBetweenValues;
16866
+ }
16867
+ return true;
16868
+ }
16869
+ function linearScale(input, output) {
16870
+ return (value) => {
16871
+ if (input[0] === input[1] || output[0] === output[1]) return output[0];
16872
+ const ratio = (output[1] - output[0]) / (input[1] - input[0]);
16873
+ return output[0] + ratio * (value - input[0]);
16874
+ };
16875
+ }
16876
+ function getDecimalCount(value) {
16877
+ return (String(value).split(".")[1] || "").length;
16878
+ }
16879
+ function roundValue(value, decimalCount) {
16880
+ const rounder = Math.pow(10, decimalCount);
16881
+ return Math.round(value * rounder) / rounder;
16882
+ }
16883
+ var Root$1 = Slider$1;
16884
+ var Track = SliderTrack;
16885
+ var Range = SliderRange;
16886
+ var Thumb = SliderThumb;
16887
+
16888
+ /**
16889
+ * Slider .
16890
+ */
16891
+ const Slider = (props) => {
16892
+ const { onValueChange, onPointerUp, id, value, name, disabled = false, rootExtraClassNames = '', trackExtraClassNames = '', rangeExtraClassNames = '', thumbExtraClassNames = '', step, min, max, } = props;
16893
+ return (React.createElement(Root$1, { className: `tw-relative tw-flex tw-h-5 tw-w-full tw-touch-none tw-select-none tw-items-center ${rootExtraClassNames}`, defaultValue: [value], value: [value], onValueChange: (value) => onValueChange && onValueChange(value), onPointerUp: (e) => onPointerUp && onPointerUp(e), name: name, id: id, max: max, min: min, disabled: disabled, step: step },
16894
+ React.createElement(Track, { className: `tw-relative tw-h-[5px] tw-grow tw-rounded-[4px] tw-bg-sq-dark-gray dark:tw-bg-sq-dark-disabled-gray ${trackExtraClassNames}` },
16895
+ React.createElement(Range, { className: `tw-absolute tw-h-full tw-rounded-full ${rangeExtraClassNames}` })),
16896
+ React.createElement(Thumb, { className: `tw-block tw-h-[15px] tw-w-[15px] tw-rounded-full tw-bg-sq-color-dark active:tw-bg-sq-color-dark-dark focus:outline-none focus-visible:tw-outline-none aria-disabled:tw-bg-sq-dark-gray dark:aria-disabled:tw-bg-sq-dark-disabled-gray tw-transition tw-ease-in-out ${thumbExtraClassNames}`, "aria-disabled": disabled })));
15969
16897
  };
15970
16898
 
15971
16899
  // packages/react/context/src/createContext.tsx
@@ -16255,14 +17183,14 @@ Defaulting to \`null\`.`;
16255
17183
  var Root = Progress;
16256
17184
  var Indicator = ProgressIndicator;
16257
17185
 
16258
- const ProgressBar = ({ value, max = 100, label, extraClasses }) => {
17186
+ const ProgressBar = ({ value, max = 100, label, extraClasses, testId }) => {
16259
17187
  const tooltipData = getQTipData({ tooltip: label });
16260
17188
  const [progress, setProgress] = React.useState(0);
16261
17189
  React.useEffect(() => {
16262
17190
  const timer = setTimeout(() => setProgress(value), 500);
16263
17191
  return () => clearTimeout(timer);
16264
17192
  }, []);
16265
- return (React.createElement("span", { ...tooltipData },
17193
+ return (React.createElement("span", { "data-testid": testId, ...tooltipData },
16266
17194
  React.createElement(Root, { className: "tw-relative tw-h-[18px] tw-w-full tw-overflow-hidden tw-rounded-[2.5px] tw-bg-sq-dark-gray dark:tw-bg-sq-dark-disabled-gray", max: max, value: value },
16267
17195
  React.createElement(Indicator, { className: `tw-ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw-h-full tw-bg-sq-color-dark tw-transition-transform tw-duration-[660ms] ${extraClasses}`, style: { transform: `translateX(-${100 - progress}%)` } }))));
16268
17196
  };
@@ -16281,6 +17209,7 @@ exports.QTip = QTip;
16281
17209
  exports.SeeqActionDropdown = SeeqActionDropdown;
16282
17210
  exports.Select = Select;
16283
17211
  exports.SelectCompoents = components;
17212
+ exports.Slider = Slider;
16284
17213
  exports.Tabs = Tabs;
16285
17214
  exports.TextArea = TextArea;
16286
17215
  exports.TextField = TextField;