@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,99 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/cta-dialog/trigger-item.tsx
21
- var trigger_item_exports = {};
22
- __export(trigger_item_exports, {
23
- TriggerItem: () => TriggerItem
24
- });
25
- module.exports = __toCommonJS(trigger_item_exports);
26
- var import_css2 = require("@cerberus/styled-system/css");
27
-
28
- // src/components/button/button.tsx
29
- var import_react = require("react");
30
- var import_css = require("@cerberus/styled-system/css");
31
- var import_recipes = require("@cerberus/styled-system/recipes");
32
- var import_jsx = require("@cerberus/styled-system/jsx");
33
- var import_jsx_runtime = require("react/jsx-runtime");
34
- var ButtonContext = (0, import_react.createContext)({
35
- pending: false
36
- });
37
- function Button(props) {
38
- const { palette, usage, shape, size, pending = false, ...nativeProps } = props;
39
- const value = (0, import_react.useMemo)(() => ({ pending }), [pending]);
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
41
- "button",
42
- {
43
- ...nativeProps,
44
- disabled: pending || nativeProps.disabled,
45
- className: (0, import_css.cx)(
46
- nativeProps.className,
47
- (0, import_recipes.button)({
48
- palette,
49
- usage,
50
- shape,
51
- size
52
- })
53
- )
54
- }
55
- ) });
56
- }
57
-
58
- // src/components/cta-dialog/trigger-item.tsx
59
- var import_factory = require("@ark-ui/react/factory");
60
- var import_recipes2 = require("@cerberus/styled-system/recipes");
61
- var import_jsx_runtime2 = require("react/jsx-runtime");
62
- function TriggerItem(props) {
63
- const { asChild, children, ...buttonProps } = props;
64
- if (asChild) {
65
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
66
- import_factory.ark.div,
67
- {
68
- className: (0, import_css2.cx)(
69
- (0, import_recipes2.button)({
70
- shape: "rounded",
71
- usage: "ghost"
72
- }),
73
- (0, import_css2.css)({
74
- w: "1/2"
75
- })
76
- ),
77
- asChild: true,
78
- children
79
- }
80
- );
81
- }
82
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
83
- Button,
84
- {
85
- ...buttonProps,
86
- className: (0, import_css2.css)({
87
- w: "1/2"
88
- }),
89
- shape: "rounded",
90
- usage: "outlined",
91
- children
92
- }
93
- );
94
- }
95
- // Annotate the CommonJS export names for ESM import in node:
96
- 0 && (module.exports = {
97
- TriggerItem
98
- });
99
- //# sourceMappingURL=trigger-item.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/cta-dialog/trigger-item.tsx","../../../../src/components/button/button.tsx"],"sourcesContent":["import { css, cx } from '@cerberus/styled-system/css'\nimport { Button, type ButtonProps } from '../button/button'\nimport { ark } from '@ark-ui/react/factory'\nimport { button } from '@cerberus/styled-system/recipes'\n\n/**\n * This module provides the trigger item for the cta modal.\n * @module 'react/cta-modal/trigger-item'\n */\n\nexport interface TriggerItemProps extends ButtonProps {\n asChild?: boolean\n}\n\n/**\n * Trigger item for the cta modal which renders content based on the actions.\n * type.\n */\nexport function TriggerItem(props: TriggerItemProps) {\n const { asChild, children, ...buttonProps } = props\n\n if (asChild) {\n return (\n <ark.div\n className={cx(\n button({\n shape: 'rounded',\n usage: 'ghost',\n }),\n css({\n w: '1/2',\n }),\n )}\n asChild\n >\n {children}\n </ark.div>\n )\n }\n\n return (\n <Button\n {...buttonProps}\n className={css({\n w: '1/2',\n })}\n shape=\"rounded\"\n usage=\"outlined\"\n >\n {children}\n </Button>\n )\n}\n","'use client'\n\nimport {\n type ButtonHTMLAttributes,\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n} from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n button,\n type ButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { Box } from '@cerberus/styled-system/jsx'\nimport { Show } from '../Show'\nimport { Spinner } from '../Spinner'\n\n/**\n * This module contains the Button component.\n * @module\n */\n\ninterface ButtonContextValue {\n pending: boolean\n}\n\nconst ButtonContext = createContext<ButtonContextValue>({\n pending: false,\n})\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n ButtonVariantProps & {\n pending?: boolean\n }\n\n/**\n * A component that allows the user to perform actions\n * @see https://cerberus.digitalu.design/react/button\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const { palette, usage, shape, size, pending = false, ...nativeProps } = props\n const value = useMemo(() => ({ pending }), [pending])\n\n return (\n <ButtonContext.Provider value={value}>\n <button\n {...nativeProps}\n disabled={pending || nativeProps.disabled}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n size,\n }),\n )}\n />\n </ButtonContext.Provider>\n )\n}\n\n/**\n * An icon to display in a button that utilizes the pending state to display\n * a loading spinner.\n */\nexport function ButtonIcon(props: PropsWithChildren<object>) {\n const { pending } = useContext(ButtonContext)\n return (\n <Show when={pending} fallback={<>{props.children}</>}>\n <Box w=\"4\">\n <Spinner />\n </Box>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAAwB;;;ACExB,mBAMO;AACP,iBAAmB;AACnB,qBAGO;AACP,iBAAoB;AAgCd;AAnBN,IAAM,oBAAgB,4BAAkC;AAAA,EACtD,SAAS;AACX,CAAC;AAWM,SAAS,OAAO,OAAiC;AACtD,QAAM,EAAE,SAAS,OAAO,OAAO,MAAM,UAAU,OAAO,GAAG,YAAY,IAAI;AACzE,QAAM,YAAQ,sBAAQ,OAAO,EAAE,QAAQ,IAAI,CAAC,OAAO,CAAC;AAEpD,SACE,4CAAC,cAAc,UAAd,EAAuB,OACtB;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,WAAW,YAAY;AAAA,MACjC,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,uBAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF,GACF;AAEJ;;;AD3DA,qBAAoB;AACpB,IAAAC,kBAAuB;AAoBjB,IAAAC,sBAAA;AALC,SAAS,YAAY,OAAyB;AACnD,QAAM,EAAE,SAAS,UAAU,GAAG,YAAY,IAAI;AAE9C,MAAI,SAAS;AACX,WACE;AAAA,MAAC,mBAAI;AAAA,MAAJ;AAAA,QACC,eAAW;AAAA,cACT,wBAAO;AAAA,YACL,OAAO;AAAA,YACP,OAAO;AAAA,UACT,CAAC;AAAA,cACD,iBAAI;AAAA,YACF,GAAG;AAAA,UACL,CAAC;AAAA,QACH;AAAA,QACA,SAAO;AAAA,QAEN;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,iBAAI;AAAA,QACb,GAAG;AAAA,MACL,CAAC;AAAA,MACD,OAAM;AAAA,MACN,OAAM;AAAA,MAEL;AAAA;AAAA,EACH;AAEJ;","names":["import_css","import_recipes","import_jsx_runtime"]}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/cta-dialog/utils.ts
21
- var utils_exports = {};
22
- __export(utils_exports, {
23
- createCTAModalActions: () => createCTAModalActions
24
- });
25
- module.exports = __toCommonJS(utils_exports);
26
- function createCTAModalActions(providedActions) {
27
- if (providedActions.length !== 2) {
28
- throw new Error("CTAModal must include 2 actions");
29
- }
30
- if (providedActions.every(
31
- (action) => action == null ? void 0 : action.handleClick
32
- )) {
33
- return {
34
- type: "btnAction",
35
- _actions: providedActions
36
- };
37
- }
38
- return {
39
- type: "reactNode",
40
- _actions: providedActions
41
- };
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- createCTAModalActions
46
- });
47
- //# sourceMappingURL=utils.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/cta-dialog/utils.ts"],"sourcesContent":["import type { MouseEventHandler, ReactNode } from 'react'\n\n/**\n * This module provide utility functions for the cta modal.\n * @module 'react/cta-modal/utils'\n */\n\nexport type CTAButtonAction = {\n /**\n * The text of the button.\n */\n text: string\n /**\n * The onClick handler for the button.\n */\n handleClick: MouseEventHandler<HTMLButtonElement>\n}\n\nexport type CTAModalAction = (CTAButtonAction | ReactNode)[]\n\nexport interface CTAModalActionReturn {\n /**\n * The type of the action content.\n */\n type: 'reactNode' | 'btnAction'\n /**\n * The actions for the cta modal. Max of 2 actions.\n */\n _actions: CTAModalAction\n}\n\n/**\n * Creates the action data to pass to the cta modal `show` method.\n */\nexport function createCTAModalActions(\n providedActions: CTAModalAction,\n): CTAModalActionReturn {\n if (providedActions.length !== 2) {\n throw new Error('CTAModal must include 2 actions')\n }\n\n if (\n providedActions.every(\n (action) => (action as unknown as CTAButtonAction)?.handleClick,\n )\n ) {\n return {\n type: 'btnAction',\n _actions: providedActions as CTAButtonAction[],\n }\n }\n\n return {\n type: 'reactNode',\n _actions: providedActions as ReactNode[],\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCO,SAAS,sBACd,iBACsB;AACtB,MAAI,gBAAgB,WAAW,GAAG;AAChC,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAEA,MACE,gBAAgB;AAAA,IACd,CAAC,WAAY,iCAAuC;AAAA,EACtD,GACA;AACA,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;","names":[]}
@@ -1,167 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/rating/index.ts
21
- var rating_exports = {};
22
- __export(rating_exports, {
23
- Rating: () => Rating,
24
- RatingContext: () => RatingContext,
25
- RatingControl: () => RatingControl,
26
- RatingHiddenInput: () => RatingHiddenInput,
27
- RatingItem: () => RatingItem,
28
- RatingItemContext: () => RatingItemContext,
29
- RatingLabel: () => RatingLabel,
30
- RatingParts: () => RatingParts,
31
- RatingRoot: () => RatingRoot
32
- });
33
- module.exports = __toCommonJS(rating_exports);
34
-
35
- // src/components/rating/primitives.tsx
36
- var import_rating_group = require("@ark-ui/react/rating-group");
37
- var import_css = require("@cerberus/styled-system/css");
38
- var import_recipes = require("@cerberus/styled-system/recipes");
39
- var import_jsx_runtime = require("react/jsx-runtime");
40
- function RatingRoot(props) {
41
- const { orientation, size, ...rootProps } = props;
42
- const styles = (0, import_recipes.ratingGroup)({ orientation, size });
43
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
- import_rating_group.RatingGroup.Root,
45
- {
46
- ...rootProps,
47
- className: (0, import_css.cx)(styles.root, rootProps.className)
48
- }
49
- );
50
- }
51
- function RatingLabel(props) {
52
- const styles = (0, import_recipes.ratingGroup)();
53
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
- import_rating_group.RatingGroup.Label,
55
- {
56
- ...props,
57
- className: (0, import_css.cx)(styles.label, props.className)
58
- }
59
- );
60
- }
61
- function RatingControl(props) {
62
- const styles = (0, import_recipes.ratingGroup)();
63
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
64
- import_rating_group.RatingGroup.Control,
65
- {
66
- ...props,
67
- className: (0, import_css.cx)(styles.control, props.className)
68
- }
69
- );
70
- }
71
- function RatingContext(props) {
72
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.Context, { ...props });
73
- }
74
- function RatingItem(props) {
75
- const { palette, ...itemProps } = props;
76
- const styles = (0, import_recipes.ratingGroup)({ palette });
77
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
- import_rating_group.RatingGroup.Item,
79
- {
80
- ...itemProps,
81
- className: (0, import_css.cx)(styles.item, itemProps.className)
82
- }
83
- );
84
- }
85
- function RatingItemContext(props) {
86
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.ItemContext, { ...props });
87
- }
88
- function RatingHiddenInput(props) {
89
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.HiddenInput, { ...props });
90
- }
91
-
92
- // src/components/rating/parts.tsx
93
- var RatingParts = {
94
- Root: RatingRoot,
95
- Label: RatingLabel,
96
- Control: RatingControl,
97
- Context: RatingContext,
98
- Item: RatingItem,
99
- ItemContext: RatingItemContext,
100
- HiddenInput: RatingHiddenInput
101
- };
102
-
103
- // src/utils/index.ts
104
- function splitProps(props, ...keyGroups) {
105
- const result = keyGroups.map(() => ({}));
106
- const rest = {};
107
- for (const key in props) {
108
- let assigned = false;
109
- for (let i = 0; i < keyGroups.length; i++) {
110
- if (keyGroups[i].includes(key)) {
111
- result[i][key] = props[key];
112
- assigned = true;
113
- break;
114
- }
115
- }
116
- if (!assigned) {
117
- rest[key] = props[key];
118
- }
119
- }
120
- return [...result, rest];
121
- }
122
-
123
- // src/components/Show.tsx
124
- var import_react = require("react");
125
- function Show(props) {
126
- const { when, children, fallback } = props;
127
- const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
128
- return (0, import_react.useMemo)(() => {
129
- if (condition) return children;
130
- return fallback ?? null;
131
- }, [condition, children, fallback]);
132
- }
133
-
134
- // src/components/rating/rating.tsx
135
- var import_jsx_runtime2 = require("react/jsx-runtime");
136
- function Rating(props) {
137
- const [{ label }, styleProps, rootProps] = splitProps(
138
- props,
139
- ["label"],
140
- ["orientation", "palette", "size"]
141
- );
142
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(RatingParts.Root, { ...styleProps, ...rootProps, children: [
143
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: Boolean(label), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RatingParts.Label, { children: label }) }),
144
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RatingParts.Control, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RatingParts.Context, { children: (context) => context.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
145
- RatingParts.Item,
146
- {
147
- index: item,
148
- palette: styleProps.palette,
149
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RatingParts.ItemContext, { children: rootProps.children })
150
- },
151
- item
152
- )) }) })
153
- ] });
154
- }
155
- // Annotate the CommonJS export names for ESM import in node:
156
- 0 && (module.exports = {
157
- Rating,
158
- RatingContext,
159
- RatingControl,
160
- RatingHiddenInput,
161
- RatingItem,
162
- RatingItemContext,
163
- RatingLabel,
164
- RatingParts,
165
- RatingRoot
166
- });
167
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/rating/index.ts","../../../../src/components/rating/primitives.tsx","../../../../src/components/rating/parts.tsx","../../../../src/utils/index.ts","../../../../src/components/Show.tsx","../../../../src/components/rating/rating.tsx"],"sourcesContent":["export * from './parts'\nexport * from './primitives'\nexport * from './rating'\n\nexport type {\n UseRatingGroupContext,\n UseRatingGroupItemContext,\n} from '@ark-ui/react/rating-group'\n","import {\n RatingGroup,\n type RatingGroupContextProps,\n type RatingGroupControlProps,\n type RatingGroupHiddenInputProps,\n type RatingGroupItemContextProps,\n type RatingGroupItemProps,\n type RatingGroupLabelProps,\n type RatingGroupRootProps,\n} from '@ark-ui/react/rating-group'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n ratingGroup,\n type RatingGroupVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the primitives of the Rating component.\n * @module 'rating/primitives'\n */\n\n/**\n * The root primitive of the Rating component.\n */\nexport function RatingRoot(\n props: RatingGroupRootProps & RatingGroupVariantProps,\n) {\n const { orientation, size, ...rootProps } = props\n const styles = ratingGroup({ orientation, size })\n return (\n <RatingGroup.Root\n {...rootProps}\n className={cx(styles.root, rootProps.className)}\n />\n )\n}\n\n/**\n * The label primitive of the Rating component.\n */\nexport function RatingLabel(props: RatingGroupLabelProps) {\n const styles = ratingGroup()\n return (\n <RatingGroup.Label\n {...props}\n className={cx(styles.label, props.className)}\n />\n )\n}\n\n/**\n * The control primitive of the Rating component.\n */\nexport function RatingControl(props: RatingGroupControlProps) {\n const styles = ratingGroup()\n return (\n <RatingGroup.Control\n {...props}\n className={cx(styles.control, props.className)}\n />\n )\n}\n\n/**\n * The context primitive of the Rating component.\n */\nexport function RatingContext(props: RatingGroupContextProps) {\n return <RatingGroup.Context {...props} />\n}\n\n/**\n * The item primitive of the Rating component.\n */\nexport function RatingItem(\n props: RatingGroupItemProps & RatingGroupVariantProps,\n) {\n const { palette, ...itemProps } = props\n const styles = ratingGroup({ palette })\n return (\n <RatingGroup.Item\n {...itemProps}\n className={cx(styles.item, itemProps.className)}\n />\n )\n}\n\n/**\n * The item context primitive of the Rating component.\n */\nexport function RatingItemContext(props: RatingGroupItemContextProps) {\n return <RatingGroup.ItemContext {...props} />\n}\n\n/**\n * The hidden input primitive of the Rating component.\n */\nexport function RatingHiddenInput(props: RatingGroupHiddenInputProps) {\n return <RatingGroup.HiddenInput {...props} />\n}\n","import type { ElementType } from 'react'\nimport {\n RatingContext,\n RatingControl,\n RatingHiddenInput,\n RatingItem,\n RatingItemContext,\n RatingLabel,\n RatingRoot,\n} from './primitives'\n\n/**\n * This module contains the parts of the Rating component.\n * @module 'rating/parts'\n */\n\ninterface RatingPartsValue {\n /**\n * The container of the rating.\n */\n Root: ElementType\n /**\n * The label of the rating.\n */\n Label: ElementType\n /**\n * The visual representation of the rating.\n */\n Control: ElementType\n /**\n * The context of the rating.\n */\n Context: ElementType\n /**\n * The item to display for the rating.\n */\n Item: ElementType\n /**\n * The context provider for the rating items.\n */\n ItemContext: ElementType\n /**\n * The native input of the rating.\n */\n HiddenInput: ElementType\n}\n\n/**\n * An Object containing the parts of the Rating component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the RatingParts object and\n * the entire family of components vs. only what you use.\n */\nexport const RatingParts: RatingPartsValue = {\n Root: RatingRoot,\n Label: RatingLabel,\n Control: RatingControl,\n Context: RatingContext,\n Item: RatingItem,\n ItemContext: RatingItemContext,\n HiddenInput: RatingHiddenInput,\n}\n","/**\n * This module contains utility functions that are used across your app.\n * @module Utils\n */\n\n/**\n * Formats the count of notifications to be displayed in the notification badge.\n * @param count - The number of notifications.\n * @returns The formatted count of notifications.\n * @example\n * ```tsx\n * const count = formatNotifyCount(100)\n * console.log(count) // '99+'\n * ```\n */\nexport function formatNotifyCount(count: number): string {\n if (count > 99) return '99+'\n return count.toString()\n}\n\n/**\n * Splits the properties of an object into multiple groups based on lists of keys.\n * @param props - The object to split.\n * @param keyGroups - The lists of keys to include in each group.\n * @returns An array of objects: each containing the properties specified in the corresponding key group, and the last object containing the remaining keys.\n */\nexport function splitProps<T extends object>(\n props: T,\n ...keyGroups: (keyof T)[][]\n): { [K in keyof T]?: T[K] }[] {\n const result = keyGroups.map(() => ({}) as { [K in keyof T]?: T[K] })\n const rest = {} as { [K in keyof T]?: T[K] }\n\n for (const key in props) {\n let assigned = false\n for (let i = 0; i < keyGroups.length; i++) {\n if (keyGroups[i].includes(key as keyof T)) {\n result[i][key as keyof T] = props[key]\n assigned = true\n break\n }\n }\n if (!assigned) {\n rest[key as keyof T] = props[key]\n }\n }\n\n return [...result, rest]\n}\n\nexport * from './localStorage'\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 type {\n RatingGroupRootProps,\n UseRatingGroupContext,\n UseRatingGroupItemContext,\n} from '@ark-ui/react/rating-group'\nimport type { RatingGroupVariantProps } from '@cerberus/styled-system/recipes'\nimport type { ReactNode } from 'react'\nimport { splitProps } from '../../utils/index'\nimport { Show } from '../Show'\nimport { RatingParts } from './parts'\n\n/**\n * This module contains the abstracted Rating component.\n * @module 'react/rating'\n */\n\nexport interface RatingProps\n extends Omit<RatingGroupRootProps, 'children'>,\n RatingGroupVariantProps {\n /**\n * The label of the rating component.\n */\n label?: string\n /**\n * The children of the rating component.\n */\n children: (context: UseRatingGroupItemContext) => ReactNode\n}\n\n/**\n * The Rating component is an abstraction of the primitives which provides a\n * visual rating system for a user to select a value.\n * @description [Cerberus Docs](https://cerberus.digitalu.design/react/rating)\n * @description [Ark Docs](https://ark-ui.com/react/docs/components/rating-group#api-reference)\n * @example\n * ```tsx\n * <Rating count={5} defaultValue={3} allowHalf>\n * {({ half, highlighted }) => {\n * if (half) return <StarHalfIcon fill=\"current\" />\n * if (highlighted) return <StarIcon fill=\"current\" />\n * return <StarIcon />\n * }}\n * </Rating>\n * ```\n */\nexport function Rating(props: RatingProps) {\n const [{ label }, styleProps, rootProps] = splitProps(\n props,\n ['label'],\n ['orientation', 'palette', 'size'],\n )\n\n return (\n <RatingParts.Root {...styleProps} {...rootProps}>\n <Show when={Boolean(label)}>\n <RatingParts.Label>{label}</RatingParts.Label>\n </Show>\n\n <RatingParts.Control>\n <RatingParts.Context>\n {(context: UseRatingGroupContext) =>\n context.items.map((item) => (\n <RatingParts.Item\n key={item}\n index={item}\n palette={styleProps.palette}\n >\n <RatingParts.ItemContext>\n {rootProps.children}\n </RatingPar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Z,EAAkB,GAAG,YAAa,GAAG,WACpC;AAAA,iDAAC,QAAK,MAAM,QAAQ,KAAK,GACvB,uDAAC,YAAY,OAAZ,EAAmB,iBAAM,GAC5B;AAAA,IAEA,6CAAC,YAAY,SAAZ,EACC,uDAAC,YAAY,SAAZ,EACE,WAAC,YACA,QAAQ,MAAM,IAAI,CAAC,SACjB;AAAA,MAAC,YAAY;AAAA,MAAZ;AAAA,QAEC,OAAO;AAAA,QACP,SAAS,WAAW;AAAA,QAEpB,uDAAC,YAAY,aAAZ,EACE,oBAAU,UACb;AAAA;AAAA,MANK;AAAA,IAOP,CACD,GAEL,GACF;AAAA,KACF;AAEJ;","names":["import_jsx_runtime"]}
@@ -1,98 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/rating/parts.tsx
21
- var parts_exports = {};
22
- __export(parts_exports, {
23
- RatingParts: () => RatingParts
24
- });
25
- module.exports = __toCommonJS(parts_exports);
26
-
27
- // src/components/rating/primitives.tsx
28
- var import_rating_group = require("@ark-ui/react/rating-group");
29
- var import_css = require("@cerberus/styled-system/css");
30
- var import_recipes = require("@cerberus/styled-system/recipes");
31
- var import_jsx_runtime = require("react/jsx-runtime");
32
- function RatingRoot(props) {
33
- const { orientation, size, ...rootProps } = props;
34
- const styles = (0, import_recipes.ratingGroup)({ orientation, size });
35
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
36
- import_rating_group.RatingGroup.Root,
37
- {
38
- ...rootProps,
39
- className: (0, import_css.cx)(styles.root, rootProps.className)
40
- }
41
- );
42
- }
43
- function RatingLabel(props) {
44
- const styles = (0, import_recipes.ratingGroup)();
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
46
- import_rating_group.RatingGroup.Label,
47
- {
48
- ...props,
49
- className: (0, import_css.cx)(styles.label, props.className)
50
- }
51
- );
52
- }
53
- function RatingControl(props) {
54
- const styles = (0, import_recipes.ratingGroup)();
55
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
- import_rating_group.RatingGroup.Control,
57
- {
58
- ...props,
59
- className: (0, import_css.cx)(styles.control, props.className)
60
- }
61
- );
62
- }
63
- function RatingContext(props) {
64
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.Context, { ...props });
65
- }
66
- function RatingItem(props) {
67
- const { palette, ...itemProps } = props;
68
- const styles = (0, import_recipes.ratingGroup)({ palette });
69
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
- import_rating_group.RatingGroup.Item,
71
- {
72
- ...itemProps,
73
- className: (0, import_css.cx)(styles.item, itemProps.className)
74
- }
75
- );
76
- }
77
- function RatingItemContext(props) {
78
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.ItemContext, { ...props });
79
- }
80
- function RatingHiddenInput(props) {
81
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.HiddenInput, { ...props });
82
- }
83
-
84
- // src/components/rating/parts.tsx
85
- var RatingParts = {
86
- Root: RatingRoot,
87
- Label: RatingLabel,
88
- Control: RatingControl,
89
- Context: RatingContext,
90
- Item: RatingItem,
91
- ItemContext: RatingItemContext,
92
- HiddenInput: RatingHiddenInput
93
- };
94
- // Annotate the CommonJS export names for ESM import in node:
95
- 0 && (module.exports = {
96
- RatingParts
97
- });
98
- //# sourceMappingURL=parts.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/rating/parts.tsx","../../../../src/components/rating/primitives.tsx"],"sourcesContent":["import type { ElementType } from 'react'\nimport {\n RatingContext,\n RatingControl,\n RatingHiddenInput,\n RatingItem,\n RatingItemContext,\n RatingLabel,\n RatingRoot,\n} from './primitives'\n\n/**\n * This module contains the parts of the Rating component.\n * @module 'rating/parts'\n */\n\ninterface RatingPartsValue {\n /**\n * The container of the rating.\n */\n Root: ElementType\n /**\n * The label of the rating.\n */\n Label: ElementType\n /**\n * The visual representation of the rating.\n */\n Control: ElementType\n /**\n * The context of the rating.\n */\n Context: ElementType\n /**\n * The item to display for the rating.\n */\n Item: ElementType\n /**\n * The context provider for the rating items.\n */\n ItemContext: ElementType\n /**\n * The native input of the rating.\n */\n HiddenInput: ElementType\n}\n\n/**\n * An Object containing the parts of the Rating component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the RatingParts object and\n * the entire family of components vs. only what you use.\n */\nexport const RatingParts: RatingPartsValue = {\n Root: RatingRoot,\n Label: RatingLabel,\n Control: RatingControl,\n Context: RatingContext,\n Item: RatingItem,\n ItemContext: RatingItemContext,\n HiddenInput: RatingHiddenInput,\n}\n","import {\n RatingGroup,\n type RatingGroupContextProps,\n type RatingGroupControlProps,\n type RatingGroupHiddenInputProps,\n type RatingGroupItemContextProps,\n type RatingGroupItemProps,\n type RatingGroupLabelProps,\n type RatingGroupRootProps,\n} from '@ark-ui/react/rating-group'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n ratingGroup,\n type RatingGroupVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the primitives of the Rating component.\n * @module 'rating/primitives'\n */\n\n/**\n * The root primitive of the Rating component.\n */\nexport function RatingRoot(\n props: RatingGroupRootProps & RatingGroupVariantProps,\n) {\n const { orientation, size, ...rootProps } = props\n const styles = ratingGroup({ orientation, size })\n return (\n <RatingGroup.Root\n {...rootProps}\n className={cx(styles.root, rootProps.className)}\n />\n )\n}\n\n/**\n * The label primitive of the Rating component.\n */\nexport function RatingLabel(props: RatingGroupLabelProps) {\n const styles = ratingGroup()\n return (\n <RatingGroup.Label\n {...props}\n className={cx(styles.label, props.className)}\n />\n )\n}\n\n/**\n * The control primitive of the Rating component.\n */\nexport function RatingControl(props: RatingGroupControlProps) {\n const styles = ratingGroup()\n return (\n <RatingGroup.Control\n {...props}\n className={cx(styles.control, props.className)}\n />\n )\n}\n\n/**\n * The context primitive of the Rating component.\n */\nexport function RatingContext(props: RatingGroupContextProps) {\n return <RatingGroup.Context {...props} />\n}\n\n/**\n * The item primitive of the Rating component.\n */\nexport function RatingItem(\n props: RatingGroupItemProps & RatingGroupVariantProps,\n) {\n const { palette, ...itemProps } = props\n const styles = ratingGroup({ palette })\n return (\n <RatingGroup.Item\n {...itemProps}\n className={cx(styles.item, itemProps.className)}\n />\n )\n}\n\n/**\n * The item context primitive of the Rating component.\n */\nexport function RatingItemContext(props: RatingGroupItemContextProps) {\n return <RatingGroup.ItemContext {...props} />\n}\n\n/**\n * The hidden input primitive of the Rating component.\n */\nexport function RatingHiddenInput(props: RatingGroupHiddenInputProps) {\n return <RatingGroup.HiddenInput {...props} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BASO;AACP,iBAAmB;AACnB,qBAGO;AAgBH;AANG,SAAS,WACd,OACA;AACA,QAAM,EAAE,aAAa,MAAM,GAAG,UAAU,IAAI;AAC5C,QAAM,aAAS,4BAAY,EAAE,aAAa,KAAK,CAAC;AAChD,SACE;AAAA,IAAC,gCAAY;AAAA,IAAZ;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,MAAM,UAAU,SAAS;AAAA;AAAA,EAChD;AAEJ;AAKO,SAAS,YAAY,OAA8B;AACxD,QAAM,aAAS,4BAAY;AAC3B,SACE;AAAA,IAAC,gCAAY;AAAA,IAAZ;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS;AAAA;AAAA,EAC7C;AAEJ;AAKO,SAAS,cAAc,OAAgC;AAC5D,QAAM,aAAS,4BAAY;AAC3B,SACE;AAAA,IAAC,gCAAY;AAAA,IAAZ;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,SAAS,MAAM,SAAS;AAAA;AAAA,EAC/C;AAEJ;AAKO,SAAS,cAAc,OAAgC;AAC5D,SAAO,4CAAC,gCAAY,SAAZ,EAAqB,GAAG,OAAO;AACzC;AAKO,SAAS,WACd,OACA;AACA,QAAM,EAAE,SAAS,GAAG,UAAU,IAAI;AAClC,QAAM,aAAS,4BAAY,EAAE,QAAQ,CAAC;AACtC,SACE;AAAA,IAAC,gCAAY;AAAA,IAAZ;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,MAAM,UAAU,SAAS;AAAA;AAAA,EAChD;AAEJ;AAKO,SAAS,kBAAkB,OAAoC;AACpE,SAAO,4CAAC,gCAAY,aAAZ,EAAyB,GAAG,OAAO;AAC7C;AAKO,SAAS,kBAAkB,OAAoC;AACpE,SAAO,4CAAC,gCAAY,aAAZ,EAAyB,GAAG,OAAO;AAC7C;;;AD1CO,IAAM,cAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AACf;","names":[]}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/rating/primitives.tsx
21
- var primitives_exports = {};
22
- __export(primitives_exports, {
23
- RatingContext: () => RatingContext,
24
- RatingControl: () => RatingControl,
25
- RatingHiddenInput: () => RatingHiddenInput,
26
- RatingItem: () => RatingItem,
27
- RatingItemContext: () => RatingItemContext,
28
- RatingLabel: () => RatingLabel,
29
- RatingRoot: () => RatingRoot
30
- });
31
- module.exports = __toCommonJS(primitives_exports);
32
- var import_rating_group = require("@ark-ui/react/rating-group");
33
- var import_css = require("@cerberus/styled-system/css");
34
- var import_recipes = require("@cerberus/styled-system/recipes");
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- function RatingRoot(props) {
37
- const { orientation, size, ...rootProps } = props;
38
- const styles = (0, import_recipes.ratingGroup)({ orientation, size });
39
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
40
- import_rating_group.RatingGroup.Root,
41
- {
42
- ...rootProps,
43
- className: (0, import_css.cx)(styles.root, rootProps.className)
44
- }
45
- );
46
- }
47
- function RatingLabel(props) {
48
- const styles = (0, import_recipes.ratingGroup)();
49
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
- import_rating_group.RatingGroup.Label,
51
- {
52
- ...props,
53
- className: (0, import_css.cx)(styles.label, props.className)
54
- }
55
- );
56
- }
57
- function RatingControl(props) {
58
- const styles = (0, import_recipes.ratingGroup)();
59
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
60
- import_rating_group.RatingGroup.Control,
61
- {
62
- ...props,
63
- className: (0, import_css.cx)(styles.control, props.className)
64
- }
65
- );
66
- }
67
- function RatingContext(props) {
68
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.Context, { ...props });
69
- }
70
- function RatingItem(props) {
71
- const { palette, ...itemProps } = props;
72
- const styles = (0, import_recipes.ratingGroup)({ palette });
73
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
- import_rating_group.RatingGroup.Item,
75
- {
76
- ...itemProps,
77
- className: (0, import_css.cx)(styles.item, itemProps.className)
78
- }
79
- );
80
- }
81
- function RatingItemContext(props) {
82
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.ItemContext, { ...props });
83
- }
84
- function RatingHiddenInput(props) {
85
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_rating_group.RatingGroup.HiddenInput, { ...props });
86
- }
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- RatingContext,
90
- RatingControl,
91
- RatingHiddenInput,
92
- RatingItem,
93
- RatingItemContext,
94
- RatingLabel,
95
- RatingRoot
96
- });
97
- //# sourceMappingURL=primitives.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/rating/primitives.tsx"],"sourcesContent":["import {\n RatingGroup,\n type RatingGroupContextProps,\n type RatingGroupControlProps,\n type RatingGroupHiddenInputProps,\n type RatingGroupItemContextProps,\n type RatingGroupItemProps,\n type RatingGroupLabelProps,\n type RatingGroupRootProps,\n} from '@ark-ui/react/rating-group'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n ratingGroup,\n type RatingGroupVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the primitives of the Rating component.\n * @module 'rating/primitives'\n */\n\n/**\n * The root primitive of the Rating component.\n */\nexport function RatingRoot(\n props: RatingGroupRootProps & RatingGroupVariantProps,\n) {\n const { orientation, size, ...rootProps } = props\n const styles = ratingGroup({ orientation, size })\n return (\n <RatingGroup.Root\n {...rootProps}\n className={cx(styles.root, rootProps.className)}\n />\n )\n}\n\n/**\n * The label primitive of the Rating component.\n */\nexport function RatingLabel(props: RatingGroupLabelProps) {\n const styles = ratingGroup()\n return (\n <RatingGroup.Label\n {...props}\n className={cx(styles.label, props.className)}\n />\n )\n}\n\n/**\n * The control primitive of the Rating component.\n */\nexport function RatingControl(props: RatingGroupControlProps) {\n const styles = ratingGroup()\n return (\n <RatingGroup.Control\n {...props}\n className={cx(styles.control, props.className)}\n />\n )\n}\n\n/**\n * The context primitive of the Rating component.\n */\nexport function RatingContext(props: RatingGroupContextProps) {\n return <RatingGroup.Context {...props} />\n}\n\n/**\n * The item primitive of the Rating component.\n */\nexport function RatingItem(\n props: RatingGroupItemProps & RatingGroupVariantProps,\n) {\n const { palette, ...itemProps } = props\n const styles = ratingGroup({ palette })\n return (\n <RatingGroup.Item\n {...itemProps}\n className={cx(styles.item, itemProps.className)}\n />\n )\n}\n\n/**\n * The item context primitive of the Rating component.\n */\nexport function RatingItemContext(props: RatingGroupItemContextProps) {\n return <RatingGroup.ItemContext {...props} />\n}\n\n/**\n * The hidden input primitive of the Rating component.\n */\nexport function RatingHiddenInput(props: RatingGroupHiddenInputProps) {\n return <RatingGroup.HiddenInput {...props} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BASO;AACP,iBAAmB;AACnB,qBAGO;AAgBH;AANG,SAAS,WACd,OACA;AACA,QAAM,EAAE,aAAa,MAAM,GAAG,UAAU,IAAI;AAC5C,QAAM,aAAS,4BAAY,EAAE,aAAa,KAAK,CAAC;AAChD,SACE;AAAA,IAAC,gCAAY;AAAA,IAAZ;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,MAAM,UAAU,SAAS;AAAA;AAAA,EAChD;AAEJ;AAKO,SAAS,YAAY,OAA8B;AACxD,QAAM,aAAS,4BAAY;AAC3B,SACE;AAAA,IAAC,gCAAY;AAAA,IAAZ;AA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