@cerberus-design/react 0.15.0-next-7a184be → 0.15.0-next-47ecb2e
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 +319 -93
- 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.map +1 -1
- package/build/legacy/components/select/index.cjs +265 -0
- package/build/legacy/components/select/index.cjs.map +1 -0
- package/build/legacy/components/select/option-group.cjs +60 -0
- package/build/legacy/components/select/option-group.cjs.map +1 -0
- package/build/legacy/components/select/parts.cjs +153 -0
- package/build/legacy/components/select/parts.cjs.map +1 -0
- package/build/legacy/components/select/primitives.cjs +167 -0
- package/build/legacy/components/select/primitives.cjs.map +1 -0
- package/build/legacy/components/select/select.cjs +212 -0
- package/build/legacy/components/select/select.cjs.map +1 -0
- package/build/legacy/components/switch/index.cjs +118 -0
- package/build/legacy/components/switch/index.cjs.map +1 -0
- package/build/legacy/components/switch/parts.cjs +75 -0
- package/build/legacy/components/switch/parts.cjs.map +1 -0
- package/build/legacy/components/switch/primitives.cjs +72 -0
- package/build/legacy/components/switch/primitives.cjs.map +1 -0
- package/build/legacy/components/switch/switch-indicator.cjs +51 -0
- package/build/legacy/components/switch/switch-indicator.cjs.map +1 -0
- package/build/legacy/components/switch/switch.cjs +106 -0
- package/build/legacy/components/switch/switch.cjs.map +1 -0
- package/build/legacy/components/toggle/index.cjs +45 -0
- package/build/legacy/components/toggle/index.cjs.map +1 -0
- package/build/legacy/components/toggle/parts.cjs +41 -0
- package/build/legacy/components/toggle/parts.cjs.map +1 -0
- package/build/legacy/components/toggle/primitives.cjs +35 -0
- package/build/legacy/components/toggle/primitives.cjs.map +1 -0
- package/build/legacy/hooks/useToggle.cjs.map +1 -1
- package/build/legacy/index.cjs +617 -483
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +319 -93
- package/build/modern/chunk-2CVGNLIM.js +15 -0
- package/build/modern/chunk-2CVGNLIM.js.map +1 -0
- package/build/modern/chunk-2LF3HPNA.js +1 -0
- package/build/modern/chunk-CAZ3EICD.js +16 -0
- package/build/modern/chunk-CAZ3EICD.js.map +1 -0
- package/build/modern/chunk-CIMY2U22.js +10 -0
- package/build/modern/chunk-CIMY2U22.js.map +1 -0
- package/build/modern/chunk-IASVL7CW.js +19 -0
- package/build/modern/chunk-IASVL7CW.js.map +1 -0
- package/build/modern/{chunk-REO5GUNC.js → chunk-ICTISECN.js} +1 -1
- package/build/modern/chunk-ICTISECN.js.map +1 -0
- package/build/modern/{chunk-77FJSNGD.js → chunk-IIH363FO.js} +1 -1
- package/build/modern/{chunk-77FJSNGD.js.map → chunk-IIH363FO.js.map} +1 -1
- package/build/modern/chunk-KQQPZJEI.js +21 -0
- package/build/modern/chunk-KQQPZJEI.js.map +1 -0
- package/build/modern/chunk-LZWNHXRP.js +48 -0
- package/build/modern/chunk-LZWNHXRP.js.map +1 -0
- package/build/modern/chunk-OVHCXBBI.js +22 -0
- package/build/modern/chunk-OVHCXBBI.js.map +1 -0
- package/build/modern/chunk-P3SF56LT.js +47 -0
- package/build/modern/chunk-P3SF56LT.js.map +1 -0
- package/build/modern/chunk-QCBLRACK.js +133 -0
- package/build/modern/chunk-QCBLRACK.js.map +1 -0
- package/build/modern/chunk-UDY6USHW.js +1 -0
- package/build/modern/chunk-V4YYGGMH.js +1 -0
- package/build/modern/chunk-XTNGF4D6.js +41 -0
- package/build/modern/chunk-XTNGF4D6.js.map +1 -0
- package/build/modern/{chunk-UNN4LHRS.js → chunk-Y4ZEJ2EF.js} +1 -1
- package/build/modern/chunk-Y4ZEJ2EF.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 +57 -0
- package/build/modern/components/select/index.js.map +1 -0
- package/build/modern/components/select/option-group.js +10 -0
- package/build/modern/components/select/option-group.js.map +1 -0
- package/build/modern/components/select/parts.js +8 -0
- package/build/modern/components/select/parts.js.map +1 -0
- package/build/modern/components/{Select.server.js → select/primitives.js} +8 -4
- package/build/modern/components/select/primitives.js.map +1 -0
- package/build/modern/components/select/select.js +15 -0
- package/build/modern/components/select/select.js.map +1 -0
- package/build/modern/components/switch/index.js +26 -0
- package/build/modern/components/switch/index.js.map +1 -0
- package/build/modern/components/switch/parts.js +8 -0
- package/build/modern/components/switch/parts.js.map +1 -0
- package/build/modern/components/switch/primitives.js +15 -0
- package/build/modern/components/switch/primitives.js.map +1 -0
- package/build/modern/components/switch/switch-indicator.js +9 -0
- package/build/modern/components/switch/switch-indicator.js.map +1 -0
- package/build/modern/components/switch/switch.js +11 -0
- package/build/modern/components/switch/switch.js.map +1 -0
- package/build/modern/components/toggle/index.js +14 -0
- package/build/modern/components/toggle/index.js.map +1 -0
- package/build/modern/components/toggle/parts.js +8 -0
- package/build/modern/components/toggle/parts.js.map +1 -0
- package/build/modern/components/toggle/primitives.js +9 -0
- package/build/modern/components/toggle/primitives.js.map +1 -0
- package/build/modern/context/confirm-modal.js +1 -1
- package/build/modern/context/cta-modal.js +2 -2
- package/build/modern/context/prompt-modal.js +1 -1
- package/build/modern/hooks/useToggle.js +1 -1
- package/build/modern/index.js +110 -72
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/checkbox/checkbox.tsx +4 -10
- package/src/components/for.tsx +1 -1
- package/src/components/select/index.ts +4 -0
- package/src/components/select/option-group.tsx +34 -0
- package/src/components/select/parts.ts +113 -0
- package/src/components/select/primitives.tsx +205 -0
- package/src/components/select/select.tsx +135 -0
- package/src/components/switch/index.ts +3 -0
- package/src/components/switch/parts.ts +53 -0
- package/src/components/switch/primitives.tsx +69 -0
- package/src/components/switch/switch-indicator.tsx +9 -0
- package/src/components/switch/switch.tsx +30 -0
- package/src/components/toggle/index.ts +2 -0
- package/src/components/toggle/parts.ts +32 -0
- package/src/components/toggle/primitives.tsx +17 -0
- package/src/hooks/useToggle.ts +1 -3
- package/src/index.ts +6 -6
- package/build/legacy/components/Select.cjs +0 -142
- package/build/legacy/components/Select.cjs.map +0 -1
- package/build/legacy/components/Select.server.cjs +0 -78
- package/build/legacy/components/Select.server.cjs.map +0 -1
- package/build/legacy/components/Toggle.cjs +0 -94
- package/build/legacy/components/Toggle.cjs.map +0 -1
- package/build/modern/chunk-GENS32QO.js +0 -61
- package/build/modern/chunk-GENS32QO.js.map +0 -1
- package/build/modern/chunk-REO5GUNC.js.map +0 -1
- package/build/modern/chunk-S2X5OEPK.js +0 -89
- package/build/modern/chunk-S2X5OEPK.js.map +0 -1
- package/build/modern/chunk-UNN4LHRS.js.map +0 -1
- package/build/modern/chunk-YWMPB2JR.js +0 -41
- package/build/modern/chunk-YWMPB2JR.js.map +0 -1
- package/build/modern/components/Select.js +0 -20
- package/build/modern/components/Toggle.js +0 -9
- package/src/components/Select.server.tsx +0 -80
- package/src/components/Select.tsx +0 -219
- package/src/components/Toggle.tsx +0 -98
- /package/build/modern/{components/Select.js.map → chunk-2LF3HPNA.js.map} +0 -0
- /package/build/modern/{components/Select.server.js.map → chunk-UDY6USHW.js.map} +0 -0
- /package/build/modern/{components/Toggle.js.map → chunk-V4YYGGMH.js.map} +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
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/switch/index.ts
|
|
21
|
+
var switch_exports = {};
|
|
22
|
+
__export(switch_exports, {
|
|
23
|
+
Switch: () => Switch2,
|
|
24
|
+
SwitchControl: () => SwitchControl,
|
|
25
|
+
SwitchHiddenInput: () => SwitchHiddenInput,
|
|
26
|
+
SwitchLabel: () => SwitchLabel,
|
|
27
|
+
SwitchParts: () => SwitchParts,
|
|
28
|
+
SwitchRoot: () => SwitchRoot,
|
|
29
|
+
SwitchThumb: () => SwitchThumb
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(switch_exports);
|
|
32
|
+
|
|
33
|
+
// src/components/switch/primitives.tsx
|
|
34
|
+
var import_react = require("@ark-ui/react");
|
|
35
|
+
var import_css = require("@cerberus/styled-system/css");
|
|
36
|
+
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
function SwitchRoot(props) {
|
|
39
|
+
const { size, ...rootProps } = props;
|
|
40
|
+
const styles = (0, import_recipes.switchRecipe)({ size });
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
42
|
+
import_react.Switch.Root,
|
|
43
|
+
{
|
|
44
|
+
...rootProps,
|
|
45
|
+
className: (0, import_css.cx)(styles.root, rootProps.className)
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function SwitchLabel(props) {
|
|
50
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Label, { ...props, className: (0, import_css.cx)(styles.label, props.className) });
|
|
52
|
+
}
|
|
53
|
+
function SwitchControl(props) {
|
|
54
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
import_react.Switch.Control,
|
|
57
|
+
{
|
|
58
|
+
...props,
|
|
59
|
+
className: (0, import_css.cx)(styles.control, props.className)
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function SwitchThumb(props) {
|
|
64
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Thumb, { ...props, className: (0, import_css.cx)(styles.thumb, props.className) });
|
|
66
|
+
}
|
|
67
|
+
var SwitchHiddenInput = import_react.Switch.HiddenInput;
|
|
68
|
+
|
|
69
|
+
// src/components/switch/parts.ts
|
|
70
|
+
var SwitchParts = {
|
|
71
|
+
Root: SwitchRoot,
|
|
72
|
+
Label: SwitchLabel,
|
|
73
|
+
Control: SwitchControl,
|
|
74
|
+
Thumb: SwitchThumb,
|
|
75
|
+
HiddenInput: SwitchHiddenInput
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/context/cerberus.tsx
|
|
79
|
+
var import_react2 = require("react");
|
|
80
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
81
|
+
var CerberusContext = (0, import_react2.createContext)(null);
|
|
82
|
+
function useCerberusContext() {
|
|
83
|
+
const context = (0, import_react2.useContext)(CerberusContext);
|
|
84
|
+
if (!context) {
|
|
85
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
86
|
+
}
|
|
87
|
+
return context;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/components/switch/switch-indicator.tsx
|
|
91
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
92
|
+
function SwitchIndicator() {
|
|
93
|
+
const { icons } = useCerberusContext();
|
|
94
|
+
const { toggleChecked: CheckIcon } = icons;
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, {});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/components/switch/switch.tsx
|
|
99
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
100
|
+
function Switch2(props) {
|
|
101
|
+
const { children, ...rootProps } = props;
|
|
102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(SwitchParts.Root, { ...rootProps, children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.Control, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.Thumb, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchIndicator, {}) }) }),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.Label, { children }),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.HiddenInput, {})
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
+
0 && (module.exports = {
|
|
110
|
+
Switch,
|
|
111
|
+
SwitchControl,
|
|
112
|
+
SwitchHiddenInput,
|
|
113
|
+
SwitchLabel,
|
|
114
|
+
SwitchParts,
|
|
115
|
+
SwitchRoot,
|
|
116
|
+
SwitchThumb
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/switch/index.ts","../../../../src/components/switch/primitives.tsx","../../../../src/components/switch/parts.ts","../../../../src/context/cerberus.tsx","../../../../src/components/switch/switch-indicator.tsx","../../../../src/components/switch/switch.tsx"],"sourcesContent":["export * from './parts'\nexport * from './primitives'\nexport * from './switch'\n","import {\n Switch,\n type SwitchControlProps,\n type SwitchLabelProps,\n type SwitchRootProps,\n type SwitchThumbProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n switchRecipe,\n type SwitchRecipeVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Switch primitives\n * @module 'react/switch'\n */\n\n/**\n * The SwitchRoot component is the context provider for the Switch components.\n */\nexport function SwitchRoot(props: SwitchRootProps & SwitchRecipeVariantProps) {\n const { size, ...rootProps } = props\n const styles = switchRecipe({ size })\n return (\n <Switch.Root\n {...rootProps}\n className={cx(styles.root, rootProps.className)}\n />\n )\n}\n\n/**\n * The SwitchLabel component is the label for the Switch.\n */\nexport function SwitchLabel(props: SwitchLabelProps) {\n const styles = switchRecipe()\n return (\n <Switch.Label {...props} className={cx(styles.label, props.className)} />\n )\n}\n\n/**\n * The SwitchControl component is the visual input for the Switch.\n */\nexport function SwitchControl(props: SwitchControlProps) {\n const styles = switchRecipe()\n return (\n <Switch.Control\n {...props}\n className={cx(styles.control, props.className)}\n />\n )\n}\n\n/**\n * The SwitchThumb component is the thumb for the Switch.\n */\nexport function SwitchThumb(props: SwitchThumbProps) {\n const styles = switchRecipe()\n return (\n <Switch.Thumb {...props} className={cx(styles.thumb, props.className)} />\n )\n}\n\n/**\n * The SwitchHiddenInput component is the native input for the Switch.\n */\nexport const SwitchHiddenInput = Switch.HiddenInput\n","import type { ElementType } from 'react'\nimport {\n SwitchControl,\n SwitchLabel,\n SwitchRoot,\n SwitchThumb,\n SwitchHiddenInput,\n} from './primitives'\n\n/**\n * This module contains the parts of the Radio parts.\n * @module 'radio/parts'\n */\n\ninterface SwitchPartsValue {\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 visual input of the switch.\n */\n Control: ElementType\n /**\n * The thumb item of the switch.\n */\n Thumb: ElementType\n /**\n * The native input for the switch.\n */\n HiddenInput: ElementType\n}\n\n/**\n * An Object containing the parts of the Radio component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the SwitchParts object and\n * the entire family of components vs. only what you use.\n */\nexport const SwitchParts: SwitchPartsValue = {\n Root: SwitchRoot,\n Label: SwitchLabel,\n Control: SwitchControl,\n Thumb: SwitchThumb,\n HiddenInput: SwitchHiddenInput,\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'\n\nexport function SwitchIndicator() {\n const { icons } = useCerberusContext()\n const { toggleChecked: CheckIcon } = icons\n return <CheckIcon />\n}\n","import type { SwitchRootProps } from '@ark-ui/react'\nimport type { SwitchRecipeVariantProps } from '@cerberus/styled-system/recipes'\nimport { SwitchParts } from './parts'\nimport { SwitchIndicator } from './switch-indicator'\n\nexport type SwitchProps = SwitchRootProps & SwitchRecipeVariantProps\n\n/**\n * The Switch component is a and abstraction of the primitives that displays a\n * controlled Switch with a label.\n * @description [Cerberus Docs] https://cerberus.digitalu.design/react/switch\n * @description [Ark Docs] https://ark-ui.com/docs/components/switch\n */\nexport function Switch(props: SwitchProps) {\n const { children, ...rootProps } = props\n\n return (\n <SwitchParts.Root {...rootProps}>\n <SwitchParts.Control>\n <SwitchParts.Thumb>\n <SwitchIndicator />\n </SwitchParts.Thumb>\n </SwitchParts.Control>\n\n <SwitchParts.Label>{children}</SwitchParts.Label>\n\n <SwitchParts.HiddenInput />\n </SwitchParts.Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAMO;AACP,iBAAmB;AACnB,qBAGO;AAcH;AAJG,SAAS,WAAW,OAAmD;AAC5E,QAAM,EAAE,MAAM,GAAG,UAAU,IAAI;AAC/B,QAAM,aAAS,6BAAa,EAAE,KAAK,CAAC;AACpC,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,MAAM,UAAU,SAAS;AAAA;AAAA,EAChD;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,SAAS,cAAc,OAA2B;AACvD,QAAM,aAAS,6BAAa;AAC5B,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,SAAS,MAAM,SAAS;AAAA;AAAA,EAC/C;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,IAAM,oBAAoB,oBAAO;;;ACtBjC,IAAM,cAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACf;;;AClDA,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;;;ACpCS,IAAAC,sBAAA;AAHF,SAAS,kBAAkB;AAChC,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,eAAe,UAAU,IAAI;AACrC,SAAO,6CAAC,aAAU;AACpB;;;ACSI,IAAAC,sBAAA;AAJG,SAASC,QAAO,OAAoB;AACzC,QAAM,EAAE,UAAU,GAAG,UAAU,IAAI;AAEnC,SACE,8CAAC,YAAY,MAAZ,EAAkB,GAAG,WACpB;AAAA,iDAAC,YAAY,SAAZ,EACC,uDAAC,YAAY,OAAZ,EACC,uDAAC,mBAAgB,GACnB,GACF;AAAA,IAEA,6CAAC,YAAY,OAAZ,EAAmB,UAAS;AAAA,IAE7B,6CAAC,YAAY,aAAZ,EAAwB;AAAA,KAC3B;AAEJ;","names":["Switch","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","Switch"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
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/switch/parts.ts
|
|
21
|
+
var parts_exports = {};
|
|
22
|
+
__export(parts_exports, {
|
|
23
|
+
SwitchParts: () => SwitchParts
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(parts_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/switch/primitives.tsx
|
|
28
|
+
var import_react = require("@ark-ui/react");
|
|
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 SwitchRoot(props) {
|
|
33
|
+
const { size, ...rootProps } = props;
|
|
34
|
+
const styles = (0, import_recipes.switchRecipe)({ size });
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
36
|
+
import_react.Switch.Root,
|
|
37
|
+
{
|
|
38
|
+
...rootProps,
|
|
39
|
+
className: (0, import_css.cx)(styles.root, rootProps.className)
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function SwitchLabel(props) {
|
|
44
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Label, { ...props, className: (0, import_css.cx)(styles.label, props.className) });
|
|
46
|
+
}
|
|
47
|
+
function SwitchControl(props) {
|
|
48
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
import_react.Switch.Control,
|
|
51
|
+
{
|
|
52
|
+
...props,
|
|
53
|
+
className: (0, import_css.cx)(styles.control, props.className)
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function SwitchThumb(props) {
|
|
58
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Thumb, { ...props, className: (0, import_css.cx)(styles.thumb, props.className) });
|
|
60
|
+
}
|
|
61
|
+
var SwitchHiddenInput = import_react.Switch.HiddenInput;
|
|
62
|
+
|
|
63
|
+
// src/components/switch/parts.ts
|
|
64
|
+
var SwitchParts = {
|
|
65
|
+
Root: SwitchRoot,
|
|
66
|
+
Label: SwitchLabel,
|
|
67
|
+
Control: SwitchControl,
|
|
68
|
+
Thumb: SwitchThumb,
|
|
69
|
+
HiddenInput: SwitchHiddenInput
|
|
70
|
+
};
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
SwitchParts
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=parts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/switch/parts.ts","../../../../src/components/switch/primitives.tsx"],"sourcesContent":["import type { ElementType } from 'react'\nimport {\n SwitchControl,\n SwitchLabel,\n SwitchRoot,\n SwitchThumb,\n SwitchHiddenInput,\n} from './primitives'\n\n/**\n * This module contains the parts of the Radio parts.\n * @module 'radio/parts'\n */\n\ninterface SwitchPartsValue {\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 visual input of the switch.\n */\n Control: ElementType\n /**\n * The thumb item of the switch.\n */\n Thumb: ElementType\n /**\n * The native input for the switch.\n */\n HiddenInput: ElementType\n}\n\n/**\n * An Object containing the parts of the Radio component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the SwitchParts object and\n * the entire family of components vs. only what you use.\n */\nexport const SwitchParts: SwitchPartsValue = {\n Root: SwitchRoot,\n Label: SwitchLabel,\n Control: SwitchControl,\n Thumb: SwitchThumb,\n HiddenInput: SwitchHiddenInput,\n}\n","import {\n Switch,\n type SwitchControlProps,\n type SwitchLabelProps,\n type SwitchRootProps,\n type SwitchThumbProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n switchRecipe,\n type SwitchRecipeVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Switch primitives\n * @module 'react/switch'\n */\n\n/**\n * The SwitchRoot component is the context provider for the Switch components.\n */\nexport function SwitchRoot(props: SwitchRootProps & SwitchRecipeVariantProps) {\n const { size, ...rootProps } = props\n const styles = switchRecipe({ size })\n return (\n <Switch.Root\n {...rootProps}\n className={cx(styles.root, rootProps.className)}\n />\n )\n}\n\n/**\n * The SwitchLabel component is the label for the Switch.\n */\nexport function SwitchLabel(props: SwitchLabelProps) {\n const styles = switchRecipe()\n return (\n <Switch.Label {...props} className={cx(styles.label, props.className)} />\n )\n}\n\n/**\n * The SwitchControl component is the visual input for the Switch.\n */\nexport function SwitchControl(props: SwitchControlProps) {\n const styles = switchRecipe()\n return (\n <Switch.Control\n {...props}\n className={cx(styles.control, props.className)}\n />\n )\n}\n\n/**\n * The SwitchThumb component is the thumb for the Switch.\n */\nexport function SwitchThumb(props: SwitchThumbProps) {\n const styles = switchRecipe()\n return (\n <Switch.Thumb {...props} className={cx(styles.thumb, props.className)} />\n )\n}\n\n/**\n * The SwitchHiddenInput component is the native input for the Switch.\n */\nexport const SwitchHiddenInput = Switch.HiddenInput\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAMO;AACP,iBAAmB;AACnB,qBAGO;AAcH;AAJG,SAAS,WAAW,OAAmD;AAC5E,QAAM,EAAE,MAAM,GAAG,UAAU,IAAI;AAC/B,QAAM,aAAS,6BAAa,EAAE,KAAK,CAAC;AACpC,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,MAAM,UAAU,SAAS;AAAA;AAAA,EAChD;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,SAAS,cAAc,OAA2B;AACvD,QAAM,aAAS,6BAAa;AAC5B,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,SAAS,MAAM,SAAS;AAAA;AAAA,EAC/C;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,IAAM,oBAAoB,oBAAO;;;ADtBjC,IAAM,cAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACf;","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
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/switch/primitives.tsx
|
|
21
|
+
var primitives_exports = {};
|
|
22
|
+
__export(primitives_exports, {
|
|
23
|
+
SwitchControl: () => SwitchControl,
|
|
24
|
+
SwitchHiddenInput: () => SwitchHiddenInput,
|
|
25
|
+
SwitchLabel: () => SwitchLabel,
|
|
26
|
+
SwitchRoot: () => SwitchRoot,
|
|
27
|
+
SwitchThumb: () => SwitchThumb
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(primitives_exports);
|
|
30
|
+
var import_react = require("@ark-ui/react");
|
|
31
|
+
var import_css = require("@cerberus/styled-system/css");
|
|
32
|
+
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
function SwitchRoot(props) {
|
|
35
|
+
const { size, ...rootProps } = props;
|
|
36
|
+
const styles = (0, import_recipes.switchRecipe)({ size });
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
38
|
+
import_react.Switch.Root,
|
|
39
|
+
{
|
|
40
|
+
...rootProps,
|
|
41
|
+
className: (0, import_css.cx)(styles.root, rootProps.className)
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function SwitchLabel(props) {
|
|
46
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Label, { ...props, className: (0, import_css.cx)(styles.label, props.className) });
|
|
48
|
+
}
|
|
49
|
+
function SwitchControl(props) {
|
|
50
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
+
import_react.Switch.Control,
|
|
53
|
+
{
|
|
54
|
+
...props,
|
|
55
|
+
className: (0, import_css.cx)(styles.control, props.className)
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function SwitchThumb(props) {
|
|
60
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Thumb, { ...props, className: (0, import_css.cx)(styles.thumb, props.className) });
|
|
62
|
+
}
|
|
63
|
+
var SwitchHiddenInput = import_react.Switch.HiddenInput;
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
SwitchControl,
|
|
67
|
+
SwitchHiddenInput,
|
|
68
|
+
SwitchLabel,
|
|
69
|
+
SwitchRoot,
|
|
70
|
+
SwitchThumb
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=primitives.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/switch/primitives.tsx"],"sourcesContent":["import {\n Switch,\n type SwitchControlProps,\n type SwitchLabelProps,\n type SwitchRootProps,\n type SwitchThumbProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n switchRecipe,\n type SwitchRecipeVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Switch primitives\n * @module 'react/switch'\n */\n\n/**\n * The SwitchRoot component is the context provider for the Switch components.\n */\nexport function SwitchRoot(props: SwitchRootProps & SwitchRecipeVariantProps) {\n const { size, ...rootProps } = props\n const styles = switchRecipe({ size })\n return (\n <Switch.Root\n {...rootProps}\n className={cx(styles.root, rootProps.className)}\n />\n )\n}\n\n/**\n * The SwitchLabel component is the label for the Switch.\n */\nexport function SwitchLabel(props: SwitchLabelProps) {\n const styles = switchRecipe()\n return (\n <Switch.Label {...props} className={cx(styles.label, props.className)} />\n )\n}\n\n/**\n * The SwitchControl component is the visual input for the Switch.\n */\nexport function SwitchControl(props: SwitchControlProps) {\n const styles = switchRecipe()\n return (\n <Switch.Control\n {...props}\n className={cx(styles.control, props.className)}\n />\n )\n}\n\n/**\n * The SwitchThumb component is the thumb for the Switch.\n */\nexport function SwitchThumb(props: SwitchThumbProps) {\n const styles = switchRecipe()\n return (\n <Switch.Thumb {...props} className={cx(styles.thumb, props.className)} />\n )\n}\n\n/**\n * The SwitchHiddenInput component is the native input for the Switch.\n */\nexport const SwitchHiddenInput = Switch.HiddenInput\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMO;AACP,iBAAmB;AACnB,qBAGO;AAcH;AAJG,SAAS,WAAW,OAAmD;AAC5E,QAAM,EAAE,MAAM,GAAG,UAAU,IAAI;AAC/B,QAAM,aAAS,6BAAa,EAAE,KAAK,CAAC;AACpC,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,MAAM,UAAU,SAAS;AAAA;AAAA,EAChD;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,SAAS,cAAc,OAA2B;AACvD,QAAM,aAAS,6BAAa;AAC5B,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,SAAS,MAAM,SAAS;AAAA;AAAA,EAC/C;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,IAAM,oBAAoB,oBAAO;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/components/switch/switch-indicator.tsx
|
|
22
|
+
var switch_indicator_exports = {};
|
|
23
|
+
__export(switch_indicator_exports, {
|
|
24
|
+
SwitchIndicator: () => SwitchIndicator
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(switch_indicator_exports);
|
|
27
|
+
|
|
28
|
+
// src/context/cerberus.tsx
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var CerberusContext = (0, import_react.createContext)(null);
|
|
32
|
+
function useCerberusContext() {
|
|
33
|
+
const context = (0, import_react.useContext)(CerberusContext);
|
|
34
|
+
if (!context) {
|
|
35
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
36
|
+
}
|
|
37
|
+
return context;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/components/switch/switch-indicator.tsx
|
|
41
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
42
|
+
function SwitchIndicator() {
|
|
43
|
+
const { icons } = useCerberusContext();
|
|
44
|
+
const { toggleChecked: CheckIcon } = icons;
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckIcon, {});
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
SwitchIndicator
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=switch-indicator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/switch/switch-indicator.tsx","../../../../src/context/cerberus.tsx"],"sourcesContent":["'use client'\n\nimport { useCerberusContext } from '../../context/cerberus'\n\nexport function SwitchIndicator() {\n const { icons } = useCerberusContext()\n const { toggleChecked: CheckIcon } = icons\n return <CheckIcon />\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAkE;AAyB9D;AAfJ,IAAM,sBAAkB,4BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,yBAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;ADpCS,IAAAA,sBAAA;AAHF,SAAS,kBAAkB;AAChC,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,eAAe,UAAU,IAAI;AACrC,SAAO,6CAAC,aAAU;AACpB;","names":["import_jsx_runtime"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
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/switch/switch.tsx
|
|
21
|
+
var switch_exports = {};
|
|
22
|
+
__export(switch_exports, {
|
|
23
|
+
Switch: () => Switch2
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(switch_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/switch/primitives.tsx
|
|
28
|
+
var import_react = require("@ark-ui/react");
|
|
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 SwitchRoot(props) {
|
|
33
|
+
const { size, ...rootProps } = props;
|
|
34
|
+
const styles = (0, import_recipes.switchRecipe)({ size });
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
36
|
+
import_react.Switch.Root,
|
|
37
|
+
{
|
|
38
|
+
...rootProps,
|
|
39
|
+
className: (0, import_css.cx)(styles.root, rootProps.className)
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function SwitchLabel(props) {
|
|
44
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Label, { ...props, className: (0, import_css.cx)(styles.label, props.className) });
|
|
46
|
+
}
|
|
47
|
+
function SwitchControl(props) {
|
|
48
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
import_react.Switch.Control,
|
|
51
|
+
{
|
|
52
|
+
...props,
|
|
53
|
+
className: (0, import_css.cx)(styles.control, props.className)
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function SwitchThumb(props) {
|
|
58
|
+
const styles = (0, import_recipes.switchRecipe)();
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Switch.Thumb, { ...props, className: (0, import_css.cx)(styles.thumb, props.className) });
|
|
60
|
+
}
|
|
61
|
+
var SwitchHiddenInput = import_react.Switch.HiddenInput;
|
|
62
|
+
|
|
63
|
+
// src/components/switch/parts.ts
|
|
64
|
+
var SwitchParts = {
|
|
65
|
+
Root: SwitchRoot,
|
|
66
|
+
Label: SwitchLabel,
|
|
67
|
+
Control: SwitchControl,
|
|
68
|
+
Thumb: SwitchThumb,
|
|
69
|
+
HiddenInput: SwitchHiddenInput
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/context/cerberus.tsx
|
|
73
|
+
var import_react2 = require("react");
|
|
74
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
75
|
+
var CerberusContext = (0, import_react2.createContext)(null);
|
|
76
|
+
function useCerberusContext() {
|
|
77
|
+
const context = (0, import_react2.useContext)(CerberusContext);
|
|
78
|
+
if (!context) {
|
|
79
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
80
|
+
}
|
|
81
|
+
return context;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/components/switch/switch-indicator.tsx
|
|
85
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
86
|
+
function SwitchIndicator() {
|
|
87
|
+
const { icons } = useCerberusContext();
|
|
88
|
+
const { toggleChecked: CheckIcon } = icons;
|
|
89
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, {});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/components/switch/switch.tsx
|
|
93
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
94
|
+
function Switch2(props) {
|
|
95
|
+
const { children, ...rootProps } = props;
|
|
96
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(SwitchParts.Root, { ...rootProps, children: [
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.Control, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.Thumb, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchIndicator, {}) }) }),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.Label, { children }),
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SwitchParts.HiddenInput, {})
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
Switch
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=switch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/switch/switch.tsx","../../../../src/components/switch/primitives.tsx","../../../../src/components/switch/parts.ts","../../../../src/context/cerberus.tsx","../../../../src/components/switch/switch-indicator.tsx"],"sourcesContent":["import type { SwitchRootProps } from '@ark-ui/react'\nimport type { SwitchRecipeVariantProps } from '@cerberus/styled-system/recipes'\nimport { SwitchParts } from './parts'\nimport { SwitchIndicator } from './switch-indicator'\n\nexport type SwitchProps = SwitchRootProps & SwitchRecipeVariantProps\n\n/**\n * The Switch component is a and abstraction of the primitives that displays a\n * controlled Switch with a label.\n * @description [Cerberus Docs] https://cerberus.digitalu.design/react/switch\n * @description [Ark Docs] https://ark-ui.com/docs/components/switch\n */\nexport function Switch(props: SwitchProps) {\n const { children, ...rootProps } = props\n\n return (\n <SwitchParts.Root {...rootProps}>\n <SwitchParts.Control>\n <SwitchParts.Thumb>\n <SwitchIndicator />\n </SwitchParts.Thumb>\n </SwitchParts.Control>\n\n <SwitchParts.Label>{children}</SwitchParts.Label>\n\n <SwitchParts.HiddenInput />\n </SwitchParts.Root>\n )\n}\n","import {\n Switch,\n type SwitchControlProps,\n type SwitchLabelProps,\n type SwitchRootProps,\n type SwitchThumbProps,\n} from '@ark-ui/react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n switchRecipe,\n type SwitchRecipeVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Switch primitives\n * @module 'react/switch'\n */\n\n/**\n * The SwitchRoot component is the context provider for the Switch components.\n */\nexport function SwitchRoot(props: SwitchRootProps & SwitchRecipeVariantProps) {\n const { size, ...rootProps } = props\n const styles = switchRecipe({ size })\n return (\n <Switch.Root\n {...rootProps}\n className={cx(styles.root, rootProps.className)}\n />\n )\n}\n\n/**\n * The SwitchLabel component is the label for the Switch.\n */\nexport function SwitchLabel(props: SwitchLabelProps) {\n const styles = switchRecipe()\n return (\n <Switch.Label {...props} className={cx(styles.label, props.className)} />\n )\n}\n\n/**\n * The SwitchControl component is the visual input for the Switch.\n */\nexport function SwitchControl(props: SwitchControlProps) {\n const styles = switchRecipe()\n return (\n <Switch.Control\n {...props}\n className={cx(styles.control, props.className)}\n />\n )\n}\n\n/**\n * The SwitchThumb component is the thumb for the Switch.\n */\nexport function SwitchThumb(props: SwitchThumbProps) {\n const styles = switchRecipe()\n return (\n <Switch.Thumb {...props} className={cx(styles.thumb, props.className)} />\n )\n}\n\n/**\n * The SwitchHiddenInput component is the native input for the Switch.\n */\nexport const SwitchHiddenInput = Switch.HiddenInput\n","import type { ElementType } from 'react'\nimport {\n SwitchControl,\n SwitchLabel,\n SwitchRoot,\n SwitchThumb,\n SwitchHiddenInput,\n} from './primitives'\n\n/**\n * This module contains the parts of the Radio parts.\n * @module 'radio/parts'\n */\n\ninterface SwitchPartsValue {\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 visual input of the switch.\n */\n Control: ElementType\n /**\n * The thumb item of the switch.\n */\n Thumb: ElementType\n /**\n * The native input for the switch.\n */\n HiddenInput: ElementType\n}\n\n/**\n * An Object containing the parts of the Radio component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the SwitchParts object and\n * the entire family of components vs. only what you use.\n */\nexport const SwitchParts: SwitchPartsValue = {\n Root: SwitchRoot,\n Label: SwitchLabel,\n Control: SwitchControl,\n Thumb: SwitchThumb,\n HiddenInput: SwitchHiddenInput,\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'\n\nexport function SwitchIndicator() {\n const { icons } = useCerberusContext()\n const { toggleChecked: CheckIcon } = icons\n return <CheckIcon />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;;;ACAA,mBAMO;AACP,iBAAmB;AACnB,qBAGO;AAcH;AAJG,SAAS,WAAW,OAAmD;AAC5E,QAAM,EAAE,MAAM,GAAG,UAAU,IAAI;AAC/B,QAAM,aAAS,6BAAa,EAAE,KAAK,CAAC;AACpC,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,MAAM,UAAU,SAAS;AAAA;AAAA,EAChD;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,SAAS,cAAc,OAA2B;AACvD,QAAM,aAAS,6BAAa;AAC5B,SACE;AAAA,IAAC,oBAAO;AAAA,IAAP;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,OAAO,SAAS,MAAM,SAAS;AAAA;AAAA,EAC/C;AAEJ;AAKO,SAAS,YAAY,OAAyB;AACnD,QAAM,aAAS,6BAAa;AAC5B,SACE,4CAAC,oBAAO,OAAP,EAAc,GAAG,OAAO,eAAW,eAAG,OAAO,OAAO,MAAM,SAAS,GAAG;AAE3E;AAKO,IAAM,oBAAoB,oBAAO;;;ACtBjC,IAAM,cAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACf;;;AClDA,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;;;ACpCS,IAAAC,sBAAA;AAHF,SAAS,kBAAkB;AAChC,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,eAAe,UAAU,IAAI;AACrC,SAAO,6CAAC,aAAU;AACpB;;;AJSI,IAAAC,sBAAA;AAJG,SAASC,QAAO,OAAoB;AACzC,QAAM,EAAE,UAAU,GAAG,UAAU,IAAI;AAEnC,SACE,8CAAC,YAAY,MAAZ,EAAkB,GAAG,WACpB;AAAA,iDAAC,YAAY,SAAZ,EACC,uDAAC,YAAY,OAAZ,EACC,uDAAC,mBAAgB,GACnB,GACF;AAAA,IAEA,6CAAC,YAAY,OAAZ,EAAmB,UAAS;AAAA,IAE7B,6CAAC,YAAY,aAAZ,EAAwB;AAAA,KAC3B;AAEJ;","names":["Switch","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","Switch"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
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/toggle/index.ts
|
|
21
|
+
var toggle_exports = {};
|
|
22
|
+
__export(toggle_exports, {
|
|
23
|
+
ToggleIndicator: () => ToggleIndicator,
|
|
24
|
+
ToggleParts: () => ToggleParts,
|
|
25
|
+
ToggleRoot: () => ToggleRoot
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(toggle_exports);
|
|
28
|
+
|
|
29
|
+
// src/components/toggle/primitives.tsx
|
|
30
|
+
var import_toggle = require("@ark-ui/react/toggle");
|
|
31
|
+
var ToggleRoot = import_toggle.Toggle.Root;
|
|
32
|
+
var ToggleIndicator = import_toggle.Toggle.Indicator;
|
|
33
|
+
|
|
34
|
+
// src/components/toggle/parts.ts
|
|
35
|
+
var ToggleParts = {
|
|
36
|
+
Root: ToggleRoot,
|
|
37
|
+
Indicator: ToggleIndicator
|
|
38
|
+
};
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
ToggleIndicator,
|
|
42
|
+
ToggleParts,
|
|
43
|
+
ToggleRoot
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/toggle/index.ts","../../../../src/components/toggle/primitives.tsx","../../../../src/components/toggle/parts.ts"],"sourcesContent":["export * from './parts'\nexport * from './primitives'\n","import { Toggle } from '@ark-ui/react/toggle'\n\n/**\n * This module provides the Toggle primitives.\n * @module 'react/toggle'\n */\n\n/**\n * The ToggleRoot is used to manage the state of the Toggle component.\n */\nexport const ToggleRoot = Toggle.Root\n\n/**\n * The ToggleIndicator is used to render the indicator of the Toggle component\n * based on the pressed state.\n */\nexport const ToggleIndicator = Toggle.Indicator\n","import type { ElementType } from 'react'\nimport { ToggleRoot, ToggleIndicator } from './primitives'\n\n/**\n * This module contains the parts of the Toggle parts.\n * @module 'toggle/parts'\n */\n\ninterface TogglePartsValue {\n /**\n * The container of the toggle.\n */\n Root: ElementType\n /**\n * The indicator that appears when a toggle is pressed.\n */\n Indicator: ElementType\n}\n\n/**\n * An Object containing the parts of the Radio component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the RadioParts object and\n * the entire family of components vs. only what you use.\n */\nexport const ToggleParts: TogglePartsValue = {\n Root: ToggleRoot,\n Indicator: ToggleIndicator,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAuB;AAUhB,IAAM,aAAa,qBAAO;AAM1B,IAAM,kBAAkB,qBAAO;;;ACY/B,IAAM,cAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,WAAW;AACb;","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
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/toggle/parts.ts
|
|
21
|
+
var parts_exports = {};
|
|
22
|
+
__export(parts_exports, {
|
|
23
|
+
ToggleParts: () => ToggleParts
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(parts_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/toggle/primitives.tsx
|
|
28
|
+
var import_toggle = require("@ark-ui/react/toggle");
|
|
29
|
+
var ToggleRoot = import_toggle.Toggle.Root;
|
|
30
|
+
var ToggleIndicator = import_toggle.Toggle.Indicator;
|
|
31
|
+
|
|
32
|
+
// src/components/toggle/parts.ts
|
|
33
|
+
var ToggleParts = {
|
|
34
|
+
Root: ToggleRoot,
|
|
35
|
+
Indicator: ToggleIndicator
|
|
36
|
+
};
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
ToggleParts
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=parts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/toggle/parts.ts","../../../../src/components/toggle/primitives.tsx"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ToggleRoot, ToggleIndicator } from './primitives'\n\n/**\n * This module contains the parts of the Toggle parts.\n * @module 'toggle/parts'\n */\n\ninterface TogglePartsValue {\n /**\n * The container of the toggle.\n */\n Root: ElementType\n /**\n * The indicator that appears when a toggle is pressed.\n */\n Indicator: ElementType\n}\n\n/**\n * An Object containing the parts of the Radio component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the RadioParts object and\n * the entire family of components vs. only what you use.\n */\nexport const ToggleParts: TogglePartsValue = {\n Root: ToggleRoot,\n Indicator: ToggleIndicator,\n}\n","import { Toggle } from '@ark-ui/react/toggle'\n\n/**\n * This module provides the Toggle primitives.\n * @module 'react/toggle'\n */\n\n/**\n * The ToggleRoot is used to manage the state of the Toggle component.\n */\nexport const ToggleRoot = Toggle.Root\n\n/**\n * The ToggleIndicator is used to render the indicator of the Toggle component\n * based on the pressed state.\n */\nexport const ToggleIndicator = Toggle.Indicator\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAuB;AAUhB,IAAM,aAAa,qBAAO;AAM1B,IAAM,kBAAkB,qBAAO;;;ADY/B,IAAM,cAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,WAAW;AACb;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
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/toggle/primitives.tsx
|
|
21
|
+
var primitives_exports = {};
|
|
22
|
+
__export(primitives_exports, {
|
|
23
|
+
ToggleIndicator: () => ToggleIndicator,
|
|
24
|
+
ToggleRoot: () => ToggleRoot
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(primitives_exports);
|
|
27
|
+
var import_toggle = require("@ark-ui/react/toggle");
|
|
28
|
+
var ToggleRoot = import_toggle.Toggle.Root;
|
|
29
|
+
var ToggleIndicator = import_toggle.Toggle.Indicator;
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
ToggleIndicator,
|
|
33
|
+
ToggleRoot
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=primitives.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/toggle/primitives.tsx"],"sourcesContent":["import { Toggle } from '@ark-ui/react/toggle'\n\n/**\n * This module provides the Toggle primitives.\n * @module 'react/toggle'\n */\n\n/**\n * The ToggleRoot is used to manage the state of the Toggle component.\n */\nexport const ToggleRoot = Toggle.Root\n\n/**\n * The ToggleIndicator is used to render the indicator of the Toggle component\n * based on the pressed state.\n */\nexport const ToggleIndicator = Toggle.Indicator\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAUhB,IAAM,aAAa,qBAAO;AAM1B,IAAM,kBAAkB,qBAAO;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useToggle.ts"],"sourcesContent":["'use client'\n\nimport { useCallback, useMemo, useState, type ChangeEvent } from 'react'\n\n/**\n * This module provides a hook for using a toggle.\n * @module useToggle\n */\n\nexport interface UseToggleOptions {\n /**\n * The initial checked state.\n */\n checked?: string\n /**\n * Called when the checked state changes.\n */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void\n}\nexport interface ToggleHookReturn {\n /**\n * The checked state.\n */\n checked: string\n /**\n * A custom handler to be called when the checked state changes.\n */\n handleChange: (e: ChangeEvent<HTMLInputElement>) => void\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/useToggle.ts"],"sourcesContent":["'use client'\n\nimport { useCallback, useMemo, useState, type ChangeEvent } from 'react'\n\n/**\n * This module provides a hook for using a toggle.\n * @module useToggle\n */\n\nexport interface UseToggleOptions {\n /**\n * The initial checked state.\n */\n checked?: string\n /**\n * Called when the checked state changes.\n */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void\n}\nexport interface ToggleHookReturn {\n /**\n * The checked state.\n */\n checked: string\n /**\n * A custom handler to be called when the checked state changes.\n */\n handleChange: (e: ChangeEvent<HTMLInputElement>) => void\n}\n\n/**\n * @deprecated Will be removed in v1. Use ToggleParts instead.\n */\nexport function useToggle(options?: UseToggleOptions): ToggleHookReturn {\n const [checked, setChecked] = useState<string>(options?.checked ?? '')\n const onChange = options?.onChange\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const target = e.currentTarget as HTMLInputElement\n setChecked((prev) => {\n return prev === target.value ? '' : target.value\n })\n onChange?.(e)\n },\n [onChange],\n )\n\n return useMemo(() => ({ checked, handleChange }), [checked, handleChange])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAiE;AA+B1D,SAAS,UAAU,SAA8C;AACtE,QAAM,CAAC,SAAS,UAAU,QAAI,wBAAiB,mCAAS,YAAW,EAAE;AACrE,QAAM,WAAW,mCAAS;AAE1B,QAAM,mBAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,YAAM,SAAS,EAAE;AACjB,iBAAW,CAAC,SAAS;AACnB,eAAO,SAAS,OAAO,QAAQ,KAAK,OAAO;AAAA,MAC7C,CAAC;AACD,2CAAW;AAAA,IACb;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,aAAO,sBAAQ,OAAO,EAAE,SAAS,aAAa,IAAI,CAAC,SAAS,YAAY,CAAC;AAC3E;","names":[]}
|