@seed-design/lynx-react 0.2.0-alpha.3 → 0.3.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 (179) hide show
  1. package/lib/_virtual/_rolldown/runtime.js +13 -0
  2. package/lib/components/ActionButton/ActionButton.d.ts +26 -33
  3. package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
  4. package/lib/components/ActionButton/ActionButton.jsx +139 -120
  5. package/lib/components/ActionButton/index.d.ts +1 -1
  6. package/lib/components/AppBar/AppBar.d.ts +35 -0
  7. package/lib/components/AppBar/AppBar.d.ts.map +1 -0
  8. package/lib/components/AppBar/AppBar.jsx +132 -0
  9. package/lib/components/AppBar/AppBar.namespace.d.ts +2 -0
  10. package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -0
  11. package/lib/components/AppBar/AppBar.namespace.js +15 -0
  12. package/lib/components/AppBar/context.d.ts +13 -0
  13. package/lib/components/AppBar/context.d.ts.map +1 -0
  14. package/lib/components/AppBar/context.js +12 -0
  15. package/lib/components/AppBar/index.d.ts +3 -0
  16. package/lib/components/AppBar/index.d.ts.map +1 -0
  17. package/lib/components/AppBar/useAppBar.d.ts +15 -0
  18. package/lib/components/AppBar/useAppBar.d.ts.map +1 -0
  19. package/lib/components/AppBar/useAppBar.js +72 -0
  20. package/lib/components/Badge/Badge.d.ts +14 -0
  21. package/lib/components/Badge/Badge.d.ts.map +1 -0
  22. package/lib/components/Badge/Badge.jsx +15 -0
  23. package/lib/components/Badge/index.d.ts +2 -0
  24. package/lib/components/Badge/index.d.ts.map +1 -0
  25. package/lib/components/BottomSheet/BottomSheet.d.ts +22 -27
  26. package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  27. package/lib/components/BottomSheet/BottomSheet.jsx +127 -142
  28. package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +1 -1
  29. package/lib/components/BottomSheet/BottomSheet.namespace.js +18 -1
  30. package/lib/components/BottomSheet/index.d.ts +2 -2
  31. package/lib/components/Box/Box.d.ts +20 -0
  32. package/lib/components/Box/Box.d.ts.map +1 -0
  33. package/lib/components/Box/Box.jsx +14 -0
  34. package/lib/components/Box/index.d.ts +2 -0
  35. package/lib/components/Box/index.d.ts.map +1 -0
  36. package/lib/components/Checkbox/Checkbox.d.ts +14 -31
  37. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  38. package/lib/components/Checkbox/Checkbox.jsx +107 -98
  39. package/lib/components/Checkbox/Checkbox.namespace.d.ts +1 -1
  40. package/lib/components/Checkbox/Checkbox.namespace.js +12 -1
  41. package/lib/components/Checkbox/index.d.ts +2 -2
  42. package/lib/components/Icon/Icon.d.ts +37 -0
  43. package/lib/components/Icon/Icon.d.ts.map +1 -0
  44. package/lib/components/Icon/Icon.jsx +143 -0
  45. package/lib/components/Icon/index.d.ts +2 -0
  46. package/lib/components/Icon/index.d.ts.map +1 -0
  47. package/lib/components/ProgressCircle/ProgressCircle.d.ts +4 -8
  48. package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
  49. package/lib/components/ProgressCircle/ProgressCircle.jsx +255 -260
  50. package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +1 -1
  51. package/lib/components/ProgressCircle/ProgressCircle.namespace.js +9 -1
  52. package/lib/components/ProgressCircle/index.d.ts +2 -2
  53. package/lib/components/RadioGroup/RadioGroup.d.ts +12 -29
  54. package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  55. package/lib/components/RadioGroup/RadioGroup.jsx +134 -118
  56. package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +1 -1
  57. package/lib/components/RadioGroup/RadioGroup.namespace.js +12 -1
  58. package/lib/components/RadioGroup/index.d.ts +2 -2
  59. package/lib/components/Stack/Stack.d.ts +33 -0
  60. package/lib/components/Stack/Stack.d.ts.map +1 -0
  61. package/lib/components/Stack/Stack.jsx +39 -0
  62. package/lib/components/Stack/index.d.ts +2 -0
  63. package/lib/components/Stack/index.d.ts.map +1 -0
  64. package/lib/components/Switch/Switch.d.ts +8 -14
  65. package/lib/components/Switch/Switch.d.ts.map +1 -1
  66. package/lib/components/Switch/Switch.jsx +82 -56
  67. package/lib/components/Switch/Switch.namespace.d.ts +1 -1
  68. package/lib/components/Switch/Switch.namespace.js +11 -1
  69. package/lib/components/Switch/index.d.ts +2 -2
  70. package/lib/components/TagGroup/TagGroup.d.ts +8 -14
  71. package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
  72. package/lib/components/TagGroup/TagGroup.jsx +42 -39
  73. package/lib/components/TagGroup/TagGroup.namespace.d.ts +1 -1
  74. package/lib/components/TagGroup/TagGroup.namespace.js +10 -1
  75. package/lib/components/TagGroup/index.d.ts +2 -2
  76. package/lib/components/Text/Text.d.ts +7 -0
  77. package/lib/components/Text/Text.d.ts.map +1 -0
  78. package/lib/components/Text/Text.jsx +28 -0
  79. package/lib/components/Text/index.d.ts +2 -0
  80. package/lib/components/Text/index.d.ts.map +1 -0
  81. package/lib/components/index.d.ts +13 -7
  82. package/lib/components/index.d.ts.map +1 -1
  83. package/lib/hooks/index.d.ts +5 -3
  84. package/lib/hooks/index.d.ts.map +1 -1
  85. package/lib/hooks/useControllableState.js +23 -23
  86. package/lib/hooks/useIconColor.d.ts +6 -3
  87. package/lib/hooks/useIconColor.d.ts.map +1 -1
  88. package/lib/hooks/useIconColor.js +34 -37
  89. package/lib/hooks/usePressTap.d.ts +11 -8
  90. package/lib/hooks/usePressTap.d.ts.map +1 -1
  91. package/lib/hooks/usePressTap.js +31 -31
  92. package/lib/hooks/useSafeArea.d.ts +19 -0
  93. package/lib/hooks/useSafeArea.d.ts.map +1 -0
  94. package/lib/hooks/useSafeArea.js +33 -0
  95. package/lib/hooks/useSeedClassName.d.ts +27 -0
  96. package/lib/hooks/useSeedClassName.d.ts.map +1 -0
  97. package/lib/hooks/useSeedClassName.js +32 -0
  98. package/lib/index.d.ts +4 -3
  99. package/lib/index.d.ts.map +1 -1
  100. package/lib/index.js +30 -3
  101. package/lib/types.d.ts +51 -0
  102. package/lib/types.d.ts.map +1 -0
  103. package/lib/utils/children.d.ts +3 -0
  104. package/lib/utils/children.d.ts.map +1 -0
  105. package/lib/utils/children.js +8 -0
  106. package/lib/utils/create-slot-recipe-context.d.ts +13 -12
  107. package/lib/utils/create-slot-recipe-context.d.ts.map +1 -1
  108. package/lib/utils/create-slot-recipe-context.jsx +88 -70
  109. package/lib/utils/get-seed-class-name.d.ts +9 -7
  110. package/lib/utils/get-seed-class-name.d.ts.map +1 -1
  111. package/lib/utils/get-seed-class-name.js +29 -37
  112. package/lib/utils/index.d.ts +4 -4
  113. package/lib/utils/resolve-recipe-token.js +45 -43
  114. package/lib/utils/split-multiple-variants-props.js +32 -32
  115. package/lib/utils/styled.d.ts +83 -0
  116. package/lib/utils/styled.d.ts.map +1 -0
  117. package/lib/utils/styled.js +144 -0
  118. package/package.json +10 -9
  119. package/src/components/ActionButton/ActionButton.test.tsx +167 -0
  120. package/src/components/ActionButton/ActionButton.tsx +210 -169
  121. package/src/components/AppBar/AppBar.namespace.ts +18 -0
  122. package/src/components/AppBar/AppBar.test.tsx +270 -0
  123. package/src/components/AppBar/AppBar.tsx +288 -0
  124. package/src/components/AppBar/context.ts +27 -0
  125. package/src/components/AppBar/index.ts +21 -0
  126. package/src/components/AppBar/useAppBar.ts +100 -0
  127. package/src/components/Badge/Badge.test.tsx +54 -0
  128. package/src/components/Badge/Badge.tsx +32 -0
  129. package/src/components/Badge/index.ts +1 -0
  130. package/src/components/BottomSheet/BottomSheet.test.tsx +219 -0
  131. package/src/components/BottomSheet/BottomSheet.tsx +120 -83
  132. package/src/components/Box/Box.test.tsx +85 -0
  133. package/src/components/Box/Box.tsx +39 -0
  134. package/src/components/Box/index.ts +1 -0
  135. package/src/components/Checkbox/Checkbox.tsx +106 -116
  136. package/src/components/Icon/Icon.tsx +265 -0
  137. package/src/components/Icon/index.ts +8 -0
  138. package/src/components/ProgressCircle/ProgressCircle.tsx +39 -25
  139. package/src/components/RadioGroup/RadioGroup.tsx +98 -117
  140. package/src/components/Stack/Stack.tsx +97 -0
  141. package/src/components/Stack/index.ts +1 -0
  142. package/src/components/Switch/Switch.tsx +59 -50
  143. package/src/components/TagGroup/TagGroup.tsx +27 -25
  144. package/src/components/Text/Text.tsx +64 -0
  145. package/src/components/Text/index.ts +1 -0
  146. package/src/components/index.ts +6 -0
  147. package/src/hooks/index.ts +2 -0
  148. package/src/hooks/{__tests__/useControllableState.test.ts → useControllableState.test.ts} +1 -1
  149. package/src/hooks/{__tests__/useIconColor.test.ts → useIconColor.test.ts} +1 -1
  150. package/src/hooks/useIconColor.ts +22 -12
  151. package/src/hooks/{__tests__/usePressTap.test.ts → usePressTap.test.ts} +1 -1
  152. package/src/hooks/usePressTap.ts +14 -10
  153. package/src/hooks/useSafeArea.test.ts +83 -0
  154. package/src/hooks/useSafeArea.ts +56 -0
  155. package/src/hooks/useSeedClassName.ts +35 -0
  156. package/src/index.ts +1 -0
  157. package/src/types.ts +76 -0
  158. package/src/utils/children.ts +13 -0
  159. package/src/utils/create-slot-recipe-context.test.tsx +96 -0
  160. package/src/utils/create-slot-recipe-context.tsx +55 -15
  161. package/src/utils/get-seed-class-name.ts +10 -12
  162. package/src/utils/{__tests__/split-multiple-variants-props.test.ts → split-multiple-variants-props.test.ts} +1 -1
  163. package/src/utils/styled.ts +442 -0
  164. package/lib/components/ActionButton/index.js +0 -1
  165. package/lib/components/BottomSheet/index.js +0 -2
  166. package/lib/components/Checkbox/index.js +0 -2
  167. package/lib/components/ProgressCircle/index.js +0 -2
  168. package/lib/components/RadioGroup/index.js +0 -2
  169. package/lib/components/Switch/index.js +0 -2
  170. package/lib/components/TagGroup/index.js +0 -2
  171. package/lib/components/index.js +0 -7
  172. package/lib/hooks/index.js +0 -3
  173. package/lib/utils/index.js +0 -4
  174. package/src/components/ActionButton/__tests__/ActionButton.test.tsx +0 -35
  175. package/src/components/BottomSheet/__tests__/BottomSheet.test.tsx +0 -119
  176. package/src/components/__tests__/ProgressCircle.test.ts +0 -33
  177. package/src/components/__tests__/exports.test.ts +0 -38
  178. package/src/components/__tests__/switch.test.ts +0 -34
  179. package/src/utils/__tests__/create-slot-recipe-context.test.tsx +0 -228
