@cerberus-design/react 0.16.0-next-22894bb → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +27 -248
  2. package/build/legacy/components/checkbox/checkbox.cjs.map +1 -1
  3. package/build/legacy/components/checkbox/index.cjs.map +1 -1
  4. package/build/legacy/components/for.cjs +4 -3
  5. package/build/legacy/components/for.cjs.map +1 -1
  6. package/build/legacy/{components/cta-dialog/provider.cjs → context/cta-modal.cjs} +150 -187
  7. package/build/legacy/context/cta-modal.cjs.map +1 -0
  8. package/build/legacy/index.cjs +720 -884
  9. package/build/legacy/index.cjs.map +1 -1
  10. package/build/modern/_tsup-dts-rollup.d.ts +27 -248
  11. package/build/modern/{chunk-O542MPR7.js → chunk-CMYD5KWA.js} +4 -4
  12. package/build/modern/{chunk-H5WNUPGH.js → chunk-FMRWRVUS.js} +7 -7
  13. package/build/modern/chunk-IIH363FO.js +13 -0
  14. package/build/modern/chunk-IIH363FO.js.map +1 -0
  15. package/build/modern/{chunk-6ICNCCPD.js → chunk-P3SF56LT.js} +4 -4
  16. package/build/modern/{chunk-UNRQAXLJ.js → chunk-Y4ZEJ2EF.js} +1 -1
  17. package/build/modern/chunk-Y4ZEJ2EF.js.map +1 -0
  18. package/build/modern/{chunk-QEM3M4N3.js → chunk-ZDANBCM3.js} +31 -22
  19. package/build/modern/chunk-ZDANBCM3.js.map +1 -0
  20. package/build/modern/components/checkbox/checkbox.js +1 -1
  21. package/build/modern/components/checkbox/index.js +1 -1
  22. package/build/modern/components/for.js +1 -1
  23. package/build/modern/components/select/index.js +2 -2
  24. package/build/modern/components/select/select.js +2 -2
  25. package/build/modern/context/cta-modal.js +19 -0
  26. package/build/modern/context/notification-center.js +3 -3
  27. package/build/modern/context/prompt-modal.js +2 -2
  28. package/build/modern/index.js +92 -124
  29. package/build/modern/index.js.map +1 -1
  30. package/package.json +2 -2
  31. package/src/components/checkbox/checkbox.tsx +2 -2
  32. package/src/components/for.tsx +18 -13
  33. package/src/{components/cta-dialog/provider.tsx → context/cta-modal.tsx} +68 -34
  34. package/src/index.ts +1 -2
  35. package/build/legacy/components/cta-dialog/context.cjs +0 -33
  36. package/build/legacy/components/cta-dialog/context.cjs.map +0 -1
  37. package/build/legacy/components/cta-dialog/index.cjs +0 -433
  38. package/build/legacy/components/cta-dialog/index.cjs.map +0 -1
  39. package/build/legacy/components/cta-dialog/provider.cjs.map +0 -1
  40. package/build/legacy/components/cta-dialog/trigger-item.cjs +0 -99
  41. package/build/legacy/components/cta-dialog/trigger-item.cjs.map +0 -1
  42. package/build/legacy/components/cta-dialog/utils.cjs +0 -47
  43. package/build/legacy/components/cta-dialog/utils.cjs.map +0 -1
  44. package/build/legacy/components/rating/index.cjs +0 -167
  45. package/build/legacy/components/rating/index.cjs.map +0 -1
  46. package/build/legacy/components/rating/parts.cjs +0 -98
  47. package/build/legacy/components/rating/parts.cjs.map +0 -1
  48. package/build/legacy/components/rating/primitives.cjs +0 -97
  49. package/build/legacy/components/rating/primitives.cjs.map +0 -1
  50. package/build/legacy/components/rating/rating.cjs +0 -151
  51. package/build/legacy/components/rating/rating.cjs.map +0 -1
  52. package/build/modern/chunk-4LSTU6WU.js +0 -8
  53. package/build/modern/chunk-4LSTU6WU.js.map +0 -1
  54. package/build/modern/chunk-DXOKSZVQ.js +0 -12
  55. package/build/modern/chunk-DXOKSZVQ.js.map +0 -1
  56. package/build/modern/chunk-IKDXADLX.js +0 -1
  57. package/build/modern/chunk-MVO2GNUA.js +0 -47
  58. package/build/modern/chunk-MVO2GNUA.js.map +0 -1
  59. package/build/modern/chunk-OS73F4SR.js +0 -25
  60. package/build/modern/chunk-OS73F4SR.js.map +0 -1
  61. package/build/modern/chunk-PLHYOCY3.js +0 -23
  62. package/build/modern/chunk-PLHYOCY3.js.map +0 -1
  63. package/build/modern/chunk-QEM3M4N3.js.map +0 -1
  64. package/build/modern/chunk-QQCB6JXW.js +0 -36
  65. package/build/modern/chunk-QQCB6JXW.js.map +0 -1
  66. package/build/modern/chunk-UNRQAXLJ.js.map +0 -1
  67. package/build/modern/chunk-W47QEZD5.js +0 -71
  68. package/build/modern/chunk-W47QEZD5.js.map +0 -1
  69. package/build/modern/chunk-ZOSGUATV.js +0 -1
  70. package/build/modern/chunk-ZOSGUATV.js.map +0 -1
  71. package/build/modern/components/cta-dialog/context.js +0 -8
  72. package/build/modern/components/cta-dialog/context.js.map +0 -1
  73. package/build/modern/components/cta-dialog/index.js +0 -26
  74. package/build/modern/components/cta-dialog/index.js.map +0 -1
  75. package/build/modern/components/cta-dialog/provider.js +0 -22
  76. package/build/modern/components/cta-dialog/provider.js.map +0 -1
  77. package/build/modern/components/cta-dialog/trigger-item.js +0 -10
  78. package/build/modern/components/cta-dialog/trigger-item.js.map +0 -1
  79. package/build/modern/components/cta-dialog/utils.js +0 -7
  80. package/build/modern/components/cta-dialog/utils.js.map +0 -1
  81. package/build/modern/components/rating/index.js +0 -31
  82. package/build/modern/components/rating/index.js.map +0 -1
  83. package/build/modern/components/rating/parts.js +0 -8
  84. package/build/modern/components/rating/parts.js.map +0 -1
  85. package/build/modern/components/rating/primitives.js +0 -19
  86. package/build/modern/components/rating/primitives.js.map +0 -1
  87. package/build/modern/components/rating/rating.js +0 -12
  88. package/build/modern/components/rating/rating.js.map +0 -1
  89. package/src/components/cta-dialog/context.tsx +0 -34
  90. package/src/components/cta-dialog/index.ts +0 -2
  91. package/src/components/cta-dialog/trigger-item.tsx +0 -53
  92. package/src/components/cta-dialog/utils.ts +0 -57
  93. package/src/components/rating/index.ts +0 -8
  94. package/src/components/rating/parts.tsx +0 -65
  95. package/src/components/rating/primitives.tsx +0 -99
  96. package/src/components/rating/rating.tsx +0 -78
  97. /package/build/modern/{chunk-O542MPR7.js.map → chunk-CMYD5KWA.js.map} +0 -0
  98. /package/build/modern/{chunk-H5WNUPGH.js.map → chunk-FMRWRVUS.js.map} +0 -0
  99. /package/build/modern/{chunk-6ICNCCPD.js.map → chunk-P3SF56LT.js.map} +0 -0
  100. /package/build/modern/{chunk-IKDXADLX.js.map → context/cta-modal.js.map} +0 -0
