@seed-design/lynx-react 0.0.0-alpha-20260622094810

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 (196) hide show
  1. package/lib/_virtual/_rolldown/runtime.js +13 -0
  2. package/lib/components/ActionButton/ActionButton.d.ts +49 -0
  3. package/lib/components/ActionButton/ActionButton.d.ts.map +1 -0
  4. package/lib/components/ActionButton/ActionButton.jsx +158 -0
  5. package/lib/components/ActionButton/index.d.ts +2 -0
  6. package/lib/components/ActionButton/index.d.ts.map +1 -0
  7. package/lib/components/AppBar/AppBar.d.ts +35 -0
  8. package/lib/components/AppBar/AppBar.d.ts.map +1 -0
  9. package/lib/components/AppBar/AppBar.jsx +132 -0
  10. package/lib/components/AppBar/AppBar.namespace.d.ts +2 -0
  11. package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -0
  12. package/lib/components/AppBar/AppBar.namespace.js +15 -0
  13. package/lib/components/AppBar/context.d.ts +13 -0
  14. package/lib/components/AppBar/context.d.ts.map +1 -0
  15. package/lib/components/AppBar/context.js +12 -0
  16. package/lib/components/AppBar/index.d.ts +3 -0
  17. package/lib/components/AppBar/index.d.ts.map +1 -0
  18. package/lib/components/AppBar/useAppBar.d.ts +15 -0
  19. package/lib/components/AppBar/useAppBar.d.ts.map +1 -0
  20. package/lib/components/AppBar/useAppBar.js +72 -0
  21. package/lib/components/Badge/Badge.d.ts +14 -0
  22. package/lib/components/Badge/Badge.d.ts.map +1 -0
  23. package/lib/components/Badge/Badge.jsx +15 -0
  24. package/lib/components/Badge/index.d.ts +2 -0
  25. package/lib/components/Badge/index.d.ts.map +1 -0
  26. package/lib/components/BottomSheet/BottomSheet.d.ts +87 -0
  27. package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -0
  28. package/lib/components/BottomSheet/BottomSheet.jsx +163 -0
  29. package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +2 -0
  30. package/lib/components/BottomSheet/BottomSheet.namespace.d.ts.map +1 -0
  31. package/lib/components/BottomSheet/BottomSheet.namespace.js +18 -0
  32. package/lib/components/BottomSheet/index.d.ts +3 -0
  33. package/lib/components/BottomSheet/index.d.ts.map +1 -0
  34. package/lib/components/Box/Box.d.ts +20 -0
  35. package/lib/components/Box/Box.d.ts.map +1 -0
  36. package/lib/components/Box/Box.jsx +14 -0
  37. package/lib/components/Box/index.d.ts +2 -0
  38. package/lib/components/Box/index.d.ts.map +1 -0
  39. package/lib/components/Checkbox/Checkbox.d.ts +35 -0
  40. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -0
  41. package/lib/components/Checkbox/Checkbox.jsx +130 -0
  42. package/lib/components/Checkbox/Checkbox.namespace.d.ts +2 -0
  43. package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -0
  44. package/lib/components/Checkbox/Checkbox.namespace.js +12 -0
  45. package/lib/components/Checkbox/index.d.ts +3 -0
  46. package/lib/components/Checkbox/index.d.ts.map +1 -0
  47. package/lib/components/Icon/Icon.d.ts +37 -0
  48. package/lib/components/Icon/Icon.d.ts.map +1 -0
  49. package/lib/components/Icon/Icon.jsx +143 -0
  50. package/lib/components/Icon/index.d.ts +2 -0
  51. package/lib/components/Icon/index.d.ts.map +1 -0
  52. package/lib/components/ProgressCircle/ProgressCircle.d.ts +25 -0
  53. package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -0
  54. package/lib/components/ProgressCircle/ProgressCircle.jsx +281 -0
  55. package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +2 -0
  56. package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts.map +1 -0
  57. package/lib/components/ProgressCircle/ProgressCircle.namespace.js +9 -0
  58. package/lib/components/ProgressCircle/index.d.ts +3 -0
  59. package/lib/components/ProgressCircle/index.d.ts.map +1 -0
  60. package/lib/components/RadioGroup/RadioGroup.d.ts +34 -0
  61. package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -0
  62. package/lib/components/RadioGroup/RadioGroup.jsx +160 -0
  63. package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +2 -0
  64. package/lib/components/RadioGroup/RadioGroup.namespace.d.ts.map +1 -0
  65. package/lib/components/RadioGroup/RadioGroup.namespace.js +12 -0
  66. package/lib/components/RadioGroup/index.d.ts +3 -0
  67. package/lib/components/RadioGroup/index.d.ts.map +1 -0
  68. package/lib/components/Stack/Stack.d.ts +33 -0
  69. package/lib/components/Stack/Stack.d.ts.map +1 -0
  70. package/lib/components/Stack/Stack.jsx +39 -0
  71. package/lib/components/Stack/index.d.ts +2 -0
  72. package/lib/components/Stack/index.d.ts.map +1 -0
  73. package/lib/components/Switch/Switch.d.ts +21 -0
  74. package/lib/components/Switch/Switch.d.ts.map +1 -0
  75. package/lib/components/Switch/Switch.jsx +101 -0
  76. package/lib/components/Switch/Switch.namespace.d.ts +2 -0
  77. package/lib/components/Switch/Switch.namespace.d.ts.map +1 -0
  78. package/lib/components/Switch/Switch.namespace.js +11 -0
  79. package/lib/components/Switch/index.d.ts +3 -0
  80. package/lib/components/Switch/index.d.ts.map +1 -0
  81. package/lib/components/TagGroup/TagGroup.d.ts +34 -0
  82. package/lib/components/TagGroup/TagGroup.d.ts.map +1 -0
  83. package/lib/components/TagGroup/TagGroup.jsx +57 -0
  84. package/lib/components/TagGroup/TagGroup.namespace.d.ts +2 -0
  85. package/lib/components/TagGroup/TagGroup.namespace.d.ts.map +1 -0
  86. package/lib/components/TagGroup/TagGroup.namespace.js +10 -0
  87. package/lib/components/TagGroup/index.d.ts +3 -0
  88. package/lib/components/TagGroup/index.d.ts.map +1 -0
  89. package/lib/components/Text/Text.d.ts +7 -0
  90. package/lib/components/Text/Text.d.ts.map +1 -0
  91. package/lib/components/Text/Text.jsx +28 -0
  92. package/lib/components/Text/index.d.ts +2 -0
  93. package/lib/components/Text/index.d.ts.map +1 -0
  94. package/lib/components/index.d.ts +14 -0
  95. package/lib/components/index.d.ts.map +1 -0
  96. package/lib/hooks/index.d.ts +5 -0
  97. package/lib/hooks/index.d.ts.map +1 -0
  98. package/lib/hooks/useControllableState.d.ts +15 -0
  99. package/lib/hooks/useControllableState.d.ts.map +1 -0
  100. package/lib/hooks/useControllableState.js +27 -0
  101. package/lib/hooks/useIconColor.d.ts +19 -0
  102. package/lib/hooks/useIconColor.d.ts.map +1 -0
  103. package/lib/hooks/useIconColor.js +38 -0
  104. package/lib/hooks/usePressTap.d.ts +27 -0
  105. package/lib/hooks/usePressTap.d.ts.map +1 -0
  106. package/lib/hooks/usePressTap.js +35 -0
  107. package/lib/hooks/useSafeArea.d.ts +19 -0
  108. package/lib/hooks/useSafeArea.d.ts.map +1 -0
  109. package/lib/hooks/useSafeArea.js +33 -0
  110. package/lib/index.d.ts +5 -0
  111. package/lib/index.d.ts.map +1 -0
  112. package/lib/index.js +29 -0
  113. package/lib/types.d.ts +51 -0
  114. package/lib/types.d.ts.map +1 -0
  115. package/lib/utils/children.d.ts +3 -0
  116. package/lib/utils/children.d.ts.map +1 -0
  117. package/lib/utils/children.js +8 -0
  118. package/lib/utils/create-slot-recipe-context.d.ts +27 -0
  119. package/lib/utils/create-slot-recipe-context.d.ts.map +1 -0
  120. package/lib/utils/create-slot-recipe-context.jsx +94 -0
  121. package/lib/utils/get-seed-class-name.d.ts +22 -0
  122. package/lib/utils/get-seed-class-name.d.ts.map +1 -0
  123. package/lib/utils/get-seed-class-name.js +28 -0
  124. package/lib/utils/index.d.ts +5 -0
  125. package/lib/utils/index.d.ts.map +1 -0
  126. package/lib/utils/resolve-recipe-token.d.ts +38 -0
  127. package/lib/utils/resolve-recipe-token.d.ts.map +1 -0
  128. package/lib/utils/resolve-recipe-token.js +49 -0
  129. package/lib/utils/split-multiple-variants-props.d.ts +29 -0
  130. package/lib/utils/split-multiple-variants-props.d.ts.map +1 -0
  131. package/lib/utils/split-multiple-variants-props.js +34 -0
  132. package/lib/utils/styled.d.ts +83 -0
  133. package/lib/utils/styled.d.ts.map +1 -0
  134. package/lib/utils/styled.js +144 -0
  135. package/package.json +54 -0
  136. package/src/components/ActionButton/ActionButton.test.tsx +167 -0
  137. package/src/components/ActionButton/ActionButton.tsx +363 -0
  138. package/src/components/ActionButton/index.ts +1 -0
  139. package/src/components/AppBar/AppBar.namespace.ts +18 -0
  140. package/src/components/AppBar/AppBar.test.tsx +270 -0
  141. package/src/components/AppBar/AppBar.tsx +288 -0
  142. package/src/components/AppBar/context.ts +27 -0
  143. package/src/components/AppBar/index.ts +21 -0
  144. package/src/components/AppBar/useAppBar.ts +100 -0
  145. package/src/components/Badge/Badge.test.tsx +54 -0
  146. package/src/components/Badge/Badge.tsx +32 -0
  147. package/src/components/Badge/index.ts +1 -0
  148. package/src/components/BottomSheet/BottomSheet.namespace.ts +24 -0
  149. package/src/components/BottomSheet/BottomSheet.test.tsx +219 -0
  150. package/src/components/BottomSheet/BottomSheet.tsx +423 -0
  151. package/src/components/BottomSheet/index.ts +27 -0
  152. package/src/components/Box/Box.test.tsx +85 -0
  153. package/src/components/Box/Box.tsx +39 -0
  154. package/src/components/Box/index.ts +1 -0
  155. package/src/components/Checkbox/Checkbox.namespace.ts +12 -0
  156. package/src/components/Checkbox/Checkbox.tsx +282 -0
  157. package/src/components/Checkbox/index.ts +14 -0
  158. package/src/components/Icon/Icon.tsx +265 -0
  159. package/src/components/Icon/index.ts +8 -0
  160. package/src/components/ProgressCircle/ProgressCircle.namespace.ts +5 -0
  161. package/src/components/ProgressCircle/ProgressCircle.tsx +424 -0
  162. package/src/components/ProgressCircle/index.ts +9 -0
  163. package/src/components/RadioGroup/RadioGroup.namespace.ts +12 -0
  164. package/src/components/RadioGroup/RadioGroup.tsx +320 -0
  165. package/src/components/RadioGroup/index.ts +14 -0
  166. package/src/components/Stack/Stack.tsx +97 -0
  167. package/src/components/Stack/index.ts +1 -0
  168. package/src/components/Switch/Switch.namespace.ts +10 -0
  169. package/src/components/Switch/Switch.tsx +200 -0
  170. package/src/components/Switch/index.ts +12 -0
  171. package/src/components/TagGroup/TagGroup.namespace.ts +8 -0
  172. package/src/components/TagGroup/TagGroup.tsx +127 -0
  173. package/src/components/TagGroup/index.ts +10 -0
  174. package/src/components/Text/Text.tsx +64 -0
  175. package/src/components/Text/index.ts +1 -0
  176. package/src/components/index.ts +13 -0
  177. package/src/hooks/index.ts +4 -0
  178. package/src/hooks/useControllableState.test.ts +120 -0
  179. package/src/hooks/useControllableState.ts +38 -0
  180. package/src/hooks/useIconColor.test.ts +13 -0
  181. package/src/hooks/useIconColor.ts +67 -0
  182. package/src/hooks/usePressTap.test.ts +129 -0
  183. package/src/hooks/usePressTap.ts +58 -0
  184. package/src/hooks/useSafeArea.test.ts +83 -0
  185. package/src/hooks/useSafeArea.ts +56 -0
  186. package/src/index.ts +4 -0
  187. package/src/types.ts +76 -0
  188. package/src/utils/children.ts +13 -0
  189. package/src/utils/create-slot-recipe-context.test.tsx +96 -0
  190. package/src/utils/create-slot-recipe-context.tsx +187 -0
  191. package/src/utils/get-seed-class-name.ts +47 -0
  192. package/src/utils/index.ts +4 -0
  193. package/src/utils/resolve-recipe-token.ts +47 -0
  194. package/src/utils/split-multiple-variants-props.test.ts +61 -0
  195. package/src/utils/split-multiple-variants-props.ts +59 -0
  196. package/src/utils/styled.ts +442 -0
