@cerberus-design/react 0.5.2-next-41ff124 → 0.5.2-next-f5feb6d
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/build/legacy/_tsup-dts-rollup.d.ts +4 -2
- package/build/legacy/{chunk-BJXUBNF2.js → chunk-5XNLWIZO.js} +9 -7
- package/build/legacy/chunk-5XNLWIZO.js.map +1 -0
- package/build/legacy/{chunk-6SAA3NUE.js → chunk-PEWG443T.js} +7 -3
- package/build/legacy/chunk-PEWG443T.js.map +1 -0
- package/build/legacy/components/Input.js +1 -1
- package/build/legacy/components/Tag.js +1 -1
- package/build/legacy/index.js +2 -2
- package/build/modern/_tsup-dts-rollup.d.ts +4 -2
- package/build/modern/{chunk-6SAA3NUE.js → chunk-PEWG443T.js} +7 -3
- package/build/modern/chunk-PEWG443T.js.map +1 -0
- package/build/modern/{chunk-23OSBT4M.js → chunk-SLIOCQBZ.js} +9 -7
- package/build/modern/chunk-SLIOCQBZ.js.map +1 -0
- package/build/modern/components/Input.js +1 -1
- package/build/modern/components/Tag.js +1 -1
- package/build/modern/index.js +2 -2
- package/package.json +3 -3
- package/src/components/Input.tsx +14 -3
- package/src/components/Tag.tsx +15 -15
- package/build/legacy/chunk-6SAA3NUE.js.map +0 -1
- package/build/legacy/chunk-BJXUBNF2.js.map +0 -1
- package/build/modern/chunk-23OSBT4M.js.map +0 -1
- package/build/modern/chunk-6SAA3NUE.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes } from 'react';
|
|
2
2
|
import { button } from '@cerberus/styled-system/recipes';
|
|
3
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import type { ConditionalValue } from '@cerberus/styled-system/types';
|
|
5
4
|
import { Context } from 'react';
|
|
6
5
|
import { ElementType } from 'react';
|
|
7
6
|
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
@@ -37,7 +36,8 @@ export { ButtonProps }
|
|
|
37
36
|
export { ButtonProps as ButtonProps_alias_1 }
|
|
38
37
|
|
|
39
38
|
declare type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
40
|
-
|
|
39
|
+
gradient?: never;
|
|
40
|
+
palette?: never;
|
|
41
41
|
onClick: () => void;
|
|
42
42
|
shape: 'pill';
|
|
43
43
|
usage: 'filled';
|
|
@@ -155,6 +155,8 @@ export { Input as Input_alias_1 }
|
|
|
155
155
|
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
156
156
|
describedBy?: string;
|
|
157
157
|
id: string;
|
|
158
|
+
startIcon?: ReactNode;
|
|
159
|
+
endIcon?: ReactNode;
|
|
158
160
|
}
|
|
159
161
|
export { InputBaseProps }
|
|
160
162
|
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
@@ -8,15 +8,11 @@ import { css, cx } from "@cerberus/styled-system/css";
|
|
|
8
8
|
import { iconButton, tag } from "@cerberus/styled-system/recipes";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
function Tag(props) {
|
|
11
|
-
const { shape: initShape, onClick, usage, ...nativeProps } = props;
|
|
11
|
+
const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props;
|
|
12
12
|
const palette = (props == null ? void 0 : props.palette) ?? "neutral";
|
|
13
13
|
const isClosable = Boolean(onClick);
|
|
14
14
|
const shape = isClosable ? "pill" : initShape;
|
|
15
|
-
const closableStyles = isClosable ?
|
|
16
|
-
bgColor: "action.bg.active",
|
|
17
|
-
color: "action.text.initial",
|
|
18
|
-
paddingInlineEnd: "0"
|
|
19
|
-
}) : "";
|
|
15
|
+
const closableStyles = isClosable ? closableCss : "";
|
|
20
16
|
return /* @__PURE__ */ jsxs(
|
|
21
17
|
"span",
|
|
22
18
|
{
|
|
@@ -24,6 +20,7 @@ function Tag(props) {
|
|
|
24
20
|
className: cx(
|
|
25
21
|
nativeProps.className,
|
|
26
22
|
tag({
|
|
23
|
+
gradient,
|
|
27
24
|
palette,
|
|
28
25
|
shape,
|
|
29
26
|
usage
|
|
@@ -49,8 +46,13 @@ function Tag(props) {
|
|
|
49
46
|
}
|
|
50
47
|
);
|
|
51
48
|
}
|
|
49
|
+
var closableCss = css({
|
|
50
|
+
bgColor: "action.bg.active",
|
|
51
|
+
color: "action.text.initial",
|
|
52
|
+
paddingInlineEnd: "0"
|
|
53
|
+
});
|
|
52
54
|
|
|
53
55
|
export {
|
|
54
56
|
Tag
|
|
55
57
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
58
|
+
//# sourceMappingURL=chunk-5XNLWIZO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Close } from '@cerberus/icons'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { iconButton, tag } from '@cerberus/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus/styled-system/types'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type TagRecipeProps = RecipeVariantProps<typeof tag>\n\nexport type StaticTagProps = HTMLAttributes<HTMLSpanElement> &\n TagRecipeProps & {\n onClick?: never\n }\n\nexport type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {\n gradient?: never\n palette?: never\n onClick: () => void\n shape: 'pill'\n usage: 'filled'\n}\n\nexport type TagProps = StaticTagProps | ClickableTagProps\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @definition [Tag docs](https://cerberus.digitalu.design/react/tags)\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(props: PropsWithChildren<TagProps>): JSX.Element {\n const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props\n const palette = props?.palette ?? 'neutral'\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const closableStyles = isClosable ? closableCss : ''\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\n gradient,\n palette,\n shape,\n usage,\n }),\n closableStyles,\n )}\n >\n {props.children}\n\n <Show when={isClosable}>\n <button\n aria-label=\"Close\"\n className={iconButton({\n palette: 'action',\n usage: 'filled',\n size: 'sm',\n })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n\nconst closableCss = css({\n bgColor: 'action.bg.active',\n color: 'action.text.initial',\n paddingInlineEnd: '0',\n})\n"],"mappings":";;;;;AACA,SAAS,aAAa;AAEtB,SAAS,KAAK,UAAU;AACxB,SAAS,YAAY,WAAW;AAyC5B,SAyBM,KAzBN;AARG,SAAS,IAAI,OAAiD;AACnE,QAAM,EAAE,OAAO,WAAW,UAAU,SAAS,OAAO,GAAG,YAAY,IAAI;AACvE,QAAM,WAAU,+BAAO,YAAW;AAClC,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,iBAAiB,aAAa,cAAc;AAElD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MAEC;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,WAAW;AAAA,cACpB,SAAS;AAAA,cACT,OAAO;AAAA,cACP,MAAM;AAAA,YACR,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,cAAc,IAAI;AAAA,EACtB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,kBAAkB;AACpB,CAAC;","names":[]}
|
|
@@ -11,10 +11,12 @@ import { input } from "@cerberus/styled-system/recipes";
|
|
|
11
11
|
import { cx } from "@cerberus/styled-system/css";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
function Input(props) {
|
|
14
|
-
const { describedBy, size, ...nativeProps } = props;
|
|
14
|
+
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props;
|
|
15
15
|
const inputStyles = input({ size });
|
|
16
16
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
17
|
+
const hasEndIcon = Boolean(endIcon);
|
|
17
18
|
return /* @__PURE__ */ jsxs("div", { className: inputStyles.root, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Show, { when: Boolean(startIcon), children: /* @__PURE__ */ jsx("span", { className: inputStyles.startIcon, children: startIcon }) }),
|
|
18
20
|
/* @__PURE__ */ jsx(
|
|
19
21
|
"input",
|
|
20
22
|
{
|
|
@@ -22,14 +24,16 @@ function Input(props) {
|
|
|
22
24
|
...fieldStates,
|
|
23
25
|
...describedBy && { "aria-describedby": describedBy },
|
|
24
26
|
...invalid && { "aria-invalid": true },
|
|
27
|
+
"data-start-icon": Boolean(startIcon),
|
|
25
28
|
className: cx("peer", nativeProps.className, inputStyles.input)
|
|
26
29
|
}
|
|
27
30
|
),
|
|
28
|
-
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(WarningFilled, { className: inputStyles.icon }) })
|
|
31
|
+
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(WarningFilled, { className: inputStyles.icon }) }),
|
|
32
|
+
/* @__PURE__ */ jsx(Show, { when: hasEndIcon && !invalid, children: /* @__PURE__ */ jsx("span", { className: inputStyles.icon, children: endIcon }) })
|
|
29
33
|
] });
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
export {
|
|
33
37
|
Input
|
|
34
38
|
};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-PEWG443T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes, ReactNode } from 'react'\nimport { WarningFilled } from '@cerberus/icons'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport type InputRecipeProps = RecipeVariantProps<typeof input>\nexport interface InputBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n startIcon?: ReactNode\n endIcon?: ReactNode\n}\nexport type InputProps = InputBaseProps & InputRecipeProps\n\nexport function Input(props: InputProps) {\n const { describedBy, size, startIcon, endIcon, ...nativeProps } = props\n const inputStyles = input({ size })\n const { invalid, ...fieldStates } = useFieldContext()\n const hasEndIcon = Boolean(endIcon)\n\n return (\n <div className={inputStyles.root}>\n <Show when={Boolean(startIcon)}>\n <span className={inputStyles.startIcon}>{startIcon}</span>\n </Show>\n\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n data-start-icon={Boolean(startIcon)}\n className={cx('peer', nativeProps.className, inputStyles.input)}\n />\n\n <Show when={invalid}>\n <WarningFilled className={inputStyles.icon} />\n </Show>\n <Show when={hasEndIcon && !invalid}>\n <span className={inputStyles.icon}>{endIcon}</span>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,UAAmC;AAqBxC,SAEI,KAFJ;AAPG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,aAAa,MAAM,WAAW,SAAS,GAAG,YAAY,IAAI;AAClE,QAAM,cAAc,MAAM,EAAE,KAAK,CAAC;AAClC,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AACpD,QAAM,aAAa,QAAQ,OAAO;AAElC,SACE,qBAAC,SAAI,WAAW,YAAY,MAC1B;AAAA,wBAAC,QAAK,MAAM,QAAQ,SAAS,GAC3B,8BAAC,UAAK,WAAW,YAAY,WAAY,qBAAU,GACrD;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,mBAAiB,QAAQ,SAAS;AAAA,QAClC,WAAW,GAAG,QAAQ,YAAY,WAAW,YAAY,KAAK;AAAA;AAAA,IAChE;AAAA,IAEA,oBAAC,QAAK,MAAM,SACV,8BAAC,iBAAc,WAAW,YAAY,MAAM,GAC9C;AAAA,IACA,oBAAC,QAAK,MAAM,cAAc,CAAC,SACzB,8BAAC,UAAK,WAAW,YAAY,MAAO,mBAAQ,GAC9C;AAAA,KACF;AAEJ;","names":[]}
|
package/build/legacy/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-YJCWUN33.js";
|
|
4
4
|
import {
|
|
5
5
|
Tag
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5XNLWIZO.js";
|
|
7
7
|
import {
|
|
8
8
|
Textarea
|
|
9
9
|
} from "./chunk-TCO46FK7.js";
|
|
10
10
|
import {
|
|
11
11
|
Input
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PEWG443T.js";
|
|
13
13
|
import {
|
|
14
14
|
Label
|
|
15
15
|
} from "./chunk-CINUA3C7.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes } from 'react';
|
|
2
2
|
import { button } from '@cerberus/styled-system/recipes';
|
|
3
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import type { ConditionalValue } from '@cerberus/styled-system/types';
|
|
5
4
|
import { Context } from 'react';
|
|
6
5
|
import { ElementType } from 'react';
|
|
7
6
|
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
@@ -37,7 +36,8 @@ export { ButtonProps }
|
|
|
37
36
|
export { ButtonProps as ButtonProps_alias_1 }
|
|
38
37
|
|
|
39
38
|
declare type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
40
|
-
|
|
39
|
+
gradient?: never;
|
|
40
|
+
palette?: never;
|
|
41
41
|
onClick: () => void;
|
|
42
42
|
shape: 'pill';
|
|
43
43
|
usage: 'filled';
|
|
@@ -155,6 +155,8 @@ export { Input as Input_alias_1 }
|
|
|
155
155
|
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
156
156
|
describedBy?: string;
|
|
157
157
|
id: string;
|
|
158
|
+
startIcon?: ReactNode;
|
|
159
|
+
endIcon?: ReactNode;
|
|
158
160
|
}
|
|
159
161
|
export { InputBaseProps }
|
|
160
162
|
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
@@ -11,10 +11,12 @@ import { input } from "@cerberus/styled-system/recipes";
|
|
|
11
11
|
import { cx } from "@cerberus/styled-system/css";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
function Input(props) {
|
|
14
|
-
const { describedBy, size, ...nativeProps } = props;
|
|
14
|
+
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props;
|
|
15
15
|
const inputStyles = input({ size });
|
|
16
16
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
17
|
+
const hasEndIcon = Boolean(endIcon);
|
|
17
18
|
return /* @__PURE__ */ jsxs("div", { className: inputStyles.root, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Show, { when: Boolean(startIcon), children: /* @__PURE__ */ jsx("span", { className: inputStyles.startIcon, children: startIcon }) }),
|
|
18
20
|
/* @__PURE__ */ jsx(
|
|
19
21
|
"input",
|
|
20
22
|
{
|
|
@@ -22,14 +24,16 @@ function Input(props) {
|
|
|
22
24
|
...fieldStates,
|
|
23
25
|
...describedBy && { "aria-describedby": describedBy },
|
|
24
26
|
...invalid && { "aria-invalid": true },
|
|
27
|
+
"data-start-icon": Boolean(startIcon),
|
|
25
28
|
className: cx("peer", nativeProps.className, inputStyles.input)
|
|
26
29
|
}
|
|
27
30
|
),
|
|
28
|
-
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(WarningFilled, { className: inputStyles.icon }) })
|
|
31
|
+
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(WarningFilled, { className: inputStyles.icon }) }),
|
|
32
|
+
/* @__PURE__ */ jsx(Show, { when: hasEndIcon && !invalid, children: /* @__PURE__ */ jsx("span", { className: inputStyles.icon, children: endIcon }) })
|
|
29
33
|
] });
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
export {
|
|
33
37
|
Input
|
|
34
38
|
};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-PEWG443T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes, ReactNode } from 'react'\nimport { WarningFilled } from '@cerberus/icons'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport type InputRecipeProps = RecipeVariantProps<typeof input>\nexport interface InputBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n startIcon?: ReactNode\n endIcon?: ReactNode\n}\nexport type InputProps = InputBaseProps & InputRecipeProps\n\nexport function Input(props: InputProps) {\n const { describedBy, size, startIcon, endIcon, ...nativeProps } = props\n const inputStyles = input({ size })\n const { invalid, ...fieldStates } = useFieldContext()\n const hasEndIcon = Boolean(endIcon)\n\n return (\n <div className={inputStyles.root}>\n <Show when={Boolean(startIcon)}>\n <span className={inputStyles.startIcon}>{startIcon}</span>\n </Show>\n\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n data-start-icon={Boolean(startIcon)}\n className={cx('peer', nativeProps.className, inputStyles.input)}\n />\n\n <Show when={invalid}>\n <WarningFilled className={inputStyles.icon} />\n </Show>\n <Show when={hasEndIcon && !invalid}>\n <span className={inputStyles.icon}>{endIcon}</span>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,UAAmC;AAqBxC,SAEI,KAFJ;AAPG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,aAAa,MAAM,WAAW,SAAS,GAAG,YAAY,IAAI;AAClE,QAAM,cAAc,MAAM,EAAE,KAAK,CAAC;AAClC,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AACpD,QAAM,aAAa,QAAQ,OAAO;AAElC,SACE,qBAAC,SAAI,WAAW,YAAY,MAC1B;AAAA,wBAAC,QAAK,MAAM,QAAQ,SAAS,GAC3B,8BAAC,UAAK,WAAW,YAAY,WAAY,qBAAU,GACrD;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,mBAAiB,QAAQ,SAAS;AAAA,QAClC,WAAW,GAAG,QAAQ,YAAY,WAAW,YAAY,KAAK;AAAA;AAAA,IAChE;AAAA,IAEA,oBAAC,QAAK,MAAM,SACV,8BAAC,iBAAc,WAAW,YAAY,MAAM,GAC9C;AAAA,IACA,oBAAC,QAAK,MAAM,cAAc,CAAC,SACzB,8BAAC,UAAK,WAAW,YAAY,MAAO,mBAAQ,GAC9C;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -8,15 +8,11 @@ import { css, cx } from "@cerberus/styled-system/css";
|
|
|
8
8
|
import { iconButton, tag } from "@cerberus/styled-system/recipes";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
function Tag(props) {
|
|
11
|
-
const { shape: initShape, onClick, usage, ...nativeProps } = props;
|
|
11
|
+
const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props;
|
|
12
12
|
const palette = props?.palette ?? "neutral";
|
|
13
13
|
const isClosable = Boolean(onClick);
|
|
14
14
|
const shape = isClosable ? "pill" : initShape;
|
|
15
|
-
const closableStyles = isClosable ?
|
|
16
|
-
bgColor: "action.bg.active",
|
|
17
|
-
color: "action.text.initial",
|
|
18
|
-
paddingInlineEnd: "0"
|
|
19
|
-
}) : "";
|
|
15
|
+
const closableStyles = isClosable ? closableCss : "";
|
|
20
16
|
return /* @__PURE__ */ jsxs(
|
|
21
17
|
"span",
|
|
22
18
|
{
|
|
@@ -24,6 +20,7 @@ function Tag(props) {
|
|
|
24
20
|
className: cx(
|
|
25
21
|
nativeProps.className,
|
|
26
22
|
tag({
|
|
23
|
+
gradient,
|
|
27
24
|
palette,
|
|
28
25
|
shape,
|
|
29
26
|
usage
|
|
@@ -49,8 +46,13 @@ function Tag(props) {
|
|
|
49
46
|
}
|
|
50
47
|
);
|
|
51
48
|
}
|
|
49
|
+
var closableCss = css({
|
|
50
|
+
bgColor: "action.bg.active",
|
|
51
|
+
color: "action.text.initial",
|
|
52
|
+
paddingInlineEnd: "0"
|
|
53
|
+
});
|
|
52
54
|
|
|
53
55
|
export {
|
|
54
56
|
Tag
|
|
55
57
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
58
|
+
//# sourceMappingURL=chunk-SLIOCQBZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Close } from '@cerberus/icons'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { iconButton, tag } from '@cerberus/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus/styled-system/types'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type TagRecipeProps = RecipeVariantProps<typeof tag>\n\nexport type StaticTagProps = HTMLAttributes<HTMLSpanElement> &\n TagRecipeProps & {\n onClick?: never\n }\n\nexport type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {\n gradient?: never\n palette?: never\n onClick: () => void\n shape: 'pill'\n usage: 'filled'\n}\n\nexport type TagProps = StaticTagProps | ClickableTagProps\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @definition [Tag docs](https://cerberus.digitalu.design/react/tags)\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(props: PropsWithChildren<TagProps>): JSX.Element {\n const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props\n const palette = props?.palette ?? 'neutral'\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const closableStyles = isClosable ? closableCss : ''\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\n gradient,\n palette,\n shape,\n usage,\n }),\n closableStyles,\n )}\n >\n {props.children}\n\n <Show when={isClosable}>\n <button\n aria-label=\"Close\"\n className={iconButton({\n palette: 'action',\n usage: 'filled',\n size: 'sm',\n })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n\nconst closableCss = css({\n bgColor: 'action.bg.active',\n color: 'action.text.initial',\n paddingInlineEnd: '0',\n})\n"],"mappings":";;;;;AACA,SAAS,aAAa;AAEtB,SAAS,KAAK,UAAU;AACxB,SAAS,YAAY,WAAW;AAyC5B,SAyBM,KAzBN;AARG,SAAS,IAAI,OAAiD;AACnE,QAAM,EAAE,OAAO,WAAW,UAAU,SAAS,OAAO,GAAG,YAAY,IAAI;AACvE,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,iBAAiB,aAAa,cAAc;AAElD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MAEC;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,WAAW;AAAA,cACpB,SAAS;AAAA,cACT,OAAO;AAAA,cACP,MAAM;AAAA,YACR,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,cAAc,IAAI;AAAA,EACtB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,kBAAkB;AACpB,CAAC;","names":[]}
|
package/build/modern/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-YJCWUN33.js";
|
|
4
4
|
import {
|
|
5
5
|
Tag
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SLIOCQBZ.js";
|
|
7
7
|
import {
|
|
8
8
|
Textarea
|
|
9
9
|
} from "./chunk-TCO46FK7.js";
|
|
10
10
|
import {
|
|
11
11
|
Input
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PEWG443T.js";
|
|
13
13
|
import {
|
|
14
14
|
Label
|
|
15
15
|
} from "./chunk-CINUA3C7.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.5.2-next-
|
|
3
|
+
"version": "0.5.2-next-f5feb6d",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"react": "^18",
|
|
22
22
|
"react-dom": "^18",
|
|
23
23
|
"tsup": "^8.1.0",
|
|
24
|
-
"@cerberus-design/
|
|
25
|
-
"@cerberus-design/
|
|
24
|
+
"@cerberus-design/configs": "0.0.0",
|
|
25
|
+
"@cerberus-design/styled-system": "0.5.2-next-f5feb6d"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
package/src/components/Input.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type { InputHTMLAttributes } from 'react'
|
|
3
|
+
import type { InputHTMLAttributes, ReactNode } from 'react'
|
|
4
4
|
import { WarningFilled } from '@cerberus/icons'
|
|
5
5
|
import { input } from '@cerberus/styled-system/recipes'
|
|
6
6
|
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
@@ -8,31 +8,42 @@ import { useFieldContext } from '../context/field'
|
|
|
8
8
|
import { Show } from './Show'
|
|
9
9
|
|
|
10
10
|
export type InputRecipeProps = RecipeVariantProps<typeof input>
|
|
11
|
-
|
|
12
11
|
export interface InputBaseProps
|
|
13
12
|
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
14
13
|
describedBy?: string
|
|
15
14
|
id: string
|
|
15
|
+
startIcon?: ReactNode
|
|
16
|
+
endIcon?: ReactNode
|
|
16
17
|
}
|
|
17
18
|
export type InputProps = InputBaseProps & InputRecipeProps
|
|
18
19
|
|
|
19
20
|
export function Input(props: InputProps) {
|
|
20
|
-
const { describedBy, size, ...nativeProps } = props
|
|
21
|
+
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props
|
|
21
22
|
const inputStyles = input({ size })
|
|
22
23
|
const { invalid, ...fieldStates } = useFieldContext()
|
|
24
|
+
const hasEndIcon = Boolean(endIcon)
|
|
23
25
|
|
|
24
26
|
return (
|
|
25
27
|
<div className={inputStyles.root}>
|
|
28
|
+
<Show when={Boolean(startIcon)}>
|
|
29
|
+
<span className={inputStyles.startIcon}>{startIcon}</span>
|
|
30
|
+
</Show>
|
|
31
|
+
|
|
26
32
|
<input
|
|
27
33
|
{...nativeProps}
|
|
28
34
|
{...fieldStates}
|
|
29
35
|
{...(describedBy && { 'aria-describedby': describedBy })}
|
|
30
36
|
{...(invalid && { 'aria-invalid': true })}
|
|
37
|
+
data-start-icon={Boolean(startIcon)}
|
|
31
38
|
className={cx('peer', nativeProps.className, inputStyles.input)}
|
|
32
39
|
/>
|
|
40
|
+
|
|
33
41
|
<Show when={invalid}>
|
|
34
42
|
<WarningFilled className={inputStyles.icon} />
|
|
35
43
|
</Show>
|
|
44
|
+
<Show when={hasEndIcon && !invalid}>
|
|
45
|
+
<span className={inputStyles.icon}>{endIcon}</span>
|
|
46
|
+
</Show>
|
|
36
47
|
</div>
|
|
37
48
|
)
|
|
38
49
|
}
|
package/src/components/Tag.tsx
CHANGED
|
@@ -3,10 +3,7 @@ import { Close } from '@cerberus/icons'
|
|
|
3
3
|
import { Show } from './Show'
|
|
4
4
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
5
5
|
import { iconButton, tag } from '@cerberus/styled-system/recipes'
|
|
6
|
-
import type {
|
|
7
|
-
ConditionalValue,
|
|
8
|
-
RecipeVariantProps,
|
|
9
|
-
} from '@cerberus/styled-system/types'
|
|
6
|
+
import type { RecipeVariantProps } from '@cerberus/styled-system/types'
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* This module contains the tag component.
|
|
@@ -14,18 +11,20 @@ import type {
|
|
|
14
11
|
*/
|
|
15
12
|
|
|
16
13
|
export type TagRecipeProps = RecipeVariantProps<typeof tag>
|
|
14
|
+
|
|
17
15
|
export type StaticTagProps = HTMLAttributes<HTMLSpanElement> &
|
|
18
16
|
TagRecipeProps & {
|
|
19
17
|
onClick?: never
|
|
20
18
|
}
|
|
19
|
+
|
|
21
20
|
export type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
>
|
|
21
|
+
gradient?: never
|
|
22
|
+
palette?: never
|
|
25
23
|
onClick: () => void
|
|
26
24
|
shape: 'pill'
|
|
27
25
|
usage: 'filled'
|
|
28
26
|
}
|
|
27
|
+
|
|
29
28
|
export type TagProps = StaticTagProps | ClickableTagProps
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -37,17 +36,11 @@ export type TagProps = StaticTagProps | ClickableTagProps
|
|
|
37
36
|
* ```
|
|
38
37
|
*/
|
|
39
38
|
export function Tag(props: PropsWithChildren<TagProps>): JSX.Element {
|
|
40
|
-
const { shape: initShape, onClick, usage, ...nativeProps } = props
|
|
39
|
+
const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props
|
|
41
40
|
const palette = props?.palette ?? 'neutral'
|
|
42
41
|
const isClosable = Boolean(onClick)
|
|
43
42
|
const shape = isClosable ? 'pill' : initShape
|
|
44
|
-
const closableStyles = isClosable
|
|
45
|
-
? css({
|
|
46
|
-
bgColor: 'action.bg.active',
|
|
47
|
-
color: 'action.text.initial',
|
|
48
|
-
paddingInlineEnd: '0',
|
|
49
|
-
})
|
|
50
|
-
: ''
|
|
43
|
+
const closableStyles = isClosable ? closableCss : ''
|
|
51
44
|
|
|
52
45
|
return (
|
|
53
46
|
<span
|
|
@@ -55,6 +48,7 @@ export function Tag(props: PropsWithChildren<TagProps>): JSX.Element {
|
|
|
55
48
|
className={cx(
|
|
56
49
|
nativeProps.className,
|
|
57
50
|
tag({
|
|
51
|
+
gradient,
|
|
58
52
|
palette,
|
|
59
53
|
shape,
|
|
60
54
|
usage,
|
|
@@ -80,3 +74,9 @@ export function Tag(props: PropsWithChildren<TagProps>): JSX.Element {
|
|
|
80
74
|
</span>
|
|
81
75
|
)
|
|
82
76
|
}
|
|
77
|
+
|
|
78
|
+
const closableCss = css({
|
|
79
|
+
bgColor: 'action.bg.active',
|
|
80
|
+
color: 'action.text.initial',
|
|
81
|
+
paddingInlineEnd: '0',
|
|
82
|
+
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes } from 'react'\nimport { WarningFilled } from '@cerberus/icons'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport type InputRecipeProps = RecipeVariantProps<typeof input>\n\nexport interface InputBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n}\nexport type InputProps = InputBaseProps & InputRecipeProps\n\nexport function Input(props: InputProps) {\n const { describedBy, size, ...nativeProps } = props\n const inputStyles = input({ size })\n const { invalid, ...fieldStates } = useFieldContext()\n\n return (\n <div className={inputStyles.root}>\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', nativeProps.className, inputStyles.input)}\n />\n <Show when={invalid}>\n <WarningFilled className={inputStyles.icon} />\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,UAAmC;AAmBxC,SACE,KADF;AANG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,aAAa,MAAM,GAAG,YAAY,IAAI;AAC9C,QAAM,cAAc,MAAM,EAAE,KAAK,CAAC;AAClC,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AAEpD,SACE,qBAAC,SAAI,WAAW,YAAY,MAC1B;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,GAAG,QAAQ,YAAY,WAAW,YAAY,KAAK;AAAA;AAAA,IAChE;AAAA,IACA,oBAAC,QAAK,MAAM,SACV,8BAAC,iBAAc,WAAW,YAAY,MAAM,GAC9C;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Close } from '@cerberus/icons'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { iconButton, tag } from '@cerberus/styled-system/recipes'\nimport type {\n ConditionalValue,\n RecipeVariantProps,\n} from '@cerberus/styled-system/types'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type TagRecipeProps = RecipeVariantProps<typeof tag>\nexport type StaticTagProps = HTMLAttributes<HTMLSpanElement> &\n TagRecipeProps & {\n onClick?: never\n }\nexport type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {\n palette?: ConditionalValue<\n 'neutral' | 'info' | 'success' | 'warning' | 'danger'\n >\n onClick: () => void\n shape: 'pill'\n usage: 'filled'\n}\nexport type TagProps = StaticTagProps | ClickableTagProps\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @definition [Tag docs](https://cerberus.digitalu.design/react/tags)\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(props: PropsWithChildren<TagProps>): JSX.Element {\n const { shape: initShape, onClick, usage, ...nativeProps } = props\n const palette = props?.palette ?? 'neutral'\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const closableStyles = isClosable\n ? css({\n bgColor: 'action.bg.active',\n color: 'action.text.initial',\n paddingInlineEnd: '0',\n })\n : ''\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\n palette,\n shape,\n usage,\n }),\n closableStyles,\n )}\n >\n {props.children}\n\n <Show when={isClosable}>\n <button\n aria-label=\"Close\"\n className={iconButton({\n palette: 'action',\n usage: 'filled',\n size: 'sm',\n })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,aAAa;AAEtB,SAAS,KAAK,UAAU;AACxB,SAAS,YAAY,WAAW;AAgD5B,SAwBM,KAxBN;AAdG,SAAS,IAAI,OAAiD;AACnE,QAAM,EAAE,OAAO,WAAW,SAAS,OAAO,GAAG,YAAY,IAAI;AAC7D,QAAM,WAAU,+BAAO,YAAW;AAClC,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,iBAAiB,aACnB,IAAI;AAAA,IACF,SAAS;AAAA,IACT,OAAO;AAAA,IACP,kBAAkB;AAAA,EACpB,CAAC,IACD;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MAEC;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,WAAW;AAAA,cACpB,SAAS;AAAA,cACT,OAAO;AAAA,cACP,MAAM;AAAA,YACR,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Close } from '@cerberus/icons'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { iconButton, tag } from '@cerberus/styled-system/recipes'\nimport type {\n ConditionalValue,\n RecipeVariantProps,\n} from '@cerberus/styled-system/types'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type TagRecipeProps = RecipeVariantProps<typeof tag>\nexport type StaticTagProps = HTMLAttributes<HTMLSpanElement> &\n TagRecipeProps & {\n onClick?: never\n }\nexport type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {\n palette?: ConditionalValue<\n 'neutral' | 'info' | 'success' | 'warning' | 'danger'\n >\n onClick: () => void\n shape: 'pill'\n usage: 'filled'\n}\nexport type TagProps = StaticTagProps | ClickableTagProps\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @definition [Tag docs](https://cerberus.digitalu.design/react/tags)\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(props: PropsWithChildren<TagProps>): JSX.Element {\n const { shape: initShape, onClick, usage, ...nativeProps } = props\n const palette = props?.palette ?? 'neutral'\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const closableStyles = isClosable\n ? css({\n bgColor: 'action.bg.active',\n color: 'action.text.initial',\n paddingInlineEnd: '0',\n })\n : ''\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\n palette,\n shape,\n usage,\n }),\n closableStyles,\n )}\n >\n {props.children}\n\n <Show when={isClosable}>\n <button\n aria-label=\"Close\"\n className={iconButton({\n palette: 'action',\n usage: 'filled',\n size: 'sm',\n })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,aAAa;AAEtB,SAAS,KAAK,UAAU;AACxB,SAAS,YAAY,WAAW;AAgD5B,SAwBM,KAxBN;AAdG,SAAS,IAAI,OAAiD;AACnE,QAAM,EAAE,OAAO,WAAW,SAAS,OAAO,GAAG,YAAY,IAAI;AAC7D,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,iBAAiB,aACnB,IAAI;AAAA,IACF,SAAS;AAAA,IACT,OAAO;AAAA,IACP,kBAAkB;AAAA,EACpB,CAAC,IACD;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MAEC;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,WAAW;AAAA,cACpB,SAAS;AAAA,cACT,OAAO;AAAA,cACP,MAAM;AAAA,YACR,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes } from 'react'\nimport { WarningFilled } from '@cerberus/icons'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport type InputRecipeProps = RecipeVariantProps<typeof input>\n\nexport interface InputBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n}\nexport type InputProps = InputBaseProps & InputRecipeProps\n\nexport function Input(props: InputProps) {\n const { describedBy, size, ...nativeProps } = props\n const inputStyles = input({ size })\n const { invalid, ...fieldStates } = useFieldContext()\n\n return (\n <div className={inputStyles.root}>\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', nativeProps.className, inputStyles.input)}\n />\n <Show when={invalid}>\n <WarningFilled className={inputStyles.icon} />\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,UAAmC;AAmBxC,SACE,KADF;AANG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,aAAa,MAAM,GAAG,YAAY,IAAI;AAC9C,QAAM,cAAc,MAAM,EAAE,KAAK,CAAC;AAClC,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AAEpD,SACE,qBAAC,SAAI,WAAW,YAAY,MAC1B;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,GAAG,QAAQ,YAAY,WAAW,YAAY,KAAK;AAAA;AAAA,IAChE;AAAA,IACA,oBAAC,QAAK,MAAM,SACV,8BAAC,iBAAc,WAAW,YAAY,MAAM,GAC9C;AAAA,KACF;AAEJ;","names":[]}
|