@@ -1 +1,11 @@
1
- export { SwitchControl as Control, SwitchLabel as Label, SwitchRoot as Root, SwitchThumb as Thumb, } from "./Switch";
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+ import { SwitchControl, SwitchLabel, SwitchRoot, SwitchThumb } from "./Switch.jsx";
3
+ //#region src/components/Switch/Switch.namespace.ts
4
+ var Switch_namespace_exports = /* @__PURE__ */ __exportAll({
5
+ Control: () => SwitchControl,
6
+ Label: () => SwitchLabel,
7
+ Root: () => SwitchRoot,
8
+ Thumb: () => SwitchThumb
9
+ });
10
+ //#endregion
11
+ export { Switch_namespace_exports };
@@ -1,3 +1,3 @@
1
- export { SwitchRoot, SwitchControl, SwitchThumb, SwitchLabel, type SwitchRootProps, type SwitchControlProps, type SwitchThumbProps, type SwitchLabelProps, } from "./Switch";
2
- export * as Switch from "./Switch.namespace";
1
+ export { SwitchRoot, SwitchControl, SwitchThumb, SwitchLabel, type SwitchRootProps, type SwitchControlProps, type SwitchThumbProps, type SwitchLabelProps, } from './Switch';
2
+ export * as Switch from './Switch.namespace';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,8 @@
1
- import * as React from "react";
2
- import { type TagGroupVariantProps } from "@seed-design/lynx-css/recipes/tag-group";
3
- import { type TagGroupItemVariantProps } from "@seed-design/lynx-css/recipes/tag-group-item";
1
+ import { TagGroupVariantProps } from '@seed-design/lynx-css/recipes/tag-group';
2
+ import { TagGroupItemVariantProps } from '@seed-design/lynx-css/recipes/tag-group-item';
3
+ import { LynxStyledElementProps } from '../../types';
4
+ import { StyleProps } from '../../utils/styled';
5
+ import * as React from "@lynx-js/react";
4
6
  /**
5
7
  * @platform Lynx
6
8
  *
@@ -8,12 +10,9 @@ import { type TagGroupItemVariantProps } from "@seed-design/lynx-css/recipes/tag
8
10
  * - `truncate` prop: Lynx flex 모델에서는 item 단위 wrap만 가능해 웹 수준의
9
11
  * "한 줄 유지 + label ellipsis" 조합을 재현할 수 없음
10
12
  * - `asChild` prop: Lynx Slot 미지원
11
- * - `flexShrink` prop: CSS variable 동적 주입 제한
12
13
  * - 아이콘 slot: Lynx 3.7 SVG 지원 후 검토 (Tier B)
13
14
  */
