@cerberus-design/react 1.0.0-rc.5 → 1.0.0-rc.7

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 (210) hide show
  1. package/dist/panda.buildinfo.json +349 -0
  2. package/package.json +8 -5
  3. package/src/components/AnimatingUploadIcon.tsx +0 -83
  4. package/src/components/accordion/index.ts +0 -3
  5. package/src/components/accordion/item-group.tsx +0 -70
  6. package/src/components/accordion/item-indicator.tsx +0 -27
  7. package/src/components/accordion/parts.ts +0 -53
  8. package/src/components/accordion/primitives.tsx +0 -86
  9. package/src/components/admonition/admonition.tsx +0 -62
  10. package/src/components/admonition/index.ts +0 -3
  11. package/src/components/admonition/match-avatar.tsx +0 -52
  12. package/src/components/admonition/parts.ts +0 -53
  13. package/src/components/admonition/primitives.tsx +0 -77
  14. package/src/components/avatar/avatar.tsx +0 -51
  15. package/src/components/avatar/index.ts +0 -5
  16. package/src/components/avatar/parts.ts +0 -37
  17. package/src/components/avatar/primitives.tsx +0 -38
  18. package/src/components/button/button.tsx +0 -62
  19. package/src/components/button/index.ts +0 -3
  20. package/src/components/button/parts.ts +0 -32
  21. package/src/components/button/primitives.tsx +0 -41
  22. package/src/components/carousel/carousel.tsx +0 -55
  23. package/src/components/carousel/index.ts +0 -3
  24. package/src/components/carousel/parts.ts +0 -71
  25. package/src/components/carousel/primitives.ts +0 -58
  26. package/src/components/checkbox/checkbox-icon.tsx +0 -39
  27. package/src/components/checkbox/checkbox.tsx +0 -42
  28. package/src/components/checkbox/index.ts +0 -3
  29. package/src/components/checkbox/parts.ts +0 -59
  30. package/src/components/checkbox/primitives.tsx +0 -77
  31. package/src/components/circular-progress/circular-progress.tsx +0 -49
  32. package/src/components/circular-progress/index.ts +0 -2
  33. package/src/components/circular-progress/primitives.ts +0 -80
  34. package/src/components/clipboard/copy-indicator.tsx +0 -22
  35. package/src/components/clipboard/copy-text.tsx +0 -13
  36. package/src/components/clipboard/index.ts +0 -2
  37. package/src/components/clipboard/parts.ts +0 -74
  38. package/src/components/clipboard/primitives.ts +0 -56
  39. package/src/components/clipboard/trigger.tsx +0 -14
  40. package/src/components/collapsible/index.ts +0 -2
  41. package/src/components/collapsible/parts.ts +0 -53
  42. package/src/components/collapsible/primitives.tsx +0 -53
  43. package/src/components/combobox/combobox.tsx +0 -67
  44. package/src/components/combobox/index.ts +0 -6
  45. package/src/components/combobox/item-group.tsx +0 -19
  46. package/src/components/combobox/item.tsx +0 -30
  47. package/src/components/combobox/parts.ts +0 -101
  48. package/src/components/combobox/primitives.tsx +0 -146
  49. package/src/components/combobox/use-stateful-collection.ts +0 -65
  50. package/src/components/cta-dialog/context.tsx +0 -38
  51. package/src/components/cta-dialog/index.ts +0 -2
  52. package/src/components/cta-dialog/provider.tsx +0 -186
  53. package/src/components/cta-dialog/trigger-item.tsx +0 -54
  54. package/src/components/cta-dialog/utils.ts +0 -57
  55. package/src/components/date-picker/calendar.tsx +0 -47
  56. package/src/components/date-picker/content.tsx +0 -21
  57. package/src/components/date-picker/date-picker.tsx +0 -20
  58. package/src/components/date-picker/day-view.tsx +0 -82
  59. package/src/components/date-picker/index.ts +0 -16
  60. package/src/components/date-picker/input.tsx +0 -26
  61. package/src/components/date-picker/month-view.tsx +0 -49
  62. package/src/components/date-picker/parts.ts +0 -167
  63. package/src/components/date-picker/primitives.tsx +0 -235
  64. package/src/components/date-picker/range-input.tsx +0 -38
  65. package/src/components/date-picker/trigger.tsx +0 -28
  66. package/src/components/date-picker/view-control-group.tsx +0 -54
  67. package/src/components/date-picker/year-view.tsx +0 -47
  68. package/src/components/dialog/close-icon-trigger.tsx +0 -36
  69. package/src/components/dialog/dialog.tsx +0 -42
  70. package/src/components/dialog/index.ts +0 -8
  71. package/src/components/dialog/parts.ts +0 -71
  72. package/src/components/dialog/primitives.tsx +0 -83
  73. package/src/components/feature-flag/feature-flag.tsx +0 -21
  74. package/src/components/feature-flag/index.ts +0 -1
  75. package/src/components/field/error-text.tsx +0 -19
  76. package/src/components/field/field.tsx +0 -93
  77. package/src/components/field/helper-text.tsx +0 -20
  78. package/src/components/field/index.ts +0 -7
  79. package/src/components/field/input.tsx +0 -47
  80. package/src/components/field/parts.ts +0 -77
  81. package/src/components/field/primitives.tsx +0 -135
  82. package/src/components/field/start-indicator.tsx +0 -23
  83. package/src/components/field/status-indicator.tsx +0 -58
  84. package/src/components/fieldset/fieldset.tsx +0 -54
  85. package/src/components/fieldset/index.ts +0 -3
  86. package/src/components/fieldset/parts.ts +0 -47
  87. package/src/components/fieldset/primitives.tsx +0 -48
  88. package/src/components/file-upload/file-status.tsx +0 -271
  89. package/src/components/file-upload/file-uploader.tsx +0 -60
  90. package/src/components/file-upload/helpers.ts +0 -28
  91. package/src/components/file-upload/img-preview.tsx +0 -41
  92. package/src/components/file-upload/index.ts +0 -6
  93. package/src/components/file-upload/parts.tsx +0 -132
  94. package/src/components/file-upload/primitives.ts +0 -161
  95. package/src/components/file-upload/utils.ts +0 -20
  96. package/src/components/for/for.tsx +0 -38
  97. package/src/components/for/index.ts +0 -1
  98. package/src/components/group/index.ts +0 -1
  99. package/src/components/group/primitives.ts +0 -7
  100. package/src/components/icon-button/button.tsx +0 -41
  101. package/src/components/icon-button/index.tsx +0 -2
  102. package/src/components/icon-button/primitives.ts +0 -19
  103. package/src/components/menu/index.ts +0 -2
  104. package/src/components/menu/menu.tsx +0 -144
  105. package/src/components/menu/primitives.ts +0 -84
  106. package/src/components/notifications/center.tsx +0 -88
  107. package/src/components/notifications/close-trigger.tsx +0 -21
  108. package/src/components/notifications/index.ts +0 -5
  109. package/src/components/notifications/match-icon.tsx +0 -41
  110. package/src/components/notifications/parts.ts +0 -53
  111. package/src/components/notifications/primitives.tsx +0 -66
  112. package/src/components/notifications/toaster.ts +0 -13
  113. package/src/components/notifications/types.ts +0 -44
  114. package/src/components/number-input/decrement-trigger.tsx +0 -16
  115. package/src/components/number-input/increment-trigger.tsx +0 -16
  116. package/src/components/number-input/index.ts +0 -3
  117. package/src/components/number-input/input.tsx +0 -33
  118. package/src/components/number-input/parts.ts +0 -65
  119. package/src/components/number-input/primitives.tsx +0 -74
  120. package/src/components/pagination/compact.tsx +0 -25
  121. package/src/components/pagination/index.ts +0 -6
  122. package/src/components/pagination/item-list.tsx +0 -34
  123. package/src/components/pagination/item.tsx +0 -6
  124. package/src/components/pagination/pagination.tsx +0 -53
  125. package/src/components/pagination/parts.ts +0 -65
  126. package/src/components/pagination/primitives.ts +0 -41
  127. package/src/components/pagination/triggers.tsx +0 -55
  128. package/src/components/pin-input/index.ts +0 -3
  129. package/src/components/pin-input/input.tsx +0 -22
  130. package/src/components/pin-input/parts.ts +0 -53
  131. package/src/components/pin-input/primitives.tsx +0 -46
  132. package/src/components/portal/index.ts +0 -1
  133. package/src/components/portal/portal.tsx +0 -28
  134. package/src/components/progress/index.ts +0 -2
  135. package/src/components/progress/primitives.ts +0 -37
  136. package/src/components/progress/progress-bar.tsx +0 -80
  137. package/src/components/radio/index.ts +0 -3
  138. package/src/components/radio/parts.ts +0 -65
  139. package/src/components/radio/primitives.tsx +0 -92
  140. package/src/components/radio/radio.tsx +0 -35
  141. package/src/components/rating/index.ts +0 -8
  142. package/src/components/rating/parts.tsx +0 -65
  143. package/src/components/rating/primitives.tsx +0 -64
  144. package/src/components/rating/rating.tsx +0 -75
  145. package/src/components/select/index.ts +0 -5
  146. package/src/components/select/option-group.tsx +0 -32
  147. package/src/components/select/option.tsx +0 -42
  148. package/src/components/select/parts.ts +0 -113
  149. package/src/components/select/primitives.tsx +0 -147
  150. package/src/components/select/select.tsx +0 -110
  151. package/src/components/show/index.ts +0 -1
  152. package/src/components/show/show.tsx +0 -48
  153. package/src/components/spinner/index.ts +0 -1
  154. package/src/components/spinner/spinner.tsx +0 -81
  155. package/src/components/split-button/button.tsx +0 -63
  156. package/src/components/split-button/index.tsx +0 -1
  157. package/src/components/switch/index.ts +0 -3
  158. package/src/components/switch/parts.ts +0 -53
  159. package/src/components/switch/primitives.tsx +0 -51
  160. package/src/components/switch/switch-indicator.tsx +0 -9
  161. package/src/components/switch/switch.tsx +0 -27
  162. package/src/components/table/index.ts +0 -3
  163. package/src/components/table/parts.ts +0 -83
  164. package/src/components/table/primitives.tsx +0 -115
  165. package/src/components/table/table.tsx +0 -73
  166. package/src/components/tabs/index.ts +0 -3
  167. package/src/components/tabs/parts.ts +0 -53
  168. package/src/components/tabs/primitives.tsx +0 -47
  169. package/src/components/tabs/tabs.tsx +0 -48
  170. package/src/components/tag/closable.tsx +0 -47
  171. package/src/components/tag/index.ts +0 -2
  172. package/src/components/tag/primitives.ts +0 -19
  173. package/src/components/tag/tag.tsx +0 -39
  174. package/src/components/text/index.ts +0 -1
  175. package/src/components/text/text.tsx +0 -55
  176. package/src/components/theme/index.ts +0 -1
  177. package/src/components/theme/theme.tsx +0 -34
  178. package/src/components/toggle/index.ts +0 -2
  179. package/src/components/toggle/parts.ts +0 -32
  180. package/src/components/toggle/primitives.tsx +0 -27
  181. package/src/components/tooltip/index.ts +0 -3
  182. package/src/components/tooltip/parts.ts +0 -59
  183. package/src/components/tooltip/primitives.ts +0 -56
  184. package/src/components/tooltip/tooltip.tsx +0 -46
  185. package/src/config/defineIcons.ts +0 -24
  186. package/src/config/icons/checkbox.icons.tsx +0 -98
  187. package/src/config/icons/default.ts +0 -69
  188. package/src/config/icons/pinned.icons.tsx +0 -31
  189. package/src/config/icons/sort.icons.tsx +0 -19
  190. package/src/config/index.ts +0 -41
  191. package/src/config/types.ts +0 -53
  192. package/src/context/cerberus.tsx +0 -53
  193. package/src/context/confirm-modal.tsx +0 -276
  194. package/src/context/feature-flags.tsx +0 -63
  195. package/src/context/field.tsx +0 -70
  196. package/src/context/navMenu.tsx +0 -89
  197. package/src/context/prompt-modal.tsx +0 -315
  198. package/src/context/theme.tsx +0 -83
  199. package/src/hooks/useModal.ts +0 -63
  200. package/src/hooks/useRootColors.ts +0 -72
  201. package/src/hooks/useTheme.ts +0 -121
  202. package/src/index.client.ts +0 -30
  203. package/src/index.ts +0 -76
  204. package/src/system/factory.ts +0 -32
  205. package/src/system/index.ts +0 -47
  206. package/src/system/primitive-factory.tsx +0 -180
  207. package/src/system/types.ts +0 -88
  208. package/src/types.ts +0 -23
  209. package/src/utils/index.ts +0 -51
  210. package/src/utils/localStorage.ts +0 -28
