@seed-design/lynx-react 0.1.1-alpha.0 → 0.2.0-alpha.3

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 (181) hide show
  1. package/lib/components/ActionButton/ActionButton.d.ts +41 -9
  2. package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
  3. package/lib/components/ActionButton/ActionButton.jsx +132 -14
  4. package/lib/components/BottomSheet/BottomSheet.d.ts +92 -0
  5. package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -0
  6. package/lib/components/BottomSheet/BottomSheet.jsx +178 -0
  7. package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +2 -0
  8. package/lib/components/BottomSheet/BottomSheet.namespace.d.ts.map +1 -0
  9. package/lib/components/BottomSheet/BottomSheet.namespace.js +1 -0
  10. package/lib/components/BottomSheet/index.d.ts +3 -0
  11. package/lib/components/BottomSheet/index.d.ts.map +1 -0
  12. package/lib/components/BottomSheet/index.js +2 -0
  13. package/lib/components/Checkbox/Checkbox.d.ts +52 -0
  14. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -0
  15. package/lib/components/Checkbox/Checkbox.jsx +121 -0
  16. package/lib/components/Checkbox/Checkbox.namespace.d.ts +2 -0
  17. package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -0
  18. package/lib/components/Checkbox/Checkbox.namespace.js +1 -0
  19. package/lib/components/Checkbox/index.d.ts +3 -0
  20. package/lib/components/Checkbox/index.d.ts.map +1 -0
  21. package/lib/components/Checkbox/index.js +2 -0
  22. package/lib/components/ProgressCircle/ProgressCircle.d.ts +10 -9
  23. package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
  24. package/lib/components/ProgressCircle/ProgressCircle.jsx +8 -14
  25. package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +2 -0
  26. package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts.map +1 -0
  27. package/lib/components/ProgressCircle/ProgressCircle.namespace.js +1 -0
  28. package/lib/components/ProgressCircle/index.d.ts +2 -1
  29. package/lib/components/ProgressCircle/index.d.ts.map +1 -1
  30. package/lib/components/ProgressCircle/index.js +2 -1
  31. package/lib/components/RadioGroup/RadioGroup.d.ts +51 -0
  32. package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -0
  33. package/lib/components/RadioGroup/RadioGroup.jsx +144 -0
  34. package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +2 -0
  35. package/lib/components/RadioGroup/RadioGroup.namespace.d.ts.map +1 -0
  36. package/lib/components/RadioGroup/RadioGroup.namespace.js +1 -0
  37. package/lib/components/RadioGroup/index.d.ts +3 -0
  38. package/lib/components/RadioGroup/index.d.ts.map +1 -0
  39. package/lib/components/RadioGroup/index.js +2 -0
  40. package/lib/components/Switch/Switch.d.ts +27 -0
  41. package/lib/components/Switch/Switch.d.ts.map +1 -0
  42. package/lib/components/Switch/Switch.jsx +75 -0
  43. package/lib/components/Switch/Switch.namespace.d.ts +2 -0
  44. package/lib/components/Switch/Switch.namespace.d.ts.map +1 -0
  45. package/lib/components/Switch/Switch.namespace.js +1 -0
  46. package/lib/components/Switch/index.d.ts +3 -0
  47. package/lib/components/Switch/index.d.ts.map +1 -0
  48. package/lib/components/Switch/index.js +2 -0
  49. package/lib/components/TagGroup/TagGroup.d.ts +40 -0
  50. package/lib/components/TagGroup/TagGroup.d.ts.map +1 -0
  51. package/lib/components/TagGroup/TagGroup.jsx +54 -0
  52. package/lib/components/TagGroup/TagGroup.namespace.d.ts +2 -0
  53. package/lib/components/TagGroup/TagGroup.namespace.d.ts.map +1 -0
  54. package/lib/components/TagGroup/TagGroup.namespace.js +1 -0
  55. package/lib/components/TagGroup/index.d.ts +3 -0
  56. package/lib/components/TagGroup/index.d.ts.map +1 -0
  57. package/lib/components/TagGroup/index.js +2 -0
  58. package/lib/components/index.d.ts +8 -0
  59. package/lib/components/index.d.ts.map +1 -0
  60. package/lib/components/index.js +7 -0
  61. package/lib/hooks/index.d.ts +4 -0
  62. package/lib/hooks/index.d.ts.map +1 -0
  63. package/lib/hooks/index.js +3 -0
  64. package/lib/hooks/useControllableState.d.ts +15 -0
  65. package/lib/hooks/useControllableState.d.ts.map +1 -0
  66. package/lib/hooks/useControllableState.js +27 -0
  67. package/lib/hooks/useIconColor.d.ts +16 -0
  68. package/lib/hooks/useIconColor.d.ts.map +1 -0
  69. package/lib/hooks/useIconColor.js +41 -0
  70. package/lib/hooks/usePressTap.d.ts +24 -0
  71. package/lib/hooks/usePressTap.d.ts.map +1 -0
  72. package/lib/hooks/usePressTap.js +35 -0
  73. package/lib/index.d.ts +3 -4
  74. package/lib/index.d.ts.map +1 -1
  75. package/lib/index.js +3 -4
  76. package/lib/utils/create-slot-recipe-context.d.ts +26 -0
  77. package/lib/utils/create-slot-recipe-context.d.ts.map +1 -0
  78. package/lib/utils/create-slot-recipe-context.jsx +76 -0
  79. package/lib/utils/get-seed-class-name.d.ts.map +1 -0
  80. package/lib/utils/index.d.ts +5 -0
  81. package/lib/utils/index.d.ts.map +1 -0
  82. package/lib/utils/index.js +4 -0
  83. package/lib/utils/resolve-recipe-token.d.ts +38 -0
  84. package/lib/utils/resolve-recipe-token.d.ts.map +1 -0
  85. package/lib/utils/resolve-recipe-token.js +47 -0
  86. package/lib/utils/split-multiple-variants-props.d.ts +29 -0
  87. package/lib/utils/split-multiple-variants-props.d.ts.map +1 -0
  88. package/lib/utils/split-multiple-variants-props.js +34 -0
  89. package/package.json +11 -9
  90. package/src/components/ActionButton/ActionButton.tsx +291 -31
  91. package/src/components/ActionButton/__tests__/ActionButton.test.tsx +35 -0
  92. package/src/components/BottomSheet/BottomSheet.namespace.ts +24 -0
  93. package/src/components/BottomSheet/BottomSheet.tsx +386 -0
  94. package/src/components/BottomSheet/__tests__/BottomSheet.test.tsx +119 -0
  95. package/src/components/BottomSheet/index.ts +27 -0
  96. package/src/components/Checkbox/Checkbox.namespace.ts +12 -0
  97. package/src/components/Checkbox/Checkbox.tsx +292 -0
  98. package/src/components/Checkbox/index.ts +14 -0
  99. package/src/components/ProgressCircle/ProgressCircle.namespace.ts +5 -0
  100. package/src/components/ProgressCircle/ProgressCircle.tsx +14 -13
  101. package/src/components/ProgressCircle/index.ts +9 -1
  102. package/src/components/RadioGroup/RadioGroup.namespace.ts +12 -0
  103. package/src/components/RadioGroup/RadioGroup.tsx +339 -0
  104. package/src/components/RadioGroup/index.ts +14 -0
  105. package/src/components/Switch/Switch.namespace.ts +10 -0
  106. package/src/components/Switch/Switch.tsx +191 -0
  107. package/src/components/Switch/index.ts +12 -0
  108. package/src/components/TagGroup/TagGroup.namespace.ts +8 -0
  109. package/src/components/TagGroup/TagGroup.tsx +125 -0
  110. package/src/components/TagGroup/index.ts +10 -0
  111. package/src/components/__tests__/ProgressCircle.test.ts +33 -0
  112. package/src/components/__tests__/exports.test.ts +38 -0
  113. package/src/components/__tests__/switch.test.ts +34 -0
  114. package/src/components/index.ts +7 -0
  115. package/src/hooks/__tests__/useControllableState.test.ts +120 -0
  116. package/src/hooks/__tests__/useIconColor.test.ts +13 -0
  117. package/src/hooks/__tests__/usePressTap.test.ts +129 -0
  118. package/src/hooks/index.ts +3 -0
  119. package/src/hooks/useControllableState.ts +38 -0
  120. package/src/hooks/useIconColor.ts +57 -0
  121. package/src/hooks/usePressTap.ts +54 -0
  122. package/src/index.ts +3 -4
  123. package/src/utils/__tests__/create-slot-recipe-context.test.tsx +228 -0
  124. package/src/utils/__tests__/split-multiple-variants-props.test.ts +61 -0
  125. package/src/utils/create-slot-recipe-context.tsx +147 -0
  126. package/src/utils/index.ts +4 -0
  127. package/src/utils/resolve-recipe-token.ts +47 -0
  128. package/src/utils/split-multiple-variants-props.ts +59 -0
  129. package/lib/components/Box/Box.d.ts +0 -10
  130. package/lib/components/Box/Box.d.ts.map +0 -1
  131. package/lib/components/Box/Box.jsx +0 -19
  132. package/lib/components/Box/index.d.ts +0 -2
  133. package/lib/components/Box/index.d.ts.map +0 -1
  134. package/lib/components/Box/index.js +0 -1
  135. package/lib/components/Flex/Flex.d.ts +0 -33
  136. package/lib/components/Flex/Flex.d.ts.map +0 -1
  137. package/lib/components/Flex/Flex.jsx +0 -7
  138. package/lib/components/Flex/index.d.ts +0 -2
  139. package/lib/components/Flex/index.d.ts.map +0 -1
  140. package/lib/components/Flex/index.js +0 -1
  141. package/lib/components/List/List.d.ts +0 -9
  142. package/lib/components/List/List.d.ts.map +0 -1
  143. package/lib/components/List/List.jsx +0 -17
  144. package/lib/components/List/index.d.ts +0 -2
  145. package/lib/components/List/index.d.ts.map +0 -1
  146. package/lib/components/List/index.js +0 -1
  147. package/lib/components/ListItem/ListItem.d.ts +0 -8
  148. package/lib/components/ListItem/ListItem.d.ts.map +0 -1
  149. package/lib/components/ListItem/ListItem.jsx +0 -11
  150. package/lib/components/ListItem/index.d.ts +0 -2
  151. package/lib/components/ListItem/index.d.ts.map +0 -1
  152. package/lib/components/ListItem/index.js +0 -1
  153. package/lib/components/ScrollView/ScrollView.d.ts +0 -9
  154. package/lib/components/ScrollView/ScrollView.d.ts.map +0 -1
  155. package/lib/components/ScrollView/ScrollView.jsx +0 -17
  156. package/lib/components/ScrollView/index.d.ts +0 -2
  157. package/lib/components/ScrollView/index.d.ts.map +0 -1
  158. package/lib/components/ScrollView/index.js +0 -1
  159. package/lib/components/Stack/Stack.d.ts +0 -6
  160. package/lib/components/Stack/Stack.d.ts.map +0 -1
  161. package/lib/components/Stack/Stack.jsx +0 -10
  162. package/lib/components/Stack/index.d.ts +0 -2
  163. package/lib/components/Stack/index.d.ts.map +0 -1
  164. package/lib/components/Stack/index.js +0 -1
  165. package/lib/components/Text/Text.d.ts +0 -30
  166. package/lib/components/Text/Text.d.ts.map +0 -1
  167. package/lib/components/Text/Text.jsx +0 -49
  168. package/lib/components/Text/index.d.ts +0 -2
  169. package/lib/components/Text/index.d.ts.map +0 -1
  170. package/lib/components/Text/index.js +0 -1
  171. package/lib/get-seed-class-name.d.ts.map +0 -1
  172. package/lib/utils/dynamic-style.d.ts +0 -13
  173. package/lib/utils/dynamic-style.d.ts.map +0 -1
  174. package/lib/utils/dynamic-style.js +0 -26
  175. package/lib/utils/styled.d.ts +0 -120
  176. package/lib/utils/styled.d.ts.map +0 -1
  177. package/lib/utils/styled.jsx +0 -131
  178. package/src/utils/dynamic-style.ts +0 -26
  179. /package/lib/{get-seed-class-name.d.ts → utils/get-seed-class-name.d.ts} +0 -0
  180. /package/lib/{get-seed-class-name.js → utils/get-seed-class-name.js} +0 -0
  181. /package/src/{get-seed-class-name.ts → utils/get-seed-class-name.ts} +0 -0
