@seed-design/react 0.2.0 → 0.2.1

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.
@@ -7,27 +7,36 @@ const chip = require('@seed-design/css/recipes/chip');
7
7
  const reactPrimitive = require('@seed-design/react-primitive');
8
8
  const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
9
9
  const Icon = require('../Icon/Icon.cjs');
10
+ const createWithStateProps = require('../../utils/createWithStateProps.cjs');
11
+ const reactCheckbox = require('@seed-design/react-checkbox');
12
+ const reactRadioGroup = require('@seed-design/react-radio-group');
10
13
 
11
14
  const { withProvider, withContext } = createSlotRecipeContext.createSlotRecipeContext(chip.chip);
15
+ const withStateProps = createWithStateProps.createWithStateProps([reactCheckbox.useCheckboxContext, reactRadioGroup.useRadioGroupItemContext], {
16
+ strict: false
17
+ });
12
18
  const ChipRoot = Icon.withIconRequired(
13
19
  withProvider(reactPrimitive.Primitive.button, "root"),
14
20
  (props) => props.layout === "iconOnly"
15
21
  );
16
22
  ChipRoot.displayName = "Chip.Root";
17
- const ChipLabel = withContext(reactPrimitive.Primitive.span, "label");
23
+ const ChipLabel = withContext(
24
+ withStateProps(reactPrimitive.Primitive.span),
25
+ "label"
26
+ );
18
27
  ChipLabel.displayName = "Chip.Label";
19
28
  const ChipPrefixIcon = withContext(
20
- reactPrimitive.Primitive.div,
29
+ withStateProps(reactPrimitive.Primitive.div),
21
30
  "prefixIcon"
22
31
  );
23
32
  ChipPrefixIcon.displayName = "Chip.PrefixIcon";
24
33
  const ChipPrefixAvatar = withContext(
25
- reactPrimitive.Primitive.div,
34
+ withStateProps(reactPrimitive.Primitive.div),
26
35
  "prefixAvatar"
27
36
  );
28
37
  ChipPrefixAvatar.displayName = "Chip.PrefixAvatar";
29
38
  const ChipSuffixIcon = withContext(
30
- reactPrimitive.Primitive.div,
39
+ withStateProps(reactPrimitive.Primitive.div),
31
40
  "suffixIcon"
32
41
  );
33
42
  ChipSuffixIcon.displayName = "Chip.SuffixIcon";
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAQpC,MAAM,WAAW,aACf,SAAQ,cAAc,EACpB,gBAAgB,EAChB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpD,eAAO,MAAM,QAAQ,+IAGpB,CAAC;AAKF,MAAM,WAAW,cAAe,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAEhG,eAAO,MAAM,SAAS,wFAAwE,CAAC;AAK/F,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AACpG,eAAO,MAAM,cAAc,4FAG1B,CAAC;AAKF,MAAM,WAAW,qBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,gBAAgB,8FAG5B,CAAC;AAKF,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AACpG,eAAO,MAAM,cAAc,4FAG1B,CAAC"}
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAcpC,MAAM,WAAW,aACf,SAAQ,cAAc,EACpB,gBAAgB,EAChB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpD,eAAO,MAAM,QAAQ,+IAGpB,CAAC;AAKF,MAAM,WAAW,cAAe,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAEhG,eAAO,MAAM,SAAS,wFAGrB,CAAC;AAKF,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AACpG,eAAO,MAAM,cAAc,4FAG1B,CAAC;AAKF,MAAM,WAAW,qBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,gBAAgB,8FAG5B,CAAC;AAKF,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AACpG,eAAO,MAAM,cAAc,4FAG1B,CAAC"}
@@ -3,27 +3,36 @@ import { chip } from '@seed-design/css/recipes/chip';
3
3
  import { Primitive } from '@seed-design/react-primitive';
4
4
  import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
5
5
  import { withIconRequired } from '../Icon/Icon.js';
6
+ import { createWithStateProps } from '../../utils/createWithStateProps.js';
7
+ import { useCheckboxContext } from '@seed-design/react-checkbox';
8
+ import { useRadioGroupItemContext } from '@seed-design/react-radio-group';
6
9
 
