@seed-design/lynx-react 0.4.0 → 0.5.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/components/Accordion/Accordion.d.ts +56 -0
- package/lib/components/Accordion/Accordion.d.ts.map +1 -0
- package/lib/components/Accordion/Accordion.jsx +210 -0
- package/lib/components/Accordion/Accordion.namespace.d.ts +2 -0
- package/lib/components/Accordion/Accordion.namespace.d.ts.map +1 -0
- package/lib/components/Accordion/Accordion.namespace.js +17 -0
- package/lib/components/Accordion/index.d.ts +3 -0
- package/lib/components/Accordion/index.d.ts.map +1 -0
- package/lib/components/ActionButton/ActionButton.jsx +6 -6
- package/lib/components/AppBar/AppBar.jsx +1 -1
- package/lib/components/Badge/Badge.jsx +1 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +6 -3
- package/lib/components/Box/Box.jsx +1 -1
- package/lib/components/Callout/Callout.d.ts +32 -0
- package/lib/components/Callout/Callout.d.ts.map +1 -0
- package/lib/components/Callout/Callout.jsx +113 -0
- package/lib/components/Callout/Callout.namespace.d.ts +2 -0
- package/lib/components/Callout/Callout.namespace.d.ts.map +1 -0
- package/lib/components/Callout/Callout.namespace.js +13 -0
- package/lib/components/Callout/index.d.ts +3 -0
- package/lib/components/Callout/index.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.jsx +36 -5
- package/lib/components/Chip/Chip.d.ts +66 -0
- package/lib/components/Chip/Chip.d.ts.map +1 -0
- package/lib/components/Chip/Chip.jsx +159 -0
- package/lib/components/Chip/Chip.namespace.d.ts +2 -0
- package/lib/components/Chip/Chip.namespace.d.ts.map +1 -0
- package/lib/components/Chip/Chip.namespace.js +16 -0
- package/lib/components/Chip/index.d.ts +3 -0
- package/lib/components/Chip/index.d.ts.map +1 -0
- package/lib/components/Divider/Divider.d.ts +31 -0
- package/lib/components/Divider/Divider.d.ts.map +1 -0
- package/lib/components/Divider/Divider.jsx +26 -0
- package/lib/components/Divider/index.d.ts +2 -0
- package/lib/components/Divider/index.d.ts.map +1 -0
- package/lib/components/Field/Field.jsx +1 -1
- package/lib/components/Icon/Icon.jsx +2 -2
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.jsx +38 -7
- package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- package/lib/components/Stack/Stack.jsx +11 -2
- package/lib/components/Switch/Switch.jsx +2 -2
- package/lib/components/Tabs/Tabs.d.ts +59 -0
- package/lib/components/Tabs/Tabs.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.jsx +406 -0
- package/lib/components/Tabs/Tabs.namespace.d.ts +2 -0
- package/lib/components/Tabs/Tabs.namespace.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.namespace.js +14 -0
- package/lib/components/Tabs/index.d.ts +3 -0
- package/lib/components/Tabs/index.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.d.ts +2 -1
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.jsx +4 -3
- package/lib/components/Text/Text.jsx +2 -2
- package/lib/components/TextField/TextField.d.ts +20 -2
- package/lib/components/TextField/TextField.d.ts.map +1 -1
- package/lib/components/TextField/TextField.jsx +25 -9
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/useIconColor.d.ts +2 -1
- package/lib/hooks/useIconColor.d.ts.map +1 -1
- package/lib/hooks/useIconColor.js +29 -5
- package/lib/hooks/usePressTap.d.ts.map +1 -1
- package/lib/hooks/usePressTap.js +1 -0
- package/lib/index.js +14 -5
- package/lib/utils/create-slot-recipe-context.jsx +1 -1
- package/package.json +3 -3
- package/src/components/Accordion/Accordion.namespace.ts +22 -0
- package/src/components/Accordion/Accordion.test.tsx +129 -0
- package/src/components/Accordion/Accordion.tsx +453 -0
- package/src/components/Accordion/index.ts +24 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +24 -0
- package/src/components/BottomSheet/BottomSheet.tsx +14 -2
- package/src/components/Callout/Callout.namespace.ts +14 -0
- package/src/components/Callout/Callout.test.tsx +188 -0
- package/src/components/Callout/Callout.tsx +272 -0
- package/src/components/Callout/index.ts +16 -0
- package/src/components/Checkbox/Checkbox.test.tsx +176 -0
- package/src/components/Checkbox/Checkbox.tsx +36 -2
- package/src/components/Chip/Chip.namespace.ts +20 -0
- package/src/components/Chip/Chip.test.tsx +113 -0
- package/src/components/Chip/Chip.tsx +373 -0
- package/src/components/Chip/index.ts +22 -0
- package/src/components/Divider/Divider.test.tsx +73 -0
- package/src/components/Divider/Divider.tsx +76 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Icon/Icon.test.tsx +129 -0
- package/src/components/ProgressCircle/ProgressCircle.test.tsx +58 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +42 -5
- package/src/components/Stack/Stack.test.tsx +67 -0
- package/src/components/Stack/Stack.tsx +15 -1
- package/src/components/Tabs/Tabs.namespace.ts +16 -0
- package/src/components/Tabs/Tabs.test.tsx +181 -0
- package/src/components/Tabs/Tabs.tsx +706 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/TagGroup/TagGroup.test.tsx +73 -0
- package/src/components/TagGroup/TagGroup.tsx +4 -2
- package/src/components/TextField/TextField.test.tsx +163 -35
- package/src/components/TextField/TextField.tsx +61 -19
- package/src/components/index.ts +5 -0
- package/src/hooks/useIconColor.ts +43 -5
- package/src/hooks/usePressTap.test.ts +13 -0
- package/src/hooks/usePressTap.ts +1 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
1
2
|
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
2
3
|
import { InternalIcon } from "../Icon/Icon.jsx";
|
|
3
|
-
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
4
4
|
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
5
|
-
import clsx from "clsx";
|
|
6
5
|
import * as React from "@lynx-js/react";
|
|
7
6
|
import { isValidElement } from "@lynx-js/react";
|
|
7
|
+
import clsx from "clsx";
|
|
8
8
|
import { checkbox } from "@seed-design/lynx-css/recipes/checkbox";
|
|
9
9
|
import { checkmark } from "@seed-design/lynx-css/recipes/checkmark";
|
|
10
10
|
import { checkboxGroup } from "@seed-design/lynx-css/recipes/checkbox-group";
|
|
@@ -33,10 +33,25 @@ var CheckboxRoot = React.forwardRef((props, ref) => {
|
|
|
33
33
|
onChange: onCheckedChange
|
|
34
34
|
});
|
|
35
35
|
const toggle = React.useCallback(() => setChecked(!checked), [checked, setChecked]);
|
|
36
|
-
const
|
|
36
|
+
const pressSelectionRef = React.useRef({
|
|
37
|
+
checked,
|
|
38
|
+
indeterminate
|
|
39
|
+
});
|
|
40
|
+
const { pressed, bindtouchstart, ...pressHandlers } = usePressTap({
|
|
37
41
|
disabled,
|
|
38
42
|
onTap: toggle
|
|
39
43
|
});
|
|
44
|
+
const handleTouchStart = React.useCallback((...args) => {
|
|
45
|
+
pressSelectionRef.current = {
|
|
46
|
+
checked,
|
|
47
|
+
indeterminate
|
|
48
|
+
};
|
|
49
|
+
bindtouchstart(...args);
|
|
50
|
+
}, [
|
|
51
|
+
bindtouchstart,
|
|
52
|
+
checked,
|
|
53
|
+
indeterminate
|
|
54
|
+
]);
|
|
40
55
|
const rootClassName = checkbox({
|
|
41
56
|
...checkboxVariantProps,
|
|
42
57
|
disabled
|
|
@@ -46,6 +61,8 @@ var CheckboxRoot = React.forwardRef((props, ref) => {
|
|
|
46
61
|
indeterminate,
|
|
47
62
|
disabled,
|
|
48
63
|
pressed,
|
|
64
|
+
pressStartChecked: pressSelectionRef.current.checked,
|
|
65
|
+
pressStartIndeterminate: pressSelectionRef.current.indeterminate,
|
|
49
66
|
checkboxVariantProps,
|
|
50
67
|
checkmarkVariantProps,
|
|
51
68
|
toggle
|
|
@@ -59,7 +76,7 @@ var CheckboxRoot = React.forwardRef((props, ref) => {
|
|
|
59
76
|
toggle
|
|
60
77
|
]);
|
|
61
78
|
return <CheckboxContext.Provider value={contextValue}>
|
|
62
|
-
<view {...ref ? { ref } : {}} className={clsx(rootClassName, className)} {...pressHandlers} {...nativeProps}>
|
|
79
|
+
<view {...ref ? { ref } : {}} className={clsx(rootClassName, className)} bindtouchstart={handleTouchStart} {...pressHandlers} {...nativeProps}>
|
|
63
80
|
{children}
|
|
64
81
|
</view>
|
|
65
82
|
</CheckboxContext.Provider>;
|
|
@@ -78,11 +95,25 @@ var CheckboxControl = React.forwardRef((props, ref) => {
|
|
|
78
95
|
pressed: context.pressed
|
|
79
96
|
};
|
|
80
97
|
const classes = checkmark(checkmarkVariantProps);
|
|
98
|
+
const pressStartClasses = checkmark({
|
|
99
|
+
...checkmarkVariantProps,
|
|
100
|
+
checked: context.pressStartChecked,
|
|
101
|
+
indeterminate: context.pressStartIndeterminate,
|
|
102
|
+
pressed: context.pressed
|
|
103
|
+
});
|
|
104
|
+
const isGhost = checkmarkVariantProps.variant === "ghost";
|
|
105
|
+
const rootClassName = isGhost ? checkmark({
|
|
106
|
+
...checkmarkVariantProps,
|
|
107
|
+
checked: false,
|
|
108
|
+
indeterminate: false,
|
|
109
|
+
pressed: false
|
|
110
|
+
}).root : classes.root;
|
|
81
111
|
return <CheckmarkControlContext.Provider value={{
|
|
82
112
|
iconClassName: classes.icon,
|
|
83
113
|
checkmarkVariantProps
|
|
84
114
|
}}>
|
|
85
|
-
<view {...ref ? { ref } : {}} className={clsx(
|
|
115
|
+
<view {...ref ? { ref } : {}} className={clsx(rootClassName, className)} {...nativeProps}>
|
|
116
|
+
{isGhost ? <view className={pressStartClasses.background} /> : null}
|
|
86
117
|
{children}
|
|
87
118
|
</view>
|
|
88
119
|
</CheckmarkControlContext.Provider>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ChipVariantProps } from '@seed-design/lynx-css/recipes/chip';
|
|
2
|
+
import { LynxAccessibilityProps, LynxPressableProps, LynxStyledElementProps } from '../../types';
|
|
3
|
+
import { PrefixIconProps, SuffixIconProps } from '../Icon/Icon';
|
|
4
|
+
import * as React from "@lynx-js/react";
|
|
5
|
+
type ChipPublicVariantProps = Omit<ChipVariantProps, "selected" | "pressed">;
|
|
6
|
+
/**
|
|
7
|
+
* @platform Lynx
|
|
8
|
+
*
|
|
9
|
+
* 웹 대비 미지원 기능:
|
|
10
|
+
* - HTML button 속성 및 native form 제출
|
|
11
|
+
* - 키보드 focus / focusVisible
|
|
12
|
+
* - `asChild`
|
|
13
|
+
*/
|
|
14
|
+
export interface ChipButtonProps extends ChipPublicVariantProps, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const ChipButton: React.ForwardRefExoticComponent<ChipButtonProps & React.RefAttributes<unknown>>;
|
|
18
|
+
/** React `Chip.Root`에 대응하는 기본 action chip입니다. */
|
|
19
|
+
export interface ChipRootProps extends ChipButtonProps {
|
|
20
|
+
}
|
|
21
|
+
export declare const ChipRoot: React.ForwardRefExoticComponent<ChipRootProps & React.RefAttributes<unknown>>;
|
|
22
|
+
/**
|
|
23
|
+
* @platform Lynx
|
|
24
|
+
*
|
|
25
|
+
* 웹 대비 미지원 기능:
|
|
26
|
+
* - HiddenInput / inputProps / name / value: Lynx에 HTML form 제출 모델이 없음
|
|
27
|
+
* - raw DOM `onChange`: `onCheckedChange`로 대체
|
|
28
|
+
*/
|
|
29
|
+
export interface ChipToggleProps extends ChipButtonProps {
|
|
30
|
+
checked?: boolean;
|
|
31
|
+
defaultChecked?: boolean;
|
|
32
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare const ChipToggle: React.ForwardRefExoticComponent<ChipToggleProps & React.RefAttributes<unknown>>;
|
|
35
|
+
export interface ChipRadioRootProps extends LynxStyledElementProps {
|
|
36
|
+
value?: string;
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
onValueChange?: (value: string) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare const ChipRadioRoot: React.ForwardRefExoticComponent<ChipRadioRootProps & React.RefAttributes<unknown>>;
|
|
42
|
+
/**
|
|
43
|
+
* @platform Lynx
|
|
44
|
+
*
|
|
45
|
+
* 웹 대비 미지원 기능:
|
|
46
|
+
* - HiddenInput / inputProps / name / required: Lynx에 HTML form 제출 모델이 없음
|
|
47
|
+
* - raw DOM `onChange`: `Chip.RadioRoot`의 `onValueChange`로 대체
|
|
48
|
+
*/
|
|
49
|
+
export interface ChipRadioItemProps extends ChipButtonProps {
|
|
50
|
+
value: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const ChipRadioItem: React.ForwardRefExoticComponent<ChipRadioItemProps & React.RefAttributes<unknown>>;
|
|
53
|
+
export interface ChipLabelProps extends LynxStyledElementProps {
|
|
54
|
+
}
|
|
55
|
+
export declare const ChipLabel: React.ForwardRefExoticComponent<ChipLabelProps & React.RefAttributes<unknown>>;
|
|
56
|
+
export interface ChipPrefixIconProps extends PrefixIconProps {
|
|
57
|
+
}
|
|
58
|
+
export declare const ChipPrefixIcon: React.ForwardRefExoticComponent<ChipPrefixIconProps & React.RefAttributes<unknown>>;
|
|
59
|
+
export interface ChipPrefixAvatarProps extends LynxStyledElementProps {
|
|
60
|
+
}
|
|
61
|
+
export declare const ChipPrefixAvatar: React.ForwardRefExoticComponent<ChipPrefixAvatarProps & React.RefAttributes<unknown>>;
|
|
62
|
+
export interface ChipSuffixIconProps extends SuffixIconProps {
|
|
63
|
+
}
|
|
64
|
+
export declare const ChipSuffixIcon: React.ForwardRefExoticComponent<ChipSuffixIconProps & React.RefAttributes<unknown>>;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAQ,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAIjF,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAItB,KAAK,sBAAsB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;AA6D7E;;;;;;;GAOG;AACH,MAAM,WAAW,eACf,SAAQ,sBAAsB,EAC5B,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,iFA2BrB,CAAC;AAGH,iDAAiD;AACjD,MAAM,WAAW,aAAc,SAAQ,eAAe;CAAG;AAEzD,eAAO,MAAM,QAAQ,+EAEnB,CAAC;AAKH;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,UAAU,iFA4CrB,CAAC;AAqBH,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,aAAa,oFAqCxB,CAAC;AAGH;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,aAAa,oFAwCxB,CAAC;AAKH,MAAM,WAAW,cAAe,SAAQ,sBAAsB;CAAG;AAEjE,eAAO,MAAM,SAAS,gFAapB,CAAC;AAGH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;CAAG;AAE/D,eAAO,MAAM,cAAc,qFAEzB,CAAC;AAGH,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB;CAAG;AAExE,eAAO,MAAM,gBAAgB,uFAa3B,CAAC;AAGH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;CAAG;AAE/D,eAAO,MAAM,cAAc,qFAEzB,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
4
|
+
import { IconRequired, IconSlotProvider, PrefixIcon, SuffixIcon } from "../Icon/Icon.jsx";
|
|
5
|
+
import * as React from "@lynx-js/react";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { chip } from "@seed-design/lynx-css/recipes/chip";
|
|
8
|
+
//#region src/components/Chip/Chip.tsx
|
|
9
|
+
var { ClassNamesProvider, useClassNames } = createSlotRecipeContext(chip);
|
|
10
|
+
var ChipRootView = React.forwardRef((props, ref) => {
|
|
11
|
+
const [variantProps, otherProps] = chip.splitVariantProps(props);
|
|
12
|
+
const classes = chip(variantProps);
|
|
13
|
+
const { children, className, ...nativeProps } = otherProps;
|
|
14
|
+
const iconSlotContextValue = React.useMemo(() => ({
|
|
15
|
+
classNames: {
|
|
16
|
+
icon: classes.icon,
|
|
17
|
+
prefixIcon: classes.prefixIcon,
|
|
18
|
+
suffixIcon: classes.suffixIcon
|
|
19
|
+
},
|
|
20
|
+
deps: [
|
|
21
|
+
variantProps.variant,
|
|
22
|
+
variantProps.size,
|
|
23
|
+
variantProps.layout,
|
|
24
|
+
variantProps.selected,
|
|
25
|
+
variantProps.pressed,
|
|
26
|
+
variantProps.disabled
|
|
27
|
+
]
|
|
28
|
+
}), [
|
|
29
|
+
classes.icon,
|
|
30
|
+
classes.prefixIcon,
|
|
31
|
+
classes.suffixIcon,
|
|
32
|
+
variantProps.variant,
|
|
33
|
+
variantProps.size,
|
|
34
|
+
variantProps.layout,
|
|
35
|
+
variantProps.selected,
|
|
36
|
+
variantProps.pressed,
|
|
37
|
+
variantProps.disabled
|
|
38
|
+
]);
|
|
39
|
+
return <ClassNamesProvider value={classes}>
|
|
40
|
+
<IconSlotProvider value={iconSlotContextValue}>
|
|
41
|
+
<IconRequired enabled={variantProps.layout === "iconOnly"}>
|
|
42
|
+
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
|
|
43
|
+
{children}
|
|
44
|
+
</view>
|
|
45
|
+
</IconRequired>
|
|
46
|
+
</IconSlotProvider>
|
|
47
|
+
</ClassNamesProvider>;
|
|
48
|
+
});
|
|
49
|
+
ChipRootView.displayName = "ChipRootView";
|
|
50
|
+
var ChipButton = React.forwardRef((props, ref) => {
|
|
51
|
+
const { bindtap, "main-thread:bindtap": mainThreadBindtap, disabled = false, "accessibility-element": accessibilityElement = true, "accessibility-traits": accessibilityTraits, ...restProps } = props;
|
|
52
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
53
|
+
disabled,
|
|
54
|
+
onTap: bindtap,
|
|
55
|
+
mainThreadOnTap: mainThreadBindtap
|
|
56
|
+
});
|
|
57
|
+
return <ChipRootView ref={ref} {...restProps} disabled={disabled} selected={false} pressed={pressed} accessibility-element={accessibilityElement} accessibility-traits={disabled ? "disabled" : accessibilityTraits ?? "button"} {...pressHandlers} />;
|
|
58
|
+
});
|
|
59
|
+
ChipButton.displayName = "ChipButton";
|
|
60
|
+
var ChipRoot = React.forwardRef((props, ref) => <ChipButton ref={ref} {...props} />);
|
|
61
|
+
ChipRoot.displayName = "ChipRoot";
|
|
62
|
+
var ChipToggle = React.forwardRef((props, ref) => {
|
|
63
|
+
const { checked: checkedProp, defaultChecked = false, onCheckedChange, bindtap, "main-thread:bindtap": mainThreadBindtap, disabled = false, "accessibility-element": accessibilityElement = true, "accessibility-traits": accessibilityTraits, ...restProps } = props;
|
|
64
|
+
const [checked, setChecked] = useControllableState({
|
|
65
|
+
value: checkedProp,
|
|
66
|
+
defaultValue: defaultChecked,
|
|
67
|
+
onChange: onCheckedChange
|
|
68
|
+
});
|
|
69
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
70
|
+
disabled,
|
|
71
|
+
onTap: React.useCallback((...args) => {
|
|
72
|
+
setChecked(!checked);
|
|
73
|
+
bindtap?.(...args);
|
|
74
|
+
}, [
|
|
75
|
+
bindtap,
|
|
76
|
+
checked,
|
|
77
|
+
setChecked
|
|
78
|
+
]),
|
|
79
|
+
mainThreadOnTap: mainThreadBindtap
|
|
80
|
+
});
|
|
81
|
+
return <ChipRootView ref={ref} {...restProps} disabled={disabled} selected={checked} pressed={pressed} accessibility-element={accessibilityElement} accessibility-traits={disabled ? "disabled" : checked ? "selected" : accessibilityTraits ?? "button"} {...pressHandlers} />;
|
|
82
|
+
});
|
|
83
|
+
ChipToggle.displayName = "ChipToggle";
|
|
84
|
+
var ChipRadioGroupContext = React.createContext(null);
|
|
85
|
+
function useChipRadioGroupContext(consumer) {
|
|
86
|
+
const context = React.useContext(ChipRadioGroupContext);
|
|
87
|
+
if (!context) throw new Error(`<${consumer}/> must be rendered inside <ChipRadioRoot/>.`);
|
|
88
|
+
return context;
|
|
89
|
+
}
|
|
90
|
+
var ChipRadioRoot = React.forwardRef((props, ref) => {
|
|
91
|
+
const { value: valueProp, defaultValue, disabled = false, onValueChange, children, className, ...nativeProps } = props;
|
|
92
|
+
const handleChange = React.useCallback((nextValue) => {
|
|
93
|
+
if (nextValue !== null) onValueChange?.(nextValue);
|
|
94
|
+
}, [onValueChange]);
|
|
95
|
+
const [value, setValueInternal] = useControllableState({
|
|
96
|
+
value: valueProp !== void 0 ? valueProp : void 0,
|
|
97
|
+
defaultValue: defaultValue ?? null,
|
|
98
|
+
onChange: handleChange
|
|
99
|
+
});
|
|
100
|
+
const setValue = React.useCallback((nextValue) => setValueInternal(nextValue), [setValueInternal]);
|
|
101
|
+
const contextValue = React.useMemo(() => ({
|
|
102
|
+
value,
|
|
103
|
+
setValue,
|
|
104
|
+
disabled
|
|
105
|
+
}), [
|
|
106
|
+
value,
|
|
107
|
+
setValue,
|
|
108
|
+
disabled
|
|
109
|
+
]);
|
|
110
|
+
return <ChipRadioGroupContext.Provider value={contextValue}>
|
|
111
|
+
<view {...ref ? { ref } : {}} className={className} {...nativeProps}>
|
|
112
|
+
{children}
|
|
113
|
+
</view>
|
|
114
|
+
</ChipRadioGroupContext.Provider>;
|
|
115
|
+
});
|
|
116
|
+
ChipRadioRoot.displayName = "ChipRadioRoot";
|
|
117
|
+
var ChipRadioItem = React.forwardRef((props, ref) => {
|
|
118
|
+
const { value: itemValue, disabled: itemDisabled = false, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-traits": accessibilityTraits, ...restProps } = props;
|
|
119
|
+
const group = useChipRadioGroupContext("ChipRadioItem");
|
|
120
|
+
const disabled = group.disabled || itemDisabled;
|
|
121
|
+
const selected = group.value === itemValue;
|
|
122
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
123
|
+
disabled,
|
|
124
|
+
onTap: React.useCallback((...args) => {
|
|
125
|
+
if (!selected) group.setValue(itemValue);
|
|
126
|
+
bindtap?.(...args);
|
|
127
|
+
}, [
|
|
128
|
+
bindtap,
|
|
129
|
+
group,
|
|
130
|
+
itemValue,
|
|
131
|
+
selected
|
|
132
|
+
]),
|
|
133
|
+
mainThreadOnTap: mainThreadBindtap
|
|
134
|
+
});
|
|
135
|
+
return <ChipRootView ref={ref} {...restProps} disabled={disabled} selected={selected} pressed={pressed} accessibility-element={accessibilityElement} accessibility-traits={disabled ? "disabled" : selected ? "selected" : accessibilityTraits ?? "button"} {...pressHandlers} />;
|
|
136
|
+
});
|
|
137
|
+
ChipRadioItem.displayName = "ChipRadioItem";
|
|
138
|
+
var ChipLabel = React.forwardRef((props, ref) => {
|
|
139
|
+
const classes = useClassNames();
|
|
140
|
+
const { children, className, ...nativeProps } = props;
|
|
141
|
+
return <text {...ref ? { ref } : {}} className={clsx(classes.label, className)} {...nativeProps}>
|
|
142
|
+
{children}
|
|
143
|
+
</text>;
|
|
144
|
+
});
|
|
145
|
+
ChipLabel.displayName = "ChipLabel";
|
|
146
|
+
var ChipPrefixIcon = React.forwardRef((props, ref) => <PrefixIcon ref={ref} {...props} />);
|
|
147
|
+
ChipPrefixIcon.displayName = "ChipPrefixIcon";
|
|
148
|
+
var ChipPrefixAvatar = React.forwardRef((props, ref) => {
|
|
149
|
+
const classes = useClassNames();
|
|
150
|
+
const { children, className, ...nativeProps } = props;
|
|
151
|
+
return <view {...ref ? { ref } : {}} className={clsx(classes.prefixAvatar, className)} {...nativeProps}>
|
|
152
|
+
{children}
|
|
153
|
+
</view>;
|
|
154
|
+
});
|
|
155
|
+
ChipPrefixAvatar.displayName = "ChipPrefixAvatar";
|
|
156
|
+
var ChipSuffixIcon = React.forwardRef((props, ref) => <SuffixIcon ref={ref} {...props} />);
|
|
157
|
+
ChipSuffixIcon.displayName = "ChipSuffixIcon";
|
|
158
|
+
//#endregion
|
|
159
|
+
export { ChipButton, ChipLabel, ChipPrefixAvatar, ChipPrefixIcon, ChipRadioItem, ChipRadioRoot, ChipRoot, ChipSuffixIcon, ChipToggle };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ChipButton as Button, ChipLabel as Label, ChipPrefixAvatar as PrefixAvatar, ChipPrefixIcon as PrefixIcon, ChipRadioItem as RadioItem, ChipRadioRoot as RadioRoot, ChipRoot as Root, ChipSuffixIcon as SuffixIcon, ChipToggle as Toggle, type ChipButtonProps as ButtonProps, type ChipLabelProps as LabelProps, type ChipPrefixAvatarProps as PrefixAvatarProps, type ChipPrefixIconProps as PrefixIconProps, type ChipRadioItemProps as RadioItemProps, type ChipRadioRootProps as RadioRootProps, type ChipRootProps as RootProps, type ChipSuffixIconProps as SuffixIconProps, type ChipToggleProps as ToggleProps, } from './Chip';
|
|
2
|
+
//# sourceMappingURL=Chip.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,IAAI,MAAM,EACpB,SAAS,IAAI,KAAK,EAClB,gBAAgB,IAAI,YAAY,EAChC,cAAc,IAAI,UAAU,EAC5B,aAAa,IAAI,SAAS,EAC1B,aAAa,IAAI,SAAS,EAC1B,QAAQ,IAAI,IAAI,EAChB,cAAc,IAAI,UAAU,EAC5B,UAAU,IAAI,MAAM,EACpB,KAAK,eAAe,IAAI,WAAW,EACnC,KAAK,cAAc,IAAI,UAAU,EACjC,KAAK,qBAAqB,IAAI,iBAAiB,EAC/C,KAAK,mBAAmB,IAAI,eAAe,EAC3C,KAAK,kBAAkB,IAAI,cAAc,EACzC,KAAK,kBAAkB,IAAI,cAAc,EACzC,KAAK,aAAa,IAAI,SAAS,EAC/B,KAAK,mBAAmB,IAAI,eAAe,EAC3C,KAAK,eAAe,IAAI,WAAW,GACpC,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { ChipButton, ChipLabel, ChipPrefixAvatar, ChipPrefixIcon, ChipRadioItem, ChipRadioRoot, ChipRoot, ChipSuffixIcon, ChipToggle } from "./Chip.jsx";
|
|
3
|
+
//#region src/components/Chip/Chip.namespace.ts
|
|
4
|
+
var Chip_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Button: () => ChipButton,
|
|
6
|
+
Label: () => ChipLabel,
|
|
7
|
+
PrefixAvatar: () => ChipPrefixAvatar,
|
|
8
|
+
PrefixIcon: () => ChipPrefixIcon,
|
|
9
|
+
RadioItem: () => ChipRadioItem,
|
|
10
|
+
RadioRoot: () => ChipRadioRoot,
|
|
11
|
+
Root: () => ChipRoot,
|
|
12
|
+
SuffixIcon: () => ChipSuffixIcon,
|
|
13
|
+
Toggle: () => ChipToggle
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Chip_namespace_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ChipButton, ChipLabel, ChipPrefixAvatar, ChipPrefixIcon, ChipRadioItem, ChipRadioRoot, ChipRoot, ChipSuffixIcon, ChipToggle, type ChipButtonProps, type ChipLabelProps, type ChipPrefixAvatarProps, type ChipPrefixIconProps, type ChipRadioItemProps, type ChipRadioRootProps, type ChipRootProps, type ChipSuffixIconProps, type ChipToggleProps, } from './Chip';
|
|
2
|
+
export * as Chip from './Chip.namespace';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LynxAccessibilityProps, LynxStyledElementProps } from '../../types';
|
|
2
|
+
import { StyleProps } from '../../utils/styled';
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
export interface DividerProps extends Omit<LynxStyledElementProps, "children">, LynxAccessibilityProps {
|
|
5
|
+
/**
|
|
6
|
+
* @default "stroke.neutralMuted"
|
|
7
|
+
*/
|
|
8
|
+
color?: StyleProps["borderColor"];
|
|
9
|
+
/**
|
|
10
|
+
* @default 1
|
|
11
|
+
*/
|
|
12
|
+
thickness?: StyleProps["borderWidth"];
|
|
13
|
+
/**
|
|
14
|
+
* @default "horizontal"
|
|
15
|
+
*/
|
|
16
|
+
orientation?: "horizontal" | "vertical";
|
|
17
|
+
/**
|
|
18
|
+
* Adds 16px of spacing to both ends of the divider.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
inset?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @platform Lynx
|
|
25
|
+
*
|
|
26
|
+
* 웹의 `<hr>` 대신 native `<view>`를 렌더링합니다. 구분선은 기본적으로 접근성
|
|
27
|
+
* 요소로 노출되며 `accessibility-role-description="separator"`를 사용합니다.
|
|
28
|
+
* 장식용 구분선은 `accessibility-element={false}`로 접근성 트리에서 제외하세요.
|
|
29
|
+
*/
|
|
30
|
+
export declare const Divider: React.ForwardRefExoticComponent<DividerProps & React.RefAttributes<unknown>>;
|
|
31
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../src/components/Divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,EAC9C,sBAAsB;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IAElC;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IAEtC;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAExC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,8EAmClB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box } from "../Box/Box.jsx";
|
|
2
|
+
import * as React from "@lynx-js/react";
|
|
3
|
+
//#region src/components/Divider/Divider.tsx
|
|
4
|
+
/**
|
|
5
|
+
* @platform Lynx
|
|
6
|
+
*
|
|
7
|
+
* 웹의 `<hr>` 대신 native `<view>`를 렌더링합니다. 구분선은 기본적으로 접근성
|
|
8
|
+
* 요소로 노출되며 `accessibility-role-description="separator"`를 사용합니다.
|
|
9
|
+
* 장식용 구분선은 `accessibility-element={false}`로 접근성 트리에서 제외하세요.
|
|
10
|
+
*/
|
|
11
|
+
var Divider = React.forwardRef((props, ref) => {
|
|
12
|
+
const { color = "stroke.neutralMuted", thickness = 1, orientation = "horizontal", inset = false, style, "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "separator", ...nativeProps } = props;
|
|
13
|
+
const isHorizontal = orientation === "horizontal";
|
|
14
|
+
return <Box {...nativeProps} ref={ref} borderColor={color} borderWidth={0} borderBottomWidth={isHorizontal ? thickness : 0} borderRightWidth={isHorizontal ? 0 : thickness} accessibility-element={accessibilityElement} accessibility-role-description={accessibilityRoleDescription} style={{
|
|
15
|
+
width: isHorizontal ? inset ? "calc(100% - 32px)" : "100%" : void 0,
|
|
16
|
+
height: isHorizontal ? void 0 : inset ? "calc(100% - 32px)" : "100%",
|
|
17
|
+
marginLeft: inset && isHorizontal ? "16px" : void 0,
|
|
18
|
+
marginRight: inset && isHorizontal ? "16px" : void 0,
|
|
19
|
+
marginTop: inset && !isHorizontal ? "16px" : void 0,
|
|
20
|
+
marginBottom: inset && !isHorizontal ? "16px" : void 0,
|
|
21
|
+
...style
|
|
22
|
+
}} />;
|
|
23
|
+
});
|
|
24
|
+
Divider.displayName = "Divider";
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Divider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Divider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
2
2
|
import { FieldContext, useFieldContext } from "./context.js";
|
|
3
|
-
import clsx from "clsx";
|
|
4
3
|
import * as React from "@lynx-js/react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
5
|
import { field } from "@seed-design/lynx-css/recipes/field";
|
|
6
6
|
import { fieldLabel } from "@seed-design/lynx-css/recipes/field-label";
|
|
7
7
|
//#region src/components/Field/Field.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { handleColor, handleDimension } from "../../utils/styled.js";
|
|
2
1
|
import { useIconColor } from "../../hooks/useIconColor.js";
|
|
3
|
-
import
|
|
2
|
+
import { handleColor, handleDimension } from "../../utils/styled.js";
|
|
4
3
|
import * as React from "@lynx-js/react";
|
|
5
4
|
import { cloneElement, isValidElement, useMainThreadRef } from "@lynx-js/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
6
|
//#region src/components/Icon/Icon.tsx
|
|
7
7
|
var IconSlotContext = React.createContext(null);
|
|
8
8
|
var IconRequiredContext = React.createContext(null);
|
|
@@ -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;AAa7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,aAAa,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;AA2IvE,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { progressCircle } from "@seed-design/lynx-css/recipes/progress-circle";
|
|
2
|
-
import clsx from "clsx";
|
|
3
1
|
import { createContext, forwardRef, runOnMainThread, useContext, useEffect, useMainThreadRef, useMemo } from "@lynx-js/react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { progressCircle } from "@seed-design/lynx-css/recipes/progress-circle";
|
|
4
4
|
//#region src/components/ProgressCircle/ProgressCircle.tsx
|
|
5
5
|
var ProgressCircleContext = createContext(null);
|
|
6
6
|
function useProgressCircleContext() {
|
|
@@ -18,6 +18,34 @@ function computeRingGeometry(numSize) {
|
|
|
18
18
|
capSize: halfSize - innerR
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
+
function bgCubicBezier(rawT, x1, y1, x2, y2) {
|
|
22
|
+
const t = Math.max(0, Math.min(1, rawT));
|
|
23
|
+
const cx = 3 * x1;
|
|
24
|
+
const bx = 3 * (x2 - x1) - cx;
|
|
25
|
+
const ax = 1 - cx - bx;
|
|
26
|
+
let currentT = t;
|
|
27
|
+
for (let i = 0; i < 8; i++) {
|
|
28
|
+
const currentX = ((ax * currentT + bx) * currentT + cx) * currentT - t;
|
|
29
|
+
const currentDx = (3 * ax * currentT + 2 * bx) * currentT + cx;
|
|
30
|
+
if (Math.abs(currentDx) < 1e-6) break;
|
|
31
|
+
currentT = currentT - currentX / currentDx;
|
|
32
|
+
}
|
|
33
|
+
const cy = 3 * y1;
|
|
34
|
+
const by = 3 * (y2 - y1) - cy;
|
|
35
|
+
return (((1 - cy - by) * currentT + by) * currentT + cy) * currentT;
|
|
36
|
+
}
|
|
37
|
+
function bgSampleIndeterminate(t) {
|
|
38
|
+
const containerEased = bgCubicBezier(t, .35, .25, .65, .75);
|
|
39
|
+
const headEased = bgCubicBezier(t, .35, 0, .65, 1);
|
|
40
|
+
const tailEased = bgCubicBezier(t, .35, 0, .65, .6);
|
|
41
|
+
const headLength = headEased <= .75 ? headEased / .75 * 360 : 360;
|
|
42
|
+
const tailOffset = tailEased <= 1 / 3 ? 0 : (tailEased - 1 / 3) / (2 / 3) * 360;
|
|
43
|
+
const arcLength = Math.max(0, headLength - tailOffset);
|
|
44
|
+
return {
|
|
45
|
+
containerDeg: containerEased * 360 + tailOffset,
|
|
46
|
+
arcLength
|
|
47
|
+
};
|
|
48
|
+
}
|
|
21
49
|
function bgPieClipPath(size, angleDeg) {
|
|
22
50
|
if (angleDeg >= 360) return void 0;
|
|
23
51
|
if (angleDeg <= 0) return "path(\"M 0 0 Z\")";
|
|
@@ -72,6 +100,7 @@ function sampleIndeterminate(t) {
|
|
|
72
100
|
};
|
|
73
101
|
}
|
|
74
102
|
var INDETERMINATE_DURATION = 1200;
|
|
103
|
+
var INDETERMINATE_INITIAL_PHASE = 1 / 6;
|
|
75
104
|
var TRANSITION_DURATION = 300;
|
|
76
105
|
/**
|
|
77
106
|
* Lynx에서 SVG를 사용할 수 없어 CSS clip-path 기반 pie sector로 구현.
|
|
@@ -220,7 +249,7 @@ function IndeterminateRange({ numSize, classes }) {
|
|
|
220
249
|
let startTs = 0;
|
|
221
250
|
function tick(ts) {
|
|
222
251
|
if (!startTs) startTs = Number(ts);
|
|
223
|
-
const state = sampleIndeterminate((ts - startTs) % INDETERMINATE_DURATION / INDETERMINATE_DURATION);
|
|
252
|
+
const state = sampleIndeterminate((ts - startTs + INDETERMINATE_DURATION * INDETERMINATE_INITIAL_PHASE) % INDETERMINATE_DURATION / INDETERMINATE_DURATION);
|
|
224
253
|
containerEl?.setStyleProperty("transform", `rotate(${state.containerDeg}deg)`);
|
|
225
254
|
const clipPath = pieClipPath(numSize, state.arcLength);
|
|
226
255
|
if (clipPath) rangeEl?.setStyleProperty("clip-path", clipPath);
|
|
@@ -247,12 +276,14 @@ function IndeterminateRange({ numSize, classes }) {
|
|
|
247
276
|
runOnMainThread(stopLoop)();
|
|
248
277
|
};
|
|
249
278
|
}, [numSize]);
|
|
250
|
-
const
|
|
279
|
+
const initialState = bgSampleIndeterminate(INDETERMINATE_INITIAL_PHASE);
|
|
280
|
+
const initialClipPath = bgPieClipPath(numSize, initialState.arcLength);
|
|
281
|
+
const initialHeadRad = initialState.arcLength * Math.PI / 180;
|
|
251
282
|
return <view main-thread:ref={containerRef} style={{
|
|
252
283
|
position: "absolute",
|
|
253
284
|
width: `${numSize}px`,
|
|
254
285
|
height: `${numSize}px`,
|
|
255
|
-
transform:
|
|
286
|
+
transform: `rotate(${initialState.containerDeg}deg)`
|
|
256
287
|
}}>
|
|
257
288
|
<view main-thread:ref={rangeRef} className={classes.range} style={{
|
|
258
289
|
position: "absolute",
|
|
@@ -270,8 +301,8 @@ function IndeterminateRange({ numSize, classes }) {
|
|
|
270
301
|
<view main-thread:ref={headCapRef} className={classes.cap} style={{
|
|
271
302
|
width: `${capSize}px`,
|
|
272
303
|
height: `${capSize}px`,
|
|
273
|
-
left: `${halfSize - capSize / 2}px`,
|
|
274
|
-
top: `${halfSize - ringCenterR - capSize / 2}px`
|
|
304
|
+
left: `${halfSize + ringCenterR * Math.sin(initialHeadRad) - capSize / 2}px`,
|
|
305
|
+
top: `${halfSize - ringCenterR * Math.cos(initialHeadRad) - capSize / 2}px`
|
|
275
306
|
}} />
|
|
276
307
|
</view>;
|
|
277
308
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
1
2
|
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
2
3
|
import { InternalIcon } from "../Icon/Icon.jsx";
|
|
3
|
-
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
4
4
|
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
5
|
-
import clsx from "clsx";
|
|
6
5
|
import * as React from "@lynx-js/react";
|
|
7
6
|
import { isValidElement } from "@lynx-js/react";
|
|
7
|
+
import clsx from "clsx";
|
|
8
8
|
import { radio } from "@seed-design/lynx-css/recipes/radio";
|
|
9
9
|
import { radiomark } from "@seed-design/lynx-css/recipes/radiomark";
|
|
10
10
|
import { radioGroup } from "@seed-design/lynx-css/recipes/radio-group";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/components/Stack/Stack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEpE,KAAK,eAAe,GAChB,SAAS,GACT,eAAe,GACf,YAAY,GACZ,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,YAAY,CAAC;AAEjB,UAAU,cAAe,SAAQ,UAAU,EAAE,sBAAsB,EAAE,kBAAkB;IACrF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC;IACvE,KAAK,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;CAAG;AAElD,MAAM,WAAW,WAAY,SAAQ,UAAU;CAAG;
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/components/Stack/Stack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEpE,KAAK,eAAe,GAChB,SAAS,GACT,eAAe,GACf,YAAY,GACZ,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,YAAY,CAAC;AAEjB,UAAU,cAAe,SAAQ,UAAU,EAAE,sBAAsB,EAAE,kBAAkB;IACrF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC;IACvE,KAAK,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;CAAG;AAElD,MAAM,WAAW,WAAY,SAAQ,UAAU;CAAG;AAwDlD,eAAO,MAAM,MAAM,6EAIjB,CAAC;AAIH,eAAO,MAAM,MAAM,6EAIjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useStyleProps } from "../../utils/styled.js";
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import * as React from "@lynx-js/react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
4
|
//#region src/components/Stack/Stack.tsx
|
|
5
5
|
function getStackProps(props) {
|
|
6
6
|
const { align, justify, wrap, grow, shrink, ...restProps } = props;
|
|
@@ -14,11 +14,20 @@ function getStackProps(props) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
function useStackStyleProps(props, flexDirection) {
|
|
17
|
-
|
|
17
|
+
const stackStyleProps = useStyleProps({
|
|
18
18
|
display: "flex",
|
|
19
19
|
flexDirection,
|
|
20
20
|
...getStackProps(props)
|
|
21
21
|
});
|
|
22
|
+
const { gap, ...style } = stackStyleProps.style;
|
|
23
|
+
if (gap == null) return stackStyleProps;
|
|
24
|
+
return {
|
|
25
|
+
...stackStyleProps,
|
|
26
|
+
style: {
|
|
27
|
+
[flexDirection === "column" ? "rowGap" : "columnGap"]: gap,
|
|
28
|
+
...style
|
|
29
|
+
}
|
|
30
|
+
};
|
|
22
31
|
}
|
|
23
32
|
function renderStackView(stackStyleProps, ref) {
|
|
24
33
|
const { style, restProps } = stackStyleProps;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
2
1
|
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
3
|
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
4
|
-
import clsx from "clsx";
|
|
5
4
|
import * as React from "@lynx-js/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
6
|
import { switchStyle } from "@seed-design/lynx-css/recipes/switch";
|
|
7
7
|
import { switchmark } from "@seed-design/lynx-css/recipes/switchmark";
|
|
8
8
|
//#region src/components/Switch/Switch.tsx
|