@@ -0,0 +1,121 @@
1
+ import * as React from "react";
2
+ import { cloneElement, isValidElement } from "react";
3
+ import clsx from "clsx";
4
+ import { checkbox } from "@seed-design/lynx-css/recipes/checkbox";
5
+ import { checkmark } from "@seed-design/lynx-css/recipes/checkmark";
6
+ import { checkboxGroup } from "@seed-design/lynx-css/recipes/checkbox-group";
7
+ import { vars as checkmarkVars } from "@seed-design/lynx-css/vars/component/checkmark";
8
+ import { useControllableState } from "../../hooks/useControllableState";
9
+ import { useIconColor } from "../../hooks/useIconColor";
10
+ import { usePressTap } from "../../hooks/usePressTap";
11
+ import { capitalize, resolveRecipeToken } from "../../utils/resolve-recipe-token";
12
+ import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props";
13
+ const CheckboxContext = React.createContext(null);
14
+ function useCheckboxContext(consumer) {
15
+ const ctx = React.useContext(CheckboxContext);
16
+ if (!ctx) {
17
+ throw new Error(`<${consumer}/> must be rendered inside <CheckboxRoot/>.`);
18
+ }
19
+ return ctx;
20
+ }
21
+ const CheckmarkIconClassContext = React.createContext(null);
22
+ function useCheckmarkIconClass(consumer) {
23
+ const ctx = React.useContext(CheckmarkIconClassContext);
24
+ if (!ctx) {
25
+ throw new Error(`<${consumer}/> must be rendered inside <CheckboxControl/>.`);
26
+ }
27
+ return ctx;
28
+ }
29
+ export const CheckboxRoot = React.forwardRef((props, ref) => {
30
+ const { children, className, checked: checkedProp, defaultChecked = false, indeterminate = false, disabled = false, onCheckedChange, ...restProps } = props;
31
+ const [{ checkbox: checkboxVariantProps, checkmark: checkmarkVariantProps }, nativeProps] = splitMultipleVariantsProps(restProps, { checkbox, checkmark });
32
+ const weight = checkboxVariantProps.weight ?? "regular";
33
+ const size = checkboxVariantProps.size ?? "medium";
34
+ const tone = checkmarkVariantProps.tone ?? "brand";
35
+ const variant = checkmarkVariantProps.variant ?? "square";
36
+ const [checked, setChecked] = useControllableState({
37
+ value: checkedProp,
38
+ defaultValue: defaultChecked,
39
+ onChange: onCheckedChange,
40
+ });
41
+ const { pressed, ...pressHandlers } = usePressTap({
42
+ disabled,
43
+ onTap: () => setChecked(!checked),
44
+ });
45
+ const rootClassName = checkbox({ weight, size, disabled }).root;
46
+ const ctx = React.useMemo(() => ({ checked, indeterminate, disabled, pressed, size, weight, tone, variant }), [checked, indeterminate, disabled, pressed, size, weight, tone, variant]);
47
+ return (<CheckboxContext.Provider value={ctx}>
48
+ <view {...(ref ? { ref: ref } : {})} className={clsx(rootClassName, className)} {...pressHandlers} {...nativeProps}>
49
+ {children}
50
+ </view>
51
+ </CheckboxContext.Provider>);
52
+ });
53
+ CheckboxRoot.displayName = "CheckboxRoot";
54
+ export const CheckboxControl = React.forwardRef((props, ref) => {
55
+ const [variantProps, restProps] = checkmark.splitVariantProps(props);
56
+ const { children, className, ...nativeProps } = restProps;
57
+ const { checked, indeterminate, disabled, pressed, tone: ctxTone, variant: ctxVariant, size: ctxSize, } = useCheckboxContext("CheckboxControl");
58
+ const tone = variantProps.tone ?? ctxTone;
59
+ const variant = variantProps.variant ?? ctxVariant;
60
+ const size = variantProps.size ?? ctxSize;
61
+ const classes = React.useMemo(() => checkmark({ variant, tone, size, checked, disabled, indeterminate, pressed }), [variant, tone, size, checked, disabled, indeterminate, pressed]);
62
+ return (<CheckmarkIconClassContext.Provider value={classes.icon}>
63
+ <view {...(ref ? { ref: ref } : {})} className={clsx(classes.root, className)} {...nativeProps}>
64
+ {children}
65
+ </view>
66
+ </CheckmarkIconClassContext.Provider>);
67
+ });
68
+ CheckboxControl.displayName = "CheckboxControl";
69
+ export function CheckboxIndicator(props) {
70
+ const { unchecked, checked: checkedIcon, indeterminate: indeterminateIcon, className, style, } = props;
71
+ const { checked, indeterminate, disabled, pressed, tone, variant, size } = useCheckboxContext("CheckboxIndicator");
72
+ const iconClassName = useCheckmarkIconClass("CheckboxIndicator");
73
+ const iconColor = useIconColor([
74
+ checked,
75
+ indeterminate,
76
+ disabled,
77
+ pressed,
78
+ tone,
79
+ variant,
80
+ size,
81
+ ]);
82
+ if (process.env.NODE_ENV !== "production" && indeterminate && !indeterminateIcon) {
83
+ console.warn("[seed-design] CheckboxIndicator: `indeterminate` prop must be provided when the checkbox is in an indeterminate state.");
84
+ }
85
+ const icon = indeterminate ? indeterminateIcon : checked ? checkedIcon : unchecked;
86
+ if (!icon || !isValidElement(icon))
87
+ return null;
88
+ // lynx-monochrome-icon 이 `<image style={{ width, height, ...style }}>` 로 자체 default size 를 박으므로
89
+ // recipe 토큰에서 꺼낸 사이즈를 inline 으로 주입해 덮는다.
90
+ const iconSize = resolveRecipeToken(checkmarkVars, [
91
+ `variant${capitalize(variant)}Size${capitalize(size)}`,
92
+ "enabled",
93
+ "icon",
94
+ "size",
95
+ ]);
96
+ return cloneElement(icon, {
97
+ ...iconColor,
98
+ className: clsx(iconClassName, icon.props.className, className),
99
+ style: iconSize
100
+ ? { width: iconSize, height: iconSize, ...icon.props.style, ...style }
101
+ : { ...icon.props.style, ...style },
102
+ });
103
+ }
104
+ CheckboxIndicator.displayName = "CheckboxIndicator";
105
+ export const CheckboxLabel = React.forwardRef((props, ref) => {
106
+ const { children, className, ...nativeProps } = props;
107
+ const { disabled, weight, size } = useCheckboxContext("CheckboxLabel");
108
+ const labelClassName = checkbox({ weight, size, disabled }).label;
109
+ return (<text {...(ref ? { ref: ref } : {})} className={clsx(labelClassName, className)} {...nativeProps}>
110
+ {children}
111
+ </text>);
112
+ });
113
+ CheckboxLabel.displayName = "CheckboxLabel";
114
+ export const CheckboxGroup = React.forwardRef((props, ref) => {
115
+ const { children, className, ...nativeProps } = props;
116
+ const classes = checkboxGroup();
117
+ return (<view {...(ref ? { ref: ref } : {})} className={clsx(classes, className)} {...nativeProps}>
118
+ {children}
119
+ </view>);
120
+ });
121
+ CheckboxGroup.displayName = "CheckboxGroup";
@@ -0,0 +1,2 @@
1
+ export { CheckboxControl as Control, CheckboxGroup as Group, CheckboxIndicator as Indicator, CheckboxLabel as Label, CheckboxRoot as Root, type CheckboxControlProps as ControlProps, type CheckboxGroupProps as GroupProps, type CheckboxIndicatorProps as IndicatorProps, type CheckboxLabelProps as LabelProps, type CheckboxRootProps as RootProps, } from "./Checkbox";
2
+ //# sourceMappingURL=Checkbox.namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,IAAI,OAAO,EAC1B,aAAa,IAAI,KAAK,EACtB,iBAAiB,IAAI,SAAS,EAC9B,aAAa,IAAI,KAAK,EACtB,YAAY,IAAI,IAAI,EACpB,KAAK,oBAAoB,IAAI,YAAY,EACzC,KAAK,kBAAkB,IAAI,UAAU,EACrC,KAAK,sBAAsB,IAAI,cAAc,EAC7C,KAAK,kBAAkB,IAAI,UAAU,EACrC,KAAK,iBAAiB,IAAI,SAAS,GACpC,MAAM,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export { CheckboxControl as Control, CheckboxGroup as Group, CheckboxIndicator as Indicator, CheckboxLabel as Label, CheckboxRoot as Root, } from "./Checkbox";
@@ -0,0 +1,3 @@
1
+ export { CheckboxRoot, CheckboxControl, CheckboxIndicator, CheckboxLabel, CheckboxGroup, type CheckboxRootProps, type CheckboxControlProps, type CheckboxIndicatorProps, type CheckboxLabelProps, type CheckboxGroupProps, } from "./Checkbox";
2
+ export * as Checkbox from "./Checkbox.namespace";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { CheckboxRoot, CheckboxControl, CheckboxIndicator, CheckboxLabel, CheckboxGroup, } from "./Checkbox";
2
+ export * as Checkbox from "./Checkbox.namespace";
@@ -1,11 +1,13 @@
1
+ import type * as React from "@lynx-js/react";
1
2
  import type { ProgressCircleVariantProps } from "@seed-design/lynx-css/recipes/progress-circle";
