@seed-design/lynx-react 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/lib/components/Accordion/Accordion.jsx +2 -2
  2. package/lib/components/ActionButton/ActionButton.jsx +1 -1
  3. package/lib/components/AlertDialog/AlertDialog.d.ts +64 -0
  4. package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
  5. package/lib/components/AlertDialog/AlertDialog.jsx +138 -0
  6. package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
  7. package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
  8. package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
  9. package/lib/components/AlertDialog/index.d.ts +3 -0
  10. package/lib/components/AlertDialog/index.d.ts.map +1 -0
  11. package/lib/components/AppBar/AppBar.d.ts +14 -1
  12. package/lib/components/AppBar/AppBar.d.ts.map +1 -1
  13. package/lib/components/AppBar/AppBar.jsx +42 -16
  14. package/lib/components/AppBar/AppBar.namespace.d.ts +1 -1
  15. package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -1
  16. package/lib/components/AppBar/context.d.ts +2 -1
  17. package/lib/components/AppBar/context.d.ts.map +1 -1
  18. package/lib/components/AppBar/index.d.ts +1 -1
  19. package/lib/components/AppBar/index.d.ts.map +1 -1
  20. package/lib/components/AppBar/useAppBar.d.ts +2 -1
  21. package/lib/components/AppBar/useAppBar.d.ts.map +1 -1
  22. package/lib/components/AppBar/useAppBar.js +17 -15
  23. package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts +182 -0
  24. package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts.map +1 -0
  25. package/lib/components/AttachmentDisplay/AttachmentDisplay.jsx +444 -0
  26. package/lib/components/AttachmentDisplay/index.d.ts +2 -0
  27. package/lib/components/AttachmentDisplay/index.d.ts.map +1 -0
  28. package/lib/components/AttachmentInput/AttachmentInput.d.ts +179 -0
  29. package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
  30. package/lib/components/AttachmentInput/AttachmentInput.jsx +520 -0
  31. package/lib/components/AttachmentInput/index.d.ts +2 -0
  32. package/lib/components/AttachmentInput/index.d.ts.map +1 -0
  33. package/lib/components/BottomSheet/BottomSheet.d.ts +1 -1
  34. package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  35. package/lib/components/BottomSheet/BottomSheet.jsx +1 -7
  36. package/lib/components/Box/Box.d.ts +3 -3
  37. package/lib/components/Box/Box.d.ts.map +1 -1
  38. package/lib/components/Callout/Callout.jsx +2 -2
  39. package/lib/components/Checkbox/Checkbox.jsx +2 -2
  40. package/lib/components/Chip/Chip.jsx +2 -2
  41. package/lib/components/ChipTabs/ChipTabs.d.ts +41 -0
  42. package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
  43. package/lib/components/ChipTabs/ChipTabs.jsx +39 -0
  44. package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
  45. package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
  46. package/lib/components/ChipTabs/ChipTabs.namespace.js +13 -0
  47. package/lib/components/ChipTabs/index.d.ts +3 -0
  48. package/lib/components/ChipTabs/index.d.ts.map +1 -0
  49. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts +18 -0
  50. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -0
  51. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.jsx +113 -0
  52. package/lib/components/ContextualFloatingButton/index.d.ts +2 -0
  53. package/lib/components/ContextualFloatingButton/index.d.ts.map +1 -0
  54. package/lib/components/Dialog/Dialog.d.ts +87 -0
  55. package/lib/components/Dialog/Dialog.d.ts.map +1 -0
  56. package/lib/components/Dialog/Dialog.jsx +147 -0
  57. package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
  58. package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
  59. package/lib/components/Dialog/Dialog.namespace.js +18 -0
  60. package/lib/components/Dialog/index.d.ts +3 -0
  61. package/lib/components/Dialog/index.d.ts.map +1 -0
  62. package/lib/components/FloatingActionButton/FloatingActionButton.d.ts +23 -0
  63. package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -0
  64. package/lib/components/FloatingActionButton/FloatingActionButton.jsx +76 -0
  65. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts +2 -0
  66. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts.map +1 -0
  67. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.js +10 -0
  68. package/lib/components/FloatingActionButton/index.d.ts +3 -0
  69. package/lib/components/FloatingActionButton/index.d.ts.map +1 -0
  70. package/lib/components/HelpBubble/HelpBubble.d.ts +67 -0
  71. package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
  72. package/lib/components/HelpBubble/HelpBubble.jsx +600 -0
  73. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
  74. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
  75. package/lib/components/HelpBubble/HelpBubble.namespace.js +18 -0
  76. package/lib/components/HelpBubble/index.d.ts +3 -0
  77. package/lib/components/HelpBubble/index.d.ts.map +1 -0
  78. package/lib/components/Icon/Icon.d.ts +1 -0
  79. package/lib/components/Icon/Icon.d.ts.map +1 -1
  80. package/lib/components/Icon/Icon.jsx +2 -1
  81. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts +28 -0
  82. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts.map +1 -0
  83. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.jsx +37 -0
  84. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts +2 -0
  85. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts.map +1 -0
  86. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.js +9 -0
  87. package/lib/components/IdentityPlaceholder/identity-placeholder-business.js +4 -0
  88. package/lib/components/IdentityPlaceholder/identity-placeholder-person.js +4 -0
  89. package/lib/components/IdentityPlaceholder/index.d.ts +3 -0
  90. package/lib/components/IdentityPlaceholder/index.d.ts.map +1 -0
  91. package/lib/components/InputButton/InputButton.d.ts +2 -0
  92. package/lib/components/InputButton/InputButton.d.ts.map +1 -1
  93. package/lib/components/InputButton/InputButton.jsx +40 -8
  94. package/lib/components/List/List.d.ts +1 -1
  95. package/lib/components/List/List.d.ts.map +1 -1
  96. package/lib/components/List/List.jsx +26 -12
  97. package/lib/components/Menu/Menu.d.ts.map +1 -1
  98. package/lib/components/Menu/Menu.jsx +15 -5
  99. package/lib/components/PageBanner/PageBanner.d.ts +3 -0
  100. package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
  101. package/lib/components/PageBanner/PageBanner.jsx +49 -11
  102. package/lib/components/QuantityPicker/QuantityPicker.d.ts +53 -0
  103. package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -0
  104. package/lib/components/QuantityPicker/QuantityPicker.jsx +282 -0
  105. package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts +2 -0
  106. package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts.map +1 -0
  107. package/lib/components/QuantityPicker/QuantityPicker.namespace.js +11 -0
  108. package/lib/components/QuantityPicker/index.d.ts +3 -0
  109. package/lib/components/QuantityPicker/index.d.ts.map +1 -0
  110. package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
  111. package/lib/components/ReactionButton/ReactionButton.d.ts +1 -1
  112. package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
  113. package/lib/components/ReactionButton/ReactionButton.jsx +22 -13
  114. package/lib/components/ScrollFog/ScrollFog.d.ts +41 -0
  115. package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -0
  116. package/lib/components/ScrollFog/ScrollFog.jsx +65 -0
  117. package/lib/components/ScrollFog/index.d.ts +2 -0
  118. package/lib/components/ScrollFog/index.d.ts.map +1 -0
  119. package/lib/components/SegmentedControl/SegmentedControl.jsx +2 -2
  120. package/lib/components/Select/Select.d.ts +112 -0
  121. package/lib/components/Select/Select.d.ts.map +1 -0
  122. package/lib/components/Select/Select.jsx +885 -0
  123. package/lib/components/Select/Select.namespace.d.ts +2 -0
  124. package/lib/components/Select/Select.namespace.d.ts.map +1 -0
  125. package/lib/components/Select/Select.namespace.js +23 -0
  126. package/lib/components/Select/index.d.ts +3 -0
  127. package/lib/components/Select/index.d.ts.map +1 -0
  128. package/lib/components/Skeleton/Skeleton.d.ts +15 -0
  129. package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
  130. package/lib/components/Skeleton/Skeleton.jsx +18 -0
  131. package/lib/components/Skeleton/index.d.ts +2 -0
  132. package/lib/components/Skeleton/index.d.ts.map +1 -0
  133. package/lib/components/Slider/Slider.d.ts +101 -0
  134. package/lib/components/Slider/Slider.d.ts.map +1 -0
  135. package/lib/components/Slider/Slider.jsx +573 -0
  136. package/lib/components/Slider/Slider.namespace.d.ts +2 -0
  137. package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
  138. package/lib/components/Slider/Slider.namespace.js +19 -0
  139. package/lib/components/Slider/Slider.utils.d.ts +19 -0
  140. package/lib/components/Slider/Slider.utils.d.ts.map +1 -0
  141. package/lib/components/Slider/Slider.utils.js +106 -0
  142. package/lib/components/Slider/index.d.ts +3 -0
  143. package/lib/components/Slider/index.d.ts.map +1 -0
  144. package/lib/components/Stack/Stack.d.ts +7 -9
  145. package/lib/components/Stack/Stack.d.ts.map +1 -1
  146. package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
  147. package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +22 -8
  148. package/lib/components/Switch/Switch.d.ts.map +1 -1
  149. package/lib/components/Switch/Switch.jsx +5 -3
  150. package/lib/components/Tabs/Tabs.d.ts +34 -2
  151. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  152. package/lib/components/Tabs/Tabs.jsx +186 -56
  153. package/lib/components/Tabs/Tabs.utils.d.ts +14 -1
  154. package/lib/components/Tabs/Tabs.utils.d.ts.map +1 -1
  155. package/lib/components/Tabs/Tabs.utils.js +24 -3
  156. package/lib/components/Tabs/index.d.ts +1 -1
  157. package/lib/components/Tabs/index.d.ts.map +1 -1
  158. package/lib/components/index.d.ts +14 -0
  159. package/lib/components/index.d.ts.map +1 -1
  160. package/lib/hooks/useControllableState.d.ts +1 -14
  161. package/lib/hooks/useControllableState.d.ts.map +1 -1
  162. package/lib/hooks/usePressTap.d.ts +1 -27
  163. package/lib/hooks/usePressTap.d.ts.map +1 -1
  164. package/lib/hooks/useSafeArea.d.ts +8 -4
  165. package/lib/hooks/useSafeArea.d.ts.map +1 -1
  166. package/lib/hooks/useSafeArea.js +22 -20
  167. package/lib/index.js +29 -6
  168. package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
  169. package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
  170. package/lib/types.d.ts +1 -0
  171. package/lib/types.d.ts.map +1 -1
  172. package/lib/utils/styled.d.ts +46 -6
  173. package/lib/utils/styled.d.ts.map +1 -1
  174. package/lib/utils/styled.js +19 -4
  175. package/package.json +9 -5
  176. package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
  177. package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
  178. package/src/components/AlertDialog/AlertDialog.tsx +374 -0
  179. package/src/components/AlertDialog/index.ts +24 -0
  180. package/src/components/AppBar/AppBar.namespace.ts +1 -0
  181. package/src/components/AppBar/AppBar.test.tsx +252 -3
  182. package/src/components/AppBar/AppBar.tsx +108 -25
  183. package/src/components/AppBar/context.ts +3 -1
  184. package/src/components/AppBar/index.ts +1 -0
  185. package/src/components/AppBar/useAppBar.ts +21 -15
  186. package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
  187. package/src/components/AttachmentDisplay/index.ts +48 -0
  188. package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
  189. package/src/components/AttachmentInput/index.ts +49 -0
  190. package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
  191. package/src/components/BottomSheet/BottomSheet.tsx +1 -19
  192. package/src/components/Box/Box.test.tsx +104 -0
  193. package/src/components/Box/Box.tsx +9 -6
  194. package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
  195. package/src/components/ChipTabs/ChipTabs.tsx +119 -0
  196. package/src/components/ChipTabs/index.ts +16 -0
  197. package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
  198. package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
  199. package/src/components/ContextualFloatingButton/index.ts +4 -0
  200. package/src/components/Dialog/Dialog.namespace.ts +24 -0
  201. package/src/components/Dialog/Dialog.test.tsx +172 -0
  202. package/src/components/Dialog/Dialog.tsx +373 -0
  203. package/src/components/Dialog/index.ts +26 -0
  204. package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
  205. package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
  206. package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
  207. package/src/components/FloatingActionButton/index.ts +10 -0
  208. package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
  209. package/src/components/HelpBubble/HelpBubble.tsx +998 -0
  210. package/src/components/HelpBubble/index.ts +26 -0
  211. package/src/components/Icon/Icon.test.tsx +0 -3
  212. package/src/components/Icon/Icon.tsx +11 -1
  213. package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
  214. package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
  215. package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
  216. package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
  217. package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
  218. package/src/components/IdentityPlaceholder/index.ts +8 -0
  219. package/src/components/InputButton/InputButton.test.tsx +128 -1
  220. package/src/components/InputButton/InputButton.tsx +60 -9
  221. package/src/components/List/List.test.tsx +54 -2
  222. package/src/components/List/List.tsx +43 -10
  223. package/src/components/Menu/Menu.tsx +14 -4
  224. package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
  225. package/src/components/PageBanner/PageBanner.test.tsx +110 -3
  226. package/src/components/PageBanner/PageBanner.tsx +83 -19
  227. package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
  228. package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
  229. package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
  230. package/src/components/QuantityPicker/index.ts +14 -0
  231. package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
  232. package/src/components/ReactionButton/ReactionButton.test.tsx +5 -3
  233. package/src/components/ReactionButton/ReactionButton.tsx +20 -12
  234. package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
  235. package/src/components/ScrollFog/ScrollFog.tsx +172 -0
  236. package/src/components/ScrollFog/index.ts +1 -0
  237. package/src/components/Select/Select.namespace.ts +34 -0
  238. package/src/components/Select/Select.test.tsx +297 -0
  239. package/src/components/Select/Select.tsx +1483 -0
  240. package/src/components/Select/index.ts +39 -0
  241. package/src/components/Skeleton/Skeleton.test.tsx +64 -0
  242. package/src/components/Skeleton/Skeleton.tsx +45 -0
  243. package/src/components/Skeleton/index.ts +1 -0
  244. package/src/components/Slider/Slider.namespace.ts +26 -0
  245. package/src/components/Slider/Slider.test.tsx +260 -0
  246. package/src/components/Slider/Slider.tsx +897 -0
  247. package/src/components/Slider/Slider.utils.ts +167 -0
  248. package/src/components/Slider/index.ts +30 -0
  249. package/src/components/Stack/Stack.test.tsx +7 -0
  250. package/src/components/Stack/Stack.tsx +11 -10
  251. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
  252. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
  253. package/src/components/Switch/Switch.tsx +14 -13
  254. package/src/components/Tabs/Tabs.test.tsx +218 -1
  255. package/src/components/Tabs/Tabs.tsx +346 -75
  256. package/src/components/Tabs/Tabs.utils.ts +51 -1
  257. package/src/components/Tabs/index.ts +17 -1
  258. package/src/components/index.ts +14 -0
  259. package/src/hooks/useControllableState.ts +1 -43
  260. package/src/hooks/usePressTap.test.ts +23 -11
  261. package/src/hooks/usePressTap.ts +1 -60
  262. package/src/hooks/useSafeArea.test.ts +13 -1
  263. package/src/hooks/useSafeArea.ts +25 -23
  264. package/src/types.ts +1 -0
  265. package/src/utils/styled.ts +127 -9
