@cerberus-design/react 0.15.0-next-544221f → 0.15.0-next-7a184be
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.cts +107 -64
- package/build/legacy/components/{FieldsetLabel.cjs → deprecated/FieldsetLabel.cjs} +1 -1
- package/build/legacy/components/deprecated/FieldsetLabel.cjs.map +1 -0
- package/build/legacy/components/fieldset/fieldset.cjs +116 -0
- package/build/legacy/components/fieldset/fieldset.cjs.map +1 -0
- package/build/legacy/components/fieldset/index.cjs +126 -0
- package/build/legacy/components/fieldset/index.cjs.map +1 -0
- package/build/legacy/components/fieldset/parts.cjs +80 -0
- package/build/legacy/components/fieldset/parts.cjs.map +1 -0
- package/build/legacy/components/fieldset/primitives.cjs +76 -0
- package/build/legacy/components/fieldset/primitives.cjs.map +1 -0
- package/build/legacy/index.cjs +669 -617
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +107 -64
- package/build/modern/chunk-7TQRTBUP.js +19 -0
- package/build/modern/chunk-7TQRTBUP.js.map +1 -0
- package/build/modern/chunk-AO3GB72J.js +27 -0
- package/build/modern/chunk-AO3GB72J.js.map +1 -0
- package/build/modern/{chunk-OYT7RGC7.js → chunk-DRDNNRU3.js} +2 -2
- package/build/modern/chunk-DRDNNRU3.js.map +1 -0
- package/build/modern/chunk-IDTAB2UJ.js +1 -0
- package/build/modern/chunk-Z3FDG263.js +53 -0
- package/build/modern/chunk-Z3FDG263.js.map +1 -0
- package/build/modern/components/deprecated/FieldsetLabel.js +7 -0
- package/build/modern/components/fieldset/fieldset.js +11 -0
- package/build/modern/components/fieldset/fieldset.js.map +1 -0
- package/build/modern/components/fieldset/index.js +24 -0
- package/build/modern/components/fieldset/index.js.map +1 -0
- package/build/modern/components/fieldset/parts.js +8 -0
- package/build/modern/components/fieldset/parts.js.map +1 -0
- package/build/modern/components/fieldset/primitives.js +13 -0
- package/build/modern/components/fieldset/primitives.js.map +1 -0
- package/build/modern/context/notification-center.js +1 -1
- package/build/modern/index.js +37 -22
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/deprecated/FieldsetLabel.tsx +32 -0
- package/src/components/fieldset/fieldset.tsx +55 -0
- package/src/components/fieldset/index.ts +3 -0
- package/src/components/fieldset/parts.ts +47 -0
- package/src/components/fieldset/primitives.tsx +79 -0
- package/src/index.ts +2 -2
- package/build/legacy/components/Fieldset.cjs +0 -53
- package/build/legacy/components/Fieldset.cjs.map +0 -1
- package/build/legacy/components/FieldsetLabel.cjs.map +0 -1
- package/build/modern/chunk-6EUC3SUI.js +0 -28
- package/build/modern/chunk-6EUC3SUI.js.map +0 -1
- package/build/modern/chunk-OYT7RGC7.js.map +0 -1
- package/build/modern/components/Fieldset.js +0 -8
- package/build/modern/components/FieldsetLabel.js +0 -7
- package/src/components/Fieldset.tsx +0 -65
- package/src/components/FieldsetLabel.tsx +0 -62
- /package/build/modern/{components/Fieldset.js.map → chunk-IDTAB2UJ.js.map} +0 -0
- /package/build/modern/components/{FieldsetLabel.js.map → deprecated/FieldsetLabel.js.map} +0 -0
|
@@ -86,7 +86,11 @@ import { FieldLabelProps } from '@ark-ui/react/field';
|
|
|
86
86
|
import { FieldMessageVariantProps } from '@cerberus/styled-system/recipes';
|
|
87
87
|
import { FieldRootProps as FieldRootProps_2 } from '@ark-ui/react/field';
|
|
88
88
|
import type { FieldRootProps as FieldRootProps_3 } from '@ark-ui/react';
|
|
89
|
-
import
|
|
89
|
+
import { FieldsetHelperTextProps } from '@ark-ui/react/fieldset';
|
|
90
|
+
import { FieldsetLegendProps } from '@ark-ui/react/fieldset';
|
|
91
|
+
import type { FieldsetRootProps } from '@ark-ui/react';
|
|
92
|
+
import { FieldsetRootProps as FieldsetRootProps_2 } from '@ark-ui/react/fieldset';
|
|
93
|
+
import { FieldsetVariantProps } from '@cerberus/styled-system/recipes';
|
|
90
94
|
import { FieldTextareaProps } from '@ark-ui/react/field';
|
|
91
95
|
import { FieldVariantProps } from '@cerberus/styled-system/recipes';
|
|
92
96
|
import { FileStatusVariantProps } from '@cerberus/styled-system/recipes';
|
|
@@ -1921,74 +1925,38 @@ export { FieldRootProps as FieldRootProps_alias_1 }
|
|
|
1921
1925
|
export { FieldRootProps as FieldRootProps_alias_2 }
|
|
1922
1926
|
|
|
1923
1927
|
/**
|
|
1924
|
-
* A component
|
|
1925
|
-
*
|
|
1926
|
-
* @
|
|
1927
|
-
* @description [
|
|
1928
|
-
* @description [MDN Web Docs: Fieldset](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset)
|
|
1929
|
-
* @example
|
|
1930
|
-
* ```tsx
|
|
1931
|
-
* import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'
|
|
1932
|
-
* import { Hstack } from '@cerberus/styled-system/jsx'
|
|
1933
|
-
*
|
|
1934
|
-
* function SomeForm() {
|
|
1935
|
-
* return (
|
|
1936
|
-
* <form>
|
|
1937
|
-
* <Fieldset>
|
|
1938
|
-
* <Legend>Do you like cats?</Legend>
|
|
1939
|
-
* <Hstack>
|
|
1940
|
-
* <Field>
|
|
1941
|
-
* <Radio id="yes" name="cats" value="yes" />
|
|
1942
|
-
* <Label htmlFor="yes">Yes</Label>
|
|
1943
|
-
* </Field>
|
|
1944
|
-
* </Hstack>
|
|
1945
|
-
* <Hstack>
|
|
1946
|
-
* <Field>
|
|
1947
|
-
* <Radio id="no" name="cats" value="no" />
|
|
1948
|
-
* <Label htmlFor="no">No</Label>
|
|
1949
|
-
* </Field>
|
|
1950
|
-
* </Hstack>
|
|
1951
|
-
* </Fieldset>
|
|
1952
|
-
* </form>
|
|
1953
|
-
* )
|
|
1954
|
-
* }
|
|
1928
|
+
* A component used for grouping related fields in a form that is an
|
|
1929
|
+
* abstraction of the Fieldset primitives.
|
|
1930
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
1931
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
1955
1932
|
*/
|
|
1956
1933
|
declare function Fieldset(props: FieldsetProps): JSX_2.Element;
|
|
1957
1934
|
export { Fieldset }
|
|
1958
1935
|
export { Fieldset as Fieldset_alias_1 }
|
|
1936
|
+
export { Fieldset as Fieldset_alias_2 }
|
|
1959
1937
|
|
|
1960
1938
|
/**
|
|
1961
|
-
*
|
|
1962
|
-
* @
|
|
1963
|
-
* @
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
*
|
|
1972
|
-
*
|
|
1973
|
-
*
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
*
|
|
1982
|
-
* <Field>
|
|
1983
|
-
* <Radio id="no" name="cats" value="no" />
|
|
1984
|
-
* <FieldsetLabel htmlFor="no">No</FieldsetLabel>
|
|
1985
|
-
* </Field>
|
|
1986
|
-
* </Hstack>
|
|
1987
|
-
* </Fieldset>
|
|
1988
|
-
* </form>
|
|
1989
|
-
* )
|
|
1990
|
-
* }
|
|
1991
|
-
* ```
|
|
1939
|
+
* The error text element for the Fieldset group.
|
|
1940
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
1941
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
1942
|
+
*/
|
|
1943
|
+
declare function FieldsetErrorText(props: FieldsetHelperTextProps): JSX_2.Element;
|
|
1944
|
+
export { FieldsetErrorText }
|
|
1945
|
+
export { FieldsetErrorText as FieldsetErrorText_alias_1 }
|
|
1946
|
+
export { FieldsetErrorText as FieldsetErrorText_alias_2 }
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* The description element for the Fieldset group.
|
|
1950
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
1951
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
1952
|
+
*/
|
|
1953
|
+
declare function FieldsetHelperText(props: FieldsetHelperTextProps & FieldsetVariantProps): JSX_2.Element;
|
|
1954
|
+
export { FieldsetHelperText }
|
|
1955
|
+
export { FieldsetHelperText as FieldsetHelperText_alias_1 }
|
|
1956
|
+
export { FieldsetHelperText as FieldsetHelperText_alias_2 }
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* @deprecated
|
|
1992
1960
|
*/
|
|
1993
1961
|
declare function FieldsetLabel(props: FieldsetLabelProps): JSX_2.Element;
|
|
1994
1962
|
export { FieldsetLabel }
|
|
@@ -2004,13 +1972,88 @@ declare type FieldsetLabelProps = LabelProps & LabelVariantProps & {
|
|
|
2004
1972
|
export { FieldsetLabelProps }
|
|
2005
1973
|
export { FieldsetLabelProps as FieldsetLabelProps_alias_1 }
|
|
2006
1974
|
|
|
1975
|
+
/**
|
|
1976
|
+
* The legend element for the Fieldset group.
|
|
1977
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
1978
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
1979
|
+
*/
|
|
1980
|
+
declare function FieldsetLegend(props: FieldsetLegendProps & FieldsetVariantProps): JSX_2.Element;
|
|
1981
|
+
export { FieldsetLegend }
|
|
1982
|
+
export { FieldsetLegend as FieldsetLegend_alias_1 }
|
|
1983
|
+
export { FieldsetLegend as FieldsetLegend_alias_2 }
|
|
1984
|
+
|
|
1985
|
+
/**
|
|
1986
|
+
* An Object containing the parts of the Field component. For users that
|
|
1987
|
+
* prefer Object component syntax.
|
|
1988
|
+
*
|
|
1989
|
+
* @remarks
|
|
1990
|
+
*
|
|
1991
|
+
* When using object component syntax, you import the FieldParts object and
|
|
1992
|
+
* the entire family of components vs. only what you use.
|
|
1993
|
+
*/
|
|
1994
|
+
declare const FieldsetParts: FieldsetPartsValue;
|
|
1995
|
+
export { FieldsetParts }
|
|
1996
|
+
export { FieldsetParts as FieldsetParts_alias_1 }
|
|
1997
|
+
export { FieldsetParts as FieldsetParts_alias_2 }
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* This module contains the parts of the Field component.
|
|
2001
|
+
* @module 'field/parts'
|
|
2002
|
+
*/
|
|
2003
|
+
declare interface FieldsetPartsValue {
|
|
2004
|
+
/**
|
|
2005
|
+
* The container of the field.
|
|
2006
|
+
*/
|
|
2007
|
+
Root: ElementType;
|
|
2008
|
+
/**
|
|
2009
|
+
* The label of the field.
|
|
2010
|
+
*/
|
|
2011
|
+
Legend: ElementType;
|
|
2012
|
+
/**
|
|
2013
|
+
* The text that displays when the field is valid.
|
|
2014
|
+
*/
|
|
2015
|
+
HelperText: ElementType;
|
|
2016
|
+
/**
|
|
2017
|
+
* The text that displays when the field is invalid.
|
|
2018
|
+
*/
|
|
2019
|
+
ErrorText: ElementType;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2007
2022
|
/**
|
|
2008
2023
|
* This module contains the Fieldset component.
|
|
2009
2024
|
* @module Fieldset
|
|
2010
2025
|
*/
|
|
2011
|
-
declare
|
|
2026
|
+
declare interface FieldsetProps extends FieldsetRootProps, FieldsetVariantProps {
|
|
2027
|
+
/**
|
|
2028
|
+
* The legend/title/label of the fieldset group.
|
|
2029
|
+
*/
|
|
2030
|
+
legend?: string;
|
|
2031
|
+
/**
|
|
2032
|
+
* The description text for the fieldset group.
|
|
2033
|
+
*/
|
|
2034
|
+
helperText?: string;
|
|
2035
|
+
/**
|
|
2036
|
+
* The error text for the fieldset group shown when the field is invalid.
|
|
2037
|
+
*/
|
|
2038
|
+
errorText?: string;
|
|
2039
|
+
}
|
|
2012
2040
|
export { FieldsetProps }
|
|
2013
2041
|
export { FieldsetProps as FieldsetProps_alias_1 }
|
|
2042
|
+
export { FieldsetProps as FieldsetProps_alias_2 }
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* This module contains all the primitives of the Fieldset component.
|
|
2046
|
+
* @module 'react/fieldset'
|
|
2047
|
+
*/
|
|
2048
|
+
/**
|
|
2049
|
+
* The context & container for the Fieldset components.
|
|
2050
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
2051
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
2052
|
+
*/
|
|
2053
|
+
declare function FieldsetRoot(props: FieldsetRootProps_2): JSX_2.Element;
|
|
2054
|
+
export { FieldsetRoot }
|
|
2055
|
+
export { FieldsetRoot as FieldsetRoot_alias_1 }
|
|
2056
|
+
export { FieldsetRoot as FieldsetRoot_alias_2 }
|
|
2014
2057
|
|
|
2015
2058
|
/**
|
|
2016
2059
|
* The start indicator displays an indicator at the start of the Input.
|
|
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/components/FieldsetLabel.tsx
|
|
20
|
+
// src/components/deprecated/FieldsetLabel.tsx
|
|
21
21
|
var FieldsetLabel_exports = {};
|
|
22
22
|
__export(FieldsetLabel_exports, {
|
|
23
23
|
FieldsetLabel: () => FieldsetLabel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/deprecated/FieldsetLabel.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'\nimport type { LabelProps } from './Label'\n\n/**\n * This module contains the FieldsetLabel component.\n * @module FieldsetLabel\n */\n\nexport type FieldsetLabelProps = LabelProps &\n LabelVariantProps & {\n htmlFor?: string\n }\n\n/**\n * @deprecated\n */\nexport function FieldsetLabel(props: FieldsetLabelProps) {\n const { size, usage, ...nativeProps } = props\n return (\n <label\n {...nativeProps}\n className={cx(\n nativeProps.className,\n label({\n size,\n usage,\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,qBAA8C;AAmB1C;AAHG,SAAS,cAAc,OAA2B;AACvD,QAAM,EAAE,MAAM,OAAO,GAAG,YAAY,IAAI;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,sBAAM;AAAA,UACJ;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/fieldset/fieldset.tsx
|
|
21
|
+
var fieldset_exports = {};
|
|
22
|
+
__export(fieldset_exports, {
|
|
23
|
+
Fieldset: () => Fieldset2
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(fieldset_exports);
|
|
26
|
+
|
|
27
|
+
// src/utils/index.ts
|
|
28
|
+
function splitProps(props, ...keyGroups) {
|
|
29
|
+
const result = keyGroups.map(() => ({}));
|
|
30
|
+
const rest = {};
|
|
31
|
+
for (const key in props) {
|
|
32
|
+
let assigned = false;
|
|
33
|
+
for (let i = 0; i < keyGroups.length; i++) {
|
|
34
|
+
if (keyGroups[i].includes(key)) {
|
|
35
|
+
result[i][key] = props[key];
|
|
36
|
+
assigned = true;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!assigned) {
|
|
41
|
+
rest[key] = props[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return [...result, rest];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/components/fieldset/primitives.tsx
|
|
48
|
+
var import_fieldset = require("@ark-ui/react/fieldset");
|
|
49
|
+
var import_css = require("@cerberus/styled-system/css");
|
|
50
|
+
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
function FieldsetRoot(props) {
|
|
53
|
+
const styles = (0, import_recipes.fieldset)();
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fieldset.Fieldset.Root, { ...props, className: (0, import_css.cx)(styles.root, props.className) });
|
|
55
|
+
}
|
|
56
|
+
function FieldsetLegend(props) {
|
|
57
|
+
const { usage, ...legendProps } = props;
|
|
58
|
+
const styles = (0, import_recipes.fieldset)({ usage });
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
import_fieldset.Fieldset.Legend,
|
|
61
|
+
{
|
|
62
|
+
...legendProps,
|
|
63
|
+
className: (0, import_css.cx)(styles.legend, legendProps.className)
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function FieldsetHelperText(props) {
|
|
68
|
+
const { usage, ...helperTextProps } = props;
|
|
69
|
+
const styles = (0, import_recipes.fieldset)({ usage });
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
import_fieldset.Fieldset.HelperText,
|
|
72
|
+
{
|
|
73
|
+
...helperTextProps,
|
|
74
|
+
className: (0, import_css.cx)(styles.helperText, helperTextProps.className)
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function FieldsetErrorText(props) {
|
|
79
|
+
const styles = (0, import_recipes.fieldset)();
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
|
+
import_fieldset.Fieldset.ErrorText,
|
|
82
|
+
{
|
|
83
|
+
...props,
|
|
84
|
+
className: (0, import_css.cx)(styles.errorText, props.className)
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/components/fieldset/parts.ts
|
|
90
|
+
var FieldsetParts = {
|
|
91
|
+
Root: FieldsetRoot,
|
|
92
|
+
Legend: FieldsetLegend,
|
|
93
|
+
HelperText: FieldsetHelperText,
|
|
94
|
+
ErrorText: FieldsetErrorText
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/components/fieldset/fieldset.tsx
|
|
98
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
99
|
+
function Fieldset2(props) {
|
|
100
|
+
const [fieldsetProps, { usage }, rootProps] = splitProps(
|
|
101
|
+
props,
|
|
102
|
+
["legend", "helperText", "errorText", "children"],
|
|
103
|
+
["usage"]
|
|
104
|
+
);
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(FieldsetParts.Root, { ...rootProps, children: [
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetParts.Legend, { usage, children: fieldsetProps.legend }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetParts.HelperText, { usage, children: fieldsetProps.helperText }),
|
|
108
|
+
fieldsetProps.children,
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetParts.ErrorText, { children: fieldsetProps.errorText })
|
|
110
|
+
] });
|
|
111
|
+
}
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
114
|
+
Fieldset
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=fieldset.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fieldset/fieldset.tsx","../../../../src/utils/index.ts","../../../../src/components/fieldset/primitives.tsx","../../../../src/components/fieldset/parts.ts"],"sourcesContent":["import type { FieldsetRootProps } from '@ark-ui/react'\nimport { splitProps } from '../../utils'\nimport { FieldsetParts } from './parts'\nimport type { FieldsetVariantProps } from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Fieldset component.\n * @module Fieldset\n */\n\nexport interface FieldsetProps extends FieldsetRootProps, FieldsetVariantProps {\n /**\n * The legend/title/label of the fieldset group.\n */\n legend?: string\n /**\n * The description text for the fieldset group.\n */\n helperText?: string\n /**\n * The error text for the fieldset group shown when the field is invalid.\n */\n errorText?: string\n}\n\n/**\n * A component used for grouping related fields in a form that is an\n * abstraction of the Fieldset primitives.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function Fieldset(props: FieldsetProps) {\n const [fieldsetProps, { usage }, rootProps] = splitProps(\n props,\n ['legend', 'helperText', 'errorText', 'children'],\n ['usage'],\n )\n\n return (\n <FieldsetParts.Root {...rootProps}>\n <FieldsetParts.Legend usage={usage}>\n {fieldsetProps.legend}\n </FieldsetParts.Legend>\n <FieldsetParts.HelperText usage={usage}>\n {fieldsetProps.helperText}\n </FieldsetParts.HelperText>\n\n {fieldsetProps.children}\n\n <FieldsetParts.ErrorText>\n {fieldsetProps.errorText}\n </FieldsetParts.ErrorText>\n </FieldsetParts.Root>\n )\n}\n","/**\n * This module contains utility functions that are used across your app.\n * @module Utils\n */\n\n/**\n * Formats the count of notifications to be displayed in the notification badge.\n * @param count - The number of notifications.\n * @returns The formatted count of notifications.\n * @example\n * ```tsx\n * const count = formatNotifyCount(100)\n * console.log(count) // '99+'\n * ```\n */\nexport function formatNotifyCount(count: number): string {\n if (count > 99) return '99+'\n return count.toString()\n}\n\n/**\n * Splits the properties of an object into multiple groups based on lists of keys.\n * @param props - The object to split.\n * @param keyGroups - The lists of keys to include in each group.\n * @returns An array of objects: each containing the properties specified in the corresponding key group, and the last object containing the remaining keys.\n */\nexport function splitProps<T extends object>(\n props: T,\n ...keyGroups: (keyof T)[][]\n): { [K in keyof T]?: T[K] }[] {\n const result = keyGroups.map(() => ({}) as { [K in keyof T]?: T[K] })\n const rest = {} as { [K in keyof T]?: T[K] }\n\n for (const key in props) {\n let assigned = false\n for (let i = 0; i < keyGroups.length; i++) {\n if (keyGroups[i].includes(key as keyof T)) {\n result[i][key as keyof T] = props[key]\n assigned = true\n break\n }\n }\n if (!assigned) {\n rest[key as keyof T] = props[key]\n }\n }\n\n return [...result, rest]\n}\n\nexport * from './localStorage'\n","import {\n Fieldset,\n type FieldsetHelperTextProps,\n type FieldsetLegendProps,\n type FieldsetRootProps,\n} from '@ark-ui/react/fieldset'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n fieldset,\n type FieldsetVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains all the primitives of the Fieldset component.\n * @module 'react/fieldset'\n */\n\n/**\n * The context & container for the Fieldset components.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetRoot(props: FieldsetRootProps) {\n const styles = fieldset()\n return (\n <Fieldset.Root {...props} className={cx(styles.root, props.className)} />\n )\n}\n\n/**\n * The legend element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetLegend(\n props: FieldsetLegendProps & FieldsetVariantProps,\n) {\n const { usage, ...legendProps } = props\n const styles = fieldset({ usage })\n return (\n <Fieldset.Legend\n {...legendProps}\n className={cx(styles.legend, legendProps.className)}\n />\n )\n}\n\n/**\n * The description element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetHelperText(\n props: FieldsetHelperTextProps & FieldsetVariantProps,\n) {\n const { usage, ...helperTextProps } = props\n const styles = fieldset({ usage })\n return (\n <Fieldset.HelperText\n {...helperTextProps}\n className={cx(styles.helperText, helperTextProps.className)}\n />\n )\n}\n\n/**\n * The error text element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetErrorText(props: FieldsetHelperTextProps) {\n const styles = fieldset()\n return (\n <Fieldset.ErrorText\n {...props}\n className={cx(styles.errorText, props.className)}\n />\n )\n}\n","import type { ElementType } from 'react'\nimport {\n FieldsetErrorText,\n FieldsetHelperText,\n FieldsetLegend,\n FieldsetRoot,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface FieldsetPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Legend: ElementType\n /**\n * The text that displays when the field is valid.\n */\n HelperText: ElementType\n /**\n * The text that displays when the field is invalid.\n */\n ErrorText: ElementType\n}\n\n/**\n * An Object containing the parts of the Field component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the FieldParts object and\n * the entire family of components vs. only what you use.\n */\nexport const FieldsetParts: FieldsetPartsValue = {\n Root: FieldsetRoot,\n Legend: FieldsetLegend,\n HelperText: FieldsetHelperText,\n ErrorText: FieldsetErrorText,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA;AAAA;;;AC0BO,SAAS,WACd,UACG,WAC0B;AAC7B,QAAM,SAAS,UAAU,IAAI,OAAO,CAAC,EAA+B;AACpE,QAAM,OAAO,CAAC;AAEd,aAAW,OAAO,OAAO;AACvB,QAAI,WAAW;AACf,aAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AACzC,UAAI,UAAU,CAAC,EAAE,SAAS,GAAc,GAAG;AACzC,eAAO,CAAC,EAAE,GAAc,IAAI,MAAM,GAAG;AACrC,mBAAW;AACX;AAAA,MACF;AAAA,IACF;AACA,QAAI,CAAC,UAAU;AACb,WAAK,GAAc,IAAI,MAAM,GAAG;AAAA,IAClC;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,QAAQ,IAAI;AACzB;;;AChDA,sBAKO;AACP,iBAAmB;AACnB,qBAGO;AAeH;AAHG,SAAS,aAAa,OAA0B;AACrD,QAAM,aAAS,yBAAS;AACxB,SACE,4CAAC,yBAAS,MAAT,EAAe,GAAG,OAAO,eAAW,eAAG,OAAO,MAAM,MAAM,SAAS,GAAG;AAE3E;AAOO,SAAS,eACd,OACA;AACA,QAAM,EAAE,OAAO,GAAG,YAAY,IAAI;AAClC,QAAM,aAAS,yBAAS,EAAE,MAAM,CAAC;AACjC,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,QAAQ,YAAY,SAAS;AAAA;AAAA,EACpD;AAEJ;AAOO,SAAS,mBACd,OACA;AACA,QAAM,EAAE,OAAO,GAAG,gBAAgB,IAAI;AACtC,QAAM,aAAS,yBAAS,EAAE,MAAM,CAAC;AACjC,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,YAAY,gBAAgB,SAAS;AAAA;AAAA,EAC5D;AAEJ;AAOO,SAAS,kBAAkB,OAAgC;AAChE,QAAM,aAAS,yBAAS;AACxB,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,WAAW,MAAM,SAAS;AAAA;AAAA,EACjD;AAEJ;;;ACrCO,IAAM,gBAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AACb;;;AHPI,IAAAC,sBAAA;AARG,SAASC,UAAS,OAAsB;AAC7C,QAAM,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,IAAI;AAAA,IAC5C;AAAA,IACA,CAAC,UAAU,cAAc,aAAa,UAAU;AAAA,IAChD,CAAC,OAAO;AAAA,EACV;AAEA,SACE,8CAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,iDAAC,cAAc,QAAd,EAAqB,OACnB,wBAAc,QACjB;AAAA,IACA,6CAAC,cAAc,YAAd,EAAyB,OACvB,wBAAc,YACjB;AAAA,IAEC,cAAc;AAAA,IAEf,6CAAC,cAAc,WAAd,EACE,wBAAc,WACjB;AAAA,KACF;AAEJ;","names":["Fieldset","import_jsx_runtime","Fieldset"]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/fieldset/index.ts
|
|
21
|
+
var fieldset_exports = {};
|
|
22
|
+
__export(fieldset_exports, {
|
|
23
|
+
Fieldset: () => Fieldset2,
|
|
24
|
+
FieldsetErrorText: () => FieldsetErrorText,
|
|
25
|
+
FieldsetHelperText: () => FieldsetHelperText,
|
|
26
|
+
FieldsetLegend: () => FieldsetLegend,
|
|
27
|
+
FieldsetParts: () => FieldsetParts,
|
|
28
|
+
FieldsetRoot: () => FieldsetRoot
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(fieldset_exports);
|
|
31
|
+
|
|
32
|
+
// src/utils/index.ts
|
|
33
|
+
function splitProps(props, ...keyGroups) {
|
|
34
|
+
const result = keyGroups.map(() => ({}));
|
|
35
|
+
const rest = {};
|
|
36
|
+
for (const key in props) {
|
|
37
|
+
let assigned = false;
|
|
38
|
+
for (let i = 0; i < keyGroups.length; i++) {
|
|
39
|
+
if (keyGroups[i].includes(key)) {
|
|
40
|
+
result[i][key] = props[key];
|
|
41
|
+
assigned = true;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!assigned) {
|
|
46
|
+
rest[key] = props[key];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return [...result, rest];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/components/fieldset/primitives.tsx
|
|
53
|
+
var import_fieldset = require("@ark-ui/react/fieldset");
|
|
54
|
+
var import_css = require("@cerberus/styled-system/css");
|
|
55
|
+
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
56
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
57
|
+
function FieldsetRoot(props) {
|
|
58
|
+
const styles = (0, import_recipes.fieldset)();
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fieldset.Fieldset.Root, { ...props, className: (0, import_css.cx)(styles.root, props.className) });
|
|
60
|
+
}
|
|
61
|
+
function FieldsetLegend(props) {
|
|
62
|
+
const { usage, ...legendProps } = props;
|
|
63
|
+
const styles = (0, import_recipes.fieldset)({ usage });
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
+
import_fieldset.Fieldset.Legend,
|
|
66
|
+
{
|
|
67
|
+
...legendProps,
|
|
68
|
+
className: (0, import_css.cx)(styles.legend, legendProps.className)
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function FieldsetHelperText(props) {
|
|
73
|
+
const { usage, ...helperTextProps } = props;
|
|
74
|
+
const styles = (0, import_recipes.fieldset)({ usage });
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
+
import_fieldset.Fieldset.HelperText,
|
|
77
|
+
{
|
|
78
|
+
...helperTextProps,
|
|
79
|
+
className: (0, import_css.cx)(styles.helperText, helperTextProps.className)
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function FieldsetErrorText(props) {
|
|
84
|
+
const styles = (0, import_recipes.fieldset)();
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
import_fieldset.Fieldset.ErrorText,
|
|
87
|
+
{
|
|
88
|
+
...props,
|
|
89
|
+
className: (0, import_css.cx)(styles.errorText, props.className)
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/components/fieldset/parts.ts
|
|
95
|
+
var FieldsetParts = {
|
|
96
|
+
Root: FieldsetRoot,
|
|
97
|
+
Legend: FieldsetLegend,
|
|
98
|
+
HelperText: FieldsetHelperText,
|
|
99
|
+
ErrorText: FieldsetErrorText
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/components/fieldset/fieldset.tsx
|
|
103
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
104
|
+
function Fieldset2(props) {
|
|
105
|
+
const [fieldsetProps, { usage }, rootProps] = splitProps(
|
|
106
|
+
props,
|
|
107
|
+
["legend", "helperText", "errorText", "children"],
|
|
108
|
+
["usage"]
|
|
109
|
+
);
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(FieldsetParts.Root, { ...rootProps, children: [
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetParts.Legend, { usage, children: fieldsetProps.legend }),
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetParts.HelperText, { usage, children: fieldsetProps.helperText }),
|
|
113
|
+
fieldsetProps.children,
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetParts.ErrorText, { children: fieldsetProps.errorText })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
Fieldset,
|
|
120
|
+
FieldsetErrorText,
|
|
121
|
+
FieldsetHelperText,
|
|
122
|
+
FieldsetLegend,
|
|
123
|
+
FieldsetParts,
|
|
124
|
+
FieldsetRoot
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fieldset/index.ts","../../../../src/utils/index.ts","../../../../src/components/fieldset/primitives.tsx","../../../../src/components/fieldset/parts.ts","../../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["export * from './fieldset'\nexport * from './parts'\nexport * from './primitives'\n","/**\n * This module contains utility functions that are used across your app.\n * @module Utils\n */\n\n/**\n * Formats the count of notifications to be displayed in the notification badge.\n * @param count - The number of notifications.\n * @returns The formatted count of notifications.\n * @example\n * ```tsx\n * const count = formatNotifyCount(100)\n * console.log(count) // '99+'\n * ```\n */\nexport function formatNotifyCount(count: number): string {\n if (count > 99) return '99+'\n return count.toString()\n}\n\n/**\n * Splits the properties of an object into multiple groups based on lists of keys.\n * @param props - The object to split.\n * @param keyGroups - The lists of keys to include in each group.\n * @returns An array of objects: each containing the properties specified in the corresponding key group, and the last object containing the remaining keys.\n */\nexport function splitProps<T extends object>(\n props: T,\n ...keyGroups: (keyof T)[][]\n): { [K in keyof T]?: T[K] }[] {\n const result = keyGroups.map(() => ({}) as { [K in keyof T]?: T[K] })\n const rest = {} as { [K in keyof T]?: T[K] }\n\n for (const key in props) {\n let assigned = false\n for (let i = 0; i < keyGroups.length; i++) {\n if (keyGroups[i].includes(key as keyof T)) {\n result[i][key as keyof T] = props[key]\n assigned = true\n break\n }\n }\n if (!assigned) {\n rest[key as keyof T] = props[key]\n }\n }\n\n return [...result, rest]\n}\n\nexport * from './localStorage'\n","import {\n Fieldset,\n type FieldsetHelperTextProps,\n type FieldsetLegendProps,\n type FieldsetRootProps,\n} from '@ark-ui/react/fieldset'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n fieldset,\n type FieldsetVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains all the primitives of the Fieldset component.\n * @module 'react/fieldset'\n */\n\n/**\n * The context & container for the Fieldset components.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetRoot(props: FieldsetRootProps) {\n const styles = fieldset()\n return (\n <Fieldset.Root {...props} className={cx(styles.root, props.className)} />\n )\n}\n\n/**\n * The legend element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetLegend(\n props: FieldsetLegendProps & FieldsetVariantProps,\n) {\n const { usage, ...legendProps } = props\n const styles = fieldset({ usage })\n return (\n <Fieldset.Legend\n {...legendProps}\n className={cx(styles.legend, legendProps.className)}\n />\n )\n}\n\n/**\n * The description element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetHelperText(\n props: FieldsetHelperTextProps & FieldsetVariantProps,\n) {\n const { usage, ...helperTextProps } = props\n const styles = fieldset({ usage })\n return (\n <Fieldset.HelperText\n {...helperTextProps}\n className={cx(styles.helperText, helperTextProps.className)}\n />\n )\n}\n\n/**\n * The error text element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetErrorText(props: FieldsetHelperTextProps) {\n const styles = fieldset()\n return (\n <Fieldset.ErrorText\n {...props}\n className={cx(styles.errorText, props.className)}\n />\n )\n}\n","import type { ElementType } from 'react'\nimport {\n FieldsetErrorText,\n FieldsetHelperText,\n FieldsetLegend,\n FieldsetRoot,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface FieldsetPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Legend: ElementType\n /**\n * The text that displays when the field is valid.\n */\n HelperText: ElementType\n /**\n * The text that displays when the field is invalid.\n */\n ErrorText: ElementType\n}\n\n/**\n * An Object containing the parts of the Field component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the FieldParts object and\n * the entire family of components vs. only what you use.\n */\nexport const FieldsetParts: FieldsetPartsValue = {\n Root: FieldsetRoot,\n Legend: FieldsetLegend,\n HelperText: FieldsetHelperText,\n ErrorText: FieldsetErrorText,\n}\n","import type { FieldsetRootProps } from '@ark-ui/react'\nimport { splitProps } from '../../utils'\nimport { FieldsetParts } from './parts'\nimport type { FieldsetVariantProps } from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Fieldset component.\n * @module Fieldset\n */\n\nexport interface FieldsetProps extends FieldsetRootProps, FieldsetVariantProps {\n /**\n * The legend/title/label of the fieldset group.\n */\n legend?: string\n /**\n * The description text for the fieldset group.\n */\n helperText?: string\n /**\n * The error text for the fieldset group shown when the field is invalid.\n */\n errorText?: string\n}\n\n/**\n * A component used for grouping related fields in a form that is an\n * abstraction of the Fieldset primitives.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function Fieldset(props: FieldsetProps) {\n const [fieldsetProps, { usage }, rootProps] = splitProps(\n props,\n ['legend', 'helperText', 'errorText', 'children'],\n ['usage'],\n )\n\n return (\n <FieldsetParts.Root {...rootProps}>\n <FieldsetParts.Legend usage={usage}>\n {fieldsetProps.legend}\n </FieldsetParts.Legend>\n <FieldsetParts.HelperText usage={usage}>\n {fieldsetProps.helperText}\n </FieldsetParts.HelperText>\n\n {fieldsetProps.children}\n\n <FieldsetParts.ErrorText>\n {fieldsetProps.errorText}\n </FieldsetParts.ErrorText>\n </FieldsetParts.Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,WACd,UACG,WAC0B;AAC7B,QAAM,SAAS,UAAU,IAAI,OAAO,CAAC,EAA+B;AACpE,QAAM,OAAO,CAAC;AAEd,aAAW,OAAO,OAAO;AACvB,QAAI,WAAW;AACf,aAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AACzC,UAAI,UAAU,CAAC,EAAE,SAAS,GAAc,GAAG;AACzC,eAAO,CAAC,EAAE,GAAc,IAAI,MAAM,GAAG;AACrC,mBAAW;AACX;AAAA,MACF;AAAA,IACF;AACA,QAAI,CAAC,UAAU;AACb,WAAK,GAAc,IAAI,MAAM,GAAG;AAAA,IAClC;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,QAAQ,IAAI;AACzB;;;AChDA,sBAKO;AACP,iBAAmB;AACnB,qBAGO;AAeH;AAHG,SAAS,aAAa,OAA0B;AACrD,QAAM,aAAS,yBAAS;AACxB,SACE,4CAAC,yBAAS,MAAT,EAAe,GAAG,OAAO,eAAW,eAAG,OAAO,MAAM,MAAM,SAAS,GAAG;AAE3E;AAOO,SAAS,eACd,OACA;AACA,QAAM,EAAE,OAAO,GAAG,YAAY,IAAI;AAClC,QAAM,aAAS,yBAAS,EAAE,MAAM,CAAC;AACjC,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,QAAQ,YAAY,SAAS;AAAA;AAAA,EACpD;AAEJ;AAOO,SAAS,mBACd,OACA;AACA,QAAM,EAAE,OAAO,GAAG,gBAAgB,IAAI;AACtC,QAAM,aAAS,yBAAS,EAAE,MAAM,CAAC;AACjC,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,YAAY,gBAAgB,SAAS;AAAA;AAAA,EAC5D;AAEJ;AAOO,SAAS,kBAAkB,OAAgC;AAChE,QAAM,aAAS,yBAAS;AACxB,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,WAAW,MAAM,SAAS;AAAA;AAAA,EACjD;AAEJ;;;ACrCO,IAAM,gBAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AACb;;;ACPI,IAAAC,sBAAA;AARG,SAASC,UAAS,OAAsB;AAC7C,QAAM,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,IAAI;AAAA,IAC5C;AAAA,IACA,CAAC,UAAU,cAAc,aAAa,UAAU;AAAA,IAChD,CAAC,OAAO;AAAA,EACV;AAEA,SACE,8CAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,iDAAC,cAAc,QAAd,EAAqB,OACnB,wBAAc,QACjB;AAAA,IACA,6CAAC,cAAc,YAAd,EAAyB,OACvB,wBAAc,YACjB;AAAA,IAEC,cAAc;AAAA,IAEf,6CAAC,cAAc,WAAd,EACE,wBAAc,WACjB;AAAA,KACF;AAEJ;","names":["Fieldset","import_jsx_runtime","Fieldset"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/fieldset/parts.ts
|
|
21
|
+
var parts_exports = {};
|
|
22
|
+
__export(parts_exports, {
|
|
23
|
+
FieldsetParts: () => FieldsetParts
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(parts_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/fieldset/primitives.tsx
|
|
28
|
+
var import_fieldset = require("@ark-ui/react/fieldset");
|
|
29
|
+
var import_css = require("@cerberus/styled-system/css");
|
|
30
|
+
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
function FieldsetRoot(props) {
|
|
33
|
+
const styles = (0, import_recipes.fieldset)();
|
|
34
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fieldset.Fieldset.Root, { ...props, className: (0, import_css.cx)(styles.root, props.className) });
|
|
35
|
+
}
|
|
36
|
+
function FieldsetLegend(props) {
|
|
37
|
+
const { usage, ...legendProps } = props;
|
|
38
|
+
const styles = (0, import_recipes.fieldset)({ usage });
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
import_fieldset.Fieldset.Legend,
|
|
41
|
+
{
|
|
42
|
+
...legendProps,
|
|
43
|
+
className: (0, import_css.cx)(styles.legend, legendProps.className)
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function FieldsetHelperText(props) {
|
|
48
|
+
const { usage, ...helperTextProps } = props;
|
|
49
|
+
const styles = (0, import_recipes.fieldset)({ usage });
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_fieldset.Fieldset.HelperText,
|
|
52
|
+
{
|
|
53
|
+
...helperTextProps,
|
|
54
|
+
className: (0, import_css.cx)(styles.helperText, helperTextProps.className)
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function FieldsetErrorText(props) {
|
|
59
|
+
const styles = (0, import_recipes.fieldset)();
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
import_fieldset.Fieldset.ErrorText,
|
|
62
|
+
{
|
|
63
|
+
...props,
|
|
64
|
+
className: (0, import_css.cx)(styles.errorText, props.className)
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/components/fieldset/parts.ts
|
|
70
|
+
var FieldsetParts = {
|
|
71
|
+
Root: FieldsetRoot,
|
|
72
|
+
Legend: FieldsetLegend,
|
|
73
|
+
HelperText: FieldsetHelperText,
|
|
74
|
+
ErrorText: FieldsetErrorText
|
|
75
|
+
};
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
FieldsetParts
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=parts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fieldset/parts.ts","../../../../src/components/fieldset/primitives.tsx"],"sourcesContent":["import type { ElementType } from 'react'\nimport {\n FieldsetErrorText,\n FieldsetHelperText,\n FieldsetLegend,\n FieldsetRoot,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface FieldsetPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Legend: ElementType\n /**\n * The text that displays when the field is valid.\n */\n HelperText: ElementType\n /**\n * The text that displays when the field is invalid.\n */\n ErrorText: ElementType\n}\n\n/**\n * An Object containing the parts of the Field component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the FieldParts object and\n * the entire family of components vs. only what you use.\n */\nexport const FieldsetParts: FieldsetPartsValue = {\n Root: FieldsetRoot,\n Legend: FieldsetLegend,\n HelperText: FieldsetHelperText,\n ErrorText: FieldsetErrorText,\n}\n","import {\n Fieldset,\n type FieldsetHelperTextProps,\n type FieldsetLegendProps,\n type FieldsetRootProps,\n} from '@ark-ui/react/fieldset'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n fieldset,\n type FieldsetVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains all the primitives of the Fieldset component.\n * @module 'react/fieldset'\n */\n\n/**\n * The context & container for the Fieldset components.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetRoot(props: FieldsetRootProps) {\n const styles = fieldset()\n return (\n <Fieldset.Root {...props} className={cx(styles.root, props.className)} />\n )\n}\n\n/**\n * The legend element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetLegend(\n props: FieldsetLegendProps & FieldsetVariantProps,\n) {\n const { usage, ...legendProps } = props\n const styles = fieldset({ usage })\n return (\n <Fieldset.Legend\n {...legendProps}\n className={cx(styles.legend, legendProps.className)}\n />\n )\n}\n\n/**\n * The description element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetHelperText(\n props: FieldsetHelperTextProps & FieldsetVariantProps,\n) {\n const { usage, ...helperTextProps } = props\n const styles = fieldset({ usage })\n return (\n <Fieldset.HelperText\n {...helperTextProps}\n className={cx(styles.helperText, helperTextProps.className)}\n />\n )\n}\n\n/**\n * The error text element for the Fieldset group.\n * @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)\n * @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)\n */\nexport function FieldsetErrorText(props: FieldsetHelperTextProps) {\n const styles = fieldset()\n return (\n <Fieldset.ErrorText\n {...props}\n className={cx(styles.errorText, props.className)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAKO;AACP,iBAAmB;AACnB,qBAGO;AAeH;AAHG,SAAS,aAAa,OAA0B;AACrD,QAAM,aAAS,yBAAS;AACxB,SACE,4CAAC,yBAAS,MAAT,EAAe,GAAG,OAAO,eAAW,eAAG,OAAO,MAAM,MAAM,SAAS,GAAG;AAE3E;AAOO,SAAS,eACd,OACA;AACA,QAAM,EAAE,OAAO,GAAG,YAAY,IAAI;AAClC,QAAM,aAAS,yBAAS,EAAE,MAAM,CAAC;AACjC,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,QAAQ,YAAY,SAAS;AAAA;AAAA,EACpD;AAEJ;AAOO,SAAS,mBACd,OACA;AACA,QAAM,EAAE,OAAO,GAAG,gBAAgB,IAAI;AACtC,QAAM,aAAS,yBAAS,EAAE,MAAM,CAAC;AACjC,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,YAAY,gBAAgB,SAAS;AAAA;AAAA,EAC5D;AAEJ;AAOO,SAAS,kBAAkB,OAAgC;AAChE,QAAM,aAAS,yBAAS;AACxB,SACE;AAAA,IAAC,yBAAS;AAAA,IAAT;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,WAAW,MAAM,SAAS;AAAA;AAAA,EACjD;AAEJ;;;ADrCO,IAAM,gBAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AACb;","names":[]}
|