@seed-design/react 1.1.8 → 1.1.12
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/Field/Field.cjs +25 -17
- package/lib/components/Field/Field.d.ts.map +1 -1
- package/lib/components/Field/Field.js +25 -17
- package/lib/components/PageBanner/PageBanner.cjs +15 -4
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.js +15 -4
- package/lib/components/TagGroup/TagGroup.cjs +7 -4
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.js +9 -6
- package/package.json +5 -4
- package/src/components/Field/Field.tsx +6 -2
- package/src/components/PageBanner/PageBanner.tsx +41 -4
- package/src/components/TagGroup/TagGroup.tsx +14 -11
|
@@ -75,25 +75,33 @@ const FieldErrorMessage = withContext(
|
|
|
75
75
|
"errorMessage"
|
|
76
76
|
);
|
|
77
77
|
const FieldCharacterCount = React.forwardRef(
|
|
78
|
-
({ current, max, ...otherProps }, ref) => {
|
|
78
|
+
({ current, max, className, ...otherProps }, ref) => {
|
|
79
79
|
const classNames = useClassNames();
|
|
80
80
|
const { stateProps } = reactField.useFieldContext();
|
|
81
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
82
|
+
reactPrimitive.Primitive.div,
|
|
83
|
+
{
|
|
84
|
+
className: clsx(classNames.characterCountArea, className),
|
|
85
|
+
ref,
|
|
86
|
+
...otherProps,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
+
"span",
|
|
90
|
+
{
|
|
91
|
+
...current === 0 ? { "data-empty": true } : {},
|
|
92
|
+
...current > max ? { "data-exceeded": true } : {},
|
|
93
|
+
className: classNames.characterCount,
|
|
94
|
+
...stateProps,
|
|
95
|
+
children: current
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: classNames.maxCharacterCount, ...stateProps, children: [
|
|
99
|
+
"/",
|
|
100
|
+
max
|
|
101
|
+
] })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
);
|
|
97
105
|
}
|
|
98
106
|
);
|
|
99
107
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/components/Field/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAmB,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAc,KAAK,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAc/F,MAAM,WAAW,cAAe,SAAQ,iBAAiB,EAAE,KAAK,CAAC,SAAS;CAAG;AAE7E,eAAO,MAAM,SAAS,uFAAmE,CAAC;AAI1F,MAAM,WAAW,gBAAiB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAEjG,eAAO,MAAM,WAAW,yFAGvB,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,sBAAsB,EAAE,KAAK,CAAC,UAAU;CAAG;AAEpF,eAAO,MAAM,UAAU,0FAA4E,CAAC;AAEpG,MAAM,WAAW,uBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,kBAAkB,iGAG9B,CAAC;AAEF,MAAM,WAAW,2BAA4B,SAAQ,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;CAAG;AAElF,eAAO,MAAM,sBAAsB,gHAyBlC,CAAC;AAIF,MAAM,WAAW,gBAAiB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAEjG,eAAO,MAAM,WAAW,yFAGvB,CAAC;AAEF,MAAM,WAAW,qBAAsB,SAAQ,KAAK,CAAC,gBAAgB;CAAG;AAExE,eAAO,MAAM,gBAAgB,+FAG5B,CAAC;AAEF,MAAM,WAAW,sBAAuB,SAAQ,KAAK,CAAC,iBAAiB;CAAG;AAE1E,eAAO,MAAM,iBAAiB,gGAG7B,CAAC;AAIF,MAAM,WAAW,wBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/components/Field/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAmB,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAc,KAAK,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAc/F,MAAM,WAAW,cAAe,SAAQ,iBAAiB,EAAE,KAAK,CAAC,SAAS;CAAG;AAE7E,eAAO,MAAM,SAAS,uFAAmE,CAAC;AAI1F,MAAM,WAAW,gBAAiB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAEjG,eAAO,MAAM,WAAW,yFAGvB,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,sBAAsB,EAAE,KAAK,CAAC,UAAU;CAAG;AAEpF,eAAO,MAAM,UAAU,0FAA4E,CAAC;AAEpG,MAAM,WAAW,uBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,kBAAkB,iGAG9B,CAAC;AAEF,MAAM,WAAW,2BAA4B,SAAQ,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;CAAG;AAElF,eAAO,MAAM,sBAAsB,gHAyBlC,CAAC;AAIF,MAAM,WAAW,gBAAiB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAEjG,eAAO,MAAM,WAAW,yFAGvB,CAAC;AAEF,MAAM,WAAW,qBAAsB,SAAQ,KAAK,CAAC,gBAAgB;CAAG;AAExE,eAAO,MAAM,gBAAgB,+FAG5B,CAAC;AAEF,MAAM,WAAW,sBAAuB,SAAQ,KAAK,CAAC,iBAAiB;CAAG;AAE1E,eAAO,MAAM,iBAAiB,gGAG7B,CAAC;AAIF,MAAM,WAAW,wBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,mBAAmB,iGAyB/B,CAAC"}
|
|
@@ -71,25 +71,33 @@ const FieldErrorMessage = withContext(
|
|
|
71
71
|
"errorMessage"
|
|
72
72
|
);
|
|
73
73
|
const FieldCharacterCount = forwardRef(
|
|
74
|
-
({ current, max, ...otherProps }, ref) => {
|
|
74
|
+
({ current, max, className, ...otherProps }, ref) => {
|
|
75
75
|
const classNames = useClassNames();
|
|
76
76
|
const { stateProps } = useFieldContext();
|
|
77
|
-
return /* @__PURE__ */ jsxs(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
return /* @__PURE__ */ jsxs(
|
|
78
|
+
Primitive.div,
|
|
79
|
+
{
|
|
80
|
+
className: clsx(classNames.characterCountArea, className),
|
|
81
|
+
ref,
|
|
82
|
+
...otherProps,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
...current === 0 ? { "data-empty": true } : {},
|
|
88
|
+
...current > max ? { "data-exceeded": true } : {},
|
|
89
|
+
className: classNames.characterCount,
|
|
90
|
+
...stateProps,
|
|
91
|
+
children: current
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsxs("span", { className: classNames.maxCharacterCount, ...stateProps, children: [
|
|
95
|
+
"/",
|
|
96
|
+
max
|
|
97
|
+
] })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
93
101
|
}
|
|
94
102
|
);
|
|
95
103
|
|
|
@@ -3,15 +3,26 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
5
|
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const React = require('react');
|
|
6
8
|
const pageBanner = require('@seed-design/css/recipes/page-banner');
|
|
7
9
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
8
10
|
const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
|
|
9
11
|
const useDismissible = require('../private/useDismissible.cjs');
|
|
12
|
+
const clsx = require('clsx');
|
|
10
13
|
|
|
11
|
-
const { withContext,
|
|
12
|
-
const PageBannerRoot =
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const { withContext, ClassNamesProvider } = createSlotRecipeContext.createSlotRecipeContext(pageBanner.pageBanner);
|
|
15
|
+
const PageBannerRoot = React.forwardRef(
|
|
16
|
+
({ className, ...props }, ref) => {
|
|
17
|
+
if (props.variant === "solid" && props.tone === "magic") {
|
|
18
|
+
console.error(
|
|
19
|
+
`\`${props.tone}\` tone is not available for \`${props.variant}\` variant in PageBanner components. Please use variant="weak" or a different tone instead.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
const [variantProps, otherProps] = pageBanner.pageBanner.splitVariantProps(props);
|
|
23
|
+
const classNames = pageBanner.pageBanner(variantProps);
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(useDismissible.DismissibleRoot, { className: clsx(classNames.root, className), ref, ...otherProps }) });
|
|
25
|
+
}
|
|
15
26
|
);
|
|
16
27
|
const PageBannerContent = withContext(
|
|
17
28
|
reactPrimitive.Primitive.div,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageBanner.d.ts","sourceRoot":"","sources":["../../../src/components/PageBanner/PageBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PageBanner.d.ts","sourceRoot":"","sources":["../../../src/components/PageBanner/PageBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAGpC,OAAO,EAAc,KAAK,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC/F,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAKnC,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB,EAAE,oBAAoB;CAAG;AAE5F,eAAO,MAAM,cAAc,4FAiB1B,CAAC;AAuBF,MAAM,WAAW,sBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,iBAAiB,+FAG7B,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAEpG,eAAO,MAAM,cAAc,4FAG1B,CAAC;AAEF,MAAM,WAAW,oBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,eAAe,8FAG3B,CAAC;AAEF,MAAM,WAAW,0BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,qBAAqB,oGAGjC,CAAC;AAEF,MAAM,WAAW,qBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpD,eAAO,MAAM,gBAAgB,iGAG5B,CAAC;AAEF,MAAM,WAAW,0BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpD,eAAO,MAAM,qBAAqB,sGAGjC,CAAC"}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
2
4
|
import { pageBanner } from '@seed-design/css/recipes/page-banner';
|
|
3
5
|
import { Primitive } from '@seed-design/react-primitive';
|
|
4
6
|
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
5
7
|
import { DismissibleCloseButton, DismissibleRoot } from '../private/useDismissible.js';
|
|
8
|
+
import clsx from 'clsx';
|
|
6
9
|
|
|
7
|
-
const { withContext,
|
|
8
|
-
const PageBannerRoot =
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const { withContext, ClassNamesProvider } = createSlotRecipeContext(pageBanner);
|
|
11
|
+
const PageBannerRoot = forwardRef(
|
|
12
|
+
({ className, ...props }, ref) => {
|
|
13
|
+
if (props.variant === "solid" && props.tone === "magic") {
|
|
14
|
+
console.error(
|
|
15
|
+
`\`${props.tone}\` tone is not available for \`${props.variant}\` variant in PageBanner components. Please use variant="weak" or a different tone instead.`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const [variantProps, otherProps] = pageBanner.splitVariantProps(props);
|
|
19
|
+
const classNames = pageBanner(variantProps);
|
|
20
|
+
return /* @__PURE__ */ jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsx(DismissibleRoot, { className: clsx(classNames.root, className), ref, ...otherProps }) });
|
|
21
|
+
}
|
|
11
22
|
);
|
|
12
23
|
const PageBannerContent = withContext(
|
|
13
24
|
Primitive.div,
|
|
@@ -18,10 +18,13 @@ const TagGroupRoot = React.forwardRef(
|
|
|
18
18
|
({ className, children, separator = " · ", ...props }, ref) => {
|
|
19
19
|
const [{ tagGroup: tagGroupVariantProps, tagGroupItem: tagGroupItemVariantProps }, otherProps] = splitMultipleVariantsProps.splitMultipleVariantsProps(props, { tagGroup: tagGroup.tagGroup, tagGroupItem: tagGroupItem.tagGroupItem });
|
|
20
20
|
const classNames = tagGroup.tagGroup(tagGroupVariantProps);
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PropsProvider, { value: tagGroupItemVariantProps, children: /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.span, { ref, className: clsx(classNames.root, className), ...otherProps, children: React.Children.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PropsProvider, { value: tagGroupItemVariantProps, children: /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.span, { ref, className: clsx(classNames.root, className), ...otherProps, children: React.Children.toArray(children).filter((child) => child !== null && child !== void 0).map((child, index) => (
|
|
22
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: those fragments won't change order
|
|
23
|
+
/* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
24
|
+
index > 0 && /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.span, { "aria-hidden": true, className: classNames.separator, children: separator }),
|
|
25
|
+
child
|
|
26
|
+
] }, index)
|
|
27
|
+
)) }) });
|
|
25
28
|
}
|
|
26
29
|
);
|
|
27
30
|
const TagGroupItem = React.forwardRef((props, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,yCAAyC,CAAC;AASjD,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,wBAAwB,EACxB,cAAc,EACd,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACvC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,+
|
|
1
|
+
{"version":3,"file":"TagGroup.d.ts","sourceRoot":"","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,yCAAyC,CAAC;AASjD,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,wBAAwB,EACxB,cAAc,EACd,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACvC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,+GA0BxB,CAAC;AAEF,MAAM,WAAW,iBACf,SAAQ,wBAAwB,EAC9B,cAAc,EACd,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,YAAY,+GAOvB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx, jsxs
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { Primitive } from '@seed-design/react-primitive';
|
|
4
4
|
import { tagGroup } from '@seed-design/css/recipes/tag-group';
|
|
5
5
|
import { tagGroupItem } from '@seed-design/css/recipes/tag-group-item';
|
|
6
6
|
import { createRecipeContext } from '../../utils/createRecipeContext.js';
|
|
7
|
-
import { forwardRef, Children } from 'react';
|
|
7
|
+
import { forwardRef, Children, Fragment } from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import { splitMultipleVariantsProps } from '../../utils/splitMultipleVariantsProps.js';
|
|
10
10
|
import { mergeProps } from '@seed-design/dom-utils';
|
|
@@ -14,10 +14,13 @@ const TagGroupRoot = forwardRef(
|
|
|
14
14
|
({ className, children, separator = " · ", ...props }, ref) => {
|
|
15
15
|
const [{ tagGroup: tagGroupVariantProps, tagGroupItem: tagGroupItemVariantProps }, otherProps] = splitMultipleVariantsProps(props, { tagGroup, tagGroupItem });
|
|
16
16
|
const classNames = tagGroup(tagGroupVariantProps);
|
|
17
|
-
return /* @__PURE__ */ jsx(PropsProvider, { value: tagGroupItemVariantProps, children: /* @__PURE__ */ jsx(Primitive.span, { ref, className: clsx(classNames.root, className), ...otherProps, children: Children.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
return /* @__PURE__ */ jsx(PropsProvider, { value: tagGroupItemVariantProps, children: /* @__PURE__ */ jsx(Primitive.span, { ref, className: clsx(classNames.root, className), ...otherProps, children: Children.toArray(children).filter((child) => child !== null && child !== void 0).map((child, index) => (
|
|
18
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: those fragments won't change order
|
|
19
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
index > 0 && /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, className: classNames.separator, children: separator }),
|
|
21
|
+
child
|
|
22
|
+
] }, index)
|
|
23
|
+
)) }) });
|
|
21
24
|
}
|
|
22
25
|
);
|
|
23
26
|
const TagGroupItem = forwardRef((props, ref) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@seed-design/dom-utils": "1.0.0",
|
|
44
44
|
"@seed-design/react-avatar": "1.0.0",
|
|
45
45
|
"@seed-design/react-checkbox": "1.0.1",
|
|
46
|
-
"@seed-design/react-dialog": "1.0.
|
|
47
|
-
"@seed-design/react-drawer": "1.0.
|
|
46
|
+
"@seed-design/react-dialog": "1.0.1",
|
|
47
|
+
"@seed-design/react-drawer": "1.0.5",
|
|
48
48
|
"@seed-design/react-field": "1.0.1",
|
|
49
49
|
"@seed-design/react-field-button": "1.0.1",
|
|
50
50
|
"@seed-design/react-popover": "1.0.3",
|
|
@@ -57,13 +57,14 @@
|
|
|
57
57
|
"@seed-design/react-slider": "1.0.1",
|
|
58
58
|
"@seed-design/react-snackbar": "1.0.0",
|
|
59
59
|
"@seed-design/react-switch": "1.0.1",
|
|
60
|
-
"@seed-design/react-tabs": "1.0.
|
|
60
|
+
"@seed-design/react-tabs": "1.0.2",
|
|
61
61
|
"@seed-design/react-text-field": "1.1.1",
|
|
62
62
|
"@seed-design/react-toggle": "1.0.0",
|
|
63
63
|
"clsx": "^2.1.1",
|
|
64
64
|
"unicode-segmenter": "^0.14.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
+
"@seed-design/css": ">=1.1.12",
|
|
67
68
|
"react": ">=18.0.0",
|
|
68
69
|
"react-dom": ">=18.0.0"
|
|
69
70
|
},
|
|
@@ -113,12 +113,16 @@ export interface FieldCharacterCountProps
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export const FieldCharacterCount = forwardRef<HTMLDivElement, FieldCharacterCountProps>(
|
|
116
|
-
({ current, max, ...otherProps }, ref) => {
|
|
116
|
+
({ current, max, className, ...otherProps }, ref) => {
|
|
117
117
|
const classNames = useClassNames();
|
|
118
118
|
const { stateProps } = useFieldContext();
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
|
-
<Primitive.div
|
|
121
|
+
<Primitive.div
|
|
122
|
+
className={clsx(classNames.characterCountArea, className)}
|
|
123
|
+
ref={ref}
|
|
124
|
+
{...otherProps}
|
|
125
|
+
>
|
|
122
126
|
<span
|
|
123
127
|
{...(current === 0 ? { "data-empty": true } : {})}
|
|
124
128
|
{...(current > max ? { "data-exceeded": true } : {})}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
|
+
import { forwardRef } from "react";
|
|
2
3
|
|
|
3
4
|
import { pageBanner, type PageBannerVariantProps } from "@seed-design/css/recipes/page-banner";
|
|
4
5
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
@@ -8,16 +9,52 @@ import {
|
|
|
8
9
|
DismissibleRoot,
|
|
9
10
|
type DismissibleRootProps,
|
|
10
11
|
} from "../private/useDismissible";
|
|
12
|
+
import clsx from "clsx";
|
|
11
13
|
|
|
12
|
-
const { withContext,
|
|
14
|
+
const { withContext, ClassNamesProvider } = createSlotRecipeContext(pageBanner);
|
|
13
15
|
|
|
14
16
|
export interface PageBannerRootProps extends PageBannerVariantProps, DismissibleRootProps {}
|
|
15
17
|
|
|
16
|
-
export const PageBannerRoot =
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
export const PageBannerRoot = forwardRef<HTMLDivElement, PageBannerRootProps>(
|
|
19
|
+
({ className, ...props }, ref) => {
|
|
20
|
+
if (props.variant === "solid" && props.tone === "magic") {
|
|
21
|
+
console.error(
|
|
22
|
+
`\`${props.tone}\` tone is not available for \`${props.variant}\` variant in PageBanner components. Please use variant="weak" or a different tone instead.`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const [variantProps, otherProps] = pageBanner.splitVariantProps(props);
|
|
27
|
+
const classNames = pageBanner(variantProps);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ClassNamesProvider value={classNames}>
|
|
31
|
+
<DismissibleRoot className={clsx(classNames.root, className)} ref={ref} {...otherProps} />
|
|
32
|
+
</ClassNamesProvider>
|
|
33
|
+
);
|
|
34
|
+
},
|
|
19
35
|
);
|
|
20
36
|
|
|
37
|
+
// Use these instead when ts implements this:
|
|
38
|
+
// Control flow analysis for destructured rest element of discriminated union
|
|
39
|
+
// https://github.com/microsoft/TypeScript/issues/15300
|
|
40
|
+
|
|
41
|
+
// export type PageBannerRootProps = DismissibleRootProps &
|
|
42
|
+
// (
|
|
43
|
+
// | {
|
|
44
|
+
// variant?: Exclude<PageBannerVariantProps["variant"], "solid">;
|
|
45
|
+
// tone?: PageBannerVariantProps["tone"];
|
|
46
|
+
// }
|
|
47
|
+
// | {
|
|
48
|
+
// variant: Extract<PageBannerVariantProps["variant"], "solid">;
|
|
49
|
+
// tone?: Exclude<PageBannerVariantProps["tone"], "magic">;
|
|
50
|
+
// }
|
|
51
|
+
// );
|
|
52
|
+
|
|
53
|
+
// export const PageBannerRoot = withProvider<HTMLDivElement, PageBannerRootProps>(
|
|
54
|
+
// DismissibleRoot,
|
|
55
|
+
// "root",
|
|
56
|
+
// );
|
|
57
|
+
|
|
21
58
|
export interface PageBannerContentProps
|
|
22
59
|
extends PrimitiveProps,
|
|
23
60
|
React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type TagGroupItemVariantProps,
|
|
6
6
|
} from "@seed-design/css/recipes/tag-group-item";
|
|
7
7
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
8
|
-
import { forwardRef, Children } from "react";
|
|
8
|
+
import { forwardRef, Children, Fragment } from "react";
|
|
9
9
|
import clsx from "clsx";
|
|
10
10
|
import { splitMultipleVariantsProps } from "../../utils/splitMultipleVariantsProps";
|
|
11
11
|
import { mergeProps } from "@seed-design/dom-utils";
|
|
@@ -29,16 +29,19 @@ export const TagGroupRoot = forwardRef<HTMLSpanElement, TagGroupRootProps>(
|
|
|
29
29
|
return (
|
|
30
30
|
<PropsProvider value={tagGroupItemVariantProps}>
|
|
31
31
|
<Primitive.span ref={ref} className={clsx(classNames.root, className)} {...otherProps}>
|
|
32
|
-
{Children.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
{Children.toArray(children)
|
|
33
|
+
.filter((child) => child !== null && child !== undefined)
|
|
34
|
+
.map((child, index) => (
|
|
35
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: those fragments won't change order
|
|
36
|
+
<Fragment key={index}>
|
|
37
|
+
{index > 0 && (
|
|
38
|
+
<Primitive.span aria-hidden className={classNames.separator}>
|
|
39
|
+
{separator}
|
|
40
|
+
</Primitive.span>
|
|
41
|
+
)}
|
|
42
|
+
{child}
|
|
43
|
+
</Fragment>
|
|
44
|
+
))}
|
|
42
45
|
</Primitive.span>
|
|
43
46
|
</PropsProvider>
|
|
44
47
|
);
|