@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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useStyleProps } from "../../utils/styled.js";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
//#region src/components/Box/Box.tsx
|
|
5
|
+
var Box = React.forwardRef((props, ref) => {
|
|
6
|
+
const { style, restProps } = useStyleProps(props);
|
|
7
|
+
const { children, className, ...nativeProps } = restProps;
|
|
8
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} className={clsx(className)} style={style}>
|
|
9
|
+
{children}
|
|
10
|
+
</view>;
|
|
11
|
+
});
|
|
12
|
+
Box.displayName = "Box";
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Box };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export interface CheckboxRootProps extends CheckboxVariantProps, Omit<CheckmarkVariantProps, "size" | "checked" | "disabled" | "indeterminate"
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
className?: string;
|
|
1
|
+
import { ReactElement } from '@lynx-js/react';
|
|
2
|
+
import { CheckboxVariantProps } from '@seed-design/lynx-css/recipes/checkbox';
|
|
3
|
+
import { CheckmarkVariantProps } from '@seed-design/lynx-css/recipes/checkmark';
|
|
4
|
+
import { LynxIconElementProps, LynxStyledElementProps } from '../../types';
|
|
5
|
+
import * as React from "@lynx-js/react";
|
|
6
|
+
export interface CheckboxRootProps extends CheckboxVariantProps, Omit<CheckmarkVariantProps, "size" | "checked" | "disabled" | "indeterminate">, LynxStyledElementProps {
|
|
9
7
|
checked?: boolean;
|
|
10
8
|
defaultChecked?: boolean;
|
|
11
9
|
indeterminate?: boolean;
|
|
@@ -13,39 +11,25 @@ export interface CheckboxRootProps extends CheckboxVariantProps, Omit<CheckmarkV
|
|
|
13
11
|
onCheckedChange?: (checked: boolean) => void;
|
|
14
12
|
}
|
|
15
13
|
export declare const CheckboxRoot: React.ForwardRefExoticComponent<CheckboxRootProps & React.RefAttributes<unknown>>;
|
|
16
|
-
export interface CheckboxControlProps extends Pick<CheckmarkVariantProps, "tone" | "variant" | "size"
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
className?: string;
|
|
14
|
+
export interface CheckboxControlProps extends Pick<CheckmarkVariantProps, "tone" | "variant" | "size">, LynxStyledElementProps {
|
|
19
15
|
}
|
|
20
16
|
export declare const CheckboxControl: React.ForwardRefExoticComponent<CheckboxControlProps & React.RefAttributes<unknown>>;
|
|
21
|
-
|
|
22
|
-
className?: string;
|
|
23
|
-
style?: CSSProperties;
|
|
24
|
-
ref?: React.Ref<MainThread.Element>;
|
|
25
|
-
};
|
|
26
|
-
export interface CheckboxIndicatorProps {
|
|
17
|
+
export interface CheckboxIndicatorProps extends Pick<LynxStyledElementProps, "className" | "style"> {
|
|
27
18
|
/** Icon rendered when neither checked nor indeterminate. Optional. */
|
|
28
|
-
unchecked?: ReactElement<
|
|
19
|
+
unchecked?: ReactElement<LynxIconElementProps>;
|
|
29
20
|
/** Icon rendered when `checked=true` and `indeterminate=false`. */
|
|
30
|
-
checked: ReactElement<
|
|
21
|
+
checked: ReactElement<LynxIconElementProps>;
|
|
31
22
|
/** Icon rendered when `indeterminate=true`. */
|
|
32
|
-
indeterminate?: ReactElement<
|
|
33
|
-
className?: string;
|
|
34
|
-
style?: CSSProperties;
|
|
23
|
+
indeterminate?: ReactElement<LynxIconElementProps>;
|
|
35
24
|
}
|
|
36
|
-
export declare function CheckboxIndicator(props: CheckboxIndicatorProps): React.
|
|
25
|
+
export declare function CheckboxIndicator(props: CheckboxIndicatorProps): React.JSX.Element | null;
|
|
37
26
|
export declare namespace CheckboxIndicator {
|
|
38
27
|
var displayName: string;
|
|
39
28
|
}
|
|
40
|
-
export interface CheckboxLabelProps {
|
|
41
|
-
children?: React.ReactNode;
|
|
42
|
-
className?: string;
|
|
29
|
+
export interface CheckboxLabelProps extends LynxStyledElementProps {
|
|
43
30
|
}
|
|
44
31
|
export declare const CheckboxLabel: React.ForwardRefExoticComponent<CheckboxLabelProps & React.RefAttributes<unknown>>;
|
|
45
|
-
export interface CheckboxGroupProps {
|
|
46
|
-
children?: React.ReactNode;
|
|
47
|
-
className?: string;
|
|
32
|
+
export interface CheckboxGroupProps extends LynxStyledElementProps {
|
|
48
33
|
}
|
|
49
34
|
export declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<unknown>>;
|
|
50
|
-
export {};
|
|
51
35
|
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAKrF,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAuDrB,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC,EAC9E,sBAAsB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,YAAY,mFA8DvB,CAAC;AAKH,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,EAC9D,sBAAsB;CAAG;AAE7B,eAAO,MAAM,eAAe,sFA2B1B,CAAC;AAKH,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,OAAO,CAAC;IAC3D,sEAAsE;IACtE,SAAS,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC/C,mEAAmE;IACnE,OAAO,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC5C,+CAA+C;IAC/C,aAAa,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;CACpD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,4BAwC9D;yBAxCe,iBAAiB;;;AA6CjC,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB;CAAG;AAErE,eAAO,MAAM,aAAa,oFAiBxB,CAAC;AAKH,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB;CAAG;AAErE,eAAO,MAAM,aAAa,oFAaxB,CAAC"}
|
|
@@ -1,121 +1,130 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
2
|
+
import { InternalIcon } from "../Icon/Icon.jsx";
|
|
3
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
4
|
+
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
3
5
|
import clsx from "clsx";
|
|
6
|
+
import * as React from "@lynx-js/react";
|
|
7
|
+
import { isValidElement } from "@lynx-js/react";
|
|
4
8
|
import { checkbox } from "@seed-design/lynx-css/recipes/checkbox";
|
|
5
9
|
import { checkmark } from "@seed-design/lynx-css/recipes/checkmark";
|
|
6
10
|
import { checkboxGroup } from "@seed-design/lynx-css/recipes/checkbox-group";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { useIconColor } from "../../hooks/use-icon-color";
|
|
10
|
-
import { usePressTap } from "../../hooks/use-press-tap";
|
|
11
|
-
import { capitalize, resolveRecipeToken } from "../../utils/resolve-recipe-token";
|
|
12
|
-
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props";
|
|
13
|
-
const CheckboxContext = React.createContext(null);
|
|
11
|
+
//#region src/components/Checkbox/Checkbox.tsx
|
|
12
|
+
var CheckboxContext = React.createContext(null);
|
|
14
13
|
function useCheckboxContext(consumer) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
return ctx;
|
|
14
|
+
const ctx = React.useContext(CheckboxContext);
|
|
15
|
+
if (!ctx) throw new Error(`<${consumer}/> must be rendered inside <CheckboxRoot/>.`);
|
|
16
|
+
return ctx;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
return ctx;
|
|
18
|
+
var CheckmarkControlContext = React.createContext(null);
|
|
19
|
+
function useCheckmarkControlContext(consumer) {
|
|
20
|
+
const ctx = React.useContext(CheckmarkControlContext);
|
|
21
|
+
if (!ctx) throw new Error(`<${consumer}/> must be rendered inside <CheckboxControl/>.`);
|
|
22
|
+
return ctx;
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
var CheckboxRoot = React.forwardRef((props, ref) => {
|
|
25
|
+
const { children, className, checked: checkedProp, defaultChecked = false, indeterminate = false, disabled = false, onCheckedChange, ...restProps } = props;
|
|
26
|
+
const [{ checkbox: checkboxVariantProps, checkmark: checkmarkVariantProps }, nativeProps] = splitMultipleVariantsProps(restProps, {
|
|
27
|
+
checkbox,
|
|
28
|
+
checkmark
|
|
29
|
+
});
|
|
30
|
+
const [checked, setChecked] = useControllableState({
|
|
31
|
+
value: checkedProp,
|
|
32
|
+
defaultValue: defaultChecked,
|
|
33
|
+
onChange: onCheckedChange
|
|
34
|
+
});
|
|
35
|
+
const toggle = React.useCallback(() => setChecked(!checked), [checked, setChecked]);
|
|
36
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
37
|
+
disabled,
|
|
38
|
+
onTap: toggle
|
|
39
|
+
});
|
|
40
|
+
const rootClassName = checkbox({
|
|
41
|
+
...checkboxVariantProps,
|
|
42
|
+
disabled
|
|
43
|
+
}).root;
|
|
44
|
+
const contextValue = React.useMemo(() => ({
|
|
45
|
+
checked,
|
|
46
|
+
indeterminate,
|
|
47
|
+
disabled,
|
|
48
|
+
pressed,
|
|
49
|
+
checkboxVariantProps,
|
|
50
|
+
checkmarkVariantProps,
|
|
51
|
+
toggle
|
|
52
|
+
}), [
|
|
53
|
+
checked,
|
|
54
|
+
indeterminate,
|
|
55
|
+
disabled,
|
|
56
|
+
pressed,
|
|
57
|
+
checkboxVariantProps,
|
|
58
|
+
checkmarkVariantProps,
|
|
59
|
+
toggle
|
|
60
|
+
]);
|
|
61
|
+
return <CheckboxContext.Provider value={contextValue}>
|
|
62
|
+
<view {...ref ? { ref } : {}} className={clsx(rootClassName, className)} {...pressHandlers} {...nativeProps}>
|
|
49
63
|
{children}
|
|
50
64
|
</view>
|
|
51
|
-
</CheckboxContext.Provider
|
|
65
|
+
</CheckboxContext.Provider>;
|
|
52
66
|
});
|
|
53
67
|
CheckboxRoot.displayName = "CheckboxRoot";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
var CheckboxControl = React.forwardRef((props, ref) => {
|
|
69
|
+
const [variantProps, restProps] = checkmark.splitVariantProps(props);
|
|
70
|
+
const { children, className, ...nativeProps } = restProps;
|
|
71
|
+
const context = useCheckboxContext("CheckboxControl");
|
|
72
|
+
const checkmarkVariantProps = {
|
|
73
|
+
...context.checkmarkVariantProps,
|
|
74
|
+
...variantProps,
|
|
75
|
+
checked: context.checked,
|
|
76
|
+
disabled: context.disabled,
|
|
77
|
+
indeterminate: context.indeterminate,
|
|
78
|
+
pressed: context.pressed
|
|
79
|
+
};
|
|
80
|
+
const classes = checkmark(checkmarkVariantProps);
|
|
81
|
+
return <CheckmarkControlContext.Provider value={{
|
|
82
|
+
iconClassName: classes.icon,
|
|
83
|
+
checkmarkVariantProps
|
|
84
|
+
}}>
|
|
85
|
+
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
|
|
64
86
|
{children}
|
|
65
87
|
</view>
|
|
66
|
-
</
|
|
88
|
+
</CheckmarkControlContext.Provider>;
|
|
67
89
|
});
|
|
68
90
|
CheckboxControl.displayName = "CheckboxControl";
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const icon = indeterminate ? indeterminateIcon : checked ? checkedIcon : unchecked;
|
|
86
|
-
if (!icon || !isValidElement(icon))
|
|
87
|
-
return null;
|
|
88
|
-
// lynx-monochrome-icon 이 `<image style={{ width, height, ...style }}>` 로 자체 default size 를 박으므로
|
|
89
|
-
// recipe 토큰에서 꺼낸 사이즈를 inline 으로 주입해 덮는다.
|
|
90
|
-
const iconSize = resolveRecipeToken(checkmarkVars, [
|
|
91
|
-
`variant${capitalize(variant)}Size${capitalize(size)}`,
|
|
92
|
-
"enabled",
|
|
93
|
-
"icon",
|
|
94
|
-
"size",
|
|
95
|
-
]);
|
|
96
|
-
return cloneElement(icon, {
|
|
97
|
-
className: clsx(iconClassName, icon.props.className, className),
|
|
98
|
-
style: iconSize
|
|
99
|
-
? { width: iconSize, height: iconSize, ...icon.props.style, ...style }
|
|
100
|
-
: { ...icon.props.style, ...style },
|
|
101
|
-
ref: tintRef,
|
|
102
|
-
});
|
|
91
|
+
function CheckboxIndicator(props) {
|
|
92
|
+
const { unchecked, checked: checkedIcon, indeterminate: indeterminateIcon, className, style } = props;
|
|
93
|
+
const context = useCheckboxContext("CheckboxIndicator");
|
|
94
|
+
const { iconClassName, checkmarkVariantProps } = useCheckmarkControlContext("CheckboxIndicator");
|
|
95
|
+
if (process.env.NODE_ENV !== "production" && context.indeterminate && !indeterminateIcon) console.warn("[seed-design] CheckboxIndicator: `indeterminate` prop must be provided when the checkbox is in an indeterminate state.");
|
|
96
|
+
const icon = context.indeterminate ? indeterminateIcon : context.checked ? checkedIcon : unchecked;
|
|
97
|
+
if (!icon || !isValidElement(icon)) return null;
|
|
98
|
+
return <InternalIcon icon={icon} className={clsx(iconClassName, className)} style={style} deps={[
|
|
99
|
+
context.checked,
|
|
100
|
+
context.indeterminate,
|
|
101
|
+
context.disabled,
|
|
102
|
+
context.pressed,
|
|
103
|
+
checkmarkVariantProps.tone,
|
|
104
|
+
checkmarkVariantProps.variant,
|
|
105
|
+
checkmarkVariantProps.size
|
|
106
|
+
]} />;
|
|
103
107
|
}
|
|
104
108
|
CheckboxIndicator.displayName = "CheckboxIndicator";
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
var CheckboxLabel = React.forwardRef((props, ref) => {
|
|
110
|
+
const { children, className, ...nativeProps } = props;
|
|
111
|
+
const context = useCheckboxContext("CheckboxLabel");
|
|
112
|
+
const labelClassName = checkbox({
|
|
113
|
+
...context.checkboxVariantProps,
|
|
114
|
+
disabled: context.disabled
|
|
115
|
+
}).label;
|
|
116
|
+
return <text {...ref ? { ref } : {}} className={clsx(labelClassName, className)} {...nativeProps}>
|
|
110
117
|
{children}
|
|
111
|
-
</text
|
|
118
|
+
</text>;
|
|
112
119
|
});
|
|
113
120
|
CheckboxLabel.displayName = "CheckboxLabel";
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
var CheckboxGroup = React.forwardRef((props, ref) => {
|
|
122
|
+
const { children, className, ...nativeProps } = props;
|
|
123
|
+
const classes = checkboxGroup();
|
|
124
|
+
return <view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
|
|
118
125
|
{children}
|
|
119
|
-
</view
|
|
126
|
+
</view>;
|
|
120
127
|
});
|
|
121
128
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
129
|
+
//#endregion
|
|
130
|
+
export { CheckboxControl, CheckboxGroup, CheckboxIndicator, CheckboxLabel, CheckboxRoot };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CheckboxControl as Control, CheckboxGroup as Group, CheckboxIndicator as Indicator, CheckboxLabel as Label, CheckboxRoot as Root, type CheckboxControlProps as ControlProps, type CheckboxGroupProps as GroupProps, type CheckboxIndicatorProps as IndicatorProps, type CheckboxLabelProps as LabelProps, type CheckboxRootProps as RootProps, } from
|
|
1
|
+
export { CheckboxControl as Control, CheckboxGroup as Group, CheckboxIndicator as Indicator, CheckboxLabel as Label, CheckboxRoot as Root, type CheckboxControlProps as ControlProps, type CheckboxGroupProps as GroupProps, type CheckboxIndicatorProps as IndicatorProps, type CheckboxLabelProps as LabelProps, type CheckboxRootProps as RootProps, } from './Checkbox';
|
|
2
2
|
//# sourceMappingURL=Checkbox.namespace.d.ts.map
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { CheckboxControl, CheckboxGroup, CheckboxIndicator, CheckboxLabel, CheckboxRoot } from "./Checkbox.jsx";
|
|
3
|
+
//#region src/components/Checkbox/Checkbox.namespace.ts
|
|
4
|
+
var Checkbox_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Control: () => CheckboxControl,
|
|
6
|
+
Group: () => CheckboxGroup,
|
|
7
|
+
Indicator: () => CheckboxIndicator,
|
|
8
|
+
Label: () => CheckboxLabel,
|
|
9
|
+
Root: () => CheckboxRoot
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Checkbox_namespace_exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CheckboxRoot, CheckboxControl, CheckboxIndicator, CheckboxLabel, CheckboxGroup, type CheckboxRootProps, type CheckboxControlProps, type CheckboxIndicatorProps, type CheckboxLabelProps, type CheckboxGroupProps, } from
|
|
2
|
-
export * as Checkbox from
|
|
1
|
+
export { CheckboxRoot, CheckboxControl, CheckboxIndicator, CheckboxLabel, CheckboxGroup, type CheckboxRootProps, type CheckboxControlProps, type CheckboxIndicatorProps, type CheckboxLabelProps, type CheckboxGroupProps, } from './Checkbox';
|
|
2
|
+
export * as Checkbox from './Checkbox.namespace';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DependencyList, ReactElement } from '@lynx-js/react';
|
|
2
|
+
import { LynxIconElementProps, LynxStyledElementProps } from '../../types';
|
|
3
|
+
import { StyleProps } from '../../utils/styled';
|
|
4
|
+
import * as React from "@lynx-js/react";
|
|
5
|
+
export type IconSlotName = "icon" | "prefixIcon" | "suffixIcon";
|
|
6
|
+
interface IconSlotContextValue {
|
|
7
|
+
classNames?: Partial<Record<IconSlotName, string>>;
|
|
8
|
+
deps?: DependencyList;
|
|
9
|
+
}
|
|
10
|
+
export declare function IconRequired({ children, enabled, }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
export declare function IconSlotProvider({ value, children, }: {
|
|
15
|
+
value: IconSlotContextValue;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
export declare function getIconSlotName(node: React.ReactNode): IconSlotName | null;
|
|
19
|
+
export interface IconProps extends LynxStyledElementProps {
|
|
20
|
+
icon: ReactElement<LynxIconElementProps>;
|
|
21
|
+
size?: StyleProps["height"] | number;
|
|
22
|
+
color?: StyleProps["color"];
|
|
23
|
+
}
|
|
24
|
+
export interface PrefixIconProps extends IconProps {
|
|
25
|
+
}
|
|
26
|
+
export interface SuffixIconProps extends IconProps {
|
|
27
|
+
}
|
|
28
|
+
export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<unknown>>;
|
|
29
|
+
export declare const PrefixIcon: React.ForwardRefExoticComponent<PrefixIconProps & React.RefAttributes<unknown>>;
|
|
30
|
+
export declare const SuffixIcon: React.ForwardRefExoticComponent<SuffixIconProps & React.RefAttributes<unknown>>;
|
|
31
|
+
export interface InternalIconProps extends LynxStyledElementProps {
|
|
32
|
+
icon: ReactElement<LynxIconElementProps>;
|
|
33
|
+
deps?: DependencyList;
|
|
34
|
+
}
|
|
35
|
+
export declare const InternalIcon: React.ForwardRefExoticComponent<InternalIconProps & React.RefAttributes<unknown>>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AAIhE,UAAU,oBAAoB;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAWD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,qBAyCA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,oBAAoB,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAEA;AAUD,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,YAAY,GAAG,IAAI,CAI1E;AAID,MAAM,WAAW,SAAU,SAAQ,sBAAsB;IACvD,IAAI,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IACrC,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;CAAG;AAErD,MAAM,WAAW,eAAgB,SAAQ,SAAS;CAAG;AAqGrD,eAAO,MAAM,IAAI,2EAA8D,CAAC;AAChF,eAAO,MAAM,UAAU,iFAItB,CAAC;AACF,eAAO,MAAM,UAAU,iFAItB,CAAC;AAIF,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;IAC/D,IAAI,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,mFA2BvB,CAAC"}
|
|
@@ -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 @@
|
|
|
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"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { ProgressCircleVariantProps } from '@seed-design/lynx-css/recipes/progress-circle';
|
|
2
|
+
import { LynxStyledElementProps } from '../../types';
|
|
1
3
|
import type * as React from "@lynx-js/react";
|
|
2
|
-
|
|
3
|
-
export interface ProgressCircleRootProps extends ProgressCircleVariantProps {
|
|
4
|
+
export interface ProgressCircleRootProps extends ProgressCircleVariantProps, LynxStyledElementProps {
|
|
4
5
|
minValue?: number;
|
|
5
6
|
maxValue?: number;
|
|
6
7
|
value?: number;
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
className?: string;
|
|
9
8
|
}
|
|
10
9
|
export type RootProps = ProgressCircleRootProps;
|
|
11
10
|
/**
|
|
@@ -18,10 +17,7 @@ export type RootProps = ProgressCircleRootProps;
|
|
|
18
17
|
*
|
|
19
18
|
* Lynx SVG + stroke-dasharray 지원 시 CSS-only 애니메이션으로 전환 예정.
|
|
20
19
|
*/
|
|
21
|
-
export declare const ProgressCircleRoot:
|
|
22
|
-
(props: ProgressCircleRootProps): React.JSX.Element;
|
|
23
|
-
displayName: string;
|
|
24
|
-
};
|
|
20
|
+
export declare const ProgressCircleRoot: React.ForwardRefExoticComponent<ProgressCircleRootProps & React.RefAttributes<unknown>>;
|
|
25
21
|
export declare const ProgressCircleRange: {
|
|
26
22
|
(): React.JSX.Element;
|
|
27
23
|
displayName: string;
|
|
@@ -1 +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;
|
|
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"}
|