@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.
- package/build/legacy/_tsup-dts-rollup.d.cts +27 -248
- package/build/legacy/components/checkbox/checkbox.cjs.map +1 -1
- package/build/legacy/components/checkbox/index.cjs.map +1 -1
- package/build/legacy/components/for.cjs +4 -3
- package/build/legacy/components/for.cjs.map +1 -1
- package/build/legacy/{components/cta-dialog/provider.cjs → context/cta-modal.cjs} +150 -187
- package/build/legacy/context/cta-modal.cjs.map +1 -0
- package/build/legacy/index.cjs +720 -884
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +27 -248
- package/build/modern/{chunk-O542MPR7.js → chunk-CMYD5KWA.js} +4 -4
- package/build/modern/{chunk-H5WNUPGH.js → chunk-FMRWRVUS.js} +7 -7
- package/build/modern/chunk-IIH363FO.js +13 -0
- package/build/modern/chunk-IIH363FO.js.map +1 -0
- package/build/modern/{chunk-6ICNCCPD.js → chunk-P3SF56LT.js} +4 -4
- package/build/modern/{chunk-UNRQAXLJ.js → chunk-Y4ZEJ2EF.js} +1 -1
- package/build/modern/chunk-Y4ZEJ2EF.js.map +1 -0
- package/build/modern/{chunk-QEM3M4N3.js → chunk-ZDANBCM3.js} +31 -22
- package/build/modern/chunk-ZDANBCM3.js.map +1 -0
- package/build/modern/components/checkbox/checkbox.js +1 -1
- package/build/modern/components/checkbox/index.js +1 -1
- package/build/modern/components/for.js +1 -1
- package/build/modern/components/select/index.js +2 -2
- package/build/modern/components/select/select.js +2 -2
- package/build/modern/context/cta-modal.js +19 -0
- package/build/modern/context/notification-center.js +3 -3
- package/build/modern/context/prompt-modal.js +2 -2
- package/build/modern/index.js +92 -124
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/checkbox/checkbox.tsx +2 -2
- package/src/components/for.tsx +18 -13
- package/src/{components/cta-dialog/provider.tsx → context/cta-modal.tsx} +68 -34
- package/src/index.ts +1 -2
- package/build/legacy/components/cta-dialog/context.cjs +0 -33
- package/build/legacy/components/cta-dialog/context.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/index.cjs +0 -433
- package/build/legacy/components/cta-dialog/index.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/provider.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/trigger-item.cjs +0 -99
- package/build/legacy/components/cta-dialog/trigger-item.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/utils.cjs +0 -47
- package/build/legacy/components/cta-dialog/utils.cjs.map +0 -1
- package/build/legacy/components/rating/index.cjs +0 -167
- package/build/legacy/components/rating/index.cjs.map +0 -1
- package/build/legacy/components/rating/parts.cjs +0 -98
- package/build/legacy/components/rating/parts.cjs.map +0 -1
- package/build/legacy/components/rating/primitives.cjs +0 -97
- package/build/legacy/components/rating/primitives.cjs.map +0 -1
- package/build/legacy/components/rating/rating.cjs +0 -151
- package/build/legacy/components/rating/rating.cjs.map +0 -1
- package/build/modern/chunk-4LSTU6WU.js +0 -8
- package/build/modern/chunk-4LSTU6WU.js.map +0 -1
- package/build/modern/chunk-DXOKSZVQ.js +0 -12
- package/build/modern/chunk-DXOKSZVQ.js.map +0 -1
- package/build/modern/chunk-IKDXADLX.js +0 -1
- package/build/modern/chunk-MVO2GNUA.js +0 -47
- package/build/modern/chunk-MVO2GNUA.js.map +0 -1
- package/build/modern/chunk-OS73F4SR.js +0 -25
- package/build/modern/chunk-OS73F4SR.js.map +0 -1
- package/build/modern/chunk-PLHYOCY3.js +0 -23
- package/build/modern/chunk-PLHYOCY3.js.map +0 -1
- package/build/modern/chunk-QEM3M4N3.js.map +0 -1
- package/build/modern/chunk-QQCB6JXW.js +0 -36
- package/build/modern/chunk-QQCB6JXW.js.map +0 -1
- package/build/modern/chunk-UNRQAXLJ.js.map +0 -1
- package/build/modern/chunk-W47QEZD5.js +0 -71
- package/build/modern/chunk-W47QEZD5.js.map +0 -1
- package/build/modern/chunk-ZOSGUATV.js +0 -1
- package/build/modern/chunk-ZOSGUATV.js.map +0 -1
- package/build/modern/components/cta-dialog/context.js +0 -8
- package/build/modern/components/cta-dialog/context.js.map +0 -1
- package/build/modern/components/cta-dialog/index.js +0 -26
- package/build/modern/components/cta-dialog/index.js.map +0 -1
- package/build/modern/components/cta-dialog/provider.js +0 -22
- package/build/modern/components/cta-dialog/provider.js.map +0 -1
- package/build/modern/components/cta-dialog/trigger-item.js +0 -10
- package/build/modern/components/cta-dialog/trigger-item.js.map +0 -1
- package/build/modern/components/cta-dialog/utils.js +0 -7
- package/build/modern/components/cta-dialog/utils.js.map +0 -1
- package/build/modern/components/rating/index.js +0 -31
- package/build/modern/components/rating/index.js.map +0 -1
- package/build/modern/components/rating/parts.js +0 -8
- package/build/modern/components/rating/parts.js.map +0 -1
- package/build/modern/components/rating/primitives.js +0 -19
- package/build/modern/components/rating/primitives.js.map +0 -1
- package/build/modern/components/rating/rating.js +0 -12
- package/build/modern/components/rating/rating.js.map +0 -1
- package/src/components/cta-dialog/context.tsx +0 -34
- package/src/components/cta-dialog/index.ts +0 -2
- package/src/components/cta-dialog/trigger-item.tsx +0 -53
- package/src/components/cta-dialog/utils.ts +0 -57
- package/src/components/rating/index.ts +0 -8
- package/src/components/rating/parts.tsx +0 -65
- package/src/components/rating/primitives.tsx +0 -99
- package/src/components/rating/rating.tsx +0 -78
- /package/build/modern/{chunk-O542MPR7.js.map → chunk-CMYD5KWA.js.map} +0 -0
- /package/build/modern/{chunk-H5WNUPGH.js.map → chunk-FMRWRVUS.js.map} +0 -0
- /package/build/modern/{chunk-6ICNCCPD.js.map → chunk-P3SF56LT.js.map} +0 -0
- /package/build/modern/{chunk-IKDXADLX.js.map → context/cta-modal.js.map} +0 -0
|
@@ -103,7 +103,6 @@ import { HtmlHTMLAttributes } from 'react';
|
|
|
103
103
|
import { IconButtonVariantProps } from '@cerberus/styled-system/recipes';
|
|
104
104
|
import { InputHTMLAttributes } from 'react';
|
|
105
105
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
106
|
-
import type { JSX as JSX_3 } from 'react';
|
|
107
106
|
import { KeyboardCode } from '@dnd-kit/core';
|
|
108
107
|
import { KeyboardCodes } from '@dnd-kit/core';
|
|
109
108
|
import { KeyboardCoordinateGetter } from '@dnd-kit/core';
|
|
@@ -120,7 +119,7 @@ import { Menu as Menu_2 } from '@ark-ui/react';
|
|
|
120
119
|
import { Modifier } from '@dnd-kit/core';
|
|
121
120
|
import { Modifiers } from '@dnd-kit/core';
|
|
122
121
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
123
|
-
import
|
|
122
|
+
import { MouseEventHandler } from 'react';
|
|
124
123
|
import { MouseSensor } from '@dnd-kit/core';
|
|
125
124
|
import { MouseSensorOptions } from '@dnd-kit/core';
|
|
126
125
|
import { NotificationVariantProps } from '@cerberus/styled-system/recipes';
|
|
@@ -145,14 +144,6 @@ import { RadioGroupItemTextProps } from '@ark-ui/react/radio-group';
|
|
|
145
144
|
import { RadioGroupLabelProps } from '@ark-ui/react/radio-group';
|
|
146
145
|
import { RadioGroupRootProps } from '@ark-ui/react/radio-group';
|
|
147
146
|
import { RadioGroupVariantProps } from '@cerberus/styled-system/recipes';
|
|
148
|
-
import { RatingGroupContextProps } from '@ark-ui/react/rating-group';
|
|
149
|
-
import { RatingGroupControlProps } from '@ark-ui/react/rating-group';
|
|
150
|
-
import { RatingGroupHiddenInputProps } from '@ark-ui/react/rating-group';
|
|
151
|
-
import { RatingGroupItemContextProps } from '@ark-ui/react/rating-group';
|
|
152
|
-
import { RatingGroupItemProps } from '@ark-ui/react/rating-group';
|
|
153
|
-
import { RatingGroupLabelProps } from '@ark-ui/react/rating-group';
|
|
154
|
-
import { RatingGroupRootProps } from '@ark-ui/react/rating-group';
|
|
155
|
-
import { RatingGroupVariantProps } from '@cerberus/styled-system/recipes';
|
|
156
147
|
import { ReactNode } from 'react';
|
|
157
148
|
import { rectIntersection } from '@dnd-kit/core';
|
|
158
149
|
import { RefAttributes } from 'react';
|
|
@@ -212,8 +203,6 @@ import { useDraggable } from '@dnd-kit/core';
|
|
|
212
203
|
import { UseDraggableArguments } from '@dnd-kit/core';
|
|
213
204
|
import { useDroppable } from '@dnd-kit/core';
|
|
214
205
|
import { UseDroppableArguments } from '@dnd-kit/core';
|
|
215
|
-
import { UseRatingGroupContext } from '@ark-ui/react/rating-group';
|
|
216
|
-
import { UseRatingGroupItemContext } from '@ark-ui/react/rating-group';
|
|
217
206
|
import { useSensor } from '@dnd-kit/core';
|
|
218
207
|
import { useSensors } from '@dnd-kit/core';
|
|
219
208
|
|
|
@@ -655,8 +644,8 @@ declare interface CerberusProviderProps {
|
|
|
655
644
|
/**
|
|
656
645
|
* Checkbox component is an abstraction of the primitives that displays a
|
|
657
646
|
* controlled checkbox with a label.
|
|
658
|
-
* @description [Cerberus Docs]
|
|
659
|
-
* @description [Ark Docs]
|
|
647
|
+
* @description [Cerberus Docs] https://cerberus.digitalu.design/react/checkbox
|
|
648
|
+
* @description [Ark Docs] https://ark-ui.com/docs/components/checkbox
|
|
660
649
|
*/
|
|
661
650
|
declare function Checkbox(props: CheckboxProps): JSX_2.Element;
|
|
662
651
|
export { Checkbox }
|
|
@@ -961,14 +950,6 @@ declare interface ConfirmModalValue {
|
|
|
961
950
|
export { ConfirmModalValue }
|
|
962
951
|
export { ConfirmModalValue as ConfirmModalValue_alias_1 }
|
|
963
952
|
|
|
964
|
-
/**
|
|
965
|
-
* Creates the action data to pass to the cta modal `show` method.
|
|
966
|
-
*/
|
|
967
|
-
declare function createCTAModalActions(providedActions: CTAModalAction): CTAModalActionReturn;
|
|
968
|
-
export { createCTAModalActions }
|
|
969
|
-
export { createCTAModalActions as createCTAModalActions_alias_1 }
|
|
970
|
-
export { createCTAModalActions as createCTAModalActions_alias_2 }
|
|
971
|
-
|
|
972
953
|
declare function createNavTriggerProps(values: NavTriggerAriaValues): NavTriggerAriaReturn;
|
|
973
954
|
export { createNavTriggerProps }
|
|
974
955
|
export { createNavTriggerProps as createNavTriggerProps_alias_1 }
|
|
@@ -986,28 +967,6 @@ export { createSelectCollection }
|
|
|
986
967
|
export { createSelectCollection as createSelectCollection_alias_1 }
|
|
987
968
|
export { createSelectCollection as createSelectCollection_alias_2 }
|
|
988
969
|
|
|
989
|
-
/**
|
|
990
|
-
* This module provide utility functions for the cta modal.
|
|
991
|
-
* @module 'react/cta-modal/utils'
|
|
992
|
-
*/
|
|
993
|
-
declare type CTAButtonAction = {
|
|
994
|
-
/**
|
|
995
|
-
* The text of the button.
|
|
996
|
-
*/
|
|
997
|
-
text: string;
|
|
998
|
-
/**
|
|
999
|
-
* The onClick handler for the button.
|
|
1000
|
-
*/
|
|
1001
|
-
handleClick: MouseEventHandler<HTMLButtonElement>;
|
|
1002
|
-
};
|
|
1003
|
-
export { CTAButtonAction }
|
|
1004
|
-
export { CTAButtonAction as CTAButtonAction_alias_1 }
|
|
1005
|
-
export { CTAButtonAction as CTAButtonAction_alias_2 }
|
|
1006
|
-
|
|
1007
|
-
/**
|
|
1008
|
-
* This module provides the provider and hook for the cta modal.
|
|
1009
|
-
* @module 'react/cta-modal/provider'
|
|
1010
|
-
*/
|
|
1011
970
|
/**
|
|
1012
971
|
* Provides a CTA modal to the app.
|
|
1013
972
|
* @see https://cerberus.digitalu.design/react/cta-modal
|
|
@@ -1040,35 +999,19 @@ export { CTAButtonAction as CTAButtonAction_alias_2 }
|
|
|
1040
999
|
* }, [cta])
|
|
1041
1000
|
* ```
|
|
1042
1001
|
*/
|
|
1043
|
-
declare function CTAModal(props: PropsWithChildren<
|
|
1002
|
+
declare function CTAModal(props: PropsWithChildren<CTAModalProviderProps>): JSX_2.Element;
|
|
1044
1003
|
export { CTAModal }
|
|
1045
1004
|
export { CTAModal as CTAModal_alias_1 }
|
|
1046
|
-
export { CTAModal as CTAModal_alias_2 }
|
|
1047
1005
|
|
|
1048
|
-
declare type
|
|
1049
|
-
export {
|
|
1050
|
-
export {
|
|
1051
|
-
export { CTAModalAction as CTAModalAction_alias_2 }
|
|
1006
|
+
declare type CTAModalProviderProps = PropsWithChildren<unknown>;
|
|
1007
|
+
export { CTAModalProviderProps }
|
|
1008
|
+
export { CTAModalProviderProps as CTAModalProviderProps_alias_1 }
|
|
1052
1009
|
|
|
1053
|
-
declare interface
|
|
1054
|
-
/**
|
|
1055
|
-
* The type of the action content.
|
|
1056
|
-
*/
|
|
1057
|
-
type: 'reactNode' | 'btnAction';
|
|
1058
|
-
/**
|
|
1059
|
-
* The actions for the cta modal. Max of 2 actions.
|
|
1060
|
-
*/
|
|
1061
|
-
_actions: CTAModalAction;
|
|
1062
|
-
}
|
|
1063
|
-
export { CTAModalActionReturn }
|
|
1064
|
-
export { CTAModalActionReturn as CTAModalActionReturn_alias_1 }
|
|
1065
|
-
export { CTAModalActionReturn as CTAModalActionReturn_alias_2 }
|
|
1066
|
-
|
|
1067
|
-
export declare const CTAModalContext: Context<CTAModalValue | null>;
|
|
1068
|
-
|
|
1069
|
-
export declare interface CTAModalValue {
|
|
1010
|
+
declare interface CTAModalValue {
|
|
1070
1011
|
show: (options: ShowCTAModalOptions) => void;
|
|
1071
1012
|
}
|
|
1013
|
+
export { CTAModalValue }
|
|
1014
|
+
export { CTAModalValue as CTAModalValue_alias_1 }
|
|
1072
1015
|
|
|
1073
1016
|
declare type CustomThemes<K extends string = DefaultThemes> = 'cerberus' | K;
|
|
1074
1017
|
export { CustomThemes }
|
|
@@ -2282,7 +2225,7 @@ export { FileUploaderProps as FileUploaderProps_alias_1 }
|
|
|
2282
2225
|
* </For>
|
|
2283
2226
|
* ```
|
|
2284
2227
|
*/
|
|
2285
|
-
declare function For<T extends
|
|
2228
|
+
declare function For<T extends string | number | Record<string, unknown> | object | undefined>(props: ForProps<T>): ReactNode;
|
|
2286
2229
|
export { For }
|
|
2287
2230
|
export { For as For_alias_1 }
|
|
2288
2231
|
|
|
@@ -2331,19 +2274,19 @@ declare function formatNotifyCount(count: number): string;
|
|
|
2331
2274
|
export { formatNotifyCount }
|
|
2332
2275
|
export { formatNotifyCount as formatNotifyCount_alias_1 }
|
|
2333
2276
|
|
|
2334
|
-
declare interface ForProps<T
|
|
2277
|
+
declare interface ForProps<T> {
|
|
2335
2278
|
/**
|
|
2336
|
-
* The array to iterate over
|
|
2279
|
+
* The array to iterate over
|
|
2337
2280
|
*/
|
|
2338
|
-
each: T
|
|
2281
|
+
each: T[];
|
|
2339
2282
|
/**
|
|
2340
|
-
* The fallback to render when the array is empty
|
|
2283
|
+
* The fallback content to render when the array is empty
|
|
2341
2284
|
*/
|
|
2342
|
-
fallback?:
|
|
2285
|
+
fallback?: ReactNode;
|
|
2343
2286
|
/**
|
|
2344
|
-
* The
|
|
2287
|
+
* The render function to render each item in the array
|
|
2345
2288
|
*/
|
|
2346
|
-
children: (item: T
|
|
2289
|
+
children: (item: Exclude<T, undefined>, index: number) => ReactNode;
|
|
2347
2290
|
}
|
|
2348
2291
|
export { ForProps }
|
|
2349
2292
|
export { ForProps as ForProps_alias_1 }
|
|
@@ -3498,154 +3441,6 @@ declare interface RangePickerInputProps extends Omit<DatePickerInputProps, 'defa
|
|
|
3498
3441
|
export { RangePickerInputProps }
|
|
3499
3442
|
export { RangePickerInputProps as RangePickerInputProps_alias_1 }
|
|
3500
3443
|
|
|
3501
|
-
/**
|
|
3502
|
-
* The Rating component is an abstraction of the primitives which provides a
|
|
3503
|
-
* visual rating system for a user to select a value.
|
|
3504
|
-
* @description [Cerberus Docs](https://cerberus.digitalu.design/react/rating)
|
|
3505
|
-
* @description [Ark Docs](https://ark-ui.com/react/docs/components/rating-group#api-reference)
|
|
3506
|
-
* @example
|
|
3507
|
-
* ```tsx
|
|
3508
|
-
* <Rating count={5} defaultValue={3} allowHalf>
|
|
3509
|
-
* {({ half, highlighted }) => {
|
|
3510
|
-
* if (half) return <StarHalfIcon fill="current" />
|
|
3511
|
-
* if (highlighted) return <StarIcon fill="current" />
|
|
3512
|
-
* return <StarIcon />
|
|
3513
|
-
* }}
|
|
3514
|
-
* </Rating>
|
|
3515
|
-
* ```
|
|
3516
|
-
*/
|
|
3517
|
-
declare function Rating(props: RatingProps): JSX_2.Element;
|
|
3518
|
-
export { Rating }
|
|
3519
|
-
export { Rating as Rating_alias_1 }
|
|
3520
|
-
export { Rating as Rating_alias_2 }
|
|
3521
|
-
|
|
3522
|
-
/**
|
|
3523
|
-
* The context primitive of the Rating component.
|
|
3524
|
-
*/
|
|
3525
|
-
declare function RatingContext(props: RatingGroupContextProps): JSX_2.Element;
|
|
3526
|
-
export { RatingContext }
|
|
3527
|
-
export { RatingContext as RatingContext_alias_1 }
|
|
3528
|
-
export { RatingContext as RatingContext_alias_2 }
|
|
3529
|
-
|
|
3530
|
-
/**
|
|
3531
|
-
* The control primitive of the Rating component.
|
|
3532
|
-
*/
|
|
3533
|
-
declare function RatingControl(props: RatingGroupControlProps): JSX_2.Element;
|
|
3534
|
-
export { RatingControl }
|
|
3535
|
-
export { RatingControl as RatingControl_alias_1 }
|
|
3536
|
-
export { RatingControl as RatingControl_alias_2 }
|
|
3537
|
-
|
|
3538
|
-
/**
|
|
3539
|
-
* The hidden input primitive of the Rating component.
|
|
3540
|
-
*/
|
|
3541
|
-
declare function RatingHiddenInput(props: RatingGroupHiddenInputProps): JSX_2.Element;
|
|
3542
|
-
export { RatingHiddenInput }
|
|
3543
|
-
export { RatingHiddenInput as RatingHiddenInput_alias_1 }
|
|
3544
|
-
export { RatingHiddenInput as RatingHiddenInput_alias_2 }
|
|
3545
|
-
|
|
3546
|
-
/**
|
|
3547
|
-
* The item primitive of the Rating component.
|
|
3548
|
-
*/
|
|
3549
|
-
declare function RatingItem(props: RatingGroupItemProps & RatingGroupVariantProps): JSX_2.Element;
|
|
3550
|
-
export { RatingItem }
|
|
3551
|
-
export { RatingItem as RatingItem_alias_1 }
|
|
3552
|
-
export { RatingItem as RatingItem_alias_2 }
|
|
3553
|
-
|
|
3554
|
-
/**
|
|
3555
|
-
* The item context primitive of the Rating component.
|
|
3556
|
-
*/
|
|
3557
|
-
declare function RatingItemContext(props: RatingGroupItemContextProps): JSX_2.Element;
|
|
3558
|
-
export { RatingItemContext }
|
|
3559
|
-
export { RatingItemContext as RatingItemContext_alias_1 }
|
|
3560
|
-
export { RatingItemContext as RatingItemContext_alias_2 }
|
|
3561
|
-
|
|
3562
|
-
/**
|
|
3563
|
-
* The label primitive of the Rating component.
|
|
3564
|
-
*/
|
|
3565
|
-
declare function RatingLabel(props: RatingGroupLabelProps): JSX_2.Element;
|
|
3566
|
-
export { RatingLabel }
|
|
3567
|
-
export { RatingLabel as RatingLabel_alias_1 }
|
|
3568
|
-
export { RatingLabel as RatingLabel_alias_2 }
|
|
3569
|
-
|
|
3570
|
-
/**
|
|
3571
|
-
* An Object containing the parts of the Rating component. For users that
|
|
3572
|
-
* prefer Object component syntax.
|
|
3573
|
-
*
|
|
3574
|
-
* @remarks
|
|
3575
|
-
*
|
|
3576
|
-
* When using object component syntax, you import the RatingParts object and
|
|
3577
|
-
* the entire family of components vs. only what you use.
|
|
3578
|
-
*/
|
|
3579
|
-
declare const RatingParts: RatingPartsValue;
|
|
3580
|
-
export { RatingParts }
|
|
3581
|
-
export { RatingParts as RatingParts_alias_1 }
|
|
3582
|
-
export { RatingParts as RatingParts_alias_2 }
|
|
3583
|
-
|
|
3584
|
-
/**
|
|
3585
|
-
* This module contains the parts of the Rating component.
|
|
3586
|
-
* @module 'rating/parts'
|
|
3587
|
-
*/
|
|
3588
|
-
declare interface RatingPartsValue {
|
|
3589
|
-
/**
|
|
3590
|
-
* The container of the rating.
|
|
3591
|
-
*/
|
|
3592
|
-
Root: ElementType;
|
|
3593
|
-
/**
|
|
3594
|
-
* The label of the rating.
|
|
3595
|
-
*/
|
|
3596
|
-
Label: ElementType;
|
|
3597
|
-
/**
|
|
3598
|
-
* The visual representation of the rating.
|
|
3599
|
-
*/
|
|
3600
|
-
Control: ElementType;
|
|
3601
|
-
/**
|
|
3602
|
-
* The context of the rating.
|
|
3603
|
-
*/
|
|
3604
|
-
Context: ElementType;
|
|
3605
|
-
/**
|
|
3606
|
-
* The item to display for the rating.
|
|
3607
|
-
*/
|
|
3608
|
-
Item: ElementType;
|
|
3609
|
-
/**
|
|
3610
|
-
* The context provider for the rating items.
|
|
3611
|
-
*/
|
|
3612
|
-
ItemContext: ElementType;
|
|
3613
|
-
/**
|
|
3614
|
-
* The native input of the rating.
|
|
3615
|
-
*/
|
|
3616
|
-
HiddenInput: ElementType;
|
|
3617
|
-
}
|
|
3618
|
-
|
|
3619
|
-
/**
|
|
3620
|
-
* This module contains the abstracted Rating component.
|
|
3621
|
-
* @module 'react/rating'
|
|
3622
|
-
*/
|
|
3623
|
-
declare interface RatingProps extends Omit<RatingGroupRootProps, 'children'>, RatingGroupVariantProps {
|
|
3624
|
-
/**
|
|
3625
|
-
* The label of the rating component.
|
|
3626
|
-
*/
|
|
3627
|
-
label?: string;
|
|
3628
|
-
/**
|
|
3629
|
-
* The children of the rating component.
|
|
3630
|
-
*/
|
|
3631
|
-
children: (context: UseRatingGroupItemContext) => ReactNode;
|
|
3632
|
-
}
|
|
3633
|
-
export { RatingProps }
|
|
3634
|
-
export { RatingProps as RatingProps_alias_1 }
|
|
3635
|
-
export { RatingProps as RatingProps_alias_2 }
|
|
3636
|
-
|
|
3637
|
-
/**
|
|
3638
|
-
* This module contains the primitives of the Rating component.
|
|
3639
|
-
* @module 'rating/primitives'
|
|
3640
|
-
*/
|
|
3641
|
-
/**
|
|
3642
|
-
* The root primitive of the Rating component.
|
|
3643
|
-
*/
|
|
3644
|
-
declare function RatingRoot(props: RatingGroupRootProps & RatingGroupVariantProps): JSX_2.Element;
|
|
3645
|
-
export { RatingRoot }
|
|
3646
|
-
export { RatingRoot as RatingRoot_alias_1 }
|
|
3647
|
-
export { RatingRoot as RatingRoot_alias_2 }
|
|
3648
|
-
|
|
3649
3444
|
export { rectIntersection }
|
|
3650
3445
|
|
|
3651
3446
|
/**
|
|
@@ -4031,10 +3826,10 @@ export { ShowConfirmModalOptions }
|
|
|
4031
3826
|
export { ShowConfirmModalOptions as ShowConfirmModalOptions_alias_1 }
|
|
4032
3827
|
|
|
4033
3828
|
/**
|
|
4034
|
-
* This module provides
|
|
3829
|
+
* This module provides a context and hook for the cta modal.
|
|
4035
3830
|
* @module
|
|
4036
3831
|
*/
|
|
4037
|
-
|
|
3832
|
+
declare interface ShowCTAModalOptions {
|
|
4038
3833
|
/**
|
|
4039
3834
|
* The heading of the cta modal.
|
|
4040
3835
|
*/
|
|
@@ -4048,10 +3843,15 @@ export declare interface ShowCTAModalOptions {
|
|
|
4048
3843
|
*/
|
|
4049
3844
|
icon?: ReactNode;
|
|
4050
3845
|
/**
|
|
4051
|
-
* The actions for the cta modal.
|
|
3846
|
+
* The actions for the cta modal. Max of 2 actions.
|
|
4052
3847
|
*/
|
|
4053
|
-
actions:
|
|
3848
|
+
actions: {
|
|
3849
|
+
text: string;
|
|
3850
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
3851
|
+
}[];
|
|
4054
3852
|
}
|
|
3853
|
+
export { ShowCTAModalOptions }
|
|
3854
|
+
export { ShowCTAModalOptions as ShowCTAModalOptions_alias_1 }
|
|
4055
3855
|
|
|
4056
3856
|
/**
|
|
4057
3857
|
* This module provides a context and hook for the prompt modal.
|
|
@@ -4789,20 +4589,6 @@ export { trapFocus as trapFocus_alias_1 }
|
|
|
4789
4589
|
|
|
4790
4590
|
export { TraversalOrder }
|
|
4791
4591
|
|
|
4792
|
-
/**
|
|
4793
|
-
* Trigger item for the cta modal which renders content based on the actions.
|
|
4794
|
-
* type.
|
|
4795
|
-
*/
|
|
4796
|
-
export declare function TriggerItem(props: TriggerItemProps): JSX_2.Element;
|
|
4797
|
-
|
|
4798
|
-
/**
|
|
4799
|
-
* This module provides the trigger item for the cta modal.
|
|
4800
|
-
* @module 'react/cta-modal/trigger-item'
|
|
4801
|
-
*/
|
|
4802
|
-
export declare interface TriggerItemProps extends ButtonProps {
|
|
4803
|
-
asChild?: boolean;
|
|
4804
|
-
}
|
|
4805
|
-
|
|
4806
4592
|
declare type TrProps = TableHTMLAttributes<HTMLTableRowElement>;
|
|
4807
4593
|
export { TrProps }
|
|
4808
4594
|
export { TrProps as TrProps_alias_1 }
|
|
@@ -4838,7 +4624,6 @@ export { useConfirmModal as useConfirmModal_alias_1 }
|
|
|
4838
4624
|
declare function useCTAModal(): CTAModalValue;
|
|
4839
4625
|
export { useCTAModal }
|
|
4840
4626
|
export { useCTAModal as useCTAModal_alias_1 }
|
|
4841
|
-
export { useCTAModal as useCTAModal_alias_2 }
|
|
4842
4627
|
|
|
4843
4628
|
/**
|
|
4844
4629
|
* @deprecated use the DatePicker family instead
|
|
@@ -4982,12 +4767,6 @@ declare function usePromptModal(): PromptModalValue;
|
|
|
4982
4767
|
export { usePromptModal }
|
|
4983
4768
|
export { usePromptModal as usePromptModal_alias_1 }
|
|
4984
4769
|
|
|
4985
|
-
export { UseRatingGroupContext }
|
|
4986
|
-
export { UseRatingGroupContext as UseRatingGroupContext_alias_1 }
|
|
4987
|
-
|
|
4988
|
-
export { UseRatingGroupItemContext }
|
|
4989
|
-
export { UseRatingGroupItemContext as UseRatingGroupItemContext_alias_1 }
|
|
4990
|
-
|
|
4991
4770
|
/**
|
|
4992
4771
|
* This hook returns a record of Cerberus colors from the document root.
|
|
4993
4772
|
* This is useful when you are working with a component that uses the `<canvas>`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/checkbox/checkbox.tsx","../../../../src/components/Show.tsx","../../../../src/components/Text.tsx","../../../../src/components/checkbox/primitives.tsx","../../../../src/components/checkbox/parts.ts","../../../../src/context/cerberus.tsx","../../../../src/components/checkbox/checkbox-icon.tsx"],"sourcesContent":["import type { CheckboxRootProps } from '@ark-ui/react'\nimport { type CheckboxVariantProps } from '@cerberus/styled-system/recipes'\nimport { Show } from '../Show'\nimport { Text } from '../Text'\nimport { CheckboxParts } from './parts'\nimport { CheckboxIcon } from './checkbox-icon'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps & CheckboxRootProps\n\n/**\n * Checkbox component is an abstraction of the primitives that displays a\n * controlled checkbox with a label.\n * @description [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @description [Ark Docs](https://ark-ui.com/docs/components/checkbox)\n */\nexport function Checkbox(props: CheckboxProps) {\n const { size, children, ...rootProps } = props\n\n return (\n <CheckboxParts.Root {...rootProps}>\n <CheckboxParts.Control size={size}>\n <CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />\n </CheckboxParts.Control>\n\n <CheckboxParts.Label size={size}>\n {children}\n <Show when={props.required}>\n <Text as=\"span\" data-part=\"required-indicator\">\n (required)\n </Text>\n </Show>\n </CheckboxParts.Label>\n\n <CheckboxParts.HiddenInput />\n </CheckboxParts.Root>\n )\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","import {\n Em,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n P,\n Small,\n Span,\n Strong,\n type PProps,\n} from '@cerberus/styled-system/jsx'\nimport { type HTMLAttributes, type PropsWithChildren } from 'react'\n\n/**\n * This module exports a component for rendering text utilizing the styled-system JSX utility.\n * @module @cerberus/react/Text\n */\n\nexport type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'\n\n// For some reason we have to use the HTMLParagraphElement type here\n// or else TS will fail for non-style props like 'id' or 'className'\nexport interface TextProps\n extends PProps,\n HTMLAttributes<HTMLParagraphElement> {\n /**\n * The element to render as. Defaults to 'p'.\n */\n as?: TextElements | Headings\n}\n\n/**\n * A component for rendering text utilizing the styled-system JSX utility.\n * @definition [Text docs](https://cerberus.digitalu.design/react/text)\n * @example\n * ```tsx\n * <Text as=\"h1\" color=\"page.text.100\" textStyle={{\n * base: 'heading-md',\n * md: 'heading-lg',\n * }}>\n * Hello, world!\n * </Text>\n */\nexport function Text(props: PropsWithChildren<TextProps>) {\n const { as = 'p', ...pandaJSXProps } = props\n switch (as) {\n case 'h1':\n return <H1 {...pandaJSXProps} />\n case 'h2':\n return <H2 {...pandaJSXProps} />\n case 'h3':\n return <H3 {...pandaJSXProps} />\n case 'h4':\n return <H4 {...pandaJSXProps} />\n case 'h5':\n return <H5 {...pandaJSXProps} />\n case 'h6':\n return <H6 {...pandaJSXProps} />\n case 'strong':\n return <Strong {...pandaJSXProps} />\n case 'em':\n return <Em {...pandaJSXProps} />\n case 'small':\n return <Small {...pandaJSXProps} />\n case 'span':\n return <Span {...pandaJSXProps} />\n default:\n return <P {...pandaJSXProps} />\n }\n}\n","import {\n Checkbox,\n type CheckboxControlProps,\n type CheckboxGroupProps,\n type CheckboxIndicatorProps,\n type CheckboxLabelProps,\n type CheckboxRootProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Checkbox primitives.\n * @module 'react/checkbox'\n */\n\n/**\n * Checkbox Root component used to provide the context to all other checkbox\n * primitives.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxRoot(props: CheckboxRootProps) {\n const styles = checkbox()\n return (\n <Checkbox.Root {...props} className={cx(styles.root, props.className)} />\n )\n}\n\n/**\n * Checkbox Label component used to display the label of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxLabel(\n props: CheckboxLabelProps & CheckboxVariantProps,\n) {\n const { size, ...labelProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Label\n {...labelProps}\n className={cx(styles.label, labelProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Control component used to display the control of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxControl(\n props: CheckboxControlProps & CheckboxVariantProps,\n) {\n const { size, ...controlProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Control\n {...controlProps}\n className={cx(styles.control, controlProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Indicator component used to display the indicator of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxIndicator(props: CheckboxIndicatorProps) {\n const styles = checkbox()\n return (\n <Checkbox.Indicator\n {...props}\n className={cx(styles.indicator, props.className)}\n />\n )\n}\n\n/**\n * Checkbox HiddenInput component used to provide the native checkbox input.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxHiddenInput(props: CheckboxControlProps) {\n return <Checkbox.HiddenInput {...props} />\n}\n\n/**\n * Checkbox Group is used to group checkboxes together in a consistently styled\n * way.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxGroup(props: CheckboxGroupProps) {\n const styles = checkbox()\n return (\n <Checkbox.Group {...props} className={cx(styles.group, props.className)} />\n )\n}\n","import type { ElementType } from 'react'\nimport {\n CheckboxRoot,\n CheckboxLabel,\n CheckboxControl,\n CheckboxIndicator,\n CheckboxHiddenInput,\n CheckboxGroup,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface CheckboxPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Label: ElementType\n /**\n * The control of the field.\n */\n Control: ElementType\n /**\n * The indicator of the field.\n */\n Indicator: ElementType\n /**\n * The hidden input of the field.\n */\n HiddenInput: ElementType\n /**\n * The checkbox group component.\n */\n Group: ElementType\n}\n\n/**\n * An Object containing the parts of the Checkbox component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the CheckboxParts object and\n * the entire family of components vs. only what you use.\n */\nexport const CheckboxParts: CheckboxPartsValue = {\n Root: CheckboxRoot,\n Label: CheckboxLabel,\n Control: CheckboxControl,\n Indicator: CheckboxIndicator,\n HiddenInput: CheckboxHiddenInput,\n Group: CheckboxGroup,\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","'use client'\n\nimport { useCerberusContext } from '../../context/cerberus'\nimport { CheckboxParts } from './parts'\nimport { Show } from '../Show'\n\n/**\n * This module contains the Checkbox Icon component.\n * @module\n */\n\ninterface CheckboxIconProps {\n indeterminate?: boolean\n}\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n const { icons } = useCerberusContext()\n const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons\n\n return (\n <CheckboxParts.Indicator indeterminate={props.indeterminate}>\n <Show when={props.indeterminate} fallback={<CheckIcon />}>\n <IndeterminateIcon />\n </Show>\n </CheckboxParts.Indicator>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA;AAAA;;;ACEA,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,sBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,sBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;ACtCA,iBAaO;AAsCM;AAJN,SAAS,KAAK,OAAqC;AACxD,QAAM,EAAE,KAAK,KAAK,GAAG,cAAc,IAAI;AACvC,UAAQ,IAAI;AAAA,IACV,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AA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GAAG,WACtB;AAAA,iDAAC,cAAc,SAAd,EAAsB,MACrB,uDAAC,gBAAa,eAAe,UAAU,YAAY,iBAAiB,GACtE;AAAA,IAEA,8CAAC,cAAc,OAAd,EAAoB,MAClB;AAAA;AAAA,MACD,6CAAC,QAAK,MAAM,MAAM,UAChB,uDAAC,QAAK,IAAG,QAAO,aAAU,sBAAqB,wBAE/C,GACF;AAAA,OACF;AAAA,IAEA,6CAAC,cAAc,aAAd,EAA0B;AAAA,KAC7B;AAEJ;","names":["Checkbox","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","Checkbox"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/checkbox/checkbox.tsx","../../../../src/components/Show.tsx","../../../../src/components/Text.tsx","../../../../src/components/checkbox/primitives.tsx","../../../../src/components/checkbox/parts.ts","../../../../src/context/cerberus.tsx","../../../../src/components/checkbox/checkbox-icon.tsx"],"sourcesContent":["import type { CheckboxRootProps } from '@ark-ui/react'\nimport { type CheckboxVariantProps } from '@cerberus/styled-system/recipes'\nimport { Show } from '../Show'\nimport { Text } from '../Text'\nimport { CheckboxParts } from './parts'\nimport { CheckboxIcon } from './checkbox-icon'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps & CheckboxRootProps\n\n/**\n * Checkbox component is an abstraction of the primitives that displays a\n * controlled checkbox with a label.\n * @description [Cerberus Docs] https://cerberus.digitalu.design/react/checkbox\n * @description [Ark Docs] https://ark-ui.com/docs/components/checkbox\n */\nexport function Checkbox(props: CheckboxProps) {\n const { size, children, ...rootProps } = props\n\n return (\n <CheckboxParts.Root {...rootProps}>\n <CheckboxParts.Control size={size}>\n <CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />\n </CheckboxParts.Control>\n\n <CheckboxParts.Label size={size}>\n {children}\n <Show when={props.required}>\n <Text as=\"span\" data-part=\"required-indicator\">\n (required)\n </Text>\n </Show>\n </CheckboxParts.Label>\n\n <CheckboxParts.HiddenInput />\n </CheckboxParts.Root>\n )\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","import {\n Em,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n P,\n Small,\n Span,\n Strong,\n type PProps,\n} from '@cerberus/styled-system/jsx'\nimport { type HTMLAttributes, type PropsWithChildren } from 'react'\n\n/**\n * This module exports a component for rendering text utilizing the styled-system JSX utility.\n * @module @cerberus/react/Text\n */\n\nexport type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'\n\n// For some reason we have to use the HTMLParagraphElement type here\n// or else TS will fail for non-style props like 'id' or 'className'\nexport interface TextProps\n extends PProps,\n HTMLAttributes<HTMLParagraphElement> {\n /**\n * The element to render as. Defaults to 'p'.\n */\n as?: TextElements | Headings\n}\n\n/**\n * A component for rendering text utilizing the styled-system JSX utility.\n * @definition [Text docs](https://cerberus.digitalu.design/react/text)\n * @example\n * ```tsx\n * <Text as=\"h1\" color=\"page.text.100\" textStyle={{\n * base: 'heading-md',\n * md: 'heading-lg',\n * }}>\n * Hello, world!\n * </Text>\n */\nexport function Text(props: PropsWithChildren<TextProps>) {\n const { as = 'p', ...pandaJSXProps } = props\n switch (as) {\n case 'h1':\n return <H1 {...pandaJSXProps} />\n case 'h2':\n return <H2 {...pandaJSXProps} />\n case 'h3':\n return <H3 {...pandaJSXProps} />\n case 'h4':\n return <H4 {...pandaJSXProps} />\n case 'h5':\n return <H5 {...pandaJSXProps} />\n case 'h6':\n return <H6 {...pandaJSXProps} />\n case 'strong':\n return <Strong {...pandaJSXProps} />\n case 'em':\n return <Em {...pandaJSXProps} />\n case 'small':\n return <Small {...pandaJSXProps} />\n case 'span':\n return <Span {...pandaJSXProps} />\n default:\n return <P {...pandaJSXProps} />\n }\n}\n","import {\n Checkbox,\n type CheckboxControlProps,\n type CheckboxGroupProps,\n type CheckboxIndicatorProps,\n type CheckboxLabelProps,\n type CheckboxRootProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Checkbox primitives.\n * @module 'react/checkbox'\n */\n\n/**\n * Checkbox Root component used to provide the context to all other checkbox\n * primitives.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxRoot(props: CheckboxRootProps) {\n const styles = checkbox()\n return (\n <Checkbox.Root {...props} className={cx(styles.root, props.className)} />\n )\n}\n\n/**\n * Checkbox Label component used to display the label of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxLabel(\n props: CheckboxLabelProps & CheckboxVariantProps,\n) {\n const { size, ...labelProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Label\n {...labelProps}\n className={cx(styles.label, labelProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Control component used to display the control of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxControl(\n props: CheckboxControlProps & CheckboxVariantProps,\n) {\n const { size, ...controlProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Control\n {...controlProps}\n className={cx(styles.control, controlProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Indicator component used to display the indicator of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxIndicator(props: CheckboxIndicatorProps) {\n const styles = checkbox()\n return (\n <Checkbox.Indicator\n {...props}\n className={cx(styles.indicator, props.className)}\n />\n )\n}\n\n/**\n * Checkbox HiddenInput component used to provide the native checkbox input.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxHiddenInput(props: CheckboxControlProps) {\n return <Checkbox.HiddenInput {...props} />\n}\n\n/**\n * Checkbox Group is used to group checkboxes together in a consistently styled\n * way.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxGroup(props: CheckboxGroupProps) {\n const styles = checkbox()\n return (\n <Checkbox.Group {...props} className={cx(styles.group, props.className)} />\n )\n}\n","import type { ElementType } from 'react'\nimport {\n CheckboxRoot,\n CheckboxLabel,\n CheckboxControl,\n CheckboxIndicator,\n CheckboxHiddenInput,\n CheckboxGroup,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface CheckboxPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Label: ElementType\n /**\n * The control of the field.\n */\n Control: ElementType\n /**\n * The indicator of the field.\n */\n Indicator: ElementType\n /**\n * The hidden input of the field.\n */\n HiddenInput: ElementType\n /**\n * The checkbox group component.\n */\n Group: ElementType\n}\n\n/**\n * An Object containing the parts of the Checkbox component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the CheckboxParts object and\n * the entire family of components vs. only what you use.\n */\nexport const CheckboxParts: CheckboxPartsValue = {\n Root: CheckboxRoot,\n Label: CheckboxLabel,\n Control: CheckboxControl,\n Indicator: CheckboxIndicator,\n HiddenInput: CheckboxHiddenInput,\n Group: CheckboxGroup,\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","'use client'\n\nimport { useCerberusContext } from '../../context/cerberus'\nimport { CheckboxParts } from './parts'\nimport { Show } from '../Show'\n\n/**\n * This module contains the Checkbox Icon component.\n * @module\n */\n\ninterface CheckboxIconProps {\n indeterminate?: boolean\n}\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n const { icons } = useCerberusContext()\n const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons\n\n return (\n <CheckboxParts.Indicator indeterminate={props.indeterminate}>\n <Show when={props.indeterminate} fallback={<CheckIcon />}>\n <IndeterminateIcon />\n </Show>\n </CheckboxParts.Indicator>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA;AAAA;;;ACEA,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,sBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,sBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;ACtCA,iBAaO;AAsCM;AAJN,SAAS,KAAK,OAAqC;AACxD,QAAM,EAAE,KAAK,KAAK,GAAG,cAAc,IAAI;AACvC,UAAQ,IAAI;AAAA,IACV,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,4CAAC,qBAAQ,GAAG,eAAe;AAAA,IACpC,KAAK;AACH,aAAO,4CAAC,iBAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,4CAAC,oBAAO,GAAG,eAAe;AAAA,IACnC,KAAK;AAC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O,IAAM,gBAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AAAA,EACb,OAAO;AACT;;;ACxDA,IAAAC,gBAAkE;AAyB9D,IAAAC,sBAAA;AAfJ,IAAM,sBAAkB,6BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,0BAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;ACViD,IAAAC,sBAAA;AAN1C,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,UAAU,WAAW,eAAe,kBAAkB,IAAI;AAElE,SACE,6CAAC,cAAc,WAAd,EAAwB,eAAe,MAAM,eAC5C,uDAAC,QAAK,MAAM,MAAM,eAAe,UAAU,6CAAC,aAAU,GACpD,uDAAC,qBAAkB,GACrB,GACF;AAEJ;;;ANZQ,IAAAC,sBAAA;AAND,SAASC,UAAS,OAAsB;AAC7C,QAAM,EAAE,MAAM,UAAU,GAAG,UAAU,IAAI;AAEzC,SACE,8CAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,iDAAC,cAAc,SAAd,EAAsB,MACrB,uDAAC,gBAAa,eAAe,UAAU,YAAY,iBAAiB,GACtE;AAAA,IAEA,8CAAC,cAAc,OAAd,EAAoB,MAClB;AAAA;AAAA,MACD,6CAAC,QAAK,MAAM,MAAM,UAChB,uDAAC,QAAK,IAAG,QAAO,aAAU,sBAAqB,wBAE/C,GACF;AAAA,OACF;AAAA,IAEA,6CAAC,cAAc,aAAd,EAA0B;AAAA,KAC7B;AAEJ;","names":["Checkbox","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","Checkbox"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/checkbox/index.ts","../../../../src/components/Show.tsx","../../../../src/components/Text.tsx","../../../../src/components/checkbox/primitives.tsx","../../../../src/components/checkbox/parts.ts","../../../../src/context/cerberus.tsx","../../../../src/components/checkbox/checkbox-icon.tsx","../../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["export * from './checkbox'\nexport * from './parts'\nexport * from './primitives'\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","import {\n Em,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n P,\n Small,\n Span,\n Strong,\n type PProps,\n} from '@cerberus/styled-system/jsx'\nimport { type HTMLAttributes, type PropsWithChildren } from 'react'\n\n/**\n * This module exports a component for rendering text utilizing the styled-system JSX utility.\n * @module @cerberus/react/Text\n */\n\nexport type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'\n\n// For some reason we have to use the HTMLParagraphElement type here\n// or else TS will fail for non-style props like 'id' or 'className'\nexport interface TextProps\n extends PProps,\n HTMLAttributes<HTMLParagraphElement> {\n /**\n * The element to render as. Defaults to 'p'.\n */\n as?: TextElements | Headings\n}\n\n/**\n * A component for rendering text utilizing the styled-system JSX utility.\n * @definition [Text docs](https://cerberus.digitalu.design/react/text)\n * @example\n * ```tsx\n * <Text as=\"h1\" color=\"page.text.100\" textStyle={{\n * base: 'heading-md',\n * md: 'heading-lg',\n * }}>\n * Hello, world!\n * </Text>\n */\nexport function Text(props: PropsWithChildren<TextProps>) {\n const { as = 'p', ...pandaJSXProps } = props\n switch (as) {\n case 'h1':\n return <H1 {...pandaJSXProps} />\n case 'h2':\n return <H2 {...pandaJSXProps} />\n case 'h3':\n return <H3 {...pandaJSXProps} />\n case 'h4':\n return <H4 {...pandaJSXProps} />\n case 'h5':\n return <H5 {...pandaJSXProps} />\n case 'h6':\n return <H6 {...pandaJSXProps} />\n case 'strong':\n return <Strong {...pandaJSXProps} />\n case 'em':\n return <Em {...pandaJSXProps} />\n case 'small':\n return <Small {...pandaJSXProps} />\n case 'span':\n return <Span {...pandaJSXProps} />\n default:\n return <P {...pandaJSXProps} />\n }\n}\n","import {\n Checkbox,\n type CheckboxControlProps,\n type CheckboxGroupProps,\n type CheckboxIndicatorProps,\n type CheckboxLabelProps,\n type CheckboxRootProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Checkbox primitives.\n * @module 'react/checkbox'\n */\n\n/**\n * Checkbox Root component used to provide the context to all other checkbox\n * primitives.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxRoot(props: CheckboxRootProps) {\n const styles = checkbox()\n return (\n <Checkbox.Root {...props} className={cx(styles.root, props.className)} />\n )\n}\n\n/**\n * Checkbox Label component used to display the label of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxLabel(\n props: CheckboxLabelProps & CheckboxVariantProps,\n) {\n const { size, ...labelProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Label\n {...labelProps}\n className={cx(styles.label, labelProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Control component used to display the control of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxControl(\n props: CheckboxControlProps & CheckboxVariantProps,\n) {\n const { size, ...controlProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Control\n {...controlProps}\n className={cx(styles.control, controlProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Indicator component used to display the indicator of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxIndicator(props: CheckboxIndicatorProps) {\n const styles = checkbox()\n return (\n <Checkbox.Indicator\n {...props}\n className={cx(styles.indicator, props.className)}\n />\n )\n}\n\n/**\n * Checkbox HiddenInput component used to provide the native checkbox input.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxHiddenInput(props: CheckboxControlProps) {\n return <Checkbox.HiddenInput {...props} />\n}\n\n/**\n * Checkbox Group is used to group checkboxes together in a consistently styled\n * way.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxGroup(props: CheckboxGroupProps) {\n const styles = checkbox()\n return (\n <Checkbox.Group {...props} className={cx(styles.group, props.className)} />\n )\n}\n","import type { ElementType } from 'react'\nimport {\n CheckboxRoot,\n CheckboxLabel,\n CheckboxControl,\n CheckboxIndicator,\n CheckboxHiddenInput,\n CheckboxGroup,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface CheckboxPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Label: ElementType\n /**\n * The control of the field.\n */\n Control: ElementType\n /**\n * The indicator of the field.\n */\n Indicator: ElementType\n /**\n * The hidden input of the field.\n */\n HiddenInput: ElementType\n /**\n * The checkbox group component.\n */\n Group: ElementType\n}\n\n/**\n * An Object containing the parts of the Checkbox component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the CheckboxParts object and\n * the entire family of components vs. only what you use.\n */\nexport const CheckboxParts: CheckboxPartsValue = {\n Root: CheckboxRoot,\n Label: CheckboxLabel,\n Control: CheckboxControl,\n Indicator: CheckboxIndicator,\n HiddenInput: CheckboxHiddenInput,\n Group: CheckboxGroup,\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","'use client'\n\nimport { useCerberusContext } from '../../context/cerberus'\nimport { CheckboxParts } from './parts'\nimport { Show } from '../Show'\n\n/**\n * This module contains the Checkbox Icon component.\n * @module\n */\n\ninterface CheckboxIconProps {\n indeterminate?: boolean\n}\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n const { icons } = useCerberusContext()\n const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons\n\n return (\n <CheckboxParts.Indicator indeterminate={props.indeterminate}>\n <Show when={props.indeterminate} fallback={<CheckIcon />}>\n <IndeterminateIcon />\n </Show>\n </CheckboxParts.Indicator>\n )\n}\n","import type { CheckboxRootProps } from '@ark-ui/react'\nimport { type CheckboxVariantProps } from '@cerberus/styled-system/recipes'\nimport { Show } from '../Show'\nimport { Text } from '../Text'\nimport { CheckboxParts } from './parts'\nimport { CheckboxIcon } from './checkbox-icon'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps & CheckboxRootProps\n\n/**\n * Checkbox component is an abstraction of the primitives that displays a\n * controlled checkbox with a label.\n * @description [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @description [Ark Docs](https://ark-ui.com/docs/components/checkbox)\n */\nexport function Checkbox(props: CheckboxProps) {\n const { size, children, ...rootProps } = props\n\n return (\n <CheckboxParts.Root {...rootProps}>\n <CheckboxParts.Control size={size}>\n <CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />\n </CheckboxParts.Control>\n\n <CheckboxParts.Label size={size}>\n {children}\n <Show when={props.required}>\n <Text as=\"span\" data-part=\"required-indicator\">\n (required)\n </Text>\n </Show>\n </CheckboxParts.Label>\n\n <CheckboxParts.HiddenInput />\n </CheckboxParts.Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA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ACtE;AACA,SAAO;AACT;;;ACViD,IAAAC,sBAAA;AAN1C,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,UAAU,WAAW,eAAe,kBAAkB,IAAI;AAElE,SACE,6CAAC,cAAc,WAAd,EAAwB,eAAe,MAAM,eAC5C,uDAAC,QAAK,MAAM,MAAM,eAAe,UAAU,6CAAC,aAAU,GACpD,uDAAC,qBAAkB,GACrB,GACF;AAEJ;;;ACZQ,IAAAC,sBAAA;AAND,SAASC,UAAS,OAAsB;AAC7C,QAAM,EAAE,MAAM,UAAU,GAAG,UAAU,IAAI;AAEzC,SACE,8CAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,iDAAC,cAAc,SAAd,EAAsB,MACrB,uDAAC,gBAAa,eAAe,UAAU,YAAY,iBAAiB,GACtE;AAAA,IAEA,8CAAC,cAAc,OAAd,EAAoB,MAClB;AAAA;AAAA,MACD,6CAAC,QAAK,MAAM,MAAM,UAChB,uDAAC,QAAK,IAAG,QAAO,aAAU,sBAAqB,wBAE/C,GACF;AAAA,OACF;AAAA,IAEA,6CAAC,cAAc,aAAd,EAA0B;AAAA,KAC7B;AAEJ;","names":["Checkbox","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","Checkbox"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/checkbox/index.ts","../../../../src/components/Show.tsx","../../../../src/components/Text.tsx","../../../../src/components/checkbox/primitives.tsx","../../../../src/components/checkbox/parts.ts","../../../../src/context/cerberus.tsx","../../../../src/components/checkbox/checkbox-icon.tsx","../../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["export * from './checkbox'\nexport * from './parts'\nexport * from './primitives'\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","import {\n Em,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n P,\n Small,\n Span,\n Strong,\n type PProps,\n} from '@cerberus/styled-system/jsx'\nimport { type HTMLAttributes, type PropsWithChildren } from 'react'\n\n/**\n * This module exports a component for rendering text utilizing the styled-system JSX utility.\n * @module @cerberus/react/Text\n */\n\nexport type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'\n\n// For some reason we have to use the HTMLParagraphElement type here\n// or else TS will fail for non-style props like 'id' or 'className'\nexport interface TextProps\n extends PProps,\n HTMLAttributes<HTMLParagraphElement> {\n /**\n * The element to render as. Defaults to 'p'.\n */\n as?: TextElements | Headings\n}\n\n/**\n * A component for rendering text utilizing the styled-system JSX utility.\n * @definition [Text docs](https://cerberus.digitalu.design/react/text)\n * @example\n * ```tsx\n * <Text as=\"h1\" color=\"page.text.100\" textStyle={{\n * base: 'heading-md',\n * md: 'heading-lg',\n * }}>\n * Hello, world!\n * </Text>\n */\nexport function Text(props: PropsWithChildren<TextProps>) {\n const { as = 'p', ...pandaJSXProps } = props\n switch (as) {\n case 'h1':\n return <H1 {...pandaJSXProps} />\n case 'h2':\n return <H2 {...pandaJSXProps} />\n case 'h3':\n return <H3 {...pandaJSXProps} />\n case 'h4':\n return <H4 {...pandaJSXProps} />\n case 'h5':\n return <H5 {...pandaJSXProps} />\n case 'h6':\n return <H6 {...pandaJSXProps} />\n case 'strong':\n return <Strong {...pandaJSXProps} />\n case 'em':\n return <Em {...pandaJSXProps} />\n case 'small':\n return <Small {...pandaJSXProps} />\n case 'span':\n return <Span {...pandaJSXProps} />\n default:\n return <P {...pandaJSXProps} />\n }\n}\n","import {\n Checkbox,\n type CheckboxControlProps,\n type CheckboxGroupProps,\n type CheckboxIndicatorProps,\n type CheckboxLabelProps,\n type CheckboxRootProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Checkbox primitives.\n * @module 'react/checkbox'\n */\n\n/**\n * Checkbox Root component used to provide the context to all other checkbox\n * primitives.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxRoot(props: CheckboxRootProps) {\n const styles = checkbox()\n return (\n <Checkbox.Root {...props} className={cx(styles.root, props.className)} />\n )\n}\n\n/**\n * Checkbox Label component used to display the label of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxLabel(\n props: CheckboxLabelProps & CheckboxVariantProps,\n) {\n const { size, ...labelProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Label\n {...labelProps}\n className={cx(styles.label, labelProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Control component used to display the control of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxControl(\n props: CheckboxControlProps & CheckboxVariantProps,\n) {\n const { size, ...controlProps } = props\n const styles = checkbox({ size })\n return (\n <Checkbox.Control\n {...controlProps}\n className={cx(styles.control, controlProps.className)}\n />\n )\n}\n\n/**\n * Checkbox Indicator component used to display the indicator of the checkbox.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxIndicator(props: CheckboxIndicatorProps) {\n const styles = checkbox()\n return (\n <Checkbox.Indicator\n {...props}\n className={cx(styles.indicator, props.className)}\n />\n )\n}\n\n/**\n * Checkbox HiddenInput component used to provide the native checkbox input.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxHiddenInput(props: CheckboxControlProps) {\n return <Checkbox.HiddenInput {...props} />\n}\n\n/**\n * Checkbox Group is used to group checkboxes together in a consistently styled\n * way.\n * @definition [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)\n * @definition [Primitive Docs](https://ark-ui.com/react/docs/components/checkbox)\n */\nexport function CheckboxGroup(props: CheckboxGroupProps) {\n const styles = checkbox()\n return (\n <Checkbox.Group {...props} className={cx(styles.group, props.className)} />\n )\n}\n","import type { ElementType } from 'react'\nimport {\n CheckboxRoot,\n CheckboxLabel,\n CheckboxControl,\n CheckboxIndicator,\n CheckboxHiddenInput,\n CheckboxGroup,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface CheckboxPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Label: ElementType\n /**\n * The control of the field.\n */\n Control: ElementType\n /**\n * The indicator of the field.\n */\n Indicator: ElementType\n /**\n * The hidden input of the field.\n */\n HiddenInput: ElementType\n /**\n * The checkbox group component.\n */\n Group: ElementType\n}\n\n/**\n * An Object containing the parts of the Checkbox component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the CheckboxParts object and\n * the entire family of components vs. only what you use.\n */\nexport const CheckboxParts: CheckboxPartsValue = {\n Root: CheckboxRoot,\n Label: CheckboxLabel,\n Control: CheckboxControl,\n Indicator: CheckboxIndicator,\n HiddenInput: CheckboxHiddenInput,\n Group: CheckboxGroup,\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","'use client'\n\nimport { useCerberusContext } from '../../context/cerberus'\nimport { CheckboxParts } from './parts'\nimport { Show } from '../Show'\n\n/**\n * This module contains the Checkbox Icon component.\n * @module\n */\n\ninterface CheckboxIconProps {\n indeterminate?: boolean\n}\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function CheckboxIcon(props: CheckboxIconProps) {\n const { icons } = useCerberusContext()\n const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons\n\n return (\n <CheckboxParts.Indicator indeterminate={props.indeterminate}>\n <Show when={props.indeterminate} fallback={<CheckIcon />}>\n <IndeterminateIcon />\n </Show>\n </CheckboxParts.Indicator>\n )\n}\n","import type { CheckboxRootProps } from '@ark-ui/react'\nimport { type CheckboxVariantProps } from '@cerberus/styled-system/recipes'\nimport { Show } from '../Show'\nimport { Text } from '../Text'\nimport { CheckboxParts } from './parts'\nimport { CheckboxIcon } from './checkbox-icon'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps & CheckboxRootProps\n\n/**\n * Checkbox component is an abstraction of the primitives that displays a\n * controlled checkbox with a label.\n * @description [Cerberus Docs] https://cerberus.digitalu.design/react/checkbox\n * @description [Ark Docs] https://ark-ui.com/docs/components/checkbox\n */\nexport function Checkbox(props: CheckboxProps) {\n const { size, children, ...rootProps } = props\n\n return (\n <CheckboxParts.Root {...rootProps}>\n <CheckboxParts.Control size={size}>\n <CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />\n </CheckboxParts.Control>\n\n <CheckboxParts.Label size={size}>\n {children}\n <Show when={props.required}>\n <Text as=\"span\" data-part=\"required-indicator\">\n (required)\n </Text>\n </Show>\n </CheckboxParts.Label>\n\n <CheckboxParts.HiddenInput />\n </CheckboxParts.Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,sBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,sBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;ACtCA,iBAaO;AAsCM;AAJN,SAAS,KAAK,OAAqC;AACxD,QAAM,EAAE,KAAK,KAAK,GAAG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;AAC7C,QAAM,EAAE,MAAM,UAAU,GAAG,UAAU,IAAI;AAEzC,SACE,8CAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,iDAAC,cAAc,SAAd,EAAsB,MACrB,uDAAC,gBAAa,eAAe,UAAU,YAAY,iBAAiB,GACtE;AAAA,IAEA,8CAAC,cAAc,OAAd,EAAoB,MAClB;AAAA;AAAA,MACD,6CAAC,QAAK,MAAM,MAAM,UAChB,uDAAC,QAAK,IAAG,QAAO,aAAU,sBAAqB,wBAE/C,GACF;AAAA,OACF;AAAA,IAEA,6CAAC,cAAc,aAAd,EAA0B;AAAA,KAC7B;AAEJ;","names":["Checkbox","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","Checkbox"]}
|
|
@@ -24,11 +24,12 @@ __export(for_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(for_exports);
|
|
26
26
|
function For(props) {
|
|
27
|
-
var _a;
|
|
28
|
-
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const mappableChildren = props.children;
|
|
29
|
+
if (((_a = props.each) == null ? void 0 : _a.length) === 0) {
|
|
29
30
|
return props.fallback || null;
|
|
30
31
|
}
|
|
31
|
-
return (
|
|
32
|
+
return (_b = props.each) == null ? void 0 : _b.map(mappableChildren);
|
|
32
33
|
}
|
|
33
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
35
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/for.tsx"],"sourcesContent":["import type { ReactNode
|
|
1
|
+
{"version":3,"sources":["../../../src/components/for.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nexport interface ForProps<T> {\n /**\n * The array to iterate over\n */\n each: T[]\n /**\n * The fallback content to render when the array is empty\n */\n fallback?: ReactNode\n /**\n * The render function to render each item in the array\n */\n children: (item: Exclude<T, undefined>, index: number) => ReactNode\n}\n\n/**\n * The For component is used to iterate over an array and render a list of\n * components or display a fallback when the array is empty.\n * Inspired by the `<For>` component from SolidJS.\n *\n * @example\n * ```tsx\n * <For each={['a', 'b', 'c']}>\n * {(item, index) => <div key={index}>{item}</div>}\n * </For>\n * ```\n */\nexport function For<\n T extends string | number | Record<string, unknown> | object | undefined,\n>(props: ForProps<T>) {\n const mappableChildren = props.children as unknown as (\n item: T,\n index: number,\n ) => ReactNode\n\n if (props.each?.length === 0) {\n return props.fallback || null\n }\n\n return props.each?.map(mappableChildren) as ReactNode\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BO,SAAS,IAEd,OAAoB;AA/BtB;AAgCE,QAAM,mBAAmB,MAAM;AAK/B,QAAI,WAAM,SAAN,mBAAY,YAAW,GAAG;AAC5B,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,UAAO,WAAM,SAAN,mBAAY,IAAI;AACzB;","names":[]}
|