@cerberus-design/react 1.0.0-rc.4 → 1.0.0-rc.6

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 +23 -0
  2. package/package.json +9 -4
  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,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'
@@ -1,53 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- SwitchControl,
4
- SwitchLabel,
5
- SwitchRoot,
6
- SwitchThumb,
7
- SwitchHiddenInput,
8
- } from './primitives'
9
-
10
- /**
11
- * This module contains the parts of the Switch parts.
12
- * @module 'switch/parts'
13
- */
14
-
15
- interface SwitchPartsValue {
16
- /**
17
- * The container of the field.
18
- */
19
- Root: ElementType
20
- /**
21
- * The label of the field.
22
- */
23
- Label: ElementType
24
- /**
25
- * The visual input of the switch.
26
- */
27
- Control: ElementType
28
- /**
29
- * The thumb item of the switch.
30
- */
31
- Thumb: ElementType
32
- /**
33
- * The native input for the switch.
34
- */
35
- HiddenInput: ElementType
36
- }
37
-
38
- /**
39
- * An Object containing the parts of the Switch component. For users that
40
- * prefer Object component syntax.
41
- *
42
- * @remarks
43
- *
44
- * When using object component syntax, you import the SwitchParts object and
45
- * the entire family of components vs. only what you use.
46
- */
47
- export const SwitchParts: SwitchPartsValue = {
48
- Root: SwitchRoot,
49
- Label: SwitchLabel,
50
- Control: SwitchControl,
51
- Thumb: SwitchThumb,
52
- HiddenInput: SwitchHiddenInput,
53
- }
@@ -1,51 +0,0 @@
1
- import {
2
- Switch,
3
- type SwitchControlProps as ArkSwitchControlProps,
4
- type SwitchHiddenInputProps as ArkSwitchHiddenInputProps,
5
- type SwitchLabelProps as ArkSwitchLabelProps,
6
- type SwitchRootProps as ArkSwitchRootProps,
7
- type SwitchThumbProps as ArkSwitchThumbProps,
8
- } from '@ark-ui/react/switch'
9
- import {
10
- switchRecipe,
11
- type SwitchRecipeVariantProps,
12
- } from 'styled-system/recipes'
13
- import {
14
- createCerberusPrimitive,
15
- type CerberusPrimitiveProps,
16
- } from '../../system/index'
17
-
18
- /**
19
- * This module contains the Switch primitives
20
- * @module 'react/switch'
21
- */
22
-
23
- const { withSlotRecipe, withNoRecipe } = createCerberusPrimitive(switchRecipe)
24
-
25
- // Root
26
-
27
- export type SwitchRootProps = CerberusPrimitiveProps<
28
- ArkSwitchRootProps & SwitchRecipeVariantProps
29
- >
30
- export const SwitchRoot = withSlotRecipe(Switch.Root, 'root')
31
-
32
- // Label
33
-
34
- export type SwitchLabelProps = CerberusPrimitiveProps<ArkSwitchLabelProps>
35
- export const SwitchLabel = withSlotRecipe(Switch.Label, 'label')
36
-
37
- // Control
38
-
39
- export type SwitchControlProps = CerberusPrimitiveProps<ArkSwitchControlProps>
40
- export const SwitchControl = withSlotRecipe(Switch.Control, 'control')
41
-
42
- // Thumb
43
-
44
- export type SwitchThumbProps = CerberusPrimitiveProps<ArkSwitchThumbProps>
45
- export const SwitchThumb = withSlotRecipe(Switch.Thumb, 'thumb')
46
-
47
- // HiddenInput
48
-
49
- export type SwitchHiddenInputProps =
50
- CerberusPrimitiveProps<ArkSwitchHiddenInputProps>
51
- export const SwitchHiddenInput = withNoRecipe(Switch.HiddenInput)
@@ -1,9 +0,0 @@
1
- 'use client'
2
-
3
- import { useCerberusContext } from '../../context/cerberus'
4
-
5
- export function SwitchIndicator() {
6
- const { icons } = useCerberusContext()
7
- const { toggleChecked: CheckIcon } = icons
8
- return <CheckIcon />
9
- }
@@ -1,27 +0,0 @@
1
- import { SwitchParts } from './parts'
2
- import { SwitchIndicator } from './switch-indicator'
3
- import type { SwitchRootProps } from './primitives'
4
-
5
- /**
6
- * The Switch component is a and abstraction of the primitives that displays a
7
- * controlled Switch with a label.
8
- * @description [Cerberus Docs] https://cerberus.digitalu.design/react/switch
9
- * @description [Ark Docs] https://ark-ui.com/docs/components/switch
10
- */
11
- export function Switch(props: SwitchRootProps) {
12
- const { children, ...rootProps } = props
13
-
14
- return (
15
- <SwitchParts.Root {...rootProps}>
16
- <SwitchParts.Control>
17
- <SwitchParts.Thumb>
18
- <SwitchIndicator />
19
- </SwitchParts.Thumb>
20
- </SwitchParts.Control>
21
-
22
- <SwitchParts.Label>{children}</SwitchParts.Label>
23
-
24
- <SwitchParts.HiddenInput />
25
- </SwitchParts.Root>
26
- )
27
- }
@@ -1,3 +0,0 @@
1
- export * from './parts'
2
- export * from './primitives'
3
- export * from './table'
@@ -1,83 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- TableRoot,
4
- Thead,
5
- Th,
6
- Tbody,
7
- Tr,
8
- Td,
9
- Tfoot,
10
- TableEl,
11
- Caption,
12
- TableTrigger,
13
- } from './primitives'
14
-
15
- /**
16
- * This module contains the parts of the Table parts.
17
- * @module 'table/parts'
18
- */
19
-
20
- export interface TablePartsValue {
21
- /**
22
- * The container of the table.
23
- */
24
- Root: ElementType
25
- /**
26
- * The table element.
27
- */
28
- Table: ElementType
29
- /**
30
- * The table caption element.
31
- */
32
- Caption: ElementType
33
- /**
34
- * The table head element.
35
- */
36
- Header: ElementType
37
- /**
38
- * The table header cell element.
39
- */
40
- HeaderCol: ElementType
41
- /**
42
- * The table body element.
43
- */
44
- Body: ElementType
45
- /**
46
- * The table row element.
47
- */
48
- Row: ElementType
49
- /**
50
- * The table cell element.
51
- */
52
- Cell: ElementType
53
- /**
54
- * The table footer element.
55
- */
56
- Footer: ElementType
57
- /**
58
- * The table trigger element.
59
- */
60
- Trigger: ElementType
61
- }
62
-
63
- /**
64
- * An Object containing the parts of the Table component. For users that
65
- * prefer Object component syntax.
66
- *
67
- * @remarks
68
- *
69
- * When using object component syntax, you import the TableParts object and
70
- * the entire family of components vs. only what you use.
71
- */
72
- export const TableParts: TablePartsValue = {
73
- Root: TableRoot,
74
- Table: TableEl,
75
- Caption: Caption,
76
- Header: Thead,
77
- HeaderCol: Th,
78
- Body: Tbody,
79
- Row: Tr,
80
- Cell: Td,
81
- Footer: Tfoot,
82
- Trigger: TableTrigger,
83
- }
@@ -1,115 +0,0 @@
1
- import { type HTMLArkProps } from '@ark-ui/react/factory'
2
- import { table, type TableVariantProps } from 'styled-system/recipes'
3
- import {
4
- cerberus,
5
- createCerberusPrimitive,
6
- type CerberusPrimitiveProps,
7
- } from '../../system/index'
8
-
9
- /**
10
- * This module contains the primitives of the Table component.
11
- * @module 'table/primitives'
12
- */
13
-
14
- const { withSlotRecipe } = createCerberusPrimitive(table)
15
-
16
- // Root
17
-
18
- export type TableRootProps = CerberusPrimitiveProps<
19
- HTMLArkProps<'div'> & TableVariantProps
20
- >
21
- export const TableRoot = withSlotRecipe(cerberus.div, 'root', {
22
- defaultProps: {
23
- 'data-scope': 'table',
24
- 'data-part': 'root',
25
- },
26
- })
27
-
28
- // TableEl
29
-
30
- export type TableElProps = CerberusPrimitiveProps<HTMLArkProps<'table'>>
31
- export const TableEl = withSlotRecipe(cerberus.table, 'table', {
32
- defaultProps: {
33
- 'data-scope': 'table',
34
- 'data-part': 'table',
35
- },
36
- })
37
-
38
- // Caption
39
-
40
- export type CaptionProps = CerberusPrimitiveProps<HTMLArkProps<'caption'>>
41
- export const Caption = withSlotRecipe(cerberus.caption, 'caption', {
42
- defaultProps: {
43
- 'data-scope': 'table',
44
- 'data-part': 'caption',
45
- },
46
- })
47
-
48
- // Thead
49
-
50
- export type TheadProps = CerberusPrimitiveProps<HTMLArkProps<'thead'>>
51
- export const Thead = withSlotRecipe(cerberus.thead, 'thead', {
52
- defaultProps: {
53
- 'data-scope': 'table',
54
- 'data-part': 'header',
55
- },
56
- })
57
-
58
- // Th
59
-
60
- export type ThProps = CerberusPrimitiveProps<HTMLArkProps<'th'>>
61
- export const Th = withSlotRecipe(cerberus.th, 'th', {
62
- defaultProps: {
63
- 'data-scope': 'table',
64
- 'data-part': 'header-col',
65
- },
66
- })
67
-
68
- // Tbody
69
-
70
- export type TbodyProps = CerberusPrimitiveProps<HTMLArkProps<'tbody'>>
71
- export const Tbody = withSlotRecipe(cerberus.tbody, 'tbody', {
72
- defaultProps: {
73
- 'data-scope': 'table',
74
- 'data-part': 'body',
75
- },
76
- })
77
-
78
- // Tr
79
- export type TrProps = CerberusPrimitiveProps<HTMLArkProps<'tr'>>
80
- export const Tr = withSlotRecipe(cerberus.tr, 'tr', {
81
- defaultProps: {
82
- 'data-scope': 'table',
83
- 'data-part': 'row',
84
- },
85
- })
86
-
87
- // Td
88
-
89
- export type TdProps = CerberusPrimitiveProps<HTMLArkProps<'td'>>
90
- export const Td = withSlotRecipe(cerberus.td, 'td', {
91
- defaultProps: {
92
- 'data-scope': 'table',
93
- 'data-part': 'cell',
94
- },
95
- })
96
-
97
- // Tfoot
98
-
99
- export type TfootProps = CerberusPrimitiveProps<HTMLArkProps<'tfoot'>>
100
- export const Tfoot = withSlotRecipe(cerberus.tfoot, 'tfoot', {
101
- defaultProps: {
102
- 'data-scope': 'table',
103
- 'data-part': 'footer',
104
- },
105
- })
106
-
107
- // TableTrigger
108
-
109
- export type TableTriggerProps = CerberusPrimitiveProps<HTMLArkProps<'button'>>
110
- export const TableTrigger = withSlotRecipe(cerberus.button, 'trigger', {
111
- defaultProps: {
112
- 'data-scope': 'table',
113
- 'data-part': 'trigger',
114
- },
115
- })