@cerberus-design/react 0.5.2-next-fc705e1 → 0.5.2-next-94987e7
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 +19 -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-AAKHV2IO.js} +13 -6
- package/build/legacy/chunk-AAKHV2IO.js.map +1 -0
- package/build/legacy/chunk-LQD23PG3.js +24 -0
- package/build/legacy/chunk-LQD23PG3.js.map +1 -0
- package/build/legacy/chunk-RK5HK6UU.js +10 -0
- package/build/legacy/chunk-RK5HK6UU.js.map +1 -0
- package/build/{modern/chunk-CINUA3C7.js → legacy/chunk-V4SA6GNO.js} +4 -4
- package/build/legacy/components/Input.js +4 -2
- package/build/legacy/components/Label.js +2 -2
- package/build/legacy/components/Tag.js +1 -1
- package/build/legacy/config/cerbIcons.js +7 -0
- package/build/legacy/config/cerbIcons.js.map +1 -0
- package/build/legacy/config/defineIcons.js +10 -0
- package/build/legacy/config/defineIcons.js.map +1 -0
- package/build/legacy/index.js +26 -19
- package/build/modern/_tsup-dts-rollup.d.ts +19 -2
- package/build/modern/{chunk-6SAA3NUE.js → chunk-AAKHV2IO.js} +13 -6
- package/build/modern/chunk-AAKHV2IO.js.map +1 -0
- package/build/modern/chunk-LQD23PG3.js +24 -0
- package/build/modern/chunk-LQD23PG3.js.map +1 -0
- package/build/modern/chunk-RK5HK6UU.js +10 -0
- package/build/modern/chunk-RK5HK6UU.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/{legacy/chunk-CINUA3C7.js → modern/chunk-V4SA6GNO.js} +4 -4
- package/build/modern/components/Input.js +4 -2
- package/build/modern/components/Label.js +2 -2
- package/build/modern/components/Tag.js +1 -1
- package/build/modern/config/cerbIcons.js +7 -0
- package/build/modern/config/cerbIcons.js.map +1 -0
- package/build/modern/config/defineIcons.js +10 -0
- package/build/modern/config/defineIcons.js.map +1 -0
- package/build/modern/index.js +26 -19
- package/package.json +2 -2
- package/src/components/Input.tsx +17 -5
- package/src/components/Tag.tsx +15 -15
- package/src/config/cerbIcons.ts +10 -0
- package/src/config/defineIcons.ts +19 -0
- package/src/index.ts +4 -0
- 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
- /package/build/legacy/{chunk-CINUA3C7.js.map → chunk-V4SA6GNO.js.map} +0 -0
- /package/build/modern/{chunk-CINUA3C7.js.map → chunk-V4SA6GNO.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes } from 'react';
|
|
2
2
|
import { button } from '@cerberus/styled-system/recipes';
|
|
3
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import { CarbonIconType } from '@cerberus/icons';
|
|
5
5
|
import { Context } from 'react';
|
|
6
6
|
import { ElementType } from 'react';
|
|
7
7
|
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
@@ -20,6 +20,10 @@ import { RefObject } from 'react';
|
|
|
20
20
|
import { tag } from '@cerberus/styled-system/recipes';
|
|
21
21
|
import type { TextareaHTMLAttributes } from 'react';
|
|
22
22
|
|
|
23
|
+
declare let $cerberusIcons: DefinedIcons;
|
|
24
|
+
export { $cerberusIcons }
|
|
25
|
+
export { $cerberusIcons as $cerberusIcons_alias_1 }
|
|
26
|
+
|
|
23
27
|
/**
|
|
24
28
|
* A component that allows the user to perform actions
|
|
25
29
|
* @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Button.tsx
|
|
@@ -37,7 +41,8 @@ export { ButtonProps }
|
|
|
37
41
|
export { ButtonProps as ButtonProps_alias_1 }
|
|
38
42
|
|
|
39
43
|
declare type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
40
|
-
|
|
44
|
+
gradient?: never;
|
|
45
|
+
palette?: never;
|
|
41
46
|
onClick: () => void;
|
|
42
47
|
shape: 'pill';
|
|
43
48
|
usage: 'filled';
|
|
@@ -57,10 +62,20 @@ declare type CustomThemes<K extends string = DefaultThemes> = 'cerberus' | K;
|
|
|
57
62
|
export { CustomThemes }
|
|
58
63
|
export { CustomThemes as CustomThemes_alias_1 }
|
|
59
64
|
|
|
65
|
+
export declare const defaultIcons: DefinedIcons;
|
|
66
|
+
|
|
60
67
|
declare type DefaultThemes = 'cerberus';
|
|
61
68
|
export { DefaultThemes }
|
|
62
69
|
export { DefaultThemes as DefaultThemes_alias_1 }
|
|
63
70
|
|
|
71
|
+
export declare interface DefinedIcons {
|
|
72
|
+
invalid: CarbonIconType | ElementType;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare function defineIcons(icons: DefinedIcons): DefinedIcons;
|
|
76
|
+
export { defineIcons }
|
|
77
|
+
export { defineIcons as defineIcons_alias_1 }
|
|
78
|
+
|
|
64
79
|
declare function Field(props: PropsWithChildren<FieldContextValue>): JSX.Element;
|
|
65
80
|
export { Field }
|
|
66
81
|
export { Field as Field_alias_1 }
|
|
@@ -155,6 +170,8 @@ export { Input as Input_alias_1 }
|
|
|
155
170
|
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
156
171
|
describedBy?: string;
|
|
157
172
|
id: string;
|
|
173
|
+
startIcon?: ReactNode;
|
|
174
|
+
endIcon?: ReactNode;
|
|
158
175
|
}
|
|
159
176
|
export { InputBaseProps }
|
|
160
177
|
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":[]}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useFieldContext
|
|
3
|
+
} from "./chunk-ZAU4JVLL.js";
|
|
1
4
|
import {
|
|
2
5
|
Show
|
|
3
6
|
} from "./chunk-4O4QFF4S.js";
|
|
4
7
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
$cerberusIcons
|
|
9
|
+
} from "./chunk-LQD23PG3.js";
|
|
7
10
|
|
|
8
11
|
// src/components/Input.tsx
|
|
9
|
-
import { WarningFilled } from "@cerberus/icons";
|
|
10
12
|
import { input } from "@cerberus/styled-system/recipes";
|
|
11
13
|
import { cx } from "@cerberus/styled-system/css";
|
|
12
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
15
|
function Input(props) {
|
|
14
|
-
const { describedBy, size, ...nativeProps } = props;
|
|
16
|
+
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props;
|
|
15
17
|
const inputStyles = input({ size });
|
|
16
18
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
19
|
+
const hasEndIcon = Boolean(endIcon);
|
|
20
|
+
const { invalid: InvalidIcon } = $cerberusIcons;
|
|
17
21
|
return /* @__PURE__ */ jsxs("div", { className: inputStyles.root, children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Show, { when: Boolean(startIcon), children: /* @__PURE__ */ jsx("span", { className: inputStyles.startIcon, children: startIcon }) }),
|
|
18
23
|
/* @__PURE__ */ jsx(
|
|
19
24
|
"input",
|
|
20
25
|
{
|
|
@@ -22,14 +27,16 @@ function Input(props) {
|
|
|
22
27
|
...fieldStates,
|
|
23
28
|
...describedBy && { "aria-describedby": describedBy },
|
|
24
29
|
...invalid && { "aria-invalid": true },
|
|
30
|
+
"data-start-icon": Boolean(startIcon),
|
|
25
31
|
className: cx("peer", nativeProps.className, inputStyles.input)
|
|
26
32
|
}
|
|
27
33
|
),
|
|
28
|
-
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(
|
|
34
|
+
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(InvalidIcon, { className: inputStyles.icon }) }),
|
|
35
|
+
/* @__PURE__ */ jsx(Show, { when: hasEndIcon && !invalid, children: /* @__PURE__ */ jsx("span", { className: inputStyles.icon, children: endIcon }) })
|
|
29
36
|
] });
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
export {
|
|
33
40
|
Input
|
|
34
41
|
};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-AAKHV2IO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes, ReactNode } from 'react'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { $cerberusIcons } from '../config/defineIcons'\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 const { invalid: InvalidIcon } = $cerberusIcons\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 <InvalidIcon 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,aAAa;AACtB,SAAS,UAAmC;AAuBxC,SAEI,KAFJ;AARG,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;AAClC,QAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,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,eAAY,WAAW,YAAY,MAAM,GAC5C;AAAA,IACA,oBAAC,QAAK,MAAM,cAAc,CAAC,SACzB,8BAAC,UAAK,WAAW,YAAY,MAAO,mBAAQ,GAC9C;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultIcons
|
|
3
|
+
} from "./chunk-RK5HK6UU.js";
|
|
4
|
+
|
|
5
|
+
// src/config/defineIcons.ts
|
|
6
|
+
function _validateIconsProperties(icons) {
|
|
7
|
+
if (!icons.invalid) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"The an invalid property must be defined in your custom icons library."
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function defineIcons(icons) {
|
|
14
|
+
_validateIconsProperties(icons);
|
|
15
|
+
$cerberusIcons = icons;
|
|
16
|
+
return $cerberusIcons;
|
|
17
|
+
}
|
|
18
|
+
var $cerberusIcons = defaultIcons;
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
defineIcons,
|
|
22
|
+
$cerberusIcons
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-LQD23PG3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/defineIcons.ts"],"sourcesContent":["import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): DefinedIcons {\n _validateIconsProperties(icons)\n $cerberusIcons = icons\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons: DefinedIcons = defaultIcons\n"],"mappings":";;;;;AAEA,SAAS,yBAAyB,OAAqB;AACrD,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,YAAY,OAAmC;AAC7D,2BAAyB,KAAK;AAC9B,mBAAiB;AACjB,SAAO;AACT;AAIO,IAAI,iBAA+B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/cerbIcons.ts"],"sourcesContent":["import { WarningFilled, type CarbonIconType } from '@cerberus/icons'\nimport type { ElementType } from 'react'\n\nexport interface DefinedIcons {\n invalid: CarbonIconType | ElementType\n}\n\nexport const defaultIcons: DefinedIcons = {\n invalid: WarningFilled,\n}\n"],"mappings":";AAAA,SAAS,qBAA0C;AAO5C,IAAM,eAA6B;AAAA,EACxC,SAAS;AACX;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Show
|
|
3
|
-
} from "./chunk-4O4QFF4S.js";
|
|
4
1
|
import {
|
|
5
2
|
useFieldContext
|
|
6
3
|
} from "./chunk-ZAU4JVLL.js";
|
|
4
|
+
import {
|
|
5
|
+
Show
|
|
6
|
+
} from "./chunk-4O4QFF4S.js";
|
|
7
7
|
|
|
8
8
|
// src/components/Label.tsx
|
|
9
9
|
import { label } from "@cerberus/styled-system/recipes";
|
|
@@ -45,4 +45,4 @@ function Label(props) {
|
|
|
45
45
|
export {
|
|
46
46
|
Label
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-V4SA6GNO.js.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Input
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-4O4QFF4S.js";
|
|
4
|
+
} from "../chunk-AAKHV2IO.js";
|
|
6
5
|
import "../chunk-ZAU4JVLL.js";
|
|
6
|
+
import "../chunk-4O4QFF4S.js";
|
|
7
|
+
import "../chunk-LQD23PG3.js";
|
|
8
|
+
import "../chunk-RK5HK6UU.js";
|
|
7
9
|
export {
|
|
8
10
|
Input
|
|
9
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/legacy/index.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Tab
|
|
3
|
+
} from "./chunk-YA2UV2AB.js";
|
|
4
|
+
import {
|
|
5
|
+
TabList
|
|
6
|
+
} from "./chunk-5GSXIYD3.js";
|
|
1
7
|
import {
|
|
2
8
|
TabPanel
|
|
3
9
|
} from "./chunk-YJCWUN33.js";
|
|
4
10
|
import {
|
|
5
11
|
Tag
|
|
6
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5XNLWIZO.js";
|
|
7
13
|
import {
|
|
8
14
|
Textarea
|
|
9
15
|
} from "./chunk-TCO46FK7.js";
|
|
16
|
+
import {
|
|
17
|
+
FieldMessage
|
|
18
|
+
} from "./chunk-VGHVH2T3.js";
|
|
19
|
+
import {
|
|
20
|
+
IconButton
|
|
21
|
+
} from "./chunk-SLHX5K6I.js";
|
|
10
22
|
import {
|
|
11
23
|
Input
|
|
12
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-AAKHV2IO.js";
|
|
13
25
|
import {
|
|
14
26
|
Label
|
|
15
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-V4SA6GNO.js";
|
|
28
|
+
import {
|
|
29
|
+
Field,
|
|
30
|
+
useFieldContext
|
|
31
|
+
} from "./chunk-ZAU4JVLL.js";
|
|
16
32
|
import {
|
|
17
33
|
NavMenuLink
|
|
18
34
|
} from "./chunk-6DIGPXAD.js";
|
|
@@ -30,12 +46,6 @@ import {
|
|
|
30
46
|
import {
|
|
31
47
|
Show
|
|
32
48
|
} from "./chunk-4O4QFF4S.js";
|
|
33
|
-
import {
|
|
34
|
-
Tab
|
|
35
|
-
} from "./chunk-YA2UV2AB.js";
|
|
36
|
-
import {
|
|
37
|
-
TabList
|
|
38
|
-
} from "./chunk-5GSXIYD3.js";
|
|
39
49
|
import "./chunk-55J6XMHW.js";
|
|
40
50
|
import {
|
|
41
51
|
createNavTriggerProps
|
|
@@ -48,6 +58,11 @@ import {
|
|
|
48
58
|
TabsContext,
|
|
49
59
|
useTabsContext
|
|
50
60
|
} from "./chunk-DQOYTLGB.js";
|
|
61
|
+
import {
|
|
62
|
+
$cerberusIcons,
|
|
63
|
+
defineIcons
|
|
64
|
+
} from "./chunk-LQD23PG3.js";
|
|
65
|
+
import "./chunk-RK5HK6UU.js";
|
|
51
66
|
import {
|
|
52
67
|
MODE_KEY,
|
|
53
68
|
THEME_KEY,
|
|
@@ -58,17 +73,8 @@ import {
|
|
|
58
73
|
import {
|
|
59
74
|
Button
|
|
60
75
|
} from "./chunk-2ATICEW3.js";
|
|
61
|
-
import {
|
|
62
|
-
FieldMessage
|
|
63
|
-
} from "./chunk-VGHVH2T3.js";
|
|
64
|
-
import {
|
|
65
|
-
Field,
|
|
66
|
-
useFieldContext
|
|
67
|
-
} from "./chunk-ZAU4JVLL.js";
|
|
68
|
-
import {
|
|
69
|
-
IconButton
|
|
70
|
-
} from "./chunk-SLHX5K6I.js";
|
|
71
76
|
export {
|
|
77
|
+
$cerberusIcons,
|
|
72
78
|
Button,
|
|
73
79
|
Field,
|
|
74
80
|
FieldMessage,
|
|
@@ -91,6 +97,7 @@ export {
|
|
|
91
97
|
Textarea,
|
|
92
98
|
ThemeProvider,
|
|
93
99
|
createNavTriggerProps,
|
|
100
|
+
defineIcons,
|
|
94
101
|
getPosition,
|
|
95
102
|
useFieldContext,
|
|
96
103
|
useNavMenuContext,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes } from 'react';
|
|
2
2
|
import { button } from '@cerberus/styled-system/recipes';
|
|
3
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import { CarbonIconType } from '@cerberus/icons';
|
|
5
5
|
import { Context } from 'react';
|
|
6
6
|
import { ElementType } from 'react';
|
|
7
7
|
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
@@ -20,6 +20,10 @@ import { RefObject } from 'react';
|
|
|
20
20
|
import { tag } from '@cerberus/styled-system/recipes';
|
|
21
21
|
import type { TextareaHTMLAttributes } from 'react';
|
|
22
22
|
|
|
23
|
+
declare let $cerberusIcons: DefinedIcons;
|
|
24
|
+
export { $cerberusIcons }
|
|
25
|
+
export { $cerberusIcons as $cerberusIcons_alias_1 }
|
|
26
|
+
|
|
23
27
|
/**
|
|
24
28
|
* A component that allows the user to perform actions
|
|
25
29
|
* @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Button.tsx
|
|
@@ -37,7 +41,8 @@ export { ButtonProps }
|
|
|
37
41
|
export { ButtonProps as ButtonProps_alias_1 }
|
|
38
42
|
|
|
39
43
|
declare type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
40
|
-
|
|
44
|
+
gradient?: never;
|
|
45
|
+
palette?: never;
|
|
41
46
|
onClick: () => void;
|
|
42
47
|
shape: 'pill';
|
|
43
48
|
usage: 'filled';
|
|
@@ -57,10 +62,20 @@ declare type CustomThemes<K extends string = DefaultThemes> = 'cerberus' | K;
|
|
|
57
62
|
export { CustomThemes }
|
|
58
63
|
export { CustomThemes as CustomThemes_alias_1 }
|
|
59
64
|
|
|
65
|
+
export declare const defaultIcons: DefinedIcons;
|
|
66
|
+
|
|
60
67
|
declare type DefaultThemes = 'cerberus';
|
|
61
68
|
export { DefaultThemes }
|
|
62
69
|
export { DefaultThemes as DefaultThemes_alias_1 }
|
|
63
70
|
|
|
71
|
+
export declare interface DefinedIcons {
|
|
72
|
+
invalid: CarbonIconType | ElementType;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare function defineIcons(icons: DefinedIcons): DefinedIcons;
|
|
76
|
+
export { defineIcons }
|
|
77
|
+
export { defineIcons as defineIcons_alias_1 }
|
|
78
|
+
|
|
64
79
|
declare function Field(props: PropsWithChildren<FieldContextValue>): JSX.Element;
|
|
65
80
|
export { Field }
|
|
66
81
|
export { Field as Field_alias_1 }
|
|
@@ -155,6 +170,8 @@ export { Input as Input_alias_1 }
|
|
|
155
170
|
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
156
171
|
describedBy?: string;
|
|
157
172
|
id: string;
|
|
173
|
+
startIcon?: ReactNode;
|
|
174
|
+
endIcon?: ReactNode;
|
|
158
175
|
}
|
|
159
176
|
export { InputBaseProps }
|
|
160
177
|
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useFieldContext
|
|
3
|
+
} from "./chunk-ZAU4JVLL.js";
|
|
1
4
|
import {
|
|
2
5
|
Show
|
|
3
6
|
} from "./chunk-4O4QFF4S.js";
|
|
4
7
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
$cerberusIcons
|
|
9
|
+
} from "./chunk-LQD23PG3.js";
|
|
7
10
|
|
|
8
11
|
// src/components/Input.tsx
|
|
9
|
-
import { WarningFilled } from "@cerberus/icons";
|
|
10
12
|
import { input } from "@cerberus/styled-system/recipes";
|
|
11
13
|
import { cx } from "@cerberus/styled-system/css";
|
|
12
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
15
|
function Input(props) {
|
|
14
|
-
const { describedBy, size, ...nativeProps } = props;
|
|
16
|
+
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props;
|
|
15
17
|
const inputStyles = input({ size });
|
|
16
18
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
19
|
+
const hasEndIcon = Boolean(endIcon);
|
|
20
|
+
const { invalid: InvalidIcon } = $cerberusIcons;
|
|
17
21
|
return /* @__PURE__ */ jsxs("div", { className: inputStyles.root, children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Show, { when: Boolean(startIcon), children: /* @__PURE__ */ jsx("span", { className: inputStyles.startIcon, children: startIcon }) }),
|
|
18
23
|
/* @__PURE__ */ jsx(
|
|
19
24
|
"input",
|
|
20
25
|
{
|
|
@@ -22,14 +27,16 @@ function Input(props) {
|
|
|
22
27
|
...fieldStates,
|
|
23
28
|
...describedBy && { "aria-describedby": describedBy },
|
|
24
29
|
...invalid && { "aria-invalid": true },
|
|
30
|
+
"data-start-icon": Boolean(startIcon),
|
|
25
31
|
className: cx("peer", nativeProps.className, inputStyles.input)
|
|
26
32
|
}
|
|
27
33
|
),
|
|
28
|
-
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(
|
|
34
|
+
/* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(InvalidIcon, { className: inputStyles.icon }) }),
|
|
35
|
+
/* @__PURE__ */ jsx(Show, { when: hasEndIcon && !invalid, children: /* @__PURE__ */ jsx("span", { className: inputStyles.icon, children: endIcon }) })
|
|
29
36
|
] });
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
export {
|
|
33
40
|
Input
|
|
34
41
|
};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-AAKHV2IO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes, ReactNode } from 'react'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { $cerberusIcons } from '../config/defineIcons'\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 const { invalid: InvalidIcon } = $cerberusIcons\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 <InvalidIcon 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,aAAa;AACtB,SAAS,UAAmC;AAuBxC,SAEI,KAFJ;AARG,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;AAClC,QAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,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,eAAY,WAAW,YAAY,MAAM,GAC5C;AAAA,IACA,oBAAC,QAAK,MAAM,cAAc,CAAC,SACzB,8BAAC,UAAK,WAAW,YAAY,MAAO,mBAAQ,GAC9C;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultIcons
|
|
3
|
+
} from "./chunk-RK5HK6UU.js";
|
|
4
|
+
|
|
5
|
+
// src/config/defineIcons.ts
|
|
6
|
+
function _validateIconsProperties(icons) {
|
|
7
|
+
if (!icons.invalid) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"The an invalid property must be defined in your custom icons library."
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function defineIcons(icons) {
|
|
14
|
+
_validateIconsProperties(icons);
|
|
15
|
+
$cerberusIcons = icons;
|
|
16
|
+
return $cerberusIcons;
|
|
17
|
+
}
|
|
18
|
+
var $cerberusIcons = defaultIcons;
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
defineIcons,
|
|
22
|
+
$cerberusIcons
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-LQD23PG3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/defineIcons.ts"],"sourcesContent":["import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): DefinedIcons {\n _validateIconsProperties(icons)\n $cerberusIcons = icons\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons: DefinedIcons = defaultIcons\n"],"mappings":";;;;;AAEA,SAAS,yBAAyB,OAAqB;AACrD,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,YAAY,OAAmC;AAC7D,2BAAyB,KAAK;AAC9B,mBAAiB;AACjB,SAAO;AACT;AAIO,IAAI,iBAA+B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/cerbIcons.ts"],"sourcesContent":["import { WarningFilled, type CarbonIconType } from '@cerberus/icons'\nimport type { ElementType } from 'react'\n\nexport interface DefinedIcons {\n invalid: CarbonIconType | ElementType\n}\n\nexport const defaultIcons: DefinedIcons = {\n invalid: WarningFilled,\n}\n"],"mappings":";AAAA,SAAS,qBAA0C;AAO5C,IAAM,eAA6B;AAAA,EACxC,SAAS;AACX;","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":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Show
|
|
3
|
-
} from "./chunk-4O4QFF4S.js";
|
|
4
1
|
import {
|
|
5
2
|
useFieldContext
|
|
6
3
|
} from "./chunk-ZAU4JVLL.js";
|
|
4
|
+
import {
|
|
5
|
+
Show
|
|
6
|
+
} from "./chunk-4O4QFF4S.js";
|
|
7
7
|
|
|
8
8
|
// src/components/Label.tsx
|
|
9
9
|
import { label } from "@cerberus/styled-system/recipes";
|
|
@@ -45,4 +45,4 @@ function Label(props) {
|
|
|
45
45
|
export {
|
|
46
46
|
Label
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-V4SA6GNO.js.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Input
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-4O4QFF4S.js";
|
|
4
|
+
} from "../chunk-AAKHV2IO.js";
|
|
6
5
|
import "../chunk-ZAU4JVLL.js";
|
|
6
|
+
import "../chunk-4O4QFF4S.js";
|
|
7
|
+
import "../chunk-LQD23PG3.js";
|
|
8
|
+
import "../chunk-RK5HK6UU.js";
|
|
7
9
|
export {
|
|
8
10
|
Input
|
|
9
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/modern/index.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Tab
|
|
3
|
+
} from "./chunk-SUP7U42W.js";
|
|
4
|
+
import {
|
|
5
|
+
TabList
|
|
6
|
+
} from "./chunk-5GSXIYD3.js";
|
|
1
7
|
import {
|
|
2
8
|
TabPanel
|
|
3
9
|
} from "./chunk-YJCWUN33.js";
|
|
4
10
|
import {
|
|
5
11
|
Tag
|
|
6
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SLIOCQBZ.js";
|
|
7
13
|
import {
|
|
8
14
|
Textarea
|
|
9
15
|
} from "./chunk-TCO46FK7.js";
|
|
16
|
+
import {
|
|
17
|
+
FieldMessage
|
|
18
|
+
} from "./chunk-VGHVH2T3.js";
|
|
19
|
+
import {
|
|
20
|
+
IconButton
|
|
21
|
+
} from "./chunk-SLHX5K6I.js";
|
|
10
22
|
import {
|
|
11
23
|
Input
|
|
12
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-AAKHV2IO.js";
|
|
13
25
|
import {
|
|
14
26
|
Label
|
|
15
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-V4SA6GNO.js";
|
|
28
|
+
import {
|
|
29
|
+
Field,
|
|
30
|
+
useFieldContext
|
|
31
|
+
} from "./chunk-ZAU4JVLL.js";
|
|
16
32
|
import {
|
|
17
33
|
NavMenuLink
|
|
18
34
|
} from "./chunk-6DIGPXAD.js";
|
|
@@ -30,12 +46,6 @@ import {
|
|
|
30
46
|
import {
|
|
31
47
|
Show
|
|
32
48
|
} from "./chunk-4O4QFF4S.js";
|
|
33
|
-
import {
|
|
34
|
-
Tab
|
|
35
|
-
} from "./chunk-SUP7U42W.js";
|
|
36
|
-
import {
|
|
37
|
-
TabList
|
|
38
|
-
} from "./chunk-5GSXIYD3.js";
|
|
39
49
|
import "./chunk-55J6XMHW.js";
|
|
40
50
|
import {
|
|
41
51
|
createNavTriggerProps
|
|
@@ -48,6 +58,11 @@ import {
|
|
|
48
58
|
TabsContext,
|
|
49
59
|
useTabsContext
|
|
50
60
|
} from "./chunk-DQOYTLGB.js";
|
|
61
|
+
import {
|
|
62
|
+
$cerberusIcons,
|
|
63
|
+
defineIcons
|
|
64
|
+
} from "./chunk-LQD23PG3.js";
|
|
65
|
+
import "./chunk-RK5HK6UU.js";
|
|
51
66
|
import {
|
|
52
67
|
MODE_KEY,
|
|
53
68
|
THEME_KEY,
|
|
@@ -58,17 +73,8 @@ import {
|
|
|
58
73
|
import {
|
|
59
74
|
Button
|
|
60
75
|
} from "./chunk-2ATICEW3.js";
|
|
61
|
-
import {
|
|
62
|
-
FieldMessage
|
|
63
|
-
} from "./chunk-VGHVH2T3.js";
|
|
64
|
-
import {
|
|
65
|
-
Field,
|
|
66
|
-
useFieldContext
|
|
67
|
-
} from "./chunk-ZAU4JVLL.js";
|
|
68
|
-
import {
|
|
69
|
-
IconButton
|
|
70
|
-
} from "./chunk-SLHX5K6I.js";
|
|
71
76
|
export {
|
|
77
|
+
$cerberusIcons,
|
|
72
78
|
Button,
|
|
73
79
|
Field,
|
|
74
80
|
FieldMessage,
|
|
@@ -91,6 +97,7 @@ export {
|
|
|
91
97
|
Textarea,
|
|
92
98
|
ThemeProvider,
|
|
93
99
|
createNavTriggerProps,
|
|
100
|
+
defineIcons,
|
|
94
101
|
getPosition,
|
|
95
102
|
useFieldContext,
|
|
96
103
|
useNavMenuContext,
|
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-94987e7",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"react-dom": "^18",
|
|
23
23
|
"tsup": "^8.1.0",
|
|
24
24
|
"@cerberus-design/configs": "0.0.0",
|
|
25
|
-
"@cerberus-design/styled-system": "0.5.2-next-
|
|
25
|
+
"@cerberus-design/styled-system": "0.5.2-next-94987e7"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
package/src/components/Input.tsx
CHANGED
|
@@ -1,37 +1,49 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type { InputHTMLAttributes } from 'react'
|
|
4
|
-
import { WarningFilled } from '@cerberus/icons'
|
|
3
|
+
import type { InputHTMLAttributes, ReactNode } from 'react'
|
|
5
4
|
import { input } from '@cerberus/styled-system/recipes'
|
|
6
5
|
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
7
6
|
import { useFieldContext } from '../context/field'
|
|
7
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
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)
|
|
25
|
+
const { invalid: InvalidIcon } = $cerberusIcons
|
|
23
26
|
|
|
24
27
|
return (
|
|
25
28
|
<div className={inputStyles.root}>
|
|
29
|
+
<Show when={Boolean(startIcon)}>
|
|
30
|
+
<span className={inputStyles.startIcon}>{startIcon}</span>
|
|
31
|
+
</Show>
|
|
32
|
+
|
|
26
33
|
<input
|
|
27
34
|
{...nativeProps}
|
|
28
35
|
{...fieldStates}
|
|
29
36
|
{...(describedBy && { 'aria-describedby': describedBy })}
|
|
30
37
|
{...(invalid && { 'aria-invalid': true })}
|
|
38
|
+
data-start-icon={Boolean(startIcon)}
|
|
31
39
|
className={cx('peer', nativeProps.className, inputStyles.input)}
|
|
32
40
|
/>
|
|
41
|
+
|
|
33
42
|
<Show when={invalid}>
|
|
34
|
-
<
|
|
43
|
+
<InvalidIcon className={inputStyles.icon} />
|
|
44
|
+
</Show>
|
|
45
|
+
<Show when={hasEndIcon && !invalid}>
|
|
46
|
+
<span className={inputStyles.icon}>{endIcon}</span>
|
|
35
47
|
</Show>
|
|
36
48
|
</div>
|
|
37
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
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WarningFilled, type CarbonIconType } from '@cerberus/icons'
|
|
2
|
+
import type { ElementType } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface DefinedIcons {
|
|
5
|
+
invalid: CarbonIconType | ElementType
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const defaultIcons: DefinedIcons = {
|
|
9
|
+
invalid: WarningFilled,
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defaultIcons, type DefinedIcons } from './cerbIcons'
|
|
2
|
+
|
|
3
|
+
function _validateIconsProperties(icons: DefinedIcons) {
|
|
4
|
+
if (!icons.invalid) {
|
|
5
|
+
throw new Error(
|
|
6
|
+
'The an invalid property must be defined in your custom icons library.',
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function defineIcons(icons: DefinedIcons): DefinedIcons {
|
|
12
|
+
_validateIconsProperties(icons)
|
|
13
|
+
$cerberusIcons = icons
|
|
14
|
+
return $cerberusIcons
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Default icons
|
|
18
|
+
|
|
19
|
+
export let $cerberusIcons: DefinedIcons = defaultIcons
|
package/src/index.ts
CHANGED
|
@@ -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":[]}
|
|
File without changes
|
|
File without changes
|