@cerberus-design/react 0.10.4 → 0.11.0

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.
Files changed (159) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +244 -2
  2. package/build/legacy/components/Admonition.cjs +419 -0
  3. package/build/legacy/components/Admonition.cjs.map +1 -0
  4. package/build/legacy/components/AnimatingUploadIcon.cjs +124 -0
  5. package/build/legacy/components/AnimatingUploadIcon.cjs.map +1 -0
  6. package/build/legacy/components/Avatar.cjs +110 -13
  7. package/build/legacy/components/Avatar.cjs.map +1 -1
  8. package/build/legacy/components/Checkbox.cjs +107 -10
  9. package/build/legacy/components/Checkbox.cjs.map +1 -1
  10. package/build/legacy/components/CircularProgress.cjs +19 -5
  11. package/build/legacy/components/CircularProgress.cjs.map +1 -1
  12. package/build/legacy/components/Fieldset.cjs +66 -0
  13. package/build/legacy/components/Fieldset.cjs.map +1 -0
  14. package/build/legacy/components/FieldsetLabel.cjs +49 -0
  15. package/build/legacy/components/FieldsetLabel.cjs.map +1 -0
  16. package/build/legacy/components/FileStatus.cjs +138 -39
  17. package/build/legacy/components/FileStatus.cjs.map +1 -1
  18. package/build/legacy/components/FileUploader.cjs +120 -22
  19. package/build/legacy/components/FileUploader.cjs.map +1 -1
  20. package/build/legacy/components/Input.cjs +108 -11
  21. package/build/legacy/components/Input.cjs.map +1 -1
  22. package/build/legacy/components/Label.cjs +1 -1
  23. package/build/legacy/components/Label.cjs.map +1 -1
  24. package/build/legacy/components/Legend.cjs +95 -0
  25. package/build/legacy/components/Legend.cjs.map +1 -0
  26. package/build/legacy/components/ModalHeader.cjs +2 -2
  27. package/build/legacy/components/ModalHeader.cjs.map +1 -1
  28. package/build/legacy/components/Notification.cjs +109 -12
  29. package/build/legacy/components/Notification.cjs.map +1 -1
  30. package/build/legacy/components/Radio.cjs +27 -14
  31. package/build/legacy/components/Radio.cjs.map +1 -1
  32. package/build/legacy/components/Select.cjs +111 -14
  33. package/build/legacy/components/Select.cjs.map +1 -1
  34. package/build/legacy/components/Tag.cjs +106 -9
  35. package/build/legacy/components/Tag.cjs.map +1 -1
  36. package/build/legacy/components/Th.cjs +4 -1
  37. package/build/legacy/components/Th.cjs.map +1 -1
  38. package/build/legacy/components/Toggle.cjs +108 -11
  39. package/build/legacy/components/Toggle.cjs.map +1 -1
  40. package/build/legacy/config/cerbIcons.cjs +102 -5
  41. package/build/legacy/config/cerbIcons.cjs.map +1 -1
  42. package/build/legacy/config/defineIcons.cjs +102 -5
  43. package/build/legacy/config/defineIcons.cjs.map +1 -1
  44. package/build/legacy/context/confirm-modal.cjs +141 -40
  45. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  46. package/build/legacy/context/notification-center.cjs +129 -32
  47. package/build/legacy/context/notification-center.cjs.map +1 -1
  48. package/build/legacy/context/prompt-modal.cjs +178 -66
  49. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  50. package/build/legacy/hooks/useModal.cjs +6 -2
  51. package/build/legacy/hooks/useModal.cjs.map +1 -1
  52. package/build/legacy/index.cjs +793 -442
  53. package/build/legacy/index.cjs.map +1 -1
  54. package/build/modern/_tsup-dts-rollup.d.ts +244 -2
  55. package/build/modern/{chunk-S7XGIQY6.js → chunk-243VUIA6.js} +2 -2
  56. package/build/modern/{chunk-LKFXUM3Z.js → chunk-3NE6C66J.js} +36 -25
  57. package/build/modern/{chunk-LKFXUM3Z.js.map → chunk-3NE6C66J.js.map} +1 -1
  58. package/build/modern/chunk-3ZDFQO25.js +31 -0
  59. package/build/modern/chunk-3ZDFQO25.js.map +1 -0
  60. package/build/modern/{chunk-YLPSE5Z2.js → chunk-6QHOKCV3.js} +11 -6
  61. package/build/modern/chunk-6QHOKCV3.js.map +1 -0
  62. package/build/modern/chunk-6TTN2JMY.js +54 -0
  63. package/build/modern/chunk-6TTN2JMY.js.map +1 -0
  64. package/build/modern/{chunk-OW62FLJ6.js → chunk-7T3JIGM7.js} +8 -4
  65. package/build/modern/chunk-7T3JIGM7.js.map +1 -0
  66. package/build/modern/{chunk-7K6PZBHN.js → chunk-CO4BKT7K.js} +5 -2
  67. package/build/modern/{chunk-7K6PZBHN.js.map → chunk-CO4BKT7K.js.map} +1 -1
  68. package/build/modern/{chunk-NBG2OSYI.js → chunk-FT7DFRHQ.js} +2 -2
  69. package/build/modern/chunk-FTPZHG6J.js +46 -0
  70. package/build/modern/{chunk-LJYCFFX7.js.map → chunk-FTPZHG6J.js.map} +1 -1
  71. package/build/modern/{chunk-JCGWTIR4.js → chunk-HCB5NQ5J.js} +5 -4
  72. package/build/modern/chunk-HCB5NQ5J.js.map +1 -0
  73. package/build/modern/chunk-HVKM54BA.js +100 -0
  74. package/build/modern/chunk-HVKM54BA.js.map +1 -0
  75. package/build/modern/{chunk-CMUFJU4S.js → chunk-KLUBAM4U.js} +2 -2
  76. package/build/modern/{chunk-AUAPBPGW.js → chunk-MDIUFBDX.js} +2 -2
  77. package/build/modern/{chunk-I35HMGJQ.js → chunk-NMF2HYWO.js} +2 -2
  78. package/build/modern/{chunk-I35HMGJQ.js.map → chunk-NMF2HYWO.js.map} +1 -1
  79. package/build/modern/{chunk-O6JYYVO7.js → chunk-PA5EB7EO.js} +2 -2
  80. package/build/modern/chunk-PZAZKQMO.js +25 -0
  81. package/build/modern/chunk-PZAZKQMO.js.map +1 -0
  82. package/build/modern/{chunk-EZNGCXVJ.js → chunk-RDQHHCFR.js} +5 -5
  83. package/build/modern/{chunk-BDCFYW34.js → chunk-TMR7JGMP.js} +12 -9
  84. package/build/modern/chunk-TMR7JGMP.js.map +1 -0
  85. package/build/modern/{chunk-WZOYPFUU.js → chunk-UJKS4DDN.js} +2 -2
  86. package/build/modern/{chunk-WLEX22KS.js → chunk-ULYQLKWA.js} +3 -3
  87. package/build/modern/{chunk-WLEX22KS.js.map → chunk-ULYQLKWA.js.map} +1 -1
  88. package/build/modern/{chunk-6YUB3ITX.js → chunk-X4Y4WTRU.js} +10 -10
  89. package/build/modern/{chunk-UXHAFEBA.js → chunk-YMJMB6OP.js} +5 -3
  90. package/build/modern/chunk-YMJMB6OP.js.map +1 -0
  91. package/build/modern/{chunk-GMG3B34U.js → chunk-YWCTMLLO.js} +2 -2
  92. package/build/modern/chunk-ZW3FFE37.js +138 -0
  93. package/build/modern/chunk-ZW3FFE37.js.map +1 -0
  94. package/build/modern/{chunk-477G5ZEL.js → chunk-ZX6DBC2Z.js} +2 -2
  95. package/build/modern/components/Admonition.js +17 -0
  96. package/build/modern/components/Admonition.js.map +1 -0
  97. package/build/modern/components/AnimatingUploadIcon.js +7 -0
  98. package/build/modern/components/AnimatingUploadIcon.js.map +1 -0
  99. package/build/modern/components/Avatar.js +4 -3
  100. package/build/modern/components/Checkbox.js +4 -3
  101. package/build/modern/components/CircularProgress.js +2 -1
  102. package/build/modern/components/Fieldset.js +9 -0
  103. package/build/modern/components/Fieldset.js.map +1 -0
  104. package/build/modern/components/FieldsetLabel.js +7 -0
  105. package/build/modern/components/FieldsetLabel.js.map +1 -0
  106. package/build/modern/components/FileStatus.js +5 -4
  107. package/build/modern/components/FileUploader.js +5 -4
  108. package/build/modern/components/Input.js +4 -3
  109. package/build/modern/components/Label.js +1 -1
  110. package/build/modern/components/Legend.js +10 -0
  111. package/build/modern/components/Legend.js.map +1 -0
  112. package/build/modern/components/ModalHeader.js +1 -1
  113. package/build/modern/components/Notification.js +4 -3
  114. package/build/modern/components/Radio.js +1 -1
  115. package/build/modern/components/Select.js +4 -3
  116. package/build/modern/components/Tag.js +4 -3
  117. package/build/modern/components/Th.js +1 -1
  118. package/build/modern/components/Toggle.js +4 -3
  119. package/build/modern/config/cerbIcons.js +2 -1
  120. package/build/modern/config/defineIcons.js +3 -2
  121. package/build/modern/context/confirm-modal.js +8 -7
  122. package/build/modern/context/notification-center.js +6 -5
  123. package/build/modern/context/prompt-modal.js +10 -9
  124. package/build/modern/hooks/useModal.js +1 -1
  125. package/build/modern/index.js +86 -65
  126. package/build/modern/index.js.map +1 -1
  127. package/package.json +3 -3
  128. package/src/components/Admonition.tsx +186 -0
  129. package/src/components/AnimatingUploadIcon.tsx +83 -0
  130. package/src/components/CircularProgress.tsx +20 -12
  131. package/src/components/Fieldset.tsx +65 -0
  132. package/src/components/FieldsetLabel.tsx +59 -0
  133. package/src/components/FileStatus.tsx +2 -0
  134. package/src/components/FileUploader.tsx +6 -1
  135. package/src/components/Label.tsx +1 -1
  136. package/src/components/Legend.tsx +87 -0
  137. package/src/components/ModalHeader.tsx +2 -2
  138. package/src/components/Radio.tsx +10 -1
  139. package/src/components/Th.tsx +3 -0
  140. package/src/config/cerbIcons.ts +10 -8
  141. package/src/context/prompt-modal.tsx +8 -1
  142. package/src/hooks/useModal.ts +19 -4
  143. package/src/index.ts +4 -0
  144. package/build/modern/chunk-BDCFYW34.js.map +0 -1
  145. package/build/modern/chunk-JCGWTIR4.js.map +0 -1
  146. package/build/modern/chunk-LJYCFFX7.js +0 -33
  147. package/build/modern/chunk-OW62FLJ6.js.map +0 -1
  148. package/build/modern/chunk-UXHAFEBA.js.map +0 -1
  149. package/build/modern/chunk-YLPSE5Z2.js.map +0 -1
  150. /package/build/modern/{chunk-S7XGIQY6.js.map → chunk-243VUIA6.js.map} +0 -0
  151. /package/build/modern/{chunk-NBG2OSYI.js.map → chunk-FT7DFRHQ.js.map} +0 -0
  152. /package/build/modern/{chunk-CMUFJU4S.js.map → chunk-KLUBAM4U.js.map} +0 -0
  153. /package/build/modern/{chunk-AUAPBPGW.js.map → chunk-MDIUFBDX.js.map} +0 -0
  154. /package/build/modern/{chunk-O6JYYVO7.js.map → chunk-PA5EB7EO.js.map} +0 -0
  155. /package/build/modern/{chunk-EZNGCXVJ.js.map → chunk-RDQHHCFR.js.map} +0 -0
  156. /package/build/modern/{chunk-WZOYPFUU.js.map → chunk-UJKS4DDN.js.map} +0 -0
  157. /package/build/modern/{chunk-6YUB3ITX.js.map → chunk-X4Y4WTRU.js.map} +0 -0
  158. /package/build/modern/{chunk-GMG3B34U.js.map → chunk-YWCTMLLO.js.map} +0 -0
  159. /package/build/modern/{chunk-477G5ZEL.js.map → chunk-ZX6DBC2Z.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { Activator } from '@dnd-kit/core';
2
2
  import { Activators } from '@dnd-kit/core';
3
3
  import { Active } from '@dnd-kit/core';
4
+ import { AdmonitionVariantProps } from '@cerberus/styled-system/recipes';
4
5
  import type { AnchorHTMLAttributes } from 'react';
5
6
  import { Announcements } from '@dnd-kit/core';
6
7
  import { applyModifiers } from '@dnd-kit/core';
@@ -10,6 +11,7 @@ import { AvatarVariantProps } from '@cerberus/styled-system/recipes';
10
11
  import { ButtonHTMLAttributes } from 'react';
11
12
  import { ButtonVariantProps } from '@cerberus/styled-system/recipes';
12
13
  import { CancelDrop } from '@dnd-kit/core';
14
+ import { CarbonIconProps } from '@cerberus/icons';
13
15
  import { CarbonIconType } from '@cerberus/icons';
14
16
  import { ChangeEvent } from 'react';
15
17
  import { CheckboxVariantProps } from '@cerberus/styled-system/recipes';
@@ -55,6 +57,7 @@ import { DroppableContainers } from '@dnd-kit/core';
55
57
  import { DroppableMeasuring } from '@dnd-kit/core';
56
58
  import { ElementType } from 'react';
57
59
  import { FieldMessageVariantProps } from '@cerberus/styled-system/recipes';
60
+ import type { FieldsetHTMLAttributes } from 'react';
58
61
  import { FileStatusVariantProps } from '@cerberus/styled-system/recipes';
59
62
  import { ForwardRefExoticComponent } from 'react';
60
63
  import { getClientRect } from '@dnd-kit/core';
@@ -74,6 +77,7 @@ import { KeyboardSensor } from '@dnd-kit/core';
74
77
  import { KeyboardSensorOptions } from '@dnd-kit/core';
75
78
  import { KeyboardSensorProps } from '@dnd-kit/core';
76
79
  import { LabelVariantProps } from '@cerberus/styled-system/recipes';
80
+ import { LabelVariantProps as LabelVariantProps_2 } from '@cerberus-design/styled-system/recipes';
77
81
  import { MeasuringConfiguration } from '@dnd-kit/core';
78
82
  import { MeasuringFrequency } from '@dnd-kit/core';
79
83
  import { MeasuringStrategy } from '@dnd-kit/core';
@@ -148,6 +152,88 @@ export { Activators }
148
152
 
149
153
  export { Active }
150
154
 
155
+ /**
156
+ * The `Admonition` component is used to create an admonition.
157
+ * @example
158
+ * ```tsx
159
+ * <Admonition palette="page">
160
+ * <AdmonitionHeading palette="page">Page</AdmonitionHeading>
161
+ * <AdmonitionDescription palette="page">
162
+ * This is a page admonition.
163
+ * </AdmonitionDescription>
164
+ * </Admonition>
165
+ * ```
166
+ * @see https://cerberus.digitalu.design/react/admonition
167
+ */
168
+ declare function Admonition(props: AdmonitionProps): JSX_2.Element;
169
+ export { Admonition }
170
+ export { Admonition as Admonition_alias_1 }
171
+
172
+ /**
173
+ * The `AdmonitionDescription` component is used to create a description within
174
+ * an admonition.
175
+ * @example
176
+ * ```tsx
177
+ * <Admonition palette="page">
178
+ * <AdmonitionHeading palette="page">Page</AdmonitionHeading>
179
+ * <AdmonitionDescription palette="page">
180
+ * This is a page admonition.
181
+ * </AdmonitionDescription>
182
+ * </Admonition>
183
+ * ```
184
+ * @see https://cerberus.digitalu.design/react/admonition
185
+ */
186
+ declare function AdmonitionDescription(props: AdmonitionDescriptionProps): JSX_2.Element;
187
+ export { AdmonitionDescription }
188
+ export { AdmonitionDescription as AdmonitionDescription_alias_1 }
189
+
190
+ declare type AdmonitionDescriptionProps = HTMLAttributes<HTMLParagraphElement> & AdmonitionVariantProps;
191
+ export { AdmonitionDescriptionProps }
192
+ export { AdmonitionDescriptionProps as AdmonitionDescriptionProps_alias_1 }
193
+
194
+ /**
195
+ * The `AdmonitionHeading` component is used to create a heading within an
196
+ * admonition.
197
+ * @example
198
+ * ```tsx
199
+ * <Admonition palette="page">
200
+ * <AdmonitionHeading palette="page">Page</AdmonitionHeading>
201
+ * <AdmonitionDescription palette="page">
202
+ * This is a page admonition.
203
+ * </AdmonitionDescription>
204
+ * </Admonition>
205
+ * ```
206
+ * @see https://cerberus.digitalu.design/react/admonition
207
+ */
208
+ declare function AdmonitionHeading(props: AdmonitionHeadingProps): JSX_2.Element;
209
+ export { AdmonitionHeading }
210
+ export { AdmonitionHeading as AdmonitionHeading_alias_1 }
211
+
212
+ declare type AdmonitionHeadingProps = HTMLAttributes<HTMLParagraphElement> & AdmonitionVariantProps;
213
+ export { AdmonitionHeadingProps }
214
+ export { AdmonitionHeadingProps as AdmonitionHeadingProps_alias_1 }
215
+
216
+ /**
217
+ * This module provides a set of components for creating admonitions.
218
+ * @module Admonition
219
+ */
220
+ declare type AdmonitionProps = HTMLAttributes<HTMLDivElement> & AdmonitionVariantProps & {
221
+ /**
222
+ * One off replacement for the icon.
223
+ */
224
+ icon?: ReactNode;
225
+ };
226
+ export { AdmonitionProps }
227
+ export { AdmonitionProps as AdmonitionProps_alias_1 }
228
+
229
+ export declare function AnimatingUploadIcon(props: AnimatingUploadIconProps): JSX_2.Element;
230
+
231
+ /**
232
+ * This module contains an animating icon to use for the FileStatus component.
233
+ * @module
234
+ */
235
+ export declare type AnimatingUploadIconProps = CarbonIconProps;
236
+
151
237
  export { Announcements }
152
238
 
153
239
  export { applyModifiers }
@@ -336,6 +422,10 @@ declare interface CircularProgressProps extends SVGProps<SVGSVGElement> {
336
422
  * What is shown below the now value (default: 'Done')
337
423
  */
338
424
  syntax?: string;
425
+ /**
426
+ * The background style of the CircularProgress
427
+ */
428
+ bgStyle?: 'filled' | 'transparent';
339
429
  }
340
430
  export { CircularProgressProps }
341
431
  export { CircularProgressProps as CircularProgressProps_alias_1 }
@@ -466,6 +556,7 @@ export declare interface DefinedIcons {
466
556
  confirmModal?: IconType;
467
557
  delete?: IconType;
468
558
  promptModal?: IconType;
559
+ waitingFileUploader?: IconType;
469
560
  fileUploader?: IconType;
470
561
  indeterminate?: IconType;
471
562
  infoNotification?: IconType;
@@ -687,6 +778,96 @@ declare type FieldMessageProps = FieldMessageBaseProps & FieldMessageVariantProp
687
778
  export { FieldMessageProps }
688
779
  export { FieldMessageProps as FieldMessageProps_alias_1 }
689
780
 
781
+ /**
782
+ * A component to group related elements in a form for accessibility.
783
+ * @memberof Field
784
+ * @see https://cerberus.digitalu.com/react/fieldset
785
+ * @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)
786
+ * @description [MDN Web Docs: Fieldset](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset)
787
+ * @example
788
+ * ```tsx
789
+ * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'
790
+ * import { Hstack } from '@cerberus/styled-system/jsx'
791
+ *
792
+ * function SomeForm() {
793
+ * return (
794
+ * <form>
795
+ * <Fieldset>
796
+ * <Legend>Do you like cats?</Legend>
797
+ * <Hstack>
798
+ * <Field>
799
+ * <Radio id="yes" name="cats" value="yes" />
800
+ * <Label htmlFor="yes">Yes</Label>
801
+ * </Field>
802
+ * </Hstack>
803
+ * <Hstack>
804
+ * <Field>
805
+ * <Radio id="no" name="cats" value="no" />
806
+ * <Label htmlFor="no">No</Label>
807
+ * </Field>
808
+ * </Hstack>
809
+ * </Fieldset>
810
+ * </form>
811
+ * )
812
+ * }
813
+ */
814
+ declare function Fieldset(props: FieldsetProps): JSX_2.Element;
815
+ export { Fieldset }
816
+ export { Fieldset as Fieldset_alias_1 }
817
+
818
+ /**
819
+ * Used for labeling inputs that are children of a Fieldset group.
820
+ * @memberof Fieldset
821
+ * @see https://cerberus.digitalu.design/react/fieldset
822
+ * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
823
+ * @example
824
+ * ```tsx
825
+ * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'
826
+ * import { Hstack } from '@cerberus/styled-system/jsx'
827
+ *
828
+ * function SomeForm() {
829
+ * return (
830
+ * <form>
831
+ * <Fieldset>
832
+ * <Legend>Do you like cats?</Legend>
833
+ * <Hstack>
834
+ * <Field>
835
+ * <Radio id="yes" name="cats" value="yes" />
836
+ * <FieldsetLabel htmlFor="yes">Yes</FieldsetLabel>
837
+ * </Field>
838
+ * </Hstack>
839
+ * <Hstack>
840
+ * <Field>
841
+ * <Radio id="no" name="cats" value="no" />
842
+ * <FieldsetLabel htmlFor="no">No</FieldsetLabel>
843
+ * </Field>
844
+ * </Hstack>
845
+ * </Fieldset>
846
+ * </form>
847
+ * )
848
+ * }
849
+ * ```
850
+ */
851
+ declare function FieldsetLabel(props: FieldsetLabelProps): JSX_2.Element;
852
+ export { FieldsetLabel }
853
+ export { FieldsetLabel as FieldsetLabel_alias_1 }
854
+
855
+ /**
856
+ * This module contains the FieldsetLabel component.
857
+ * @module FieldsetLabel
858
+ */
859
+ declare type FieldsetLabelProps = LabelProps & LabelVariantProps;
860
+ export { FieldsetLabelProps }
861
+ export { FieldsetLabelProps as FieldsetLabelProps_alias_1 }
862
+
863
+ /**
864
+ * This module contains the Fieldset component.
865
+ * @module Fieldset
866
+ */
867
+ declare type FieldsetProps = FieldsetHTMLAttributes<HTMLFieldSetElement>;
868
+ export { FieldsetProps }
869
+ export { FieldsetProps as FieldsetProps_alias_1 }
870
+
690
871
  declare interface FileBaseStatusProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
691
872
  /**
692
873
  * A unique identifier for the file status. Required for accessibility.
@@ -776,6 +957,10 @@ declare interface FileUploaderProps extends InputHTMLAttributes<HTMLInputElement
776
957
  * The name of the file input element.
777
958
  */
778
959
  name: string;
960
+ /**
961
+ * Disable the FileUploader component. Good for single-use file uploads.
962
+ */
963
+ disabled?: boolean;
779
964
  }
780
965
  export { FileUploaderProps }
781
966
  export { FileUploaderProps as FileUploaderProps_alias_1 }
@@ -958,6 +1143,52 @@ declare type LabelProps = LabelBaseProps & LabelVariantProps;
958
1143
  export { LabelProps }
959
1144
  export { LabelProps as LabelProps_alias_1 }
960
1145
 
1146
+ /**
1147
+ * A component to provide a global label for a group of related elements in a form (for accessibility).
1148
+ * @memberof Fieldset
1149
+ * @see https://cerberus.digitalu.com/react/fieldset
1150
+ * @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)
1151
+ * @description [MDN Web Docs: Legend](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend)
1152
+ * @example
1153
+ * ```tsx
1154
+ * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'
1155
+ * import { Hstack } from '@cerberus/styled-system/jsx'
1156
+ *
1157
+ * function SomeForm() {
1158
+ * return (
1159
+ * <form>
1160
+ * <Fieldset>
1161
+ * <Legend>Do you like cats?</Legend>
1162
+ * <Hstack>
1163
+ * <Field>
1164
+ * <Radio id="yes" name="cats" value="yes" />
1165
+ * <Label htmlFor="yes">Yes</Label>
1166
+ * </Field>
1167
+ * </Hstack>
1168
+ * <Hstack>
1169
+ * <Field>
1170
+ * <Radio id="no" name="cats" value="no" />
1171
+ * <Label htmlFor="no">No</Label>
1172
+ * </Field>
1173
+ * </Hstack>
1174
+ * </Fieldset>
1175
+ * </form>
1176
+ * )
1177
+ * }
1178
+ * ```
1179
+ */
1180
+ declare function Legend(props: LegendProps): JSX_2.Element;
1181
+ export { Legend }
1182
+ export { Legend as Legend_alias_1 }
1183
+
1184
+ /**
1185
+ * This module contains the Fieldset component.
1186
+ * @module Fieldset
1187
+ */
1188
+ declare type LegendProps = HTMLAttributes<HTMLLegendElement> & LabelVariantProps_2;
1189
+ export { LegendProps }
1190
+ export { LegendProps as LegendProps_alias_1 }
1191
+
961
1192
  export { MeasuringConfiguration }
962
1193
 
963
1194
  export { MeasuringFrequency }
@@ -2347,9 +2578,16 @@ export { useFieldContext }
2347
2578
  export { useFieldContext as useFieldContext_alias_1 }
2348
2579
 
2349
2580
  /**
2350
- * Provides a hook for using a custom modal.
2581
+ * Provides a hook for using a custom modal via the native dialog element
2582
+ * methods.
2583
+ *
2584
+ * Cerberus modals use the native dialog element. This hook
2585
+ * does not control the modal via React state but rather by calling the
2586
+ * native dialog element's `showModal` and `close` methods.
2587
+ *
2351
2588
  * @memberof module:Modal
2352
- * @returns The modal hook.
2589
+ * @see https://cerberus.digitalu.design/react/modal
2590
+ * @description [Moz Dev Dialog Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)
2353
2591
  */
2354
2592
  declare function useModal(): UseModalReturnValue;
2355
2593
  export { useModal }
@@ -2372,6 +2610,10 @@ declare interface UseModalReturnValue {
2372
2610
  * Closes the modal.
2373
2611
  */
2374
2612
  close: () => void;
2613
+ /**
2614
+ * Whether the modal is open based on the show and close methods.
2615
+ */
2616
+ isOpen: boolean;
2375
2617
  }
2376
2618
 
2377
2619
  /**
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-BUVVRQLZ.js";
4
4
  import {
5
5
  $cerberusIcons
6
- } from "./chunk-NBG2OSYI.js";
6
+ } from "./chunk-FT7DFRHQ.js";
7
7
 
8
8
  // src/components/Tag.tsx
9
9
  import { css, cx } from "@cerberus/styled-system/css";
@@ -61,4 +61,4 @@ var closableCss = css({
61
61
  export {
62
62
  Tag
63
63
  };
64
- //# sourceMappingURL=chunk-S7XGIQY6.js.map
64
+ //# sourceMappingURL=chunk-243VUIA6.js.map
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  Portal
3
3
  } from "./chunk-GLY7GU5S.js";
4
- import {
5
- ModalHeader
6
- } from "./chunk-WLEX22KS.js";
7
- import {
8
- ModalHeading
9
- } from "./chunk-2UXE5PDG.js";
10
4
  import {
11
5
  Input
12
- } from "./chunk-WZOYPFUU.js";
6
+ } from "./chunk-UJKS4DDN.js";
13
7
  import {
14
8
  Label
15
- } from "./chunk-I35HMGJQ.js";
9
+ } from "./chunk-NMF2HYWO.js";
16
10
  import {
17
11
  Modal
18
12
  } from "./chunk-BE4EOU2P.js";
19
13
  import {
20
14
  ModalDescription
21
15
  } from "./chunk-Q7BRMIBR.js";
16
+ import {
17
+ ModalHeader
18
+ } from "./chunk-ULYQLKWA.js";
19
+ import {
20
+ ModalHeading
21
+ } from "./chunk-2UXE5PDG.js";
22
22
  import {
23
23
  Avatar
24
- } from "./chunk-477G5ZEL.js";
24
+ } from "./chunk-ZX6DBC2Z.js";
25
25
  import {
26
26
  Button
27
27
  } from "./chunk-EXGKZGML.js";
@@ -36,10 +36,10 @@ import {
36
36
  } from "./chunk-JIZQFTW6.js";
37
37
  import {
38
38
  $cerberusIcons
39
- } from "./chunk-NBG2OSYI.js";
39
+ } from "./chunk-FT7DFRHQ.js";
40
40
  import {
41
41
  useModal
42
- } from "./chunk-OW62FLJ6.js";
42
+ } from "./chunk-7T3JIGM7.js";
43
43
 
44
44
  // src/context/prompt-modal.tsx
45
45
  import {
@@ -150,19 +150,30 @@ function PromptModal(props) {
150
150
  mb: "8"
151
151
  }),
152
152
  children: /* @__PURE__ */ jsxs(Field, { invalid: !isValid, children: [
153
- /* @__PURE__ */ jsxs(Label, { htmlFor: "confirm", size: "md", children: [
154
- "Type",
155
- /* @__PURE__ */ jsx(
156
- "strong",
157
- {
158
- className: css({
159
- textTransform: "uppercase"
160
- }),
161
- children: content?.key
162
- }
163
- ),
164
- "to confirm"
165
- ] }),
153
+ /* @__PURE__ */ jsxs(
154
+ Label,
155
+ {
156
+ className: css({
157
+ gap: 1,
158
+ justifyContent: "flex-start"
159
+ }),
160
+ htmlFor: "confirm",
161
+ size: "md",
162
+ children: [
163
+ "Type",
164
+ /* @__PURE__ */ jsx(
165
+ "strong",
166
+ {
167
+ className: css({
168
+ textTransform: "uppercase"
169
+ }),
170
+ children: content?.key
171
+ }
172
+ ),
173
+ "to confirm"
174
+ ]
175
+ }
176
+ ),
166
177
  /* @__PURE__ */ jsx(
167
178
  Input,
168
179
  {
@@ -229,4 +240,4 @@ export {
229
240
  PromptModal,
230
241
  usePromptModal
231
242
  };
232
- //# sourceMappingURL=chunk-LKFXUM3Z.js.map
243
+ //# sourceMappingURL=chunk-3NE6C66J.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/prompt-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type MouseEvent,\n type PropsWithChildren,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Input } from '../components/Input'\nimport { Field } from './field'\nimport { Label } from '../components/Label'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { Show } from '../components/Show'\nimport { useModal } from '../hooks/useModal'\nimport { Modal } from '../components/Modal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\nimport { Avatar } from '../components/Avatar'\n\n/**\n * This module provides a context and hook for the prompt modal.\n * @module PromptModal\n */\n\nexport interface ShowPromptModalOptions {\n /**\n * The kind of prompt modal to show.\n * @default 'non-destructive'\n */\n kind?: 'destructive' | 'non-destructive'\n /**\n * The heading of the prompt modal.\n */\n heading: string\n /**\n * The description of the prompt modal.\n */\n description?: string\n /**\n * The key to confirm the action.\n */\n key: string\n /**\n * The text for the action button.\n */\n actionText: string\n /**\n * The text for the cancel button.\n */\n cancelText: string\n}\nexport type PromptShowResult =\n | ((value: string | PromiseLike<string>) => void)\n | null\n\nexport interface PromptModalValue {\n /**\n * The method to trigger the prompt modal.\n * @returns the value of the key if the action is confirmed.\n * @example\n * ```tsx\n * const accepted = await prompt.show({\n * kind: 'destructive',\n * heading: 'Delete channel?',\n * description:\n * 'This will permanently delete a channel on your account. There is no going back.',\n * key: CHANNEL_NAME,\n * actionText: 'Yes, delete channel',\n * cancelText: 'No, cancel',\n * })\n */\n show: (options: ShowPromptModalOptions) => Promise<string>\n}\n\nconst PromptModalContext = createContext<PromptModalValue | null>(null)\n\nexport interface PromptModalProviderProps {}\n\n/**\n * Provides a prompt modal to the app.\n * @see https://cerberus.digitalu.design/react/prompt-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <PromptModal>\n * <SomeFeatureSection />\n * </PromptModal>\n *\n * // Use the hook to show the prompt modal.\n * const prompt = usePromptModal()\n *\n * const handleClick = useCallback(async () => {\n * const accepted = await prompt.show({\n * kind: 'destructive',\n * heading: 'Delete channel?',\n * description:\n * 'This will permanently delete a channel on your account. There is no going back.',\n * key: CHANNEL_NAME,\n * actionText: 'Yes, delete channel',\n * cancelText: 'No, cancel',\n * })\n * // do something with accepted\n * }, [prompt])\n * ```\n */\nexport function PromptModal(\n props: PropsWithChildren<PromptModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<PromptShowResult>(null)\n const [content, setContent] = useState<ShowPromptModalOptions | null>(null)\n const [inputValue, setInputValue] = useState<string>('')\n const focusTrap = trapFocus(modalRef)\n const PromptIcon = $cerberusIcons.promptModal\n\n const isValid = useMemo(\n () => inputValue === content?.key,\n [inputValue, content],\n )\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setInputValue(e.currentTarget.value)\n },\n [content],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(inputValue)\n }\n close()\n },\n [inputValue, close],\n )\n\n const handleShow = useCallback(\n (options: ShowPromptModalOptions) => {\n return new Promise<string>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <PromptModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <ModalHeader>\n <div\n className={hstack({\n justify: 'center',\n w: 'full',\n })}\n >\n <Show\n when={palette === 'danger'}\n fallback={\n <Avatar\n ariaLabel=\"\"\n gradient=\"charon-light\"\n icon={<PromptIcon size={24} />}\n src=\"\"\n />\n }\n >\n <Avatar\n ariaLabel=\"\"\n gradient=\"hades-dark\"\n icon={<PromptIcon size={24} />}\n src=\"\"\n />\n </Show>\n </div>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n mt: '4',\n mb: '8',\n })}\n >\n <Field invalid={!isValid}>\n <Label htmlFor=\"confirm\" size=\"md\">\n Type\n <strong\n className={css({\n textTransform: 'uppercase',\n })}\n >\n {content?.key}\n </strong>\n to confirm\n </Label>\n <Input\n id=\"confirm\"\n name=\"confirm\"\n onChange={handleChange}\n type=\"text\"\n />\n </Field>\n </div>\n\n <div\n className={hstack({\n justifyContent: 'stretch',\n gap: '4',\n })}\n >\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n disabled={!isValid}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </div>\n </Modal>\n </Portal>\n </PromptModalContext.Provider>\n )\n}\n\n/**\n * Used to retrieve the context of the PromptModal provider.\n */\nexport function usePromptModal(): PromptModalValue {\n const context = useContext(PromptModalContext)\n if (context === null) {\n throw new Error('usePromptModal must be used within a PromptModal Provider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGP,SAAS,WAAW;AACpB,SAAS,QAAQ,cAAc;AAkKrB,SAagB,KAbhB;AA7FV,IAAM,qBAAqB,cAAuC,IAAI;AA+B/D,SAAS,YACd,OACA;AACA,QAAM,EAAE,UAAU,MAAM,MAAM,IAAI,SAAS;AAC3C,QAAM,aAAa,OAAyB,IAAI;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwC,IAAI;AAC1E,QAAM,CAA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BACT;AAAA,gBACA,OAAM;AAAA,gBAEL,mBAAS;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,IAAI;AAAA,kBACb,GAAG;AAAA,gBACL,CAAC;AAAA,gBACD,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,OAAM;AAAA,gBACN,OAAM;AAAA,gBAEL,mBAAS;AAAA;AAAA,YACZ;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAKO,SAAS,iBAAmC;AACjD,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/context/prompt-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type MouseEvent,\n type PropsWithChildren,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Input } from '../components/Input'\nimport { Field } from './field'\nimport { Label } from '../components/Label'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { Show } from '../components/Show'\nimport { useModal } from '../hooks/useModal'\nimport { Modal } from '../components/Modal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\nimport { Avatar } from '../components/Avatar'\n\n/**\n * This module provides a context and hook for the prompt modal.\n * @module PromptModal\n */\n\nexport interface ShowPromptModalOptions {\n /**\n * The kind of prompt modal to show.\n * @default 'non-destructive'\n */\n kind?: 'destructive' | 'non-destructive'\n /**\n * The heading of the prompt modal.\n */\n heading: string\n /**\n * The description of the prompt modal.\n */\n description?: string\n /**\n * The key to confirm the action.\n */\n key: string\n /**\n * The text for the action button.\n */\n actionText: string\n /**\n * The text for the cancel button.\n */\n cancelText: string\n}\nexport type PromptShowResult =\n | ((value: string | PromiseLike<string>) => void)\n | null\n\nexport interface PromptModalValue {\n /**\n * The method to trigger the prompt modal.\n * @returns the value of the key if the action is confirmed.\n * @example\n * ```tsx\n * const accepted = await prompt.show({\n * kind: 'destructive',\n * heading: 'Delete channel?',\n * description:\n * 'This will permanently delete a channel on your account. There is no going back.',\n * key: CHANNEL_NAME,\n * actionText: 'Yes, delete channel',\n * cancelText: 'No, cancel',\n * })\n */\n show: (options: ShowPromptModalOptions) => Promise<string>\n}\n\nconst PromptModalContext = createContext<PromptModalValue | null>(null)\n\nexport interface PromptModalProviderProps {}\n\n/**\n * Provides a prompt modal to the app.\n * @see https://cerberus.digitalu.design/react/prompt-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <PromptModal>\n * <SomeFeatureSection />\n * </PromptModal>\n *\n * // Use the hook to show the prompt modal.\n * const prompt = usePromptModal()\n *\n * const handleClick = useCallback(async () => {\n * const accepted = await prompt.show({\n * kind: 'destructive',\n * heading: 'Delete channel?',\n * description:\n * 'This will permanently delete a channel on your account. There is no going back.',\n * key: CHANNEL_NAME,\n * actionText: 'Yes, delete channel',\n * cancelText: 'No, cancel',\n * })\n * // do something with accepted\n * }, [prompt])\n * ```\n */\nexport function PromptModal(\n props: PropsWithChildren<PromptModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<PromptShowResult>(null)\n const [content, setContent] = useState<ShowPromptModalOptions | null>(null)\n const [inputValue, setInputValue] = useState<string>('')\n const focusTrap = trapFocus(modalRef)\n const PromptIcon = $cerberusIcons.promptModal\n\n const isValid = useMemo(\n () => inputValue === content?.key,\n [inputValue, content],\n )\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setInputValue(e.currentTarget.value)\n },\n [content],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(inputValue)\n }\n close()\n },\n [inputValue, close],\n )\n\n const handleShow = useCallback(\n (options: ShowPromptModalOptions) => {\n return new Promise<string>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <PromptModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <ModalHeader>\n <div\n className={hstack({\n justify: 'center',\n w: 'full',\n })}\n >\n <Show\n when={palette === 'danger'}\n fallback={\n <Avatar\n ariaLabel=\"\"\n gradient=\"charon-light\"\n icon={<PromptIcon size={24} />}\n src=\"\"\n />\n }\n >\n <Avatar\n ariaLabel=\"\"\n gradient=\"hades-dark\"\n icon={<PromptIcon size={24} />}\n src=\"\"\n />\n </Show>\n </div>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n mt: '4',\n mb: '8',\n })}\n >\n <Field invalid={!isValid}>\n <Label\n className={css({\n gap: 1,\n justifyContent: 'flex-start',\n })}\n htmlFor=\"confirm\"\n size=\"md\"\n >\n Type\n <strong\n className={css({\n textTransform: 'uppercase',\n })}\n >\n {content?.key}\n </strong>\n to confirm\n </Label>\n <Input\n id=\"confirm\"\n name=\"confirm\"\n onChange={handleChange}\n type=\"text\"\n />\n </Field>\n </div>\n\n <div\n className={hstack({\n justifyContent: 'stretch',\n gap: '4',\n })}\n >\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n disabled={!isValid}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </div>\n </Modal>\n </Portal>\n </PromptModalContext.Provider>\n )\n}\n\n/**\n * Used to retrieve the context of the PromptModal provider.\n */\nexport function usePromptModal(): PromptModalValue {\n const context = useContext(PromptModalContext)\n if (context === null) {\n throw new Error('usePromptModal must be used within a PromptModal Provider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGP,SAAS,WAAW;AACpB,SAAS,QAAQ,cAAc;AAkKrB,SAagB,KAbhB;AA7FV,IAAM,qBAAqB,cAAuC,IAAI;AA+B/D,SAAS,YACd,OACA;AACA,QAAM,EAAE,UAAU,MAAM,MAAM,IAAI,SAAS;AAC3C,QAAM,aAAa,OAAyB,IAAI;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwC,IAAI;AAC1E,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AACvD,QAAM,YAAY,UAAU,QAAQ;AACpC,QAAM,aAAa,eAAe;AAElC,QAAM,UAAU;AAAA,IACd,MAAM,eAAe,SAAS;AAAA,IAC9B,CAAC,YAAY,OAAO;AAAA,EACtB;AAEA,QAAM,UAAU;AAAA,IACd,MAAO,SAAS,SAAS,gBAAgB,WAAW;AAAA,IACpD,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,oBAAc,EAAE,cAAc,KAAK;AAAA,IACrC;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,YAAM,SAAS,EAAE;AACjB,UAAI,OAAO,UAAU,QAAQ;AAC3B,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,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,31 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-UZDVOIW5.js";
4
+
5
+ // src/components/Fieldset.tsx
6
+ import { css, cx } from "@cerberus/styled-system/css";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function Fieldset(props) {
9
+ const { invalid, ...formState } = useFieldContext();
10
+ return /* @__PURE__ */ jsx(
11
+ "fieldset",
12
+ {
13
+ ...props,
14
+ ...formState,
15
+ ...invalid && { "aria-invalid": true },
16
+ className: cx(
17
+ props.className,
18
+ css({
19
+ border: "none",
20
+ pt: 2,
21
+ margin: 0
22
+ })
23
+ )
24
+ }
25
+ );
26
+ }
27
+
28
+ export {
29
+ Fieldset
30
+ };
31
+ //# sourceMappingURL=chunk-3ZDFQO25.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Fieldset.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport type { FieldsetHTMLAttributes } from 'react'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the Fieldset component.\n * @module Fieldset\n */\n\nexport type FieldsetProps = FieldsetHTMLAttributes<HTMLFieldSetElement>\n\n/**\n * A component to group related elements in a form for accessibility.\n * @memberof Field\n * @see https://cerberus.digitalu.com/react/fieldset\n * @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)\n * @description [MDN Web Docs: Fieldset](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset)\n * @example\n * ```tsx\n * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'\n * import { Hstack } from '@cerberus/styled-system/jsx'\n *\n * function SomeForm() {\n * return (\n * <form>\n * <Fieldset>\n * <Legend>Do you like cats?</Legend>\n * <Hstack>\n * <Field>\n * <Radio id=\"yes\" name=\"cats\" value=\"yes\" />\n * <Label htmlFor=\"yes\">Yes</Label>\n * </Field>\n * </Hstack>\n * <Hstack>\n * <Field>\n * <Radio id=\"no\" name=\"cats\" value=\"no\" />\n * <Label htmlFor=\"no\">No</Label>\n * </Field>\n * </Hstack>\n * </Fieldset>\n * </form>\n * )\n * }\n */\nexport function Fieldset(props: FieldsetProps) {\n const { invalid, ...formState } = useFieldContext()\n\n return (\n <fieldset\n {...props}\n {...formState}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n props.className,\n css({\n border: 'none',\n pt: 2,\n margin: 0,\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,KAAK,UAAU;AAgDpB;AAJG,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,SAAS,GAAG,UAAU,IAAI,gBAAgB;AAElD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW;AAAA,QACT,MAAM;AAAA,QACN,IAAI;AAAA,UACF,QAAQ;AAAA,UACR,IAAI;AAAA,UACJ,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,3 +1,7 @@
1
+ import {
2
+ Show
3
+ } from "./chunk-BUVVRQLZ.js";
4
+
1
5
  // src/components/CircularProgress.tsx
2
6
  import { cq } from "@cerberus/styled-system/patterns";
3
7
  import { css } from "@cerberus/styled-system/css";
@@ -7,6 +11,7 @@ function CircularProgress(props) {
7
11
  const radius = `calc(50% * (1 - ${strokeW}/100))`;
8
12
  const status = props.syntax ?? "Done";
9
13
  const now = props.now >= 100 ? 100 : props.now;
14
+ const bgStyle = props.bgStyle ?? "filled";
10
15
  return /* @__PURE__ */ jsx(
11
16
  "div",
12
17
  {
@@ -44,18 +49,18 @@ function CircularProgress(props) {
44
49
  "stop",
45
50
  {
46
51
  offset: "0%",
47
- stopColor: "var(--cerberus-colors-action-bg-initial)"
52
+ stopColor: "var(--cerberus-colors-data-viz-progress-start)"
48
53
  }
49
54
  ),
50
55
  /* @__PURE__ */ jsx(
51
56
  "stop",
52
57
  {
53
58
  offset: "100%",
54
- stopColor: "var(--cerberus-colors-action-bg-active)"
59
+ stopColor: "var(--cerberus-colors-data-viz-progress-end)"
55
60
  }
56
61
  )
57
62
  ] }) }),
58
- /* @__PURE__ */ jsx(
63
+ /* @__PURE__ */ jsx(Show, { when: bgStyle === "filled", children: /* @__PURE__ */ jsx(
59
64
  "circle",
60
65
  {
61
66
  className: css({
@@ -66,7 +71,7 @@ function CircularProgress(props) {
66
71
  r: `calc(50% * (1 - ${strokeW}/100))`,
67
72
  pathLength: "100"
68
73
  }
69
- ),
74
+ ) }),
70
75
  /* @__PURE__ */ jsx(
71
76
  "circle",
72
77
  {
@@ -86,7 +91,7 @@ function CircularProgress(props) {
86
91
  className: css({
87
92
  stroke: "url(#gradient)",
88
93
  transition: "stroke-dashoffset, stroke 0.5s ease",
89
- "&:is([data-complete=true])": {
94
+ _isComplete: {
90
95
  stroke: "success.bg.initial"
91
96
  }
92
97
  }),
@@ -145,4 +150,4 @@ function CircularProgress(props) {
145
150
  export {
146
151
  CircularProgress
147
152
  };
148
- //# sourceMappingURL=chunk-YLPSE5Z2.js.map
153
+ //# sourceMappingURL=chunk-6QHOKCV3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/CircularProgress.tsx"],"sourcesContent":["'use client'\n\nimport { cq } from '@cerberus/styled-system/patterns'\nimport { css } from '@cerberus/styled-system/css'\nimport type { SVGProps } from 'react'\nimport { Show } from './Show'\n\n/**\n * This module contains the CircularProgress component.\n * @module\n */\n\nexport interface CircularProgressProps extends SVGProps<SVGSVGElement> {\n /**\n * A unique identifier for the progress bar. Required for accessibility.\n */\n id: string\n /**\n * A description label for the progress bar. Required for accessibility.\n */\n label: string\n /**\n * The current value of the CircularProgress\n */\n now: number\n /**\n * The title of the CircularProgress for a11y\n */\n title: string\n /**\n * What is shown below the now value (default: 'Done')\n */\n syntax?: string\n /**\n * The background style of the CircularProgress\n */\n bgStyle?: 'filled' | 'transparent'\n}\n\n/**\n * The CircularProgress component is used to display a loading indicator.\n * @param props - SVG element attributes\n * @param props.now - The current value of the CircularProgress\n * @param props.title - The title of the CircularProgress for a11y\n * @param props.label - What is shown below the now value (default: 'Done')\n * @see https://cerberus.digitalu.design/react/progress-indicators\n * @example\n * ```tsx\n * <CircularProgress now={24} title=\"Course completion\" label=\"done\" />\n * ```\n */\nexport function CircularProgress(props: CircularProgressProps) {\n const strokeW: number = 14\n const radius = `calc(50% * (1 - ${strokeW}/100))`\n const status: string = props.syntax ?? 'Done'\n const now: number = props.now >= 100 ? 100 : props.now\n const bgStyle: string = props.bgStyle ?? 'filled'\n\n return (\n <div\n id={props.id}\n aria-label={props.label}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={now}\n className={cq({\n alignSelf: 'stretch',\n flex: 1,\n m: '4px',\n position: 'relative',\n })}\n role=\"progressbar\"\n >\n <svg\n data-complete={now === 100}\n className={css({\n display: 'block',\n rounded: 'full',\n transition: 'all 0.5s ease',\n })}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeWidth={strokeW}\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <title>{props.title}</title>\n <desc>{`${now}% ${status}`}</desc>\n <defs>\n <linearGradient id=\"gradient\">\n <stop\n offset=\"0%\"\n stopColor=\"var(--cerberus-colors-data-viz-progress-start)\"\n />\n <stop\n offset=\"100%\"\n stopColor=\"var(--cerberus-colors-data-viz-progress-end)\"\n />\n </linearGradient>\n </defs>\n\n <Show when={bgStyle === 'filled'}>\n <circle\n className={css({\n fill: 'page.surface.initial',\n })}\n cx=\"50%\"\n cy=\"50%\"\n r={`calc(50% * (1 - ${strokeW}/100))`}\n pathLength=\"100\"\n />\n </Show>\n <circle\n className={css({\n stroke: 'page.bg.100',\n })}\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n pathLength=\"100\"\n />\n <circle\n data-complete={now === 100}\n className={css({\n stroke: 'url(#gradient)',\n transition: 'stroke-dashoffset, stroke 0.5s ease',\n _isComplete: {\n stroke: 'success.bg.initial',\n },\n })}\n cx=\"50%\"\n cy=\"50%\"\n fill=\"none\"\n r={radius}\n pathLength=\"100\"\n strokeDasharray=\"100\"\n strokeDashoffset={100 - now}\n transform=\"rotate(-90 50 50)\"\n />\n\n <g>\n <text\n className={css({\n fill: 'page.text.initial',\n fontFamily: 'mono',\n textStyle: '1.25rem',\n })}\n x=\"50%\"\n y=\"47%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {now}%\n </text>\n <text\n className={css({\n fill: 'page.text.100',\n fontSize: '0.5rem',\n fontWeight: 600,\n })}\n x=\"50%\"\n y=\"59%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {status}\n </text>\n </g>\n </svg>\n </div>\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,UAAU;AACnB,SAAS,WAAW;AAmFZ,cAGE,YAHF;AAnCD,SAAS,iBAAiB,OAA8B;AAC7D,QAAM,UAAkB;AACxB,QAAM,SAAS,mBAAmB,OAAO;AACzC,QAAM,SAAiB,MAAM,UAAU;AACvC,QAAM,MAAc,MAAM,OAAO,MAAM,MAAM,MAAM;AACnD,QAAM,UAAkB,MAAM,WAAW;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,MAAM;AAAA,MACV,cAAY,MAAM;AAAA,MAClB,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,GAAG;AAAA,QACZ,WAAW;AAAA,QACX,MAAM;AAAA,QACN,GAAG;AAAA,QACH,UAAU;AAAA,MACZ,CAAC;AAAA,MACD,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACC,iBAAe,QAAQ;AAAA,UACvB,WAAW,IAAI;AAAA,YACb,SAAS;AAAA,YACT,SAAS;AAAA,YACT,YAAY;AAAA,UACd,CAAC;A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AAAA;AAAA,kBACC,WAAW,IAAI;AAAA,oBACb,MAAM;AAAA,oBACN,YAAY;AAAA,oBACZ,WAAW;AAAA,kBACb,CAAC;AAAA,kBACD,GAAE;AAAA,kBACF,GAAE;AAAA,kBACF,kBAAiB;AAAA,kBACjB,YAAW;AAAA,kBAEV;AAAA;AAAA,oBAAI;AAAA;AAAA;AAAA,cACP;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACC,WAAW,IAAI;AAAA,oBACb,MAAM;AAAA,oBACN,UAAU;AAAA,oBACV,YAAY;AAAA,kBACd,CAAC;AAAA,kBACD,GAAE;AAAA,kBACF,GAAE;AAAA,kBACF,kBAAiB;AAAA,kBACjB,YAAW;AAAA,kBAEV;AAAA;AAAA,cACH;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,54 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-UZDVOIW5.js";
4
+ import {
5
+ Show
6
+ } from "./chunk-BUVVRQLZ.js";
7
+
8
+ // src/components/Legend.tsx
9
+ import { css, cx } from "@cerberus/styled-system/css";
10
+ import {
11
+ label
12
+ } from "@cerberus-design/styled-system/recipes";
13
+ import { hstack } from "@cerberus-design/styled-system/patterns";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ function Legend(props) {
16
+ const { size, ...nativeProps } = props;
17
+ const { invalid, ...formState } = useFieldContext();
18
+ return /* @__PURE__ */ jsxs(
19
+ "legend",
20
+ {
21
+ ...nativeProps,
22
+ ...formState,
23
+ ...invalid && { "aria-invalid": true },
24
+ className: cx(
25
+ nativeProps.className,
26
+ hstack({
27
+ justify: "space-between",
28
+ w: "full"
29
+ }),
30
+ label({
31
+ size
32
+ })
33
+ ),
34
+ children: [
35
+ nativeProps.children,
36
+ /* @__PURE__ */ jsx(Show, { when: formState.required, children: /* @__PURE__ */ jsx(
37
+ "span",
38
+ {
39
+ className: css({
40
+ color: "page.text.100",
41
+ fontSize: "inherit"
42
+ }),
43
+ children: "(required)"
44
+ }
45
+ ) })
46
+ ]
47
+ }
48
+ );
49
+ }
50
+
51
+ export {
52
+ Legend
53
+ };
54
+ //# sourceMappingURL=chunk-6TTN2JMY.js.map