@@ -0,0 +1,143 @@
1
+ import { handleColor, handleDimension } from "../../utils/styled.js";
2
+ import { useIconColor } from "../../hooks/useIconColor.js";
3
+ import clsx from "clsx";
4
+ import * as React from "@lynx-js/react";
5
+ import { cloneElement, isValidElement, useMainThreadRef } from "@lynx-js/react";
6
+ //#region src/components/Icon/Icon.tsx
7
+ var IconSlotContext = React.createContext(null);
8
+ var IconRequiredContext = React.createContext(null);
9
+ function IconRequired({ children, enabled }) {
10
+ const registeredCountRef = React.useRef(0);
11
+ const parentContext = React.useContext(IconRequiredContext);
12
+ const register = React.useCallback(() => {
13
+ registeredCountRef.current += 1;
14
+ if (process.env.NODE_ENV !== "production" && registeredCountRef.current > 1) throw new Error("Icon-only Component must render only one <Icon /> under children. Check if you are rendering multiple <Icon />.");
15
+ }, []);
16
+ const unregister = React.useCallback(() => {
17
+ registeredCountRef.current = Math.max(0, registeredCountRef.current - 1);
18
+ }, []);
19
+ React.useLayoutEffect(() => {
20
+ if (!enabled) return;
21
+ if (process.env.NODE_ENV !== "production") {
22
+ if (parentContext) throw new Error("Icon-only Component must not be nested within another Icon-Only. Check if you are using Icon-Only inside another Icon-Only.");
23
+ if (registeredCountRef.current === 0) throw new Error("Icon-only Component must render <Icon /> as a child. Check if you are using raw icon element instead of <Icon icon={} />.");
24
+ }
25
+ }, [enabled, parentContext]);
26
+ const value = React.useMemo(() => {
27
+ if (!enabled) return parentContext ?? null;
28
+ return {
29
+ register,
30
+ unregister
31
+ };
32
+ }, [
33
+ enabled,
34
+ parentContext,
35
+ register,
36
+ unregister
37
+ ]);
38
+ return <IconRequiredContext.Provider value={value}>{children}</IconRequiredContext.Provider>;
39
+ }
40
+ function IconSlotProvider({ value, children }) {
41
+ return <IconSlotContext.Provider value={value}>{children}</IconSlotContext.Provider>;
42
+ }
43
+ var iconSlotMarker = Symbol.for("@seed-design/lynx-react/icon-slot");
44
+ function getIconSlotName(node) {
45
+ if (!isValidElement(node)) return null;
46
+ return node.type[iconSlotMarker] ?? null;
47
+ }
48
+ function mergeWrapperStyle({ size, color, style }) {
49
+ const dimension = handleDimension(size);
50
+ const resolvedColor = handleColor(color);
51
+ if (dimension == null && resolvedColor == null) return style;
52
+ return {
53
+ ...dimension != null ? {
54
+ width: dimension,
55
+ height: dimension
56
+ } : {},
57
+ ...resolvedColor != null ? { color: resolvedColor } : {},
58
+ ...style
59
+ };
60
+ }
61
+ function getStyleColor(style) {
62
+ return style?.color;
63
+ }
64
+ var IconSlotBase = React.forwardRef((props, ref) => {
65
+ const { icon, slot, baseClassName, className, style, size, color, children: _children, ...nativeProps } = props;
66
+ const context = React.useContext(IconSlotContext);
67
+ const iconRequiredContext = React.useContext(IconRequiredContext);
68
+ const sourceRef = useMainThreadRef(null);
69
+ const slotClassName = slot != null ? context?.classNames?.[slot] : void 0;
70
+ const iconColor = useIconColor([
71
+ baseClassName,
72
+ slotClassName,
73
+ className,
74
+ size,
75
+ color,
76
+ getStyleColor(style),
77
+ ...context?.deps ?? []
78
+ ], { sourceRef });
79
+ const hasValidIcon = isValidElement(icon);
80
+ React.useLayoutEffect(() => {
81
+ if (slot !== "icon" || !hasValidIcon) return;
82
+ iconRequiredContext?.register();
83
+ return () => {
84
+ iconRequiredContext?.unregister();
85
+ };
86
+ }, [
87
+ hasValidIcon,
88
+ iconRequiredContext,
89
+ slot
90
+ ]);
91
+ if (!hasValidIcon) return null;
92
+ return <view {...ref ? { ref } : {}} {...nativeProps} main-thread:ref={sourceRef} className={clsx(baseClassName, slotClassName, className)} style={mergeWrapperStyle({
93
+ size,
94
+ color,
95
+ style
96
+ })}>
97
+ {cloneElement(icon, {
98
+ ...iconColor,
99
+ className: icon.props.className,
100
+ style: {
101
+ ...icon.props.style,
102
+ width: "100%",
103
+ height: "100%"
104
+ }
105
+ })}
106
+ </view>;
107
+ });
108
+ IconSlotBase.displayName = "IconSlotBase";
109
+ function createIconComponent(displayName, slot, baseClassName) {
110
+ const Component = React.forwardRef((props, ref) => {
111
+ return <IconSlotBase ref={ref} slot={slot} baseClassName={baseClassName} {...props} />;
112
+ });
113
+ Component.displayName = displayName;
114
+ Component[iconSlotMarker] = slot;
115
+ return Component;
116
+ }
117
+ var Icon = createIconComponent("Icon", "icon", "seed-icon");
118
+ var PrefixIcon = createIconComponent("PrefixIcon", "prefixIcon", "seed-prefix-icon");
119
+ var SuffixIcon = createIconComponent("SuffixIcon", "suffixIcon", "seed-suffix-icon");
120
+ var InternalIcon = React.forwardRef((props, ref) => {
121
+ const { icon, deps = [], className, style, children: _children, ...nativeProps } = props;
122
+ const sourceRef = useMainThreadRef(null);
123
+ const iconColor = useIconColor([
124
+ className,
125
+ getStyleColor(style),
126
+ ...deps ?? []
127
+ ], { sourceRef });
128
+ if (!isValidElement(icon)) return null;
129
+ return <view {...ref ? { ref } : {}} {...nativeProps} main-thread:ref={sourceRef} className={className} style={style}>
130
+ {cloneElement(icon, {
131
+ ...iconColor,
132
+ className: icon.props.className,
133
+ style: {
134
+ ...icon.props.style,
135
+ width: "100%",
136
+ height: "100%"
137
+ }
138
+ })}
139
+ </view>;
140
+ });
141
+ InternalIcon.displayName = "InternalIcon";
142
+ //#endregion
143
+ export { Icon, IconRequired, IconSlotProvider, InternalIcon, PrefixIcon, SuffixIcon, getIconSlotName };
@@ -0,0 +1,2 @@
1
+ export { Icon, PrefixIcon, SuffixIcon, type IconProps, type PrefixIconProps, type SuffixIconProps, } from './Icon';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { ProgressCircleVariantProps } from '@seed-design/lynx-css/recipes/progress-circle';
2
+ import { LynxStyledElementProps } from '../../types';
3
+ import type * as React from "@lynx-js/react";
4
+ export interface ProgressCircleRootProps extends ProgressCircleVariantProps, LynxStyledElementProps {
5
+ minValue?: number;
6
+ maxValue?: number;
7
+ value?: number;
8
+ }
9
+ export type RootProps = ProgressCircleRootProps;
10
+ /**
11
+ * Lynx에서 SVG를 사용할 수 없어 CSS clip-path 기반 pie sector로 구현.
12
+ *
13
+ * **Known Issues:**
14
+ * - clip-path가 Lynx에서 animatable이 아니라 JS RAF로 매 프레임 SVG path 생성
15
+ * - Lynx main thread에서 모듈 레벨 Map 미지원으로 인스턴스 간 RAF 공유 불가
16
+ * - 다수 인스턴스 동시 렌더링 시 성능 저하 가능
17
+ *
18
+ * Lynx SVG + stroke-dasharray 지원 시 CSS-only 애니메이션으로 전환 예정.
19
+ */
20
+ export declare const ProgressCircleRoot: React.ForwardRefExoticComponent<ProgressCircleRootProps & React.RefAttributes<unknown>>;
21
+ export declare const ProgressCircleRange: {
22
+ (): React.JSX.Element;
23
+ displayName: string;
24
+ };
25
+ //# sourceMappingURL=ProgressCircle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressCircle.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/ProgressCircle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAa7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AA2GvE,MAAM,WAAW,uBACf,SAAQ,0BAA0B,EAChC,sBAAsB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAIhD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,yFA8B7B,CAAC;AAIH,eAAO,MAAM,mBAAmB;;;CAQ/B,CAAC"}
@@ -0,0 +1,281 @@
1
+ import { progressCircle } from "@seed-design/lynx-css/recipes/progress-circle";
2
+ import clsx from "clsx";
3
+ import { createContext, forwardRef, runOnMainThread, useContext, useEffect, useMainThreadRef, useMemo } from "@lynx-js/react";
4
+ //#region src/components/ProgressCircle/ProgressCircle.tsx
5
+ var ProgressCircleContext = createContext(null);
6
+ function useProgressCircleContext() {
7
+ const ctx = useContext(ProgressCircleContext);
8
+ if (!ctx) throw new Error("ProgressCircle compound components must be used within ProgressCircle.Root");
9
+ return ctx;
10
+ }
11
+ function computeRingGeometry(numSize) {
12
+ const halfSize = numSize / 2;
13
+ const innerR = .53 * Math.SQRT2 * halfSize;
14
+ return {
15
+ halfSize,
16
+ innerR,
17
+ ringCenterR: (halfSize + innerR) / 2,
18
+ capSize: halfSize - innerR
19
+ };
20
+ }
21
+ function bgPieClipPath(size, angleDeg) {
22
+ if (angleDeg >= 360) return void 0;
23
+ if (angleDeg <= 0) return "path(\"M 0 0 Z\")";
24
+ const c = size / 2;
25
+ const r = c + 1;
26
+ const rad = angleDeg * Math.PI / 180;
27
+ const endX = c + r * Math.sin(rad);
28
+ const endY = c - r * Math.cos(rad);
29
+ const largeArc = angleDeg > 180 ? 1 : 0;
30
+ return `path("M ${c} ${c} L ${c} ${c - r} A ${r} ${r} 0 ${largeArc} 1 ${endX} ${endY} Z")`;
31
+ }
32
+ function cubicBezier(rawT, x1, y1, x2, y2) {
33
+ "main thread";
34
+ const t = Math.max(0, Math.min(1, rawT));
35
+ const cx = 3 * x1;
36
+ const bx = 3 * (x2 - x1) - cx;
37
+ const ax = 1 - cx - bx;
38
+ let currentT = t;
39
+ for (let i = 0; i < 8; i++) {
40
+ const currentX = ((ax * currentT + bx) * currentT + cx) * currentT - t;
41
+ const currentDx = (3 * ax * currentT + 2 * bx) * currentT + cx;
42
+ if (Math.abs(currentDx) < 1e-6) break;
43
+ currentT = currentT - currentX / currentDx;
44
+ }
45
+ const cy = 3 * y1;
46
+ const by = 3 * (y2 - y1) - cy;
47
+ return (((1 - cy - by) * currentT + by) * currentT + cy) * currentT;
48
+ }
49
+ function pieClipPath(size, angleDeg) {
50
+ "main thread";
51
+ if (angleDeg >= 360) return void 0;
52
+ if (angleDeg <= 0) return "path(\"M 0 0 Z\")";
53
+ const c = size / 2;
54
+ const r = c + 1;
55
+ const rad = angleDeg * Math.PI / 180;
56
+ const endX = c + r * Math.sin(rad);
57
+ const endY = c - r * Math.cos(rad);
58
+ const largeArc = angleDeg > 180 ? 1 : 0;
59
+ return `path("M ${c} ${c} L ${c} ${c - r} A ${r} ${r} 0 ${largeArc} 1 ${endX} ${endY} Z")`;
60
+ }
61
+ function sampleIndeterminate(t) {
62
+ "main thread";
63
+ const containerEased = cubicBezier(t, .35, .25, .65, .75);
64
+ const headEased = cubicBezier(t, .35, 0, .65, 1);
65
+ const tailEased = cubicBezier(t, .35, 0, .65, .6);
66
+ const headLength = headEased <= .75 ? headEased / .75 * 360 : 360;
67
+ const tailOffset = tailEased <= 1 / 3 ? 0 : (tailEased - 1 / 3) / (2 / 3) * 360;
68
+ const arcLength = Math.max(0, headLength - tailOffset);
69
+ return {
70
+ containerDeg: containerEased * 360 + tailOffset,
71
+ arcLength
72
+ };
73
+ }
74
+ var INDETERMINATE_DURATION = 1200;
75
+ var TRANSITION_DURATION = 300;
76
+ /**
77
+ * Lynx에서 SVG를 사용할 수 없어 CSS clip-path 기반 pie sector로 구현.
78
+ *
79
+ * **Known Issues:**
80
+ * - clip-path가 Lynx에서 animatable이 아니라 JS RAF로 매 프레임 SVG path 생성
81
+ * - Lynx main thread에서 모듈 레벨 Map 미지원으로 인스턴스 간 RAF 공유 불가
82
+ * - 다수 인스턴스 동시 렌더링 시 성능 저하 가능
83
+ *
84
+ * Lynx SVG + stroke-dasharray 지원 시 CSS-only 애니메이션으로 전환 예정.
85
+ */
86
+ var ProgressCircleRoot = forwardRef((props, ref) => {
87
+ const [variantProps, otherProps] = progressCircle.splitVariantProps(props);
88
+ const { children, className, style, minValue, maxValue, value } = otherProps;
89
+ const size = variantProps.size ?? "40";
90
+ const tone = variantProps.tone ?? "neutral";
91
+ const numSize = Number(size);
92
+ const isDeterminate = minValue !== void 0 && maxValue !== void 0 && value !== void 0;
93
+ const range = (maxValue ?? 1) - (minValue ?? 0);
94
+ const progress = isDeterminate ? range === 0 ? 0 : ((value ?? 0) - (minValue ?? 0)) / range : 0;
95
+ const classes = progressCircle({
96
+ tone,
97
+ size
98
+ });
99
+ const ctx = useMemo(() => ({
100
+ numSize,
101
+ isDeterminate,
102
+ progress,
103
+ classes
104
+ }), [
105
+ numSize,
106
+ isDeterminate,
107
+ progress,
108
+ classes
109
+ ]);
110
+ return <ProgressCircleContext.Provider value={ctx}>
111
+ <view {...ref ? { ref } : {}} className={clsx(classes.root, className)} style={{
112
+ ...style,
113
+ width: `${numSize}px`,
114
+ height: `${numSize}px`
115
+ }}>
116
+ {children}
117
+ </view>
118
+ </ProgressCircleContext.Provider>;
119
+ });
120
+ var ProgressCircleRange = () => {
121
+ const { numSize, isDeterminate, progress, classes } = useProgressCircleContext();
122
+ if (!isDeterminate) return <IndeterminateRange numSize={numSize} classes={classes} />;
123
+ return <DeterminateRange numSize={numSize} progress={progress} classes={classes} />;
124
+ };
125
+ function DeterminateRange({ numSize, progress, classes }) {
126
+ const rangeRef = useMainThreadRef(null);
127
+ const startCapRef = useMainThreadRef(null);
128
+ const endCapRef = useMainThreadRef(null);
129
+ const prevProgressRef = useMainThreadRef(progress);
130
+ const cancelRef = useMainThreadRef(0);
131
+ const { halfSize, ringCenterR, capSize } = computeRingGeometry(numSize);
132
+ const initialAngle = progress * 360;
133
+ const initialClipPath = bgPieClipPath(numSize, initialAngle);
134
+ const initialEndRad = initialAngle * Math.PI / 180;
135
+ function startAnimation(newProgress) {
136
+ "main thread";
137
+ if (cancelRef.current) {
138
+ cancelAnimationFrame(cancelRef.current);
139
+ cancelRef.current = 0;
140
+ }
141
+ const from = prevProgressRef.current ?? 0;
142
+ prevProgressRef.current = newProgress;
143
+ if (from === newProgress) return;
144
+ const rangeEl = rangeRef.current;
145
+ const endCapEl = endCapRef.current;
146
+ let startTs = 0;
147
+ function applyProgress(p) {
148
+ const angleDeg = p * 360;
149
+ const cp = pieClipPath(numSize, angleDeg);
150
+ if (cp) rangeEl?.setStyleProperty("clip-path", cp);
151
+ else rangeEl?.setStyleProperty("clip-path", "none");
152
+ const rad = angleDeg * Math.PI / 180;
153
+ endCapEl?.setStyleProperties({
154
+ left: `${halfSize + ringCenterR * Math.sin(rad) - capSize / 2}px`,
155
+ top: `${halfSize - ringCenterR * Math.cos(rad) - capSize / 2}px`
156
+ });
157
+ }
158
+ function step(ts) {
159
+ if (!startTs) startTs = Number(ts);
160
+ const elapsed = ts - startTs;
161
+ if (elapsed >= TRANSITION_DURATION) {
162
+ applyProgress(newProgress);
163
+ cancelRef.current = 0;
164
+ return;
165
+ }
166
+ const eased = cubicBezier(elapsed / TRANSITION_DURATION, 0, 0, .15, 1);
167
+ applyProgress(from + (newProgress - from) * eased);
168
+ cancelRef.current = requestAnimationFrame(step);
169
+ }
170
+ applyProgress(from);
171
+ cancelRef.current = requestAnimationFrame(step);
172
+ }
173
+ function cancelAnimation() {
174
+ "main thread";
175
+ if (cancelRef.current) {
176
+ cancelAnimationFrame(cancelRef.current);
177
+ cancelRef.current = 0;
178
+ }
179
+ }
180
+ useEffect(() => {
181
+ runOnMainThread(startAnimation)(progress);
182
+ return () => {
183
+ runOnMainThread(cancelAnimation)();
184
+ };
185
+ }, [progress, numSize]);
186
+ return <>
187
+ <view main-thread:ref={rangeRef} className={classes.range} style={{
188
+ position: "absolute",
189
+ width: `${numSize}px`,
190
+ height: `${numSize}px`,
191
+ borderRadius: "50%",
192
+ clipPath: initialClipPath
193
+ }} />
194
+ <view main-thread:ref={startCapRef} className={classes.cap} style={{
195
+ width: `${capSize}px`,
196
+ height: `${capSize}px`,
197
+ left: `${halfSize - capSize / 2}px`,
198
+ top: `${halfSize - ringCenterR - capSize / 2}px`
199
+ }} />
200
+ <view main-thread:ref={endCapRef} className={classes.cap} style={{
201
+ width: `${capSize}px`,
202
+ height: `${capSize}px`,
203
+ left: `${halfSize + ringCenterR * Math.sin(initialEndRad) - capSize / 2}px`,
204
+ top: `${halfSize - ringCenterR * Math.cos(initialEndRad) - capSize / 2}px`
205
+ }} />
206
+ </>;
207
+ }
208
+ function IndeterminateRange({ numSize, classes }) {
209
+ const containerRef = useMainThreadRef(null);
210
+ const rangeRef = useMainThreadRef(null);
211
+ const headCapRef = useMainThreadRef(null);
212
+ const tailCapRef = useMainThreadRef(null);
213
+ const rafIdRef = useMainThreadRef(0);
214
+ const { halfSize, ringCenterR, capSize } = computeRingGeometry(numSize);
215
+ function startLoop() {
216
+ "main thread";
217
+ const containerEl = containerRef.current;
218
+ const rangeEl = rangeRef.current;
219
+ const headCapEl = headCapRef.current;
220
+ let startTs = 0;
221
+ function tick(ts) {
222
+ if (!startTs) startTs = Number(ts);
223
+ const state = sampleIndeterminate((ts - startTs) % INDETERMINATE_DURATION / INDETERMINATE_DURATION);
224
+ containerEl?.setStyleProperty("transform", `rotate(${state.containerDeg}deg)`);
225
+ const clipPath = pieClipPath(numSize, state.arcLength);
226
+ if (clipPath) rangeEl?.setStyleProperty("clip-path", clipPath);
227
+ else rangeEl?.setStyleProperty("clip-path", "none");
228
+ const headRad = state.arcLength * Math.PI / 180;
229
+ headCapEl?.setStyleProperties({
230
+ left: `${halfSize + ringCenterR * Math.sin(headRad) - capSize / 2}px`,
231
+ top: `${halfSize - ringCenterR * Math.cos(headRad) - capSize / 2}px`
232
+ });
233
+ rafIdRef.current = requestAnimationFrame(tick);
234
+ }
235
+ rafIdRef.current = requestAnimationFrame(tick);
236
+ }
237
+ function stopLoop() {
238
+ "main thread";
239
+ if (rafIdRef.current) {
240
+ cancelAnimationFrame(rafIdRef.current);
241
+ rafIdRef.current = 0;
242
+ }
243
+ }
244
+ useEffect(() => {
245
+ runOnMainThread(startLoop)();
246
+ return () => {
247
+ runOnMainThread(stopLoop)();
248
+ };
249
+ }, [numSize]);
250
+ const initialClipPath = "path(\"M 0 0 Z\")";
251
+ return <view main-thread:ref={containerRef} style={{
252
+ position: "absolute",
253
+ width: `${numSize}px`,
254
+ height: `${numSize}px`,
255
+ transform: "rotate(0deg)"
256
+ }}>
257
+ <view main-thread:ref={rangeRef} className={classes.range} style={{
258
+ position: "absolute",
259
+ width: `${numSize}px`,
260
+ height: `${numSize}px`,
261
+ borderRadius: "50%",
262
+ clipPath: initialClipPath
263
+ }} />
264
+ <view main-thread:ref={tailCapRef} className={classes.cap} style={{
265
+ width: `${capSize}px`,
266
+ height: `${capSize}px`,
267
+ left: `${halfSize - capSize / 2}px`,
268
+ top: `${halfSize - ringCenterR - capSize / 2}px`
269
+ }} />
270
+ <view main-thread:ref={headCapRef} className={classes.cap} style={{
271
+ width: `${capSize}px`,
272
+ height: `${capSize}px`,
273
+ left: `${halfSize - capSize / 2}px`,
274
+ top: `${halfSize - ringCenterR - capSize / 2}px`
275
+ }} />
276
+ </view>;
277
+ }
278
+ ProgressCircleRoot.displayName = "ProgressCircleRoot";
279
+ ProgressCircleRange.displayName = "ProgressCircleRange";
280
+ //#endregion
281
+ export { ProgressCircleRange, ProgressCircleRoot };
@@ -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,9 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+ import { ProgressCircleRange, ProgressCircleRoot } from "./ProgressCircle.jsx";
3
+ //#region src/components/ProgressCircle/ProgressCircle.namespace.ts
4
+ var ProgressCircle_namespace_exports = /* @__PURE__ */ __exportAll({
5
+ Range: () => ProgressCircleRange,
6
+ Root: () => ProgressCircleRoot
7
+ });
8
+ //#endregion
9
+ export { ProgressCircle_namespace_exports };
@@ -0,0 +1,3 @@
1
+ export { ProgressCircleRange, ProgressCircleRoot, type ProgressCircleRootProps, type ProgressCircleRootProps as ProgressCircleProps, type RootProps, } from './ProgressCircle';
2
+ export * as ProgressCircle from './ProgressCircle.namespace';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,34 @@
1
+ import { ReactElement } from '@lynx-js/react';
2
+ import { RadioVariantProps } from '@seed-design/lynx-css/recipes/radio';
3
+ import { RadiomarkVariantProps } from '@seed-design/lynx-css/recipes/radiomark';
4
+ import { LynxIconElementProps, LynxStyledElementProps } from '../../types';
5
+ import * as React from "@lynx-js/react";
6
+ export interface RadioGroupRootProps extends RadioVariantProps, Omit<RadiomarkVariantProps, "size" | "checked" | "disabled">, LynxStyledElementProps {
7
+ value?: string;
8
+ defaultValue?: string;
9
+ disabled?: boolean;
10
+ onValueChange?: (value: string) => void;
11
+ }
12
+ export declare const RadioGroupRoot: React.ForwardRefExoticComponent<RadioGroupRootProps & React.RefAttributes<unknown>>;
13
+ export interface RadioGroupItemProps extends LynxStyledElementProps {
14
+ value: string;
15
+ disabled?: boolean;
16
+ }
17
+ export declare const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<unknown>>;
18
+ export interface RadioGroupItemControlProps extends Pick<RadiomarkVariantProps, "tone">, LynxStyledElementProps {
19
+ }
20
+ export declare const RadioGroupItemControl: React.ForwardRefExoticComponent<RadioGroupItemControlProps & React.RefAttributes<unknown>>;
21
+ export interface RadioGroupItemIndicatorProps extends Pick<LynxStyledElementProps, "className" | "style"> {
22
+ /** Icon rendered when not checked. Optional — falls back to default `<view>` dot when omitted. */
23
+ unchecked?: ReactElement<LynxIconElementProps>;
24
+ /** Icon rendered when the item is checked. Optional — falls back to default `<view>` dot when omitted. */
25
+ checked?: ReactElement<LynxIconElementProps>;
26
+ }
27
+ export declare function RadioGroupItemIndicator(props: RadioGroupItemIndicatorProps): React.JSX.Element;
28
+ export declare namespace RadioGroupItemIndicator {
29
+ var displayName: string;
30
+ }
31
+ export interface RadioGroupItemLabelProps extends LynxStyledElementProps {
32
+ }
33
+ export declare const RadioGroupItemLabel: React.ForwardRefExoticComponent<RadioGroupItemLabelProps & React.RefAttributes<unknown>>;
34
+ //# 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,gBAAgB,CAAC;AACxC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAKrF,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAsErB,MAAM,WAAW,mBACf,SAAQ,iBAAiB,EACvB,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,EAC5D,sBAAsB;IACxB,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,qFAyDzB,CAAC;AAKH,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,qFA+CzB,CAAC;AAKH,MAAM,WAAW,0BACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,EACzC,sBAAsB;CAAG;AAE7B,eAAO,MAAM,qBAAqB,4FA6BjC,CAAC;AAKF,MAAM,WAAW,4BACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,OAAO,CAAC;IAC3D,kGAAkG;IAClG,SAAS,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC/C,0GAA0G;IAC1G,OAAO,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;CAC9C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,qBA6B1E;yBA7Be,uBAAuB;;;AAkCvC,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;CAAG;AAE3E,eAAO,MAAM,mBAAmB,0FAoB/B,CAAC"}