@janbox/storefront-ui 1.0.0 → 1.0.2

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 (238) hide show
  1. package/dist/hooks/index.d.ts +2 -0
  2. package/dist/hooks/index.d.ts.map +1 -1
  3. package/dist/hooks/index.js +4 -0
  4. package/dist/hooks/use-controllable-state.js +2 -2
  5. package/dist/hooks/use-countdown-timer.js +1 -1
  6. package/dist/hooks/use-first-mount-state/index.d.ts +2 -0
  7. package/dist/hooks/use-first-mount-state/index.d.ts.map +1 -0
  8. package/dist/hooks/use-first-mount-state/index.js +12 -0
  9. package/dist/hooks/use-update-effect/index.d.ts +3 -0
  10. package/dist/hooks/use-update-effect/index.d.ts.map +1 -0
  11. package/dist/hooks/use-update-effect/index.js +13 -0
  12. package/dist/lib/accordion/accordion/accordion.d.ts +2 -1
  13. package/dist/lib/accordion/accordion/accordion.d.ts.map +1 -1
  14. package/dist/lib/accordion/accordion/accordion.js +15 -6
  15. package/dist/lib/accordion/accordion/types.d.ts +2 -2
  16. package/dist/lib/accordion/accordion/types.d.ts.map +1 -1
  17. package/dist/lib/date-picker/date-picker.d.ts.map +1 -1
  18. package/dist/lib/date-picker/date-picker.js +1 -2
  19. package/dist/lib/input-range/index.d.ts +1 -0
  20. package/dist/lib/input-range/index.d.ts.map +1 -1
  21. package/dist/lib/input-range/types.d.ts +3 -4
  22. package/dist/lib/input-range/types.d.ts.map +1 -1
  23. package/dist/node_modules/.pnpm/react-use@17.6.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-use/esm/misc/isDeepEqual.js +5 -0
  24. package/dist/node_modules/.pnpm/react-use@17.6.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-use/esm/useCustomCompareEffect.js +25 -0
  25. package/dist/node_modules/.pnpm/react-use@17.6.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-use/esm/useDeepCompareEffect.js +19 -0
  26. package/dist/node_modules/.pnpm/react-use@17.6.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-use/esm/useFirstMountState.js +12 -0
  27. package/dist/node_modules/.pnpm/react-use@17.6.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-use/esm/useUpdateEffect.js +13 -0
  28. package/dist/style.css +579 -0
  29. package/package.json +1 -14
  30. package/dist/HOCs/index.cjs +0 -4
  31. package/dist/HOCs/with-query-fallback.cjs +0 -16
  32. package/dist/assets/json/countries.json.cjs +0 -1159
  33. package/dist/assets/svg/arrow-down.svg.cjs +0 -3
  34. package/dist/assets/svg/arrow-forward.svg.cjs +0 -3
  35. package/dist/assets/svg/arrow-left.svg.cjs +0 -3
  36. package/dist/assets/svg/arrow-right.svg.cjs +0 -3
  37. package/dist/assets/svg/calendar.svg.cjs +0 -3
  38. package/dist/assets/svg/check.svg.cjs +0 -3
  39. package/dist/assets/svg/clock-time.svg.cjs +0 -3
  40. package/dist/assets/svg/done-check.svg.cjs +0 -3
  41. package/dist/assets/svg/earth-home-world.svg.cjs +0 -3
  42. package/dist/assets/svg/eye-hidden.svg.cjs +0 -3
  43. package/dist/assets/svg/eye-show-visible.svg.cjs +0 -3
  44. package/dist/assets/svg/image-placeholder.svg.cjs +0 -3
  45. package/dist/assets/svg/loading-waiting.svg.cjs +0 -3
  46. package/dist/assets/svg/long-arrow-right.svg.cjs +0 -3
  47. package/dist/assets/svg/minus.svg.cjs +0 -3
  48. package/dist/assets/svg/plus.svg.cjs +0 -3
  49. package/dist/assets/svg/search-add-plus-middle.svg.cjs +0 -3
  50. package/dist/assets/svg/search-minus.svg.cjs +0 -3
  51. package/dist/assets/svg/times-close-delete.svg.cjs +0 -3
  52. package/dist/components/index.cjs +0 -8
  53. package/dist/components/scroll-view.cjs +0 -19
  54. package/dist/components/svg-loader.cjs +0 -14
  55. package/dist/components/virtualized-list.cjs +0 -43
  56. package/dist/constants/index.cjs +0 -32
  57. package/dist/hooks/index.cjs +0 -14
  58. package/dist/hooks/use-controllable-state.cjs +0 -39
  59. package/dist/hooks/use-countdown-timer.cjs +0 -85
  60. package/dist/hooks/use-hover-line-effect/index.cjs +0 -24
  61. package/dist/hooks/use-hover-line-effect/use-hover-line-effect.module.scss.cjs +0 -8
  62. package/dist/hooks/use-query-params.cjs +0 -53
  63. package/dist/hooks/use-ripple-effect/index.cjs +0 -69
  64. package/dist/hooks/use-ripple-effect/use-ripple-effect.module.scss.cjs +0 -11
  65. package/dist/hooks/use-window-screen/index.cjs +0 -52
  66. package/dist/index.cjs +0 -305
  67. package/dist/lib/accordion/accordion/accordion.cjs +0 -109
  68. package/dist/lib/accordion/accordion/helpers.cjs +0 -21
  69. package/dist/lib/accordion/accordion/types.cjs +0 -7
  70. package/dist/lib/accordion/accordion-content/accordion-content.cjs +0 -41
  71. package/dist/lib/accordion/accordion-content/helpers.cjs +0 -8
  72. package/dist/lib/accordion/accordion-group/accordion-group.cjs +0 -56
  73. package/dist/lib/accordion/accordion-group/helpers.cjs +0 -20
  74. package/dist/lib/accordion/accordion-group/types.cjs +0 -7
  75. package/dist/lib/accordion/accordion-summary/accordion-summary.cjs +0 -64
  76. package/dist/lib/accordion/accordion-summary/helpers.cjs +0 -15
  77. package/dist/lib/accordion/accordion-summary/types.cjs +0 -8
  78. package/dist/lib/badge/badge.cjs +0 -42
  79. package/dist/lib/badge/helpers.cjs +0 -8
  80. package/dist/lib/box/box.cjs +0 -55
  81. package/dist/lib/box/helpers.cjs +0 -8
  82. package/dist/lib/breadcrumbs/breadcrumb-item/breadcrumb-item.cjs +0 -28
  83. package/dist/lib/breadcrumbs/breadcrumbs/breadcrumbs.cjs +0 -44
  84. package/dist/lib/button/button.cjs +0 -235
  85. package/dist/lib/button/helpers.cjs +0 -74
  86. package/dist/lib/cascader/cascader.cjs +0 -497
  87. package/dist/lib/cascader/helpers.cjs +0 -28
  88. package/dist/lib/checkbox/checkbox.cjs +0 -52
  89. package/dist/lib/checkbox/checkbox.module.scss.cjs +0 -23
  90. package/dist/lib/chip/chip.cjs +0 -60
  91. package/dist/lib/chip/helpers.cjs +0 -14
  92. package/dist/lib/collapse/collapse.cjs +0 -50
  93. package/dist/lib/container/container.cjs +0 -101
  94. package/dist/lib/container/helpers.cjs +0 -12
  95. package/dist/lib/count-up/count-up.cjs +0 -38
  96. package/dist/lib/countdown-timer/countdown-timer.cjs +0 -9
  97. package/dist/lib/date-picker/date-picker.cjs +0 -169
  98. package/dist/lib/date-picker/helpers.cjs +0 -12
  99. package/dist/lib/dialog/dialog/dialog.cjs +0 -93
  100. package/dist/lib/dialog/dialog/helpers.cjs +0 -27
  101. package/dist/lib/dialog/dialog-body/dialog-body.cjs +0 -32
  102. package/dist/lib/dialog/dialog-close/dialog-close.cjs +0 -5
  103. package/dist/lib/dialog/dialog-footer/dialog-footer.cjs +0 -31
  104. package/dist/lib/dialog/dialog-header/dialog-header.cjs +0 -73
  105. package/dist/lib/drawer/drawer/drawer.cjs +0 -100
  106. package/dist/lib/drawer/drawer/helpers.cjs +0 -7
  107. package/dist/lib/drawer/drawer-close/drawer-close.cjs +0 -5
  108. package/dist/lib/filter-panel/checkbox-filter-panel.cjs +0 -107
  109. package/dist/lib/filter-panel/filter-panel.cjs +0 -37
  110. package/dist/lib/filter-panel/input-range-filter-panel.cjs +0 -78
  111. package/dist/lib/filter-panel/input-text-filter-panel.cjs +0 -57
  112. package/dist/lib/filter-panel/radio-filter-panel.cjs +0 -95
  113. package/dist/lib/flag/flag.cjs +0 -20
  114. package/dist/lib/flag/helpers.cjs +0 -16
  115. package/dist/lib/flexbox/flex-item/flex-item.cjs +0 -22
  116. package/dist/lib/flexbox/flex-item/helpers.cjs +0 -10
  117. package/dist/lib/flexbox/flexbox/flexbox.cjs +0 -46
  118. package/dist/lib/flexbox/flexbox/helpers.cjs +0 -16
  119. package/dist/lib/floating/floating/floating.cjs +0 -97
  120. package/dist/lib/floating/floating/helpers.cjs +0 -9
  121. package/dist/lib/floating/floating-close/floating-close.cjs +0 -32
  122. package/dist/lib/floating/floating-content/floating-content.cjs +0 -57
  123. package/dist/lib/floating/floating-trigger/floating-trigger.cjs +0 -35
  124. package/dist/lib/form-helper-text/form-helper-text.cjs +0 -35
  125. package/dist/lib/form-label/form-label.cjs +0 -28
  126. package/dist/lib/generic-element/generic-element.cjs +0 -15
  127. package/dist/lib/grid/cell/cell.cjs +0 -28
  128. package/dist/lib/grid/cell/helpers.cjs +0 -8
  129. package/dist/lib/grid/grid/grid.cjs +0 -53
  130. package/dist/lib/grid/grid/helpers.cjs +0 -12
  131. package/dist/lib/highlight-words/highlight-words.cjs +0 -18
  132. package/dist/lib/icon/helpers.cjs +0 -12
  133. package/dist/lib/icon/icon.cjs +0 -38
  134. package/dist/lib/icon-button/helpers.cjs +0 -42
  135. package/dist/lib/icon-button/icon-button.cjs +0 -146
  136. package/dist/lib/image/helpers.cjs +0 -15
  137. package/dist/lib/image/image.cjs +0 -36
  138. package/dist/lib/input/helpers.cjs +0 -38
  139. package/dist/lib/input/input.cjs +0 -205
  140. package/dist/lib/input/input.module.scss.cjs +0 -17
  141. package/dist/lib/input-mask/helpers.cjs +0 -12
  142. package/dist/lib/input-mask/input-mask.cjs +0 -120
  143. package/dist/lib/input-number/input-number.cjs +0 -132
  144. package/dist/lib/input-number/input-number.module.scss.cjs +0 -8
  145. package/dist/lib/input-range/helpers.cjs +0 -12
  146. package/dist/lib/input-range/input-range.cjs +0 -179
  147. package/dist/lib/input-range/input-range.module.scss.cjs +0 -8
  148. package/dist/lib/lightbox/lightbox.cjs +0 -199
  149. package/dist/lib/linear-progress/helpers.cjs +0 -13
  150. package/dist/lib/linear-progress/linear-progress.cjs +0 -75
  151. package/dist/lib/link/helpers.cjs +0 -8
  152. package/dist/lib/link/link.cjs +0 -63
  153. package/dist/lib/loading/block-skeleton/block-skeleton.cjs +0 -21
  154. package/dist/lib/loading/image-skeleton/image-skeleton.cjs +0 -43
  155. package/dist/lib/loading/loading-overlay/loading-overlay.cjs +0 -60
  156. package/dist/lib/loading/text-skeleton/text-skeleton.cjs +0 -16
  157. package/dist/lib/marquee/marquee/helpers.cjs +0 -15
  158. package/dist/lib/marquee/marquee/marquee.cjs +0 -99
  159. package/dist/lib/marquee/marquee/types.cjs +0 -7
  160. package/dist/lib/marquee/marquee-item/marquee-item.cjs +0 -16
  161. package/dist/lib/menu/menu/menu.cjs +0 -38
  162. package/dist/lib/menu/menu-item/helpers.cjs +0 -16
  163. package/dist/lib/menu/menu-item/menu-item.cjs +0 -34
  164. package/dist/lib/menu/menu-list/menu-list.cjs +0 -34
  165. package/dist/lib/menu/menu-list/types.cjs +0 -7
  166. package/dist/lib/menu/menu-trigger/menu-trigger.cjs +0 -8
  167. package/dist/lib/multiple-select/helpers.cjs +0 -12
  168. package/dist/lib/multiple-select/multiple-select.cjs +0 -348
  169. package/dist/lib/nav-link/nav-link.cjs +0 -40
  170. package/dist/lib/notifications/helpers.cjs +0 -39
  171. package/dist/lib/notifications/notifications.cjs +0 -167
  172. package/dist/lib/otp-input/otp-input.cjs +0 -132
  173. package/dist/lib/pagination/helpers.cjs +0 -57
  174. package/dist/lib/pagination/pagination.cjs +0 -163
  175. package/dist/lib/phone-input/phone-input.cjs +0 -182
  176. package/dist/lib/popover/popover/helpers.cjs +0 -7
  177. package/dist/lib/popover/popover/popover.cjs +0 -31
  178. package/dist/lib/popover/popover-close/popover-close.cjs +0 -5
  179. package/dist/lib/popover/popover-content/popover-content.cjs +0 -29
  180. package/dist/lib/popover/popover-trigger/popover-trigger.cjs +0 -8
  181. package/dist/lib/primitive/primitive.cjs +0 -30
  182. package/dist/lib/progress/progress.cjs +0 -50
  183. package/dist/lib/radio-button/helpers.cjs +0 -8
  184. package/dist/lib/radio-button/radio-button.cjs +0 -33
  185. package/dist/lib/radio-button/radio-button.module.scss.cjs +0 -17
  186. package/dist/lib/select/helpers.cjs +0 -12
  187. package/dist/lib/select/select.cjs +0 -317
  188. package/dist/lib/star-rating/star-rating.cjs +0 -39
  189. package/dist/lib/stepper/step.cjs +0 -69
  190. package/dist/lib/stepper/stepper.cjs +0 -86
  191. package/dist/lib/stepper/types.cjs +0 -8
  192. package/dist/lib/swiper/swiper/helpers.cjs +0 -16
  193. package/dist/lib/swiper/swiper/swiper.cjs +0 -113
  194. package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.cjs +0 -77
  195. package/dist/lib/swiper/swiper-slide/swiper-slide.cjs +0 -31
  196. package/dist/lib/switch/switch.cjs +0 -19
  197. package/dist/lib/switch/switch.module.scss.cjs +0 -14
  198. package/dist/lib/table/table/table.cjs +0 -26
  199. package/dist/lib/table/table-body/table-body.cjs +0 -34
  200. package/dist/lib/table/table-cell/table-cell.cjs +0 -12
  201. package/dist/lib/table/table-footer/table-footer.cjs +0 -7
  202. package/dist/lib/table/table-head/table-head.cjs +0 -33
  203. package/dist/lib/table/table-row/table-row.cjs +0 -7
  204. package/dist/lib/tabs/tab/helpers.cjs +0 -9
  205. package/dist/lib/tabs/tab/tab.cjs +0 -26
  206. package/dist/lib/tabs/tab-content/tab-content.cjs +0 -22
  207. package/dist/lib/tabs/tab-indicator/tab-indicator.cjs +0 -92
  208. package/dist/lib/tabs/tab-list/helpers.cjs +0 -8
  209. package/dist/lib/tabs/tab-list/tab-list.cjs +0 -40
  210. package/dist/lib/tabs/tab-panel/helpers.cjs +0 -8
  211. package/dist/lib/tabs/tab-panel/tab-panel.cjs +0 -21
  212. package/dist/lib/tabs/tabs/helpers.cjs +0 -36
  213. package/dist/lib/tabs/tabs/tabs.cjs +0 -62
  214. package/dist/lib/text/helpers.cjs +0 -140
  215. package/dist/lib/text/text.cjs +0 -41
  216. package/dist/lib/textarea/helpers.cjs +0 -12
  217. package/dist/lib/textarea/textarea.cjs +0 -122
  218. package/dist/lib/textarea/textarea.module.scss.cjs +0 -14
  219. package/dist/lib/time-picker/time-picker.cjs +0 -305
  220. package/dist/lib/tooltip/tooltip.cjs +0 -124
  221. package/dist/lib/trans-html/trans-html.cjs +0 -26
  222. package/dist/lib/unordered-list/list-item/helpers.cjs +0 -14
  223. package/dist/lib/unordered-list/list-item/list-item.cjs +0 -36
  224. package/dist/lib/unordered-list/unordered-list/helpers.cjs +0 -14
  225. package/dist/lib/unordered-list/unordered-list/unordered-list.cjs +0 -27
  226. package/dist/lib/video/helpers.cjs +0 -10
  227. package/dist/lib/video/video.cjs +0 -24
  228. package/dist/theme/index.cjs +0 -22
  229. package/dist/theme/palette.cjs +0 -287
  230. package/dist/theme/provider.cjs +0 -303
  231. package/dist/theme/screens.cjs +0 -24
  232. package/dist/theme/typography.cjs +0 -29
  233. package/dist/types/index.cjs +0 -1
  234. package/dist/utils/common.cjs +0 -139
  235. package/dist/utils/emotion-helpers.cjs +0 -145
  236. package/dist/utils/index.cjs +0 -233
  237. package/dist/utils/query-params.cjs +0 -130
  238. package/dist/utils/stylesheet.cjs +0 -5