2
- export interface RootProps extends ProgressCircleVariantProps {
3
+ export interface ProgressCircleRootProps extends ProgressCircleVariantProps {
3
4
  minValue?: number;
4
5
  maxValue?: number;
5
6
  value?: number;
6
7
  children?: React.ReactNode;
7
8
  className?: string;
8
9
  }
10
+ export type RootProps = ProgressCircleRootProps;
9
11
  /**
10
12
  * Lynx에서 SVG를 사용할 수 없어 CSS clip-path 기반 pie sector로 구현.
11
13
  *
@@ -16,13 +18,12 @@ export interface RootProps extends ProgressCircleVariantProps {
16
18
  *
17
19
  * Lynx SVG + stroke-dasharray 지원 시 CSS-only 애니메이션으로 전환 예정.
18
20
  */
19
- declare function Root(props: RootProps): import("react").JSX.Element;
20
- declare function Track(): null;
21
- declare function Range(): import("react").JSX.Element;
22
- export declare const ProgressCircle: {
23
- Root: typeof Root;
24
- Track: typeof Track;
25
- Range: typeof Range;
21
+ export declare const ProgressCircleRoot: {
22
+ (props: ProgressCircleRootProps): React.JSX.Element;
23
+ displayName: string;
24
+ };
25
+ export declare const ProgressCircleRange: {
26
+ (): React.JSX.Element;
27
+ displayName: string;
26
28
  };
27
- export {};
28
29
  //# sourceMappingURL=ProgressCircle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressCircle.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/ProgressCircle.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAqGhG,MAAM,WAAW,SAAU,SAAQ,0BAA0B;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,+BAgC7B;AAED,iBAAS,KAAK,SAEb;AAED,iBAAS,KAAK,gCAQb;AAyOD,eAAO,MAAM,cAAc;;;;CAI1B,CAAC"}
1
+ {"version":3,"file":"ProgressCircle.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/ProgressCircle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAY7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAqGhG,MAAM,WAAW,uBAAwB,SAAQ,0BAA0B;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAEhD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;YAAW,uBAAuB;;CAgChE,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAQ/B,CAAC"}
@@ -89,7 +89,7 @@ const TRANSITION_DURATION = 300;
89
89
  *
90
90
  * Lynx SVG + stroke-dasharray 지원 시 CSS-only 애니메이션으로 전환 예정.
91
91
  */
92
- function Root(props) {
92
+ export const ProgressCircleRoot = (props) => {
93
93
  const size = props.size ?? "40";
94
94
  const tone = props.tone ?? "neutral";
95
95
  const numSize = Number(size);
@@ -107,17 +107,14 @@ function Root(props) {
107
107
  {props.children}
108
108
  </view>
109
109
  </ProgressCircleContext.Provider>);
110
- }
111
- function Track() {
112
- return null;
113
- }
114
- function Range() {
110
+ };
111
+ export const ProgressCircleRange = () => {
115
112
  const { numSize, isDeterminate, progress, classes } = useProgressCircleCtx();
116
113
  if (!isDeterminate) {
117
114
  return <IndeterminateRange numSize={numSize} classes={classes}/>;
118
115
  }
119
116
  return <DeterminateRange numSize={numSize} progress={progress} classes={classes}/>;
120
- }
117
+ };
121
118
  function DeterminateRange({ numSize, progress, classes, }) {
122
119
  const rangeRef = useMainThreadRef(null);
123
120
  const startCapRef = useMainThreadRef(null);
@@ -185,7 +182,7 @@ function DeterminateRange({ numSize, progress, classes, }) {
185
182
  return () => {
186
183
  runOnMainThread(cancelAnimation)();
187
184
  };
188
- }, [progress]);
185
+ }, [progress, numSize]);
189
186
  return (<>
190
187
  <view main-thread:ref={rangeRef} className={classes.range} style={{
191
188
  position: "absolute",
@@ -256,7 +253,7 @@ function IndeterminateRange({ numSize, classes }) {
256
253
  return () => {
257
254
  runOnMainThread(stopLoop)();
258
255
  };
259
- }, []);
256
+ }, [numSize]);
260
257
  const initialClipPath = 'path("M 0 0 Z")';
