@seed-design/lynx-react 0.2.0-alpha.2 → 0.2.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 (186) hide show
  1. package/lib/_virtual/_rolldown/runtime.js +13 -0
  2. package/lib/components/ActionButton/ActionButton.d.ts +26 -32
  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 -30
  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 -28
  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 +4 -3
  84. package/lib/hooks/index.d.ts.map +1 -1
  85. package/lib/hooks/{use-controllable-state.d.ts → useControllableState.d.ts} +1 -1
  86. package/lib/hooks/useControllableState.d.ts.map +1 -0
  87. package/lib/hooks/useControllableState.js +27 -0
  88. package/lib/hooks/useIconColor.d.ts +19 -0
  89. package/lib/hooks/useIconColor.d.ts.map +1 -0
  90. package/lib/hooks/useIconColor.js +38 -0
  91. package/lib/hooks/{use-press-tap.d.ts → usePressTap.d.ts} +12 -9
  92. package/lib/hooks/usePressTap.d.ts.map +1 -0
  93. package/lib/hooks/usePressTap.js +35 -0
  94. package/lib/hooks/useSafeArea.d.ts +19 -0
  95. package/lib/hooks/useSafeArea.d.ts.map +1 -0
  96. package/lib/hooks/useSafeArea.js +33 -0
  97. package/lib/index.d.ts +4 -3
  98. package/lib/index.d.ts.map +1 -1
  99. package/lib/index.js +29 -3
  100. package/lib/types.d.ts +51 -0
  101. package/lib/types.d.ts.map +1 -0
  102. package/lib/utils/children.d.ts +3 -0
  103. package/lib/utils/children.d.ts.map +1 -0
  104. package/lib/utils/children.js +8 -0
  105. package/lib/utils/create-slot-recipe-context.d.ts +13 -12
  106. package/lib/utils/create-slot-recipe-context.d.ts.map +1 -1
  107. package/lib/utils/create-slot-recipe-context.jsx +88 -70
  108. package/lib/utils/get-seed-class-name.d.ts +6 -7
  109. package/lib/utils/get-seed-class-name.d.ts.map +1 -1
  110. package/lib/utils/get-seed-class-name.js +26 -37
  111. package/lib/utils/index.d.ts +4 -4
  112. package/lib/utils/resolve-recipe-token.js +45 -43
  113. package/lib/utils/split-multiple-variants-props.js +32 -32
  114. package/lib/utils/styled.d.ts +83 -0
  115. package/lib/utils/styled.d.ts.map +1 -0
  116. package/lib/utils/styled.js +144 -0
  117. package/package.json +9 -9
  118. package/src/components/ActionButton/ActionButton.test.tsx +167 -0
  119. package/src/components/ActionButton/ActionButton.tsx +210 -168
  120. package/src/components/AppBar/AppBar.namespace.ts +18 -0
  121. package/src/components/AppBar/AppBar.test.tsx +270 -0
  122. package/src/components/AppBar/AppBar.tsx +288 -0
  123. package/src/components/AppBar/context.ts +27 -0
  124. package/src/components/AppBar/index.ts +21 -0
  125. package/src/components/AppBar/useAppBar.ts +100 -0
  126. package/src/components/Badge/Badge.test.tsx +54 -0
  127. package/src/components/Badge/Badge.tsx +32 -0
  128. package/src/components/Badge/index.ts +1 -0
  129. package/src/components/BottomSheet/BottomSheet.test.tsx +219 -0
  130. package/src/components/BottomSheet/BottomSheet.tsx +120 -83
  131. package/src/components/Box/Box.test.tsx +85 -0
  132. package/src/components/Box/Box.tsx +39 -0
  133. package/src/components/Box/index.ts +1 -0
  134. package/src/components/Checkbox/Checkbox.tsx +108 -117
  135. package/src/components/Icon/Icon.tsx +265 -0
  136. package/src/components/Icon/index.ts +8 -0
  137. package/src/components/ProgressCircle/ProgressCircle.tsx +39 -25
  138. package/src/components/RadioGroup/RadioGroup.tsx +100 -118
  139. package/src/components/Stack/Stack.tsx +97 -0
  140. package/src/components/Stack/index.ts +1 -0
  141. package/src/components/Switch/Switch.tsx +61 -52
  142. package/src/components/TagGroup/TagGroup.tsx +27 -25
  143. package/src/components/Text/Text.tsx +64 -0
  144. package/src/components/Text/index.ts +1 -0
  145. package/src/components/index.ts +6 -0
  146. package/src/hooks/index.ts +4 -3
  147. package/src/hooks/{__tests__/use-controllable-state.test.ts → useControllableState.test.ts} +1 -1
  148. package/src/hooks/useIconColor.test.ts +13 -0
  149. package/src/hooks/useIconColor.ts +67 -0
  150. package/src/hooks/{__tests__/use-press-tap.test.ts → usePressTap.test.ts} +1 -1
  151. package/src/hooks/{use-press-tap.ts → usePressTap.ts} +14 -10
  152. package/src/hooks/useSafeArea.test.ts +83 -0
  153. package/src/hooks/useSafeArea.ts +56 -0
  154. package/src/index.ts +1 -0
  155. package/src/types.ts +76 -0
  156. package/src/utils/children.ts +13 -0
  157. package/src/utils/create-slot-recipe-context.test.tsx +96 -0
  158. package/src/utils/create-slot-recipe-context.tsx +55 -15
  159. package/src/utils/get-seed-class-name.ts +7 -12
  160. package/src/utils/{__tests__/split-multiple-variants-props.test.ts → split-multiple-variants-props.test.ts} +1 -1
  161. package/src/utils/styled.ts +442 -0
  162. package/lib/components/ActionButton/index.js +0 -1
  163. package/lib/components/BottomSheet/index.js +0 -2
  164. package/lib/components/Checkbox/index.js +0 -2
  165. package/lib/components/ProgressCircle/index.js +0 -2
  166. package/lib/components/RadioGroup/index.js +0 -2
  167. package/lib/components/Switch/index.js +0 -2
  168. package/lib/components/TagGroup/index.js +0 -2
  169. package/lib/components/index.js +0 -7
  170. package/lib/hooks/index.js +0 -3
  171. package/lib/hooks/use-controllable-state.d.ts.map +0 -1
  172. package/lib/hooks/use-controllable-state.js +0 -27
  173. package/lib/hooks/use-icon-color.d.ts +0 -15
  174. package/lib/hooks/use-icon-color.d.ts.map +0 -1
  175. package/lib/hooks/use-icon-color.js +0 -37
  176. package/lib/hooks/use-press-tap.d.ts.map +0 -1
  177. package/lib/hooks/use-press-tap.js +0 -35
  178. package/lib/utils/index.js +0 -4
  179. package/src/components/ActionButton/__tests__/ActionButton.test.tsx +0 -35
  180. package/src/components/BottomSheet/__tests__/BottomSheet.test.tsx +0 -119
  181. package/src/components/__tests__/ProgressCircle.test.ts +0 -33
  182. package/src/components/__tests__/exports.test.ts +0 -38
  183. package/src/components/__tests__/switch.test.ts +0 -34
  184. package/src/hooks/use-icon-color.ts +0 -51
  185. package/src/utils/__tests__/create-slot-recipe-context.test.tsx +0 -228
  186. /package/src/hooks/{use-controllable-state.ts → useControllableState.ts} +0 -0