@@ -1,5 +0,0 @@
1
- export * from './parts'
2
- export * from './primitives'
3
- export * from './select'
4
- export * from './option'
5
- export * from './option-group'
@@ -1,32 +0,0 @@
1
- import { SelectItemGroup, SelectItemGroupLabel } from './primitives'
2
-
3
- /**
4
- * This module contains the named abstractions OptionGroup and OptionGroupLabel
5
- * components for API consistency with the Select component.
6
- * @module 'react/select/option-group'
7
- */
8
-
9
- /**
10
- * The OptionGroup component is a group of options in the dropdown list.
11
- * @definition [Select docs](https://cerberus.digitalu.design/react/select)
12
- * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)
13
- * @example
14
- * ```tsx
15
- * <OptionGroup>
16
- * <OptionGroupLabel>Greek gods</OptionGroupLabel>
17
- * ...
18
- * </OptionGroup>
19
- * ```
20
- */
21
- export const OptionGroup = SelectItemGroup
22
-
23
- /**
24
- * The OptionGroupLabel component is the label of the OptionGroup.
25
- * @definition [Select docs](https://cerberus.digitalu.design/react/select)
26
- * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)
27
- * @example
28
- * ```tsx
29
- * <OptionGroupLabel>Greek gods</OptionGroupLabel>
30
- * ```
31
- */
32
- export const OptionGroupLabel = SelectItemGroupLabel
@@ -1,42 +0,0 @@
1
- 'use client'
2
-
3
- import { useCerberusContext } from '../../context/cerberus'
4
- import { SelectParts } from './parts'
5
- import type { SelectItemProps } from './primitives'
6
- import type { SelectCollectionItem } from './select'
7
-
8
- /**
9
- * This module contains the Option component for the Select dropdown.
10
- * @module 'react/select/option'
11
- */
12
-
13
- export interface OptionProps extends SelectItemProps {
14
- /**
15
- * The CollectionListItem to be displayed in the dropdown list.
16
- */
17
- item: SelectCollectionItem
18
- }
19
-
20
- /**
21
- * The Option component is used to render an individual item in the Select
22
- * dropdown. It is an abstraction of the Select Item, ItemText, and
23
- * ItemIndicator primitives that also displays a Checked icon when the item is
24
- * selected.
25
- *
26
- * @definition [Select docs](https://cerberus.digitalu.design/react/select/dev)
27
- * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)
28
- */
29
- export function Option(props: OptionProps) {
30
- const { item, ...itemProps } = props
31
- const { icons } = useCerberusContext()
32
- const { selectChecked: CheckedIcon } = icons
33
-
34
- return (
35
- <SelectParts.Item {...itemProps} item={item}>
36
- <SelectParts.ItemText>{item?.label}</SelectParts.ItemText>
37
- <SelectParts.ItemIndicator>
38
- <CheckedIcon />
39
- </SelectParts.ItemIndicator>
40
- </SelectParts.Item>
41
- )
42
- }
@@ -1,113 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- SelectClearTrigger,
4
- SelectContent,
5
- SelectControl,
6
- SelectHiddenSelect,
7
- SelectIndicator,
8
- SelectItem,
9
- SelectItemGroup,
10
- SelectItemGroupLabel,
11
- SelectItemIndicator,
12
- SelectItemText,
13
- SelectLabel,
14
- SelectPositioner,
15
- SelectRoot,
16
- SelectTrigger,
17
- SelectValueText,
18
- } from './primitives'
19
-
20
- /**
21
- * This module contains the parts of the Select parts.
22
- * @module 'select/parts'
23
- */
24
-
25
- interface SelectPartsValue {
26
- /**
27
- * The context provider for the Select component.
28
- */
29
- Root: ElementType
30
- /**
31
- * The label that appears above the select input.
32
- */
33
- Label: ElementType
34
- /**
35
- * The control that wraps the select trigger.
36
- */
37
- Control: ElementType
38
- /**
39
- * The trigger that opens the dropdown.
40
- */
41
- Trigger: ElementType
42
- /**
43
- * The trigger to clear the select input.
44
- */
45
- ClearTrigger: ElementType
46
- /**
47
- * The text that appears in the trigger.
48
- */
49
- ValueText: ElementType
50
- /**
51
- * The indicator that appears in the trigger.
52
- */
53
- Indicator: ElementType
54
- /**
55
- * The positioner that wraps the content.
56
- */
57
- Positioner: ElementType
58
- /**
59
- * The content of the select component.
60
- */
61
- Content: ElementType
62
- /**
63
- * A group of items in the select component.
64
- */
65
- ItemGroup: ElementType
66
- /**
67
- * The label for a group of items in the select component.
68
- */
69
- ItemGroupLabel: ElementType
70
- /**
71
- * An individual item in the select component.
72
- */
73
- Item: ElementType
74
- /**
75
- * The text that labels a single radio of the field.
76
- */
77
- ItemText: ElementType
78
- /**
79
- * The indicator that appears when the item has been selected.
80
- */
81
- ItemIndicator: ElementType
82
- /**
83
- * The native select for use within a field.
84
- */
85
- HiddenSelect: ElementType
86
- }
87
-
88
- /**
89
- * An Object containing the parts of the Radio component. For users that
90
- * prefer Object component syntax.
91
- *
92
- * @remarks
93
- *
94
- * When using object component syntax, you import the SelectParts object and
95
- * the entire family of components vs. only what you use.
96
- */
97
- export const SelectParts: SelectPartsValue = {
98
- Root: SelectRoot,
99
- Label: SelectLabel,
100
- Control: SelectControl,
101
- Trigger: SelectTrigger,
102
- ClearTrigger: SelectClearTrigger,
103
- ValueText: SelectValueText,
104
- Indicator: SelectIndicator,
105
- Positioner: SelectPositioner,
106
- Content: SelectContent,
107
- ItemGroup: SelectItemGroup,
108
- ItemGroupLabel: SelectItemGroupLabel,
109
- Item: SelectItem,
110
- ItemText: SelectItemText,
111
- ItemIndicator: SelectItemIndicator,
112
- HiddenSelect: SelectHiddenSelect,
113
- }
@@ -1,147 +0,0 @@
1
- import {
2
- createListCollection,
3
- Select,
4
- type ListCollection,
5
- type SelectClearTriggerProps as ArkSelectClearTrigger,
6
- type SelectContentProps as ArkSelectContentProps,
7
- type SelectControlProps as ArkSelectControlProps,
8
- type SelectHiddenSelectProps as ArkSelectHiddenSelectProps,
9
- type SelectIndicatorProps as ArkSelectIndicatorProps,
10
- type SelectItemGroupLabelProps as ArkSelectItemGroupLabelProps,
11
- type SelectItemGroupProps as ArkSelectItemGroupProps,
12
- type SelectItemIndicatorProps as ArkSelectItemIndicatorProps,
13
- type SelectItemProps as ArkSelectItemProps,
14
- type SelectItemTextProps as ArkSelectItemTextProps,
15
- type SelectLabelProps as ArkSelectLabelProps,
16
- type SelectPositionerProps as ArkSelectPositionerProps,
17
- type SelectRootProps as ArkSelectRootProps,
18
- type SelectTriggerProps as ArkSelectTriggerProps,
19
- type SelectValueChangeDetails,
20
- type SelectValueTextProps as ArkSelectValueTextProps,
21
- } from '@ark-ui/react/select'
22
- import { select, type SelectVariantProps } from 'styled-system/recipes'
23
- import {
24
- createCerberusPrimitive,
25
- type CerberusPrimitiveProps,
26
- } from '../../system/index'
27
- import type { SelectCollectionItem } from './select'
28
-
29
- /**
30
- * This module contains the Select primitives
31
- * @module 'react/select'
32
- */
33
-
34
- const { withSlotRecipe, withNoRecipe } = createCerberusPrimitive(select)
35
-
36
- // Root
37
-
38
- export type SelectRootProps = CerberusPrimitiveProps<
39
- ArkSelectRootProps<SelectCollectionItem> & SelectVariantProps
40
- >
41
- export const SelectRoot = withSlotRecipe(Select.Root, 'root')
42
-
43
- // Label
44
-
45
- export type SelectLabelProps = CerberusPrimitiveProps<ArkSelectLabelProps>
46
- export const SelectLabel = withSlotRecipe(Select.Label, 'label')
47
-
48
- // Control
49
-
50
- export type SelectControlProps = CerberusPrimitiveProps<ArkSelectControlProps>
51
- export const SelectControl = withNoRecipe(Select.Control)
52
-
53
- // Trigger
54
-
55
- export type SelectTriggerProps = CerberusPrimitiveProps<ArkSelectTriggerProps>
56
- export const SelectTrigger = withSlotRecipe(Select.Trigger, 'trigger')
57
-
58
- // Value Text
59
-
60
- export type SelectValueTextProps =
61
- CerberusPrimitiveProps<ArkSelectValueTextProps>
62
- export const SelectValueText = withNoRecipe(Select.ValueText)
63
-
64
- // Indicator
65
-
66
- export type SelectIndicatorProps =
67
- CerberusPrimitiveProps<ArkSelectIndicatorProps>
68
- export const SelectIndicator = withSlotRecipe(Select.Indicator, 'indicator')
69
-
70
- // Clear Trigger
71
-
72
- export type SelectClearTriggerProps =
73
- CerberusPrimitiveProps<ArkSelectClearTrigger>
74
- export const SelectClearTrigger = withNoRecipe(Select.ClearTrigger)
75
-
76
- // Positioner
77
-
78
- export type SelectPositionerProps =
79
- CerberusPrimitiveProps<ArkSelectPositionerProps>
80
- export const SelectPositioner = withSlotRecipe(Select.Positioner, 'positioner')
81
-
82
- // Content
83
-
84
- export type SelectContentProps = CerberusPrimitiveProps<
85
- ArkSelectContentProps & SelectVariantProps
86
- >
87
- export const SelectContent = withSlotRecipe(Select.Content, 'content')
88
-
89
- // Item Group
90
-
91
- export type SelectItemGroupProps =
92
- CerberusPrimitiveProps<ArkSelectItemGroupProps>
93
- export const SelectItemGroup = withNoRecipe(Select.ItemGroup)
94
-
95
- // Item Group Label
96
-
97
- export type SelectItemGroupLabelProps =
98
- CerberusPrimitiveProps<ArkSelectItemGroupLabelProps>
99
- export const SelectItemGroupLabel = withSlotRecipe(
100
- Select.ItemGroupLabel,
101
- 'itemGroupLabel',
102
- )
103
-
104
- // Item
105
-
106
- export type SelectItemProps = CerberusPrimitiveProps<ArkSelectItemProps>
107
- export const SelectItem = withSlotRecipe(Select.Item, 'item')
108
-
109
- // Item Text
110
-
111
- export type SelectItemTextProps = CerberusPrimitiveProps<ArkSelectItemTextProps>
112
- export const SelectItemText = withNoRecipe(Select.ItemText)
113
-
114
- // Item Indicator
115
-
116
- export type SelectItemIndicatorProps =
117
- CerberusPrimitiveProps<ArkSelectItemIndicatorProps>
118
- export const SelectItemIndicator = withSlotRecipe(
119
- Select.ItemIndicator,
120
- 'itemIndicator',
121
- )
122
-
123
- // Hidden Select
124
-
125
- export type SelectHiddenSelectProps =
126
- CerberusPrimitiveProps<ArkSelectHiddenSelectProps>
127
- export const SelectHiddenSelect = withNoRecipe(Select.HiddenSelect)
128
-
129
- // Collection
130
-
131
- /**
132
- * A helper function to create a SelectCollection object.
133
- * @param collection - An array of SelectCollectionItem objects that matches
134
- * the following shape:
135
- * ```ts
136
- * [{ label: 'Hades', value: 'hades', disabled?: true }]
137
- * ```
138
- */
139
- export function createSelectCollection(
140
- collection: SelectCollectionItem[],
141
- ): ListCollection<SelectCollectionItem> {
142
- return createListCollection({
143
- items: collection,
144
- })
145
- }
146
-
147
- export type { SelectValueChangeDetails, ListCollection }
@@ -1,110 +0,0 @@
1
- 'use client'
2
-
3
- import { HStack } from 'styled-system/jsx'
4
- import { useCerberusContext } from '../../context/cerberus'
5
- import { splitProps } from '../../utils/index'
6
- import { Show } from '../show/index'
7
- import { SelectParts } from './parts'
8
- import type { SelectRootProps } from './primitives'
9
-
10
- /**
11
- * This module contains the Select components.
12
- * @module 'react/select'
13
- */
14
-
15
- export interface SelectCollectionItem {
16
- /**
17
- * What is displayed in the dropdown list.
18
- */
19
- label: string
20
- /**
21
- * The value of the selected item used in the form.
22
- */
23
- value: string
24
- /**
25
- * If the item is disabled.
26
- */
27
- disabled?: boolean
28
- }
29
-
30
- export interface SelectCollection {
31
- /**
32
- * The items to be displayed in the dropdown list.
33
- */
34
- items: SelectCollectionItem[]
35
- }
36
-
37
- export interface SelectProps extends Omit<SelectRootProps, 'container'> {
38
- /**
39
- * The placeholder text when no option is selected.
40
- */
41
- placeholder?: string
42
- }
43
-
44
- /**
45
- * The Select component is a dropdown list that allows users to select an
46
- * option from a list.
47
- * @definition [Select docs](https://cerberus.digitalu.design/react/select)
48
- * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)
49
- * @example
50
- * ```tsx
51
- * import { Select, Option, createListCollection } from '@cerberus-design/react'
52
- *
53
- * export function SelectBasicPreview() {
54
- * const collection = createListCollection({
55
- * items: [
56
- * { label: 'Hades', value: 'hades' },
57
- * { label: 'Persephone', value: 'persephone' },
58
- * { label: 'Zeus', value: 'zeus', disabled: true },
59
- * ]
60
- * })
61
- *
62
- * return (
63
- * <Select
64
- * collection={collection}
65
- * label="Select Relative"
66
- * placeholder="Choose option"
67
- * >
68
- * {collection.items.map((item) => (
69
- * <Option key={item.value} item={item} />
70
- * ))}
71
- * </Select>
72
- * )
73
- * }
74
- */
75
- export function Select(props: SelectProps) {
76
- const [{ collection, placeholder }, rootProps] = splitProps(props, [
77
- 'collection',
78
- 'placeholder',
79
- ])
80
-
81
- const { icons } = useCerberusContext()
82
- const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons
83
-
84
- return (
85
- <SelectParts.Root collection={collection} {...rootProps}>
86
- <SelectParts.Control>
87
- <SelectParts.Trigger>
88
- <SelectParts.ValueText placeholder={placeholder} />
89
-
90
- <HStack>
91
- <Show when={props.invalid}>
92
- <InvalidIcon data-part="invalid-icon" />
93
- </Show>
94
- <SelectParts.Indicator>
95
- <SelectArrow />
96
- </SelectParts.Indicator>
97
- </HStack>
98
- </SelectParts.Trigger>
99
- </SelectParts.Control>
100
-
101
- <SelectParts.Positioner>
102
- <SelectParts.Content size={rootProps.size}>
103
- {props.children}
104
- </SelectParts.Content>
105
- </SelectParts.Positioner>
106
-
107
- <SelectParts.HiddenSelect />
108
- </SelectParts.Root>
109
- )
110
- }
@@ -1 +0,0 @@
1
- export * from './show'
@@ -1,48 +0,0 @@
1
- import { type ReactNode } from 'react'
2
-
3
- /**
4
- * This module contains the Show component.
5
- * @module
6
- */
7
-
8
- export interface ShowProps<T> {
9
- /**
10
- * The children to render when the condition is true.
11
- * This can be a ReactNode or a function that returns a ReactNode. Passing a
12
- * function will lazy render the children only when needed.
13
- */
14
- children: ReactNode | (() => ReactNode)
15
- /**
16
- * The condition to render memoized children or the fallback content.
17
- */
18
- when: T | boolean | null | undefined
19
- /**
20
- * The children to render when the condition is false.
21
- */
22
- fallback?: ReactNode
23
- }
24
-
25
- /**
26
- * Conditionally render a memoized version of the children or optional fallback
27
- * content.
28
- * @see https://cerberus.digitalu.design/react/show
29
- * @example
30
- * ```tsx
31
- * <Show when={isLoggedIn} fallback={<Navigate to="/login" />}>
32
- * <Dashboard />
33
- * </Show>
34
- */
35
- export function Show<T>(props: ShowProps<T>) {
36
- const { when, children, fallback } = props
37
-
38
- if (when) {
39
- if (typeof children === 'function') {
40
- return <>{children()}</>
41
- }
42
- return <>{children}</>
43
- }
44
-
45
- if (fallback) return <>{fallback}</>
46
-
47
- return null
48
- }
@@ -1 +0,0 @@
1
- export * from './spinner'
@@ -1,81 +0,0 @@
1
- /**
2
- * This module contains the Spinner component.
3
- * @module
4
- */
5
-
6
- export interface SpinnerProps {
7
- /**
8
- * The size of the spinner
9
- */
10
- size?: number | string
11
- }
12
-
13
- /**
14
- * The Spinner component is used to display a loading indicator. Typically used
15
- * in buttons, modals, and other components that require a loading state.
16
- * @see https://cerberus.digitalu.design/react/loading-states/
17
- * @example
18
- * ```tsx
19
- * <Button>
20
- * <Show when={loading} fallback={<>Save</>}>
21
- * Saving
22
- * <Spinner size={24} />
23
- * </Show>
24
- * </Button>
25
- * ```
26
- */
27
- export function Spinner(props: SpinnerProps) {
28
- return (
29
- <svg
30
- aria-busy="true"
31
- data-scope="spinner"
32
- data-part="root"
33
- role="status"
34
- xmlns="http://www.w3.org/2000/svg"
35
- height={props.size}
36
- width={props.size}
37
- viewBox="0 0 24 24"
38
- >
39
- <g
40
- fill="none"
41
- stroke="currentColor"
42
- strokeLinecap="round"
43
- strokeLinejoin="round"
44
- strokeWidth={2}
45
- >
46
- <path
47
- strokeDasharray={16}
48
- strokeDashoffset={16}
49
- d="M12 3c4.97 0 9 4.03 9 9"
50
- >
51
- <animate
52
- fill="freeze"
53
- attributeName="stroke-dashoffset"
54
- dur="0.15s"
55
- values="16;0"
56
- ></animate>
57
- <animateTransform
58
- attributeName="transform"
59
- dur="0.75s"
60
- repeatCount="indefinite"
61
- type="rotate"
62
- values="0 12 12;360 12 12"
63
- ></animateTransform>
64
- </path>
65
- <path
66
- strokeDasharray={64}
67
- strokeDashoffset={64}
68
- strokeOpacity={0.3}
69
- d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"
70
- >
71
- <animate
72
- fill="freeze"
73
- attributeName="stroke-dashoffset"
74
- dur="0.6s"
75
- values="64;0"
76
- ></animate>
77
- </path>
78
- </g>
79
- </svg>
80
- )
81
- }
@@ -1,63 +0,0 @@
1
- 'use client'
2
-
3
- import { useCerberusContext } from '../../context/cerberus'
4
- import { splitProps } from '../../utils'
5
- import { ButtonGroup, ButtonParts, type ButtonProps } from '../button/index'
6
- import { IconButton } from '../icon-button/index'
7
- import { Menu, MenuTrigger, MenuContent } from '../menu/index'
8
- import type { CerberusPrimitiveProps } from '../../system/types'
9
-
10
- /**
11
- * This module provides an abstraction for a SplitButton component.
12
- * @module SplitButton
13
- */
14
-
15
- export interface SplitButtonProps extends ButtonProps {
16
- /** T
17
- * he text for the primary action button.
18
- */
19
- actionText: string
20
- }
21
-
22
- /**
23
- * A SplitButton component that combines a primary action button with a
24
- * dropdown menu for additional actions.
25
- * @definition [Cerberus docs](https://cerberus.digitalu.designdocs/components/split-button)
26
- */
27
- export function SplitButton(props: CerberusPrimitiveProps<SplitButtonProps>) {
28
- const [elProps, { usage = 'filled', actionText }, actionProps] = splitProps(
29
- props,
30
- ['children'],
31
- ['usage', 'actionText'],
32
- )
33
-
34
- const { icons } = useCerberusContext()
35
- const { selectArrow: SelectArrow } = icons
36
-
37
- const iconShape = actionProps.shape === 'rounded' ? 'circle' : 'square'
38
-
39
- return (
40
- <ButtonGroup layout="attached" shape={actionProps.shape}>
41
- <ButtonParts.Root usage={usage} {...actionProps}>
42
- <ButtonParts.Icon />
43
- {actionText}
44
- </ButtonParts.Root>
45
-
46
- <Menu>
47
- <MenuTrigger>
48
- <IconButton
49
- ariaLabel="More options"
50
- palette={actionProps.palette}
51
- disabled={actionProps.pending}
52
- shape={iconShape}
53
- usage={usage}
54
- >
55
- <SelectArrow />
56
- </IconButton>
57
- </MenuTrigger>
58
-
59
- <MenuContent>{elProps.children}</MenuContent>
60
- </Menu>
61
- </ButtonGroup>
62
- )
63
- }
@@ -1 +0,0 @@
1
- export * from './button'
@@ -1,3 +0,0 @@
1
- export * from './parts'
2
- export * from './primitives'
3
- export * from './switch'