@seed-design/lynx-react 0.1.1-alpha.0 → 0.2.0-alpha.2
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/components/ActionButton/ActionButton.d.ts +40 -9
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.jsx +132 -14
- package/lib/components/BottomSheet/BottomSheet.d.ts +92 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.jsx +178 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +2 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.js +1 -0
- package/lib/components/BottomSheet/index.d.ts +3 -0
- package/lib/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/index.js +2 -0
- package/lib/components/Checkbox/Checkbox.d.ts +51 -0
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.jsx +121 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +2 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.namespace.js +1 -0
- package/lib/components/Checkbox/index.d.ts +3 -0
- package/lib/components/Checkbox/index.d.ts.map +1 -0
- package/lib/components/Checkbox/index.js +2 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts +10 -9
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.jsx +8 -14
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +2 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.js +1 -0
- package/lib/components/ProgressCircle/index.d.ts +2 -1
- package/lib/components/ProgressCircle/index.d.ts.map +1 -1
- package/lib/components/ProgressCircle/index.js +2 -1
- package/lib/components/RadioGroup/RadioGroup.d.ts +50 -0
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.jsx +144 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +2 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.js +1 -0
- package/lib/components/RadioGroup/index.d.ts +3 -0
- package/lib/components/RadioGroup/index.d.ts.map +1 -0
- package/lib/components/RadioGroup/index.js +2 -0
- package/lib/components/Switch/Switch.d.ts +27 -0
- package/lib/components/Switch/Switch.d.ts.map +1 -0
- package/lib/components/Switch/Switch.jsx +75 -0
- package/lib/components/Switch/Switch.namespace.d.ts +2 -0
- package/lib/components/Switch/Switch.namespace.d.ts.map +1 -0
- package/lib/components/Switch/Switch.namespace.js +1 -0
- package/lib/components/Switch/index.d.ts +3 -0
- package/lib/components/Switch/index.d.ts.map +1 -0
- package/lib/components/Switch/index.js +2 -0
- package/lib/components/TagGroup/TagGroup.d.ts +40 -0
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.jsx +54 -0
- package/lib/components/TagGroup/TagGroup.namespace.d.ts +2 -0
- package/lib/components/TagGroup/TagGroup.namespace.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.namespace.js +1 -0
- package/lib/components/TagGroup/index.d.ts +3 -0
- package/lib/components/TagGroup/index.d.ts.map +1 -0
- package/lib/components/TagGroup/index.js +2 -0
- package/lib/components/index.d.ts +8 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +7 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/use-controllable-state.d.ts +15 -0
- package/lib/hooks/use-controllable-state.d.ts.map +1 -0
- package/lib/hooks/use-controllable-state.js +27 -0
- package/lib/hooks/use-icon-color.d.ts +15 -0
- package/lib/hooks/use-icon-color.d.ts.map +1 -0
- package/lib/hooks/use-icon-color.js +37 -0
- package/lib/hooks/use-press-tap.d.ts +24 -0
- package/lib/hooks/use-press-tap.d.ts.map +1 -0
- package/lib/hooks/use-press-tap.js +35 -0
- package/lib/index.d.ts +3 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- package/lib/utils/create-slot-recipe-context.d.ts +26 -0
- package/lib/utils/create-slot-recipe-context.d.ts.map +1 -0
- package/lib/utils/create-slot-recipe-context.jsx +76 -0
- package/lib/utils/get-seed-class-name.d.ts.map +1 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/resolve-recipe-token.d.ts +38 -0
- package/lib/utils/resolve-recipe-token.d.ts.map +1 -0
- package/lib/utils/resolve-recipe-token.js +47 -0
- package/lib/utils/split-multiple-variants-props.d.ts +29 -0
- package/lib/utils/split-multiple-variants-props.d.ts.map +1 -0
- package/lib/utils/split-multiple-variants-props.js +34 -0
- package/package.json +12 -9
- package/src/components/ActionButton/ActionButton.tsx +290 -31
- package/src/components/ActionButton/__tests__/ActionButton.test.tsx +35 -0
- package/src/components/BottomSheet/BottomSheet.namespace.ts +24 -0
- package/src/components/BottomSheet/BottomSheet.tsx +386 -0
- package/src/components/BottomSheet/__tests__/BottomSheet.test.tsx +119 -0
- package/src/components/BottomSheet/index.ts +27 -0
- package/src/components/Checkbox/Checkbox.namespace.ts +12 -0
- package/src/components/Checkbox/Checkbox.tsx +291 -0
- package/src/components/Checkbox/index.ts +14 -0
- package/src/components/ProgressCircle/ProgressCircle.namespace.ts +5 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +14 -13
- package/src/components/ProgressCircle/index.ts +9 -1
- package/src/components/RadioGroup/RadioGroup.namespace.ts +12 -0
- package/src/components/RadioGroup/RadioGroup.tsx +338 -0
- package/src/components/RadioGroup/index.ts +14 -0
- package/src/components/Switch/Switch.namespace.ts +10 -0
- package/src/components/Switch/Switch.tsx +191 -0
- package/src/components/Switch/index.ts +12 -0
- package/src/components/TagGroup/TagGroup.namespace.ts +8 -0
- package/src/components/TagGroup/TagGroup.tsx +125 -0
- package/src/components/TagGroup/index.ts +10 -0
- package/src/components/__tests__/ProgressCircle.test.ts +33 -0
- package/src/components/__tests__/exports.test.ts +38 -0
- package/src/components/__tests__/switch.test.ts +34 -0
- package/src/components/index.ts +7 -0
- package/src/hooks/__tests__/use-controllable-state.test.ts +120 -0
- package/src/hooks/__tests__/use-press-tap.test.ts +129 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/use-controllable-state.ts +38 -0
- package/src/hooks/use-icon-color.ts +51 -0
- package/src/hooks/use-press-tap.ts +54 -0
- package/src/index.ts +3 -4
- package/src/utils/__tests__/create-slot-recipe-context.test.tsx +228 -0
- package/src/utils/__tests__/split-multiple-variants-props.test.ts +61 -0
- package/src/utils/create-slot-recipe-context.tsx +147 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/resolve-recipe-token.ts +47 -0
- package/src/utils/split-multiple-variants-props.ts +59 -0
- package/lib/components/Box/Box.d.ts +0 -10
- package/lib/components/Box/Box.d.ts.map +0 -1
- package/lib/components/Box/Box.jsx +0 -19
- package/lib/components/Box/index.d.ts +0 -2
- package/lib/components/Box/index.d.ts.map +0 -1
- package/lib/components/Box/index.js +0 -1
- package/lib/components/Flex/Flex.d.ts +0 -33
- package/lib/components/Flex/Flex.d.ts.map +0 -1
- package/lib/components/Flex/Flex.jsx +0 -7
- package/lib/components/Flex/index.d.ts +0 -2
- package/lib/components/Flex/index.d.ts.map +0 -1
- package/lib/components/Flex/index.js +0 -1
- package/lib/components/List/List.d.ts +0 -9
- package/lib/components/List/List.d.ts.map +0 -1
- package/lib/components/List/List.jsx +0 -17
- package/lib/components/List/index.d.ts +0 -2
- package/lib/components/List/index.d.ts.map +0 -1
- package/lib/components/List/index.js +0 -1
- package/lib/components/ListItem/ListItem.d.ts +0 -8
- package/lib/components/ListItem/ListItem.d.ts.map +0 -1
- package/lib/components/ListItem/ListItem.jsx +0 -11
- package/lib/components/ListItem/index.d.ts +0 -2
- package/lib/components/ListItem/index.d.ts.map +0 -1
- package/lib/components/ListItem/index.js +0 -1
- package/lib/components/ScrollView/ScrollView.d.ts +0 -9
- package/lib/components/ScrollView/ScrollView.d.ts.map +0 -1
- package/lib/components/ScrollView/ScrollView.jsx +0 -17
- package/lib/components/ScrollView/index.d.ts +0 -2
- package/lib/components/ScrollView/index.d.ts.map +0 -1
- package/lib/components/ScrollView/index.js +0 -1
- package/lib/components/Stack/Stack.d.ts +0 -6
- package/lib/components/Stack/Stack.d.ts.map +0 -1
- package/lib/components/Stack/Stack.jsx +0 -10
- package/lib/components/Stack/index.d.ts +0 -2
- package/lib/components/Stack/index.d.ts.map +0 -1
- package/lib/components/Stack/index.js +0 -1
- package/lib/components/Text/Text.d.ts +0 -30
- package/lib/components/Text/Text.d.ts.map +0 -1
- package/lib/components/Text/Text.jsx +0 -49
- package/lib/components/Text/index.d.ts +0 -2
- package/lib/components/Text/index.d.ts.map +0 -1
- package/lib/components/Text/index.js +0 -1
- package/lib/get-seed-class-name.d.ts.map +0 -1
- package/lib/utils/dynamic-style.d.ts +0 -13
- package/lib/utils/dynamic-style.d.ts.map +0 -1
- package/lib/utils/dynamic-style.js +0 -26
- package/lib/utils/styled.d.ts +0 -120
- package/lib/utils/styled.d.ts.map +0 -1
- package/lib/utils/styled.jsx +0 -131
- package/src/utils/dynamic-style.ts +0 -26
- /package/lib/{get-seed-class-name.d.ts → utils/get-seed-class-name.d.ts} +0 -0
- /package/lib/{get-seed-class-name.js → utils/get-seed-class-name.js} +0 -0
- /package/src/{get-seed-class-name.ts → utils/get-seed-class-name.ts} +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { forwardRef, memo } from "react";
|
|
2
|
-
import { Slot } from "@seed-design/lynx-primitive";
|
|
3
|
-
import { useStyleProps } from "../../utils/styled";
|
|
4
|
-
const ListImpl = forwardRef((props, ref) => {
|
|
5
|
-
const { style, restProps } = useStyleProps(props);
|
|
6
|
-
const { asChild = false, className, children, ...nativeProps } = restProps;
|
|
7
|
-
if (asChild) {
|
|
8
|
-
return (<Slot {...(ref ? { ref } : {})} className={className} style={style} {...nativeProps}>
|
|
9
|
-
{children}
|
|
10
|
-
</Slot>);
|
|
11
|
-
}
|
|
12
|
-
return (<list {...(ref ? { ref } : {})} className={className} style={style} {...nativeProps}>
|
|
13
|
-
{children}
|
|
14
|
-
</list>);
|
|
15
|
-
});
|
|
16
|
-
ListImpl.displayName = "List";
|
|
17
|
-
export const List = memo(ListImpl);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/List/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { List } from "./List";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { type StyleProps } from "../../utils/styled";
|
|
3
|
-
import type { ListItemProps as LynxListItemProps } from "@lynx-js/types";
|
|
4
|
-
export interface ListItemProps extends StyleProps, Omit<LynxListItemProps, "style"> {
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const ListItem: import("react").NamedExoticComponent<Omit<ListItemProps, "ref"> & import("react").RefAttributes<any>>;
|
|
8
|
-
//# sourceMappingURL=ListItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/components/ListItem/ListItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,MAAM,WAAW,aAAc,SAAQ,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACjF,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAoBD,eAAO,MAAM,QAAQ,uGAAqB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { forwardRef, memo } from "react";
|
|
2
|
-
import { useStyleProps } from "../../utils/styled";
|
|
3
|
-
const ListItemImpl = forwardRef((props, ref) => {
|
|
4
|
-
const { style, restProps } = useStyleProps(props);
|
|
5
|
-
const { className, children, ...nativeProps } = restProps;
|
|
6
|
-
return (<list-item {...(ref ? { ref } : {})} className={className} style={style} {...nativeProps}>
|
|
7
|
-
{children}
|
|
8
|
-
</list-item>);
|
|
9
|
-
});
|
|
10
|
-
ListItemImpl.displayName = "ListItem";
|
|
11
|
-
export const ListItem = memo(ListItemImpl);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ListItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ListItem } from "./ListItem";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { type StyleProps } from "../../utils/styled";
|
|
3
|
-
import type { ScrollViewProps as LynxScrollViewProps } from "@lynx-js/types";
|
|
4
|
-
export interface ScrollViewProps extends StyleProps, Omit<LynxScrollViewProps, "style"> {
|
|
5
|
-
asChild?: boolean;
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare const ScrollView: import("react").NamedExoticComponent<Omit<ScrollViewProps, "ref"> & import("react").RefAttributes<any>>;
|
|
9
|
-
//# sourceMappingURL=ScrollView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollView/ScrollView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,MAAM,WAAW,eAAgB,SAAQ,UAAU,EAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA4BD,eAAO,MAAM,UAAU,yGAAuB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { forwardRef, memo } from "react";
|
|
2
|
-
import { Slot } from "@seed-design/lynx-primitive";
|
|
3
|
-
import { useStyleProps } from "../../utils/styled";
|
|
4
|
-
const ScrollViewImpl = forwardRef((props, ref) => {
|
|
5
|
-
const { style, restProps } = useStyleProps(props);
|
|
6
|
-
const { asChild = false, className, children, ...nativeProps } = restProps;
|
|
7
|
-
if (asChild) {
|
|
8
|
-
return (<Slot {...(ref ? { ref } : {})} className={className} style={style} {...nativeProps}>
|
|
9
|
-
{children}
|
|
10
|
-
</Slot>);
|
|
11
|
-
}
|
|
12
|
-
return (<scroll-view {...(ref ? { ref } : {})} className={className} style={style} {...nativeProps}>
|
|
13
|
-
{children}
|
|
14
|
-
</scroll-view>);
|
|
15
|
-
});
|
|
16
|
-
ScrollViewImpl.displayName = "ScrollView";
|
|
17
|
-
export const ScrollView = memo(ScrollViewImpl);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ScrollView } from "./ScrollView";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type FlexProps } from "../Flex/Flex";
|
|
2
|
-
export type VStackProps = Omit<FlexProps, "flexDirection">;
|
|
3
|
-
export type HStackProps = Omit<FlexProps, "flexDirection">;
|
|
4
|
-
export declare const VStack: import("react").ForwardRefExoticComponent<VStackProps & import("react").RefAttributes<any>>;
|
|
5
|
-
export declare const HStack: import("react").ForwardRefExoticComponent<HStackProps & import("react").RefAttributes<any>>;
|
|
6
|
-
//# sourceMappingURL=Stack.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/components/Stack/Stack.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AAE3D,eAAO,MAAM,MAAM,6FAEjB,CAAC;AAIH,eAAO,MAAM,MAAM,6FAEjB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
import { Flex } from "../Flex/Flex";
|
|
3
|
-
export const VStack = forwardRef((props, ref) => {
|
|
4
|
-
return <Flex ref={ref} display="flex" flexDirection="column" {...props}/>;
|
|
5
|
-
});
|
|
6
|
-
VStack.displayName = "VStack";
|
|
7
|
-
export const HStack = forwardRef((props, ref) => {
|
|
8
|
-
return <Flex ref={ref} display="flex" flexDirection="row" {...props}/>;
|
|
9
|
-
});
|
|
10
|
-
HStack.displayName = "HStack";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Stack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { VStack, HStack } from "./Stack";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { TextVariantProps } from "@seed-design/lynx-css/recipes/text";
|
|
2
|
-
import { type FontSize, type FontWeight, type LineHeight, type ScopedColorFg, type ScopedColorPalette } from "@seed-design/css/vars";
|
|
3
|
-
import type { ReactNode } from "react";
|
|
4
|
-
export interface TextProps extends Pick<TextVariantProps, "textStyle"> {
|
|
5
|
-
/**
|
|
6
|
-
* The color of the text.
|
|
7
|
-
*/
|
|
8
|
-
color?: ScopedColorFg | ScopedColorPalette | (string & {});
|
|
9
|
-
/**
|
|
10
|
-
* The font size of the text. Partially overrides the textStyle.
|
|
11
|
-
*/
|
|
12
|
-
fontSize?: FontSize | (string & {});
|
|
13
|
-
/**
|
|
14
|
-
* The line height of the text. Partially overrides the textStyle.
|
|
15
|
-
*/
|
|
16
|
-
lineHeight?: LineHeight | (string & {});
|
|
17
|
-
/**
|
|
18
|
-
* The font weight of the text. Partially overrides the textStyle.
|
|
19
|
-
*/
|
|
20
|
-
fontWeight?: FontWeight;
|
|
21
|
-
/**
|
|
22
|
-
* The alignment of the text.
|
|
23
|
-
*/
|
|
24
|
-
align?: "left" | "center" | "right";
|
|
25
|
-
className?: string;
|
|
26
|
-
style?: React.CSSProperties;
|
|
27
|
-
children?: ReactNode;
|
|
28
|
-
}
|
|
29
|
-
export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<any>>;
|
|
30
|
-
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAqCvC,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC;IACpE;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,GAAG,kBAAkB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAEpC;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAExC;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,IAAI,2FA0BhB,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { text } from "@seed-design/lynx-css/recipes/text";
|
|
2
|
-
import { vars, } from "@seed-design/css/vars";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import { forwardRef, useMemo } from "react";
|
|
5
|
-
import { dynamicStyle } from "../../utils/dynamic-style";
|
|
6
|
-
function handleColor(color) {
|
|
7
|
-
if (!color) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
const [type, value] = color.split(".");
|
|
11
|
-
// @ts-expect-error
|
|
12
|
-
return vars.$color[type]?.[value] ?? color;
|
|
13
|
-
}
|
|
14
|
-
function handleFontWeight(fontWeight) {
|
|
15
|
-
if (!fontWeight) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
// @ts-expect-error
|
|
19
|
-
return vars.$fontWeight[fontWeight] ?? undefined;
|
|
20
|
-
}
|
|
21
|
-
function handleFontSize(size) {
|
|
22
|
-
if (!size) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
// @ts-expect-error
|
|
26
|
-
return vars.$fontSize[size] ?? size;
|
|
27
|
-
}
|
|
28
|
-
function handleLineHeight(lineHeight) {
|
|
29
|
-
if (!lineHeight) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
// @ts-expect-error
|
|
33
|
-
return vars.$lineHeight[lineHeight] ?? lineHeight;
|
|
34
|
-
}
|
|
35
|
-
export const Text = forwardRef(({ color, textStyle, fontSize, lineHeight, fontWeight, align, children, className, style }, ref) => {
|
|
36
|
-
const classes = useMemo(() => text({ textStyle }), [textStyle]);
|
|
37
|
-
const textStyleStr = dynamicStyle({
|
|
38
|
-
color: handleColor(color),
|
|
39
|
-
"font-size": handleFontSize(fontSize),
|
|
40
|
-
"line-height": handleLineHeight(lineHeight ?? fontSize),
|
|
41
|
-
"font-weight": handleFontWeight(fontWeight),
|
|
42
|
-
"text-align": align,
|
|
43
|
-
...style,
|
|
44
|
-
});
|
|
45
|
-
return (<text {...(ref ? { ref } : {})} className={clsx(classes.text, className)} style={textStyleStr}>
|
|
46
|
-
{children}
|
|
47
|
-
</text>);
|
|
48
|
-
});
|
|
49
|
-
Text.displayName = "Text";
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
export { Text } from "./Text";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-seed-class-name.d.ts","sourceRoot":"","sources":["../src/get-seed-class-name.ts"],"names":[],"mappings":"AAUA,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,MAAM,CAsB5E"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a style object to a Lynx-compatible style string.
|
|
3
|
-
*
|
|
4
|
-
* Lynx compiles object-form `style` props into static CSS at build time,
|
|
5
|
-
* which drops dynamically-set CSS custom properties. Passing styles as a
|
|
6
|
-
* string literal preserves runtime values.
|
|
7
|
-
*
|
|
8
|
-
* Property names are converted from camelCase to kebab-case so that
|
|
9
|
-
* `React.CSSProperties` keys (e.g. `fontSize`) produce valid CSS
|
|
10
|
-
* (e.g. `font-size`).
|
|
11
|
-
*/
|
|
12
|
-
export declare function dynamicStyle(style: Record<string, unknown>): string;
|
|
13
|
-
//# sourceMappingURL=dynamic-style.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-style.d.ts","sourceRoot":"","sources":["../../src/utils/dynamic-style.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAKnE"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert camelCase CSS property names to kebab-case.
|
|
3
|
-
* CSS custom properties (starting with `--`) are left unchanged.
|
|
4
|
-
*/
|
|
5
|
-
function toKebabCase(str) {
|
|
6
|
-
if (str.startsWith("--"))
|
|
7
|
-
return str;
|
|
8
|
-
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Convert a style object to a Lynx-compatible style string.
|
|
12
|
-
*
|
|
13
|
-
* Lynx compiles object-form `style` props into static CSS at build time,
|
|
14
|
-
* which drops dynamically-set CSS custom properties. Passing styles as a
|
|
15
|
-
* string literal preserves runtime values.
|
|
16
|
-
*
|
|
17
|
-
* Property names are converted from camelCase to kebab-case so that
|
|
18
|
-
* `React.CSSProperties` keys (e.g. `fontSize`) produce valid CSS
|
|
19
|
-
* (e.g. `font-size`).
|
|
20
|
-
*/
|
|
21
|
-
export function dynamicStyle(style) {
|
|
22
|
-
return Object.entries(style)
|
|
23
|
-
.filter(([_, v]) => v != null)
|
|
24
|
-
.map(([k, v]) => `${toKebabCase(k)}: ${v}`)
|
|
25
|
-
.join("; ");
|
|
26
|
-
}
|
package/lib/utils/styled.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import type { ScopedColorBg, ScopedColorFg, ScopedColorPalette, ScopedColorStroke, Dimension, Radius, SpacingX, SpacingY, Gradient, Shadow, ScopedColorBanner } from "@seed-design/css/vars";
|
|
2
|
-
export declare function handleColor(color: string | undefined): any;
|
|
3
|
-
export declare function handleDimension(dimension: string | 0 | undefined): string | undefined;
|
|
4
|
-
export declare function handlePaddingWithSafeArea(padding: string | 0 | undefined, direction: "top" | "bottom"): string | undefined;
|
|
5
|
-
export declare function handleRadius(radius: string | 0 | undefined): any;
|
|
6
|
-
export interface StyleProps {
|
|
7
|
-
/**
|
|
8
|
-
* Shorthand for `background`.
|
|
9
|
-
*/
|
|
10
|
-
bg?: ScopedColorBg | ScopedColorPalette | ScopedColorBanner | (string & {});
|
|
11
|
-
background?: ScopedColorBg | ScopedColorPalette | ScopedColorBanner | (string & {});
|
|
12
|
-
/**
|
|
13
|
-
* Shorthand for `backgroundGradient`.
|
|
14
|
-
*/
|
|
15
|
-
bgGradient?: Gradient;
|
|
16
|
-
backgroundGradient?: Gradient;
|
|
17
|
-
/**
|
|
18
|
-
* Shorthand for `backgroundGradientDirection`.
|
|
19
|
-
* e.g. `43deg`
|
|
20
|
-
*/
|
|
21
|
-
bgGradientDirection?: "to right" | "to left" | "to top" | "to bottom" | "to top right" | "to top left" | "to bottom right" | "to bottom left" | (string & {});
|
|
22
|
-
backgroundGradientDirection?: "to right" | "to left" | "to top" | "to bottom" | "to top right" | "to top left" | "to bottom right" | "to bottom left" | (string & {});
|
|
23
|
-
color?: ScopedColorFg | ScopedColorPalette | (string & {});
|
|
24
|
-
borderColor?: ScopedColorStroke | ScopedColorPalette | (string & {});
|
|
25
|
-
borderWidth?: 0 | 1 | (string & {});
|
|
26
|
-
borderTopWidth?: 0 | 1 | (string & {});
|
|
27
|
-
borderRightWidth?: 0 | 1 | (string & {});
|
|
28
|
-
borderBottomWidth?: 0 | 1 | (string & {});
|
|
29
|
-
borderLeftWidth?: 0 | 1 | (string & {});
|
|
30
|
-
borderRadius?: Radius | 0 | (string & {});
|
|
31
|
-
borderTopLeftRadius?: Radius | 0 | (string & {});
|
|
32
|
-
borderTopRightRadius?: Radius | 0 | (string & {});
|
|
33
|
-
borderBottomRightRadius?: Radius | 0 | (string & {});
|
|
34
|
-
borderBottomLeftRadius?: Radius | 0 | (string & {});
|
|
35
|
-
boxShadow?: Shadow | (string & {});
|
|
36
|
-
width?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | "full" | (string & {});
|
|
37
|
-
minWidth?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | "full" | (string & {});
|
|
38
|
-
maxWidth?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | "full" | (string & {});
|
|
39
|
-
height?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | "full" | (string & {});
|
|
40
|
-
minHeight?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | "full" | (string & {});
|
|
41
|
-
maxHeight?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | "full" | (string & {});
|
|
42
|
-
top?: 0 | (string & {});
|
|
43
|
-
left?: 0 | (string & {});
|
|
44
|
-
right?: 0 | (string & {});
|
|
45
|
-
bottom?: 0 | (string & {});
|
|
46
|
-
padding?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
47
|
-
/**
|
|
48
|
-
* Shorthand for `padding`.
|
|
49
|
-
*/
|
|
50
|
-
p?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
51
|
-
paddingX?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
52
|
-
/**
|
|
53
|
-
* Shorthand for `paddingX`.
|
|
54
|
-
*/
|
|
55
|
-
px?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
56
|
-
paddingY?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
57
|
-
/**
|
|
58
|
-
* Shorthand for `paddingY`.
|
|
59
|
-
*/
|
|
60
|
-
py?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
61
|
-
paddingTop?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | "safeArea" | (string & {});
|
|
62
|
-
/**
|
|
63
|
-
* Shorthand for `paddingTop`.
|
|
64
|
-
*/
|
|
65
|
-
pt?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | "safeArea" | (string & {});
|
|
66
|
-
paddingRight?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
67
|
-
/**
|
|
68
|
-
* Shorthand for `paddingRight`.
|
|
69
|
-
*/
|
|
70
|
-
pr?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
71
|
-
paddingBottom?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | "safeArea" | (string & {});
|
|
72
|
-
/**
|
|
73
|
-
* Shorthand for `paddingBottom`.
|
|
74
|
-
*/
|
|
75
|
-
pb?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | "safeArea" | (string & {});
|
|
76
|
-
paddingLeft?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
77
|
-
/**
|
|
78
|
-
* Shorthand for `paddingLeft`.
|
|
79
|
-
*/
|
|
80
|
-
pl?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
81
|
-
bleedX?: "asPadding" | Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
82
|
-
bleedY?: "asPadding" | Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
83
|
-
bleedTop?: "asPadding" | Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
84
|
-
bleedRight?: "asPadding" | Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
85
|
-
bleedBottom?: "asPadding" | Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
86
|
-
bleedLeft?: "asPadding" | Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
87
|
-
display?: "flex" | "none" | "block";
|
|
88
|
-
position?: "relative" | "absolute" | "fixed" | "sticky";
|
|
89
|
-
overflowX?: "visible" | "hidden";
|
|
90
|
-
overflowY?: "visible" | "hidden";
|
|
91
|
-
zIndex?: number | (string & {});
|
|
92
|
-
/**
|
|
93
|
-
* If true, flex-grow will be set to `1`.
|
|
94
|
-
*/
|
|
95
|
-
flexGrow?: 0 | 1 | (number & {}) | true;
|
|
96
|
-
/**
|
|
97
|
-
* If true, flex-shrink will be set to `1`.
|
|
98
|
-
*/
|
|
99
|
-
flexShrink?: 0 | (number & {}) | true;
|
|
100
|
-
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
|
|
101
|
-
/**
|
|
102
|
-
* If true, flex-wrap will be set to `wrap`.
|
|
103
|
-
*/
|
|
104
|
-
flexWrap?: "wrap" | "wrap-reverse" | "nowrap" | true;
|
|
105
|
-
justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around";
|
|
106
|
-
justifySelf?: "center" | "start" | "end" | "stretch";
|
|
107
|
-
alignItems?: "flex-start" | "flex-end" | "center" | "stretch";
|
|
108
|
-
alignContent?: "flex-start" | "flex-end" | "center" | "stretch";
|
|
109
|
-
alignSelf?: "flex-start" | "flex-end" | "center" | "stretch";
|
|
110
|
-
gap?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
111
|
-
}
|
|
112
|
-
interface UseStyleProps extends StyleProps {
|
|
113
|
-
style?: React.CSSProperties;
|
|
114
|
-
}
|
|
115
|
-
export declare function useStyleProps<T extends UseStyleProps>(props: T): {
|
|
116
|
-
style: string;
|
|
117
|
-
restProps: Omit<T, keyof UseStyleProps>;
|
|
118
|
-
};
|
|
119
|
-
export {};
|
|
120
|
-
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../src/utils/styled.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAG/B,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,OAOpD;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAwBrF;AAs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C,CAAC,EAAE,MAAM,aAAa,CAAC,CAAC;CACzC,CAwIA"}
|
package/lib/utils/styled.jsx
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StyleProps utilities for Lynx.
|
|
3
|
-
* Based on packages/react/src/utils/styled.tsx, adapted for Lynx environment.
|
|
4
|
-
*/
|
|
5
|
-
import { dynamicStyle } from "./dynamic-style";
|
|
6
|
-
import { vars } from "@seed-design/css/vars";
|
|
7
|
-
export function handleColor(color) {
|
|
8
|
-
if (!color) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
const [type, value] = color.split(".");
|
|
12
|
-
// @ts-expect-error
|
|
13
|
-
return vars.$color[type]?.[value] ?? color;
|
|
14
|
-
}
|
|
15
|
-
export function handleDimension(dimension) {
|
|
16
|
-
if (dimension == null) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
if (typeof dimension === "number") {
|
|
20
|
-
return `${dimension}px`;
|
|
21
|
-
}
|
|
22
|
-
if (dimension === "full") {
|
|
23
|
-
return "100%";
|
|
24
|
-
}
|
|
25
|
-
const [type, value] = dimension.split(".");
|
|
26
|
-
// @ts-expect-error
|
|
27
|
-
const resolved = vars.$dimension[dimension] ?? vars.$dimension[type]?.[value] ?? dimension;
|
|
28
|
-
// 숫자만으로 이루어진 string이면 px 단위 추가 (Lynx는 unitless length를 허용하지 않음)
|
|
29
|
-
if (typeof resolved === "string" && /^\d+(\.\d+)?$/.test(resolved)) {
|
|
30
|
-
return `${resolved}px`;
|
|
31
|
-
}
|
|
32
|
-
return resolved;
|
|
33
|
-
}
|
|
34
|
-
function handleBleed(dimension, direction) {
|
|
35
|
-
if (dimension === "asPadding") {
|
|
36
|
-
return `var(--seed-box-padding-${direction})`;
|
|
37
|
-
}
|
|
38
|
-
return handleDimension(dimension);
|
|
39
|
-
}
|
|
40
|
-
function handleShadow(shadow) {
|
|
41
|
-
if (!shadow) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
// @ts-expect-error
|
|
45
|
-
return vars.$shadow[shadow] ?? shadow;
|
|
46
|
-
}
|
|
47
|
-
export function handlePaddingWithSafeArea(padding, direction) {
|
|
48
|
-
if (padding === "safeArea") {
|
|
49
|
-
return `var(--seed-safe-area-${direction})`;
|
|
50
|
-
}
|
|
51
|
-
return handleDimension(padding);
|
|
52
|
-
}
|
|
53
|
-
export function handleRadius(radius) {
|
|
54
|
-
if (radius == null) {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
// @ts-expect-error
|
|
58
|
-
return vars.$radius[radius] ?? radius;
|
|
59
|
-
}
|
|
60
|
-
function handleGradient(gradientToken, direction) {
|
|
61
|
-
if (!gradientToken || !direction) {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
// @ts-expect-error
|
|
65
|
-
const colorStops = vars.$gradient[gradientToken];
|
|
66
|
-
if (!colorStops) {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
return `linear-gradient(${direction}, ${colorStops})`;
|
|
70
|
-
}
|
|
71
|
-
export function useStyleProps(props) {
|
|
72
|
-
const { background, bg, bgGradient, backgroundGradient, bgGradientDirection, backgroundGradientDirection, color, borderColor, borderWidth, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderRadius, borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius, boxShadow, width, minWidth, maxWidth, height, minHeight, maxHeight, padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, p, px, py, pt, pr, pb, pl, bleedX, bleedY, bleedTop, bleedRight, bleedBottom, bleedLeft, bottom, left, right, top, display, position, overflowX, overflowY, zIndex, flexGrow, flexShrink, flexDirection, flexWrap, justifyContent, justifySelf, alignItems, alignContent, alignSelf, gap, style, ...restProps } = props;
|
|
73
|
-
const gradientValue = handleGradient(bgGradient ?? backgroundGradient, bgGradientDirection ?? backgroundGradientDirection);
|
|
74
|
-
const rawStyle = {
|
|
75
|
-
"--seed-box-background": handleColor(background ?? bg) ?? gradientValue,
|
|
76
|
-
"--seed-box-color": handleColor(color),
|
|
77
|
-
"--seed-box-border-color": handleColor(borderColor),
|
|
78
|
-
"--seed-box-border-width": borderWidth !== undefined ? `${borderWidth}px` : undefined,
|
|
79
|
-
"--seed-box-border-top-width": borderTopWidth !== undefined ? `${borderTopWidth}px` : undefined,
|
|
80
|
-
"--seed-box-border-right-width": borderRightWidth !== undefined ? `${borderRightWidth}px` : undefined,
|
|
81
|
-
"--seed-box-border-bottom-width": borderBottomWidth !== undefined ? `${borderBottomWidth}px` : undefined,
|
|
82
|
-
"--seed-box-border-left-width": borderLeftWidth !== undefined ? `${borderLeftWidth}px` : undefined,
|
|
83
|
-
"--seed-box-border-radius": handleRadius(borderRadius),
|
|
84
|
-
"--seed-box-border-top-left-radius": handleRadius(borderTopLeftRadius),
|
|
85
|
-
"--seed-box-border-top-right-radius": handleRadius(borderTopRightRadius),
|
|
86
|
-
"--seed-box-border-bottom-right-radius": handleRadius(borderBottomRightRadius),
|
|
87
|
-
"--seed-box-border-bottom-left-radius": handleRadius(borderBottomLeftRadius),
|
|
88
|
-
"--seed-box-box-shadow": handleShadow(boxShadow),
|
|
89
|
-
"--seed-box-width": handleDimension(width),
|
|
90
|
-
"--seed-box-min-width": handleDimension(minWidth),
|
|
91
|
-
"--seed-box-max-width": handleDimension(maxWidth),
|
|
92
|
-
"--seed-box-height": handleDimension(height),
|
|
93
|
-
"--seed-box-min-height": handleDimension(minHeight),
|
|
94
|
-
"--seed-box-max-height": handleDimension(maxHeight),
|
|
95
|
-
"--seed-box-padding": handleDimension(padding ?? p),
|
|
96
|
-
"--seed-box-padding-x": handleDimension(paddingX ?? px),
|
|
97
|
-
"--seed-box-padding-y": handleDimension(paddingY ?? py),
|
|
98
|
-
"--seed-box-padding-top": handlePaddingWithSafeArea(paddingTop ?? pt, "top"),
|
|
99
|
-
"--seed-box-padding-right": handleDimension(paddingRight ?? pr),
|
|
100
|
-
"--seed-box-padding-bottom": handlePaddingWithSafeArea(paddingBottom ?? pb, "bottom"),
|
|
101
|
-
"--seed-box-padding-left": handleDimension(paddingLeft ?? pl),
|
|
102
|
-
"--seed-box-bleed-top": handleBleed(bleedTop ?? bleedY, "top"),
|
|
103
|
-
"--seed-box-bleed-right": handleBleed(bleedRight ?? bleedX, "right"),
|
|
104
|
-
"--seed-box-bleed-bottom": handleBleed(bleedBottom ?? bleedY, "bottom"),
|
|
105
|
-
"--seed-box-bleed-left": handleBleed(bleedLeft ?? bleedX, "left"),
|
|
106
|
-
"--seed-box-top": top,
|
|
107
|
-
"--seed-box-left": left,
|
|
108
|
-
"--seed-box-right": right,
|
|
109
|
-
"--seed-box-bottom": bottom,
|
|
110
|
-
"--seed-box-gap": handleDimension(gap),
|
|
111
|
-
"--seed-box-display": display,
|
|
112
|
-
"--seed-box-position": position,
|
|
113
|
-
"--seed-box-overflow-x": overflowX,
|
|
114
|
-
"--seed-box-overflow-y": overflowY,
|
|
115
|
-
"--seed-box-z-index": zIndex,
|
|
116
|
-
"--seed-box-flex-grow": flexGrow === true ? 1 : flexGrow,
|
|
117
|
-
"--seed-box-flex-shrink": flexShrink === true ? 1 : flexShrink,
|
|
118
|
-
"--seed-box-flex-direction": flexDirection,
|
|
119
|
-
"--seed-box-flex-wrap": flexWrap === true ? "wrap" : flexWrap,
|
|
120
|
-
"--seed-box-justify-content": justifyContent,
|
|
121
|
-
"--seed-box-justify-self": justifySelf,
|
|
122
|
-
"--seed-box-align-items": alignItems,
|
|
123
|
-
"--seed-box-align-content": alignContent,
|
|
124
|
-
"--seed-box-align-self": alignSelf,
|
|
125
|
-
...style,
|
|
126
|
-
};
|
|
127
|
-
return {
|
|
128
|
-
style: dynamicStyle(rawStyle),
|
|
129
|
-
restProps: restProps,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert camelCase CSS property names to kebab-case.
|
|
3
|
-
* CSS custom properties (starting with `--`) are left unchanged.
|
|
4
|
-
*/
|
|
5
|
-
function toKebabCase(str: string): string {
|
|
6
|
-
if (str.startsWith("--")) return str;
|
|
7
|
-
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Convert a style object to a Lynx-compatible style string.
|
|
12
|
-
*
|
|
13
|
-
* Lynx compiles object-form `style` props into static CSS at build time,
|
|
14
|
-
* which drops dynamically-set CSS custom properties. Passing styles as a
|
|
15
|
-
* string literal preserves runtime values.
|
|
16
|
-
*
|
|
17
|
-
* Property names are converted from camelCase to kebab-case so that
|
|
18
|
-
* `React.CSSProperties` keys (e.g. `fontSize`) produce valid CSS
|
|
19
|
-
* (e.g. `font-size`).
|
|
20
|
-
*/
|
|
21
|
-
export function dynamicStyle(style: Record<string, unknown>): string {
|
|
22
|
-
return Object.entries(style)
|
|
23
|
-
.filter(([_, v]) => v != null)
|
|
24
|
-
.map(([k, v]) => `${toKebabCase(k)}: ${v}`)
|
|
25
|
-
.join("; ");
|
|
26
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|