@seed-design/react 0.1.8 → 0.1.9

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.
@@ -29,10 +29,10 @@ const CheckSelectBoxContent = withContext(
29
29
  "content"
30
30
  );
31
31
  const CheckSelectBoxLabel = withContext(
32
- withStateProps(reactPrimitive.Primitive.span),
32
+ withStateProps(reactPrimitive.Primitive.div),
33
33
  "label"
34
34
  );
35
- const CheckSelectBoxDescription = withContext(withStateProps(reactPrimitive.Primitive.span), "description");
35
+ const CheckSelectBoxDescription = withContext(withStateProps(reactPrimitive.Primitive.div), "description");
36
36
  const CheckSelectBoxControl = withContext(
37
37
  reactCheckbox.Checkbox.Control,
38
38
  "checkboxControl"
@@ -1 +1 @@
1
- {"version":3,"file":"CheckSelectBox.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/CheckSelectBox.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAsB,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9E,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMvE,MAAM,WAAW,wBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qHAI/B,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB,CAAC,SAAS;CAAG;AAE/E,eAAO,MAAM,kBAAkB,sHAG9B,CAAC;AAEF,MAAM,WAAW,0BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,qBAAqB,uHAGjC,CAAC;AAEF,MAAM,WAAW,wBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM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F,MAAM,WAAW,8BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,yBAAyB,4HAGS,CAAC;AAEhD,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB,CAAC,YAAY;CAAG;AAErF,eAAO,MAAM,qBAAqB,uHAGjC,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;CAAG;AAErE,eAAO,MAAM,kBAAkB,mHAG9B,CAAC;AAEF,MAAM,WAAW,8BAA+B,SAAQ,iBAAiB,CAAC,gBAAgB;CAAG;AAE7F,eAAO,MAAM,yBAAyB,iIAAgC,CAAC"}
@@ -25,10 +25,10 @@ const CheckSelectBoxContent = withContext(
25
25
  "content"
26
26
  );
27
27
  const CheckSelectBoxLabel = withContext(
28
- withStateProps(Primitive.span),
28
+ withStateProps(Primitive.div),
29
29
  "label"
30
30
  );
31
- const CheckSelectBoxDescription = withContext(withStateProps(Primitive.span), "description");
31
+ const CheckSelectBoxDescription = withContext(withStateProps(Primitive.div), "description");
32
32
  const CheckSelectBoxControl = withContext(
33
33
  Checkbox.Control,
34
34
  "checkboxControl"
@@ -27,10 +27,10 @@ const RadioSelectBoxContent = withContext(
27
27
  "content"
28
28
  );
29
29
  const RadioSelectBoxLabel = withContext(
30
- withStateProps(reactPrimitive.Primitive.span),
30
+ withStateProps(reactPrimitive.Primitive.div),
31
31
  "label"
32
32
  );
33
- const RadioSelectBoxDescription = withContext(withStateProps(reactPrimitive.Primitive.span), "description");
33
+ const RadioSelectBoxDescription = withContext(withStateProps(reactPrimitive.Primitive.div), "description");
34
34
  const RadioSelectBoxControl = withContext(
35
35
  reactRadioGroup.RadioGroup.ItemControl,
36
36
  "radioControl"
@@ -1 +1 @@
1
- {"version":3,"file":"RadioSelectBox.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/RadioSelectBox.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAa,KAAK,cAAc,EAAE,MAA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M,gCAAgC,CAAC;AAIxC,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMvE,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB,CAAC,SAAS;CAAG;AAEjF,eAAO,MAAM,kBAAkB,oHAE9B,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB,CAAC,SAAS;CAAG;AAEjF,eAAO,MAAM,kBAAkB,sHAG9B,CAAC;AAEF,MAAM,WAAW,0BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,qBAAqB,uHAGjC,CAAC;AAEF,MAAM,WAAW,wBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,mBAAmB,sHAG/B,CAAC;AAEF,MAAM,WAAW,8BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,yBAAyB,4HAGS,CAAC;AAEhD,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB,CAAC,gBAAgB;CAAG;AAE3F,eAAO,MAAM,qBAAqB,uHAGjC,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;CAAG;AAErE,eAAO,MAAM,kBAAkB,mHAG9B,CAAC;AAEF,MAAM,WAAW,8BAA+B,SAAQ,mBAAmB,CAAC,oBAAoB;CAAG;AAEnG,eAAO,MAAM,yBAAyB,uIAAsC,CAAC"}
@@ -23,10 +23,10 @@ const RadioSelectBoxContent = withContext(
23
23
  "content"
24
24
  );
25
25
  const RadioSelectBoxLabel = withContext(
26
- withStateProps(Primitive.span),
26
+ withStateProps(Primitive.div),
27
27
  "label"
28
28
  );
29
- const RadioSelectBoxDescription = withContext(withStateProps(Primitive.span), "description");
29
+ const RadioSelectBoxDescription = withContext(withStateProps(Primitive.div), "description");
30
30
  const RadioSelectBoxControl = withContext(
31
31
  RadioGroup.ItemControl,
32
32
  "radioControl"
@@ -3,17 +3,32 @@
3
3
 
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
+ const jsxRuntime = require('react/jsx-runtime');
6
7
  const reactSwitch = require('@seed-design/react-switch');
7
8
  const _switch = require('@seed-design/css/recipes/switch');
8
9
  const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
9
10
  const reactPrimitive = require('@seed-design/react-primitive');
10
11
  const createWithStateProps = require('../../utils/createWithStateProps.cjs');
12
+ const React = require('react');
13
+ const clsx = require('clsx');
11
14
 
12
- const { withProvider, withContext } = createSlotRecipeContext.createSlotRecipeContext(_switch.switchStyle);
15
+ const { withContext, ClassNamesProvider } = createSlotRecipeContext.createSlotRecipeContext(_switch.switchStyle);
13
16
  const withStateProps = createWithStateProps.createWithStateProps([reactSwitch.useSwitchContext]);
14
- const SwitchRoot = withProvider(
15
- reactSwitch.Switch.Root,
16
- "root"
17
+ const SwitchRoot = React.forwardRef(
18
+ ({ size: propSize, className, ...otherProps }, ref) => {
19
+ const classNames = _switch.switchStyle({
20
+ // TODO: remove this mapping completely
21
+ size: propSize === "small" ? "16" : propSize === "medium" ? "32" : propSize
22
+ });
23
+ return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(
24
+ reactSwitch.Switch.Root,
25
+ {
26
+ ref,
27
+ className: clsx(classNames.root, className),
28
+ ...otherProps
29
+ }
30
+ ) });
31
+ }
17
32
  );
18
33
  const SwitchControl = withContext(
19
34
  reactSwitch.Switch.Control,
@@ -1,20 +1,26 @@
1
1
  import { Switch as SwitchPrimitive } from '@seed-design/react-switch';
2
2
  import { SwitchVariantProps } from '@seed-design/css/recipes/switch';
3
3
  import { PrimitiveProps } from '@seed-design/react-primitive';
4
- import { ForwardRefExoticComponent, RefAttributes } from 'react';
5
- export interface SwitchRootProps extends SwitchVariantProps, SwitchPrimitive.RootProps {
4
+ import { default as React } from 'react';
5
+ /**
6
+ * @deprecated Use `16` or `32` instead of `small` or `medium`.
7
+ */
8
+ type SwitchVariantDeprecatedSizeProps = "small" | "medium";
9
+ export interface SwitchRootProps extends Omit<SwitchVariantProps, "size">, SwitchPrimitive.RootProps {
10
+ size?: SwitchVariantProps["size"] | SwitchVariantDeprecatedSizeProps;
6
11
  }
7
- export declare const SwitchRoot: ForwardRefExoticComponent<SwitchRootProps & RefAttributes<HTMLLabelElement>>;
12
+ export declare const SwitchRoot: React.ForwardRefExoticComponent<SwitchRootProps & React.RefAttributes<HTMLLabelElement>>;
8
13
  export interface SwitchControlProps extends SwitchPrimitive.ControlProps {
9
14
  }
10
- export declare const SwitchControl: ForwardRefExoticComponent<SwitchControlProps & RefAttributes<HTMLDivElement>>;
15
+ export declare const SwitchControl: React.ForwardRefExoticComponent<SwitchControlProps & React.RefAttributes<HTMLDivElement>>;
11
16
  export interface SwitchThumbProps extends SwitchPrimitive.ThumbProps {
12
17
  }
13
- export declare const SwitchThumb: ForwardRefExoticComponent<SwitchThumbProps & RefAttributes<HTMLDivElement>>;
18
+ export declare const SwitchThumb: React.ForwardRefExoticComponent<SwitchThumbProps & React.RefAttributes<HTMLDivElement>>;
14
19
  export interface SwitchLabelProps extends PrimitiveProps, React.HTMLAttributes<HTMLSpanElement> {
15
20
  }
16
- export declare const SwitchLabel: ForwardRefExoticComponent<SwitchLabelProps & RefAttributes<HTMLSpanElement>>;
21
+ export declare const SwitchLabel: React.ForwardRefExoticComponent<SwitchLabelProps & React.RefAttributes<HTMLSpanElement>>;
17
22
  export interface SwitchHiddenInputProps extends SwitchPrimitive.HiddenInputProps {
18
23
  }
19
- export declare const SwitchHiddenInput: ForwardRefExoticComponent<SwitchPrimitive.HiddenInputProps & RefAttributes<HTMLInputElement>>;
24
+ export declare const SwitchHiddenInput: React.ForwardRefExoticComponent<SwitchPrimitive.HiddenInputProps & React.RefAttributes<HTMLInputElement>>;
25
+ export {};
20
26
  //# sourceMappingURL=Switch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAoB,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAEvF,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQ9E,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,eAAe,CAAC,SAAS;CAAG;AAEzF,eAAO,MAAM,UAAU,8GAGtB,CAAC;AAIF,MAAM,WAAW,kBAAmB,SAAQ,eAAe,CAAC,YAAY;CAAG;AAE3E,eAAO,MAAM,aAAa,+GAGzB,CAAC;AAIF,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC,UAAU;CAAG;AAEvE,eAAO,MAAM,WAAW,6GAGvB,CAAC;AAIF,MAAM,WAAW,gBAAiB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAElG,eAAO,MAAM,WAAW,8GAGvB,CAAC;AAIF,MAAM,WAAW,sBAAuB,SAAQ,eAAe,CAAC,gBAAgB;CAAG;AAEnF,eAAO,MAAM,iBAAiB,+HAA8B,CAAC"}
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAoB,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAEvF,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B;;GAEG;AACH,KAAK,gCAAgC,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,EACtC,eAAe,CAAC,SAAS;IAC3B,IAAI,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,gCAAgC,CAAC;CACtE;AAED,eAAO,MAAM,UAAU,0FAiBtB,CAAC;AAaF,MAAM,WAAW,kBAAmB,SAAQ,eAAe,CAAC,YAAY;CAAG;AAE3E,eAAO,MAAM,aAAa,2FAGzB,CAAC;AAIF,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC,UAAU;CAAG;AAEvE,eAAO,MAAM,WAAW,yFAGvB,CAAC;AAIF,MAAM,WAAW,gBAAiB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAElG,eAAO,MAAM,WAAW,0FAGvB,CAAC;AAIF,MAAM,WAAW,sBAAuB,SAAQ,eAAe,CAAC,gBAAgB;CAAG;AAEnF,eAAO,MAAM,iBAAiB,2GAA8B,CAAC"}
@@ -1,15 +1,30 @@
1
1
  'use client';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
  import { Switch, useSwitchContext } from '@seed-design/react-switch';
3
4
  import { switchStyle } from '@seed-design/css/recipes/switch';
4
5
  import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
5
6
  import { Primitive } from '@seed-design/react-primitive';
6
7
  import { createWithStateProps } from '../../utils/createWithStateProps.js';
8
+ import React__default from 'react';
9
+ import clsx from 'clsx';
7
10
 
8
- const { withProvider, withContext } = createSlotRecipeContext(switchStyle);
11
+ const { withContext, ClassNamesProvider } = createSlotRecipeContext(switchStyle);
9
12
  const withStateProps = createWithStateProps([useSwitchContext]);
10
- const SwitchRoot = withProvider(
11
- Switch.Root,
12
- "root"
13
+ const SwitchRoot = React__default.forwardRef(
14
+ ({ size: propSize, className, ...otherProps }, ref) => {
15
+ const classNames = switchStyle({
16
+ // TODO: remove this mapping completely
17
+ size: propSize === "small" ? "16" : propSize === "medium" ? "32" : propSize
18
+ });
19
+ return /* @__PURE__ */ jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsx(
20
+ Switch.Root,
21
+ {
22
+ ref,
23
+ className: clsx(classNames.root, className),
24
+ ...otherProps
25
+ }
26
+ ) });
27
+ }
13
28
  );
14
29
  const SwitchControl = withContext(
15
30
  Switch.Control,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-design/react",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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.1.8",
61
+ "@seed-design/css": "0.1.9",
62
62
  "react": ">=18.0.0",
63
63
  "react-dom": ">=18.0.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@seed-design/css": "0.1.8",
66
+ "@seed-design/css": "0.1.9",
67
67
  "@vitejs/plugin-react": "^4.4.1",
68
68
  "ajv": "^8.17.1",
69
69
  "globby": "^14.1.0",
@@ -47,7 +47,7 @@ export interface CheckSelectBoxLabelProps
47
47
  React.HTMLAttributes<HTMLSpanElement> {}
48
48
 
49
49
  export const CheckSelectBoxLabel = withContext<HTMLSpanElement, CheckSelectBoxLabelProps>(
50
- withStateProps(Primitive.span),
50
+ withStateProps(Primitive.div),
51
51
  "label",
52
52
  );
53
53
 
@@ -58,7 +58,7 @@ export interface CheckSelectBoxDescriptionProps
58
58
  export const CheckSelectBoxDescription = withContext<
59
59
  HTMLSpanElement,
60
60
  CheckSelectBoxDescriptionProps
61
- >(withStateProps(Primitive.span), "description");
61
+ >(withStateProps(Primitive.div), "description");
62
62
 
63
63
  export interface CheckSelectBoxControlProps extends CheckboxPrimitive.ControlProps {}
64
64
 
@@ -41,7 +41,7 @@ export interface RadioSelectBoxLabelProps
41
41
  React.HTMLAttributes<HTMLSpanElement> {}
42
42
 
43
43
  export const RadioSelectBoxLabel = withContext<HTMLSpanElement, RadioSelectBoxLabelProps>(
44
- withStateProps(Primitive.span),
44
+ withStateProps(Primitive.div),
45
45
  "label",
46
46
  );
47
47
 
@@ -52,7 +52,7 @@ export interface RadioSelectBoxDescriptionProps
52
52
  export const RadioSelectBoxDescription = withContext<
53
53
  HTMLSpanElement,
54
54
  RadioSelectBoxDescriptionProps
55
- >(withStateProps(Primitive.span), "description");
55
+ >(withStateProps(Primitive.div), "description");
56
56
 
57
57
  export interface RadioSelectBoxControlProps extends RadioGroupPrimitive.ItemControlProps {}
58
58
 
@@ -3,19 +3,53 @@ import { switchStyle, type SwitchVariantProps } from "@seed-design/css/recipes/s
3
3
  import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
4
4
  import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
5
5
  import { createWithStateProps } from "../../utils/createWithStateProps";
6
+ import React from "react";
7
+ import clsx from "clsx";
6
8
 
7
- const { withProvider, withContext } = createSlotRecipeContext(switchStyle);
9
+ const { withContext, ClassNamesProvider } = createSlotRecipeContext(switchStyle);
8
10
  const withStateProps = createWithStateProps([useSwitchContext]);
9
11
 
10
12
  ////////////////////////////////////////////////////////////////////////////////////
11
13
 
12
- export interface SwitchRootProps extends SwitchVariantProps, SwitchPrimitive.RootProps {}
13
-
14
- export const SwitchRoot = withProvider<HTMLLabelElement, SwitchRootProps>(
15
- SwitchPrimitive.Root,
16
- "root",
14
+ /**
15
+ * @deprecated Use `16` or `32` instead of `small` or `medium`.
16
+ */
17
+ type SwitchVariantDeprecatedSizeProps = "small" | "medium";
18
+
19
+ export interface SwitchRootProps
20
+ extends Omit<SwitchVariantProps, "size">,
21
+ SwitchPrimitive.RootProps {
22
+ size?: SwitchVariantProps["size"] | SwitchVariantDeprecatedSizeProps;
23
+ }
24
+
25
+ export const SwitchRoot = React.forwardRef<HTMLLabelElement, SwitchRootProps>(
26
+ ({ size: propSize, className, ...otherProps }, ref) => {
27
+ const classNames = switchStyle({
28
+ // TODO: remove this mapping completely
29
+ size: propSize === "small" ? "16" : propSize === "medium" ? "32" : propSize,
30
+ });
31
+
32
+ return (
33
+ <ClassNamesProvider value={classNames}>
34
+ <SwitchPrimitive.Root
35
+ ref={ref}
36
+ className={clsx(classNames.root, className)}
37
+ {...otherProps}
38
+ />
39
+ </ClassNamesProvider>
40
+ );
41
+ },
17
42
  );
18
43
 
44
+ // XXX: use when the deprecated size props are removed
45
+
46
+ // export interface SwitchRootProps extends SwitchVariantProps, SwitchPrimitive.RootProps {}
47
+
48
+ // export const SwitchRoot = withProvider<HTMLLabelElement, SwitchRootProps>(
49
+ // SwitchPrimitive.Root,
50
+ // "root",
51
+ // );
52
+
19
53
  ////////////////////////////////////////////////////////////////////////////////////
20
54
 
21
55
  export interface SwitchControlProps extends SwitchPrimitive.ControlProps {}