@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.
- package/lib/_virtual/_rolldown/runtime.js +13 -0
- package/lib/components/ActionButton/ActionButton.d.ts +26 -32
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.jsx +139 -120
- package/lib/components/ActionButton/index.d.ts +1 -1
- package/lib/components/AppBar/AppBar.d.ts +35 -0
- package/lib/components/AppBar/AppBar.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.jsx +132 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts +2 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.namespace.js +15 -0
- package/lib/components/AppBar/context.d.ts +13 -0
- package/lib/components/AppBar/context.d.ts.map +1 -0
- package/lib/components/AppBar/context.js +12 -0
- package/lib/components/AppBar/index.d.ts +3 -0
- package/lib/components/AppBar/index.d.ts.map +1 -0
- package/lib/components/AppBar/useAppBar.d.ts +15 -0
- package/lib/components/AppBar/useAppBar.d.ts.map +1 -0
- package/lib/components/AppBar/useAppBar.js +72 -0
- package/lib/components/Badge/Badge.d.ts +14 -0
- package/lib/components/Badge/Badge.d.ts.map +1 -0
- package/lib/components/Badge/Badge.jsx +15 -0
- package/lib/components/Badge/index.d.ts +2 -0
- package/lib/components/Badge/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +22 -27
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +127 -142
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +1 -1
- package/lib/components/BottomSheet/BottomSheet.namespace.js +18 -1
- package/lib/components/BottomSheet/index.d.ts +2 -2
- package/lib/components/Box/Box.d.ts +20 -0
- package/lib/components/Box/Box.d.ts.map +1 -0
- package/lib/components/Box/Box.jsx +14 -0
- package/lib/components/Box/index.d.ts +2 -0
- package/lib/components/Box/index.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts +14 -30
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.jsx +107 -98
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +1 -1
- package/lib/components/Checkbox/Checkbox.namespace.js +12 -1
- package/lib/components/Checkbox/index.d.ts +2 -2
- package/lib/components/Icon/Icon.d.ts +37 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -0
- package/lib/components/Icon/Icon.jsx +143 -0
- package/lib/components/Icon/index.d.ts +2 -0
- package/lib/components/Icon/index.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts +4 -8
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.jsx +255 -260
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.namespace.js +9 -1
- package/lib/components/ProgressCircle/index.d.ts +2 -2
- package/lib/components/RadioGroup/RadioGroup.d.ts +12 -28
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.jsx +134 -118
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +1 -1
- package/lib/components/RadioGroup/RadioGroup.namespace.js +12 -1
- package/lib/components/RadioGroup/index.d.ts +2 -2
- package/lib/components/Stack/Stack.d.ts +33 -0
- package/lib/components/Stack/Stack.d.ts.map +1 -0
- package/lib/components/Stack/Stack.jsx +39 -0
- package/lib/components/Stack/index.d.ts +2 -0
- package/lib/components/Stack/index.d.ts.map +1 -0
- package/lib/components/Switch/Switch.d.ts +8 -14
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.jsx +82 -56
- package/lib/components/Switch/Switch.namespace.d.ts +1 -1
- package/lib/components/Switch/Switch.namespace.js +11 -1
- package/lib/components/Switch/index.d.ts +2 -2
- package/lib/components/TagGroup/TagGroup.d.ts +8 -14
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.jsx +42 -39
- package/lib/components/TagGroup/TagGroup.namespace.d.ts +1 -1
- package/lib/components/TagGroup/TagGroup.namespace.js +10 -1
- package/lib/components/TagGroup/index.d.ts +2 -2
- package/lib/components/Text/Text.d.ts +7 -0
- package/lib/components/Text/Text.d.ts.map +1 -0
- package/lib/components/Text/Text.jsx +28 -0
- package/lib/components/Text/index.d.ts +2 -0
- package/lib/components/Text/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +13 -7
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/index.d.ts +4 -3
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/{use-controllable-state.d.ts → useControllableState.d.ts} +1 -1
- package/lib/hooks/useControllableState.d.ts.map +1 -0
- package/lib/hooks/useControllableState.js +27 -0
- package/lib/hooks/useIconColor.d.ts +19 -0
- package/lib/hooks/useIconColor.d.ts.map +1 -0
- package/lib/hooks/useIconColor.js +38 -0
- package/lib/hooks/{use-press-tap.d.ts → usePressTap.d.ts} +12 -9
- package/lib/hooks/usePressTap.d.ts.map +1 -0
- package/lib/hooks/usePressTap.js +35 -0
- package/lib/hooks/useSafeArea.d.ts +19 -0
- package/lib/hooks/useSafeArea.d.ts.map +1 -0
- package/lib/hooks/useSafeArea.js +33 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +29 -3
- package/lib/types.d.ts +51 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/utils/children.d.ts +3 -0
- package/lib/utils/children.d.ts.map +1 -0
- package/lib/utils/children.js +8 -0
- package/lib/utils/create-slot-recipe-context.d.ts +13 -12
- package/lib/utils/create-slot-recipe-context.d.ts.map +1 -1
- package/lib/utils/create-slot-recipe-context.jsx +88 -70
- package/lib/utils/get-seed-class-name.d.ts +6 -7
- package/lib/utils/get-seed-class-name.d.ts.map +1 -1
- package/lib/utils/get-seed-class-name.js +26 -37
- package/lib/utils/index.d.ts +4 -4
- package/lib/utils/resolve-recipe-token.js +45 -43
- package/lib/utils/split-multiple-variants-props.js +32 -32
- package/lib/utils/styled.d.ts +83 -0
- package/lib/utils/styled.d.ts.map +1 -0
- package/lib/utils/styled.js +144 -0
- package/package.json +9 -9
- package/src/components/ActionButton/ActionButton.test.tsx +167 -0
- package/src/components/ActionButton/ActionButton.tsx +210 -168
- package/src/components/AppBar/AppBar.namespace.ts +18 -0
- package/src/components/AppBar/AppBar.test.tsx +270 -0
- package/src/components/AppBar/AppBar.tsx +288 -0
- package/src/components/AppBar/context.ts +27 -0
- package/src/components/AppBar/index.ts +21 -0
- package/src/components/AppBar/useAppBar.ts +100 -0
- package/src/components/Badge/Badge.test.tsx +54 -0
- package/src/components/Badge/Badge.tsx +32 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +219 -0
- package/src/components/BottomSheet/BottomSheet.tsx +120 -83
- package/src/components/Box/Box.test.tsx +85 -0
- package/src/components/Box/Box.tsx +39 -0
- package/src/components/Box/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.tsx +108 -117
- package/src/components/Icon/Icon.tsx +265 -0
- package/src/components/Icon/index.ts +8 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +39 -25
- package/src/components/RadioGroup/RadioGroup.tsx +100 -118
- package/src/components/Stack/Stack.tsx +97 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Switch/Switch.tsx +61 -52
- package/src/components/TagGroup/TagGroup.tsx +27 -25
- package/src/components/Text/Text.tsx +64 -0
- package/src/components/Text/index.ts +1 -0
- package/src/components/index.ts +6 -0
- package/src/hooks/index.ts +4 -3
- package/src/hooks/{__tests__/use-controllable-state.test.ts → useControllableState.test.ts} +1 -1
- package/src/hooks/useIconColor.test.ts +13 -0
- package/src/hooks/useIconColor.ts +67 -0
- package/src/hooks/{__tests__/use-press-tap.test.ts → usePressTap.test.ts} +1 -1
- package/src/hooks/{use-press-tap.ts → usePressTap.ts} +14 -10
- package/src/hooks/useSafeArea.test.ts +83 -0
- package/src/hooks/useSafeArea.ts +56 -0
- package/src/index.ts +1 -0
- package/src/types.ts +76 -0
- package/src/utils/children.ts +13 -0
- package/src/utils/create-slot-recipe-context.test.tsx +96 -0
- package/src/utils/create-slot-recipe-context.tsx +55 -15
- package/src/utils/get-seed-class-name.ts +7 -12
- package/src/utils/{__tests__/split-multiple-variants-props.test.ts → split-multiple-variants-props.test.ts} +1 -1
- package/src/utils/styled.ts +442 -0
- package/lib/components/ActionButton/index.js +0 -1
- package/lib/components/BottomSheet/index.js +0 -2
- package/lib/components/Checkbox/index.js +0 -2
- package/lib/components/ProgressCircle/index.js +0 -2
- package/lib/components/RadioGroup/index.js +0 -2
- package/lib/components/Switch/index.js +0 -2
- package/lib/components/TagGroup/index.js +0 -2
- package/lib/components/index.js +0 -7
- package/lib/hooks/index.js +0 -3
- package/lib/hooks/use-controllable-state.d.ts.map +0 -1
- package/lib/hooks/use-controllable-state.js +0 -27
- package/lib/hooks/use-icon-color.d.ts +0 -15
- package/lib/hooks/use-icon-color.d.ts.map +0 -1
- package/lib/hooks/use-icon-color.js +0 -37
- package/lib/hooks/use-press-tap.d.ts.map +0 -1
- package/lib/hooks/use-press-tap.js +0 -35
- package/lib/utils/index.js +0 -4
- package/src/components/ActionButton/__tests__/ActionButton.test.tsx +0 -35
- package/src/components/BottomSheet/__tests__/BottomSheet.test.tsx +0 -119
- package/src/components/__tests__/ProgressCircle.test.ts +0 -33
- package/src/components/__tests__/exports.test.ts +0 -38
- package/src/components/__tests__/switch.test.ts +0 -34
- package/src/hooks/use-icon-color.ts +0 -51
- package/src/utils/__tests__/create-slot-recipe-context.test.tsx +0 -228
- /package/src/hooks/{use-controllable-state.ts → useControllableState.ts} +0 -0
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { SwitchControl, SwitchLabel, SwitchRoot, SwitchThumb } from "./Switch.jsx";
|
|
3
|
+
//#region src/components/Switch/Switch.namespace.ts
|
|
4
|
+
var Switch_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Control: () => SwitchControl,
|
|
6
|
+
Label: () => SwitchLabel,
|
|
7
|
+
Root: () => SwitchRoot,
|
|
8
|
+
Thumb: () => SwitchThumb
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Switch_namespace_exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { SwitchRoot, SwitchControl, SwitchThumb, SwitchLabel, type SwitchRootProps, type SwitchControlProps, type SwitchThumbProps, type SwitchLabelProps, } from
|
|
2
|
-
export * as Switch from
|
|
1
|
+
export { SwitchRoot, SwitchControl, SwitchThumb, SwitchLabel, type SwitchRootProps, type SwitchControlProps, type SwitchThumbProps, type SwitchLabelProps, } from './Switch';
|
|
2
|
+
export * as Switch from './Switch.namespace';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { TagGroupVariantProps } from '@seed-design/lynx-css/recipes/tag-group';
|
|
2
|
+
import { TagGroupItemVariantProps } from '@seed-design/lynx-css/recipes/tag-group-item';
|
|
3
|
+
import { LynxStyledElementProps } from '../../types';
|
|
4
|
+
import { StyleProps } from '../../utils/styled';
|
|
5
|
+
import * as React from "@lynx-js/react";
|
|
4
6
|
/**
|
|
5
7
|
* @platform Lynx
|
|
6
8
|
*
|
|
@@ -8,12 +10,9 @@ import { type TagGroupItemVariantProps } from "@seed-design/lynx-css/recipes/tag
|
|
|
8
10
|
* - `truncate` prop: Lynx flex 모델에서는 item 단위 wrap만 가능해 웹 수준의
|
|
9
11
|
* "한 줄 유지 + label ellipsis" 조합을 재현할 수 없음
|
|
10
12
|
* - `asChild` prop: Lynx Slot 미지원
|
|
11
|
-
* - `flexShrink` prop: CSS variable 동적 주입 제한
|
|
12
13
|
* - 아이콘 slot: Lynx 3.7 SVG 지원 후 검토 (Tier B)
|
|
13
14
|
*/
|
|
14
|
-
export interface TagGroupRootProps extends TagGroupVariantProps, TagGroupItemVariantProps {
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
className?: string;
|
|
15
|
+
export interface TagGroupRootProps extends TagGroupVariantProps, TagGroupItemVariantProps, LynxStyledElementProps {
|
|
17
16
|
/**
|
|
18
17
|
* children 사이에 삽입되는 구분자. 기본값 `" · "`.
|
|
19
18
|
*/
|
|
@@ -25,16 +24,11 @@ export declare const TagGroupRoot: React.ForwardRefExoticComponent<TagGroupRootP
|
|
|
25
24
|
*
|
|
26
25
|
* 웹 대비 미지원 기능:
|
|
27
26
|
* - `asChild` prop: Lynx Slot 미지원
|
|
28
|
-
* - `flexShrink` prop: CSS variable 동적 주입 제한
|
|
29
27
|
*/
|
|
30
|
-
export interface TagGroupItemProps extends TagGroupItemVariantProps {
|
|
31
|
-
children?: React.ReactNode;
|
|
32
|
-
className?: string;
|
|
28
|
+
export interface TagGroupItemProps extends TagGroupItemVariantProps, Pick<StyleProps, "flexShrink">, LynxStyledElementProps {
|
|
33
29
|
}
|
|
34
30
|
export declare const TagGroupItem: React.ForwardRefExoticComponent<TagGroupItemProps & React.RefAttributes<unknown>>;
|
|
35
|
-
export interface TagGroupItemLabelProps {
|
|
36
|
-
children?: React.ReactNode;
|
|
37
|
-
className?: string;
|
|
31
|
+
export interface TagGroupItemLabelProps extends LynxStyledElementProps {
|
|
38
32
|
}
|
|
39
33
|
export declare const TagGroupItemLabel: React.ForwardRefExoticComponent<TagGroupItemLabelProps & React.RefAttributes<unknown>>;
|
|
40
34
|
//# sourceMappingURL=TagGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC9F,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAA4B,MAAM,aAAa,CAAC;AAIpF,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOpE;;;;;;;;GAQG;AACH,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,wBAAwB,EACxB,sBAAsB;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,mFAiCvB,CAAC;AAKH;;;;;GAKG;AACH,MAAM,WAAW,iBACf,SAAQ,wBAAwB,EAC9B,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAC9B,sBAAsB;CAAG;AAE7B,eAAO,MAAM,YAAY,mFAmBvB,CAAC;AAKH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;CAAG;AAEzE,eAAO,MAAM,iBAAiB,wFAY5B,CAAC"}
|
|
@@ -1,54 +1,57 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
2
|
+
import { toArray } from "../../utils/children.js";
|
|
3
|
+
import { useStyleProps } from "../../utils/styled.js";
|
|
4
|
+
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
2
5
|
import clsx from "clsx";
|
|
6
|
+
import * as React from "@lynx-js/react";
|
|
3
7
|
import { tagGroup } from "@seed-design/lynx-css/recipes/tag-group";
|
|
4
|
-
import { tagGroupItem
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
import { tagGroupItem } from "@seed-design/lynx-css/recipes/tag-group-item";
|
|
9
|
+
//#region src/components/TagGroup/TagGroup.tsx
|
|
10
|
+
var { PropsProvider, useProps, ClassNamesProvider, useClassNames } = createSlotRecipeContext(tagGroupItem);
|
|
11
|
+
var TagGroupRoot = React.forwardRef((props, ref) => {
|
|
12
|
+
const [{ tagGroup: tagGroupVariantProps, tagGroupItem: tagGroupItemVariantProps }, otherProps] = splitMultipleVariantsProps(props, {
|
|
13
|
+
tagGroup,
|
|
14
|
+
tagGroupItem
|
|
15
|
+
});
|
|
16
|
+
const { children, className, separator = " · ", ...nativeProps } = otherProps;
|
|
17
|
+
const classes = tagGroup(tagGroupVariantProps);
|
|
18
|
+
const visibleChildren = toArray(children);
|
|
19
|
+
return <PropsProvider value={tagGroupItemVariantProps}>
|
|
20
|
+
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
|
|
15
21
|
{visibleChildren.map((child, index) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Lynx <text> separator는 개별 flex item이라 wrap이 발동하면 separator가
|
|
19
|
-
// 이전 row 끝에 남는다. separator와 뒤따르는 item을 하나의 flex-row wrapper로
|
|
20
|
-
// 묶어 같은 wrap 단위로 함께 이동시킨다.
|
|
21
|
-
return (<view key={child.key ?? index} style={{
|
|
22
|
-
display: "flex",
|
|
23
|
-
flexDirection: "row",
|
|
24
|
-
alignItems: "center",
|
|
25
|
-
flexShrink: 0,
|
|
26
|
-
}}>
|
|
22
|
+
if (index === 0) return child;
|
|
23
|
+
return <view key={child.key ?? index} className={classes.separatorWrapper}>
|
|
27
24
|
<text className={classes.separator}>{separator}</text>
|
|
28
25
|
{child}
|
|
29
|
-
</view
|
|
30
|
-
|
|
26
|
+
</view>;
|
|
27
|
+
})}
|
|
31
28
|
</view>
|
|
32
|
-
</PropsProvider
|
|
29
|
+
</PropsProvider>;
|
|
33
30
|
});
|
|
34
31
|
TagGroupRoot.displayName = "TagGroupRoot";
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
var TagGroupItem = React.forwardRef((props, ref) => {
|
|
33
|
+
const parentVariantProps = useProps();
|
|
34
|
+
const [localVariantProps, otherProps] = tagGroupItem.splitVariantProps(props);
|
|
35
|
+
const classes = tagGroupItem({
|
|
36
|
+
...parentVariantProps,
|
|
37
|
+
...localVariantProps
|
|
38
|
+
});
|
|
39
|
+
const { style, restProps } = useStyleProps(otherProps);
|
|
40
|
+
const { children, className, ...nativeProps } = restProps;
|
|
41
|
+
return <ClassNamesProvider value={classes}>
|
|
42
|
+
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} style={style} {...nativeProps}>
|
|
42
43
|
{children}
|
|
43
44
|
</view>
|
|
44
|
-
</ClassNamesProvider
|
|
45
|
+
</ClassNamesProvider>;
|
|
45
46
|
});
|
|
46
47
|
TagGroupItem.displayName = "TagGroupItem";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
var TagGroupItemLabel = React.forwardRef((props, ref) => {
|
|
49
|
+
const classes = useClassNames();
|
|
50
|
+
const { children, className, ...nativeProps } = props;
|
|
51
|
+
return <text {...ref ? { ref } : {}} className={clsx(classes.label, className)} {...nativeProps}>
|
|
51
52
|
{children}
|
|
52
|
-
</text
|
|
53
|
+
</text>;
|
|
53
54
|
});
|
|
54
55
|
TagGroupItemLabel.displayName = "TagGroupItemLabel";
|
|
56
|
+
//#endregion
|
|
57
|
+
export { TagGroupItem, TagGroupItemLabel, TagGroupRoot };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TagGroupItem as Item, TagGroupItemLabel as ItemLabel, TagGroupRoot as Root, type TagGroupItemLabelProps as ItemLabelProps, type TagGroupItemProps as ItemProps, type TagGroupRootProps as RootProps, } from
|
|
1
|
+
export { TagGroupItem as Item, TagGroupItemLabel as ItemLabel, TagGroupRoot as Root, type TagGroupItemLabelProps as ItemLabelProps, type TagGroupItemProps as ItemProps, type TagGroupRootProps as RootProps, } from './TagGroup';
|
|
2
2
|
//# sourceMappingURL=TagGroup.namespace.d.ts.map
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { TagGroupItem, TagGroupItemLabel, TagGroupRoot } from "./TagGroup.jsx";
|
|
3
|
+
//#region src/components/TagGroup/TagGroup.namespace.ts
|
|
4
|
+
var TagGroup_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Item: () => TagGroupItem,
|
|
6
|
+
ItemLabel: () => TagGroupItemLabel,
|
|
7
|
+
Root: () => TagGroupRoot
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TagGroup_namespace_exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { TagGroupRoot, TagGroupItem, TagGroupItemLabel, type TagGroupRootProps, type TagGroupItemProps, type TagGroupItemLabelProps, } from
|
|
2
|
-
export * as TagGroup from
|
|
1
|
+
export { TagGroupRoot, TagGroupItem, TagGroupItemLabel, type TagGroupRootProps, type TagGroupItemProps, type TagGroupItemLabelProps, } from './TagGroup';
|
|
2
|
+
export * as TagGroup from './TagGroup.namespace';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TextStyleProps } from '../../utils/styled';
|
|
2
|
+
import { LynxStyledElementProps } from '../../types';
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
export interface TextProps extends TextStyleProps, LynxStyledElementProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<unknown>>;
|
|
7
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAYvE,MAAM,WAAW,SAAU,SAAQ,cAAc,EAAE,sBAAsB;CAAG;AAE5E,eAAO,MAAM,IAAI,2EAkCf,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { handleColor, handleFontSize, handleFontWeight, handleLineHeight } from "../../utils/styled.js";
|
|
2
|
+
import { typography } from "@seed-design/lynx-css/vars/component";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import * as React from "@lynx-js/react";
|
|
5
|
+
//#region src/components/Text/Text.tsx
|
|
6
|
+
function capitalize(value) {
|
|
7
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
8
|
+
}
|
|
9
|
+
function getTypographyStyle(textStyle) {
|
|
10
|
+
return typography[`textStyle${capitalize(textStyle ?? "t5Regular")}`].enabled.root;
|
|
11
|
+
}
|
|
12
|
+
var Text = React.forwardRef((props, ref) => {
|
|
13
|
+
const { color, textStyle, fontSize, lineHeight, fontWeight, align, children, className, style, ...nativeProps } = props;
|
|
14
|
+
const typographyStyle = getTypographyStyle(textStyle);
|
|
15
|
+
return <text {...ref ? { ref } : {}} {...nativeProps} className={clsx(className)} style={{
|
|
16
|
+
color: handleColor(color),
|
|
17
|
+
fontSize: handleFontSize(fontSize) ?? typographyStyle.fontSize,
|
|
18
|
+
lineHeight: handleLineHeight(lineHeight ?? fontSize) ?? typographyStyle.lineHeight,
|
|
19
|
+
fontWeight: handleFontWeight(fontWeight) ?? typographyStyle.fontWeight,
|
|
20
|
+
textAlign: align,
|
|
21
|
+
...style
|
|
22
|
+
}}>
|
|
23
|
+
{children}
|
|
24
|
+
</text>;
|
|
25
|
+
});
|
|
26
|
+
Text.displayName = "Text";
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Text };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from './ActionButton';
|
|
2
|
+
export * from './AppBar';
|
|
3
|
+
export * from './Badge';
|
|
4
|
+
export * from './Box';
|
|
5
|
+
export * from './BottomSheet';
|
|
6
|
+
export * from './Checkbox';
|
|
7
|
+
export * from './Icon';
|
|
8
|
+
export * from './ProgressCircle';
|
|
9
|
+
export * from './RadioGroup';
|
|
10
|
+
export * from './Stack';
|
|
11
|
+
export * from './Switch';
|
|
12
|
+
export * from './TagGroup';
|
|
13
|
+
export * from './Text';
|
|
8
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './useControllableState';
|
|
2
|
+
export * from './useIconColor';
|
|
3
|
+
export * from './usePressTap';
|
|
4
|
+
export * from './useSafeArea';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/hooks/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -12,4 +12,4 @@ export interface UseControllableStateProps<T> {
|
|
|
12
12
|
* - `onChange` fires in both modes.
|
|
13
13
|
*/
|
|
14
14
|
export declare function useControllableState<T>(props: UseControllableStateProps<T>): [T, (value: T) => void];
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=useControllableState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../../src/hooks/useControllableState.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,YAAY,EAAE,CAAC,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAClC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAkBzB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useRef, useState } from "@lynx-js/react";
|
|
2
|
+
import { useMemoizedFn } from "@lynx-js/lynx-ui-common";
|
|
3
|
+
//#region src/hooks/useControllableState.ts
|
|
4
|
+
/**
|
|
5
|
+
* Controlled/uncontrolled state pattern for Lynx components.
|
|
6
|
+
*
|
|
7
|
+
* - When `value` is provided, the component is controlled.
|
|
8
|
+
* - When `value` is `undefined`, the component manages its own state
|
|
9
|
+
* starting from `defaultValue`.
|
|
10
|
+
* - `onChange` fires in both modes.
|
|
11
|
+
*/
|
|
12
|
+
function useControllableState(props) {
|
|
13
|
+
const { value, defaultValue, onChange } = props;
|
|
14
|
+
const isControlled = value !== void 0;
|
|
15
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
16
|
+
const currentValue = isControlled ? value : uncontrolledValue;
|
|
17
|
+
const prevValueRef = useRef(currentValue);
|
|
18
|
+
return [currentValue, useMemoizedFn((nextValue) => {
|
|
19
|
+
if (!isControlled) setUncontrolledValue(nextValue);
|
|
20
|
+
if (nextValue !== prevValueRef.current) {
|
|
21
|
+
onChange?.(nextValue);
|
|
22
|
+
prevValueRef.current = nextValue;
|
|
23
|
+
}
|
|
24
|
+
})];
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useControllableState };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MainThread } from '@lynx-js/types';
|
|
2
|
+
import { DependencyList, RefObject } from '@lynx-js/react';
|
|
3
|
+
export interface UseIconColorOptions {
|
|
4
|
+
sourceRef?: RefObject<MainThread.Element>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Lynx `<image>` 의 tint color 를 recipe 의 CSS `color` 로부터 main-thread 에서 읽어
|
|
8
|
+
* `tint-color` attribute 로 mirror. `deps` 가 바뀌면 재동기화.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const iconColorProps = useIconColor([variant, disabled, loading]);
|
|
12
|
+
* return cloneElement(iconChild, iconColorProps);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function useIconColor(deps: DependencyList, options?: UseIconColorOptions): {
|
|
16
|
+
ref: RefObject<MainThread.Element>;
|
|
17
|
+
"main-thread:binduiappear": () => void;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useIconColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIconColor.d.ts","sourceRoot":"","sources":["../../src/hooks/useIconColor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOhE,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;CAC3C;AAyBD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,cAAc,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B;IACD,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACnC,0BAA0B,EAAE,MAAM,IAAI,CAAC;CACxC,CAeA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { runOnMainThread, useEffect, useMainThreadRef } from "@lynx-js/react";
|
|
2
|
+
//#region src/hooks/useIconColor.ts
|
|
3
|
+
function syncTintColor(targetRef, sourceRef) {
|
|
4
|
+
"main thread";
|
|
5
|
+
const target = targetRef.current;
|
|
6
|
+
if (!target) return;
|
|
7
|
+
const source = sourceRef?.current ?? target;
|
|
8
|
+
let color;
|
|
9
|
+
if (typeof source.getComputedStyleProperty === "function") color = source.getComputedStyleProperty("color");
|
|
10
|
+
else if (typeof source.getComputedCssProperty === "function") color = source.getComputedCssProperty("color");
|
|
11
|
+
if (color) target.setAttribute("tint-color", color);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lynx `<image>` 의 tint color 를 recipe 의 CSS `color` 로부터 main-thread 에서 읽어
|
|
15
|
+
* `tint-color` attribute 로 mirror. `deps` 가 바뀌면 재동기화.
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const iconColorProps = useIconColor([variant, disabled, loading]);
|
|
19
|
+
* return cloneElement(iconChild, iconColorProps);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function useIconColor(deps, options) {
|
|
23
|
+
const ref = useMainThreadRef(null);
|
|
24
|
+
const sourceRef = options?.sourceRef;
|
|
25
|
+
function syncOnUiAppear() {
|
|
26
|
+
"main thread";
|
|
27
|
+
syncTintColor(ref, sourceRef);
|
|
28
|
+
}
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
runOnMainThread(syncTintColor)(ref, sourceRef);
|
|
31
|
+
}, deps);
|
|
32
|
+
return {
|
|
33
|
+
ref,
|
|
34
|
+
"main-thread:binduiappear": syncOnUiAppear
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { useIconColor };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseTouchEvent, EventHandler, Target } from '@lynx-js/types';
|
|
2
|
+
import { LynxTouchProps } from '../types';
|
|
3
|
+
type TouchHandler = EventHandler<BaseTouchEvent<Target>>;
|
|
2
4
|
export interface UsePressTapOptions {
|
|
3
5
|
disabled?: boolean;
|
|
4
|
-
onTap?:
|
|
5
|
-
mainThreadOnTap?:
|
|
6
|
+
onTap?: TouchHandler;
|
|
7
|
+
mainThreadOnTap?: LynxTouchProps["main-thread:bindtap"];
|
|
6
8
|
}
|
|
7
9
|
export interface UsePressTapReturn {
|
|
8
10
|
pressed: boolean;
|
|
9
|
-
bindtap:
|
|
10
|
-
bindtouchstart:
|
|
11
|
-
bindtouchend:
|
|
12
|
-
bindtouchcancel:
|
|
13
|
-
"main-thread:bindtap"?:
|
|
11
|
+
bindtap: TouchHandler;
|
|
12
|
+
bindtouchstart: TouchHandler;
|
|
13
|
+
bindtouchend: TouchHandler;
|
|
14
|
+
bindtouchcancel: TouchHandler;
|
|
15
|
+
"main-thread:bindtap"?: LynxTouchProps["main-thread:bindtap"];
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Hook that provides press/tap interaction state for Lynx elements.
|
|
@@ -21,4 +23,5 @@ export interface UsePressTapReturn {
|
|
|
21
23
|
* - `main-thread:bindtap` is conditionally included (only when enabled and provided).
|
|
22
24
|
*/
|
|
23
25
|
export declare function usePressTap(options?: UsePressTapOptions): UsePressTapReturn;
|
|
24
|
-
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=usePressTap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePressTap.d.ts","sourceRoot":"","sources":["../../src/hooks/usePressTap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,KAAK,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,eAAe,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,cAAc,EAAE,YAAY,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,YAAY,CAAC;IAC9B,qBAAqB,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CAC/D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,iBAAiB,CA0B/E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState } from "@lynx-js/react";
|
|
2
|
+
import { useMemoizedFn } from "@lynx-js/lynx-ui-common";
|
|
3
|
+
//#region src/hooks/usePressTap.ts
|
|
4
|
+
/**
|
|
5
|
+
* Hook that provides press/tap interaction state for Lynx elements.
|
|
6
|
+
*
|
|
7
|
+
* - Tracks `pressed` state via touch events.
|
|
8
|
+
* - When `disabled` is true, the element cannot become active and no tap fires.
|
|
9
|
+
* - If the element becomes disabled during a press, the active state is cleared.
|
|
10
|
+
* - `main-thread:bindtap` is conditionally included (only when enabled and provided).
|
|
11
|
+
*/
|
|
12
|
+
function usePressTap(options = {}) {
|
|
13
|
+
const { disabled = false, onTap, mainThreadOnTap } = options;
|
|
14
|
+
const [pressed, setPressed] = useState(false);
|
|
15
|
+
const press = useMemoizedFn(() => {
|
|
16
|
+
if (disabled) return;
|
|
17
|
+
setPressed(true);
|
|
18
|
+
});
|
|
19
|
+
const reset = useMemoizedFn(() => {
|
|
20
|
+
setPressed(false);
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
pressed,
|
|
24
|
+
bindtap: useMemoizedFn((...args) => {
|
|
25
|
+
if (disabled) return;
|
|
26
|
+
onTap?.(...args);
|
|
27
|
+
}),
|
|
28
|
+
bindtouchstart: press,
|
|
29
|
+
bindtouchend: reset,
|
|
30
|
+
bindtouchcancel: reset,
|
|
31
|
+
...!disabled && mainThreadOnTap ? { "main-thread:bindtap": mainThreadOnTap } : {}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { usePressTap };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare module "@lynx-js/types" {
|
|
2
|
+
interface GlobalProps {
|
|
3
|
+
safeAreaInsetTop?: number;
|
|
4
|
+
safeAreaInsetBottom?: number;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export interface UseSafeAreaReturn {
|
|
8
|
+
safeAreaInsetTop: string;
|
|
9
|
+
safeAreaInsetBottom: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Lynx 앱에서 top/bottom safe area inset 값을 반환합니다.
|
|
13
|
+
*
|
|
14
|
+
* `lynx.__globalProps.safeAreaInsetTop`과 `safeAreaInsetBottom`을 우선 사용하고,
|
|
15
|
+
* host가 값을 제공하지 않으면 Lynx CSS `env(safe-area-inset-*)` 값을 fallback으로
|
|
16
|
+
* 반환합니다.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useSafeArea(): UseSafeAreaReturn;
|
|
19
|
+
//# sourceMappingURL=useSafeArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSafeArea.d.ts","sourceRoot":"","sources":["../../src/hooks/useSafeArea.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,WAAW;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B;CACF;AAuBD,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAW/C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo } from "@lynx-js/react";
|
|
2
|
+
//#region src/hooks/useSafeArea.ts
|
|
3
|
+
var safeAreaProp = {
|
|
4
|
+
top: "safeAreaInsetTop",
|
|
5
|
+
bottom: "safeAreaInsetBottom"
|
|
6
|
+
};
|
|
7
|
+
function getSafeAreaEnvInset(edge) {
|
|
8
|
+
return `env(safe-area-inset-${edge})`;
|
|
9
|
+
}
|
|
10
|
+
function normalizeSafeAreaValue(value) {
|
|
11
|
+
if (typeof value !== "number" || value <= 0 || !Number.isFinite(value)) return;
|
|
12
|
+
return `${value}px`;
|
|
13
|
+
}
|
|
14
|
+
function resolveSafeAreaInset(edge, value) {
|
|
15
|
+
return normalizeSafeAreaValue(value) ?? getSafeAreaEnvInset(edge);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Lynx 앱에서 top/bottom safe area inset 값을 반환합니다.
|
|
19
|
+
*
|
|
20
|
+
* `lynx.__globalProps.safeAreaInsetTop`과 `safeAreaInsetBottom`을 우선 사용하고,
|
|
21
|
+
* host가 값을 제공하지 않으면 Lynx CSS `env(safe-area-inset-*)` 값을 fallback으로
|
|
22
|
+
* 반환합니다.
|
|
23
|
+
*/
|
|
24
|
+
function useSafeArea() {
|
|
25
|
+
const safeAreaInsetTop = lynx.__globalProps?.[safeAreaProp.top];
|
|
26
|
+
const safeAreaInsetBottom = lynx.__globalProps?.[safeAreaProp.bottom];
|
|
27
|
+
return useMemo(() => ({
|
|
28
|
+
safeAreaInsetTop: resolveSafeAreaInset("top", safeAreaInsetTop),
|
|
29
|
+
safeAreaInsetBottom: resolveSafeAreaInset("bottom", safeAreaInsetBottom)
|
|
30
|
+
}), [safeAreaInsetTop, safeAreaInsetBottom]);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { useSafeArea };
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,mBAAmB,SAAS,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { usePressTap } from "./hooks/usePressTap.js";
|
|
2
|
+
import { createSlotRecipeContext } from "./utils/create-slot-recipe-context.jsx";
|
|
3
|
+
import { capitalize, resolveRecipeToken } from "./utils/resolve-recipe-token.js";
|
|
4
|
+
import { useSafeArea } from "./hooks/useSafeArea.js";
|
|
5
|
+
import { ProgressCircleRange, ProgressCircleRoot } from "./components/ProgressCircle/ProgressCircle.jsx";
|
|
6
|
+
import { ProgressCircle_namespace_exports } from "./components/ProgressCircle/ProgressCircle.namespace.js";
|
|
7
|
+
import { useIconColor } from "./hooks/useIconColor.js";
|
|
8
|
+
import { Icon, PrefixIcon, SuffixIcon } from "./components/Icon/Icon.jsx";
|
|
9
|
+
import { ActionButton } from "./components/ActionButton/ActionButton.jsx";
|
|
10
|
+
import { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle } from "./components/AppBar/AppBar.jsx";
|
|
11
|
+
import { AppBar_namespace_exports } from "./components/AppBar/AppBar.namespace.js";
|
|
12
|
+
import { Badge } from "./components/Badge/Badge.jsx";
|
|
13
|
+
import { Box } from "./components/Box/Box.jsx";
|
|
14
|
+
import { BottomSheetBackdrop, BottomSheetBody, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHandle, BottomSheetHeader, BottomSheetPositioner, BottomSheetRoot, BottomSheetTitle, BottomSheetTrigger } from "./components/BottomSheet/BottomSheet.jsx";
|
|
15
|
+
import { BottomSheet_namespace_exports } from "./components/BottomSheet/BottomSheet.namespace.js";
|
|
16
|
+
import { useControllableState } from "./hooks/useControllableState.js";
|
|
17
|
+
import { splitMultipleVariantsProps } from "./utils/split-multiple-variants-props.js";
|
|
18
|
+
import { CheckboxControl, CheckboxGroup, CheckboxIndicator, CheckboxLabel, CheckboxRoot } from "./components/Checkbox/Checkbox.jsx";
|
|
19
|
+
import { Checkbox_namespace_exports } from "./components/Checkbox/Checkbox.namespace.js";
|
|
20
|
+
import { RadioGroupItem, RadioGroupItemControl, RadioGroupItemIndicator, RadioGroupItemLabel, RadioGroupRoot } from "./components/RadioGroup/RadioGroup.jsx";
|
|
21
|
+
import { RadioGroup_namespace_exports } from "./components/RadioGroup/RadioGroup.namespace.js";
|
|
22
|
+
import { HStack, VStack } from "./components/Stack/Stack.jsx";
|
|
23
|
+
import { SwitchControl, SwitchLabel, SwitchRoot, SwitchThumb } from "./components/Switch/Switch.jsx";
|
|
24
|
+
import { Switch_namespace_exports } from "./components/Switch/Switch.namespace.js";
|
|
25
|
+
import { TagGroupItem, TagGroupItemLabel, TagGroupRoot } from "./components/TagGroup/TagGroup.jsx";
|
|
26
|
+
import { TagGroup_namespace_exports } from "./components/TagGroup/TagGroup.namespace.js";
|
|
27
|
+
import { Text } from "./components/Text/Text.jsx";
|
|
28
|
+
import { getSeedClassName } from "./utils/get-seed-class-name.js";
|
|
29
|
+
export { ActionButton, AppBar_namespace_exports as AppBar, AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle, Badge, BottomSheet_namespace_exports as BottomSheet, BottomSheetBackdrop, BottomSheetBody, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHandle, BottomSheetHeader, BottomSheetPositioner, BottomSheetRoot, BottomSheetTitle, BottomSheetTrigger, Box, Checkbox_namespace_exports as Checkbox, CheckboxControl, CheckboxGroup, CheckboxIndicator, CheckboxLabel, CheckboxRoot, HStack, Icon, PrefixIcon, ProgressCircle_namespace_exports as ProgressCircle, ProgressCircleRange, ProgressCircleRoot, RadioGroup_namespace_exports as RadioGroup, RadioGroupItem, RadioGroupItemControl, RadioGroupItemIndicator, RadioGroupItemLabel, RadioGroupRoot, SuffixIcon, Switch_namespace_exports as Switch, SwitchControl, SwitchLabel, SwitchRoot, SwitchThumb, TagGroup_namespace_exports as TagGroup, TagGroupItem, TagGroupItemLabel, TagGroupRoot, Text, VStack, capitalize, createSlotRecipeContext, getSeedClassName, resolveRecipeToken, splitMultipleVariantsProps, useControllableState, useIconColor, usePressTap, useSafeArea };
|