@@ -0,0 +1,282 @@
1
+ import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
2
+ import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
3
+ import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
4
+ import { mergeProps } from "../../utils/merge-props.js";
5
+ import { InternalIcon } from "../Icon/Icon.jsx";
6
+ import * as React from "@lynx-js/react";
7
+ import clsx from "clsx";
8
+ import { quantityPicker } from "@seed-design/lynx-css/recipes/quantity-picker";
9
+ //#region src/components/QuantityPicker/QuantityPicker.tsx
10
+ var defaultGetValueText = (valueText) => valueText;
11
+ var QuantityPickerContext = React.createContext(null);
12
+ function useQuantityPickerContext(consumer) {
13
+ const context = React.useContext(QuantityPickerContext);
14
+ if (!context) throw new Error(`<${consumer}/> must be rendered inside <QuantityPickerRoot/>.`);
15
+ return context;
16
+ }
17
+ function assertSafeInteger(value, name) {
18
+ if (!Number.isSafeInteger(value)) throw new Error(`QuantityPicker: ${name} must be a safe integer.`);
19
+ }
20
+ function validateProps({ defaultValue, max, min, step, value }) {
21
+ assertSafeInteger(min, "min");
22
+ assertSafeInteger(max, "max");
23
+ assertSafeInteger(step, "step");
24
+ if (min > max) throw new Error("QuantityPicker: min must be less than or equal to max.");
25
+ if (step <= 0) throw new Error("QuantityPicker: step must be greater than 0.");
26
+ for (const [name, candidate] of [["value", value], ["defaultValue", defaultValue]]) {
27
+ if (candidate === void 0) continue;
28
+ assertSafeInteger(candidate, name);
29
+ if (candidate < min || candidate > max) throw new Error(`QuantityPicker: ${name} must be between min and max.`);
30
+ }
31
+ }
32
+ function getLoadingState(loading) {
33
+ if (loading === true) return {
34
+ decrement: true,
35
+ increment: true
36
+ };
37
+ return {
38
+ decrement: typeof loading === "object" ? loading?.decrement ?? false : false,
39
+ increment: typeof loading === "object" ? loading?.increment ?? false : false
40
+ };
41
+ }
42
+ function getValueDisplayPlaceholder(min, max) {
43
+ const boundary = String(min).length > String(max).length ? min : max;
44
+ return String(boundary).replace(/\d/g, "0");
45
+ }
46
+ function getAccessibleText(valueText, value) {
47
+ return typeof valueText === "string" || typeof valueText === "number" ? String(valueText) : String(value);
48
+ }
49
+ function recipeProps(context, pressed = false) {
50
+ return {
51
+ layout: context.layout,
52
+ size: context.size,
53
+ invalid: context.invalid,
54
+ disabled: context.disabled,
55
+ pressed,
56
+ loading: context.loading ?? false
57
+ };
58
+ }
59
+ function isQuantityPickerButton(child) {
60
+ return React.isValidElement(child) && (child.type === QuantityPickerDecrementButton || child.type === QuantityPickerIncrementButton);
61
+ }
62
+ function isQuantityPickerValueDisplay(child) {
63
+ return React.isValidElement(child) && child.type === QuantityPickerValueDisplay;
64
+ }
65
+ function flattenQuantityPickerChildren(children) {
66
+ if (children == null || typeof children === "boolean") return [];
67
+ if (Array.isArray(children)) return children.flatMap(flattenQuantityPickerChildren);
68
+ if (React.isValidElement(children) && children.type === React.Fragment) return flattenQuantityPickerChildren(children.props.children);
69
+ return [children];
70
+ }
71
+ function withDividers(children, dividerClassName) {
72
+ const childArray = flattenQuantityPickerChildren(children);
73
+ return childArray.flatMap((child, index) => {
74
+ const nextChild = childArray[index + 1];
75
+ if (!(isQuantityPickerButton(child) && isQuantityPickerValueDisplay(nextChild) || isQuantityPickerValueDisplay(child) && isQuantityPickerButton(nextChild))) return [child];
76
+ return [child, <view key={isQuantityPickerValueDisplay(child) ? "quantity-picker-divider-after-value" : "quantity-picker-divider-before-value"} accessibility-elements-hidden={true} className={dividerClassName} />];
77
+ });
78
+ }
79
+ function renderActionContent(icon, loadingIndicator, children, className, loading) {
80
+ if (loading) {
81
+ const content = loadingIndicator ?? children;
82
+ return <view className={className} accessibility-elements-hidden={true}>
83
+ {typeof content === "string" || typeof content === "number" ? <text>{content}</text> : content}
84
+ </view>;
85
+ }
86
+ if (icon == null) return typeof children === "string" || typeof children === "number" ? <text className={className}>{children}</text> : children;
87
+ if (typeof icon === "string" || typeof icon === "number") return <text className={className}>{icon}</text>;
88
+ if (!React.isValidElement(icon)) return icon;
89
+ return <InternalIcon icon={icon} className={className} accessibility-elements-hidden={true} />;
90
+ }
91
+ var QuantityPickerRoot = React.forwardRef((props, ref) => {
92
+ const { loading, ...propsWithoutLoading } = props;
93
+ const [variantProps, otherProps] = quantityPicker.splitVariantProps(propsWithoutLoading);
94
+ const { disabled = false, invalid = false, layout: layoutProp = "hug", size: sizeProp = "medium" } = variantProps;
95
+ const { children, className, min, max, step: stepProp = 1, value: valueProp, defaultValue, onValueChange, readOnly = false, onRemove, getValueText = defaultGetValueText, dir = "ltr", removable = false, removeAccessibilityLabel, "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "quantity picker", "accessibility-traits": accessibilityTraits, "accessibility-value": accessibilityValue, ...nativeProps } = otherProps;
96
+ validateProps({
97
+ min,
98
+ max,
99
+ step: stepProp,
100
+ value: valueProp,
101
+ defaultValue
102
+ });
103
+ const initialValue = defaultValue ?? min;
104
+ assertSafeInteger(initialValue, "defaultValue");
105
+ if (initialValue < min || initialValue > max) throw new Error("QuantityPicker: defaultValue must be between min and max.");
106
+ const [value, setValue] = useControllableState({
107
+ value: valueProp,
108
+ defaultValue: initialValue,
109
+ onChange: onValueChange
110
+ });
111
+ const loadingState = getLoadingState(loading);
112
+ const isAtMin = value === min;
113
+ const isAtMax = value === max;
114
+ const isRemoveButton = removable && isAtMin;
115
+ const decrementDisabled = disabled || !isRemoveButton && isAtMin;
116
+ const incrementDisabled = disabled || isAtMax;
117
+ const decrementBlocked = decrementDisabled || readOnly || loadingState.decrement;
118
+ const incrementBlocked = incrementDisabled || readOnly || loadingState.increment;
119
+ const decrement = React.useCallback(() => {
120
+ "background only";
121
+ if (isRemoveButton) {
122
+ if (!decrementBlocked) onRemove?.();
123
+ return;
124
+ }
125
+ if (!decrementBlocked) setValue(Math.max(value - stepProp, min));
126
+ }, [
127
+ decrementBlocked,
128
+ isRemoveButton,
129
+ min,
130
+ onRemove,
131
+ setValue,
132
+ stepProp,
133
+ value
134
+ ]);
135
+ const increment = React.useCallback(() => {
136
+ "background only";
137
+ if (!incrementBlocked) setValue(Math.min(value + stepProp, max));
138
+ }, [
139
+ incrementBlocked,
140
+ max,
141
+ setValue,
142
+ stepProp,
143
+ value
144
+ ]);
145
+ const classes = quantityPicker(recipeProps({
146
+ layout: layoutProp,
147
+ size: sizeProp,
148
+ invalid,
149
+ disabled,
150
+ loading: loadingState.decrement || loadingState.increment
151
+ }));
152
+ const displayValue = getValueText(String(value), value);
153
+ const contextValue = React.useMemo(() => ({
154
+ layout: layoutProp,
155
+ size: sizeProp,
156
+ invalid,
157
+ disabled,
158
+ readOnly,
159
+ loading: loadingState.decrement || loadingState.increment,
160
+ value,
161
+ min,
162
+ max,
163
+ step: stepProp,
164
+ dir,
165
+ removable,
166
+ isAtMin,
167
+ isAtMax,
168
+ isRemoveButton,
169
+ removeAccessibilityLabel,
170
+ getValueText,
171
+ decrementLoading: loadingState.decrement,
172
+ incrementLoading: loadingState.increment,
173
+ decrementBlocked,
174
+ incrementBlocked,
175
+ decrement,
176
+ increment,
177
+ onRemove,
178
+ classes
179
+ }), [
180
+ classes,
181
+ decrement,
182
+ decrementBlocked,
183
+ disabled,
184
+ dir,
185
+ getValueText,
186
+ increment,
187
+ incrementBlocked,
188
+ invalid,
189
+ isAtMax,
190
+ isAtMin,
191
+ isRemoveButton,
192
+ loadingState.decrement,
193
+ loadingState.increment,
194
+ max,
195
+ min,
196
+ onRemove,
197
+ readOnly,
198
+ removeAccessibilityLabel,
199
+ removable,
200
+ layoutProp,
201
+ sizeProp,
202
+ value
203
+ ]);
204
+ const orderedChildren = flattenQuantityPickerChildren(children);
205
+ if (dir === "rtl") orderedChildren.reverse();
206
+ return <QuantityPickerContext.Provider value={contextValue}>
207
+ <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.root, className)} accessibility-element={accessibilityElement} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (disabled ? "disabled" : void 0)} accessibility-value={accessibilityValue ?? getAccessibleText(displayValue, value)}>
208
+ {withDividers(orderedChildren, classes.divider)}
209
+ </view>
210
+ </QuantityPickerContext.Provider>;
211
+ });
212
+ QuantityPickerRoot.displayName = "QuantityPickerRoot";
213
+ var QuantityPickerDecrementButton = React.forwardRef((props, ref) => {
214
+ const context = useQuantityPickerContext("QuantityPickerDecrementButton");
215
+ const { children, className, style, icon, loadingIndicator, removeIcon, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
216
+ const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
217
+ disabled: context.decrementBlocked,
218
+ onTap: (...args) => {
219
+ context.decrement();
220
+ bindtap?.(...args);
221
+ },
222
+ mainThreadOnTap: mainThreadBindtap
223
+ });
224
+ const classes = quantityPicker(recipeProps({
225
+ ...context,
226
+ loading: context.decrementLoading,
227
+ disabled: context.decrementBlocked
228
+ }, pressed && !context.decrementBlocked));
229
+ const scaleFeedback = useScaleFeedback({
230
+ disabled: context.decrementBlocked,
231
+ onTouchStart: bindtouchstart,
232
+ onTouchEnd: bindtouchend,
233
+ onTouchCancel: bindtouchcancel
234
+ });
235
+ const iconContent = context.isRemoveButton ? removeIcon ?? icon : icon;
236
+ return <view {...mergeProps(ref ? { ref } : {}, scaleFeedback.scaleFeedbackTargetProps, scaleFeedback.scaleFeedbackTriggerProps, pressHandlers, nativeProps)} className={clsx(classes.decrementButton, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={context.isRemoveButton ? context.removeAccessibilityLabel : accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (context.decrementBlocked ? "disabled" : "button")}>
237
+ {renderActionContent(iconContent, loadingIndicator, children, classes.decrementIcon, context.decrementLoading)}
238
+ </view>;
239
+ });
240
+ QuantityPickerDecrementButton.displayName = "QuantityPickerDecrementButton";
241
+ var QuantityPickerValueDisplay = React.forwardRef((props, ref) => {
242
+ const context = useQuantityPickerContext("QuantityPickerValueDisplay");
243
+ const { className, style, "accessibility-elements-hidden": accessibilityElementsHidden = true, ...nativeProps } = props;
244
+ const valueText = context.getValueText(String(context.value), context.value);
245
+ const placeholderText = getValueDisplayPlaceholder(context.min, context.max);
246
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(quantityPicker(recipeProps(context)).valueDisplay, className)} style={style} accessibility-elements-hidden={accessibilityElementsHidden}>
247
+ <text accessibility-elements-hidden={true} className={quantityPicker(recipeProps(context)).valueDisplayPlaceholder}>
248
+ {context.getValueText(placeholderText, placeholderText)}
249
+ </text>
250
+ <text className={quantityPicker(recipeProps(context)).valueDisplayText}>{valueText}</text>
251
+ </view>;
252
+ });
253
+ QuantityPickerValueDisplay.displayName = "QuantityPickerValueDisplay";
254
+ var QuantityPickerIncrementButton = React.forwardRef((props, ref) => {
255
+ const context = useQuantityPickerContext("QuantityPickerIncrementButton");
256
+ const { children, className, style, icon, loadingIndicator, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
257
+ const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
258
+ disabled: context.incrementBlocked,
259
+ onTap: (...args) => {
260
+ context.increment();
261
+ bindtap?.(...args);
262
+ },
263
+ mainThreadOnTap: mainThreadBindtap
264
+ });
265
+ const classes = quantityPicker(recipeProps({
266
+ ...context,
267
+ loading: context.incrementLoading,
268
+ disabled: context.incrementBlocked
269
+ }, pressed && !context.incrementBlocked));
270
+ const scaleFeedback = useScaleFeedback({
271
+ disabled: context.incrementBlocked,
272
+ onTouchStart: bindtouchstart,
273
+ onTouchEnd: bindtouchend,
274
+ onTouchCancel: bindtouchcancel
275
+ });
276
+ return <view {...mergeProps(ref ? { ref } : {}, scaleFeedback.scaleFeedbackTargetProps, scaleFeedback.scaleFeedbackTriggerProps, pressHandlers, nativeProps)} className={clsx(classes.incrementButton, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (context.incrementBlocked ? "disabled" : "button")}>
277
+ {renderActionContent(icon, loadingIndicator, children, classes.incrementIcon, context.incrementLoading)}
278
+ </view>;
279
+ });
280
+ QuantityPickerIncrementButton.displayName = "QuantityPickerIncrementButton";
281
+ //#endregion
282
+ export { QuantityPickerDecrementButton, QuantityPickerIncrementButton, QuantityPickerRoot, QuantityPickerValueDisplay };
@@ -0,0 +1,2 @@
1
+ export { QuantityPickerRoot as Root, QuantityPickerDecrementButton as DecrementButton, QuantityPickerValueDisplay as ValueDisplay, QuantityPickerIncrementButton as IncrementButton, type QuantityPickerRootProps as RootProps, type QuantityPickerDecrementButtonProps as DecrementButtonProps, type QuantityPickerValueDisplayProps as ValueDisplayProps, type QuantityPickerIncrementButtonProps as IncrementButtonProps, } from './QuantityPicker';
2
+ //# sourceMappingURL=QuantityPicker.namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuantityPicker.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/QuantityPicker/QuantityPicker.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,IAAI,IAAI,EAC1B,6BAA6B,IAAI,eAAe,EAChD,0BAA0B,IAAI,YAAY,EAC1C,6BAA6B,IAAI,eAAe,EAChD,KAAK,uBAAuB,IAAI,SAAS,EACzC,KAAK,kCAAkC,IAAI,oBAAoB,EAC/D,KAAK,+BAA+B,IAAI,iBAAiB,EACzD,KAAK,kCAAkC,IAAI,oBAAoB,GAChE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+ import { QuantityPickerDecrementButton, QuantityPickerIncrementButton, QuantityPickerRoot, QuantityPickerValueDisplay } from "./QuantityPicker.jsx";
3
+ //#region src/components/QuantityPicker/QuantityPicker.namespace.ts
4
+ var QuantityPicker_namespace_exports = /* @__PURE__ */ __exportAll({
5
+ DecrementButton: () => QuantityPickerDecrementButton,
6
+ IncrementButton: () => QuantityPickerIncrementButton,
7
+ Root: () => QuantityPickerRoot,
8
+ ValueDisplay: () => QuantityPickerValueDisplay
9
+ });
10
+ //#endregion
11
+ export { QuantityPicker_namespace_exports };
@@ -0,0 +1,3 @@
1
+ export { QuantityPickerRoot, QuantityPickerDecrementButton, QuantityPickerValueDisplay, QuantityPickerIncrementButton, type QuantityPickerRootProps, type QuantityPickerDecrementButtonProps, type QuantityPickerValueDisplayProps, type QuantityPickerIncrementButtonProps, type QuantityPickerLoading, type QuantityPickerGetValueText, } from './QuantityPicker';
2
+ export * as QuantityPicker from './QuantityPicker.namespace';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/QuantityPicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,kCAAkC,EACvC,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,GAChC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
@@ -1,5 +1,5 @@
1
- import { useControllableState } from "../../hooks/useControllableState.js";
2
- import { usePressTap } from "../../hooks/usePressTap.js";
1
+ import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
2
+ import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
3
3
  import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