7
10
  const { withProvider, withContext } = createSlotRecipeContext(chip);
11
+ const withStateProps = createWithStateProps([useCheckboxContext, useRadioGroupItemContext], {
12
+ strict: false
13
+ });
8
14
  const ChipRoot = withIconRequired(
9
15
  withProvider(Primitive.button, "root"),
10
16
  (props) => props.layout === "iconOnly"
11
17
  );
12
18
  ChipRoot.displayName = "Chip.Root";
13
- const ChipLabel = withContext(Primitive.span, "label");
19
+ const ChipLabel = withContext(
20
+ withStateProps(Primitive.span),
21
+ "label"
22
+ );
14
23
  ChipLabel.displayName = "Chip.Label";
15
24
  const ChipPrefixIcon = withContext(
16
- Primitive.div,
25
+ withStateProps(Primitive.div),
17
26
  "prefixIcon"
18
27
  );
19
28
  ChipPrefixIcon.displayName = "Chip.PrefixIcon";
20
29
  const ChipPrefixAvatar = withContext(
21
- Primitive.div,
30
+ withStateProps(Primitive.div),
22
31
  "prefixAvatar"
23
32
  );
24
33
  ChipPrefixAvatar.displayName = "Chip.PrefixAvatar";
25
34
  const ChipSuffixIcon = withContext(
26
- Primitive.div,
35
+ withStateProps(Primitive.div),
27
36
  "suffixIcon"
28
37
  );
29
38
  ChipSuffixIcon.displayName = "Chip.SuffixIcon";
@@ -9,4 +9,5 @@ const Chip = require('./Chip.cjs');
9
9
  exports.Label = Chip.ChipLabel;
10
10
  exports.PrefixAvatar = Chip.ChipPrefixAvatar;
11
11
  exports.PrefixIcon = Chip.ChipPrefixIcon;
12
+ exports.Root = Chip.ChipRoot;
12
13
  exports.SuffixIcon = Chip.ChipSuffixIcon;
@@ -1,2 +1,2 @@
1
- export { ChipLabel as Label, ChipPrefixIcon as PrefixIcon, ChipPrefixAvatar as PrefixAvatar, ChipSuffixIcon as SuffixIcon, type ChipLabelProps as LabelProps, type ChipPrefixIconProps as PrefixIconProps, type ChipPrefixAvatarProps as PrefixAvatarProps, type ChipSuffixIconProps as SuffixIconProps, } from './Chip';
1
+ export { ChipRoot as Root, ChipLabel as Label, ChipPrefixIcon as PrefixIcon, ChipPrefixAvatar as PrefixAvatar, ChipSuffixIcon as SuffixIcon, type ChipRootProps as RootProps, type ChipLabelProps as LabelProps, type ChipPrefixIconProps as PrefixIconProps, type ChipPrefixAvatarProps as PrefixAvatarProps, type ChipSuffixIconProps as SuffixIconProps, } from './Chip';
2
2
  //# sourceMappingURL=Chip.namespace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,IAAI,KAAK,EAClB,cAAc,IAAI,UAAU,EAC5B,gBAAgB,IAAI,YAAY,EAChC,cAAc,IAAI,UAAU,EAC5B,KAAK,cAAc,IAAI,UAAU,EACjC,KAAK,mBAAmB,IAAI,eAAe,EAC3C,KAAK,qBAAqB,IAAI,iBAAiB,EAC/C,KAAK,mBAAmB,IAAI,eAAe,GAC5C,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"Chip.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,IAAI,EAChB,SAAS,IAAI,KAAK,EAClB,cAAc,IAAI,UAAU,EAC5B,gBAAgB,IAAI,YAAY,EAChC,cAAc,IAAI,UAAU,EAC5B,KAAK,aAAa,IAAI,SAAS,EAC/B,KAAK,cAAc,IAAI,UAAU,EACjC,KAAK,mBAAmB,IAAI,eAAe,EAC3C,KAAK,qBAAqB,IAAI,iBAAiB,EAC/C,KAAK,mBAAmB,IAAI,eAAe,GAC5C,MAAM,QAAQ,CAAC"}
