@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,53 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- NotificationActionTrigger,
4
- NotificationCloseTrigger,
5
- NotificationDescription,
6
- NotificationHeading,
7
- NotificationRoot,
8
- } from './primitives'
9
-
10
- /**
11
- * This module contains the parts of the Notification parts.
12
- * @module 'notification/parts'
13
- */
14
-
15
- interface NotificationPartsValue {
16
- /**
17
- * The context provider of the notification.
18
- */
19
- Root: ElementType
20
- /**
21
- * The title heading of the notification.
22
- */
23
- Heading: ElementType
24
- /**
25
- * The description of the notification.
26
- */
27
- Description: ElementType
28
- /**
29
- * The close button of the notification.
30
- */
31
- CloseTrigger: ElementType
32
- /**
33
- * The action trigger of the notification.
34
- */
35
- ActionTrigger: ElementType
36
- }
37
-
38
- /**
39
- * An Object containing the parts of the Notification components. For users that
40
- * prefer Object component syntax.
41
- *
42
- * @remarks
43
- *
44
- * When using object component syntax, you import the NotificationParts object and
45
- * the entire family of components vs. only what you use.
46
- */
47
- export const NotificationParts: NotificationPartsValue = {
48
- Root: NotificationRoot,
49
- Heading: NotificationHeading,
50
- Description: NotificationDescription,
51
- CloseTrigger: NotificationCloseTrigger,
52
- ActionTrigger: NotificationActionTrigger,
53
- }
@@ -1,66 +0,0 @@
1
- import {
2
- Toast,
3
- Toaster,
4
- type ToastActionTriggerProps,
5
- type ToastCloseTriggerProps,
6
- type ToastDescriptionProps,
7
- type ToasterProps,
8
- type ToastRootProps,
9
- type ToastTitleProps,
10
- } from '@ark-ui/react/toast'
11
- import { toast, type ToastVariantProps } from 'styled-system/recipes'
12
- import {
13
- createCerberusPrimitive,
14
- type CerberusPrimitiveProps,
15
- } from '../../system/index'
16
-
17
- /**
18
- * This module contains the primitives of the Notification component.
19
- * @module 'notification/primitives'
20
- */
21
-
22
- const { withSlotRecipe } = createCerberusPrimitive(toast)
23
-
24
- // Toaster
25
-
26
- export type NotificationProviderProps = ToasterProps
27
- export const NotificationProvider = Toaster
28
-
29
- // Root
30
-
31
- export type NotificationRootProps = CerberusPrimitiveProps<
32
- ToastRootProps & ToastVariantProps
33
- >
34
- export const NotificationRoot = withSlotRecipe(Toast.Root, 'root')
35
-
36
- // Heading
37
-
38
- export type NotificationHeadingProps = CerberusPrimitiveProps<ToastTitleProps>
39
- export const NotificationHeading = withSlotRecipe(Toast.Title, 'title')
40
-
41
- // Description
42
-
43
- export type NotificationDescriptionProps =
44
- CerberusPrimitiveProps<ToastDescriptionProps>
45
- export const NotificationDescription = withSlotRecipe(
46
- Toast.Description,
47
- 'description',
48
- )
49
-
50
- // Close Trigger
51
-
52
- export type NotificationCloseTriggerProps =
53
- CerberusPrimitiveProps<ToastCloseTriggerProps>
54
- export const NotificationCloseTrigger = withSlotRecipe(
55
- Toast.CloseTrigger,
56
- 'closeTrigger',
57
- )
58
-
59
- // Action Trigger
60
-
61
- export type NotificationActionTriggerProps =
62
- CerberusPrimitiveProps<ToastActionTriggerProps>
63
- export const NotificationActionTrigger = withSlotRecipe(
64
- Toast.ActionTrigger,
65
- 'actionTrigger',
66
- )
@@ -1,13 +0,0 @@
1
- 'use client'
2
-
3
- import { createToaster, type CreateToasterReturn } from '@ark-ui/react/toast'
4
-
5
- export const toaster: CreateToasterReturn = createToaster({
6
- gap: 16,
7
- overlap: true,
8
- placement: 'top-end',
9
- })
10
-
11
- // Re-exporting for easier customization
12
-
13
- export { createToaster, Toaster } from '@ark-ui/react/toast'
@@ -1,44 +0,0 @@
1
- import type { CreateToasterReturn } from '@ark-ui/react/toast'
2
- import type { ReactNode } from 'react'
3
-
4
- export type NotifyOptionsType =
5
- | 'info'
6
- | 'info-subtle'
7
- | 'success'
8
- | 'success-subtle'
9
- | 'warning'
10
- | 'warning-subtle'
11
- | 'error'
12
- | 'error-subtle'
13
- | 'loading'
14
- | 'loading-subtle'
15
-
16
- export interface NotifyOptions {
17
- /**
18
- * The palette of the notification.
19
- * @default 'info'
20
- */
21
- palette?: NotifyOptionsType
22
- /**
23
- * The heading of the notification.
24
- */
25
- heading: string
26
- /**
27
- * The description of the notification.
28
- */
29
- description?: ReactNode
30
- /**
31
- * The action to take when the notification is closed
32
- */
33
- action?: {
34
- label: string
35
- onClick: () => void
36
- }
37
- }
38
-
39
- export type UseNotificationCenterReturn = CreateToasterReturn & {
40
- /**
41
- * @deprecated use `create` instead
42
- */
43
- notify: (options: NotifyOptions) => void
44
- }
@@ -1,16 +0,0 @@
1
- 'use client'
2
-
3
- import { useCerberusContext } from '../../context/cerberus'
4
- import { NumberInputParts } from './parts'
5
- import type { NumberInputDecrementTriggerProps } from './primitives'
6
-
7
- export function DecrementTrigger(props: NumberInputDecrementTriggerProps) {
8
- const { icons } = useCerberusContext()
9
- const { decrement: ChevronDown } = icons
10
-
11
- return (
12
- <NumberInputParts.DecrementTrigger {...props}>
13
- <ChevronDown />
14
- </NumberInputParts.DecrementTrigger>
15
- )
16
- }
@@ -1,16 +0,0 @@
1
- 'use client'
2
-
3
- import { useCerberusContext } from '../../context/cerberus'
4
- import { NumberInputParts } from './parts'
5
- import type { NumberInputIncrementTriggerProps } from './primitives'
6
-
7
- export function IncrementTrigger(props: NumberInputIncrementTriggerProps) {
8
- const { icons } = useCerberusContext()
9
- const { increment: ChevronUp } = icons
10
-
11
- return (
12
- <NumberInputParts.IncrementTrigger {...props}>
13
- <ChevronUp />
14
- </NumberInputParts.IncrementTrigger>
15
- )
16
- }
@@ -1,3 +0,0 @@
1
- export * from './parts'
2
- export * from './primitives'
3
- export * from './input'
@@ -1,33 +0,0 @@
1
- import { Show } from '../show/show'
2
- import { NumberInputParts } from './parts'
3
- import type { NumberInputRootProps } from './primitives'
4
- import { DecrementTrigger } from './decrement-trigger'
5
- import { IncrementTrigger } from './increment-trigger'
6
-
7
- interface NumberInputElProps extends NumberInputRootProps {
8
- /**
9
- * Whether to show a scrubber for fine-tuning the value.
10
- */
11
- scrubber?: boolean
12
- }
13
-
14
- /**
15
- * An input for displaying a numeric value.
16
- * @definition [Cerberus Docs](https://cerberus.digitalu.design/docs/components/number-input)
17
- */
18
- export function NumberInput(props: NumberInputElProps) {
19
- const { scrubber, ...rootProps } = props
20
- return (
21
- <NumberInputParts.Root {...rootProps}>
22
- <Show when={scrubber}>
23
- <NumberInputParts.Scrubber />
24
- </Show>
25
-
26
- <NumberInputParts.Control>
27
- <NumberInputParts.Input />
28
- <IncrementTrigger />
29
- <DecrementTrigger />
30
- </NumberInputParts.Control>
31
- </NumberInputParts.Root>
32
- )
33
- }
@@ -1,65 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- NumberInputControl,
4
- NumberInputDecrementTrigger,
5
- NumberInputIncrementTrigger,
6
- NumberInputInput,
7
- NumberInputLabel,
8
- NumberInputRoot,
9
- NumberInputScrubber,
10
- } from './primitives'
11
-
12
- /**
13
- * This module contains the parts of the NumberInput component.
14
- * @module 'number-input/parts'
15
- */
16
-
17
- interface NumberInputPartsValue {
18
- /**
19
- * The context provider of the number input.
20
- */
21
- Root: ElementType
22
- /**
23
- * The label of the number input.
24
- */
25
- Label: ElementType
26
- /**
27
- * The input element of the number input.
28
- */
29
- Input: ElementType
30
- /**
31
- * The control container for increment and decrement buttons.
32
- */
33
- Control: ElementType
34
- /**
35
- * The button to decrement the value.
36
- */
37
- DecrementTrigger: ElementType
38
- /**
39
- * The button to increment the value.
40
- */
41
- IncrementTrigger: ElementType
42
- /**
43
- * The scrubber element for pointer-based value adjustment.
44
- */
45
- Scrubber: ElementType
46
- }
47
-
48
- /**
49
- * An Object containing the parts of the NumberInput component. For users that
50
- * prefer Object component syntax.
51
- *
52
- * @remarks
53
- *
54
- * When using object component syntax, you import the NumberInputParts object and
55
- * the entire family of components vs. only what you use.
56
- */
57
- export const NumberInputParts: NumberInputPartsValue = {
58
- Root: NumberInputRoot,
59
- Label: NumberInputLabel,
60
- Input: NumberInputInput,
61
- Control: NumberInputControl,
62
- DecrementTrigger: NumberInputDecrementTrigger,
63
- IncrementTrigger: NumberInputIncrementTrigger,
64
- Scrubber: NumberInputScrubber,
65
- }
@@ -1,74 +0,0 @@
1
- import {
2
- NumberInput,
3
- type NumberInputControlProps as ArkNumberInputControlProps,
4
- type NumberInputDecrementTriggerProps as ArkNumberInputDecrementTriggerProps,
5
- type NumberInputIncrementTriggerProps as ArkNumberInputIncrementTriggerProps,
6
- type NumberInputInputProps as ArkNumberInputInputProps,
7
- type NumberInputLabelProps as ArkNumberInputLabelProps,
8
- type NumberInputRootProps as ArkNumberInputRootProps,
9
- type NumberInputScrubberProps as ArkNumberInputScrubberProps,
10
- } from '@ark-ui/react/number-input'
11
- import {
12
- numberInput,
13
- type NumberInputVariantProps,
14
- } from 'styled-system/recipes'
15
- import {
16
- createCerberusPrimitive,
17
- type CerberusPrimitiveProps,
18
- } from '../../system/index'
19
-
20
- /**
21
- * This module contains all the primitives of the NumberInput component.
22
- * @module 'number-input'
23
- */
24
-
25
- const { withSlotRecipe, withNoRecipe } = createCerberusPrimitive(numberInput)
26
-
27
- // Root
28
-
29
- export type NumberInputRootProps = CerberusPrimitiveProps<
30
- ArkNumberInputRootProps & NumberInputVariantProps
31
- >
32
- export const NumberInputRoot = withSlotRecipe(NumberInput.Root, 'root')
33
-
34
- // Label
35
-
36
- export type NumberInputLabelProps =
37
- CerberusPrimitiveProps<ArkNumberInputLabelProps>
38
- export const NumberInputLabel = withNoRecipe(NumberInput.Label)
39
-
40
- // Input
41
-
42
- export type NumberInputInputProps =
43
- CerberusPrimitiveProps<ArkNumberInputInputProps>
44
- export const NumberInputInput = withSlotRecipe(NumberInput.Input, 'input')
45
-
46
- // Control
47
-
48
- export type NumberInputControlProps =
49
- CerberusPrimitiveProps<ArkNumberInputControlProps>
50
- export const NumberInputControl = withSlotRecipe(NumberInput.Control, 'control')
51
-
52
- // DecrementTrigger
53
-
54
- export type NumberInputDecrementTriggerProps =
55
- CerberusPrimitiveProps<ArkNumberInputDecrementTriggerProps>
56
- export const NumberInputDecrementTrigger = withSlotRecipe(
57
- NumberInput.DecrementTrigger,
58
- 'decrementTrigger',
59
- )
60
-
61
- // IncrementTrigger
62
-
63
- export type NumberInputIncrementTriggerProps =
64
- CerberusPrimitiveProps<ArkNumberInputIncrementTriggerProps>
65
- export const NumberInputIncrementTrigger = withSlotRecipe(
66
- NumberInput.IncrementTrigger,
67
- 'incrementTrigger',
68
- )
69
-
70
- // Scrubber
71
-
72
- export type NumberInputScrubberProps =
73
- CerberusPrimitiveProps<ArkNumberInputScrubberProps>
74
- export const NumberInputScrubber = withNoRecipe(NumberInput.Scrubber)
@@ -1,25 +0,0 @@
1
- import { Group } from '../group/index'
2
- import { Text } from '../text/index'
3
- import { PaginationProps } from './pagination'
4
- import { PaginationContextDetails } from './primitives'
5
- import { NextTrigger, PrevTrigger } from './triggers'
6
-
7
- interface CompactTextProps extends PaginationContextDetails {
8
- layout: PaginationProps['layout']
9
- }
10
-
11
- export function CompactText(props: CompactTextProps) {
12
- const { layout, ...pagination } = props
13
-
14
- return (
15
- <Group layout={layout}>
16
- <PrevTrigger layout={layout} />
17
-
18
- <Text alignSelf="center" textAlign="center" textStyle="label-sm">
19
- {pagination.page} of {pagination.totalPages}
20
- </Text>
21
-
22
- <NextTrigger layout={layout} />
23
- </Group>
24
- )
25
- }
@@ -1,6 +0,0 @@
1
- export * from './pagination'
2
- export * from './triggers'
3
- export * from './compact'
4
- export * from './item-list'
5
- export * from './primitives'
6
- export * from './parts'
@@ -1,34 +0,0 @@
1
- import { Group } from '../group/index'
2
- import { PaginationItem } from './item'
3
- import { PaginationProps } from './pagination'
4
- import { PaginationParts } from './parts'
5
- import { PaginationContextDetails } from './primitives'
6
- import { NextTrigger, PrevTrigger } from './triggers'
7
-
8
- interface ItemListProps extends PaginationContextDetails {
9
- layout?: PaginationProps['layout']
10
- }
11
-
12
- export function ItemList(props: ItemListProps) {
13
- const { layout, ...pagination } = props
14
-
15
- return (
16
- <Group layout={layout}>
17
- <PrevTrigger layout={layout} />
18
-
19
- {pagination.pages.map((page, index) =>
20
- page.type === 'page' ? (
21
- <PaginationParts.Item key={index} {...page} asChild>
22
- <PaginationItem>{page.value}</PaginationItem>
23
- </PaginationParts.Item>
24
- ) : (
25
- <PaginationParts.Ellipsis key={index} index={index} asChild>
26
- <PaginationItem>&#8230;</PaginationItem>
27
- </PaginationParts.Ellipsis>
28
- ),
29
- )}
30
-
31
- <NextTrigger layout={layout} />
32
- </Group>
33
- )
34
- }
@@ -1,6 +0,0 @@
1
- import { PropsWithChildren } from 'react'
2
- import { Button } from '../button/index'
3
-
4
- export function PaginationItem(props: PropsWithChildren) {
5
- return <Button shape="default" usage="outlined-subtle" {...props} />
6
- }
@@ -1,53 +0,0 @@
1
- 'use client'
2
-
3
- import type { WithCss } from 'styled-system/types'
4
- import { type GroupProps } from '../group/index'
5
- import { Show } from '../show/index'
6
- import { CompactText } from './compact'
7
- import { ItemList } from './item-list'
8
- import { PaginationParts } from './parts'
9
- import {
10
- PaginationRootProps,
11
- type PaginationContextDetails,
12
- } from './primitives'
13
-
14
- export interface PaginationProps extends PaginationRootProps, WithCss {
15
- /**
16
- * Display a compact layout of only text information and triggers.
17
- * @default false
18
- */
19
- compact?: boolean
20
- /**
21
- * Display the layout of the button group.
22
- * @default 'default'
23
- */
24
- layout?: GroupProps['layout']
25
- }
26
-
27
- /**
28
- * A pagination component that displays a list of buttons to navigate between pages.
29
- * @see [Cerby Docs](https://cerberus.digitalu.design/docs/components/pagination)
30
- * @definition [Ark Docs](https://ark-ui.com/docs/components/pagination#api-reference)
31
- */
32
- export function Pagination(props: PaginationProps) {
33
- const { compact, layout, ...rootProps } = props
34
-
35
- return (
36
- <PaginationParts.Root {...rootProps}>
37
- <PaginationParts.Context>
38
- {(pagination: PaginationContextDetails) => (
39
- <>
40
- {props.children}
41
-
42
- <Show
43
- when={compact}
44
- fallback={<ItemList layout={layout} {...pagination} />}
45
- >
46
- <CompactText layout={layout} {...pagination} />
47
- </Show>
48
- </>
49
- )}
50
- </PaginationParts.Context>
51
- </PaginationParts.Root>
52
- )
53
- }
@@ -1,65 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- PaginationRoot,
4
- PaginationPrevTrigger,
5
- PaginationNextTrigger,
6
- PaginationContext,
7
- PaginationItem,
8
- PaginationEllipsis,
9
- PaginationRootProvider,
10
- } from './primitives'
11
-
12
- /**
13
- * This module contains the parts of the Pagination component.
14
- * @module 'pagination/parts'
15
- */
16
-
17
- interface PaginationPartsValue {
18
- /**
19
- * The context provider of the pagination family.
20
- */
21
- Root: ElementType
22
- /**
23
- * The trigger button for going backwards.
24
- */
25
- PrevTrigger: ElementType
26
- /**
27
- * The trigger button for going forwards.
28
- */
29
- NextTrigger: ElementType
30
- /**
31
- * The context provider of the pagination family.
32
- */
33
- Context: ElementType
34
- /**
35
- * The item component of the pagination family.
36
- */
37
- Item: ElementType
38
- /**
39
- * The ellipsis component of the pagination family.
40
- */
41
- Ellipsis: ElementType
42
- /**
43
- * The context provider of the pagination family.
44
- */
45
- RootProvider: ElementType
46
- }
47
-
48
- /**
49
- * An Object containing the parts of the Pagination component. For users that
50
- * prefer Object component syntax.
51
- *
52
- * @remarks
53
- *
54
- * When using object component syntax, you import the PaginationParts object and
55
- * the entire family of components vs. only what you use.
56
- */
57
- export const PaginationParts: PaginationPartsValue = {
58
- Root: PaginationRoot,
59
- PrevTrigger: PaginationPrevTrigger,
60
- NextTrigger: PaginationNextTrigger,
61
- Context: PaginationContext,
62
- Item: PaginationItem,
63
- Ellipsis: PaginationEllipsis,
64
- RootProvider: PaginationRootProvider,
65
- }
@@ -1,41 +0,0 @@
1
- import {
2
- Pagination,
3
- type PaginationContextProps as ArkPaginationContextProps,
4
- type PaginationEllipsisProps as ArkPaginationEllipsisProps,
5
- type PaginationItemProps as ArkPaginationItemProps,
6
- type PaginationNextTriggerProps as ArkPaginationNextTriggerProps,
7
- type PaginationPrevTriggerProps as ArkPaginationPrevTriggerProps,
8
- type PaginationRootProps as ArkPaginationRootProps,
9
- type PaginationRootProviderProps as ArkPaginationRootProviderProps,
10
- type UsePaginationReturn as ArkUsePaginationReturn,
11
- type PaginationPageUrlDetails,
12
- type PaginationPageSizeChangeDetails,
13
- } from '@ark-ui/react/pagination'
14
- import { createCerberusPrimitive } from '../../system/index'
15
-
16
- const { withNoRecipe } = createCerberusPrimitive()
17
-
18
- export type PaginationRootProps = ArkPaginationRootProps
19
- export const PaginationRoot = withNoRecipe(Pagination.Root)
20
-
21
- export type PaginationPrevTriggerProps = ArkPaginationPrevTriggerProps
22
- export const PaginationPrevTrigger = withNoRecipe(Pagination.PrevTrigger)
23
-
24
- export type PaginationNextTriggerProps = ArkPaginationNextTriggerProps
25
- export const PaginationNextTrigger = withNoRecipe(Pagination.NextTrigger)
26
-
27
- export type PaginationContextProps = ArkPaginationContextProps
28
- export const PaginationContext = withNoRecipe(Pagination.Context)
29
-
30
- export type PaginationItemProps = ArkPaginationItemProps
31
- export const PaginationItem = withNoRecipe(Pagination.Item)
32
-
33
- export type PaginationEllipsisProps = ArkPaginationEllipsisProps
34
- export const PaginationEllipsis = withNoRecipe(Pagination.Ellipsis)
35
-
36
- export type PaginationRootProviderProps = ArkPaginationRootProviderProps
37
- export const PaginationRootProvider = withNoRecipe(Pagination.RootProvider)
38
-
39
- export type PaginationContextDetails = ArkUsePaginationReturn
40
- export type PageDetails = PaginationPageUrlDetails
41
- export type PageSizeChangeDetails = PaginationPageSizeChangeDetails
@@ -1,55 +0,0 @@
1
- 'use client'
2
-
3
- import { useCerberusContext } from '../../context/cerberus'
4
- import { PropsWithChildren } from 'react'
5
- import { IconButton, type IconButtonProps } from '../icon-button/index'
6
- import { PaginationParts } from './parts'
7
- import { GroupProps } from '../group'
8
-
9
- export function PrevTrigger(props: TriggerProps) {
10
- const { icons } = useCerberusContext()
11
- const { calendarPrev: Icon } = icons
12
-
13
- return (
14
- <PaginationParts.PrevTrigger asChild>
15
- <PaginationTrigger {...props}>
16
- <Icon />
17
- </PaginationTrigger>
18
- </PaginationParts.PrevTrigger>
19
- )
20
- }
21
-
22
- export function NextTrigger(props: TriggerProps) {
23
- const { icons } = useCerberusContext()
24
- const { calendarNext: Icon } = icons
25
-
26
- return (
27
- <PaginationParts.NextTrigger asChild>
28
- <PaginationTrigger {...props}>
29
- <Icon />
30
- </PaginationTrigger>
31
- </PaginationParts.NextTrigger>
32
- )
33
- }
34
-
35
- export interface TriggerBaseProps {
36
- layout?: GroupProps['layout']
37
- }
38
- export type TriggerProps = TriggerBaseProps & Omit<IconButtonProps, 'clipboard'>
39
-
40
- function PaginationTrigger(props: PropsWithChildren<TriggerProps>) {
41
- const { layout, ...btnProps } = props
42
-
43
- if (layout === 'attached') {
44
- return (
45
- <IconButton
46
- shape="square"
47
- usage="outlined-subtle"
48
- clipboard
49
- {...btnProps}
50
- />
51
- )
52
- }
53
-
54
- return <IconButton shape="square" clipboard {...btnProps} />
55
- }