@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,55 +0,0 @@
1
- import { cerberus, CerberusProps } from '../../system/index'
2
-
3
- /**
4
- * This module exports a component for rendering text utilizing the styled-system JSX utility.
5
- * @module @cerberus/react/Text
6
- */
7
-
8
- export type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
9
- export type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'
10
-
11
- // For some reason we have to use the HTMLParagraphElement type here
12
- // or else TS will fail for non-style props like 'id' or 'className'
13
- export interface TextProps extends CerberusProps<'p'> {
14
- /**
15
- * The element to render as. Defaults to 'p'.
16
- */
17
- as?: TextElements | Headings
18
- }
19
-
20
- /**
21
- * A component for rendering text utilizing the styled-system JSX utility.
22
- * @definition [Text docs](https://cerberus.digitalu.design/react/text)
23
- * @example
24
- * ```tsx
25
- * <Text as="h1" color="page.text.100" textStyle={{
26
- * base: 'heading-md',
27
- * md: 'heading-lg',
28
- * }}>
29
- * Hello, world!
30
- * </Text>
31
- */
32
- export function Text(props: TextProps) {
33
- const { as = 'p', ...elProps } = props
34
-
35
- const cache = {
36
- h1: cerberus.h1,
37
- h2: cerberus.h2,
38
- h3: cerberus.h3,
39
- h4: cerberus.h4,
40
- h5: cerberus.h5,
41
- h6: cerberus.h6,
42
- strong: cerberus.strong,
43
- em: cerberus.em,
44
- small: cerberus.small,
45
- span: cerberus.span,
46
- p: cerberus.p,
47
- }
48
-
49
- if (as in cache) {
50
- const Component = cache[as as keyof typeof cache]
51
- return <Component {...elProps} />
52
- }
53
-
54
- return <cerberus.p {...elProps} />
55
- }
@@ -1 +0,0 @@
1
- export * from './theme'
@@ -1,34 +0,0 @@
1
- import type { PropsWithChildren } from 'react'
2
- import type { ColorModes, CustomThemes } from '../../context/theme'
3
- import { cerberus, type CerberusPrimitiveProps } from '../../system'
4
-
5
- export interface ThemeProps<T extends string> {
6
- /**
7
- * The color mode to apply to the theme.
8
- * @default 'light'
9
- */
10
- mode?: ColorModes
11
- /**
12
- * The theme to apply to the component.
13
- * @default 'cerberus'
14
- */
15
- theme?: CustomThemes<T>
16
- }
17
-
18
- export function Theme<T extends string>(
19
- props: PropsWithChildren<CerberusPrimitiveProps<ThemeProps<T>>>,
20
- ) {
21
- const { mode, theme, ...nativeProps } = props
22
- const colorMode = mode || 'light'
23
- const themeName = theme || 'cerberus'
24
-
25
- return (
26
- <cerberus.div
27
- {...nativeProps}
28
- data-panda-theme={themeName}
29
- data-color-mode={colorMode}
30
- >
31
- {props.children}
32
- </cerberus.div>
33
- )
34
- }
@@ -1,2 +0,0 @@
1
- export * from './parts'
2
- export * from './primitives'
@@ -1,32 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import { ToggleRoot, ToggleIndicator } from './primitives'
3
-
4
- /**
5
- * This module contains the parts of the Toggle parts.
6
- * @module 'toggle/parts'
7
- */
8
-
9
- interface TogglePartsValue {
10
- /**
11
- * The container of the toggle.
12
- */
13
- Root: ElementType
14
- /**
15
- * The indicator that appears when a toggle is pressed.
16
- */
17
- Indicator: ElementType
18
- }
19
-
20
- /**
21
- * An Object containing the parts of the Radio component. For users that
22
- * prefer Object component syntax.
23
- *
24
- * @remarks
25
- *
26
- * When using object component syntax, you import the RadioParts object and
27
- * the entire family of components vs. only what you use.
28
- */
29
- export const ToggleParts: TogglePartsValue = {
30
- Root: ToggleRoot,
31
- Indicator: ToggleIndicator,
32
- }
@@ -1,27 +0,0 @@
1
- import {
2
- Toggle,
3
- type ToggleIndicatorProps as ArkToggleIndicatorProps,
4
- type ToggleRootProps as ArkToggleRootProps,
5
- } from '@ark-ui/react/toggle'
6
- import {
7
- createCerberusPrimitive,
8
- type CerberusPrimitiveProps,
9
- } from '../../system/index'
10
-
11
- /**
12
- * This module provides the Toggle primitives.
13
- * @module 'react/toggle'
14
- */
15
-
16
- const { withNoRecipe } = createCerberusPrimitive()
17
-
18
- // Root
19
-
20
- export type ToggleRootProps = CerberusPrimitiveProps<ArkToggleRootProps>
21
- export const ToggleRoot = withNoRecipe(Toggle.Root)
22
-
23
- // Indicator
24
-
25
- export type ToggleIndicatorProps =
26
- CerberusPrimitiveProps<ArkToggleIndicatorProps>
27
- export const ToggleIndicator = withNoRecipe(Toggle.Indicator)
@@ -1,3 +0,0 @@
1
- export * from './primitives'
2
- export * from './parts'
3
- export * from './tooltip'
@@ -1,59 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- TooltipRoot,
4
- TooltipTrigger,
5
- TooltipPositioner,
6
- TooltipContent,
7
- TooltipArrow,
8
- TooltipArrowTip,
9
- } from './primitives'
10
-
11
- /**
12
- * This module contains the parts of the Tooltip component.
13
- * @module 'tooltip/parts'
14
- */
15
-
16
- interface TooltipPartsValue {
17
- /**
18
- * The context provider of the tooltip.
19
- */
20
- Root: ElementType
21
- /**
22
- * The trigger that of the tooltip.
23
- */
24
- Trigger: ElementType
25
- /**
26
- * The positioner of the tooltip.
27
- */
28
- Positioner: ElementType
29
- /**
30
- * The content of the tooltip.
31
- */
32
- Content: ElementType
33
- /**
34
- * The arrow of the tooltip.
35
- */
36
- Arrow: ElementType
37
- /**
38
- * The arrow tip of the tooltip.
39
- */
40
- ArrowTip: ElementType
41
- }
42
-
43
- /**
44
- * An Object containing the parts of the Tooltip component. For users that
45
- * prefer Object component syntax.
46
- *
47
- * @remarks
48
- *
49
- * When using object component syntax, you import the TooltipParts object and
50
- * the entire family of components vs. only what you use.
51
- */
52
- export const TooltipParts: TooltipPartsValue = {
53
- Root: TooltipRoot,
54
- Trigger: TooltipTrigger,
55
- Positioner: TooltipPositioner,
56
- Content: TooltipContent,
57
- Arrow: TooltipArrow,
58
- ArrowTip: TooltipArrowTip,
59
- }
@@ -1,56 +0,0 @@
1
- import {
2
- Tooltip,
3
- type TooltipRootProps as ArkTooltipRootProps,
4
- type TooltipTriggerProps as ArkTooltipTriggerProps,
5
- type TooltipPositionerProps as ArkTooltipPositionerProps,
6
- type TooltipContentProps as ArkTooltipContentProps,
7
- type TooltipArrowProps as ArkTooltipArrowProps,
8
- type TooltipArrowTipProps as ArkTooltipArrowTipProps,
9
- } from '@ark-ui/react/tooltip'
10
- import { tooltip } from 'styled-system/recipes'
11
- import {
12
- createCerberusPrimitive,
13
- type CerberusPrimitiveProps,
14
- } from '../../system/index'
15
-
16
- /**
17
- * This module contains the Tooltip primitive components.
18
- * @module TooltipPrimitives
19
- */
20
-
21
- const { withSlotRecipe } = createCerberusPrimitive(tooltip)
22
-
23
- // Root
24
-
25
- export type TooltipRootProps = CerberusPrimitiveProps<ArkTooltipRootProps>
26
- export const TooltipRoot = withSlotRecipe(Tooltip.Root, 'root')
27
-
28
- // Trigger
29
-
30
- export type TooltipTriggerProps = CerberusPrimitiveProps<ArkTooltipTriggerProps>
31
- export const TooltipTrigger = withSlotRecipe(Tooltip.Trigger, 'trigger')
32
-
33
- // Positioner
34
-
35
- export type TooltipPositionerProps =
36
- CerberusPrimitiveProps<ArkTooltipPositionerProps>
37
- export const TooltipPositioner = withSlotRecipe(
38
- Tooltip.Positioner,
39
- 'positioner',
40
- )
41
-
42
- // Content
43
-
44
- export type TooltipContentProps = CerberusPrimitiveProps<ArkTooltipContentProps>
45
- export const TooltipContent = withSlotRecipe(Tooltip.Content, 'content')
46
-
47
- // Arrow
48
-
49
- export type TooltipArrowProps = CerberusPrimitiveProps<ArkTooltipArrowProps>
50
- export const TooltipArrow = withSlotRecipe(Tooltip.Arrow, 'arrow')
51
-
52
- // ArrowTip
53
-
54
- export type TooltipArrowTipProps =
55
- CerberusPrimitiveProps<ArkTooltipArrowTipProps>
56
- export const TooltipArrowTip = withSlotRecipe(Tooltip.ArrowTip, 'arrowTip')
@@ -1,46 +0,0 @@
1
- import type { ReactNode } from 'react'
2
- import { TooltipParts } from './parts'
3
- import type { TooltipRootProps } from './primitives'
4
-
5
- /**
6
- * This module contains the Tooltip component.
7
- * @module Tooltip
8
- */
9
-
10
- export interface TooltipProps extends Omit<TooltipRootProps, 'content'> {
11
- /**
12
- * The text content to display in the tooltip.
13
- */
14
- content: ReactNode
15
- }
16
-
17
- /**
18
- * The Tooltip component is used to provide additional information about an element when it is hovered over.
19
- * @definition [Tooltip docs](https://cerberus.digitalu.design/react/tooltip)
20
- * @example
21
- * ```tsx
22
- * <Tooltip content="This is a tooltip">
23
- * <Information />
24
- * </Tooltip>
25
- */
26
- export function Tooltip(props: TooltipProps) {
27
- const { content, children, ...rootProps } = props
28
- const position = {
29
- placement: props.positioning || 'top',
30
- }
31
-
32
- return (
33
- <TooltipParts.Root openDelay={400} positioning={position} {...rootProps}>
34
- <TooltipParts.Trigger asChild>{children}</TooltipParts.Trigger>
35
-
36
- <TooltipParts.Positioner>
37
- <TooltipParts.Content>
38
- <TooltipParts.Arrow>
39
- <TooltipParts.ArrowTip />
40
- </TooltipParts.Arrow>
41
- {content}
42
- </TooltipParts.Content>
43
- </TooltipParts.Positioner>
44
- </TooltipParts.Root>
45
- )
46
- }
@@ -1,24 +0,0 @@
1
- import { defaultIcons } from './icons/default'
2
- import type { DefinedIcons, IconType } from './types'
3
-
4
- /**
5
- * Defines the icons that will be used in Cerberus React components via the
6
- * CerberusProvider.
7
- * @param icons The icons that will be used in Cerberus React components.
8
- * @returns Icons object compatible with the CerberusProvider SystemConfig.
9
- * @example
10
- * ```tsx
11
- * const icons = defineIcons({
12
- * accordionIndicator: MyAccordionIndicatorIcon,
13
- * ...
14
- * })
15
- * ```
16
- */
17
- export function defineIcons<T extends IconType>(
18
- icons: DefinedIcons<T>,
19
- ): Required<DefinedIcons<T>> {
20
- return {
21
- ...defaultIcons,
22
- ...icons,
23
- } as Required<DefinedIcons<T>>
24
- }
@@ -1,98 +0,0 @@
1
- /**
2
- * This module contains substitute icons for the Checkbox component.
3
- * @module
4
- */
5
-
6
- /**
7
- * Checkmark icon for Checkbox component
8
- */
9
- export function CheckmarkIcon() {
10
- return (
11
- <svg
12
- aria-hidden="true"
13
- xmlns="http://www.w3.org/2000/svg"
14
- fill="none"
15
- role="img"
16
- viewBox="0 0 24 24"
17
- >
18
- <path
19
- fill="currentColor"
20
- d="M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
21
- />
22
- </svg>
23
- )
24
- }
25
-
26
- /**
27
- * Indeterminate icon for Checkbox component
28
- */
29
- export function IndeterminateIcon() {
30
- return (
31
- <svg
32
- aria-hidden="true"
33
- xmlns="http://www.w3.org/2000/svg"
34
- role="img"
35
- fill="none"
36
- viewBox="0 0 24 24"
37
- >
38
- <path fill="currentColor" d="M4 11h16v2.667H4z" />
39
- </svg>
40
- )
41
- }
42
-
43
- /**
44
- * Animated checkmark icon for Clipboard.Indicator component
45
- */
46
- export function AnimatedCheckmarkIcon() {
47
- return (
48
- <svg
49
- aria-hidden="true"
50
- role="img"
51
- xmlns="http://www.w3.org/2000/svg"
52
- viewBox="0 0 24 24"
53
- >
54
- <path
55
- fill="none"
56
- stroke="currentColor"
57
- strokeDasharray={24}
58
- strokeDashoffset={24}
59
- strokeLinejoin="round"
60
- strokeWidth={2}
61
- d="M5 11l6 6l10 -10"
62
- >
63
- <animate
64
- fill="freeze"
65
- attributeName="stroke-dashoffset"
66
- dur="0.28s"
67
- values="24;0"
68
- ></animate>
69
- </path>
70
- </svg>
71
- )
72
- }
73
-
74
- /**
75
- * Copy icon for Clipboard.Indicator component
76
- */
77
- export function CopyIcon() {
78
- return (
79
- <svg
80
- xmlns="http://www.w3.org/2000/svg"
81
- aria-hidden="true"
82
- role="img"
83
- viewBox="0 0 32 32"
84
- >
85
- <title>copy</title>
86
- <path
87
- d="M28 10v18H10V10zm0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2"
88
- fill="currentColor"
89
- />
90
- <path d="M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z" fill="currentColor" />
91
- <path
92
- fill="none"
93
- d="M0 0h32v32H0z"
94
- data-name="&lt;Transparent Rectangle&gt;"
95
- />
96
- </svg>
97
- )
98
- }
@@ -1,69 +0,0 @@
1
- import {
2
- Calendar,
3
- CaretDown,
4
- Checkmark,
5
- CheckmarkOutline,
6
- ChevronDown,
7
- ChevronLeft,
8
- ChevronRight,
9
- ChevronUp,
10
- Close,
11
- CloudUpload,
12
- Information,
13
- OverflowMenuVertical,
14
- Restart,
15
- TrashCan,
16
- UserFilled,
17
- Warning,
18
- WarningAlt,
19
- WarningFilled,
20
- } from '@carbon/icons-react'
21
- import { AnimatingUploadIcon } from '../../components/AnimatingUploadIcon'
22
- import { DefinedIcons } from '../types'
23
- import { CheckmarkIcon, IndeterminateIcon } from './checkbox.icons'
24
- import {
25
- PinLeftFilledIcon,
26
- PinLeftIcon,
27
- PinRightFilledIcon,
28
- PinRightIcon,
29
- } from './pinned.icons'
30
- import { SortAscIcon, SortDescIcon } from './sort.icons'
31
-
32
- /**
33
- * Fallback icons when there is no custom set provided by the user.
34
- */
35
- export const defaultIcons: Required<DefinedIcons> = {
36
- accordionIndicator: ChevronDown,
37
- avatar: UserFilled,
38
- calendar: Calendar,
39
- calendarPrev: ChevronLeft,
40
- calendarNext: ChevronRight,
41
- caretDown: CaretDown,
42
- checkbox: CheckmarkIcon,
43
- close: Close,
44
- confirmModal: Information,
45
- dangerNotification: WarningFilled,
46
- decrement: ChevronDown,
47
- delete: TrashCan,
48
- fileUploader: AnimatingUploadIcon,
49
- increment: ChevronUp,
50
- indeterminate: IndeterminateIcon,
51
- infoNotification: Information,
52
- invalid: WarningFilled,
53
- invalidAlt: Warning,
54
- moreVertical: OverflowMenuVertical,
55
- pinLeft: PinLeftIcon,
56
- pinLeftFilled: PinLeftFilledIcon,
57
- pinRight: PinRightIcon,
58
- pinRightFilled: PinRightFilledIcon,
59
- promptModal: Information,
60
- redo: Restart,
61
- selectArrow: ChevronDown,
62
- selectChecked: Checkmark,
63
- sortAsc: SortAscIcon,
64
- sortDesc: SortDescIcon,
65
- successNotification: CheckmarkOutline,
66
- toggleChecked: Checkmark,
67
- waitingFileUploader: CloudUpload,
68
- warningNotification: WarningAlt,
69
- }
@@ -1,31 +0,0 @@
1
- import { CarbonIconProps, Pin, PinFilled } from '@carbon/icons-react'
2
- import { PropsWithChildren } from 'react'
3
- import { Box } from 'styled-system/jsx'
4
-
5
- export function PinLeftIcon(props: CarbonIconProps) {
6
- return <Pin {...props} />
7
- }
8
-
9
- export function PinLeftFilledIcon(props: CarbonIconProps) {
10
- return <PinFilled {...props} />
11
- }
12
-
13
- export function PinRightIcon(props: CarbonIconProps) {
14
- return (
15
- <FlippedContainer>
16
- <Pin {...props} />
17
- </FlippedContainer>
18
- )
19
- }
20
-
21
- export function PinRightFilledIcon(props: CarbonIconProps) {
22
- return (
23
- <FlippedContainer>
24
- <PinFilled {...props} />
25
- </FlippedContainer>
26
- )
27
- }
28
-
29
- function FlippedContainer(props: PropsWithChildren) {
30
- return <Box transform="scaleX(-1)" {...props} />
31
- }
@@ -1,19 +0,0 @@
1
- import { CarbonIconProps, SortAscending } from '@carbon/icons-react'
2
- import { PropsWithChildren } from 'react'
3
- import { Box } from 'styled-system/jsx'
4
-
5
- export function SortAscIcon(props: CarbonIconProps) {
6
- return <SortAscending {...props} />
7
- }
8
-
9
- export function SortDescIcon(props: CarbonIconProps) {
10
- return (
11
- <FlippedContainer>
12
- <SortAscending {...props} />
13
- </FlippedContainer>
14
- )
15
- }
16
-
17
- function FlippedContainer(props: PropsWithChildren) {
18
- return <Box transform="rotate(180deg)" {...props} />
19
- }
@@ -1,41 +0,0 @@
1
- import { defaultIcons } from './icons/default'
2
- import type { SystemConfig } from './types'
3
-
4
- /**
5
- * Create a system configuration object to be used on the CerberusProvider.
6
- * @param options The system configuration options you want to customize.
7
- * @returns A CerberusProvider-compatible system configuration object.
8
- * @example
9
- * ```tsx
10
- * const icons = defineIcons({
11
- * accordionIndicator: MyAccordionIndicatorIcon,
12
- * ...
13
- * })
14
- * const config = makeSystemConfig({
15
- * icons,
16
- * })
17
- *
18
- * // In your app
19
- * <CerberusProvider config={config}>
20
- * <App />
21
- * </CerberusProvider>
22
- * ```
23
- */
24
- export function makeSystemConfig(options?: SystemConfig): SystemConfig {
25
- if (!options) {
26
- return {
27
- icons: defaultIcons,
28
- }
29
- }
30
-
31
- return {
32
- ...options,
33
- icons: {
34
- ...defaultIcons,
35
- ...options.icons,
36
- },
37
- }
38
- }
39
-
40
- export * from './defineIcons'
41
- export * from './types'
@@ -1,53 +0,0 @@
1
- import type { ElementType } from 'react'
2
-
3
- /**
4
- * This module contains the types for the Cerberus React configuration.
5
- * @module config.types
6
- */
7
-
8
- export interface SystemConfig {
9
- /**
10
- * The icons that will be used in Cerberus React components.
11
- */
12
- icons: Required<DefinedIcons>
13
- }
14
-
15
- export interface DefinedIcons<T extends IconType = IconType> {
16
- accordionIndicator?: T
17
- avatar?: T
18
- calendar?: T
19
- calendarPrev?: T
20
- calendarNext?: T
21
- caretDown?: T
22
- checkbox?: T
23
- close?: T
24
- confirmModal?: T
25
- decrement?: T
26
- delete?: T
27
- dangerNotification?: T
28
- fileUploader?: T
29
- indeterminate?: T
30
- increment?: T
31
- infoNotification?: T
32
- invalid?: T
33
- invalidAlt?: T
34
- moreVertical?: T
35
- pinLeft?: T
36
- pinLeftFilled?: T
37
- pinRight?: T
38
- pinRightFilled?: T
39
- promptModal?: T
40
- redo?: T
41
- selectArrow?: T
42
- selectChecked?: T
43
- sortAsc?: T
44
- sortDesc?: T
45
- successNotification?: T
46
- toggleChecked?: T
47
- waitingFileUploader?: T
48
- warningNotification?: T
49
- }
50
-
51
- // types
52
-
53
- export type IconType = ElementType