14
- export interface TagGroupRootProps extends TagGroupVariantProps, TagGroupItemVariantProps {
15
- children?: React.ReactNode;
16
- className?: string;
15
+ export interface TagGroupRootProps extends TagGroupVariantProps, TagGroupItemVariantProps, LynxStyledElementProps {
17
16
  /**
18
17
  * children 사이에 삽입되는 구분자. 기본값 `" · "`.
19
18
  */
@@ -25,16 +24,11 @@ export declare const TagGroupRoot: React.ForwardRefExoticComponent<TagGroupRootP
25
24
  *
26
25
  * 웹 대비 미지원 기능:
27
26
  * - `asChild` prop: Lynx Slot 미지원
28
- * - `flexShrink` prop: CSS variable 동적 주입 제한
29
27
  */
30
- export interface TagGroupItemProps extends TagGroupItemVariantProps {
31
- children?: React.ReactNode;
32
- className?: string;
28
+ export interface TagGroupItemProps extends TagGroupItemVariantProps, Pick<StyleProps, "flexShrink">, LynxStyledElementProps {
33
29
  }
34
30
  export declare const TagGroupItem: React.ForwardRefExoticComponent<TagGroupItemProps & React.RefAttributes<unknown>>;
35
- export interface TagGroupItemLabelProps {
36
- children?: React.ReactNode;
37
- className?: string;
31
+ export interface TagGroupItemLabelProps extends LynxStyledElementProps {
38
32
  }
39
33
  export declare const TagGroupItemLabel: React.ForwardRefExoticComponent<TagGroupItemLabelProps & React.RefAttributes<unknown>>;
40
34
  //# sourceMappingURL=TagGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC9F,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8CAA8C,CAAC;AAQtD;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB,EAAE,wBAAwB;IACvF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,mFAsCvB,CAAC;AAGH;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,YAAY,mFAiBvB,CAAC;AAGH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,wFAY5B,CAAC"}
1
+ {"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC9F,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAA4B,MAAM,aAAa,CAAC;AAIpF,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOpE;;;;;;;;GAQG;AACH,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,wBAAwB,EACxB,sBAAsB;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,mFAiCvB,CAAC;AAKH;;;;;GAKG;AACH,MAAM,WAAW,iBACf,SAAQ,wBAAwB,EAC9B,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAC9B,sBAAsB;CAAG;AAE7B,eAAO,MAAM,YAAY,mFAmBvB,CAAC;AAKH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;CAAG;AAEzE,eAAO,MAAM,iBAAiB,wFAY5B,CAAC"}
@@ -1,54 +1,57 @@
1
- import * as React from "react";
1
+ import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
2
+ import { toArray } from "../../utils/children.js";
3
+ import { useStyleProps } from "../../utils/styled.js";
4
+ import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
2
5
  import clsx from "clsx";
6
+ import * as React from "@lynx-js/react";
3
7
  import { tagGroup } from "@seed-design/lynx-css/recipes/tag-group";
4
- import { tagGroupItem, } from "@seed-design/lynx-css/recipes/tag-group-item";
5
- import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context";
6
- import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props";
7
- const { PropsProvider, useProps, ClassNamesProvider, useClassNames } = createSlotRecipeContext(tagGroupItem);
8
- export const TagGroupRoot = React.forwardRef((props, ref) => {
9
- const [{ tagGroup: tagGroupVariantProps, tagGroupItem: tagGroupItemVariantProps }, otherProps] = splitMultipleVariantsProps(props, { tagGroup, tagGroupItem });
10
- const { children, className, separator = " · ", ...nativeProps } = otherProps;
11
- const classes = tagGroup(tagGroupVariantProps);
12
- const visibleChildren = React.Children.toArray(children);
13
- return (<PropsProvider value={tagGroupItemVariantProps}>
14
- <view {...(ref ? { ref: ref } : {})} className={clsx(classes.root, className)} {...nativeProps}>
8
+ import { tagGroupItem } from "@seed-design/lynx-css/recipes/tag-group-item";
9
+ //#region src/components/TagGroup/TagGroup.tsx
10
+ var { PropsProvider, useProps, ClassNamesProvider, useClassNames } = createSlotRecipeContext(tagGroupItem);
11
+ var TagGroupRoot = React.forwardRef((props, ref) => {
12
+ const [{ tagGroup: tagGroupVariantProps, tagGroupItem: tagGroupItemVariantProps }, otherProps] = splitMultipleVariantsProps(props, {
13
+ tagGroup,
14
+ tagGroupItem
15
+ });
16
+ const { children, className, separator = " · ", ...nativeProps } = otherProps;
17
+ const classes = tagGroup(tagGroupVariantProps);
18
+ const visibleChildren = toArray(children);
19
+ return <PropsProvider value={tagGroupItemVariantProps}>
20
+ <view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
15
21
  {visibleChildren.map((child, index) => {
16
- if (index === 0)
17
- return child;
18
- // Lynx <text> separator는 개별 flex item이라 wrap이 발동하면 separator가
19
- // 이전 row 끝에 남는다. separator와 뒤따르는 item을 하나의 flex-row wrapper로
20
- // 묶어 같은 wrap 단위로 함께 이동시킨다.
21
- return (<view key={child.key ?? index} style={{
22
- display: "flex",
23
- flexDirection: "row",
24
- alignItems: "center",
25
- flexShrink: 0,
26
- }}>
22
+ if (index === 0) return child;
23
+ return <view key={child.key ?? index} className={classes.separatorWrapper}>
27
24
  <text className={classes.separator}>{separator}</text>
28
25
  {child}
29
- </view>);
30
- })}
26
+ </view>;
27
+ })}
31
28
  </view>
32
- </PropsProvider>);
29
+ </PropsProvider>;
33
30
  });
34
31
  TagGroupRoot.displayName = "TagGroupRoot";
35
- export const TagGroupItem = React.forwardRef((props, ref) => {
36
- const parentVariantProps = useProps();
37
- const [localVariantProps, otherProps] = tagGroupItem.splitVariantProps(props);
38
- const classes = tagGroupItem({ ...parentVariantProps, ...localVariantProps });
39
- const { children, className, ...nativeProps } = otherProps;
40
- return (<ClassNamesProvider value={classes}>
41
- <view {...(ref ? { ref: ref } : {})} className={clsx(classes.root, className)} {...nativeProps}>
32
+ var TagGroupItem = React.forwardRef((props, ref) => {
33
+ const parentVariantProps = useProps();
34
+ const [localVariantProps, otherProps] = tagGroupItem.splitVariantProps(props);
35
+ const classes = tagGroupItem({
36
+ ...parentVariantProps,
37
+ ...localVariantProps
38
+ });
39
+ const { style, restProps } = useStyleProps(otherProps);
40
+ const { children, className, ...nativeProps } = restProps;
41
+ return <ClassNamesProvider value={classes}>
42
+ <view {...ref ? { ref } : {}} className={clsx(classes.root, className)} style={style} {...nativeProps}>
42
43
  {children}
43
44
  </view>
44
- </ClassNamesProvider>);
45
+ </ClassNamesProvider>;
45
46
  });
46
47
  TagGroupItem.displayName = "TagGroupItem";
47
- export const TagGroupItemLabel = React.forwardRef((props, ref) => {
48
- const classes = useClassNames();
49
- const { children, className, ...nativeProps } = props;
50
- return (<text {...(ref ? { ref: ref } : {})} className={clsx(classes.label, className)} {...nativeProps}>
48
+ var TagGroupItemLabel = React.forwardRef((props, ref) => {
49
+ const classes = useClassNames();
50
+ const { children, className, ...nativeProps } = props;
51
+ return <text {...ref ? { ref } : {}} className={clsx(classes.label, className)} {...nativeProps}>
51
52
  {children}
52
- </text>);
53
+ </text>;
53
54
  });
54
55
  TagGroupItemLabel.displayName = "TagGroupItemLabel";
56
+ //#endregion
57
+ export { TagGroupItem, TagGroupItemLabel, TagGroupRoot };
@@ -1,2 +1,2 @@
1
- export { TagGroupItem as Item, TagGroupItemLabel as ItemLabel, TagGroupRoot as Root, type TagGroupItemLabelProps as ItemLabelProps, type TagGroupItemProps as ItemProps, type TagGroupRootProps as RootProps, } from "./TagGroup";
1
+ export { TagGroupItem as Item, TagGroupItemLabel as ItemLabel, TagGroupRoot as Root, type TagGroupItemLabelProps as ItemLabelProps, type TagGroupItemProps as ItemProps, type TagGroupRootProps as RootProps, } from './TagGroup';
2
2
  //# sourceMappingURL=TagGroup.namespace.d.ts.map
@@ -1 +1,10 @@
1
- export { TagGroupItem as Item, TagGroupItemLabel as ItemLabel, TagGroupRoot as Root, } from "./TagGroup";
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+ import { TagGroupItem, TagGroupItemLabel, TagGroupRoot } from "./TagGroup.jsx";
3
+ //#region src/components/TagGroup/TagGroup.namespace.ts
4
+ var TagGroup_namespace_exports = /* @__PURE__ */ __exportAll({
5
+ Item: () => TagGroupItem,
6
+ ItemLabel: () => TagGroupItemLabel,
7
+ Root: () => TagGroupRoot
8
+ });
9
+ //#endregion
10
+ export { TagGroup_namespace_exports };
@@ -1,3 +1,3 @@
1
- export { TagGroupRoot, TagGroupItem, TagGroupItemLabel, type TagGroupRootProps, type TagGroupItemProps, type TagGroupItemLabelProps, } from "./TagGroup";
2
- export * as TagGroup from "./TagGroup.namespace";
1
+ export { TagGroupRoot, TagGroupItem, TagGroupItemLabel, type TagGroupRootProps, type TagGroupItemProps, type TagGroupItemLabelProps, } from './TagGroup';
2
+ export * as TagGroup from './TagGroup.namespace';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { TextStyleProps } from '../../utils/styled';
2
+ import { LynxStyledElementProps } from '../../types';
3
+ import * as React from "@lynx-js/react";
4
+ export interface TextProps extends TextStyleProps, LynxStyledElementProps {
5
+ }
6
+ export declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<unknown>>;
7
+ //# sourceMappingURL=Text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAYvE,MAAM,WAAW,SAAU,SAAQ,cAAc,EAAE,sBAAsB;CAAG;AAE5E,eAAO,MAAM,IAAI,2EAkCf,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { handleColor, handleFontSize, handleFontWeight, handleLineHeight } from "../../utils/styled.js";
2
+ import { typography } from "@seed-design/lynx-css/vars/component";
3
+ import clsx from "clsx";
4
+ import * as React from "@lynx-js/react";
5
+ //#region src/components/Text/Text.tsx
6
+ function capitalize(value) {
7
+ return value.charAt(0).toUpperCase() + value.slice(1);
8
+ }
9
+ function getTypographyStyle(textStyle) {
10
+ return typography[`textStyle${capitalize(textStyle ?? "t5Regular")}`].enabled.root;
11
+ }
12
+ var Text = React.forwardRef((props, ref) => {
13
+ const { color, textStyle, fontSize, lineHeight, fontWeight, align, children, className, style, ...nativeProps } = props;
14
+ const typographyStyle = getTypographyStyle(textStyle);
15
+ return <text {...ref ? { ref } : {}} {...nativeProps} className={clsx(className)} style={{
16
+ color: handleColor(color),
17
+ fontSize: handleFontSize(fontSize) ?? typographyStyle.fontSize,
18
+ lineHeight: handleLineHeight(lineHeight ?? fontSize) ?? typographyStyle.lineHeight,
19
+ fontWeight: handleFontWeight(fontWeight) ?? typographyStyle.fontWeight,
20
+ textAlign: align,
21
+ ...style
22
+ }}>
23
+ {children}
24
+ </text>;
25
+ });
26
+ Text.displayName = "Text";
27
+ //#endregion
28
+ export { Text };
@@ -0,0 +1,2 @@
1
+ export { Text, type TextProps } from './Text';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,8 +1,14 @@
1
- export * from "./ActionButton";
2
- export * from "./BottomSheet";
3
- export * from "./Checkbox";
4
- export * from "./ProgressCircle";
5
- export * from "./RadioGroup";
6
- export * from "./Switch";
7
- export * from "./TagGroup";
1
+ export * from './ActionButton';
2
+ export * from './AppBar';
3
+ export * from './Badge';
4
+ export * from './Box';
5
+ export * from './BottomSheet';
6
+ export * from './Checkbox';
7
+ export * from './Icon';
8
+ export * from './ProgressCircle';
9
+ export * from './RadioGroup';
10
+ export * from './Stack';
11
+ export * from './Switch';
12
+ export * from './TagGroup';
13
+ export * from './Text';
8
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
@@ -1,4 +1,6 @@
1
- export * from "./useControllableState";
2
- export * from "./useIconColor";
3
- export * from "./usePressTap";
1
+ export * from './useControllableState';
2
+ export * from './useIconColor';
3
+ export * from './usePressTap';
4
+ export * from './useSafeArea';
5
+ export * from './useSeedClassName';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
@@ -1,27 +1,27 @@
1
1
  import { useRef, useState } from "@lynx-js/react";
2
2
  import { useMemoizedFn } from "@lynx-js/lynx-ui-common";
3
+ //#region src/hooks/useControllableState.ts
3
4
  /**
4
- * Controlled/uncontrolled state pattern for Lynx components.
5
- *
6
- * - When `value` is provided, the component is controlled.
7
- * - When `value` is `undefined`, the component manages its own state
8
- * starting from `defaultValue`.
9
- * - `onChange` fires in both modes.
10
- */
11
- export function useControllableState(props) {
12
- const { value, defaultValue, onChange } = props;
13
- const isControlled = value !== undefined;
14
- const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
15
- const currentValue = isControlled ? value : uncontrolledValue;
16
- const prevValueRef = useRef(currentValue);
17
- const setValue = useMemoizedFn((nextValue) => {
18
- if (!isControlled) {
19
- setUncontrolledValue(nextValue);
20
- }
21
- if (nextValue !== prevValueRef.current) {
22
- onChange?.(nextValue);
23
- prevValueRef.current = nextValue;
24
- }
25
- });
26
- return [currentValue, setValue];
5
+ * Controlled/uncontrolled state pattern for Lynx components.
6
+ *
7
+ * - When `value` is provided, the component is controlled.
8
+ * - When `value` is `undefined`, the component manages its own state
9
+ * starting from `defaultValue`.
10
+ * - `onChange` fires in both modes.
11
+ */
12
+ function useControllableState(props) {
13
+ const { value, defaultValue, onChange } = props;
14
+ const isControlled = value !== void 0;
15
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
16
+ const currentValue = isControlled ? value : uncontrolledValue;
17
+ const prevValueRef = useRef(currentValue);
18
+ return [currentValue, useMemoizedFn((nextValue) => {
19
+ if (!isControlled) setUncontrolledValue(nextValue);
20
+ if (nextValue !== prevValueRef.current) {
21
+ onChange?.(nextValue);
22
+ prevValueRef.current = nextValue;
23
+ }
24
+ })];
27
25
  }
26
+ //#endregion
27
+ export { useControllableState };
@@ -1,5 +1,8 @@
1
- import type { MainThread } from "@lynx-js/types";
2
- import type { DependencyList, RefObject } from "react";
1
+ import { MainThread } from '@lynx-js/types';
2
+ import { DependencyList, RefObject } from '@lynx-js/react';
3
+ export interface UseIconColorOptions {
4
+ sourceRef?: RefObject<MainThread.Element>;
5
+ }
3
6
  /**
4
7
  * Lynx `<image>` 의 tint color 를 recipe 의 CSS `color` 로부터 main-thread 에서 읽어
5
8
  * `tint-color` attribute 로 mirror. `deps` 가 바뀌면 재동기화.
@@ -9,7 +12,7 @@ import type { DependencyList, RefObject } from "react";
9
12
  * return cloneElement(iconChild, iconColorProps);
10
13
  * ```
11
14
  */
12
- export declare function useIconColor(deps: DependencyList): {
15
+ export declare function useIconColor(deps: DependencyList, options?: UseIconColorOptions): {
13
16
  ref: RefObject<MainThread.Element>;
14
17
  "main-thread:binduiappear": () => void;
15
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useIconColor.d.ts","sourceRoot":"","sources":["../../src/hooks/useIconColor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA4BvD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG;IAClD,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACnC,0BAA0B,EAAE,MAAM,IAAI,CAAC;CACxC,CAcA"}
1
+ {"version":3,"file":"useIconColor.d.ts","sourceRoot":"","sources":["../../src/hooks/useIconColor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOhE,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;CAC3C;AAyBD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,cAAc,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B;IACD,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACnC,0BAA0B,EAAE,MAAM,IAAI,CAAC;CACxC,CAeA"}
@@ -1,41 +1,38 @@
1
1
  import { runOnMainThread, useEffect, useMainThreadRef } from "@lynx-js/react";
2
- // Lynx `<image>` 의 `tint-color` attribute 에 CSS variable 문자열을 직접 넣는 경로는
3
- // 안정적으로 동작하지 않는다. CSS `color` 는 computed style 로 resolved color 를 읽을 수
4
- // 있으므로 main-thread 에서 한 번 읽어 `tint-color` 로 mirror 한다.
5
- function syncTintColor(ref) {
6
- "main thread";
7
- const el = ref.current;
8
- if (!el)
9
- return;
10
- let color;
11
- if (typeof el.getComputedStyleProperty === "function") {
12
- color = el.getComputedStyleProperty("color");
13
- }
14
- else if (typeof el.getComputedCssProperty === "function") {
15
- color = el.getComputedCssProperty("color");
16
- }
17
- if (color) {
18
- el.setAttribute("tint-color", color);
19
- }
2
+ //#region src/hooks/useIconColor.ts
3
+ function syncTintColor(targetRef, sourceRef) {
4
+ "main thread";
5
+ const target = targetRef.current;
6
+ if (!target) return;
7
+ const source = sourceRef?.current ?? target;
8
+ let color;
9
+ if (typeof source.getComputedStyleProperty === "function") color = source.getComputedStyleProperty("color");
10
+ else if (typeof source.getComputedCssProperty === "function") color = source.getComputedCssProperty("color");
11
+ if (color) target.setAttribute("tint-color", color);
20
12
  }
21
13
  /**
22
- * Lynx `<image>` 의 tint color 를 recipe 의 CSS `color` 로부터 main-thread 에서 읽어
23
- * `tint-color` attribute 로 mirror. `deps` 가 바뀌면 재동기화.
24
- *
25
- * ```tsx
26
- * const iconColorProps = useIconColor([variant, disabled, loading]);
27
- * return cloneElement(iconChild, iconColorProps);
28
- * ```
29
- */
30
- export function useIconColor(deps) {
31
- const ref = useMainThreadRef(null);
32
- function syncOnUiAppear() {
33
- "main thread";
34
- syncTintColor(ref);
35
- }
36
- // deps 는 caller 가 책임.
37
- useEffect(() => {
38
- runOnMainThread(syncTintColor)(ref);
39
- }, deps);
40
- return { ref, "main-thread:binduiappear": syncOnUiAppear };
14
+ * Lynx `<image>` 의 tint color 를 recipe 의 CSS `color` 로부터 main-thread 에서 읽어
15
+ * `tint-color` attribute 로 mirror. `deps` 가 바뀌면 재동기화.
16
+ *
17
+ * ```tsx
18
+ * const iconColorProps = useIconColor([variant, disabled, loading]);
19
+ * return cloneElement(iconChild, iconColorProps);
20
+ * ```
21
+ */
22
+ function useIconColor(deps, options) {
23
+ const ref = useMainThreadRef(null);
24
+ const sourceRef = options?.sourceRef;
25
+ function syncOnUiAppear() {
26
+ "main thread";
27
+ syncTintColor(ref, sourceRef);
28
+ }
29
+ useEffect(() => {
30
+ runOnMainThread(syncTintColor)(ref, sourceRef);
31
+ }, deps);
32
+ return {
33
+ ref,
34
+ "main-thread:binduiappear": syncOnUiAppear
35
+ };
41
36
  }
37
+ //#endregion
38
+ export { useIconColor };
@@ -1,16 +1,18 @@
1
- import type { TouchEvent } from "@lynx-js/types";
1
+ import { BaseTouchEvent, EventHandler, Target } from '@lynx-js/types';
2
+ import { LynxTouchProps } from '../types';
3
+ type TouchHandler = EventHandler<BaseTouchEvent<Target>>;
2
4
  export interface UsePressTapOptions {
3
5
  disabled?: boolean;
4
- onTap?: () => void;
5
- mainThreadOnTap?: () => void;
6
+ onTap?: TouchHandler;
7
+ mainThreadOnTap?: LynxTouchProps["main-thread:bindtap"];
6
8
  }
7
9
  export interface UsePressTapReturn {
8
10
  pressed: boolean;
9
- bindtap: (e: TouchEvent) => void;
10
- bindtouchstart: (e: TouchEvent) => void;
11
- bindtouchend: (e: TouchEvent) => void;
12
- bindtouchcancel: (e: TouchEvent) => void;
13
- "main-thread:bindtap"?: () => void;
11
+ bindtap: TouchHandler;
12
+ bindtouchstart: TouchHandler;
13
+ bindtouchend: TouchHandler;
14
+ bindtouchcancel: TouchHandler;
15
+ "main-thread:bindtap"?: LynxTouchProps["main-thread:bindtap"];
14
16
  }
15
17
  /**
16
18
  * Hook that provides press/tap interaction state for Lynx elements.
@@ -21,4 +23,5 @@ export interface UsePressTapReturn {
21
23
  * - `main-thread:bindtap` is conditionally included (only when enabled and provided).
22
24
  */
23
25
  export declare function usePressTap(options?: UsePressTapOptions): UsePressTapReturn;
26
+ export {};
24
27
  //# sourceMappingURL=usePressTap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePressTap.d.ts","sourceRoot":"","sources":["../../src/hooks/usePressTap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACjC,cAAc,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,eAAe,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,iBAAiB,CA0B/E"}
1
+ {"version":3,"file":"usePressTap.d.ts","sourceRoot":"","sources":["../../src/hooks/usePressTap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,KAAK,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,eAAe,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,cAAc,EAAE,YAAY,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,YAAY,CAAC;IAC9B,qBAAqB,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CAC/D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,iBAAiB,CA0B/E"}
@@ -1,35 +1,35 @@
1
1
  import { useState } from "@lynx-js/react";
2
2
  import { useMemoizedFn } from "@lynx-js/lynx-ui-common";
3
+ //#region src/hooks/usePressTap.ts
3
4
  /**
4
- * Hook that provides press/tap interaction state for Lynx elements.
5
- *
6
- * - Tracks `pressed` state via touch events.
7
- * - When `disabled` is true, the element cannot become active and no tap fires.
8
- * - If the element becomes disabled during a press, the active state is cleared.
9
- * - `main-thread:bindtap` is conditionally included (only when enabled and provided).
10
- */
11
- export function usePressTap(options = {}) {
12
- const { disabled = false, onTap, mainThreadOnTap } = options;
13
- const [pressed, setPressed] = useState(false);
14
- const press = useMemoizedFn(() => {
15
- if (disabled)
16
- return;
17
- setPressed(true);
18
- });
19
- const reset = useMemoizedFn(() => {
20
- setPressed(false);
21
- });
22
- const handleTap = useMemoizedFn(() => {
23
- if (disabled)
24
- return;
25
- onTap?.();
26
- });
27
- return {
28
- pressed,
29
- bindtap: handleTap,
30
- bindtouchstart: press,
31
- bindtouchend: reset,
32
- bindtouchcancel: reset,
33
- ...(!disabled && mainThreadOnTap ? { "main-thread:bindtap": mainThreadOnTap } : {}),
34
- };
5
+ * Hook that provides press/tap interaction state for Lynx elements.
6
+ *
7
+ * - Tracks `pressed` state via touch events.
8
+ * - When `disabled` is true, the element cannot become active and no tap fires.
9
+ * - If the element becomes disabled during a press, the active state is cleared.
10
+ * - `main-thread:bindtap` is conditionally included (only when enabled and provided).
11
+ */
12
+ function usePressTap(options = {}) {
13
+ const { disabled = false, onTap, mainThreadOnTap } = options;
14
+ const [pressed, setPressed] = useState(false);
15
+ const press = useMemoizedFn(() => {
16
+ if (disabled) return;
17
+ setPressed(true);
18
+ });
19
+ const reset = useMemoizedFn(() => {
20
+ setPressed(false);
21
+ });
22
+ return {
23
+ pressed,
24
+ bindtap: useMemoizedFn((...args) => {
25
+ if (disabled) return;
26
+ onTap?.(...args);
27
+ }),
28
+ bindtouchstart: press,
29
+ bindtouchend: reset,
30
+ bindtouchcancel: reset,
31
+ ...!disabled && mainThreadOnTap ? { "main-thread:bindtap": mainThreadOnTap } : {}
32
+ };
35
33
  }
34
+ //#endregion
35
+ export { usePressTap };
@@ -0,0 +1,19 @@
1
+ declare module "@lynx-js/types" {
2
+ interface GlobalProps {
3
+ safeAreaInsetTop?: number;
4
+ safeAreaInsetBottom?: number;
5
+ }
6
+ }
7
+ export interface UseSafeAreaReturn {
8
+ safeAreaInsetTop: string;
9
+ safeAreaInsetBottom: string;
10
+ }
11
+ /**
12
+ * Lynx 앱에서 top/bottom safe area inset 값을 반환합니다.
13
+ *
14
+ * `lynx.__globalProps.safeAreaInsetTop`과 `safeAreaInsetBottom`을 우선 사용하고,
15
+ * host가 값을 제공하지 않으면 Lynx CSS `env(safe-area-inset-*)` 값을 fallback으로
16
+ * 반환합니다.
17
+ */
18
+ export declare function useSafeArea(): UseSafeAreaReturn;
19
+ //# sourceMappingURL=useSafeArea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSafeArea.d.ts","sourceRoot":"","sources":["../../src/hooks/useSafeArea.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,WAAW;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B;CACF;AAuBD,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAW/C"}
@@ -0,0 +1,33 @@
1
+ import { useMemo } from "@lynx-js/react";
2
+ //#region src/hooks/useSafeArea.ts
3
+ var safeAreaProp = {
4
+ top: "safeAreaInsetTop",
5
+ bottom: "safeAreaInsetBottom"
6
+ };
7
+ function getSafeAreaEnvInset(edge) {
8
+ return `env(safe-area-inset-${edge})`;
9
+ }
10
+ function normalizeSafeAreaValue(value) {
11
+ if (typeof value !== "number" || value <= 0 || !Number.isFinite(value)) return;
12
+ return `${value}px`;
13
+ }
14
+ function resolveSafeAreaInset(edge, value) {
15
+ return normalizeSafeAreaValue(value) ?? getSafeAreaEnvInset(edge);
16
+ }
17
+ /**
18
+ * Lynx 앱에서 top/bottom safe area inset 값을 반환합니다.
19
+ *
20
+ * `lynx.__globalProps.safeAreaInsetTop`과 `safeAreaInsetBottom`을 우선 사용하고,
21
+ * host가 값을 제공하지 않으면 Lynx CSS `env(safe-area-inset-*)` 값을 fallback으로
22
+ * 반환합니다.
23
+ */
24
+ function useSafeArea() {
25
+ const safeAreaInsetTop = lynx.__globalProps?.[safeAreaProp.top];
26
+ const safeAreaInsetBottom = lynx.__globalProps?.[safeAreaProp.bottom];
27
+ return useMemo(() => ({
28
+ safeAreaInsetTop: resolveSafeAreaInset("top", safeAreaInsetTop),
29
+ safeAreaInsetBottom: resolveSafeAreaInset("bottom", safeAreaInsetBottom)
30
+ }), [safeAreaInsetTop, safeAreaInsetBottom]);
31
+ }
32
+ //#endregion
33
+ export { useSafeArea };