package/lib/types.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ import { ReactNode, Ref } from '@lynx-js/react';
2
+ import { CSSProperties, IntrinsicElements, MainThread, NodesRef, TextProps, ViewProps } from '@lynx-js/types';
3
+ export type LynxViewProps = IntrinsicElements["view"] & ViewProps;
4
+ export type LynxTextProps = IntrinsicElements["text"] & TextProps;
5
+ export type LynxViewRef = Ref<NodesRef>;
6
+ export type LynxTextRef = Ref<NodesRef>;
7
+ export type LynxMainThreadRef = Ref<MainThread.Element>;
8
+ export type LynxStyle = CSSProperties;
9
+ export interface LynxElementProps {
10
+ children?: ReactNode;
11
+ className?: LynxViewProps["className"];
12
+ }
13
+ export interface LynxStyledElementProps extends LynxElementProps {
14
+ style?: LynxStyle;
15
+ }
16
+ export interface LynxPressableProps {
17
+ bindtap?: LynxViewProps["bindtap"];
18
+ "main-thread:bindtap"?: LynxViewProps["main-thread:bindtap"];
19
+ }
20
+ export interface LynxTouchProps {
21
+ bindtap?: LynxViewProps["bindtap"];
22
+ bindtouchstart?: LynxViewProps["bindtouchstart"];
23
+ bindtouchend?: LynxViewProps["bindtouchend"];
24
+ bindtouchcancel?: LynxViewProps["bindtouchcancel"];
25
+ "main-thread:bindtap"?: LynxViewProps["main-thread:bindtap"];
26
+ }
27
+ export interface LynxIconElementProps {
28
+ className?: IntrinsicElements["image"]["className"];
29
+ style?: LynxStyle;
30
+ ref?: LynxMainThreadRef;
31
+ "main-thread:binduiappear"?: IntrinsicElements["image"]["main-thread:binduiappear"];
32
+ }
33
+ /**
34
+ * @platform Lynx
35
+ *
36
+ * native element(`<view>`/`<text>`/`<image>` 등)가 공유하는 접근성 속성 모음.
37
+ * `@lynx-js/types`의 StandardProps 접근성 속성을 표준화한 타입으로, 컴포넌트가
38
+ * 확장해 native element에 패스스루한다. 모든 native tag가 동일한 공통 속성을
39
+ * 가지며 tag별 차이는 없다.
40
+ *
41
+ * web ARIA 대응:
42
+ * - `accessibility-label` ← `aria-label`
43
+ * - `accessibility-role-description` ← `role` (switch/checkbox/progressbar)
44
+ * - `accessibility-value` ← `aria-checked` / `aria-valuenow`
45
+ * - `accessibility-elements-hidden` ← `aria-hidden`
46
+ *
47
+ * `accessibility-traits`는 단일 값이라 `selected`+`disabled` 동시 표현이 안 된다.
48
+ * 역할은 `accessibility-role-description`, 상태는 `accessibility-value`로 분담한다.
49
+ */
50
+ export type LynxAccessibilityProps = Pick<LynxViewProps, "accessibility-label" | "accessibility-traits" | "accessibility-element" | "accessibility-value" | "accessibility-role-description" | "accessibility-elements-hidden" | "accessibility-heading" | "accessibility-actions" | "accessibility-exclusive-focus" | "ios-platform-accessibility-id">;
51
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACV,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,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,MAAM,sBAAsB,GAAG,IAAI,CACvC,aAAa,EACX,qBAAqB,GACrB,sBAAsB,GACtB,uBAAuB,GACvB,qBAAqB,GACrB,gCAAgC,GAChC,+BAA+B,GAC/B,uBAAuB,GACvB,uBAAuB,GACvB,+BAA+B,GAC/B,+BAA+B,CAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ReactNode } from '@lynx-js/react';
2
+ export declare function toArray(children: ReactNode): ReactNode[];
3
+ //# sourceMappingURL=children.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../src/utils/children.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAUxD"}
@@ -0,0 +1,8 @@
1
+ //#region src/utils/children.ts
2
+ function toArray(children) {
3
+ if (children == null || typeof children === "boolean") return [];
4
+ if (Array.isArray(children)) return children.flatMap(toArray);
5
+ return [children];
6
+ }
7
+ //#endregion
8
+ export { toArray };
@@ -1,26 +1,27 @@
1
+ import { ElementType, ForwardRefExoticComponent, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from '@lynx-js/react';
1
2
  type SlotRecipe<Props extends Record<string, string | boolean | undefined>, Classnames extends Record<string, string>> = ((props?: Props) => Classnames) & {
2
3
  splitVariantProps: <T extends Props>(props: T) => [Props, Omit<T, keyof Props>];
3
4
  };
4
5
  export declare function createSlotRecipeContext<Props extends Record<string, string | boolean | undefined>, Classnames extends Record<string, string>>(recipe: SlotRecipe<Props, Classnames>): {
5
- ClassNamesProvider: ({ children, value, }: {
6
- children: React.ReactNode;
6
+ ClassNamesProvider: (props: {
7
+ children: ReactNode;
7
8
  value: Classnames;
8
- }) => import("react").JSX.Element;
9
- PropsProvider: ({ children, value }: {
10
- children: React.ReactNode;
9
+ }) => ReactElement;
10
+ PropsProvider: (props: {
11
+ children: ReactNode;
11
12
  value: Props;
12
- }) => import("react").JSX.Element;
13
+ }) => ReactElement;
13
14
  useClassNames: () => Classnames;
14
15
  useProps: () => Props | null;
15
- withRootProvider: <P>(Component: React.ElementType<any>, options?: {
16
+ withRootProvider: <P>(Component: ElementType<any>, options?: {
16
17
  defaultProps?: Partial<P>;
17
- }) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P>>;
18
- withProvider: <T, P>(Component: React.ElementType<any>, slot: keyof Classnames, options?: {
18
+ }) => ForwardRefExoticComponent<PropsWithoutRef<P>>;
19
+ withProvider: <T, P>(Component: ElementType<any>, slot: keyof Classnames, options?: {
19
20
  defaultProps?: Partial<P>;
20
- }) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
21
- withContext: <T, P>(Component: React.ElementType<any>, slot?: keyof Classnames, options?: {
21
+ }) => ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
22
+ withContext: <T, P>(Component: ElementType<any>, slot?: keyof Classnames, options?: {
22
23
  defaultProps?: Partial<P>;
23
- }) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
24
+ }) => ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
24
25
  };
25
26
  export {};
26
27
  //# sourceMappingURL=create-slot-recipe-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-slot-recipe-context.d.ts","sourceRoot":"","sources":["../../src/utils/create-slot-recipe-context.tsx"],"names":[],"mappings":"AAGA,KAAK,UAAU,CACb,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC1D,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IACvC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,UAAU,CAAC,GAAG;IACpC,iBAAiB,EAAE,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,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E,OAAO,CAAC,CAAC,CAAC,CAAC;KAC3B,KACE,yBAAyB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EACjB,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,EAC3B,IAAI,EAAE,MAAM,UAAU,EACtB,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;KAC3B,KACE,yBAAyB,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAChB,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,EAC3B,IAAI,CAAC,EAAE,MAAM,UAAU,EACvB,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;KAC3B,KACE,yBAAyB,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACvE,CAkIA"}
@@ -1,76 +1,94 @@
1
- import { createContext, forwardRef, useContext } from "@lynx-js/react";
2
1
  import clsx from "clsx";
3
- export function createSlotRecipeContext(recipe) {
4
- const ClassNamesContext = createContext(null);
5
- const PropsContext = createContext(null);
6
- const ClassNamesProvider = ({ children, value, }) => {
7
- return <ClassNamesContext.Provider value={value}>{children}</ClassNamesContext.Provider>;
8
- };
9
- const PropsProvider = ({ children, value }) => {
10
- return <PropsContext.Provider value={value}>{children}</PropsContext.Provider>;
11
- };
12
- function useClassNames() {
13
- const context = useContext(ClassNamesContext);
14
- if (context === null) {
15
- throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
16
- }
17
- return context;
18
- }
19
- function useProps() {
20
- return useContext(PropsContext);
21
- }
22
- const withRootProvider = (Component, options) => {
23
- const { defaultProps } = options ?? {};
24
- const StyledComponent = (innerProps) => {
25
- const props = { ...(defaultProps ?? {}), ...useProps(), ...innerProps };
26
- const [variantProps, otherProps] = recipe.splitVariantProps(props);
27
- const classNames = recipe(variantProps);
28
- return (<ClassNamesProvider value={classNames}>
2
+ import { createContext, forwardRef, useContext } from "@lynx-js/react";
3
+ //#region src/utils/create-slot-recipe-context.tsx
4
+ function assertNotIntrinsicComponent(Component, caller) {
5
+ if (typeof Component !== "string") return;
6
+ throw new Error(`${caller} cannot wrap intrinsic tag "${Component}" in Lynx. Native <view>/<text> slots must be rendered as literal JSX in the component file; passing intrinsic strings through createSlotRecipeContext can cause BackgroundSnapshot not found errors.`);
7
+ }
8
+ function createSlotRecipeContext(recipe) {
9
+ const ClassNamesContext = createContext(null);
10
+ const PropsContext = createContext(null);
11
+ const ClassNamesProvider = ({ children, value }) => {
12
+ return <ClassNamesContext.Provider value={value}>{children}</ClassNamesContext.Provider>;
13
+ };
14
+ const PropsProvider = ({ children, value }) => {
15
+ return <PropsContext.Provider value={value}>{children}</PropsContext.Provider>;
16
+ };
17
+ function useClassNames() {
18
+ const context = useContext(ClassNamesContext);
19
+ if (context === null) throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
20
+ return context;
21
+ }
22
+ function useProps() {
23
+ return useContext(PropsContext);
24
+ }
25
+ const withRootProvider = (Component, options) => {
26
+ assertNotIntrinsicComponent(Component, "withRootProvider");
27
+ const { defaultProps } = options ?? {};
28
+ const StyledComponent = (innerProps) => {
29
+ const props = {
30
+ ...defaultProps ?? {},
31
+ ...useProps(),
32
+ ...innerProps
33
+ };
34
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
35
+ const classNames = recipe(variantProps);
36
+ return <ClassNamesProvider value={classNames}>
29
37
  <PropsProvider value={variantProps}>
30
- <Component {...otherProps}/>
38
+ <Component {...otherProps} />
31
39
  </PropsProvider>
32
- </ClassNamesProvider>);
33
- };
34
- // @ts-expect-error — assigning displayName to a plain function component
35
- StyledComponent.displayName = Component.displayName || Component.name;
36
- return StyledComponent;
37
- };
38
- const withProvider = (Component, slot, options) => {
39
- const { defaultProps } = options ?? {};
40
- const StyledComponent = forwardRef((innerProps, ref) => {
41
- const props = { ...(defaultProps ?? {}), ...useProps(), ...innerProps };
42
- const [variantProps, otherProps] = recipe.splitVariantProps(props);
43
- const classNames = recipe(variantProps);
44
- const slotClassName = classNames[slot];
45
- const userClassName = props["className"];
46
- return (<ClassNamesProvider value={classNames}>
40
+ </ClassNamesProvider>;
41
+ };
42
+ StyledComponent.displayName = Component.displayName || Component.name;
43
+ return StyledComponent;
44
+ };
45
+ const withProvider = (Component, slot, options) => {
46
+ assertNotIntrinsicComponent(Component, "withProvider");
47
+ const { defaultProps } = options ?? {};
48
+ const StyledComponent = forwardRef((innerProps, ref) => {
49
+ const props = {
50
+ ...defaultProps ?? {},
51
+ ...useProps(),
52
+ ...innerProps
53
+ };
54
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
55
+ const classNames = recipe(variantProps);
56
+ const slotClassName = classNames[slot];
57
+ const userClassName = props["className"];
58
+ return <ClassNamesProvider value={classNames}>
47
59
  <PropsProvider value={variantProps}>
48
- <Component {...(ref ? { ref } : {})} {...otherProps} className={clsx(slotClassName, userClassName)}/>
60
+ <Component {...ref ? { ref } : {}} {...otherProps} className={clsx(slotClassName, userClassName)} />
49
61
  </PropsProvider>
50
- </ClassNamesProvider>);
51
- });
52
- StyledComponent.displayName = Component.displayName || Component.name;
53
- return StyledComponent;
54
- };
55
- const withContext = (Component, slot, options) => {
56
- const { defaultProps } = options ?? {};
57
- const StyledComponent = forwardRef((innerProps, ref) => {
58
- const props = { ...(defaultProps ?? {}), ...innerProps };
59
- const classNames = useClassNames();
60
- const slotClassName = slot ? classNames[slot] : undefined;
61
- const userClassName = props["className"];
62
- return (<Component {...(ref ? { ref } : {})} {...props} className={clsx(slotClassName, userClassName)}/>);
63
- });
64
- StyledComponent.displayName = Component.displayName || Component.name;
65
- return StyledComponent;
66
- };
67
- return {
68
- ClassNamesProvider,
69
- PropsProvider,
70
- useClassNames,
71
- useProps,
72
- withRootProvider,
73
- withProvider,
74
- withContext,
75
- };
62
+ </ClassNamesProvider>;
63
+ });
64
+ StyledComponent.displayName = Component.displayName || Component.name;
65
+ return StyledComponent;
66
+ };
67
+ const withContext = (Component, slot, options) => {
68
+ assertNotIntrinsicComponent(Component, "withContext");
69
+ const { defaultProps } = options ?? {};
70
+ const StyledComponent = forwardRef((innerProps, ref) => {
71
+ const props = {
72
+ ...defaultProps ?? {},
73
+ ...innerProps
74
+ };
75
+ const classNames = useClassNames();
76
+ const slotClassName = slot ? classNames[slot] : void 0;
77
+ const userClassName = props["className"];
78
+ return <Component {...ref ? { ref } : {}} {...props} className={clsx(slotClassName, userClassName)} />;
79
+ });
80
+ StyledComponent.displayName = Component.displayName || Component.name;
81
+ return StyledComponent;
82
+ };
83
+ return {
84
+ ClassNamesProvider,
85
+ PropsProvider,
86
+ useClassNames,
87
+ useProps,
88
+ withRootProvider,
89
+ withProvider,
90
+ withContext
91
+ };
76
92
  }
93
+ //#endregion
94
+ export { createSlotRecipeContext };
@@ -1,9 +1,11 @@
1
- type ColorMode = "system" | "light-only" | "dark-only";
1
+ export type ColorMode = "system" | "light-only" | "dark-only";
2
+ export interface GetSeedClassNameOptions {
3
+ colorMode?: ColorMode;
4
+ }
2
5
  /**
3
6
  * Lynx 앱의 root `<page>` 요소에 적용할 SEED Design className을 반환한다.
4
7
  *
5
- * 테마(dark/light)와 플랫폼(iOS/Android)을 자동 감지하여
6
- * 렌더링 전에 올바른 CSS 변수가 적용되도록 한다.
8
+ * 테마(dark/light)를 자동 감지하여 렌더링 전에 올바른 CSS 변수가 적용되도록 한다.
7
9
  *
8
10
  * @example
9
11
  * ```tsx
@@ -16,8 +18,5 @@ type ColorMode = "system" | "light-only" | "dark-only";
16
18
  * );
17
19
  * ```
18
20
  */
19
- export declare function getSeedClassName(options?: {
20
- colorMode?: ColorMode;
21
- }): string;
22
- export {};
21
+ export declare function getSeedClassName(options?: GetSeedClassNameOptions): string;
23
22
  //# sourceMappingURL=get-seed-class-name.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-seed-class-name.d.ts","sourceRoot":"","sources":["../../src/utils/get-seed-class-name.ts"],"names":[],"mappings":"AAUA,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,MAAM,CAsB5E"}
1
+ {"version":3,"file":"get-seed-class-name.d.ts","sourceRoot":"","sources":["../../src/utils/get-seed-class-name.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAkB1E"}
@@ -1,39 +1,28 @@
1
+ //#region src/utils/get-seed-class-name.ts
1
2
  /**
2
- * Lynx 앱의 root `<page>` 요소에 적용할 SEED Design className을 반환한다.
3
- *
4
- * 테마(dark/light)와 플랫폼(iOS/Android)을 자동 감지하여
5
- * 렌더링 전에 올바른 CSS 변수가 적용되도록 한다.
6
- *
7
- * @example
8
- * ```tsx
9
- * import { getSeedClassName } from "@seed-design/lynx-react";
10
- *
11
- * root.render(
12
- * <page className={getSeedClassName({ colorMode: "system" })}>
13
- * <App />
14
- * </page>
15
- * );
16
- * ```
17
- */
18
- export function getSeedClassName(options) {
19
- const { colorMode = "system" } = options ?? {};
20
- // Theme — lynx.__globalProps.theme에서 시스템 테마 읽기
21
- const systemTheme = lynx?.__globalProps?.["theme"];
22
- let themeClass;
23
- if (colorMode === "light-only") {
24
- themeClass = "seed-user-color-scheme-light";
25
- }
26
- else if (colorMode === "dark-only") {
27
- themeClass = "seed-user-color-scheme-dark";
28
- }
29
- else {
30
- themeClass =
31
- systemTheme?.toLowerCase() === "dark"
32
- ? "seed-user-color-scheme-dark"
33
- : "seed-user-color-scheme-light";
34
- }
35
- // Platform — SystemInfo.platform에서 디바이스 플랫폼 읽기
36
- const platform = SystemInfo?.platform;
37
- const platformClass = platform === "iOS" ? "seed-platform-ios" : "seed-platform-android";
38
- return `${themeClass} ${platformClass}`;
3
+ * Lynx 앱의 root `<page>` 요소에 적용할 SEED Design className을 반환한다.
4
+ *
5
+ * 테마(dark/light)를 자동 감지하여 렌더링 전에 올바른 CSS 변수가 적용되도록 한다.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { getSeedClassName } from "@seed-design/lynx-react";
10
+ *
11
+ * root.render(
12
+ * <page className={getSeedClassName({ colorMode: "system" })}>
13
+ * <App />
14
+ * </page>
15
+ * );
16
+ * ```
17
+ */
18
+ function getSeedClassName(options) {
19
+ const { colorMode = "system" } = options ?? {};
20
+ const systemTheme = lynx?.__globalProps?.["theme"];
21
+ let themeClass;
22
+ if (colorMode === "light-only") themeClass = "seed-user-color-scheme-light";
23
+ else if (colorMode === "dark-only") themeClass = "seed-user-color-scheme-dark";
24
+ else themeClass = systemTheme?.toLowerCase() === "dark" ? "seed-user-color-scheme-dark" : "seed-user-color-scheme-light";
25
+ return themeClass;
39
26
  }
27
+ //#endregion
28
+ export { getSeedClassName };
@@ -1,5 +1,5 @@
1
- export * from "./create-slot-recipe-context";
2
- export * from "./get-seed-class-name";
3
- export * from "./resolve-recipe-token";
4
- export * from "./split-multiple-variants-props";
1
+ export * from './create-slot-recipe-context';
2
+ export * from './get-seed-class-name';
3
+ export * from './resolve-recipe-token';
4
+ export * from './split-multiple-variants-props';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,47 +1,49 @@
1
+ //#region src/utils/resolve-recipe-token.ts
1
2
  /**
2
- * Rootage vars 객체에서 `path` 를 따라 token 값(주로 `"var(--seed-...)"` 스트링)을 꺼낸다.
3
- *
4
- * 쓰임새: Lynx `<image>` 의 `tint-color` / `width` / `height` 처럼 CSS 만으로는
5
- * override 할 수 없거나(아이콘 패키지가 inline style 을 박는 경우 등) React 가
6
- * recipe 와 같은 소스에서 꺼내 inline attribute 로 주입해야 하는 속성을 다룰 때.
7
- *
8
- * ```ts
9
- * import { actionButton as actionButtonVars } from "@seed-design/lynx-css/vars/component";
10
- * import { capitalize, resolveRecipeToken } from "@seed-design/lynx-react/utils/resolve-recipe-token";
11
- *
12
- * // variant × state × slot → color
13
- * const color = resolveRecipeToken(actionButtonVars, [
14
- * `variant${capitalize(variant)}`,
15
- * state, // "enabled" | "disabled" | "loading" | "pressed"
16
- * "prefixIcon",
17
- * "color",
18
- * ]);
19
- *
20
- * // size × layout → icon size
21
- * const size = resolveRecipeToken(actionButtonVars, [
22
- * `size${capitalize(size)}Layout${capitalize(layout)}`,
23
- * "enabled",
24
- * "prefixIcon",
25
- * "size",
26
- * ]);
27
- * ```
28
- *
29
- * recipe token 경로가 컴포넌트마다 조금씩 다르므로(variant/size/layout 조합 여부 등)
30
- * 이 유틸은 "vars + path" 조합만 제공하고, 각 컴포넌트가 자기 path 를 만들어 호출한다.
31
- */
32
- export function resolveRecipeToken(vars, path) {
33
- let cursor = vars;
34
- for (const key of path) {
35
- if (cursor == null || typeof cursor !== "object")
36
- return undefined;
37
- cursor = cursor[key];
38
- }
39
- return typeof cursor === "string" ? cursor : undefined;
3
+ * Rootage vars 객체에서 `path` 를 따라 token 값(주로 `"var(--seed-...)"` 스트링)을 꺼낸다.
4
+ *
5
+ * 쓰임새: Lynx `<image>` 의 `tint-color` / `width` / `height` 처럼 CSS 만으로는
6
+ * override 할 수 없거나(아이콘 패키지가 inline style 을 박는 경우 등) React 가
7
+ * recipe 와 같은 소스에서 꺼내 inline attribute 로 주입해야 하는 속성을 다룰 때.
8
+ *
9
+ * ```ts
10
+ * import { actionButton as actionButtonVars } from "@seed-design/lynx-css/vars/component";
11
+ * import { capitalize, resolveRecipeToken } from "@seed-design/lynx-react/utils/resolve-recipe-token";
12
+ *
13
+ * // variant × state × slot → color
14
+ * const color = resolveRecipeToken(actionButtonVars, [
15
+ * `variant${capitalize(variant)}`,
16
+ * state, // "enabled" | "disabled" | "loading" | "pressed"
17
+ * "prefixIcon",
18
+ * "color",
19
+ * ]);
20
+ *
21
+ * // size × layout → icon size
22
+ * const size = resolveRecipeToken(actionButtonVars, [
23
+ * `size${capitalize(size)}Layout${capitalize(layout)}`,
24
+ * "enabled",
25
+ * "prefixIcon",
26
+ * "size",
27
+ * ]);
28
+ * ```
29
+ *
30
+ * recipe token 경로가 컴포넌트마다 조금씩 다르므로(variant/size/layout 조합 여부 등)
31
+ * 이 유틸은 "vars + path" 조합만 제공하고, 각 컴포넌트가 자기 path 를 만들어 호출한다.
32
+ */
33
+ function resolveRecipeToken(vars, path) {
34
+ let cursor = vars;
35
+ for (const key of path) {
36
+ if (cursor == null || typeof cursor !== "object") return void 0;
37
+ cursor = cursor[key];
38
+ }
39
+ return typeof cursor === "string" ? cursor : void 0;
40
40
  }
41
41
  /**
42
- * 첫 글자 대문자. recipe variant key 조립용
43
- * (e.g. `variant` + `brandSolid` → `variantBrandSolid`).
44
- */
45
- export function capitalize(value) {
46
- return (value.charAt(0).toUpperCase() + value.slice(1));
42
+ * 첫 글자 대문자. recipe variant key 조립용
43
+ * (e.g. `variant` + `brandSolid` → `variantBrandSolid`).
44
+ */
45
+ function capitalize(value) {
46
+ return value.charAt(0).toUpperCase() + value.slice(1);
47
47
  }
48
+ //#endregion
49
+ export { capitalize, resolveRecipeToken };
@@ -1,34 +1,34 @@
1
+ //#region src/utils/split-multiple-variants-props.ts
1
2
  /**
2
- * Split `props` across multiple recipes' variant extractors in one pass.
3
- *
4
- * Given `recipesMap` of `{ [recipeKey]: recipe }`, returns:
5
- * - A bucket per recipe key with that recipe's variant-only props.
6
- * - `remainingProps` with every recipe variant key stripped out.
7
- *
8
- * Keys that appear in more than one recipe (e.g. shared `size`) are copied
9
- * into each corresponding bucket. `remainingProps` never includes any key
10
- * that any recipe claimed as a variant.
11
- *
12
- * Mirror of `packages/react/src/utils/splitMultipleVariantsProps` adapted
13
- * to TypeScript for Lynx. Use when a single compound component composes two
14
- * or more recipes (e.g. Switch's `switch` + `switchmark`).
15
- */
16
- export function splitMultipleVariantsProps(props, recipesMap) {
17
- const multipleVariantsProps = {};
18
- const extractedKeys = new Set();
19
- const propsRecord = props;
20
- for (const recipeKey in recipesMap) {
21
- const [variantProps] = recipesMap[recipeKey].splitVariantProps(propsRecord);
22
- multipleVariantsProps[recipeKey] = variantProps;
23
- for (const variantPropKey in variantProps) {
24
- extractedKeys.add(variantPropKey);
25
- }
26
- }
27
- const remainingProps = {};
28
- for (const propKey in propsRecord) {
29
- if (extractedKeys.has(propKey))
30
- continue;
31
- remainingProps[propKey] = propsRecord[propKey];
32
- }
33
- return [multipleVariantsProps, remainingProps];
3
+ * Split `props` across multiple recipes' variant extractors in one pass.
4
+ *
5
+ * Given `recipesMap` of `{ [recipeKey]: recipe }`, returns:
6
+ * - A bucket per recipe key with that recipe's variant-only props.
7
+ * - `remainingProps` with every recipe variant key stripped out.
8
+ *
9
+ * Keys that appear in more than one recipe (e.g. shared `size`) are copied
10
+ * into each corresponding bucket. `remainingProps` never includes any key
11
+ * that any recipe claimed as a variant.
12
+ *
13
+ * Mirror of `packages/react/src/utils/splitMultipleVariantsProps` adapted
14
+ * to TypeScript for Lynx. Use when a single compound component composes two
15
+ * or more recipes (e.g. Switch's `switch` + `switchmark`).
16
+ */
17
+ function splitMultipleVariantsProps(props, recipesMap) {
18
+ const multipleVariantsProps = {};
19
+ const extractedKeys = /* @__PURE__ */ new Set();
20
+ const propsRecord = props;
21
+ for (const recipeKey in recipesMap) {
22
+ const [variantProps] = recipesMap[recipeKey].splitVariantProps(propsRecord);
23
+ multipleVariantsProps[recipeKey] = variantProps;
24
+ for (const variantPropKey in variantProps) extractedKeys.add(variantPropKey);
25
+ }
26
+ const remainingProps = {};
27
+ for (const propKey in propsRecord) {
28
+ if (extractedKeys.has(propKey)) continue;
29
+ remainingProps[propKey] = propsRecord[propKey];
30
+ }
31
+ return [multipleVariantsProps, remainingProps];
34
32
  }
33
+ //#endregion
34
+ export { splitMultipleVariantsProps };