@@ -1,19 +0,0 @@
1
- import {
2
- RatingContext,
3
- RatingControl,
4
- RatingHiddenInput,
5
- RatingItem,
6
- RatingItemContext,
7
- RatingLabel,
8
- RatingRoot
9
- } from "../../chunk-W47QEZD5.js";
10
- export {
11
- RatingContext,
12
- RatingControl,
13
- RatingHiddenInput,
14
- RatingItem,
15
- RatingItemContext,
16
- RatingLabel,
17
- RatingRoot
18
- };
19
- //# sourceMappingURL=primitives.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,12 +0,0 @@
1
- import {
2
- Rating
3
- } from "../../chunk-QQCB6JXW.js";
4
- import "../../chunk-OS73F4SR.js";
5
- import "../../chunk-W47QEZD5.js";
6
- import "../../chunk-BL7G3577.js";
7
- import "../../chunk-FQLMPEYX.js";
8
- import "../../chunk-BUVVRQLZ.js";
9
- export {
10
- Rating
11
- };
12
- //# sourceMappingURL=rating.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,34 +0,0 @@
1
- 'use client'
2
-
3
- import { createContext, type ReactNode } from 'react'
4
- import type { CTAModalActionReturn } from './utils'
5
-
6
- /**
7
- * This module provides the context for the cta modal.
8
- * @module
9
- */
10
-
11
- export interface ShowCTAModalOptions {
12
- /**
13
- * The heading of the cta modal.
14
- */
15
- heading: string
16
- /**
17
- * The description of the cta modal.
18
- */
19
- description?: string
20
- /**
21
- * The icon used for the modal Avatar.
22
- */
23
- icon?: ReactNode
24
- /**
25
- * The actions for the cta modal. Requires 2 actions.
26
- */
27
- actions: CTAModalActionReturn
28
- }
29
-
30
- export interface CTAModalValue {
31
- show: (options: ShowCTAModalOptions) => void
32
- }
33
-
34
- export const CTAModalContext = createContext<CTAModalValue | null>(null)
@@ -1,2 +0,0 @@
1
- export * from './provider'
2
- export * from './utils'
@@ -1,53 +0,0 @@
1
- import { css, cx } from '@cerberus/styled-system/css'
2
- import { Button, type ButtonProps } from '../button/button'
3
- import { ark } from '@ark-ui/react/factory'
4
- import { button } from '@cerberus/styled-system/recipes'
5
-
6
- /**
7
- * This module provides the trigger item for the cta modal.
8
- * @module 'react/cta-modal/trigger-item'
9
- */
10
-
11
- export interface TriggerItemProps extends ButtonProps {
12
- asChild?: boolean
13
- }
14
-
15
- /**
16
- * Trigger item for the cta modal which renders content based on the actions.
17
- * type.
18
- */
19
- export function TriggerItem(props: TriggerItemProps) {
20
- const { asChild, children, ...buttonProps } = props
21
-
22
- if (asChild) {
23
- return (
24
- <ark.div
25
- className={cx(
26
- button({
27
- shape: 'rounded',
28
- usage: 'ghost',
29
- }),
30
- css({
31
- w: '1/2',
32
- }),
33
- )}
34
- asChild
35
- >
36
- {children}
37
- </ark.div>
38
- )
39
- }
40
-
41
- return (
42
- <Button
43
- {...buttonProps}
44
- className={css({
45
- w: '1/2',
46
- })}
47
- shape="rounded"
48
- usage="outlined"
49
- >
50
- {children}
51
- </Button>
52
- )
53
- }
@@ -1,57 +0,0 @@
1
- import type { MouseEventHandler, ReactNode } from 'react'
2
-
3
- /**
4
- * This module provide utility functions for the cta modal.
5
- * @module 'react/cta-modal/utils'
6
- */
7
-
8
- export type CTAButtonAction = {
9
- /**
10
- * The text of the button.
11
- */
12
- text: string
13
- /**
14
- * The onClick handler for the button.
15
- */
16
- handleClick: MouseEventHandler<HTMLButtonElement>
17
- }
18
-
19
- export type CTAModalAction = (CTAButtonAction | ReactNode)[]
20
-
21
- export interface CTAModalActionReturn {
22
- /**
23
- * The type of the action content.
24
- */
25
- type: 'reactNode' | 'btnAction'
26
- /**
27
- * The actions for the cta modal. Max of 2 actions.
28
- */
29
- _actions: CTAModalAction
30
- }
31
-
32
- /**
33
- * Creates the action data to pass to the cta modal `show` method.
34
- */
35
- export function createCTAModalActions(
36
- providedActions: CTAModalAction,
37
- ): CTAModalActionReturn {
38
- if (providedActions.length !== 2) {
39
- throw new Error('CTAModal must include 2 actions')
40
- }
41
-
42
- if (
43
- providedActions.every(
44
- (action) => (action as unknown as CTAButtonAction)?.handleClick,
45
- )
46
- ) {
47
- return {
48
- type: 'btnAction',
49
- _actions: providedActions as CTAButtonAction[],
50
- }
51
- }
52
-
53
- return {
54
- type: 'reactNode',
55
- _actions: providedActions as ReactNode[],
56
- }
57
- }
@@ -1,8 +0,0 @@
1
- export * from './parts'
2
- export * from './primitives'
3
- export * from './rating'
4
-
5
- export type {
6
- UseRatingGroupContext,
7
- UseRatingGroupItemContext,
8
- } from '@ark-ui/react/rating-group'
@@ -1,65 +0,0 @@
1
- import type { ElementType } from 'react'
2
- import {
3
- RatingContext,
4
- RatingControl,
5
- RatingHiddenInput,
6
- RatingItem,
7
- RatingItemContext,
8
- RatingLabel,
9
- RatingRoot,
10
- } from './primitives'
11
-
12
- /**
13
- * This module contains the parts of the Rating component.
14
- * @module 'rating/parts'
15
- */
16
-
17
- interface RatingPartsValue {
18
- /**
19
- * The container of the rating.
20
- */
21
- Root: ElementType
22
- /**
23
- * The label of the rating.
24
- */
25
- Label: ElementType
26
- /**
27
- * The visual representation of the rating.
28
- */
29
- Control: ElementType
30
- /**
31
- * The context of the rating.
32
- */
33
- Context: ElementType
34
- /**
35
- * The item to display for the rating.
36
- */
37
- Item: ElementType
38
- /**
39
- * The context provider for the rating items.
40
- */
41
- ItemContext: ElementType
42
- /**
43
- * The native input of the rating.
44
- */
45
- HiddenInput: ElementType
46
- }
47
-
48
- /**
49
- * An Object containing the parts of the Rating component. For users that
50
- * prefer Object component syntax.
51
- *
52
- * @remarks
53
- *
54
- * When using object component syntax, you import the RatingParts object and
55
- * the entire family of components vs. only what you use.
56
- */
57
- export const RatingParts: RatingPartsValue = {
58
- Root: RatingRoot,
59
- Label: RatingLabel,
60
- Control: RatingControl,
61
- Context: RatingContext,
62
- Item: RatingItem,
63
- ItemContext: RatingItemContext,
64
- HiddenInput: RatingHiddenInput,
65
- }
@@ -1,99 +0,0 @@
1
- import {
2
- RatingGroup,
3
- type RatingGroupContextProps,
4
- type RatingGroupControlProps,
5
- type RatingGroupHiddenInputProps,
6
- type RatingGroupItemContextProps,
7
- type RatingGroupItemProps,
8
- type RatingGroupLabelProps,
9
- type RatingGroupRootProps,
10
- } from '@ark-ui/react/rating-group'
11
- import { cx } from '@cerberus/styled-system/css'
12
- import {
13
- ratingGroup,
14
- type RatingGroupVariantProps,
15
- } from '@cerberus/styled-system/recipes'
16
-
17
- /**
18
- * This module contains the primitives of the Rating component.
19
- * @module 'rating/primitives'
20
- */
21
-
22
- /**
23
- * The root primitive of the Rating component.
24
- */
25
- export function RatingRoot(
26
- props: RatingGroupRootProps & RatingGroupVariantProps,
27
- ) {
28
- const { orientation, size, ...rootProps } = props
29
- const styles = ratingGroup({ orientation, size })
30
- return (
31
- <RatingGroup.Root
32
- {...rootProps}
33
- className={cx(styles.root, rootProps.className)}
34
- />
35
- )
36
- }
37
-
38
- /**
39
- * The label primitive of the Rating component.
40
- */
41
- export function RatingLabel(props: RatingGroupLabelProps) {
42
- const styles = ratingGroup()
43
- return (
44
- <RatingGroup.Label
45
- {...props}
46
- className={cx(styles.label, props.className)}
47
- />
48
- )
49
- }
50
-
51
- /**
52
- * The control primitive of the Rating component.
53
- */
54
- export function RatingControl(props: RatingGroupControlProps) {
55
- const styles = ratingGroup()
56
- return (
57
- <RatingGroup.Control
58
- {...props}
59
- className={cx(styles.control, props.className)}
60
- />
61
- )
62
- }
63
-
64
- /**
65
- * The context primitive of the Rating component.
66
- */
67
- export function RatingContext(props: RatingGroupContextProps) {
68
- return <RatingGroup.Context {...props} />
69
- }
70
-
71
- /**
72
- * The item primitive of the Rating component.
73
- */
74
- export function RatingItem(
75
- props: RatingGroupItemProps & RatingGroupVariantProps,
76
- ) {
77
- const { palette, ...itemProps } = props
78
- const styles = ratingGroup({ palette })
79
- return (
80
- <RatingGroup.Item
81
- {...itemProps}
82
- className={cx(styles.item, itemProps.className)}
83
- />
84
- )
85
- }
86
-
87
- /**
88
- * The item context primitive of the Rating component.
89
- */
90
- export function RatingItemContext(props: RatingGroupItemContextProps) {
91
- return <RatingGroup.ItemContext {...props} />
92
- }
93
-
94
- /**
95
- * The hidden input primitive of the Rating component.
96
- */
97
- export function RatingHiddenInput(props: RatingGroupHiddenInputProps) {
98
- return <RatingGroup.HiddenInput {...props} />
99
- }
@@ -1,78 +0,0 @@
1
- import type {
2
- RatingGroupRootProps,
3
- UseRatingGroupContext,
4
- UseRatingGroupItemContext,
5
- } from '@ark-ui/react/rating-group'
6
- import type { RatingGroupVariantProps } from '@cerberus/styled-system/recipes'
7
- import type { ReactNode } from 'react'
8
- import { splitProps } from '../../utils/index'
9
- import { Show } from '../Show'
10
- import { RatingParts } from './parts'
11
-
12
- /**
13
- * This module contains the abstracted Rating component.
14
- * @module 'react/rating'
15
- */
16
-
17
- export interface RatingProps
18
- extends Omit<RatingGroupRootProps, 'children'>,
19
- RatingGroupVariantProps {
20
- /**
21
- * The label of the rating component.
22
- */
23
- label?: string
24
- /**
25
- * The children of the rating component.
26
- */
27
- children: (context: UseRatingGroupItemContext) => ReactNode
28
- }
29
-
30
- /**
31
- * The Rating component is an abstraction of the primitives which provides a
32
- * visual rating system for a user to select a value.
33
- * @description [Cerberus Docs](https://cerberus.digitalu.design/react/rating)
34
- * @description [Ark Docs](https://ark-ui.com/react/docs/components/rating-group#api-reference)
35
- * @example
36
- * ```tsx
37
- * <Rating count={5} defaultValue={3} allowHalf>
38
- * {({ half, highlighted }) => {
39
- * if (half) return <StarHalfIcon fill="current" />
40
- * if (highlighted) return <StarIcon fill="current" />
41
- * return <StarIcon />
42
- * }}
43
- * </Rating>
44
- * ```
45
- */
46
- export function Rating(props: RatingProps) {
47
- const [{ label }, styleProps, rootProps] = splitProps(
48
- props,
49
- ['label'],
50
- ['orientation', 'palette', 'size'],
51
- )
52
-
53
- return (
54
- <RatingParts.Root {...styleProps} {...rootProps}>
55
- <Show when={Boolean(label)}>
56
- <RatingParts.Label>{label}</RatingParts.Label>
57
- </Show>
58
-
59
- <RatingParts.Control>
60
- <RatingParts.Context>
61
- {(context: UseRatingGroupContext) =>
62
- context.items.map((item) => (
63
- <RatingParts.Item
64
- key={item}
65
- index={item}
66
- palette={styleProps.palette}
67
- >
68
- <RatingParts.ItemContext>
69
- {rootProps.children}
70
- </RatingParts.ItemContext>
71
- </RatingParts.Item>
72
- ))
73
- }
74
- </RatingParts.Context>
75
- </RatingParts.Control>
76
- </RatingParts.Root>
77
- )
78
- }