@cerberus-design/react 0.15.0-next-e0ce56e → 0.15.0-next-739c492
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 +313 -112
- package/build/legacy/components/Checkbox.cjs +27 -35
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/DatePicker.client.cjs +67 -89
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/components/Fieldset.cjs +4 -17
- package/build/legacy/components/Fieldset.cjs.map +1 -1
- package/build/legacy/components/FieldsetLabel.cjs.map +1 -1
- package/build/legacy/components/FileStatus.cjs +126 -79
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/Legend.cjs +10 -22
- package/build/legacy/components/Legend.cjs.map +1 -1
- package/build/legacy/components/Radio.cjs +4 -21
- package/build/legacy/components/Radio.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +19 -54
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs +17 -24
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/components/button/button.cjs +1 -1
- package/build/legacy/components/button/button.cjs.map +1 -1
- package/build/legacy/components/button/index.cjs +1 -1
- package/build/legacy/components/button/index.cjs.map +1 -1
- package/build/legacy/components/button/parts.cjs +1 -1
- package/build/legacy/components/button/parts.cjs.map +1 -1
- package/build/legacy/components/{FieldMessage.cjs → deprecated/FieldMessage.cjs} +4 -17
- package/build/legacy/components/deprecated/FieldMessage.cjs.map +1 -0
- package/build/legacy/components/{Textarea.cjs → deprecated/Label.cjs} +24 -36
- package/build/legacy/components/deprecated/Label.cjs.map +1 -0
- package/build/legacy/components/field/field.cjs +130 -0
- package/build/legacy/components/field/field.cjs.map +1 -0
- package/build/legacy/components/field/index.cjs +261 -0
- package/build/legacy/components/field/index.cjs.map +1 -0
- package/build/legacy/components/field/parts.cjs +184 -0
- package/build/legacy/components/field/parts.cjs.map +1 -0
- package/build/legacy/components/field/primitives.cjs +186 -0
- package/build/legacy/components/field/primitives.cjs.map +1 -0
- package/build/legacy/components/field/start-indicator.cjs +45 -0
- package/build/legacy/components/field/start-indicator.cjs.map +1 -0
- package/build/legacy/components/field/status-indicator.cjs +78 -0
- package/build/legacy/components/field/status-indicator.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +1 -1
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +1 -1
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/field.cjs +23 -4
- package/build/legacy/context/field.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +168 -166
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs.map +1 -1
- package/build/legacy/index.cjs +1156 -1067
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/utils/index.cjs +22 -2
- package/build/legacy/utils/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +313 -112
- package/build/modern/{chunk-2JX27W6Y.js → chunk-2BIHLH4V.js} +2 -2
- package/build/modern/chunk-2BIHLH4V.js.map +1 -0
- package/build/modern/{chunk-3ZDFQO25.js → chunk-6EUC3SUI.js} +4 -7
- package/build/modern/chunk-6EUC3SUI.js.map +1 -0
- package/build/modern/{chunk-MER66QUY.js → chunk-6KZVE4HC.js} +1 -1
- package/build/modern/{chunk-MER66QUY.js.map → chunk-6KZVE4HC.js.map} +1 -1
- package/build/modern/{chunk-FTPZHG6J.js → chunk-6WOJAMZV.js} +3 -9
- package/build/modern/chunk-6WOJAMZV.js.map +1 -0
- package/build/modern/chunk-7VA5SXTY.js +31 -0
- package/build/modern/chunk-7VA5SXTY.js.map +1 -0
- package/build/modern/chunk-7YVOZULL.js +23 -0
- package/build/modern/chunk-7YVOZULL.js.map +1 -0
- package/build/modern/{chunk-KU2AWAK3.js → chunk-B2A6QFKT.js} +4 -17
- package/build/modern/chunk-B2A6QFKT.js.map +1 -0
- package/build/modern/chunk-BL7G3577.js +29 -0
- package/build/modern/chunk-BL7G3577.js.map +1 -0
- package/build/modern/chunk-C5NL3X7W.js +96 -0
- package/build/modern/chunk-C5NL3X7W.js.map +1 -0
- package/build/modern/chunk-CNA2VKAH.js +43 -0
- package/build/modern/chunk-CNA2VKAH.js.map +1 -0
- package/build/modern/{chunk-Z7FGXAND.js → chunk-FMRWRVUS.js} +2 -2
- package/build/modern/{chunk-NGOLRISW.js → chunk-FVE4GBB7.js} +9 -8
- package/build/modern/chunk-FVE4GBB7.js.map +1 -0
- package/build/modern/{chunk-7P7OWBGV.js → chunk-G2VFEBY4.js} +8 -8
- package/build/modern/chunk-G2VFEBY4.js.map +1 -0
- package/build/modern/{chunk-XQICKZH4.js → chunk-GENS32QO.js} +10 -8
- package/build/modern/chunk-GENS32QO.js.map +1 -0
- package/build/modern/{chunk-Q4IV5NUT.js → chunk-GNPGG4ND.js} +37 -40
- package/build/modern/chunk-GNPGG4ND.js.map +1 -0
- package/build/modern/{chunk-7S47NSGR.js → chunk-H54FR7IP.js} +2 -2
- package/build/modern/chunk-IGSC4IEA.js +37 -0
- package/build/modern/chunk-IGSC4IEA.js.map +1 -0
- package/build/modern/{chunk-JWIJHSI6.js → chunk-L7N24B6B.js} +3 -6
- package/build/modern/chunk-L7N24B6B.js.map +1 -0
- package/build/modern/{chunk-3RGRHMJQ.js → chunk-LCN7LYTU.js} +5 -5
- package/build/modern/{chunk-3BM6MZ4A.js → chunk-MWRO5QYD.js} +1 -1
- package/build/modern/chunk-MWRO5QYD.js.map +1 -0
- package/build/modern/{chunk-PZAZKQMO.js → chunk-OYT7RGC7.js} +1 -1
- package/build/modern/chunk-OYT7RGC7.js.map +1 -0
- package/build/modern/{chunk-ILQW5VZT.js → chunk-RBNOEAWJ.js} +4 -7
- package/build/modern/chunk-RBNOEAWJ.js.map +1 -0
- package/build/modern/{chunk-5QONP7GT.js → chunk-S2X5OEPK.js} +2 -10
- package/build/modern/chunk-S2X5OEPK.js.map +1 -0
- package/build/modern/chunk-TYPULJMJ.js +1 -0
- package/build/modern/chunk-Z52R6ABJ.js +21 -0
- package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
- package/build/modern/components/Checkbox.js +1 -2
- package/build/modern/components/DatePicker.client.js +3 -4
- package/build/modern/components/Fieldset.js +1 -2
- package/build/modern/components/FieldsetLabel.js +1 -1
- package/build/modern/components/FileStatus.js +9 -3
- package/build/modern/components/Legend.js +1 -2
- package/build/modern/components/Radio.js +1 -3
- package/build/modern/components/Select.js +1 -2
- package/build/modern/components/Toggle.js +1 -2
- package/build/modern/components/button/button.js +1 -1
- package/build/modern/components/button/index.js +2 -2
- package/build/modern/components/button/parts.js +2 -2
- package/build/modern/components/deprecated/FieldMessage.js +8 -0
- package/build/modern/components/deprecated/Label.js +17 -0
- package/build/modern/components/field/field.js +14 -0
- package/build/modern/components/field/index.js +42 -0
- package/build/modern/components/field/index.js.map +1 -0
- package/build/modern/components/field/parts.js +11 -0
- package/build/modern/components/field/parts.js.map +1 -0
- package/build/modern/components/field/primitives.js +24 -0
- package/build/modern/components/field/primitives.js.map +1 -0
- package/build/modern/components/field/start-indicator.js +7 -0
- package/build/modern/components/field/start-indicator.js.map +1 -0
- package/build/modern/components/field/status-indicator.js +9 -0
- package/build/modern/components/field/status-indicator.js.map +1 -0
- package/build/modern/context/confirm-modal.js +2 -2
- package/build/modern/context/cta-modal.js +4 -4
- package/build/modern/context/field.js +34 -4
- package/build/modern/context/field.js.map +1 -1
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +10 -5
- package/build/modern/hooks/useDate.js +1 -1
- package/build/modern/index.js +85 -62
- package/build/modern/index.js.map +1 -1
- package/build/modern/utils/index.js +5 -3
- package/package.json +2 -2
- package/src/components/Checkbox.tsx +13 -9
- package/src/components/DatePicker.client.tsx +2 -14
- package/src/components/Fieldset.tsx +3 -3
- package/src/components/FieldsetLabel.tsx +5 -2
- package/src/components/FileStatus.tsx +4 -5
- package/src/components/Legend.tsx +5 -6
- package/src/components/Radio.tsx +2 -7
- package/src/components/Select.tsx +1 -16
- package/src/components/Toggle.tsx +14 -7
- package/src/components/button/button.tsx +1 -1
- package/src/components/button/parts.ts +6 -0
- package/src/components/{FieldMessage.tsx → deprecated/FieldMessage.tsx} +2 -13
- package/src/components/deprecated/Label.tsx +24 -0
- package/src/components/field/field.tsx +77 -0
- package/src/components/field/index.ts +5 -0
- package/src/components/field/parts.ts +71 -0
- package/src/components/field/primitives.tsx +197 -0
- package/src/components/field/start-indicator.tsx +23 -0
- package/src/components/field/status-indicator.tsx +58 -0
- package/src/context/field.tsx +6 -5
- package/src/context/prompt-modal.tsx +16 -18
- package/src/hooks/useDate.ts +1 -7
- package/src/index.ts +4 -6
- package/src/utils/index.ts +30 -0
- package/build/legacy/components/FieldMessage.cjs.map +0 -1
- package/build/legacy/components/Input.cjs +0 -95
- package/build/legacy/components/Input.cjs.map +0 -1
- package/build/legacy/components/Label.cjs +0 -93
- package/build/legacy/components/Label.cjs.map +0 -1
- package/build/legacy/components/Textarea.cjs.map +0 -1
- package/build/modern/chunk-2JX27W6Y.js.map +0 -1
- package/build/modern/chunk-3BM6MZ4A.js.map +0 -1
- package/build/modern/chunk-3ZDFQO25.js.map +0 -1
- package/build/modern/chunk-5QONP7GT.js.map +0 -1
- package/build/modern/chunk-7P7OWBGV.js.map +0 -1
- package/build/modern/chunk-C5EHJUS5.js +0 -10
- package/build/modern/chunk-C5EHJUS5.js.map +0 -1
- package/build/modern/chunk-FTPZHG6J.js.map +0 -1
- package/build/modern/chunk-ILQW5VZT.js.map +0 -1
- package/build/modern/chunk-JIJM6JFJ.js +0 -36
- package/build/modern/chunk-JIJM6JFJ.js.map +0 -1
- package/build/modern/chunk-JWIJHSI6.js.map +0 -1
- package/build/modern/chunk-KU2AWAK3.js.map +0 -1
- package/build/modern/chunk-NGOLRISW.js.map +0 -1
- package/build/modern/chunk-NMF2HYWO.js +0 -50
- package/build/modern/chunk-NMF2HYWO.js.map +0 -1
- package/build/modern/chunk-PZAZKQMO.js.map +0 -1
- package/build/modern/chunk-Q4IV5NUT.js.map +0 -1
- package/build/modern/chunk-UZDVOIW5.js +0 -33
- package/build/modern/chunk-UZDVOIW5.js.map +0 -1
- package/build/modern/chunk-VYCU7I4J.js +0 -43
- package/build/modern/chunk-VYCU7I4J.js.map +0 -1
- package/build/modern/chunk-XQICKZH4.js.map +0 -1
- package/build/modern/components/FieldMessage.js +0 -9
- package/build/modern/components/Input.js +0 -11
- package/build/modern/components/Label.js +0 -10
- package/build/modern/components/Textarea.js +0 -9
- package/src/components/Input.tsx +0 -69
- package/src/components/Label.tsx +0 -69
- package/src/components/Textarea.tsx +0 -52
- /package/build/modern/{chunk-Z7FGXAND.js.map → chunk-FMRWRVUS.js.map} +0 -0
- /package/build/modern/{chunk-7S47NSGR.js.map → chunk-H54FR7IP.js.map} +0 -0
- /package/build/modern/{chunk-3RGRHMJQ.js.map → chunk-LCN7LYTU.js.map} +0 -0
- /package/build/modern/{components/FieldMessage.js.map → chunk-TYPULJMJ.js.map} +0 -0
- /package/build/modern/components/{Input.js.map → deprecated/FieldMessage.js.map} +0 -0
- /package/build/modern/components/{Label.js.map → deprecated/Label.js.map} +0 -0
- /package/build/modern/components/{Textarea.js.map → field/field.js.map} +0 -0
|
@@ -75,8 +75,15 @@ import { DroppableContainer } from '@dnd-kit/core';
|
|
|
75
75
|
import { DroppableContainers } from '@dnd-kit/core';
|
|
76
76
|
import { DroppableMeasuring } from '@dnd-kit/core';
|
|
77
77
|
import { ElementType } from 'react';
|
|
78
|
+
import { FieldHelperTextProps } from '@ark-ui/react/field';
|
|
79
|
+
import { FieldInputProps as FieldInputProps_2 } from '@ark-ui/react/field';
|
|
80
|
+
import { FieldLabelProps } from '@ark-ui/react/field';
|
|
78
81
|
import { FieldMessageVariantProps } from '@cerberus/styled-system/recipes';
|
|
82
|
+
import { FieldRootProps as FieldRootProps_2 } from '@ark-ui/react/field';
|
|
83
|
+
import type { FieldRootProps as FieldRootProps_3 } from '@ark-ui/react';
|
|
79
84
|
import type { FieldsetHTMLAttributes } from 'react';
|
|
85
|
+
import { FieldTextareaProps } from '@ark-ui/react/field';
|
|
86
|
+
import { FieldVariantProps } from '@cerberus/styled-system/recipes';
|
|
80
87
|
import { FileStatusVariantProps } from '@cerberus/styled-system/recipes';
|
|
81
88
|
import { ForwardRefExoticComponent } from 'react';
|
|
82
89
|
import { getClientRect } from '@dnd-kit/core';
|
|
@@ -86,7 +93,6 @@ import { HTMLAttributes } from 'react';
|
|
|
86
93
|
import { HtmlHTMLAttributes } from 'react';
|
|
87
94
|
import { IconButtonVariantProps } from '@cerberus/styled-system/recipes';
|
|
88
95
|
import { InputHTMLAttributes } from 'react';
|
|
89
|
-
import { InputVariantProps } from '@cerberus/styled-system/recipes';
|
|
90
96
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
91
97
|
import { KeyboardCode } from '@dnd-kit/core';
|
|
92
98
|
import { KeyboardCodes } from '@dnd-kit/core';
|
|
@@ -150,7 +156,6 @@ import { TabsVariantProps } from '@cerberus/styled-system/recipes';
|
|
|
150
156
|
import { TagVariantProps } from '@cerberus/styled-system/recipes';
|
|
151
157
|
import { TbodyVariantProps } from '@cerberus/styled-system/recipes';
|
|
152
158
|
import { TdVariantProps } from '@cerberus/styled-system/recipes';
|
|
153
|
-
import type { TextareaHTMLAttributes } from 'react';
|
|
154
159
|
import { ThVariantProps } from '@cerberus/styled-system/recipes';
|
|
155
160
|
import { ToggleVariantProps } from '@cerberus/styled-system/recipes';
|
|
156
161
|
import { TooltipContentProps } from '@ark-ui/react/tooltip';
|
|
@@ -530,10 +535,6 @@ declare interface BaseSelectProps {
|
|
|
530
535
|
* The placeholder text when no option is selected.
|
|
531
536
|
*/
|
|
532
537
|
placeholder?: string;
|
|
533
|
-
/**
|
|
534
|
-
* The label of the select.
|
|
535
|
-
*/
|
|
536
|
-
label: string;
|
|
537
538
|
}
|
|
538
539
|
export { BaseSelectProps }
|
|
539
540
|
export { BaseSelectProps as BaseSelectProps_alias_1 }
|
|
@@ -575,7 +576,13 @@ export { ButtonParts as ButtonParts_alias_2 }
|
|
|
575
576
|
* @module 'button/parts'
|
|
576
577
|
*/
|
|
577
578
|
declare interface ButtonPartsValue {
|
|
579
|
+
/**
|
|
580
|
+
* The context provider of the button.
|
|
581
|
+
*/
|
|
578
582
|
Root: ElementType;
|
|
583
|
+
/**
|
|
584
|
+
* The icon of the button.
|
|
585
|
+
*/
|
|
579
586
|
Icon: ElementType;
|
|
580
587
|
}
|
|
581
588
|
|
|
@@ -629,13 +636,13 @@ export declare type CheckboxIconProps = SVGProps<SVGSVGElement>;
|
|
|
629
636
|
*/
|
|
630
637
|
declare type CheckboxProps = CheckboxVariantProps & Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'id'> & {
|
|
631
638
|
/**
|
|
632
|
-
*
|
|
639
|
+
* @deprecated
|
|
633
640
|
*/
|
|
634
641
|
describedBy?: string;
|
|
635
642
|
/**
|
|
636
|
-
*
|
|
643
|
+
* @deprecated use the Field.ids.control instead
|
|
637
644
|
*/
|
|
638
|
-
id
|
|
645
|
+
id?: string;
|
|
639
646
|
/**
|
|
640
647
|
* Used to display a mixed checked state.
|
|
641
648
|
* @description [ARIA Mixed State](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/examples/checkbox-mixed/)
|
|
@@ -1506,18 +1513,34 @@ export { FeatureFlagValue }
|
|
|
1506
1513
|
export { FeatureFlagValue as FeatureFlagValue_alias_1 }
|
|
1507
1514
|
|
|
1508
1515
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1516
|
+
* The Field component is the context provider for all FieldParts and displays
|
|
1517
|
+
* the label, helperText, and ErrorText.
|
|
1518
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1519
|
+
* @example
|
|
1520
|
+
* ```tsx
|
|
1521
|
+
* <Field
|
|
1522
|
+
* ids={{
|
|
1523
|
+
* control: 'firstName',
|
|
1524
|
+
* }}
|
|
1525
|
+
* label="Label"
|
|
1526
|
+
* helperText="This is what people will see on your profile."
|
|
1527
|
+
* errorText="A first name is required to create an account."
|
|
1528
|
+
* required
|
|
1529
|
+
* >
|
|
1530
|
+
* <Input name="firstName" type="text" />
|
|
1531
|
+
* </Field>
|
|
1532
|
+
* ```
|
|
1511
1533
|
*/
|
|
1512
|
-
declare function Field(props:
|
|
1534
|
+
declare function Field(props: FieldProps): JSX_2.Element;
|
|
1513
1535
|
export { Field }
|
|
1514
1536
|
export { Field as Field_alias_1 }
|
|
1537
|
+
export { Field as Field_alias_2 }
|
|
1515
1538
|
|
|
1516
1539
|
/**
|
|
1517
1540
|
* This module provides a context and hook for the field.
|
|
1518
1541
|
* @module Field
|
|
1519
1542
|
*/
|
|
1520
|
-
declare interface FieldContextValue {
|
|
1543
|
+
export declare interface FieldContextValue {
|
|
1521
1544
|
/**
|
|
1522
1545
|
* Whether the field is disabled.
|
|
1523
1546
|
* @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)
|
|
@@ -1536,23 +1559,93 @@ declare interface FieldContextValue {
|
|
|
1536
1559
|
*/
|
|
1537
1560
|
invalid?: boolean;
|
|
1538
1561
|
}
|
|
1539
|
-
export { FieldContextValue }
|
|
1540
|
-
export { FieldContextValue as FieldContextValue_alias_1 }
|
|
1541
1562
|
|
|
1542
1563
|
/**
|
|
1543
|
-
*
|
|
1544
|
-
*
|
|
1564
|
+
* The error text for the Field component that is shown when the field is
|
|
1565
|
+
* invalid.
|
|
1566
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1545
1567
|
* @example
|
|
1546
1568
|
* ```tsx
|
|
1547
|
-
* <
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1552
|
-
|
|
1553
|
-
|
|
1569
|
+
* <FieldRoot>
|
|
1570
|
+
* <FieldInput />
|
|
1571
|
+
* <FieldErrorText>Error text</FieldErrorText>
|
|
1572
|
+
* </FieldRoot>
|
|
1573
|
+
* ```
|
|
1574
|
+
*/
|
|
1575
|
+
declare function FieldErrorText(props: FieldHelperTextProps): JSX_2.Element | null;
|
|
1576
|
+
export { FieldErrorText }
|
|
1577
|
+
export { FieldErrorText as FieldErrorText_alias_1 }
|
|
1578
|
+
export { FieldErrorText as FieldErrorText_alias_2 }
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* The helper text for the Field component that is shown when the field is
|
|
1582
|
+
* valid.
|
|
1583
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1584
|
+
* @example
|
|
1585
|
+
* ```tsx
|
|
1586
|
+
* <FieldRoot>
|
|
1587
|
+
* <FieldInput />
|
|
1588
|
+
* <FieldHelperText>Helper text</FieldHelperText>
|
|
1589
|
+
* </FieldRoot>
|
|
1590
|
+
* ```
|
|
1591
|
+
*/
|
|
1592
|
+
declare function FieldHelperText(props: FieldHelperTextProps): JSX_2.Element | null;
|
|
1593
|
+
export { FieldHelperText }
|
|
1594
|
+
export { FieldHelperText as FieldHelperText_alias_1 }
|
|
1595
|
+
export { FieldHelperText as FieldHelperText_alias_2 }
|
|
1596
|
+
|
|
1597
|
+
declare type FieldIndicatorProps = HTMLAttributes<HTMLSpanElement>;
|
|
1598
|
+
export { FieldIndicatorProps }
|
|
1599
|
+
export { FieldIndicatorProps as FieldIndicatorProps_alias_1 }
|
|
1600
|
+
export { FieldIndicatorProps as FieldIndicatorProps_alias_2 }
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* The input for the Field component.
|
|
1604
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1605
|
+
* @example
|
|
1606
|
+
* ```tsx
|
|
1607
|
+
* <FieldRoot>
|
|
1608
|
+
* <FieldInput />
|
|
1609
|
+
* </FieldRoot>
|
|
1610
|
+
* ```
|
|
1611
|
+
*/
|
|
1612
|
+
declare function FieldInput(props: FieldInputProps): JSX_2.Element;
|
|
1613
|
+
export { FieldInput }
|
|
1614
|
+
export { FieldInput as FieldInput_alias_1 }
|
|
1615
|
+
export { FieldInput as FieldInput_alias_2 }
|
|
1616
|
+
|
|
1617
|
+
declare interface FieldInputProps extends Omit<FieldInputProps_2, 'size'>, FieldVariantProps {
|
|
1618
|
+
/**
|
|
1619
|
+
* An optional icon to display at the start of the input.
|
|
1620
|
+
*/
|
|
1621
|
+
startIcon?: ReactNode;
|
|
1622
|
+
/**
|
|
1623
|
+
* An optional icon to display at the end of the input.
|
|
1624
|
+
*/
|
|
1625
|
+
endIcon?: ReactNode;
|
|
1626
|
+
}
|
|
1627
|
+
export { FieldInputProps }
|
|
1628
|
+
export { FieldInputProps as FieldInputProps_alias_1 }
|
|
1629
|
+
export { FieldInputProps as FieldInputProps_alias_2 }
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* The label for the Field component.
|
|
1633
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1634
|
+
* @example
|
|
1635
|
+
* ```tsx
|
|
1636
|
+
* <FieldRoot>
|
|
1637
|
+
* <FieldLabel>Label</FieldLabel>
|
|
1638
|
+
* </FieldRoot>
|
|
1554
1639
|
* ```
|
|
1555
1640
|
*/
|
|
1641
|
+
declare function FieldLabel(props: FieldLabelProps): JSX_2.Element;
|
|
1642
|
+
export { FieldLabel }
|
|
1643
|
+
export { FieldLabel as FieldLabel_alias_1 }
|
|
1644
|
+
export { FieldLabel as FieldLabel_alias_2 }
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* @deprecated use FieldHelperText, FieldErrorText, or FieldParts instead
|
|
1648
|
+
*/
|
|
1556
1649
|
declare function FieldMessage(props: FieldMessageProps): JSX_2.Element;
|
|
1557
1650
|
export { FieldMessage }
|
|
1558
1651
|
export { FieldMessage as FieldMessage_alias_1 }
|
|
@@ -1577,6 +1670,111 @@ declare type FieldMessageProps = FieldMessageBaseProps & FieldMessageVariantProp
|
|
|
1577
1670
|
export { FieldMessageProps }
|
|
1578
1671
|
export { FieldMessageProps as FieldMessageProps_alias_1 }
|
|
1579
1672
|
|
|
1673
|
+
/**
|
|
1674
|
+
* An Object containing the parts of the Field component. For users that
|
|
1675
|
+
* prefer Object component syntax.
|
|
1676
|
+
*
|
|
1677
|
+
* @remarks
|
|
1678
|
+
*
|
|
1679
|
+
* When using object component syntax, you import the FieldParts object and
|
|
1680
|
+
* the entire family of components vs. only what you use.
|
|
1681
|
+
*/
|
|
1682
|
+
declare const FieldParts: FieldPartsValue;
|
|
1683
|
+
export { FieldParts }
|
|
1684
|
+
export { FieldParts as FieldParts_alias_1 }
|
|
1685
|
+
export { FieldParts as FieldParts_alias_2 }
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* This module contains the parts of the Field component.
|
|
1689
|
+
* @module 'field/parts'
|
|
1690
|
+
*/
|
|
1691
|
+
declare interface FieldPartsValue {
|
|
1692
|
+
/**
|
|
1693
|
+
* The container of the field.
|
|
1694
|
+
*/
|
|
1695
|
+
Root: ElementType;
|
|
1696
|
+
/**
|
|
1697
|
+
* The label of the field.
|
|
1698
|
+
*/
|
|
1699
|
+
Label: ElementType;
|
|
1700
|
+
/**
|
|
1701
|
+
* The input of the field.
|
|
1702
|
+
*/
|
|
1703
|
+
Input: ElementType;
|
|
1704
|
+
/**
|
|
1705
|
+
* The textarea of the field.
|
|
1706
|
+
*/
|
|
1707
|
+
Textarea: ElementType;
|
|
1708
|
+
/**
|
|
1709
|
+
* The text that displays when the field is valid.
|
|
1710
|
+
*/
|
|
1711
|
+
HelperText: ElementType;
|
|
1712
|
+
/**
|
|
1713
|
+
* The text that displays when the field is invalid.
|
|
1714
|
+
*/
|
|
1715
|
+
ErrorText: ElementType;
|
|
1716
|
+
/**
|
|
1717
|
+
* The indicator that appears at the start of the field.
|
|
1718
|
+
*/
|
|
1719
|
+
StartIndicator: ElementType;
|
|
1720
|
+
/**
|
|
1721
|
+
* The status indicator of the field.
|
|
1722
|
+
*/
|
|
1723
|
+
StatusIndicator: ElementType;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
declare interface FieldProps extends FieldRootProps_2 {
|
|
1727
|
+
/**
|
|
1728
|
+
* The label of the field.
|
|
1729
|
+
*/
|
|
1730
|
+
label?: string;
|
|
1731
|
+
/**
|
|
1732
|
+
* The helper text of the field.
|
|
1733
|
+
*/
|
|
1734
|
+
helperText?: string;
|
|
1735
|
+
/**
|
|
1736
|
+
* A helper text positioned at the end of the field. Good for Textarea fields.
|
|
1737
|
+
*/
|
|
1738
|
+
secondaryHelperText?: string;
|
|
1739
|
+
/**
|
|
1740
|
+
* The error text of the field. Shown when the field is invalid.
|
|
1741
|
+
*/
|
|
1742
|
+
errorText?: string;
|
|
1743
|
+
}
|
|
1744
|
+
export { FieldProps }
|
|
1745
|
+
export { FieldProps as FieldProps_alias_1 }
|
|
1746
|
+
export { FieldProps as FieldProps_alias_2 }
|
|
1747
|
+
|
|
1748
|
+
/**
|
|
1749
|
+
* @deprecated use FieldRoot or FieldParts instead
|
|
1750
|
+
*/
|
|
1751
|
+
export declare function FieldProvider(props: PropsWithChildren<FieldRootProps_3>): JSX.Element;
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* The context & container for the Field components.
|
|
1755
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1756
|
+
* @example
|
|
1757
|
+
* ```tsx
|
|
1758
|
+
* <FieldRoot required ids={{ input: 'exampleId' }}>
|
|
1759
|
+
* <FieldLabel>Label</FieldLabel>
|
|
1760
|
+
* <FieldInput />
|
|
1761
|
+
* </FieldRoot>
|
|
1762
|
+
* ```
|
|
1763
|
+
*/
|
|
1764
|
+
declare function FieldRoot(props: FieldRootProps): JSX_2.Element;
|
|
1765
|
+
export { FieldRoot }
|
|
1766
|
+
export { FieldRoot as FieldRoot_alias_1 }
|
|
1767
|
+
export { FieldRoot as FieldRoot_alias_2 }
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* This module contains all the primitives of the Field component.
|
|
1771
|
+
* @module 'field'
|
|
1772
|
+
*/
|
|
1773
|
+
declare type FieldRootProps = FieldRootProps_2 & FieldVariantProps;
|
|
1774
|
+
export { FieldRootProps }
|
|
1775
|
+
export { FieldRootProps as FieldRootProps_alias_1 }
|
|
1776
|
+
export { FieldRootProps as FieldRootProps_alias_2 }
|
|
1777
|
+
|
|
1580
1778
|
/**
|
|
1581
1779
|
* A component to group related elements in a form for accessibility.
|
|
1582
1780
|
* @memberof Field
|
|
@@ -1655,7 +1853,9 @@ export { FieldsetLabel as FieldsetLabel_alias_1 }
|
|
|
1655
1853
|
* This module contains the FieldsetLabel component.
|
|
1656
1854
|
* @module FieldsetLabel
|
|
1657
1855
|
*/
|
|
1658
|
-
declare type FieldsetLabelProps = LabelProps & LabelVariantProps
|
|
1856
|
+
declare type FieldsetLabelProps = LabelProps & LabelVariantProps & {
|
|
1857
|
+
htmlFor?: string;
|
|
1858
|
+
};
|
|
1659
1859
|
export { FieldsetLabelProps }
|
|
1660
1860
|
export { FieldsetLabelProps as FieldsetLabelProps_alias_1 }
|
|
1661
1861
|
|
|
@@ -1667,6 +1867,55 @@ declare type FieldsetProps = FieldsetHTMLAttributes<HTMLFieldSetElement>;
|
|
|
1667
1867
|
export { FieldsetProps }
|
|
1668
1868
|
export { FieldsetProps as FieldsetProps_alias_1 }
|
|
1669
1869
|
|
|
1870
|
+
/**
|
|
1871
|
+
* The start indicator displays an indicator at the start of the Input.
|
|
1872
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1873
|
+
*/
|
|
1874
|
+
declare function FieldStartIndicator(props: FieldIndicatorProps): JSX_2.Element | null;
|
|
1875
|
+
export { FieldStartIndicator }
|
|
1876
|
+
export { FieldStartIndicator as FieldStartIndicator_alias_1 }
|
|
1877
|
+
export { FieldStartIndicator as FieldStartIndicator_alias_2 }
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* The invalid status indicator for the Field component.
|
|
1881
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1882
|
+
* @example
|
|
1883
|
+
* ```tsx
|
|
1884
|
+
* <FieldRoot>
|
|
1885
|
+
* <FieldStatusIndicator />
|
|
1886
|
+
* </FieldRoot>
|
|
1887
|
+
* ```
|
|
1888
|
+
*/
|
|
1889
|
+
declare function FieldStatusIndicator(props: FieldStatusIndicatorProps): JSX_2.Element;
|
|
1890
|
+
export { FieldStatusIndicator }
|
|
1891
|
+
export { FieldStatusIndicator as FieldStatusIndicator_alias_1 }
|
|
1892
|
+
export { FieldStatusIndicator as FieldStatusIndicator_alias_2 }
|
|
1893
|
+
|
|
1894
|
+
declare interface FieldStatusIndicatorProps extends HTMLAttributes<HTMLSpanElement> {
|
|
1895
|
+
/**
|
|
1896
|
+
* The fallback content to display when the field is valid.
|
|
1897
|
+
*/
|
|
1898
|
+
fallback?: ReactNode;
|
|
1899
|
+
}
|
|
1900
|
+
export { FieldStatusIndicatorProps }
|
|
1901
|
+
export { FieldStatusIndicatorProps as FieldStatusIndicatorProps_alias_1 }
|
|
1902
|
+
export { FieldStatusIndicatorProps as FieldStatusIndicatorProps_alias_2 }
|
|
1903
|
+
|
|
1904
|
+
/**
|
|
1905
|
+
* The textarea for the Field component.
|
|
1906
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
1907
|
+
* @example
|
|
1908
|
+
* ```tsx
|
|
1909
|
+
* <FieldRoot>
|
|
1910
|
+
* <FieldTextarea />
|
|
1911
|
+
* </FieldRoot>
|
|
1912
|
+
* ```
|
|
1913
|
+
*/
|
|
1914
|
+
declare function FieldTextarea(props: FieldTextareaProps): JSX_2.Element;
|
|
1915
|
+
export { FieldTextarea }
|
|
1916
|
+
export { FieldTextarea as FieldTextarea_alias_1 }
|
|
1917
|
+
export { FieldTextarea as FieldTextarea_alias_2 }
|
|
1918
|
+
|
|
1670
1919
|
declare interface FileBaseStatusProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
|
|
1671
1920
|
/**
|
|
1672
1921
|
* A unique identifier for the file status. Required for accessibility.
|
|
@@ -1923,39 +2172,29 @@ export { IndeterminateProgressBarProps }
|
|
|
1923
2172
|
export { IndeterminateProgressBarProps as IndeterminateProgressBarProps_alias_1 }
|
|
1924
2173
|
|
|
1925
2174
|
/**
|
|
1926
|
-
* A
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
2175
|
+
* A named export for the FieldInput component.
|
|
2176
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
2177
|
+
* @example
|
|
2178
|
+
* ```tsx
|
|
2179
|
+
* import { Input } from '@cerberus/react'
|
|
2180
|
+
*
|
|
2181
|
+
* <Field
|
|
2182
|
+
* ids={{
|
|
2183
|
+
* control: 'email',
|
|
2184
|
+
* }}
|
|
2185
|
+
* label="Enter your email"
|
|
2186
|
+
* helperText="We'll never share your email with anyone else."
|
|
2187
|
+
* errorText="Email is required."
|
|
2188
|
+
* required
|
|
2189
|
+
* >
|
|
2190
|
+
* <Input type="email" />
|
|
2191
|
+
* </Field>
|
|
2192
|
+
* ```
|
|
1930
2193
|
*/
|
|
1931
|
-
declare
|
|
2194
|
+
declare const Input: typeof FieldInput;
|
|
1932
2195
|
export { Input }
|
|
1933
2196
|
export { Input as Input_alias_1 }
|
|
1934
|
-
|
|
1935
|
-
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
1936
|
-
/**
|
|
1937
|
-
* The id of the FieldMessage component used to describe the input. Required for accessibility.
|
|
1938
|
-
*/
|
|
1939
|
-
describedBy?: string;
|
|
1940
|
-
/**
|
|
1941
|
-
* The unique identifier for the input element. Required for accessibility.
|
|
1942
|
-
*/
|
|
1943
|
-
id: string;
|
|
1944
|
-
/**
|
|
1945
|
-
* An optional icon to display at the start of the input.
|
|
1946
|
-
*/
|
|
1947
|
-
startIcon?: ReactNode;
|
|
1948
|
-
/**
|
|
1949
|
-
* An optional icon to display at the end of the input.
|
|
1950
|
-
*/
|
|
1951
|
-
endIcon?: ReactNode;
|
|
1952
|
-
}
|
|
1953
|
-
export { InputBaseProps }
|
|
1954
|
-
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
1955
|
-
|
|
1956
|
-
declare type InputProps = InputBaseProps & InputVariantProps;
|
|
1957
|
-
export { InputProps }
|
|
1958
|
-
export { InputProps as InputProps_alias_1 }
|
|
2197
|
+
export { Input as Input_alias_2 }
|
|
1959
2198
|
|
|
1960
2199
|
export { KeyboardCode }
|
|
1961
2200
|
|
|
@@ -1970,16 +2209,7 @@ export { KeyboardSensorOptions }
|
|
|
1970
2209
|
export { KeyboardSensorProps }
|
|
1971
2210
|
|
|
1972
2211
|
/**
|
|
1973
|
-
*
|
|
1974
|
-
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
1975
|
-
* @see https://cerberus.digitalu.design/react/label
|
|
1976
|
-
* @example
|
|
1977
|
-
* ```tsx
|
|
1978
|
-
* <Field required>
|
|
1979
|
-
* <Label htmlFor="search" hidden>Search everything</Label>
|
|
1980
|
-
* <Input id="search" startIcon={Search} type="text" />
|
|
1981
|
-
* </Field>
|
|
1982
|
-
* ```
|
|
2212
|
+
* @deprecated Use FieldLabel or FieldParts.Label instead.
|
|
1983
2213
|
*/
|
|
1984
2214
|
declare function Label(props: PropsWithChildren<LabelProps>): JSX_2.Element;
|
|
1985
2215
|
export { Label }
|
|
@@ -1989,16 +2219,7 @@ export { Label as Label_alias_1 }
|
|
|
1989
2219
|
* This module contains the Label component.
|
|
1990
2220
|
* @module
|
|
1991
2221
|
*/
|
|
1992
|
-
declare
|
|
1993
|
-
/**
|
|
1994
|
-
* The unique identifier for the input element. Required for accessibility.
|
|
1995
|
-
*/
|
|
1996
|
-
htmlFor: string;
|
|
1997
|
-
/**
|
|
1998
|
-
* Used to hide the label from the UI while keeping it accessible to screen readers. Typically used for global search inputs that have no visible label.
|
|
1999
|
-
*/
|
|
2000
|
-
hidden?: boolean;
|
|
2001
|
-
}
|
|
2222
|
+
declare type LabelBaseProps = HTMLAttributes<HTMLLabelElement>;
|
|
2002
2223
|
export { LabelBaseProps }
|
|
2003
2224
|
export { LabelBaseProps as LabelBaseProps_alias_1 }
|
|
2004
2225
|
|
|
@@ -3272,6 +3493,18 @@ declare type SpinnerProps = SVGProps<SVGSVGElement> & {
|
|
|
3272
3493
|
export { SpinnerProps }
|
|
3273
3494
|
export { SpinnerProps as SpinnerProps_alias_1 }
|
|
3274
3495
|
|
|
3496
|
+
/**
|
|
3497
|
+
* Splits the properties of an object into multiple groups based on lists of keys.
|
|
3498
|
+
* @param props - The object to split.
|
|
3499
|
+
* @param keyGroups - The lists of keys to include in each group.
|
|
3500
|
+
* @returns An array of objects: each containing the properties specified in the corresponding key group, and the last object containing the remaining keys.
|
|
3501
|
+
*/
|
|
3502
|
+
declare function splitProps<T extends object>(props: T, ...keyGroups: (keyof T)[][]): {
|
|
3503
|
+
[K in keyof T]?: T[K];
|
|
3504
|
+
}[];
|
|
3505
|
+
export { splitProps }
|
|
3506
|
+
export { splitProps as splitProps_alias_1 }
|
|
3507
|
+
|
|
3275
3508
|
/**
|
|
3276
3509
|
* This module contains the tag component.
|
|
3277
3510
|
* @module
|
|
@@ -3556,34 +3789,10 @@ declare function Text_2(props: PropsWithChildren<TextProps>): JSX_2.Element;
|
|
|
3556
3789
|
export { Text_2 as Text }
|
|
3557
3790
|
export { Text_2 as Text_alias_1 }
|
|
3558
3791
|
|
|
3559
|
-
|
|
3560
|
-
* A component that allows the user to input large blocks of text.
|
|
3561
|
-
* @see https://cerberus.digitalu.design/react/textarea
|
|
3562
|
-
*/
|
|
3563
|
-
declare function Textarea(props: TextareaProps): JSX.Element;
|
|
3792
|
+
declare const Textarea: typeof FieldTextarea;
|
|
3564
3793
|
export { Textarea }
|
|
3565
3794
|
export { Textarea as Textarea_alias_1 }
|
|
3566
|
-
|
|
3567
|
-
/**
|
|
3568
|
-
* This module contains the Textarea component.
|
|
3569
|
-
* @module
|
|
3570
|
-
*/
|
|
3571
|
-
declare interface TextareaBaseProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
3572
|
-
/**
|
|
3573
|
-
* The ID of the FieldMessage that describes the textarea.
|
|
3574
|
-
*/
|
|
3575
|
-
describedBy?: string;
|
|
3576
|
-
/**
|
|
3577
|
-
* The unique id of the textarea.
|
|
3578
|
-
*/
|
|
3579
|
-
id: string;
|
|
3580
|
-
}
|
|
3581
|
-
export { TextareaBaseProps }
|
|
3582
|
-
export { TextareaBaseProps as TextareaBaseProps_alias_1 }
|
|
3583
|
-
|
|
3584
|
-
declare type TextareaProps = InputVariantProps & TextareaBaseProps;
|
|
3585
|
-
export { TextareaProps }
|
|
3586
|
-
export { TextareaProps as TextareaProps_alias_1 }
|
|
3795
|
+
export { Textarea as Textarea_alias_2 }
|
|
3587
3796
|
|
|
3588
3797
|
declare type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span';
|
|
3589
3798
|
export { TextElements }
|
|
@@ -3747,7 +3956,7 @@ export { Toggle as Toggle_alias_1 }
|
|
|
3747
3956
|
*/
|
|
3748
3957
|
declare type ToggleBase = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'id' | 'value'> & {
|
|
3749
3958
|
/**
|
|
3750
|
-
*
|
|
3959
|
+
* @deprecated
|
|
3751
3960
|
*/
|
|
3752
3961
|
describedBy?: string;
|
|
3753
3962
|
/**
|
|
@@ -3872,13 +4081,7 @@ export { useCTAModal }
|
|
|
3872
4081
|
export { useCTAModal as useCTAModal_alias_1 }
|
|
3873
4082
|
|
|
3874
4083
|
/**
|
|
3875
|
-
*
|
|
3876
|
-
* @example
|
|
3877
|
-
* ```tsx
|
|
3878
|
-
* const MyComponent = () => {
|
|
3879
|
-
* const date = useDate({ initialValue: '01 JAN 2024' })
|
|
3880
|
-
* return <input onChange={date.onChange} type="text" value={date.value} />
|
|
3881
|
-
* }
|
|
4084
|
+
* @deprecated use the DatePicker family instead
|
|
3882
4085
|
*/
|
|
3883
4086
|
declare function useDate(options?: UseDateOptions): UseDateReturn;
|
|
3884
4087
|
export { useDate }
|
|
@@ -3944,9 +4147,7 @@ export { useFeatureFlags as useFeatureFlags_alias_1 }
|
|
|
3944
4147
|
* Used to access the field context.
|
|
3945
4148
|
* @returns The field context.
|
|
3946
4149
|
*/
|
|
3947
|
-
declare function useFieldContext(): FieldContextValue;
|
|
3948
|
-
export { useFieldContext }
|
|
3949
|
-
export { useFieldContext as useFieldContext_alias_1 }
|
|
4150
|
+
export declare function useFieldContext(): FieldContextValue;
|
|
3950
4151
|
|
|
3951
4152
|
/**
|
|
3952
4153
|
* Provides a hook for using a custom modal via the native dialog element
|
|
@@ -28,46 +28,35 @@ var import_recipes = require("@cerberus/styled-system/recipes");
|
|
|
28
28
|
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
29
29
|
var import_css = require("@cerberus/styled-system/css");
|
|
30
30
|
|
|
31
|
-
// src/
|
|
31
|
+
// src/context/cerberus.tsx
|
|
32
32
|
var import_react = require("react");
|
|
33
|
-
function Show(props) {
|
|
34
|
-
const { when, children, fallback } = props;
|
|
35
|
-
const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
|
|
36
|
-
return (0, import_react.useMemo)(() => {
|
|
37
|
-
if (condition) return children;
|
|
38
|
-
return fallback ?? null;
|
|
39
|
-
}, [condition, children, fallback]);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/context/field.tsx
|
|
43
|
-
var import_react2 = require("react");
|
|
44
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var
|
|
46
|
-
function useFieldContext() {
|
|
47
|
-
const context = (0, import_react2.useContext)(FieldContext);
|
|
48
|
-
if (!context) {
|
|
49
|
-
throw new Error("useFieldContext must be used within a Field Provider.");
|
|
50
|
-
}
|
|
51
|
-
return context;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/context/cerberus.tsx
|
|
55
|
-
var import_react3 = require("react");
|
|
56
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
57
|
-
var CerberusContext = (0, import_react3.createContext)(null);
|
|
34
|
+
var CerberusContext = (0, import_react.createContext)(null);
|
|
58
35
|
function useCerberusContext() {
|
|
59
|
-
const context = (0,
|
|
36
|
+
const context = (0, import_react.useContext)(CerberusContext);
|
|
60
37
|
if (!context) {
|
|
61
38
|
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
62
39
|
}
|
|
63
40
|
return context;
|
|
64
41
|
}
|
|
65
42
|
|
|
43
|
+
// src/components/Show.tsx
|
|
44
|
+
var import_react2 = require("react");
|
|
45
|
+
function Show(props) {
|
|
46
|
+
const { when, children, fallback } = props;
|
|
47
|
+
const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
|
|
48
|
+
return (0, import_react2.useMemo)(() => {
|
|
49
|
+
if (condition) return children;
|
|
50
|
+
return fallback ?? null;
|
|
51
|
+
}, [condition, children, fallback]);
|
|
52
|
+
}
|
|
53
|
+
|
|
66
54
|
// src/components/Checkbox.tsx
|
|
67
|
-
var
|
|
55
|
+
var import_field = require("@ark-ui/react/field");
|
|
56
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
68
57
|
function Checkbox(props) {
|
|
69
|
-
const {
|
|
70
|
-
const { invalid,
|
|
58
|
+
const { size, checked, mixed, ...nativeProps } = props;
|
|
59
|
+
const { invalid, disabled, readOnly, required, ariaDescribedby, ids } = (0, import_field.useFieldContext)();
|
|
71
60
|
const styles = (0, import_recipes.checkbox)({ size });
|
|
72
61
|
const { icons } = useCerberusContext();
|
|
73
62
|
const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons;
|
|
@@ -77,7 +66,7 @@ function Checkbox(props) {
|
|
|
77
66
|
if (!IndeterminateIcon) {
|
|
78
67
|
throw new Error("The CerberusProvider is missing the indeterminate icon.");
|
|
79
68
|
}
|
|
80
|
-
return /* @__PURE__ */ (0,
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
81
70
|
"div",
|
|
82
71
|
{
|
|
83
72
|
className: (0, import_css.cx)(
|
|
@@ -88,20 +77,23 @@ function Checkbox(props) {
|
|
|
88
77
|
})
|
|
89
78
|
),
|
|
90
79
|
children: [
|
|
91
|
-
/* @__PURE__ */ (0,
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
92
81
|
"input",
|
|
93
82
|
{
|
|
94
83
|
...nativeProps,
|
|
95
|
-
...
|
|
96
|
-
...
|
|
84
|
+
...disabled && { disabled: true },
|
|
85
|
+
...readOnly && { readOnly: true },
|
|
86
|
+
...required && { required: true },
|
|
87
|
+
...ariaDescribedby && { "aria-describedby": ariaDescribedby },
|
|
97
88
|
...invalid && { "aria-invalid": true },
|
|
98
89
|
...mixed && { "aria-checked": "mixed" },
|
|
90
|
+
id: ids.control,
|
|
99
91
|
className: (0, import_css.cx)("peer", nativeProps.className, styles.input),
|
|
100
92
|
type: "checkbox"
|
|
101
93
|
}
|
|
102
94
|
),
|
|
103
|
-
/* @__PURE__ */ (0,
|
|
104
|
-
/* @__PURE__ */ (0,
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: checked && !mixed, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckIcon, {}) }) }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: mixed, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IndeterminateIcon, {}) }) })
|
|
105
97
|
]
|
|
106
98
|
}
|
|
107
99
|
);
|