@seed-design/react 1.0.6 → 1.1.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/ActionButton/ActionButton.cjs +7 -1
- package/lib/components/ActionButton/ActionButton.d.ts +7 -1
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.js +7 -1
- package/lib/components/BottomSheet/BottomSheet.cjs +14 -18
- package/lib/components/BottomSheet/BottomSheet.d.ts +12 -19
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.js +14 -18
- package/lib/components/BottomSheet/BottomSheet.namespace.cjs +2 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +1 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.namespace.js +1 -0
- package/lib/components/BottomSheetHandle/BottomSheetHandle.cjs +20 -0
- package/lib/components/BottomSheetHandle/BottomSheetHandle.d.ts +6 -0
- package/lib/components/BottomSheetHandle/BottomSheetHandle.d.ts.map +1 -0
- package/lib/components/BottomSheetHandle/BottomSheetHandle.js +16 -0
- package/lib/components/BottomSheetHandle/index.cjs +9 -0
- package/lib/components/BottomSheetHandle/index.d.ts +2 -0
- package/lib/components/BottomSheetHandle/index.d.ts.map +1 -0
- package/lib/components/BottomSheetHandle/index.js +1 -0
- package/lib/components/Chip/Chip.cjs +4 -3
- package/lib/components/Chip/Chip.d.ts.map +1 -1
- package/lib/components/Chip/Chip.js +4 -3
- package/lib/components/Field/Field.cjs +108 -0
- package/lib/components/Field/Field.d.ts +41 -0
- package/lib/components/Field/Field.d.ts.map +1 -0
- package/lib/components/Field/Field.js +96 -0
- package/lib/components/Field/Field.namespace.cjs +17 -0
- package/lib/components/Field/Field.namespace.d.ts +2 -0
- package/lib/components/Field/Field.namespace.d.ts.map +1 -0
- package/lib/components/Field/Field.namespace.js +1 -0
- package/lib/components/Field/index.cjs +19 -0
- package/lib/components/Field/index.d.ts +3 -0
- package/lib/components/Field/index.d.ts.map +1 -0
- package/lib/components/Field/index.js +3 -0
- package/lib/components/FieldButton/FieldButton.cjs +201 -0
- package/lib/components/FieldButton/FieldButton.d.ts +61 -0
- package/lib/components/FieldButton/FieldButton.d.ts.map +1 -0
- package/lib/components/FieldButton/FieldButton.js +161 -0
- package/lib/components/FieldButton/FieldButton.namespace.cjs +26 -0
- package/lib/components/FieldButton/FieldButton.namespace.d.ts +2 -0
- package/lib/components/FieldButton/FieldButton.namespace.d.ts.map +1 -0
- package/lib/components/FieldButton/FieldButton.namespace.js +1 -0
- package/lib/components/FieldButton/index.cjs +28 -0
- package/lib/components/FieldButton/index.d.ts +3 -0
- package/lib/components/FieldButton/index.d.ts.map +1 -0
- package/lib/components/FieldButton/index.js +3 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts +1 -1
- package/lib/components/List/List.cjs +5 -4
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.js +5 -4
- package/lib/components/PageBanner/PageBanner.cjs +8 -3
- package/lib/components/PageBanner/PageBanner.d.ts +5 -2
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.js +7 -3
- package/lib/components/PageBanner/PageBanner.namespace.cjs +2 -1
- package/lib/components/PageBanner/PageBanner.namespace.d.ts +1 -1
- package/lib/components/PageBanner/PageBanner.namespace.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.namespace.js +1 -1
- package/lib/components/PageBanner/index.cjs +2 -1
- package/lib/components/PageBanner/index.d.ts +1 -1
- package/lib/components/PageBanner/index.d.ts.map +1 -1
- package/lib/components/PageBanner/index.js +1 -1
- package/lib/components/Slider/Slider.cjs +110 -0
- package/lib/components/Slider/Slider.d.ts +51 -0
- package/lib/components/Slider/Slider.d.ts.map +1 -0
- package/lib/components/Slider/Slider.js +94 -0
- package/lib/components/Slider/Slider.namespace.cjs +21 -0
- package/lib/components/Slider/Slider.namespace.d.ts +2 -0
- package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
- package/lib/components/Slider/Slider.namespace.js +1 -0
- package/lib/components/Slider/index.cjs +23 -0
- package/lib/components/Slider/index.d.ts +3 -0
- package/lib/components/Slider/index.d.ts.map +1 -0
- package/lib/components/Slider/index.js +3 -0
- package/lib/components/TextField/TextField.cjs +54 -74
- package/lib/components/TextField/TextField.d.ts +2 -35
- package/lib/components/TextField/TextField.d.ts.map +1 -1
- package/lib/components/TextField/TextField.js +56 -65
- package/lib/components/TextField/TextField.namespace.cjs +0 -11
- package/lib/components/TextField/TextField.namespace.d.ts +1 -1
- package/lib/components/TextField/TextField.namespace.d.ts.map +1 -1
- package/lib/components/TextField/TextField.namespace.js +1 -1
- package/lib/components/TextField/TextField.test.d.ts +1 -0
- package/lib/components/TextField/TextField.test.d.ts.map +1 -0
- package/lib/components/TextField/index.cjs +2 -11
- package/lib/components/TextField/index.d.ts +2 -1
- package/lib/components/TextField/index.d.ts.map +1 -1
- package/lib/components/TextField/index.js +2 -1
- package/lib/components/TextField/memoize.cjs +18 -0
- package/lib/components/TextField/memoize.d.ts +2 -0
- package/lib/components/TextField/memoize.d.ts.map +1 -0
- package/lib/components/TextField/memoize.js +14 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.cjs +52 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.d.ts +23 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.d.ts.map +1 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.js +48 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.test.d.ts +1 -0
- package/lib/components/TextField/useTextFieldWithGraphemes.test.d.ts.map +1 -0
- package/lib/components/index.cjs +53 -12
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +12 -2
- package/lib/index.cjs +53 -12
- package/lib/index.js +12 -2
- package/lib/node_modules/unicode-segmenter/_grapheme_data.cjs +23 -0
- package/lib/node_modules/unicode-segmenter/_grapheme_data.js +19 -0
- package/lib/node_modules/unicode-segmenter/_incb_data.cjs +29 -0
- package/lib/node_modules/unicode-segmenter/_incb_data.js +25 -0
- package/lib/node_modules/unicode-segmenter/core.cjs +83 -0
- package/lib/node_modules/unicode-segmenter/core.js +78 -0
- package/lib/node_modules/unicode-segmenter/grapheme.cjs +312 -0
- package/lib/node_modules/unicode-segmenter/grapheme.js +307 -0
- package/lib/primitive.cjs +7 -0
- package/lib/primitive.d.ts +1 -0
- package/lib/primitive.d.ts.map +1 -1
- package/lib/primitive.js +1 -0
- package/lib/utils/createWithStateProps.cjs +8 -4
- package/lib/utils/createWithStateProps.d.ts +6 -3
- package/lib/utils/createWithStateProps.d.ts.map +1 -1
- package/lib/utils/createWithStateProps.js +8 -4
- package/package.json +9 -6
- package/src/components/ActionButton/ActionButton.tsx +21 -2
- package/src/components/BottomSheet/BottomSheet.namespace.ts +5 -0
- package/src/components/BottomSheet/BottomSheet.tsx +24 -38
- package/src/components/BottomSheetHandle/BottomSheetHandle.tsx +22 -0
- package/src/components/BottomSheetHandle/index.ts +1 -0
- package/src/components/Chip/Chip.tsx +4 -3
- package/src/components/Field/Field.namespace.ts +19 -0
- package/src/components/Field/Field.tsx +136 -0
- package/src/components/Field/index.ts +21 -0
- package/src/components/FieldButton/FieldButton.namespace.ts +38 -0
- package/src/components/FieldButton/FieldButton.tsx +249 -0
- package/src/components/FieldButton/index.ts +40 -0
- package/src/components/HelpBubble/HelpBubble.tsx +1 -1
- package/src/components/List/List.tsx +5 -4
- package/src/components/PageBanner/PageBanner.namespace.ts +4 -2
- package/src/components/PageBanner/PageBanner.tsx +10 -3
- package/src/components/PageBanner/index.ts +4 -2
- package/src/components/Slider/Slider.namespace.ts +28 -0
- package/src/components/Slider/Slider.tsx +154 -0
- package/src/components/Slider/index.ts +30 -0
- package/src/components/TextField/TextField.namespace.ts +2 -24
- package/src/components/TextField/TextField.test.tsx +260 -0
- package/src/components/TextField/TextField.tsx +67 -143
- package/src/components/TextField/index.ts +7 -24
- package/src/components/TextField/memoize.ts +14 -0
- package/src/components/TextField/useTextFieldWithGraphemes.test.tsx +301 -0
- package/src/components/TextField/useTextFieldWithGraphemes.ts +65 -0
- package/src/components/index.ts +3 -0
- package/src/primitive.ts +1 -0
- package/src/utils/createWithStateProps.tsx +14 -9
- package/lib/components/List/ListHeader.namespace.d.ts +0 -2
- package/lib/components/List/ListHeader.namespace.d.ts.map +0 -1
- package/src/components/List/ListHeader.namespace.ts +0 -0
package/lib/primitive.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from '@seed-design/react-popover';
|
|
|
5
5
|
export * from '@seed-design/react-progress';
|
|
6
6
|
export * from '@seed-design/react-pull-to-refresh';
|
|
7
7
|
export * from '@seed-design/react-radio-group';
|
|
8
|
+
export * from '@seed-design/react-slider';
|
|
8
9
|
export * from '@seed-design/react-snackbar';
|
|
9
10
|
export * from '@seed-design/react-switch';
|
|
10
11
|
export * from '@seed-design/react-tabs';
|
package/lib/primitive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../src/primitive.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../src/primitive.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
|
package/lib/primitive.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from '@seed-design/react-popover';
|
|
|
5
5
|
export * from '@seed-design/react-progress';
|
|
6
6
|
export * from '@seed-design/react-pull-to-refresh';
|
|
7
7
|
export * from '@seed-design/react-radio-group';
|
|
8
|
+
export * from '@seed-design/react-slider';
|
|
8
9
|
export * from '@seed-design/react-snackbar';
|
|
9
10
|
export * from '@seed-design/react-switch';
|
|
10
11
|
export * from '@seed-design/react-tabs';
|
|
@@ -6,13 +6,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
const React = require('react');
|
|
8
8
|
|
|
9
|
-
function createWithStateProps(useContexts
|
|
10
|
-
const strict = options?.strict ?? true;
|
|
9
|
+
function createWithStateProps(useContexts) {
|
|
11
10
|
return function withStateProps(Component) {
|
|
12
11
|
const Node = React.forwardRef((props, ref) => {
|
|
13
12
|
const stateProps = {};
|
|
14
|
-
for (const
|
|
15
|
-
|
|
13
|
+
for (const contextConfig of useContexts) {
|
|
14
|
+
if (typeof contextConfig === "function") {
|
|
15
|
+
Object.assign(stateProps, contextConfig({ strict: true })?.stateProps);
|
|
16
|
+
} else {
|
|
17
|
+
const { useContext, strict = false } = contextConfig;
|
|
18
|
+
Object.assign(stateProps, useContext({ strict })?.stateProps);
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...stateProps, ...props });
|
|
18
22
|
});
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
2
|
type AtLeastOne<T> = [T, ...T[]];
|
|
3
|
-
|
|
3
|
+
type ContextHook = (prop?: {
|
|
4
4
|
strict?: boolean;
|
|
5
5
|
}) => {
|
|
6
6
|
stateProps: React.HTMLAttributes<HTMLElement>;
|
|
7
|
-
} | null
|
|
7
|
+
} | null;
|
|
8
|
+
type ContextConfig = ContextHook | {
|
|
9
|
+
useContext: ContextHook;
|
|
8
10
|
strict?: boolean;
|
|
9
|
-
}
|
|
11
|
+
};
|
|
12
|
+
export declare function createWithStateProps(useContexts: AtLeastOne<ContextConfig>): <P, R>(Component: React.ComponentType<P & React.RefAttributes<R>>) => ForwardRefExoticComponent< PropsWithoutRef<P> & RefAttributes<R>>;
|
|
10
13
|
export {};
|
|
11
14
|
//# sourceMappingURL=createWithStateProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithStateProps.d.ts","sourceRoot":"","sources":["../../src/utils/createWithStateProps.tsx"],"names":[],"mappings":";AAEA,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAEjC,
|
|
1
|
+
{"version":3,"file":"createWithStateProps.d.ts","sourceRoot":"","sources":["../../src/utils/createWithStateProps.tsx"],"names":[],"mappings":";AAEA,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAEjC,KAAK,WAAW,GAAG,CAAC,IAAI,CAAC,EAAE;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,KAAK;IAAE,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;CAAE,GAAG,IAAI,CAAC;AAE/D,KAAK,aAAa,GAAG,WAAW,GAAG;IAAE,UAAU,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjF,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,IAC1C,CAAC,EAAE,CAAC,EAAE,WAAW,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,sHAqBhG"}
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
|
|
5
|
-
function createWithStateProps(useContexts
|
|
6
|
-
const strict = options?.strict ?? true;
|
|
5
|
+
function createWithStateProps(useContexts) {
|
|
7
6
|
return function withStateProps(Component) {
|
|
8
7
|
const Node = forwardRef((props, ref) => {
|
|
9
8
|
const stateProps = {};
|
|
10
|
-
for (const
|
|
11
|
-
|
|
9
|
+
for (const contextConfig of useContexts) {
|
|
10
|
+
if (typeof contextConfig === "function") {
|
|
11
|
+
Object.assign(stateProps, contextConfig({ strict: true })?.stateProps);
|
|
12
|
+
} else {
|
|
13
|
+
const { useContext, strict = false } = contextConfig;
|
|
14
|
+
Object.assign(stateProps, useContext({ strict })?.stateProps);
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
return /* @__PURE__ */ jsx(Component, { ref, ...stateProps, ...props });
|
|
14
18
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/react",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -43,27 +43,30 @@
|
|
|
43
43
|
"@seed-design/react-avatar": "1.0.0",
|
|
44
44
|
"@seed-design/react-checkbox": "1.0.0",
|
|
45
45
|
"@seed-design/react-dialog": "1.0.0",
|
|
46
|
-
"@seed-design/react-
|
|
46
|
+
"@seed-design/react-drawer": "1.0.0",
|
|
47
|
+
"@seed-design/react-field": "1.0.0",
|
|
48
|
+
"@seed-design/react-field-button": "1.0.0",
|
|
49
|
+
"@seed-design/react-popover": "1.0.2",
|
|
47
50
|
"@seed-design/react-portal": "1.0.0",
|
|
48
51
|
"@seed-design/react-primitive": "1.0.0",
|
|
49
52
|
"@seed-design/react-progress": "1.0.0",
|
|
50
53
|
"@seed-design/react-pull-to-refresh": "1.0.1",
|
|
51
54
|
"@seed-design/react-radio-group": "1.0.0",
|
|
52
55
|
"@seed-design/react-segmented-control": "1.0.0",
|
|
56
|
+
"@seed-design/react-slider": "1.0.0",
|
|
53
57
|
"@seed-design/react-snackbar": "1.0.0",
|
|
54
58
|
"@seed-design/react-switch": "1.0.0",
|
|
55
59
|
"@seed-design/react-tabs": "1.0.0",
|
|
56
|
-
"@seed-design/react-text-field": "1.
|
|
60
|
+
"@seed-design/react-text-field": "1.1.0",
|
|
57
61
|
"@seed-design/react-toggle": "1.0.0",
|
|
58
|
-
"clsx": "^2.1.1"
|
|
62
|
+
"clsx": "^2.1.1",
|
|
63
|
+
"unicode-segmenter": "^0.14.0"
|
|
59
64
|
},
|
|
60
65
|
"peerDependencies": {
|
|
61
|
-
"@seed-design/css": "1.0.6",
|
|
62
66
|
"react": ">=18.0.0",
|
|
63
67
|
"react-dom": ">=18.0.0"
|
|
64
68
|
},
|
|
65
69
|
"devDependencies": {
|
|
66
|
-
"@seed-design/css": "1.0.6",
|
|
67
70
|
"@types/react": "^19.2.2",
|
|
68
71
|
"@types/react-dom": "^19.2.1",
|
|
69
72
|
"@vitejs/plugin-react": "^5.0.0",
|
|
@@ -12,7 +12,12 @@ import {
|
|
|
12
12
|
usePendingButton,
|
|
13
13
|
type UsePendingButtonProps,
|
|
14
14
|
} from "../LoadingIndicator/usePendingButton";
|
|
15
|
-
import
|
|
15
|
+
import {
|
|
16
|
+
type ScopedColorFg,
|
|
17
|
+
type ScopedColorPalette,
|
|
18
|
+
type FontWeight,
|
|
19
|
+
vars,
|
|
20
|
+
} from "@seed-design/css/vars";
|
|
16
21
|
|
|
17
22
|
export interface ActionButtonProps
|
|
18
23
|
extends ActionButtonVariantProps,
|
|
@@ -26,6 +31,13 @@ export interface ActionButtonProps
|
|
|
26
31
|
* @default "fg.neutral"
|
|
27
32
|
*/
|
|
28
33
|
color?: ScopedColorFg | ScopedColorPalette;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Weight of the label.
|
|
37
|
+
* Works only when `variant` is `ghost`.
|
|
38
|
+
* @default "bold"
|
|
39
|
+
*/
|
|
40
|
+
fontWeight?: FontWeight;
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProps>(
|
|
@@ -36,6 +48,7 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
|
|
|
36
48
|
loading = false,
|
|
37
49
|
layout = "withText",
|
|
38
50
|
color,
|
|
51
|
+
fontWeight,
|
|
39
52
|
className,
|
|
40
53
|
children,
|
|
41
54
|
...otherProps
|
|
@@ -59,7 +72,13 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
|
|
|
59
72
|
ref={ref}
|
|
60
73
|
className={clsx(recipeClassName, className)}
|
|
61
74
|
// NOTE: Should we handle color as a style prop?
|
|
62
|
-
style={
|
|
75
|
+
style={
|
|
76
|
+
{
|
|
77
|
+
...style,
|
|
78
|
+
...(color && { "--seed-box-color": handleColor(color) }),
|
|
79
|
+
...(fontWeight && { "--seed-font-weight": vars.$fontWeight[fontWeight] }),
|
|
80
|
+
} as React.CSSProperties
|
|
81
|
+
}
|
|
63
82
|
{...api.stateProps}
|
|
64
83
|
{...restProps}
|
|
65
84
|
>
|
|
@@ -22,3 +22,8 @@ export {
|
|
|
22
22
|
type BottomSheetTriggerProps as TriggerProps,
|
|
23
23
|
type BottomSheetCloseButtonProps as CloseButtonProps,
|
|
24
24
|
} from "./BottomSheet";
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
BottomSheetHandle as Handle,
|
|
28
|
+
type BottomSheetHandleProps as HandleProps,
|
|
29
|
+
} from "../BottomSheetHandle";
|
|
@@ -1,63 +1,51 @@
|
|
|
1
|
-
import { Dialog as DialogPrimitive, useDialogContext } from "@seed-design/react-dialog";
|
|
2
|
-
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
1
|
import { bottomSheet, type BottomSheetVariantProps } from "@seed-design/css/recipes/bottom-sheet";
|
|
2
|
+
import { Drawer } from "@seed-design/react-drawer";
|
|
3
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
4
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
5
|
-
import {
|
|
6
|
-
import { withStyleProps, type StyleProps } from "../../utils/styled";
|
|
5
|
+
import type { StyleProps } from "../../utils/styled";
|
|
7
6
|
|
|
8
7
|
const { withRootProvider, withContext } = createSlotRecipeContext(bottomSheet);
|
|
9
|
-
const withStateProps = createWithStateProps([useDialogContext]);
|
|
10
8
|
|
|
11
9
|
////////////////////////////////////////////////////////////////////////////////////
|
|
12
10
|
|
|
13
|
-
export interface BottomSheetRootProps extends BottomSheetVariantProps,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
lazyMount?: DialogPrimitive.RootProps["lazyMount"];
|
|
18
|
-
/**
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
unmountOnExit?: DialogPrimitive.RootProps["unmountOnExit"];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const BottomSheetRoot = withRootProvider<BottomSheetRootProps>(DialogPrimitive.Root, {
|
|
11
|
+
export interface BottomSheetRootProps extends BottomSheetVariantProps, Drawer.RootProps {}
|
|
12
|
+
|
|
13
|
+
export const BottomSheetRoot = withRootProvider<BottomSheetRootProps>(Drawer.Root, {
|
|
25
14
|
defaultProps: {
|
|
26
|
-
|
|
27
|
-
unmountOnExit: true,
|
|
15
|
+
direction: "bottom",
|
|
28
16
|
},
|
|
29
17
|
});
|
|
30
18
|
|
|
31
19
|
////////////////////////////////////////////////////////////////////////////////////
|
|
32
20
|
|
|
33
|
-
export interface BottomSheetTriggerProps extends
|
|
21
|
+
export interface BottomSheetTriggerProps extends Drawer.TriggerProps {}
|
|
34
22
|
|
|
35
|
-
export const BottomSheetTrigger =
|
|
23
|
+
export const BottomSheetTrigger = Drawer.Trigger;
|
|
36
24
|
|
|
37
25
|
////////////////////////////////////////////////////////////////////////////////////
|
|
38
26
|
|
|
39
|
-
export interface BottomSheetPositionerProps extends
|
|
27
|
+
export interface BottomSheetPositionerProps extends Drawer.PositionerProps {}
|
|
40
28
|
|
|
41
29
|
export const BottomSheetPositioner = withContext<HTMLDivElement, BottomSheetPositionerProps>(
|
|
42
|
-
|
|
30
|
+
Drawer.Positioner,
|
|
43
31
|
"positioner",
|
|
44
32
|
);
|
|
45
33
|
|
|
46
34
|
////////////////////////////////////////////////////////////////////////////////////
|
|
47
35
|
|
|
48
|
-
export interface BottomSheetBackdropProps extends
|
|
36
|
+
export interface BottomSheetBackdropProps extends Drawer.BackdropProps {}
|
|
49
37
|
|
|
50
38
|
export const BottomSheetBackdrop = withContext<HTMLDivElement, BottomSheetBackdropProps>(
|
|
51
|
-
|
|
39
|
+
Drawer.Backdrop,
|
|
52
40
|
"backdrop",
|
|
53
41
|
);
|
|
54
42
|
|
|
55
43
|
////////////////////////////////////////////////////////////////////////////////////
|
|
56
44
|
|
|
57
|
-
export interface BottomSheetContentProps extends
|
|
45
|
+
export interface BottomSheetContentProps extends Drawer.ContentProps {}
|
|
58
46
|
|
|
59
47
|
export const BottomSheetContent = withContext<HTMLDivElement, BottomSheetContentProps>(
|
|
60
|
-
|
|
48
|
+
Drawer.Content,
|
|
61
49
|
"content",
|
|
62
50
|
);
|
|
63
51
|
|
|
@@ -68,27 +56,27 @@ export interface BottomSheetHeaderProps
|
|
|
68
56
|
React.HTMLAttributes<HTMLDivElement> {}
|
|
69
57
|
|
|
70
58
|
export const BottomSheetHeader = withContext<HTMLDivElement, BottomSheetHeaderProps>(
|
|
71
|
-
|
|
59
|
+
Primitive.div,
|
|
72
60
|
"header",
|
|
73
61
|
);
|
|
74
62
|
|
|
75
63
|
////////////////////////////////////////////////////////////////////////////////////
|
|
76
64
|
|
|
77
|
-
export interface BottomSheetTitleProps extends
|
|
65
|
+
export interface BottomSheetTitleProps extends Drawer.TitleProps {}
|
|
78
66
|
|
|
79
67
|
export const BottomSheetTitle = withContext<HTMLHeadingElement, BottomSheetTitleProps>(
|
|
80
|
-
|
|
68
|
+
Drawer.Title,
|
|
81
69
|
"title",
|
|
82
70
|
);
|
|
83
71
|
|
|
84
72
|
////////////////////////////////////////////////////////////////////////////////////
|
|
85
73
|
|
|
86
|
-
export interface BottomSheetDescriptionProps extends
|
|
74
|
+
export interface BottomSheetDescriptionProps extends Drawer.DescriptionProps {}
|
|
87
75
|
|
|
88
76
|
export const BottomSheetDescription = withContext<
|
|
89
77
|
HTMLParagraphElement,
|
|
90
78
|
BottomSheetDescriptionProps
|
|
91
|
-
>(
|
|
79
|
+
>(Drawer.Description, "description");
|
|
92
80
|
|
|
93
81
|
////////////////////////////////////////////////////////////////////////////////////
|
|
94
82
|
|
|
@@ -101,7 +89,7 @@ export interface BottomSheetBodyProps
|
|
|
101
89
|
React.HTMLAttributes<HTMLDivElement> {}
|
|
102
90
|
|
|
103
91
|
export const BottomSheetBody = withContext<HTMLDivElement, BottomSheetBodyProps>(
|
|
104
|
-
|
|
92
|
+
Primitive.div,
|
|
105
93
|
"body",
|
|
106
94
|
);
|
|
107
95
|
|
|
@@ -112,17 +100,15 @@ export interface BottomSheetFooterProps
|
|
|
112
100
|
React.HTMLAttributes<HTMLDivElement> {}
|
|
113
101
|
|
|
114
102
|
export const BottomSheetFooter = withContext<HTMLDivElement, BottomSheetFooterProps>(
|
|
115
|
-
|
|
103
|
+
Primitive.div,
|
|
116
104
|
"footer",
|
|
117
105
|
);
|
|
118
106
|
|
|
119
107
|
////////////////////////////////////////////////////////////////////////////////////
|
|
120
108
|
|
|
121
|
-
export interface BottomSheetCloseButtonProps
|
|
122
|
-
extends PrimitiveProps,
|
|
123
|
-
React.HTMLAttributes<HTMLButtonElement> {}
|
|
109
|
+
export interface BottomSheetCloseButtonProps extends Drawer.CloseButtonProps {}
|
|
124
110
|
|
|
125
111
|
export const BottomSheetCloseButton = withContext<HTMLButtonElement, BottomSheetCloseButtonProps>(
|
|
126
|
-
|
|
112
|
+
Drawer.CloseButton,
|
|
127
113
|
"closeButton",
|
|
128
114
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
|
+
import { bottomSheetHandle } from "@seed-design/css/recipes/bottom-sheet-handle";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
|
|
6
|
+
export interface BottomSheetHandleProps
|
|
7
|
+
extends PrimitiveProps,
|
|
8
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
9
|
+
|
|
10
|
+
export const BottomSheetHandle = React.forwardRef<HTMLDivElement, BottomSheetHandleProps>(
|
|
11
|
+
({ className, ...props }, ref) => {
|
|
12
|
+
const classNames = bottomSheetHandle();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Primitive.div ref={ref} className={clsx(classNames.root, className)} {...props}>
|
|
16
|
+
<Primitive.div aria-hidden="true" className={classNames.touchArea} />
|
|
17
|
+
</Primitive.div>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
BottomSheetHandle.displayName = "BottomSheetHandle";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BottomSheetHandle, type BottomSheetHandleProps } from "./BottomSheetHandle";
|
|
@@ -8,9 +8,10 @@ import { useCheckboxContext } from "@seed-design/react-checkbox";
|
|
|
8
8
|
import { useRadioGroupItemContext } from "@seed-design/react-radio-group";
|
|
9
9
|
|
|
10
10
|
const { withProvider, withContext } = createSlotRecipeContext(chip);
|
|
11
|
-
const withStateProps = createWithStateProps([
|
|
12
|
-
strict: false,
|
|
13
|
-
}
|
|
11
|
+
const withStateProps = createWithStateProps([
|
|
12
|
+
{ useContext: useCheckboxContext, strict: false },
|
|
13
|
+
{ useContext: useRadioGroupItemContext, strict: false },
|
|
14
|
+
]);
|
|
14
15
|
|
|
15
16
|
////////////////////////////////////////////////////////////////////////////////////
|
|
16
17
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export {
|
|
2
|
+
FieldRoot as Root,
|
|
3
|
+
FieldHeader as Header,
|
|
4
|
+
FieldLabel as Label,
|
|
5
|
+
FieldIndicatorText as IndicatorText,
|
|
6
|
+
FieldRequiredIndicator as RequiredIndicator,
|
|
7
|
+
FieldFooter as Footer,
|
|
8
|
+
FieldDescription as Description,
|
|
9
|
+
FieldErrorMessage as ErrorMessage,
|
|
10
|
+
FieldCharacterCount as CharacterCount,
|
|
11
|
+
type FieldRootProps as RootProps,
|
|
12
|
+
type FieldHeaderProps as HeaderProps,
|
|
13
|
+
type FieldLabelProps as LabelProps,
|
|
14
|
+
type FieldIndicatorTextProps as IndicatorTextProps,
|
|
15
|
+
type FieldFooterProps as FooterProps,
|
|
16
|
+
type FieldDescriptionProps as DescriptionProps,
|
|
17
|
+
type FieldErrorMessageProps as ErrorMessageProps,
|
|
18
|
+
type FieldCharacterCountProps as CharacterCountProps,
|
|
19
|
+
} from "./Field";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
|
+
import { Field, useFieldContext } from "@seed-design/react-field";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
6
|
+
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
7
|
+
import { field, type FieldVariantProps } from "@seed-design/css/recipes/field";
|
|
8
|
+
import { fieldLabel, type FieldLabelVariantProps } from "@seed-design/css/recipes/field-label";
|
|
9
|
+
import { InternalIcon } from "../private/Icon";
|
|
10
|
+
import clsx from "clsx";
|
|
11
|
+
|
|
12
|
+
const { withProvider, withContext, useClassNames } = createSlotRecipeContext(field);
|
|
13
|
+
const {
|
|
14
|
+
withContext: withLabelContext,
|
|
15
|
+
withProvider: withLabelProvider,
|
|
16
|
+
useClassNames: useLabelClassNames,
|
|
17
|
+
} = createSlotRecipeContext(fieldLabel);
|
|
18
|
+
const withStateProps = createWithStateProps([useFieldContext]);
|
|
19
|
+
|
|
20
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
21
|
+
|
|
22
|
+
export interface FieldRootProps extends FieldVariantProps, Field.RootProps {}
|
|
23
|
+
|
|
24
|
+
export const FieldRoot = withProvider<HTMLDivElement, FieldRootProps>(Field.Root, "root");
|
|
25
|
+
|
|
26
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
27
|
+
|
|
28
|
+
export interface FieldHeaderProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {}
|
|
29
|
+
|
|
30
|
+
export const FieldHeader = withContext<HTMLDivElement, FieldHeaderProps>(
|
|
31
|
+
withStateProps(Primitive.div),
|
|
32
|
+
"header",
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export interface FieldLabelProps extends FieldLabelVariantProps, Field.LabelProps {}
|
|
36
|
+
|
|
37
|
+
export const FieldLabel = withLabelProvider<HTMLLabelElement, FieldLabelProps>(Field.Label, "root");
|
|
38
|
+
|
|
39
|
+
export interface FieldIndicatorTextProps
|
|
40
|
+
extends PrimitiveProps,
|
|
41
|
+
React.HTMLAttributes<HTMLSpanElement> {}
|
|
42
|
+
|
|
43
|
+
export const FieldIndicatorText = withLabelContext<HTMLSpanElement, FieldIndicatorTextProps>(
|
|
44
|
+
withStateProps(Primitive.span),
|
|
45
|
+
"indicatorText",
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export interface FieldRequiredIndicatorProps extends React.SVGProps<SVGElement> {}
|
|
49
|
+
|
|
50
|
+
export const FieldRequiredIndicator = forwardRef<SVGSVGElement, FieldRequiredIndicatorProps>(
|
|
51
|
+
({ className, ...props }, ref) => {
|
|
52
|
+
const { indicatorIcon } = useLabelClassNames();
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<InternalIcon
|
|
56
|
+
svg={
|
|
57
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: InternalIcon is aria-hidden
|
|
58
|
+
<svg
|
|
59
|
+
viewBox="0 0 6 6"
|
|
60
|
+
fill="none"
|
|
61
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
+
className={clsx(indicatorIcon, className)}
|
|
63
|
+
>
|
|
64
|
+
<path
|
|
65
|
+
d="M3.75002 1.55859L4.41318 1.09468C4.75243 0.857361 5.21982 0.939865 5.45732 1.27899C5.69499 1.61836 5.61243 2.08615 5.27295 2.32366L4.30763 2.99902L5.27372 3.67612C5.61285 3.91381 5.69517 4.38137 5.45761 4.72059C5.21999 5.0599 4.7523 5.14233 4.41299 4.90471L3.75002 4.44043V5.25C3.75002 5.66421 3.41423 6 3.00002 6C2.5858 6 2.25002 5.66421 2.25002 5.25V4.44043L1.58704 4.90471C1.24773 5.14233 0.780041 5.0599 0.542418 4.72059C0.304856 4.38137 0.387176 3.91381 0.726309 3.67612L1.6924 2.99902L0.727079 2.32366C0.387603 2.08615 0.305043 1.61836 0.542707 1.27899C0.780206 0.939865 1.2476 0.857361 1.58685 1.09468L2.25002 1.55859V0.75C2.25002 0.335786 2.5858 0 3.00002 0C3.41423 0 3.75002 0.335786 3.75002 0.75V1.55859Z"
|
|
66
|
+
fill="currentColor"
|
|
67
|
+
/>
|
|
68
|
+
</svg>
|
|
69
|
+
}
|
|
70
|
+
ref={ref}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
78
|
+
|
|
79
|
+
export interface FieldFooterProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {}
|
|
80
|
+
|
|
81
|
+
export const FieldFooter = withContext<HTMLDivElement, FieldFooterProps>(
|
|
82
|
+
withStateProps(Primitive.div),
|
|
83
|
+
"footer",
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export interface FieldDescriptionProps extends Field.DescriptionProps {}
|
|
87
|
+
|
|
88
|
+
export const FieldDescription = withContext<HTMLSpanElement, FieldDescriptionProps>(
|
|
89
|
+
Field.Description,
|
|
90
|
+
"description",
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
export interface FieldErrorMessageProps extends Field.ErrorMessageProps {}
|
|
94
|
+
|
|
95
|
+
export const FieldErrorMessage = withContext<HTMLSpanElement, FieldErrorMessageProps>(
|
|
96
|
+
Field.ErrorMessage,
|
|
97
|
+
"errorMessage",
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
101
|
+
|
|
102
|
+
export interface FieldCharacterCountProps
|
|
103
|
+
extends PrimitiveProps,
|
|
104
|
+
React.HTMLAttributes<HTMLDivElement> {
|
|
105
|
+
/**
|
|
106
|
+
* The current number of characters/graphemes
|
|
107
|
+
*/
|
|
108
|
+
current: number;
|
|
109
|
+
/**
|
|
110
|
+
* The maximum allowed characters/graphemes
|
|
111
|
+
*/
|
|
112
|
+
max: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const FieldCharacterCount = forwardRef<HTMLDivElement, FieldCharacterCountProps>(
|
|
116
|
+
({ current, max, ...otherProps }, ref) => {
|
|
117
|
+
const classNames = useClassNames();
|
|
118
|
+
const { stateProps } = useFieldContext();
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<Primitive.div ref={ref} {...otherProps}>
|
|
122
|
+
<span
|
|
123
|
+
{...(current === 0 ? { "data-empty": true } : {})}
|
|
124
|
+
{...(current > max ? { "data-exceeded": true } : {})}
|
|
125
|
+
className={classNames.characterCount}
|
|
126
|
+
{...stateProps}
|
|
127
|
+
>
|
|
128
|
+
{current}
|
|
129
|
+
</span>
|
|
130
|
+
<span className={classNames.maxCharacterCount} {...stateProps}>
|
|
131
|
+
/{max}
|
|
132
|
+
</span>
|
|
133
|
+
</Primitive.div>
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export {
|
|
2
|
+
FieldRoot,
|
|
3
|
+
FieldHeader,
|
|
4
|
+
FieldLabel,
|
|
5
|
+
FieldIndicatorText,
|
|
6
|
+
FieldRequiredIndicator,
|
|
7
|
+
FieldFooter,
|
|
8
|
+
FieldDescription,
|
|
9
|
+
FieldErrorMessage,
|
|
10
|
+
FieldCharacterCount,
|
|
11
|
+
type FieldRootProps,
|
|
12
|
+
type FieldHeaderProps,
|
|
13
|
+
type FieldLabelProps,
|
|
14
|
+
type FieldIndicatorTextProps,
|
|
15
|
+
type FieldFooterProps,
|
|
16
|
+
type FieldDescriptionProps,
|
|
17
|
+
type FieldErrorMessageProps,
|
|
18
|
+
type FieldCharacterCountProps,
|
|
19
|
+
} from "./Field";
|
|
20
|
+
|
|
21
|
+
export * as Field from "./Field.namespace";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export {
|
|
2
|
+
FieldButtonButton as Button,
|
|
3
|
+
FieldButtonClearButton as ClearButton,
|
|
4
|
+
FieldButtonDescription as Description,
|
|
5
|
+
FieldButtonErrorMessage as ErrorMessage,
|
|
6
|
+
FieldButtonRoot as Root,
|
|
7
|
+
FieldButtonFooter as Footer,
|
|
8
|
+
FieldButtonHeader as Header,
|
|
9
|
+
FieldButtonHiddenInput as HiddenInput,
|
|
10
|
+
FieldButtonIndicatorText as IndicatorText,
|
|
11
|
+
FieldButtonLabel as Label,
|
|
12
|
+
FieldButtonPlaceholder as Placeholder,
|
|
13
|
+
FieldButtonPrefixIcon as PrefixIcon,
|
|
14
|
+
FieldButtonPrefixText as PrefixText,
|
|
15
|
+
FieldButtonRequiredIndicator as RequiredIndicator,
|
|
16
|
+
FieldButtonControl as Control,
|
|
17
|
+
FieldButtonSuffixIcon as SuffixIcon,
|
|
18
|
+
FieldButtonSuffixText as SuffixText,
|
|
19
|
+
FieldButtonValue as Value,
|
|
20
|
+
type FieldButtonButtonProps as ButtonProps,
|
|
21
|
+
type FieldButtonClearButtonProps as ClearButtonProps,
|
|
22
|
+
type FieldButtonDescriptionProps as DescriptionProps,
|
|
23
|
+
type FieldButtonErrorMessageProps as ErrorMessageProps,
|
|
24
|
+
type FieldButtonRootProps as RootProps,
|
|
25
|
+
type FieldButtonFooterProps as FooterProps,
|
|
26
|
+
type FieldButtonHeaderProps as HeaderProps,
|
|
27
|
+
type FieldButtonHiddenInputProps as HiddenInputProps,
|
|
28
|
+
type FieldButtonIndicatorTextProps as IndicatorTextProps,
|
|
29
|
+
type FieldButtonLabelProps as LabelProps,
|
|
30
|
+
type FieldButtonPlaceholderProps as PlaceholderProps,
|
|
31
|
+
type FieldButtonPrefixIconProps as PrefixIconProps,
|
|
32
|
+
type FieldButtonPrefixTextProps as PrefixTextProps,
|
|
33
|
+
type FieldButtonRequiredIndicatorProps as RequiredIndicatorProps,
|
|
34
|
+
type FieldButtonControlProps as ControlProps,
|
|
35
|
+
type FieldButtonSuffixIconProps as SuffixIconProps,
|
|
36
|
+
type FieldButtonSuffixTextProps as SuffixTextProps,
|
|
37
|
+
type FieldButtonValueProps as ValueProps,
|
|
38
|
+
} from "./FieldButton";
|