261
258
  return (<view main-thread:ref={containerRef} style={{
262
259
  position: "absolute",
@@ -285,8 +282,5 @@ function IndeterminateRange({ numSize, classes }) {
285
282
  }}/>
286
283
  </view>);
287
284
  }
288
- export const ProgressCircle = {
289
- Root,
290
- Track,
291
- Range,
292
- };
285
+ ProgressCircleRoot.displayName = "ProgressCircleRoot";
286
+ ProgressCircleRange.displayName = "ProgressCircleRange";
@@ -0,0 +1,2 @@
1
+ export { ProgressCircleRange as Range, ProgressCircleRoot as Root, type ProgressCircleRootProps as RootProps, } from "./ProgressCircle";
2
+ //# sourceMappingURL=ProgressCircle.namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressCircle.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/ProgressCircle.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,IAAI,KAAK,EAC5B,kBAAkB,IAAI,IAAI,EAC1B,KAAK,uBAAuB,IAAI,SAAS,GAC1C,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ export { ProgressCircleRange as Range, ProgressCircleRoot as Root, } from "./ProgressCircle";
@@ -1,2 +1,3 @@
1
- export { ProgressCircle, type RootProps as ProgressCircleProps } from "./ProgressCircle";
1
+ export { ProgressCircleRange, ProgressCircleRoot, type ProgressCircleRootProps, type ProgressCircleRootProps as ProgressCircleProps, type RootProps, } from "./ProgressCircle";
2
+ export * as ProgressCircle from "./ProgressCircle.namespace";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,IAAI,mBAAmB,EACnD,KAAK,SAAS,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
@@ -1 +1,2 @@
1
- export { ProgressCircle } from "./ProgressCircle";
1
+ export { ProgressCircleRange, ProgressCircleRoot, } from "./ProgressCircle";
2
+ export * as ProgressCircle from "./ProgressCircle.namespace";
@@ -0,0 +1,51 @@
1
+ import * as React from "react";
2
+ import { type CSSProperties, type ReactElement } from "react";
3
+ import type { MainThread } from "@lynx-js/types";
4
+ import type { RadioVariantProps } from "@seed-design/lynx-css/recipes/radio";
5
+ import type { RadiomarkVariantProps } from "@seed-design/lynx-css/recipes/radiomark";
6
+ export interface RadioGroupRootProps extends RadioVariantProps, Omit<RadiomarkVariantProps, "size" | "checked" | "disabled"> {
7
+ children?: React.ReactNode;
8
+ className?: string;
9
+ value?: string;
10
+ defaultValue?: string;
11
+ disabled?: boolean;
12
+ onValueChange?: (value: string) => void;
13
+ }
14
+ export declare const RadioGroupRoot: React.ForwardRefExoticComponent<RadioGroupRootProps & React.RefAttributes<unknown>>;
15
+ export interface RadioGroupItemProps {
16
+ value: string;
17
+ children?: React.ReactNode;
18
+ className?: string;
19
+ disabled?: boolean;
20
+ }
21
+ export declare const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<unknown>>;
22
+ export interface RadioGroupItemControlProps extends Pick<RadiomarkVariantProps, "tone"> {
23
+ children?: React.ReactNode;
24
+ className?: string;
25
+ }
26
+ export declare const RadioGroupItemControl: React.ForwardRefExoticComponent<RadioGroupItemControlProps & React.RefAttributes<unknown>>;
27
+ type IconElementProps = {
28
+ className?: string;
29
+ style?: CSSProperties;
30
+ ref?: React.Ref<MainThread.Element>;
31
+ "main-thread:binduiappear"?: () => void;
32
+ };
33
+ export interface RadioGroupItemIndicatorProps {
34
+ /** Icon rendered when not checked. Optional — falls back to default `<view>` dot when omitted. */
35
+ unchecked?: ReactElement<IconElementProps>;
36
+ /** Icon rendered when the item is checked. Optional — falls back to default `<view>` dot when omitted. */
37
+ checked?: ReactElement<IconElementProps>;
38
+ className?: string;
39
+ style?: CSSProperties;
40
+ }
41
+ export declare function RadioGroupItemIndicator(props: RadioGroupItemIndicatorProps): React.JSX.Element;
42
+ export declare namespace RadioGroupItemIndicator {
43
+ var displayName: string;
44
+ }
45
+ export interface RadioGroupItemLabelProps {
46
+ children?: React.ReactNode;
47
+ className?: string;
48
+ }
49
+ export declare const RadioGroupItemLabel: React.ForwardRefExoticComponent<RadioGroupItemLabelProps & React.RefAttributes<unknown>>;
50
+ export {};
51
+ //# sourceMappingURL=RadioGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAgC,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAE5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AA6ErF,MAAM,WAAW,mBACf,SAAQ,iBAAiB,EACvB,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;IAC9D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,cAAc,qFAsDzB,CAAC;AAKH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,qFAsDzB,CAAC;AAKH,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACrF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,qBAAqB,4FA+BjC,CAAC;AAKF,KAAK,gBAAgB,GAAG;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;CACzC,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,kGAAkG;IAClG,SAAS,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC3C,0GAA0G;IAC1G,OAAO,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,qBAgC1E;yBAhCe,uBAAuB;;;AAqCvC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,mBAAmB,0FAiB/B,CAAC"}
@@ -0,0 +1,144 @@
1
+ import * as React from "react";
2
+ import { cloneElement, isValidElement } from "react";
3
+ import clsx from "clsx";
4
+ import { radio } from "@seed-design/lynx-css/recipes/radio";
5
+ import { radiomark } from "@seed-design/lynx-css/recipes/radiomark";
6
+ import { radioGroup } from "@seed-design/lynx-css/recipes/radio-group";
7
+ import { vars as radiomarkVars } from "@seed-design/lynx-css/vars/component/radiomark";
8
+ import { useControllableState } from "../../hooks/useControllableState";
9
+ import { useIconColor } from "../../hooks/useIconColor";
10
+ import { usePressTap } from "../../hooks/usePressTap";
11
+ import { capitalize, resolveRecipeToken } from "../../utils/resolve-recipe-token";
12
+ import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props";
13
+ const RadioGroupContext = React.createContext(null);
14
+ function useRadioGroupContext(consumer) {
15
+ const ctx = React.useContext(RadioGroupContext);
16
+ if (!ctx) {
17
+ throw new Error(`<${consumer}/> must be rendered inside <RadioGroupRoot/>.`);
18
+ }
19
+ return ctx;
20
+ }
21
+ const RadioGroupItemContext = React.createContext(null);
22
+ function useRadioGroupItemContext(consumer) {
23
+ const ctx = React.useContext(RadioGroupItemContext);
24
+ if (!ctx) {
25
+ throw new Error(`<${consumer}/> must be rendered inside <RadioGroupItem/>.`);
26
+ }
27
+ return ctx;
28
+ }
29
+ const RadiomarkIconClassContext = React.createContext(null);
30
+ function useRadiomarkIconClass(consumer) {
31
+ const ctx = React.useContext(RadiomarkIconClassContext);
32
+ if (!ctx) {
33
+ throw new Error(`<${consumer}/> must be rendered inside <RadioGroupItemControl/>.`);
34
+ }
35
+ return ctx;
36
+ }
37
+ export const RadioGroupRoot = React.forwardRef((props, ref) => {
38
+ const { children, className, value: valueProp, defaultValue, disabled = false, onValueChange, ...restProps } = props;
39
+ const [{ radio: radioVariantProps, radiomark: radiomarkVariantProps }, nativeProps] = splitMultipleVariantsProps(restProps, { radio, radiomark });
40
+ const weight = radioVariantProps.weight ?? "regular";
41
+ const size = radioVariantProps.size ?? "medium";
42
+ const tone = radiomarkVariantProps.tone ?? "brand";
43
+ const handleChange = React.useCallback((next) => {
44
+ if (next !== null)
45
+ onValueChange?.(next);
46
+ }, [onValueChange]);
47
+ const [value, setValueInternal] = useControllableState({
48
+ value: valueProp !== undefined ? valueProp : undefined,
49
+ defaultValue: defaultValue ?? null,
50
+ onChange: handleChange,
51
+ });
52
+ const setValue = React.useCallback((next) => {
53
+ setValueInternal(next);
54
+ }, [setValueInternal]);
55
+ const rootClassName = radioGroup();
56
+ const ctx = React.useMemo(() => ({ value, setValue, disabled, size, weight, tone }), [value, setValue, disabled, size, weight, tone]);
57
+ return (<RadioGroupContext.Provider value={ctx}>
58
+ <view {...(ref ? { ref: ref } : {})} className={clsx(rootClassName, className)} {...nativeProps}>
59
+ {children}
60
+ </view>
61
+ </RadioGroupContext.Provider>);
62
+ });
63
+ RadioGroupRoot.displayName = "RadioGroupRoot";
64
+ export const RadioGroupItem = React.forwardRef((props, ref) => {
65
+ const { value: itemValue, disabled: itemDisabled = false, children, className, ...nativeProps } = props;
66
+ const { value: groupValue, setValue, disabled: groupDisabled, size, weight, tone, } = useRadioGroupContext("RadioGroupItem");
67
+ const disabled = groupDisabled || itemDisabled;
68
+ const checked = groupValue === itemValue;
69
+ const { pressed, ...pressHandlers } = usePressTap({
70
+ disabled,
71
+ onTap: () => {
72
+ if (checked)
73
+ return;
74
+ setValue(itemValue);
75
+ },
76
+ });
77
+ const rootClassName = radio({ weight, size, disabled }).root;
78
+ const itemCtx = React.useMemo(() => ({
79
+ value: itemValue,
80
+ checked,
81
+ disabled,
82
+ pressed,
83
+ tone,
84
+ size,
85
+ }), [itemValue, checked, disabled, pressed, tone, size]);
86
+ return (<RadioGroupItemContext.Provider value={itemCtx}>
87
+ <view {...(ref ? { ref: ref } : {})} className={clsx(rootClassName, className)} {...pressHandlers} {...nativeProps}>
88
+ {children}
89
+ </view>
90
+ </RadioGroupItemContext.Provider>);
91
+ });
92
+ RadioGroupItem.displayName = "RadioGroupItem";
93
+ export const RadioGroupItemControl = React.forwardRef((props, ref) => {
94
+ const [variantProps, restProps] = radiomark.splitVariantProps(props);
95
+ const { children, className, ...nativeProps } = restProps;
96
+ const { checked, disabled, pressed, tone: ctxTone, size, } = useRadioGroupItemContext("RadioGroupItemControl");
97
+ const tone = variantProps.tone ?? ctxTone;
98
+ const classes = React.useMemo(() => radiomark({ tone, size, checked, disabled, pressed }), [tone, size, checked, disabled, pressed]);
99
+ return (<RadiomarkIconClassContext.Provider value={classes.icon}>
100
+ <view {...(ref ? { ref: ref } : {})} className={clsx(classes.root, className)} {...nativeProps}>
101
+ {children}
102
+ </view>
103
+ </RadiomarkIconClassContext.Provider>);
104
+ });
105
+ RadioGroupItemControl.displayName = "RadioGroupItemControl";
106
+ export function RadioGroupItemIndicator(props) {
107
+ const { unchecked, checked: checkedIcon, className, style } = props;
108
+ const { checked, disabled, pressed, tone, size } = useRadioGroupItemContext("RadioGroupItemIndicator");
109
+ const iconClassName = useRadiomarkIconClass("RadioGroupItemIndicator");
110
+ const iconColor = useIconColor([checked, disabled, pressed, tone, size]);
111
+ const icon = checked ? checkedIcon : unchecked;
112
+ // 사용자가 custom icon 을 주지 않으면 default `<view>` 로 동그란 점을 그린다.
113
+ // radiomark.icon recipe 가 borderRadius/backgroundColor/width/height 를 적용해
114
+ // 라디오의 inner dot 모양을 재현. 웹 RadioGroup 의 default `<svg><circle/></svg>` 동작과 일치.
115
+ if (!icon || !isValidElement(icon)) {
116
+ return <view className={clsx(iconClassName, className)} style={style}/>;
117
+ }
118
+ // lynx-monochrome-icon 이 `<image style={{ width, height, ...style }}>` 로 자체 default size 를 박으므로
119
+ // recipe 토큰에서 꺼낸 사이즈를 inline 으로 주입해 덮는다.
120
+ const iconSize = resolveRecipeToken(radiomarkVars, [
121
+ `size${capitalize(size)}`,
122
+ disabled ? "disabled" : "enabled",
123
+ "icon",
124
+ "size",
125
+ ]);
126
+ return cloneElement(icon, {
127
+ ...iconColor,
128
+ className: clsx(iconClassName, icon.props.className, className),
129
+ style: iconSize
130
+ ? { width: iconSize, height: iconSize, ...icon.props.style, ...style }
131
+ : { ...icon.props.style, ...style },
132
+ });
133
+ }
134
+ RadioGroupItemIndicator.displayName = "RadioGroupItemIndicator";
135
+ export const RadioGroupItemLabel = React.forwardRef((props, ref) => {
136
+ const { children, className, ...nativeProps } = props;
137
+ const { disabled } = useRadioGroupItemContext("RadioGroupItemLabel");
138
+ const { size, weight } = useRadioGroupContext("RadioGroupItemLabel");
139
+ const labelClassName = radio({ weight, size, disabled }).label;
140
+ return (<text {...(ref ? { ref: ref } : {})} className={clsx(labelClassName, className)} {...nativeProps}>
141
+ {children}
142
+ </text>);
143
+ });
144
+ RadioGroupItemLabel.displayName = "RadioGroupItemLabel";
@@ -0,0 +1,2 @@
1
+ export { RadioGroupItem as Item, RadioGroupItemControl as ItemControl, RadioGroupItemIndicator as ItemIndicator, RadioGroupItemLabel as ItemLabel, RadioGroupRoot as Root, type RadioGroupItemControlProps as ItemControlProps, type RadioGroupItemIndicatorProps as ItemIndicatorProps, type RadioGroupItemLabelProps as ItemLabelProps, type RadioGroupItemProps as ItemProps, type RadioGroupRootProps as RootProps, } from "./RadioGroup";
2
+ //# sourceMappingURL=RadioGroup.namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/RadioGroup/RadioGroup.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,IAAI,IAAI,EACtB,qBAAqB,IAAI,WAAW,EACpC,uBAAuB,IAAI,aAAa,EACxC,mBAAmB,IAAI,SAAS,EAChC,cAAc,IAAI,IAAI,EACtB,KAAK,0BAA0B,IAAI,gBAAgB,EACnD,KAAK,4BAA4B,IAAI,kBAAkB,EACvD,KAAK,wBAAwB,IAAI,cAAc,EAC/C,KAAK,mBAAmB,IAAI,SAAS,EACrC,KAAK,mBAAmB,IAAI,SAAS,GACtC,MAAM,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export { RadioGroupItem as Item, RadioGroupItemControl as ItemControl, RadioGroupItemIndicator as ItemIndicator, RadioGroupItemLabel as ItemLabel, RadioGroupRoot as Root, } from "./RadioGroup";
@@ -0,0 +1,3 @@
1
+ export { RadioGroupRoot, RadioGroupItem, RadioGroupItemControl, RadioGroupItemIndicator, RadioGroupItemLabel, type RadioGroupRootProps, type RadioGroupItemProps, type RadioGroupItemControlProps, type RadioGroupItemIndicatorProps, type RadioGroupItemLabelProps, } from "./RadioGroup";
2
+ export * as RadioGroup from "./RadioGroup.namespace";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RadioGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,GAC9B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { RadioGroupRoot, RadioGroupItem, RadioGroupItemControl, RadioGroupItemIndicator, RadioGroupItemLabel, } from "./RadioGroup";
2
+ export * as RadioGroup from "./RadioGroup.namespace";
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import type { SwitchVariantProps } from "@seed-design/lynx-css/recipes/switch";
3
+ import type { SwitchmarkVariantProps } from "@seed-design/lynx-css/recipes/switchmark";
4
+ export interface SwitchRootProps extends SwitchVariantProps, Omit<SwitchmarkVariantProps, "size"> {
5
+ children?: React.ReactNode;
6
+ className?: string;
7
+ checked?: boolean;
8
+ defaultChecked?: boolean;
9
+ disabled?: boolean;
10
+ onCheckedChange?: (checked: boolean) => void;
11
+ }
12
+ export declare const SwitchRoot: React.ForwardRefExoticComponent<SwitchRootProps & React.RefAttributes<unknown>>;
13
+ export interface SwitchControlProps extends Pick<SwitchmarkVariantProps, "tone" | "size"> {
14
+ children?: React.ReactNode;
15
+ className?: string;
16
+ }
17
+ export declare const SwitchControl: React.ForwardRefExoticComponent<SwitchControlProps & React.RefAttributes<unknown>>;
18
+ export interface SwitchThumbProps {
19
+ className?: string;
20
+ }
21
+ export declare const SwitchThumb: React.ForwardRefExoticComponent<SwitchThumbProps & React.RefAttributes<unknown>>;
22
+ export interface SwitchLabelProps {
23
+ children?: React.ReactNode;
24
+ className?: string;
25
+ }
26
+ export declare const SwitchLabel: React.ForwardRefExoticComponent<SwitchLabelProps & React.RefAttributes<unknown>>;
27
+ //# sourceMappingURL=Switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAmDvF,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAC/F,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,UAAU,iFA6CrB,CAAC;AAKH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,CAAC;IACvF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,oFAwBxB,CAAC;AAKH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,kFAWtB,CAAC;AAKH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,kFActB,CAAC"}
@@ -0,0 +1,75 @@
1
+ import * as React from "react";
2
+ import clsx from "clsx";
3
+ import { switchStyle } from "@seed-design/lynx-css/recipes/switch";
4
+ import { switchmark } from "@seed-design/lynx-css/recipes/switchmark";
5
+ import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props";
6
+ import { useControllableState } from "../../hooks/useControllableState";
7
+ import { usePressTap } from "../../hooks/usePressTap";
8
+ const SwitchContext = React.createContext(null);
9
+ function useSwitchContext(consumer) {
10
+ const ctx = React.useContext(SwitchContext);
11
+ if (!ctx) {
12
+ throw new Error(`<${consumer}/> must be rendered inside <SwitchRoot/>.`);
13
+ }
14
+ return ctx;
15
+ }
16
+ const SwitchmarkThumbClassContext = React.createContext(null);
17
+ function useSwitchmarkThumbClass(consumer) {
18
+ const ctx = React.useContext(SwitchmarkThumbClassContext);
19
+ if (!ctx) {
20
+ throw new Error(`<${consumer}/> must be rendered inside <SwitchControl/>.`);
21
+ }
22
+ return ctx;
23
+ }
24
+ export const SwitchRoot = React.forwardRef((props, ref) => {
25
+ const { children, className, checked: checkedProp, defaultChecked = false, disabled = false, onCheckedChange, ...restProps } = props;
26
+ const [{ switch: switchVariantProps, switchmark: switchmarkVariantProps }, nativeProps] = splitMultipleVariantsProps(restProps, { switch: switchStyle, switchmark });
27
+ const size = switchVariantProps.size ?? "32";
28
+ const tone = switchmarkVariantProps.tone ?? "brand";
29
+ const [checked, setChecked] = useControllableState({
30
+ value: checkedProp,
31
+ defaultValue: defaultChecked,
32
+ onChange: onCheckedChange,
33
+ });
34
+ const { pressed: _pressed, ...pressHandlers } = usePressTap({
35
+ disabled,
36
+ onTap: () => setChecked(!checked),
37
+ });
38
+ const rootClassName = switchStyle({ size }).root;
39
+ const ctx = React.useMemo(() => ({ checked, disabled, size, tone }), [checked, disabled, size, tone]);
40
+ return (<SwitchContext.Provider value={ctx}>
41
+ <view {...(ref ? { ref: ref } : {})} className={clsx(rootClassName, className)} {...pressHandlers} {...nativeProps}>
42
+ {children}
43
+ </view>
44
+ </SwitchContext.Provider>);
45
+ });
46
+ SwitchRoot.displayName = "SwitchRoot";
47
+ export const SwitchControl = React.forwardRef((props, ref) => {
48
+ const [variantProps, restProps] = switchmark.splitVariantProps(props);
49
+ const { children, className, ...nativeProps } = restProps;
50
+ const { checked, disabled, tone: ctxTone, size: ctxSize } = useSwitchContext("SwitchControl");
51
+ const tone = variantProps.tone ?? ctxTone;
52
+ const size = variantProps.size ?? ctxSize;
53
+ const classes = React.useMemo(() => switchmark({ tone, size, checked, disabled }), [tone, size, checked, disabled]);
54
+ return (<SwitchmarkThumbClassContext.Provider value={classes.thumb}>
55
+ <view {...(ref ? { ref: ref } : {})} className={clsx(classes.root, className)} {...nativeProps}>
56
+ {children}
57
+ </view>
58
+ </SwitchmarkThumbClassContext.Provider>);
59
+ });
60
+ SwitchControl.displayName = "SwitchControl";
61
+ export const SwitchThumb = React.forwardRef((props, ref) => {
62
+ const { className, ...nativeProps } = props;
63
+ const thumbClassName = useSwitchmarkThumbClass("SwitchThumb");
64
+ return (<view {...(ref ? { ref: ref } : {})} className={clsx(thumbClassName, className)} {...nativeProps}/>);
65
+ });
66
+ SwitchThumb.displayName = "SwitchThumb";
67
+ export const SwitchLabel = React.forwardRef((props, ref) => {
68
+ const { children, className, ...nativeProps } = props;
69
+ const { disabled, size } = useSwitchContext("SwitchLabel");
70
+ const labelClassName = switchStyle({ size, disabled }).label;
71
+ return (<text {...(ref ? { ref: ref } : {})} className={clsx(labelClassName, className)} {...nativeProps}>
72
+ {children}
73
+ </text>);
74
+ });
75
+ SwitchLabel.displayName = "SwitchLabel";
@@ -0,0 +1,2 @@
1
+ export { SwitchControl as Control, SwitchLabel as Label, SwitchRoot as Root, SwitchThumb as Thumb, type SwitchControlProps as ControlProps, type SwitchLabelProps as LabelProps, type SwitchRootProps as RootProps, type SwitchThumbProps as ThumbProps, } from "./Switch";
2
+ //# sourceMappingURL=Switch.namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Switch.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,OAAO,EACxB,WAAW,IAAI,KAAK,EACpB,UAAU,IAAI,IAAI,EAClB,WAAW,IAAI,KAAK,EACpB,KAAK,kBAAkB,IAAI,YAAY,EACvC,KAAK,gBAAgB,IAAI,UAAU,EACnC,KAAK,eAAe,IAAI,SAAS,EACjC,KAAK,gBAAgB,IAAI,UAAU,GACpC,MAAM,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ export { SwitchControl as Control, SwitchLabel as Label, SwitchRoot as Root, SwitchThumb as Thumb, } from "./Switch";
@@ -0,0 +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";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC"}