4
4
  import { mergeProps } from "../../utils/merge-props.js";
5
5
  import { InternalIcon } from "../Icon/Icon.jsx";
@@ -9,7 +9,7 @@ import * as React from "@lynx-js/react";
9
9
  * - 키보드 focus / focusVisible
10
10
  * - `asChild`
11
11
  */
12
- export interface ReactionButtonProps extends Omit<ReactionButtonVariantProps, "selected" | "pressed" | "disabled" | "loading">, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
12
+ export interface ReactionButtonProps extends Omit<ReactionButtonVariantProps, "selected" | "pressed" | "disabled" | "loading">, Omit<LynxStyledElementProps, "flatten">, LynxPressableProps, LynxAccessibilityProps {
13
13
  pressed?: boolean;
14
14
  defaultPressed?: boolean;
15
15
  onPressedChange?: (pressed: boolean) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ReactionButton.d.ts","sourceRoot":"","sources":["../../../src/components/ReactionButton/ReactionButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAKxC,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,aAAa,CAAC;AAMrB;;;;;;;GAOG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,EACvF,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,qFAkGzB,CAAC"}
1
+ {"version":3,"file":"ReactionButton.d.ts","sourceRoot":"","sources":["../../../src/components/ReactionButton/ReactionButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAOxC,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,aAAa,CAAC;AAMrB;;;;;;;GAOG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,EACvF,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,EACvC,kBAAkB,EAClB,sBAAsB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,qFAwGzB,CAAC"}
@@ -1,6 +1,8 @@
1
- import { useControllableState } from "../../hooks/useControllableState.js";
2
- import { usePressTap } from "../../hooks/usePressTap.js";
1
+ import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
2
+ import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
3
+ import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
3
4
  import { toArray } from "../../utils/children.js";
5
+ import { mergeProps } from "../../utils/merge-props.js";
4
6
  import { IconSlotProvider, getIconSlotName } from "../Icon/Icon.jsx";
5
7
  import { ProgressCircleRange, ProgressCircleRoot } from "../ProgressCircle/ProgressCircle.jsx";
6
8
  import { isCountElement } from "../Count/Count.jsx";
@@ -18,18 +20,25 @@ var ReactionButton = React.forwardRef((props, ref) => {
18
20
  defaultValue: defaultPressed,
19
21
  onChange: onPressedChange
20
22
  });
21
- const { pressed, ...pressHandlers } = usePressTap({
22
- disabled,
23
- onTap: React.useCallback((...args) => {
24
- setSelected(!selected);
25
- bindtap?.(...args);
26
- }, [
27
- bindtap,
28
- selected,
29
- setSelected
30
- ]),
23
+ const handleTap = React.useCallback((...args) => {
24
+ setSelected(!selected);
25
+ bindtap?.(...args);
26
+ }, [
27
+ bindtap,
28
+ selected,
29
+ setSelected
30
+ ]);
31
+ const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
32
+ disabled: disabled || loading,
33
+ onTap: handleTap,
31
34
  mainThreadOnTap: mainThreadBindtap
32
35
  });
36
+ const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback({
37
+ disabled: disabled || loading,
38
+ onTouchStart: bindtouchstart,
39
+ onTouchEnd: bindtouchend,
40
+ onTouchCancel: bindtouchcancel
41
+ });
33
42
  const classNames = reactionButton({
34
43
  ...variantProps,
35
44
  selected,
@@ -69,7 +78,7 @@ var ReactionButton = React.forwardRef((props, ref) => {
69
78
  labelChildren.push(child);
70
79
  }
71
80
  return <IconSlotProvider value={iconSlotContextValue}>
72
- <view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.root, className)} style={style} accessibility-element={accessibilityElement} accessibility-traits={disabled ? "disabled" : selected ? "selected" : accessibilityTraits ?? "button"} {...pressHandlers}>
81
+ <view {...mergeProps(ref ? { ref } : {}, scaleFeedbackTargetProps, scaleFeedbackTriggerProps, pressHandlers, nativeProps)} flatten={false} className={clsx(classNames.root, className)} style={style} accessibility-element={accessibilityElement} accessibility-traits={disabled ? "disabled" : selected ? "selected" : accessibilityTraits ?? "button"}>
73
82
  <view className={classNames.content}>
74
83
  {prefixIconChildren}
75
84
  {labelChildren.length > 0 ? <text className={classNames.label}>{labelChildren}</text> : null}
@@ -0,0 +1,41 @@
1
+ import { ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes } from '@lynx-js/react';
2
+ import { IntrinsicElements, NodesRef } from '@lynx-js/types';
3
+ type NativeViewProps = Omit<IntrinsicElements["view"], `main-thread:${string}`>;
4
+ type LynxForwardRefComponent<T, P> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
5
+ type ScrollFogPlacement = "top" | "bottom" | "left" | "right";
6
+ type SizesConfig = {
7
+ top?: number;
8
+ bottom?: number;
9
+ left?: number;
10
+ right?: number;
11
+ };
12
+ /**
13
+ * @platform Lynx
14
+ *
15
+ * A two-axis scroll area with independently configurable edge masks.
16
+ */
17
+ export interface ScrollFogProps extends Omit<NativeViewProps, "children" | "className" | "style"> {
18
+ children?: ReactNode;
19
+ className?: NativeViewProps["className"];
20
+ style?: NativeViewProps["style"];
21
+ /**
22
+ * Fog 효과를 표시할 방향입니다.
23
+ * @defaultValue ["top", "bottom"]
24
+ */
25
+ placement?: ScrollFogPlacement[];
26
+ /**
27
+ * Fog 효과의 크기입니다. 숫자는 px 단위로 처리합니다.
28
+ * @defaultValue 20
29
+ */
30
+ size?: number | string;
31
+ /** 방향별 Fog 효과의 크기입니다. 숫자는 px 단위로 처리합니다. */
32
+ sizes?: SizesConfig;
33
+ /**
34
+ * Native scroll indicator를 숨깁니다.
35
+ * @defaultValue false
36
+ */
37
+ hideScrollBar?: boolean;
38
+ }
39
+ export declare const ScrollFog: LynxForwardRefComponent<NodesRef, ScrollFogProps>;
40
+ export {};
41
+ //# sourceMappingURL=ScrollFog.d.ts.map
@@ -0,0 +1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AAO,MAAM,SAAS,EAAE,uBAAuB,CAAC,QAAQ,EAAE,cAAc,CAwFtE,CAAC"}
@@ -0,0 +1,65 @@
1
+ import * as React from "@lynx-js/react";
2
+ import clsx from "clsx";
3
+ import { scrollFog } from "@seed-design/lynx-css/vars/component";
4
+ import { scrollFog as scrollFog$1 } from "@seed-design/lynx-css/recipes/scroll-fog";
5
+ //#region src/components/ScrollFog/ScrollFog.tsx
6
+ var DEFAULT_SIZE = scrollFog.base.enabled.root.size;
7
+ function normalizeSize(size) {
8
+ return typeof size === "number" ? `${size}px` : size;
9
+ }
10
+ function createRootStyle(style, sizes) {
11
+ const variables = {
12
+ "--scroll-fog-size-top": sizes.top,
13
+ "--scroll-fog-size-bottom": sizes.bottom,
14
+ "--scroll-fog-size-left": sizes.left,
15
+ "--scroll-fog-size-right": sizes.right
16
+ };
17
+ if (typeof style === "string") return `${style}; ${Object.entries(variables).map(([property, value]) => `${property}: ${value}`).join("; ")}`;
18
+ return {
19
+ ...style,
20
+ ...variables
21
+ };
22
+ }
23
+ var ScrollFog = React.forwardRef((props, forwardedRef) => {
24
+ const { children, className, style, placement = ["top", "bottom"], size = DEFAULT_SIZE, sizes, hideScrollBar = false, ...rootProps } = props;
25
+ const normalizedSize = normalizeSize(size);
26
+ const topSize = sizes?.top ? normalizeSize(sizes.top) : normalizedSize;
27
+ const bottomSize = sizes?.bottom ? normalizeSize(sizes.bottom) : normalizedSize;
28
+ const leftSize = sizes?.left ? normalizeSize(sizes.left) : normalizedSize;
29
+ const rightSize = sizes?.right ? normalizeSize(sizes.right) : normalizedSize;
30
+ const scrollBarEnabled = !hideScrollBar;
31
+ const classNames = scrollFog$1({
32
+ top: placement.includes("top"),
33
+ bottom: placement.includes("bottom"),
34
+ left: placement.includes("left"),
35
+ right: placement.includes("right")
36
+ });
37
+ let content = <scroll-view enable-nested-scroll scroll-bar-enable={scrollBarEnabled} scroll-orientation="vertical" className={classNames.verticalScroll}>
38
+ <scroll-view enable-nested-scroll scroll-bar-enable={scrollBarEnabled} scroll-orientation="horizontal" className={classNames.horizontalScroll}>
39
+ {children}
40
+ </scroll-view>
41
+ </scroll-view>;
42
+ if (placement.includes("right")) content = <view flatten={false} className={classNames.rightMask}>
43
+ {content}
44
+ </view>;
45
+ if (placement.includes("left")) content = <view flatten={false} className={classNames.leftMask}>
46
+ {content}
47
+ </view>;
48
+ if (placement.includes("bottom")) content = <view flatten={false} className={classNames.bottomMask}>
49
+ {content}
50
+ </view>;
51
+ if (placement.includes("top")) content = <view flatten={false} className={classNames.topMask}>
52
+ {content}
53
+ </view>;
54
+ return <view {...forwardedRef ? { ref: forwardedRef } : {}} {...rootProps} className={clsx(classNames.root, className)} style={createRootStyle(style, {
55
+ top: topSize,
56
+ bottom: bottomSize,
57
+ left: leftSize,
58
+ right: rightSize
59
+ })}>
60
+ {content}
61
+ </view>;
62
+ });
63
+ ScrollFog.displayName = "ScrollFog";
64
+ //#endregion
65
+ export { ScrollFog };
@@ -0,0 +1,2 @@
1
+ export { ScrollFog, type ScrollFogProps } from './ScrollFog';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollFog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -1,5 +1,5 @@
1
- import { useControllableState } from "../../hooks/useControllableState.js";
2
- import { usePressTap } from "../../hooks/usePressTap.js";
1
+ import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
2
+ import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
3
3
  import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
4
4
  import { mergeProps } from "../../utils/merge-props.js";
5
5
  import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
@@ -0,0 +1,112 @@
1
+ import { BaseEvent } from '@lynx-js/types';
2
+ import { SelectVariantProps } from '@seed-design/lynx-css/recipes/select';
3
+ import { SelectTriggerVariantProps } from '@seed-design/lynx-css/recipes/select-trigger';
4
+ import { SelectItemVariantProps } from '@seed-design/lynx-css/recipes/select-item';
5
+ import { LynxAccessibilityProps, LynxPressableProps, LynxStyledElementProps } from '../../types';
6
+ import { InternalIconProps } from '../Icon/Icon';
7
+ import { Placement as SelectPlacement } from '../private/Positioning';
8
+ import * as React from "@lynx-js/react";
9
+ type SelectPublicVariantProps = Omit<SelectVariantProps, "size" | "open" | "positioned"> & {
10
+ size?: "large" | "medium" | "responsive";
11
+ };
12
+ type SelectTriggerPublicVariantProps = Omit<SelectTriggerVariantProps, "size" | "open" | "pressed" | "disabled" | "readOnly" | "invalid">;
13
+ type SelectItemPublicVariantProps = Omit<SelectItemVariantProps, "size" | "selected" | "pressed" | "disabled">;
14
+ export type SelectOpenChangeReason = "trigger" | "interactOutside" | "itemSelect" | "dismiss";
15
+ export interface SelectOpenChangeDetails {
16
+ reason: SelectOpenChangeReason;
17
+ event: BaseEvent;
18
+ }
19
+ export interface SelectSelectedItem {
20
+ value: string;
21
+ label: React.ReactNode;
22
+ textValue: string;
23
+ prefixIcon?: React.ReactNode;
24
+ resolved: boolean;
25
+ }
26
+ /**
27
+ * @platform Lynx
28
+ *
29
+ * Web-only DOM APIs are intentionally omitted: `asChild`, hidden native select/name/form
30
+ * submission, DOM focus/typeahead/keyboard navigation, and ARIA ids all rely on a browser DOM.
31
+ * Lynx uses native tap, overlay dismissal, `accessibility-*` attributes, and app-owned state.
32
+ */
33
+ export interface SelectRootProps extends SelectPublicVariantProps, SelectTriggerPublicVariantProps, SelectItemPublicVariantProps, LynxStyledElementProps {
34
+ value?: string[];
35
+ defaultValue?: string[];
36
+ onValueChange?: (value: string[]) => void;
37
+ multiple?: boolean;
38
+ open?: boolean;
39
+ defaultOpen?: boolean;
40
+ onOpenChange?: (open: boolean, details: SelectOpenChangeDetails) => void;
41
+ disabled?: boolean;
42
+ readOnly?: boolean;
43
+ invalid?: boolean;
44
+ required?: boolean;
45
+ placement?: SelectPlacement;
46
+ gutter?: number;
47
+ overflowPadding?: number;
48
+ formatValue?: (items: SelectSelectedItem[]) => React.ReactNode;
49
+ }
50
+ export declare const SelectRoot: React.ForwardRefExoticComponent<SelectRootProps & React.RefAttributes<unknown>>;
51
+ export interface SelectTriggerProps extends SelectTriggerPublicVariantProps, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
52
+ placeholder?: React.ReactNode;
53
+ prefixIcon?: React.ReactNode;
54
+ suffixIcon?: React.ReactNode;
55
+ }
56
+ export declare const SelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<unknown>>;
57
+ export interface SelectValueProps extends LynxStyledElementProps {
58
+ }
59
+ export declare const SelectValue: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<unknown>>;
60
+ export interface SelectPlaceholderProps extends LynxStyledElementProps {
61
+ }
62
+ export declare const SelectPlaceholder: React.ForwardRefExoticComponent<SelectPlaceholderProps & React.RefAttributes<unknown>>;
63
+ export interface SelectPrefixIconProps extends Omit<InternalIconProps, "icon" | "deps"> {
64
+ fallback?: React.ReactNode;
65
+ }
66
+ export declare const SelectPrefixIcon: React.ForwardRefExoticComponent<SelectPrefixIconProps & React.RefAttributes<unknown>>;
67
+ export interface SelectSuffixIconProps extends Omit<InternalIconProps, "icon" | "deps"> {
68
+ icon?: React.ReactNode;
69
+ }
70
+ export declare const SelectSuffixIcon: React.ForwardRefExoticComponent<SelectSuffixIconProps & React.RefAttributes<unknown>>;
71
+ export interface SelectContentProps extends LynxStyledElementProps {
72
+ }
73
+ export declare const SelectContent: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<unknown>>;
74
+ /** The viewport is normally owned by SelectContent; use this only for custom content composition. */
75
+ export interface SelectScrollAreaProps extends LynxStyledElementProps {
76
+ }
77
+ export declare const SelectScrollArea: React.ForwardRefExoticComponent<SelectScrollAreaProps & React.RefAttributes<unknown>>;
78
+ export interface SelectGroupProps extends LynxStyledElementProps {
79
+ }
80
+ export declare const SelectGroup: React.ForwardRefExoticComponent<SelectGroupProps & React.RefAttributes<unknown>>;
81
+ export interface SelectGroupLabelProps extends LynxStyledElementProps, LynxAccessibilityProps {
82
+ }
83
+ export declare const SelectGroupLabel: React.ForwardRefExoticComponent<SelectGroupLabelProps & React.RefAttributes<unknown>>;
84
+ export interface SelectItemProps extends SelectItemPublicVariantProps, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
85
+ value: string;
86
+ label?: React.ReactNode;
87
+ textValue?: string;
88
+ prefixIcon?: React.ReactNode;
89
+ disabled?: boolean;
90
+ readOnly?: boolean;
91
+ }
92
+ export declare const SelectItem: React.ForwardRefExoticComponent<SelectItemProps & React.RefAttributes<unknown>>;
93
+ export interface SelectItemPrefixIconProps extends Omit<InternalIconProps, "icon" | "deps"> {
94
+ icon?: React.ReactNode;
95
+ }
96
+ export declare const SelectItemPrefixIcon: React.ForwardRefExoticComponent<SelectItemPrefixIconProps & React.RefAttributes<unknown>>;
97
+ export interface SelectItemBodyProps extends LynxStyledElementProps {
98
+ }
99
+ export declare const SelectItemBody: React.ForwardRefExoticComponent<SelectItemBodyProps & React.RefAttributes<unknown>>;
100
+ export interface SelectItemLabelProps extends LynxStyledElementProps {
101
+ }
102
+ export declare const SelectItemLabel: React.ForwardRefExoticComponent<SelectItemLabelProps & React.RefAttributes<unknown>>;
103
+ export interface SelectItemDescriptionProps extends LynxStyledElementProps {
104
+ }
105
+ export declare const SelectItemDescription: React.ForwardRefExoticComponent<SelectItemDescriptionProps & React.RefAttributes<unknown>>;
106
+ export interface SelectItemIndicatorProps extends Omit<InternalIconProps, "icon" | "deps"> {
107
+ selected?: React.ReactNode;
108
+ unselected?: React.ReactNode;
109
+ }
110
+ export declare const SelectItemIndicator: React.ForwardRefExoticComponent<SelectItemIndicatorProps & React.RefAttributes<unknown>>;
111
+ export {};
112
+ //# sourceMappingURL=Select.d.ts.map
@@ -0,0 +1 @@
1
+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