@@ -1,348 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("react");
5
- const lodashEs = require("lodash-es");
6
- const helpers = require("./helpers.cjs");
7
- const svgLoader = require("../../components/svg-loader.cjs");
8
- const virtualizedList = require("../../components/virtualized-list.cjs");
9
- const index = require("../../hooks/use-window-screen/index.cjs");
10
- const useControllableState = require("../../hooks/use-controllable-state.cjs");
11
- const utils_index = require("../../utils/index.cjs");
12
- const arrowDown = require("../../assets/svg/arrow-down.svg.cjs");
13
- const theme_palette = require("../../theme/palette.cjs");
14
- const theme_typography = require("../../theme/typography.cjs");
15
- const checkbox = require("../checkbox/checkbox.cjs");
16
- const textSkeleton = require("../loading/text-skeleton/text-skeleton.cjs");
17
- const common = require("../../utils/common.cjs");
18
- const floating = require("../floating/floating/floating.cjs");
19
- const floatingTrigger = require("../floating/floating-trigger/floating-trigger.cjs");
20
- const inputMask = require("../input-mask/input-mask.cjs");
21
- const floatingContent = require("../floating/floating-content/floating-content.cjs");
22
- const input = require("../input/input.cjs");
23
- const formHelperText = require("../form-helper-text/form-helper-text.cjs");
24
- const DEFAULT_DISPLAY_ROW_COUNT = 5;
25
- const MultipleSelect = ({ ref, ...props }) => {
26
- var _a, _b, _c, _d, _e;
27
- const {
28
- placement = "bottom-start",
29
- open,
30
- onOpenChange,
31
- searchable = true,
32
- value,
33
- optionValue,
34
- optionLabel,
35
- defaultValue,
36
- options,
37
- onChange,
38
- placeholder,
39
- listProps,
40
- tagLabel,
41
- // selectedRenderer,
42
- optionSearchLabel,
43
- helperText,
44
- error,
45
- containerProps,
46
- inputProps,
47
- displayCount = 1,
48
- ...rest
49
- } = helpers.getMultipleSelectProps(props);
50
- const searchInputRef = react.useRef(null);
51
- const floatingRef = react.useRef(null);
52
- const uniqueId = react.useId();
53
- const windowScreen = index.useWindowScreen();
54
- const [inputValue, setInputValue] = useControllableState.useControllableState({
55
- defaultValue: (inputProps == null ? void 0 : inputProps.defaultValue) ?? "",
56
- value: inputProps == null ? void 0 : inputProps.value
57
- });
58
- const [isOpen, setIsOpen] = useControllableState.useControllableState({
59
- defaultValue: open ?? false,
60
- value: open
61
- });
62
- const prehandleOpenChange = (nextOpen, event, reason) => {
63
- setIsOpen(nextOpen);
64
- onOpenChange == null ? void 0 : onOpenChange(nextOpen, event, reason);
65
- };
66
- const [controllableValues, setControllableValues] = useControllableState.useControllableState({
67
- defaultValue: defaultValue ?? [],
68
- value
69
- });
70
- const getOptionValue = react.useCallback(
71
- (option) => {
72
- return typeof optionValue === "function" ? optionValue(option) : lodashEs.get(option, optionValue ?? "value");
73
- },
74
- [optionValue]
75
- );
76
- const getTagLabel = (option) => {
77
- switch (typeof tagLabel) {
78
- case "function":
79
- return tagLabel(option);
80
- case "string":
81
- return lodashEs.get(option, tagLabel);
82
- default:
83
- return null;
84
- }
85
- };
86
- const getOptionValueRef = react.useRef(getOptionValue);
87
- getOptionValueRef.current = getOptionValue;
88
- const selectedValueMap = react.useMemo(
89
- () => new Map(
90
- controllableValues.map((item) => {
91
- const key = typeof item === "object" ? getOptionValue(item) : item;
92
- return [
93
- key,
94
- typeof item === "object" ? item : options.find((option) => getOptionValue(option) === key) ?? {}
95
- ];
96
- })
97
- ),
98
- [controllableValues]
99
- );
100
- const getOptionLabel = react.useCallback(
101
- (option) => {
102
- return typeof optionLabel === "function" ? optionLabel(option) : lodashEs.get(option, optionLabel ?? "label");
103
- },
104
- [optionLabel]
105
- );
106
- const handleChange = (option, selected) => {
107
- let preset = [...controllableValues];
108
- if (selected) {
109
- preset.push(option);
110
- } else {
111
- preset = preset.filter((item) => getOptionValue(item) !== getOptionValue(option));
112
- }
113
- setControllableValues(preset);
114
- onChange == null ? void 0 : onChange(preset);
115
- };
116
- const responsiveSize = lodashEs.isNil(windowScreen.name) ? void 0 : utils_index.getResponsiveProp(rest, "size", windowScreen.name);
117
- const rowMinHeight = utils_index.getSizeVariantState(responsiveSize).inputSize ?? 0;
118
- const displayOptions = react.useMemo(() => {
119
- if (!inputValue) {
120
- return options;
121
- }
122
- return options.filter((option) => {
123
- let searchLabels = [String(getOptionLabel(option))];
124
- switch (typeof optionSearchLabel) {
125
- case "function":
126
- searchLabels = common.ensureArray(optionSearchLabel(option));
127
- break;
128
- case "string":
129
- searchLabels = common.ensureArray(String(lodashEs.get(option, optionSearchLabel)));
130
- break;
131
- case "object":
132
- searchLabels = optionSearchLabel.map((label) => String(lodashEs.get(option, label)));
133
- break;
134
- }
135
- return common.matchSearch(searchLabels, inputValue);
136
- });
137
- }, [getOptionLabel, inputValue, optionSearchLabel, options]);
138
- const RowComponent = ({ row }) => {
139
- const rowData = displayOptions.at(row.index);
140
- const rowValue = lodashEs.isNil(rowData) ? void 0 : getOptionValue(rowData);
141
- const isSelected = lodashEs.isNil(rowValue) ? false : selectedValueMap.has(rowValue);
142
- const onCheckboxChange = (e) => {
143
- if (lodashEs.isNil(rowData)) return;
144
- handleChange(rowData, e.target.checked);
145
- };
146
- return /* @__PURE__ */ jsxRuntime.jsx(
147
- checkbox.Checkbox,
148
- {
149
- onChange: onCheckboxChange,
150
- checked: isSelected,
151
- containerProps: {
152
- css: {
153
- paddingTop: 2,
154
- paddingBottom: 2,
155
- paddingLeft: 12,
156
- paddingRight: 12,
157
- borderRadius: 8,
158
- ":hover": { backgroundColor: theme_palette.getColorVar("neutral.100") },
159
- minHeight: rowMinHeight,
160
- width: "100%"
161
- }
162
- },
163
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { css: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: lodashEs.isNil(rowData) ? /* @__PURE__ */ jsxRuntime.jsx(textSkeleton.TextSkeleton, { css: { width: "100%" } }) : getOptionLabel(rowData) })
164
- }
165
- );
166
- };
167
- const sizeOptions = {
168
- apply({ elements }) {
169
- const { width } = elements.reference.getBoundingClientRect();
170
- Object.assign(elements.floating.style, {
171
- minWidth: `${width}px`
172
- });
173
- }
174
- };
175
- const estimateSize = react.useCallback(
176
- (_index) => {
177
- return rowMinHeight ?? 0;
178
- },
179
- [rowMinHeight]
180
- );
181
- const getItemKey = react.useCallback(
182
- (index2) => {
183
- const option = displayOptions.at(index2);
184
- return option ? getOptionValue(option).toString() : `${uniqueId}-${index2}`;
185
- },
186
- [displayOptions, getOptionValue, uniqueId]
187
- );
188
- const getTextCss = (sizeVariant) => {
189
- if (lodashEs.isNil(sizeVariant)) return {};
190
- const { textVariant } = utils_index.getSizeVariantState(sizeVariant);
191
- if (lodashEs.isNil(textVariant)) return {};
192
- return theme_typography.getTypographyVar(textVariant);
193
- };
194
- const onInputChange = (e) => {
195
- var _a2;
196
- e.target.value = lodashEs.trimStart(e.target.value);
197
- setInputValue(e.target.value);
198
- (_a2 = inputProps == null ? void 0 : inputProps.onChange) == null ? void 0 : _a2.call(inputProps, e);
199
- };
200
- react.useEffect(() => {
201
- const timer = setTimeout(() => {
202
- var _a2;
203
- if (isOpen) {
204
- (_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
205
- } else {
206
- setInputValue("");
207
- }
208
- }, 100);
209
- return () => clearTimeout(timer);
210
- }, [isOpen, setInputValue]);
211
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...containerProps, css: { display: "flex", flexDirection: "column", width: "100%", ...containerProps == null ? void 0 : containerProps.css }, children: [
212
- /* @__PURE__ */ jsxRuntime.jsxs(
213
- floating.Floating,
214
- {
215
- clickProps: {
216
- enabled: true
217
- },
218
- dismissProps: {
219
- enabled: true
220
- },
221
- sizeOptions,
222
- placement,
223
- open: isOpen,
224
- onOpenChange: prehandleOpenChange,
225
- ref: floatingRef,
226
- children: [
227
- /* @__PURE__ */ jsxRuntime.jsx(floatingTrigger.FloatingTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
228
- inputMask.InputMask,
229
- {
230
- type: "button",
231
- error: isOpen ? false : error,
232
- element: "button",
233
- suffix: /* @__PURE__ */ jsxRuntime.jsx(
234
- svgLoader.SvgLoader,
235
- {
236
- source: arrowDown,
237
- width: 20,
238
- height: 20,
239
- css: {
240
- transition: "transform 150ms",
241
- ...isOpen ? { transform: "rotate(-180deg)" } : {}
242
- }
243
- }
244
- ),
245
- ...rest,
246
- ref,
247
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { css: [{ flex: 1, textAlign: "left", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", paddingTop: 4, paddingBottom: 4 }, getTextCss((_a = rest.xs) == null ? void 0 : _a.size)], children: selectedValueMap.size > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
248
- "div",
249
- {
250
- css: {
251
- display: "flex",
252
- gap: 4,
253
- ...displayCount > 1 ? { flexWrap: "wrap" } : {}
254
- },
255
- children: [
256
- Array.from(selectedValueMap.values()).slice(0, displayCount).map((selectedOption) => {
257
- const rowValue = getOptionValue(selectedOption);
258
- const rowLabel = getTagLabel(selectedOption) ?? getOptionLabel(selectedOption);
259
- return /* @__PURE__ */ jsxRuntime.jsx(
260
- "div",
261
- {
262
- css: {
263
- display: "flex",
264
- alignItems: "center",
265
- gap: 8,
266
- overflow: "hidden",
267
- borderRadius: 8,
268
- backgroundColor: theme_palette.getColorVar("neutral.100"),
269
- paddingLeft: 8,
270
- paddingRight: 8,
271
- paddingTop: 4,
272
- paddingBottom: 4,
273
- fontSize: "0.75rem",
274
- lineHeight: "1rem"
275
- },
276
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { css: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: lodashEs.isElement(rowLabel) ? rowLabel : /* @__PURE__ */ jsxRuntime.jsx("span", { children: rowLabel }) })
277
- },
278
- rowValue.toString()
279
- );
280
- }),
281
- displayCount < selectedValueMap.size && /* @__PURE__ */ jsxRuntime.jsx("div", { css: {
282
- borderRadius: 8,
283
- backgroundColor: theme_palette.getColorVar("neutral.100"),
284
- paddingLeft: 8,
285
- paddingRight: 8,
286
- paddingTop: 4,
287
- paddingBottom: 4,
288
- fontSize: "0.75rem",
289
- lineHeight: "1rem",
290
- flexShrink: 0
291
- }, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { css: { fontWeight: 500 }, children: [
292
- "+",
293
- selectedValueMap.size - displayCount
294
- ] }) })
295
- ]
296
- }
297
- ) : /* @__PURE__ */ jsxRuntime.jsx("span", { css: { color: theme_palette.getColorVar("neutral.400"), display: "block" }, children: placeholder }) })
298
- }
299
- ) }),
300
- /* @__PURE__ */ jsxRuntime.jsx(floatingContent.FloatingContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { css: {
301
- paddingTop: 8,
302
- paddingBottom: 8,
303
- border: "1px solid",
304
- borderColor: theme_palette.getColorVar("border.default"),
305
- borderRadius: 8,
306
- boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
307
- fontSize: "0.875rem",
308
- lineHeight: "1.25rem",
309
- backgroundColor: theme_palette.getColorVar("surface.default")
310
- }, children: [
311
- searchable && /* @__PURE__ */ jsxRuntime.jsx("div", { css: { paddingLeft: 8, paddingRight: 8, paddingBottom: 12, position: "relative" }, children: /* @__PURE__ */ jsxRuntime.jsx(
312
- input.Input,
313
- {
314
- xs: { size: (_b = rest.xs) == null ? void 0 : _b.size },
315
- sm: { size: (_c = rest.sm) == null ? void 0 : _c.size },
316
- md: { size: (_d = rest.md) == null ? void 0 : _d.size },
317
- lg: { size: (_e = rest.lg) == null ? void 0 : _e.size },
318
- value: inputValue,
319
- ...inputProps,
320
- onChange: onInputChange,
321
- ref: searchInputRef
322
- }
323
- ) }),
324
- /* @__PURE__ */ jsxRuntime.jsx(
325
- virtualizedList.VirtualizedList,
326
- {
327
- ...listProps,
328
- css: { paddingLeft: 4, paddingRight: 4 },
329
- options: {
330
- count: displayOptions.length,
331
- estimateSize,
332
- getItemKey
333
- },
334
- style: {
335
- maxHeight: rowMinHeight * DEFAULT_DISPLAY_ROW_COUNT,
336
- ...listProps == null ? void 0 : listProps.style
337
- },
338
- RowComponent
339
- }
340
- )
341
- ] }) })
342
- ]
343
- }
344
- ),
345
- /* @__PURE__ */ jsxRuntime.jsx(formHelperText.FormHelperText, { error, children: helperText })
346
- ] });
347
- };
348
- exports.MultipleSelect = MultipleSelect;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("react");
5
- const lodashEs = require("lodash-es");
6
- const reactRouter = require("react-router");
7
- const constants_index = require("../../constants/index.cjs");
8
- const NavLink = react.forwardRef(
9
- ({ children, style, className, to, ...props }, ref) => {
10
- const styleFn = (renderProps) => {
11
- return lodashEs.isFunction(style) ? style({
12
- ...renderProps,
13
- isActive: renderProps.isActive && !lodashEs.isNil(to)
14
- }) : style;
15
- };
16
- const classNameFn = (renderProps) => {
17
- return lodashEs.isFunction(className) ? className({
18
- ...renderProps,
19
- isActive: renderProps.isActive && !lodashEs.isNil(to)
20
- }) : className;
21
- };
22
- const onClick = (e) => {
23
- var _a;
24
- if (e.currentTarget.getAttribute("aria-disabled") === constants_index.Booleanish.True) {
25
- e.preventDefault();
26
- }
27
- if (lodashEs.isNil(to)) {
28
- e.preventDefault();
29
- }
30
- (_a = props.onClick) == null ? void 0 : _a.call(props, e);
31
- };
32
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouter.NavLink, { ...props, style: styleFn, className: classNameFn, to: to ?? "#", ref, onClick, children: (renderProps) => {
33
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: lodashEs.isFunction(children) ? children({
34
- ...renderProps,
35
- isActive: renderProps.isActive && !lodashEs.isNil(to)
36
- }) : children });
37
- } });
38
- }
39
- );
40
- exports.NavLink = NavLink;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react = require("react");
4
- const jotai = require("jotai");
5
- const uuid = require("uuid");
6
- require("clsx");
7
- require("lodash-es");
8
- require("../../theme/palette.cjs");
9
- const common = require("../../utils/common.cjs");
10
- const notificationAtom = jotai.atom({
11
- entries: []
12
- });
13
- const useNotifications = () => {
14
- const [, setAtomValue] = jotai.useAtom(notificationAtom);
15
- const pushNotifications = react.useCallback(
16
- (notifications) => {
17
- return setAtomValue((prev) => {
18
- return {
19
- ...prev,
20
- entries: [
21
- ...prev.entries,
22
- ...common.ensureArray(notifications).map((notification) => ({
23
- ...notification,
24
- id: uuid.v4()
25
- }))
26
- ]
27
- };
28
- });
29
- },
30
- [setAtomValue]
31
- );
32
- return react.useMemo(() => {
33
- return {
34
- pushNotifications
35
- };
36
- }, [pushNotifications]);
37
- };
38
- exports.notificationAtom = notificationAtom;
39
- exports.useNotifications = useNotifications;
@@ -1,167 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react$2 = require("react");
5
- const react = require("@floating-ui/react");
6
- const jotai = require("jotai");
7
- const lodashEs = require("lodash-es");
8
- const react$1 = require("motion/react");
9
- const helpers = require("./helpers.cjs");
10
- const utils_index = require("../../utils/index.cjs");
11
- const theme_index = require("../../theme/index.cjs");
12
- const theme_screens = require("../../theme/screens.cjs");
13
- const Notification = ({
14
- notification
15
- }) => {
16
- const { main, light } = utils_index.getColorShadesByVariant(notification.color);
17
- const [, setAtomValue] = jotai.useAtom(helpers.notificationAtom);
18
- const timerRef = react$2.useRef(null);
19
- const controls = react$1.useAnimation();
20
- const progressControls = react$1.useAnimation();
21
- const startTimeRef = react$2.useRef(Date.now());
22
- const remainingTimeRef = react$2.useRef(notification.duration ?? 3e3);
23
- const removeNotification = react$2.useCallback(() => {
24
- setAtomValue((prev) => ({
25
- ...prev,
26
- entries: prev.entries.filter((n) => n.id !== notification.id)
27
- }));
28
- }, [notification.id, setAtomValue]);
29
- const clearTimer = react$2.useCallback(() => {
30
- if (lodashEs.isNil(timerRef.current)) return;
31
- clearTimeout(timerRef.current);
32
- timerRef.current = null;
33
- }, []);
34
- const startTimer = react$2.useCallback(
35
- (timeLeft) => {
36
- clearTimer();
37
- const duration = timeLeft ?? remainingTimeRef.current;
38
- startTimeRef.current = Date.now();
39
- timerRef.current = setTimeout(() => {
40
- removeNotification();
41
- }, duration);
42
- },
43
- [clearTimer, removeNotification]
44
- );
45
- react$2.useEffect(() => {
46
- startTimer(notification.duration ?? 3e3);
47
- progressControls.start({
48
- scaleX: 1,
49
- transition: {
50
- duration: (notification.duration ?? 3e3) / 1e3,
51
- ease: "linear"
52
- }
53
- });
54
- return () => {
55
- clearTimer();
56
- };
57
- }, []);
58
- const handleMouseEnter = react$2.useCallback(() => {
59
- const elapsed = Date.now() - startTimeRef.current;
60
- remainingTimeRef.current = Math.max(0, remainingTimeRef.current - elapsed);
61
- clearTimer();
62
- progressControls.stop();
63
- }, [clearTimer, progressControls]);
64
- const handleMouseLeave = react$2.useCallback(() => {
65
- startTimer(remainingTimeRef.current);
66
- progressControls.start({
67
- scaleX: 1,
68
- transition: {
69
- duration: remainingTimeRef.current / 1e3,
70
- ease: "linear"
71
- }
72
- });
73
- }, [startTimer, progressControls]);
74
- return /* @__PURE__ */ jsxRuntime.jsxs(
75
- react$1.motion.div,
76
- {
77
- layout: true,
78
- initial: { opacity: 0, x: 100 },
79
- animate: { opacity: 1, x: 0 },
80
- exit: { opacity: 0, x: 300 },
81
- transition: { duration: 0.3 },
82
- css: {
83
- backgroundColor: light,
84
- outlineColor: main,
85
- width: 440,
86
- borderRadius: 12,
87
- outlineWidth: 1,
88
- outlineOffset: -1,
89
- outlineStyle: "solid",
90
- display: "flex",
91
- flexDirection: "column",
92
- gap: 4,
93
- maxWidth: "100%",
94
- pointerEvents: "auto",
95
- cursor: "grab",
96
- padding: 16,
97
- overflow: "hidden",
98
- position: "relative"
99
- },
100
- drag: "x",
101
- dragConstraints: { left: 0, right: 0 },
102
- onMouseEnter: handleMouseEnter,
103
- onMouseLeave: handleMouseLeave,
104
- onDragEnd: (_event, info) => {
105
- if (Math.abs(info.offset.x) > 100) {
106
- controls.start({ x: info.offset.x > 0 ? 300 : -300, opacity: 0 }).then(removeNotification);
107
- } else {
108
- controls.start({ x: 0 });
109
- }
110
- },
111
- children: [
112
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: {
113
- fontSize: "0.875rem",
114
- lineHeight: "1.25rem",
115
- fontWeight: 500,
116
- [theme_screens.mediaQuery("sm")]: { fontSize: "1rem", lineHeight: "1.5rem" }
117
- }, children: notification.title ?? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: " " }) }),
118
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: {
119
- fontSize: "0.75rem",
120
- lineHeight: "1rem",
121
- [theme_screens.mediaQuery("sm")]: { fontSize: "0.875rem", lineHeight: "1.25rem" }
122
- }, children: notification.message ?? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: " " }) }),
123
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: { position: "absolute", left: 0, right: 0, bottom: 4, paddingLeft: 4, paddingRight: 4, overflow: "hidden", pointerEvents: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(
124
- react$1.motion.div,
125
- {
126
- css: {
127
- height: 4,
128
- width: "100%",
129
- borderRadius: 9999
130
- },
131
- style: {
132
- backgroundImage: `linear-gradient(to right, ${light}, ${main})`,
133
- transformOrigin: "left"
134
- },
135
- initial: { scaleX: 0 },
136
- animate: progressControls
137
- }
138
- ) })
139
- ]
140
- }
141
- );
142
- };
143
- const Notifications = () => {
144
- const { entries } = jotai.useAtomValue(helpers.notificationAtom);
145
- return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
146
- "div",
147
- {
148
- css: {
149
- zIndex: theme_index.FLOATING_Z_INDEX + 1,
150
- position: "fixed",
151
- top: 0,
152
- left: 0,
153
- right: 0,
154
- pointerEvents: "none",
155
- padding: 8,
156
- display: "flex",
157
- flexDirection: "column",
158
- alignItems: "flex-end",
159
- gap: 8
160
- },
161
- children: /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { mode: "popLayout", children: entries.map((notification) => {
162
- return /* @__PURE__ */ jsxRuntime.jsx(Notification, { notification }, notification.id);
163
- }) })
164
- }
165
- ) });
166
- };
167
- exports.Notifications = Notifications;