@@ -1 +1 @@
1
- export { ChipLabel as Label, ChipPrefixAvatar as PrefixAvatar, ChipPrefixIcon as PrefixIcon, ChipSuffixIcon as SuffixIcon } from './Chip.js';
1
+ export { ChipLabel as Label, ChipPrefixAvatar as PrefixAvatar, ChipPrefixIcon as PrefixIcon, ChipRoot as Root, ChipSuffixIcon as SuffixIcon } from './Chip.js';
@@ -29,7 +29,7 @@ const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
29
29
  const Divider = React__namespace.forwardRef((props, ref) => {
30
30
  const {
31
31
  as = "hr",
32
- color = "stroke.neutral",
32
+ color = "stroke.neutralMuted",
33
33
  thickness = 1,
34
34
  orientation = "horizontal",
35
35
  role,
@@ -9,7 +9,7 @@ export interface DividerProps {
9
9
  */
10
10
  as?: "hr" | "div" | "li";
11
11
  /**
12
- * @default "stroke.neutral"
12
+ * @default "stroke.neutralMuted"
13
13
  */
14
14
  color?: BoxProps["borderColor"];
15
15
  /**
@@ -6,7 +6,7 @@ import { Box } from '../Box/Box.js';
6
6
  const Divider = React.forwardRef((props, ref) => {
7
7
  const {
8
8
  as = "hr",
9
- color = "stroke.neutral",
9
+ color = "stroke.neutralMuted",
10
10
  thickness = 1,
11
11
  orientation = "horizontal",
12
12
  role,
@@ -2,7 +2,7 @@ import { FlexProps } from '../Flex';
2
2
  import * as React from "react";
3
3
  export interface ResponsivePairProps extends Omit<FlexProps, "flexDirection" | "flexWrap"> {
4
4
  /**
5
- * @default wrap-reverse
5
+ * @default "wrap-reverse"
6
6
  */
7
7
  wrap?: "wrap" | "wrap-reverse";
8
8
  children: [React.ReactNode, React.ReactNode];
@@ -7,7 +7,7 @@ const jsxRuntime = require('react/jsx-runtime');
7
7
  const React = require('react');
8
8
 
9
9
  function createWithStateProps(useContexts, options) {
10
- const strict = true;
10
+ const strict = options?.strict ?? true;
11
11
  return function withStateProps(Component) {
12
12
  const Node = React.forwardRef((props, ref) => {
13
13
  const stateProps = {};
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
 
5
5
  function createWithStateProps(useContexts, options) {
6
- const strict = true;
6
+ const strict = options?.strict ?? true;
7
7
  return function withStateProps(Component) {
8
8
  const Node = forwardRef((props, ref) => {
9
9
  const stateProps = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-design/react",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/daangn/seed-design.git",
@@ -58,12 +58,12 @@
58
58
  "clsx": "^2.1.1"
59
59
  },
60
60
  "peerDependencies": {
61
- "@seed-design/css": "0.2.0",
61
+ "@seed-design/css": "0.2.1",
62
62
  "react": ">=18.0.0",
63
63
  "react-dom": ">=18.0.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@seed-design/css": "0.2.0",
66
+ "@seed-design/css": "0.2.1",
67
67
  "@vitejs/plugin-react": "^5.0.0",
68
68
  "ajv": "^8.17.1",
69
69
  "globby": "^14.1.0",
@@ -1,8 +1,10 @@
1
1
  export {
2
+ ChipRoot as Root,
2
3
  ChipLabel as Label,
3
4
  ChipPrefixIcon as PrefixIcon,
4
5
  ChipPrefixAvatar as PrefixAvatar,
5
6
  ChipSuffixIcon as SuffixIcon,
7
+ type ChipRootProps as RootProps,
6
8
  type ChipLabelProps as LabelProps,
7
9
  type ChipPrefixIconProps as PrefixIconProps,
8
10
  type ChipPrefixAvatarProps as PrefixAvatarProps,
@@ -3,8 +3,14 @@ import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
3
3
  import type * as React from "react";
4
4
  import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
5
5
  import { withIconRequired } from "../Icon/Icon";
6
+ import { createWithStateProps } from "../../utils/createWithStateProps";
7
+ import { useCheckboxContext } from "@seed-design/react-checkbox";
8
+ import { useRadioGroupItemContext } from "@seed-design/react-radio-group";
6
9
 
7
10
  const { withProvider, withContext } = createSlotRecipeContext(chip);
11
+ const withStateProps = createWithStateProps([useCheckboxContext, useRadioGroupItemContext], {
12
+ strict: false,
13
+ });
8
14
 
9
15
  ////////////////////////////////////////////////////////////////////////////////////
10
16
 
@@ -23,14 +29,17 @@ ChipRoot.displayName = "Chip.Root";
23
29
 
24
30
  export interface ChipLabelProps extends PrimitiveProps, React.HTMLAttributes<HTMLSpanElement> {}
25
31
 
26
- export const ChipLabel = withContext<HTMLSpanElement, ChipLabelProps>(Primitive.span, "label");
32
+ export const ChipLabel = withContext<HTMLSpanElement, ChipLabelProps>(
33
+ withStateProps(Primitive.span),
34
+ "label",
35
+ );
27
36
  ChipLabel.displayName = "Chip.Label";
28
37
 
29
38
  ////////////////////////////////////////////////////////////////////////////////////
30
39
 
31
40
  export interface ChipPrefixIconProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {}
32
41
  export const ChipPrefixIcon = withContext<HTMLDivElement, ChipPrefixIconProps>(
33
- Primitive.div,
42
+ withStateProps(Primitive.div),
34
43
  "prefixIcon",
35
44
  );
36
45
  ChipPrefixIcon.displayName = "Chip.PrefixIcon";
@@ -42,7 +51,7 @@ export interface ChipPrefixAvatarProps
42
51
  React.HTMLAttributes<HTMLDivElement> {}
43
52
 
44
53
  export const ChipPrefixAvatar = withContext<HTMLDivElement, ChipPrefixAvatarProps>(
45
- Primitive.div,
54
+ withStateProps(Primitive.div),
46
55
  "prefixAvatar",
47
56
  );
48
57
  ChipPrefixAvatar.displayName = "Chip.PrefixAvatar";
@@ -51,7 +60,7 @@ ChipPrefixAvatar.displayName = "Chip.PrefixAvatar";
51
60
 
52
61
  export interface ChipSuffixIconProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {}
53
62
  export const ChipSuffixIcon = withContext<HTMLDivElement, ChipSuffixIconProps>(
54
- Primitive.div,
63
+ withStateProps(Primitive.div),
55
64
  "suffixIcon",
56
65
  );
57
66
  ChipSuffixIcon.displayName = "Chip.SuffixIcon";
@@ -11,7 +11,7 @@ export interface DividerProps {
11
11
  as?: "hr" | "div" | "li";
12
12
 
13
13
  /**
14
- * @default "stroke.neutral"
14
+ * @default "stroke.neutralMuted"
15
15
  */
16
16
  color?: BoxProps["borderColor"];
17
17
 
@@ -31,7 +31,7 @@ export interface DividerProps {
31
31
  export const Divider = React.forwardRef<HTMLHRElement, DividerProps>((props, ref) => {
32
32
  const {
33
33
  as = "hr",
34
- color = "stroke.neutral",
34
+ color = "stroke.neutralMuted",
35
35
  thickness = 1,
36
36
  orientation = "horizontal",
37
37
  role,
@@ -5,7 +5,7 @@ import { Flex, type FlexProps } from "../Flex";
5
5
 
6
6
  export interface ResponsivePairProps extends Omit<FlexProps, "flexDirection" | "flexWrap"> {
7
7
  /**
8
- * @default wrap-reverse
8
+ * @default "wrap-reverse"
9
9
  */
10
10
  wrap?: "wrap" | "wrap-reverse";
11
11