@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
package/src/index.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from './components/deprecated/NavMenuTrigger'
|
|
|
16
16
|
export * from './components/deprecated/NavMenuList'
|
|
17
17
|
export * from './components/deprecated/NavMenuLink'
|
|
18
18
|
export * from './hooks/useDate'
|
|
19
|
+
export * from './hooks/useModal'
|
|
20
|
+
export * from './hooks/useToggle'
|
|
19
21
|
|
|
20
22
|
// components
|
|
21
23
|
|
|
@@ -47,7 +49,10 @@ export * from './components/NotificationDescription'
|
|
|
47
49
|
export * from './components/Portal'
|
|
48
50
|
export * from './components/ProgressBar'
|
|
49
51
|
export * from './components/radio/index'
|
|
52
|
+
export * from './components/select/index'
|
|
53
|
+
export * from './components/Show'
|
|
50
54
|
export * from './components/Spinner'
|
|
55
|
+
export * from './components/switch/index'
|
|
51
56
|
export * from './components/Tabs.client'
|
|
52
57
|
export * from './components/Table'
|
|
53
58
|
export * from './components/Thead'
|
|
@@ -56,11 +61,8 @@ export * from './components/Td'
|
|
|
56
61
|
export * from './components/Tbody'
|
|
57
62
|
export * from './components/Tag'
|
|
58
63
|
export * from './components/Text'
|
|
59
|
-
export * from './components/
|
|
64
|
+
export * from './components/toggle/index'
|
|
60
65
|
export * from './components/Tooltip'
|
|
61
|
-
export * from './components/Select'
|
|
62
|
-
export * from './components/Select.server'
|
|
63
|
-
export * from './components/Show'
|
|
64
66
|
|
|
65
67
|
// context
|
|
66
68
|
|
|
@@ -76,9 +78,7 @@ export * from './context/theme'
|
|
|
76
78
|
|
|
77
79
|
// hooks
|
|
78
80
|
|
|
79
|
-
export * from './hooks/useModal'
|
|
80
81
|
export * from './hooks/useTheme'
|
|
81
|
-
export * from './hooks/useToggle'
|
|
82
82
|
export * from './hooks/useRootColors'
|
|
83
83
|
|
|
84
84
|
// aria-helpers
|
|
@@ -1,142 +0,0 @@
|
|
|
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/Select.tsx
|
|
22
|
-
var Select_exports = {};
|
|
23
|
-
__export(Select_exports, {
|
|
24
|
-
Option: () => Option,
|
|
25
|
-
OptionGroup: () => OptionGroup,
|
|
26
|
-
OptionGroupLabel: () => OptionGroupLabel,
|
|
27
|
-
Select: () => Select,
|
|
28
|
-
createSelectCollection: () => createSelectCollection
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(Select_exports);
|
|
31
|
-
var import_select2 = require("@ark-ui/react/select");
|
|
32
|
-
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
33
|
-
var import_css = require("@cerberus/styled-system/css");
|
|
34
|
-
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
35
|
-
|
|
36
|
-
// src/context/cerberus.tsx
|
|
37
|
-
var import_react = require("react");
|
|
38
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
-
var CerberusContext = (0, import_react.createContext)(null);
|
|
40
|
-
function useCerberusContext() {
|
|
41
|
-
const context = (0, import_react.useContext)(CerberusContext);
|
|
42
|
-
if (!context) {
|
|
43
|
-
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
44
|
-
}
|
|
45
|
-
return context;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// src/components/Portal.tsx
|
|
49
|
-
var import_react2 = require("@ark-ui/react");
|
|
50
|
-
var Portal = import_react2.Portal;
|
|
51
|
-
|
|
52
|
-
// src/components/Show.tsx
|
|
53
|
-
var import_react3 = require("react");
|
|
54
|
-
function Show(props) {
|
|
55
|
-
const { when, children, fallback } = props;
|
|
56
|
-
const condition = (0, import_react3.useMemo)(() => when ?? false, [when]);
|
|
57
|
-
return (0, import_react3.useMemo)(() => {
|
|
58
|
-
if (condition) return children;
|
|
59
|
-
return fallback ?? null;
|
|
60
|
-
}, [condition, children, fallback]);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/components/Select.server.tsx
|
|
64
|
-
var import_select = require("@ark-ui/react/select");
|
|
65
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
66
|
-
function SelectRoot(props) {
|
|
67
|
-
const { children, ...rootProps } = props;
|
|
68
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_select.Select.Root, { ...rootProps, children: [
|
|
69
|
-
children,
|
|
70
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.Select.HiddenSelect, {})
|
|
71
|
-
] });
|
|
72
|
-
}
|
|
73
|
-
var SelectLabel = import_select.Select.Label;
|
|
74
|
-
var SelectControl = import_select.Select.Control;
|
|
75
|
-
var SelectTrigger = import_select.Select.Trigger;
|
|
76
|
-
var SelectValueText = import_select.Select.ValueText;
|
|
77
|
-
var SelectIndicator = import_select.Select.Indicator;
|
|
78
|
-
var SelectClearTrigger = import_select.Select.ClearTrigger;
|
|
79
|
-
var SelectPositioner = import_select.Select.Positioner;
|
|
80
|
-
var SelectContent = import_select.Select.Content;
|
|
81
|
-
var SelectItemGroup = import_select.Select.ItemGroup;
|
|
82
|
-
var SelectItemGroupLabel = import_select.Select.ItemGroupLabel;
|
|
83
|
-
var SelectItem = import_select.Select.Item;
|
|
84
|
-
var SelectItemText = import_select.Select.ItemText;
|
|
85
|
-
var SelectItemIndicator = import_select.Select.ItemIndicator;
|
|
86
|
-
|
|
87
|
-
// src/components/Select.tsx
|
|
88
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
89
|
-
function Select(props) {
|
|
90
|
-
const { collection, placeholder, size, ...rootProps } = props;
|
|
91
|
-
const { icons } = useCerberusContext();
|
|
92
|
-
const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons;
|
|
93
|
-
const styles = (0, import_recipes.select)({ size });
|
|
94
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(SelectRoot, { className: styles.root, collection, ...rootProps, children: [
|
|
95
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectControl, { className: styles.control, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(SelectTrigger, { className: styles.trigger, children: [
|
|
96
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectValueText, { placeholder }),
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx.HStack, { children: [
|
|
98
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: props.invalid, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InvalidIcon, { "data-part": "invalid-icon" }) }),
|
|
99
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectIndicator, { className: styles.indicator, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectArrow, {}) })
|
|
100
|
-
] })
|
|
101
|
-
] }) }),
|
|
102
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectPositioner, { className: styles.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectContent, { className: styles.content, children: props.children }) }) }),
|
|
103
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_select2.Select.HiddenSelect, {})
|
|
104
|
-
] });
|
|
105
|
-
}
|
|
106
|
-
function Option(props) {
|
|
107
|
-
const { item, ...itemProps } = props;
|
|
108
|
-
const { icons } = useCerberusContext();
|
|
109
|
-
const { selectChecked: CheckedIcon } = icons;
|
|
110
|
-
const styles = (0, import_recipes.select)();
|
|
111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(SelectItem, { ...itemProps, item, className: styles.item, children: [
|
|
112
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectItemText, { className: styles.itemText, children: item == null ? void 0 : item.label }),
|
|
113
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectItemIndicator, { className: styles.itemIndicator, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckedIcon, {}) })
|
|
114
|
-
] });
|
|
115
|
-
}
|
|
116
|
-
function OptionGroup(props) {
|
|
117
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectItemGroup, { ...props });
|
|
118
|
-
}
|
|
119
|
-
function OptionGroupLabel(props) {
|
|
120
|
-
const styles = (0, import_recipes.select)();
|
|
121
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
122
|
-
SelectItemGroupLabel,
|
|
123
|
-
{
|
|
124
|
-
...props,
|
|
125
|
-
className: (0, import_css.cx)(props.className, styles.itemGroupLabel)
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function createSelectCollection(collection) {
|
|
130
|
-
return (0, import_select2.createListCollection)({
|
|
131
|
-
items: collection
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
-
0 && (module.exports = {
|
|
136
|
-
Option,
|
|
137
|
-
OptionGroup,
|
|
138
|
-
OptionGroupLabel,
|
|
139
|
-
Select,
|
|
140
|
-
createSelectCollection
|
|
141
|
-
});
|
|
142
|
-
//# sourceMappingURL=Select.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Select.tsx","../../../src/context/cerberus.tsx","../../../src/components/Portal.tsx","../../../src/components/Show.tsx","../../../src/components/Select.server.tsx"],"sourcesContent":["'use client'\n\nimport {\n Select as ArkSelect,\n createListCollection,\n type SelectRootProps,\n type SelectItemProps,\n type SelectItemGroupProps,\n type SelectItemGroupLabelProps,\n type ListCollection,\n type SelectValueChangeDetails,\n} from '@ark-ui/react/select'\nimport {\n select,\n type SelectVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { HStack } from '@cerberus/styled-system/jsx'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Portal } from './Portal'\nimport { Show } from './Show'\nimport {\n SelectContent,\n SelectControl,\n SelectIndicator,\n SelectItem,\n SelectItemGroup,\n SelectItemGroupLabel,\n SelectItemIndicator,\n SelectItemText,\n SelectPositioner,\n SelectRoot,\n SelectTrigger,\n SelectValueText,\n} from './Select.server'\n\n/**\n * This module contains the Select components.\n * @module 'react/select'\n */\n\nexport interface SelectCollectionItem {\n /**\n * What is displayed in the dropdown list.\n */\n label: string\n /**\n * The value of the selected item used in the form.\n */\n value: string\n /**\n * If the item is disabled.\n */\n disabled?: boolean\n}\n\nexport interface SelectCollection {\n /**\n * The items to be displayed in the dropdown list.\n */\n items: SelectCollectionItem[]\n}\n\nexport interface BaseSelectProps {\n /**\n * The placeholder text when no option is selected.\n */\n placeholder?: string\n}\n\nexport type SelectProps = SelectRootProps<SelectCollectionItem> &\n BaseSelectProps &\n SelectVariantProps\n\n/**\n * The Select component is a dropdown list that allows users to select an\n * option from a list.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * import { Select, Option, createListCollection } from '@cerberus-design/react'\n *\n * export function SelectBasicPreview() {\n * const collection = createListCollection({\n * items: [\n * { label: 'Hades', value: 'hades' },\n * { label: 'Persephone', value: 'persephone' },\n * { label: 'Zeus', value: 'zeus', disabled: true },\n * ]\n * })\n *\n * return (\n * <Select\n * collection={collection}\n * label=\"Select Relative\"\n * placeholder=\"Choose option\"\n * >\n * {collection.items.map((item) => (\n * <Option key={item.value} item={item} />\n * ))}\n * </Select>\n * )\n * }\n */\nexport function Select(props: SelectProps) {\n const { collection, placeholder, size, ...rootProps } = props\n const { icons } = useCerberusContext()\n const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons\n\n const styles = select({ size })\n\n return (\n <SelectRoot className={styles.root} collection={collection} {...rootProps}>\n <SelectControl className={styles.control}>\n <SelectTrigger className={styles.trigger}>\n <SelectValueText placeholder={placeholder} />\n\n <HStack>\n <Show when={props.invalid}>\n <InvalidIcon data-part=\"invalid-icon\" />\n </Show>\n <SelectIndicator className={styles.indicator}>\n <SelectArrow />\n </SelectIndicator>\n </HStack>\n </SelectTrigger>\n </SelectControl>\n\n <Portal>\n <SelectPositioner className={styles.positioner}>\n <SelectContent className={styles.content}>\n {props.children}\n </SelectContent>\n </SelectPositioner>\n </Portal>\n\n <ArkSelect.HiddenSelect />\n </SelectRoot>\n )\n}\n\nexport interface OptionProps extends SelectItemProps {\n /**\n * The CollectionListItem to be displayed in the dropdown list.\n */\n item: SelectCollectionItem\n}\n\nexport function Option(props: OptionProps) {\n const { item, ...itemProps } = props\n\n const { icons } = useCerberusContext()\n const { selectChecked: CheckedIcon } = icons\n\n const styles = select()\n\n return (\n <SelectItem {...itemProps} item={item} className={styles.item}>\n <SelectItemText className={styles.itemText}>{item?.label}</SelectItemText>\n <SelectItemIndicator className={styles.itemIndicator}>\n <CheckedIcon />\n </SelectItemIndicator>\n </SelectItem>\n )\n}\n\n/**\n * The OptionGroup component is a group of options in the dropdown list.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * <OptionGroup>\n * <OptionGroupLabel>Greek gods</OptionGroupLabel>\n * ...\n * </OptionGroup>\n * ```\n */\nexport function OptionGroup(props: SelectItemGroupProps) {\n return <SelectItemGroup {...props} />\n}\n\n/**\n * The OptionGroupLabel component is the label of the OptionGroup.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * <OptionGroupLabel>Greek gods</OptionGroupLabel>\n * ```\n */\nexport function OptionGroupLabel(props: SelectItemGroupLabelProps) {\n const styles = select()\n return (\n <SelectItemGroupLabel\n {...props}\n className={cx(props.className, styles.itemGroupLabel)}\n />\n )\n}\n\n/**\n * A helper function to create a SelectCollection object.\n * @param collection - An array of SelectCollectionItem objects that matches\n * the following shape:\n * ```ts\n * [{ label: 'Hades', value: 'hades', disabled?: true }]\n * ```\n */\nexport function createSelectCollection(\n collection: SelectCollectionItem[],\n): ListCollection<SelectCollectionItem> {\n return createListCollection({\n items: collection,\n })\n}\n\nexport type { SelectValueChangeDetails, ListCollection }\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","import {\n Portal as ArkPortal,\n type PortalProps as ArkPortalProps,\n} from '@ark-ui/react'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport type PortalProps = ArkPortalProps\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @see https://cerberus.digitalu.design/react/portal\n * @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)\n * @example\n * ```tsx\n * 'use client'\n *\n * import { Portal } from '@cerberus/react'\n *\n * function SomeFeatureWithinSSRPage() {\n * return (\n * <Portal>\n * <div>Portal Content outside of the React VDom tree</div>\n * </Portal>\n * )\n * }\n */\nexport const Portal = ArkPortal\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 { Select as ArkSelect, type SelectRootProps } from '@ark-ui/react/select'\nimport type { SelectCollectionItem } from './Select'\n\n/**\n * Select Primitive: The context provider for the Select family\n */\nexport function SelectRoot(props: SelectRootProps<SelectCollectionItem>) {\n const { children, ...rootProps } = props\n return (\n <ArkSelect.Root {...rootProps}>\n {children}\n <ArkSelect.HiddenSelect />\n </ArkSelect.Root>\n )\n}\n\n/**\n * Select Primitive: The label that appears above the select input\n */\nexport const SelectLabel = ArkSelect.Label\n\n/**\n * Select Primitive: The wrapper to the select trigger that opens the dropdown\n */\nexport const SelectControl = ArkSelect.Control\n\n/**\n * Select Primitive: The trigger that opens the dropdown\n */\nexport const SelectTrigger = ArkSelect.Trigger\n\n/**\n * Select Primitive: The text that appears in the trigger\n */\nexport const SelectValueText = ArkSelect.ValueText\n\n/**\n * Select Primitive: The indicator that appears in the trigger\n */\nexport const SelectIndicator = ArkSelect.Indicator\n\n/**\n * Select Primitive: The trigger that clears the selected value\n */\nexport const SelectClearTrigger = ArkSelect.ClearTrigger\n\n/**\n * Select Primitive: The positioner that contains the dropdown\n */\nexport const SelectPositioner = ArkSelect.Positioner\n\n/**\n * Select Primitive: The content of the dropdown (i.e. the container itself)\n */\nexport const SelectContent = ArkSelect.Content\n\n/**\n * Select Primitive: The container for a group of item options\n */\nexport const SelectItemGroup = ArkSelect.ItemGroup\n\n/**\n * Select Primitive: The label for a group of item options\n */\nexport const SelectItemGroupLabel = ArkSelect.ItemGroupLabel\n\n/**\n * Select Primitive: The container for an item option\n */\nexport const SelectItem = ArkSelect.Item\n\n/**\n * Select Primitive: The text for an item option\n */\nexport const SelectItemText = ArkSelect.ItemText\n\n/**\n * Select Primitive: The indicator for an item option\n */\nexport const SelectItemIndicator = ArkSelect.ItemIndicator\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,iBASO;AACP,qBAGO;AACP,iBAAmB;AACnB,iBAAuB;;;ACfvB,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;;;AC3CA,IAAAC,gBAGO;AA2BA,IAAM,SAAS,cAAAC;;;AC5BtB,IAAAC,gBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,uBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,uBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;ACtCA,oBAA0D;AAStD,IAAAC,sBAAA;AAHG,SAAS,WAAW,OAA8C;AACvE,QAAM,EAAE,UAAU,GAAG,UAAU,IAAI;AACnC,SACE,8CAAC,cAAAC,OAAU,MAAV,EAAgB,GAAG,WACjB;AAAA;AAAA,IACD,6CAAC,cAAAA,OAAU,cAAV,EAAuB;AAAA,KAC1B;AAEJ;AAKO,IAAM,cAAc,cAAAA,OAAU;AAK9B,IAAM,gBAAgB,cAAAA,OAAU;AAKhC,IAAM,gBAAgB,cAAAA,OAAU;AAKhC,IAAM,kBAAkB,cAAAA,OAAU;AAKlC,IAAM,kBAAkB,cAAAA,OAAU;AAKlC,IAAM,qBAAqB,cAAAA,OAAU;AAKrC,IAAM,mBAAmB,cAAAA,OAAU;AAKnC,IAAM,gBAAgB,cAAAA,OAAU;AAKhC,IAAM,kBAAkB,cAAAA,OAAU;AAKlC,IAAM,uBAAuB,cAAAA,OAAU;AAKvC,IAAM,aAAa,cAAAA,OAAU;AAK7B,IAAM,iBAAiB,cAAAA,OAAU;AAKjC,IAAM,sBAAsB,cAAAA,OAAU;;;AJqCnC,IAAAC,sBAAA;AAXH,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,YAAY,aAAa,MAAM,GAAG,UAAU,IAAI;AACxD,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,aAAa,aAAa,SAAS,YAAY,IAAI;AAE3D,QAAM,aAAS,uBAAO,EAAE,KAAK,CAAC;AAE9B,SACE,8CAAC,cAAW,WAAW,OAAO,MAAM,YAAyB,GAAG,WAC9D;AAAA,iDAAC,iBAAc,WAAW,OAAO,SAC/B,wDAAC,iBAAc,WAAW,OAAO,SAC/B;AAAA,mDAAC,mBAAgB,aAA0B;AAAA,MAE3C,8CAAC,qBACC;AAAA,qDAAC,QAAK,MAAM,MAAM,SAChB,uDAAC,eAAY,aAAU,gBAAe,GACxC;AAAA,QACA,6CAAC,mBAAgB,WAAW,OAAO,WACjC,uDAAC,eAAY,GACf;AAAA,SACF;AAAA,OACF,GACF;AAAA,IAEA,6CAAC,UACC,uDAAC,oBAAiB,WAAW,OAAO,YAClC,uDAAC,iBAAc,WAAW,OAAO,SAC9B,gBAAM,UACT,GACF,GACF;AAAA,IAEA,6CAAC,eAAAC,OAAU,cAAV,EAAuB;AAAA,KAC1B;AAEJ;AASO,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,UAAU,IAAI;AAE/B,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,eAAe,YAAY,IAAI;AAEvC,QAAM,aAAS,uBAAO;AAEtB,SACE,8CAAC,cAAY,GAAG,WAAW,MAAY,WAAW,OAAO,MACvD;AAAA,iDAAC,kBAAe,WAAW,OAAO,UAAW,uCAAM,OAAM;AAAA,IACzD,6CAAC,uBAAoB,WAAW,OAAO,eACrC,uDAAC,eAAY,GACf;AAAA,KACF;AAEJ;AAcO,SAAS,YAAY,OAA6B;AACvD,SAAO,6CAAC,mBAAiB,GAAG,OAAO;AACrC;AAWO,SAAS,iBAAiB,OAAkC;AACjE,QAAM,aAAS,uBAAO;AACtB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,MAAM,WAAW,OAAO,cAAc;AAAA;AAAA,EACtD;AAEJ;AAUO,SAAS,uBACd,YACsC;AACtC,aAAO,qCAAqB;AAAA,IAC1B,OAAO;AAAA,EACT,CAAC;AACH;","names":["import_select","import_react","ArkPortal","import_react","import_jsx_runtime","ArkSelect","import_jsx_runtime","ArkSelect"]}
|
|
@@ -1,78 +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/Select.server.tsx
|
|
21
|
-
var Select_server_exports = {};
|
|
22
|
-
__export(Select_server_exports, {
|
|
23
|
-
SelectClearTrigger: () => SelectClearTrigger,
|
|
24
|
-
SelectContent: () => SelectContent,
|
|
25
|
-
SelectControl: () => SelectControl,
|
|
26
|
-
SelectIndicator: () => SelectIndicator,
|
|
27
|
-
SelectItem: () => SelectItem,
|
|
28
|
-
SelectItemGroup: () => SelectItemGroup,
|
|
29
|
-
SelectItemGroupLabel: () => SelectItemGroupLabel,
|
|
30
|
-
SelectItemIndicator: () => SelectItemIndicator,
|
|
31
|
-
SelectItemText: () => SelectItemText,
|
|
32
|
-
SelectLabel: () => SelectLabel,
|
|
33
|
-
SelectPositioner: () => SelectPositioner,
|
|
34
|
-
SelectRoot: () => SelectRoot,
|
|
35
|
-
SelectTrigger: () => SelectTrigger,
|
|
36
|
-
SelectValueText: () => SelectValueText
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(Select_server_exports);
|
|
39
|
-
var import_select = require("@ark-ui/react/select");
|
|
40
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
-
function SelectRoot(props) {
|
|
42
|
-
const { children, ...rootProps } = props;
|
|
43
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_select.Select.Root, { ...rootProps, children: [
|
|
44
|
-
children,
|
|
45
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.HiddenSelect, {})
|
|
46
|
-
] });
|
|
47
|
-
}
|
|
48
|
-
var SelectLabel = import_select.Select.Label;
|
|
49
|
-
var SelectControl = import_select.Select.Control;
|
|
50
|
-
var SelectTrigger = import_select.Select.Trigger;
|
|
51
|
-
var SelectValueText = import_select.Select.ValueText;
|
|
52
|
-
var SelectIndicator = import_select.Select.Indicator;
|
|
53
|
-
var SelectClearTrigger = import_select.Select.ClearTrigger;
|
|
54
|
-
var SelectPositioner = import_select.Select.Positioner;
|
|
55
|
-
var SelectContent = import_select.Select.Content;
|
|
56
|
-
var SelectItemGroup = import_select.Select.ItemGroup;
|
|
57
|
-
var SelectItemGroupLabel = import_select.Select.ItemGroupLabel;
|
|
58
|
-
var SelectItem = import_select.Select.Item;
|
|
59
|
-
var SelectItemText = import_select.Select.ItemText;
|
|
60
|
-
var SelectItemIndicator = import_select.Select.ItemIndicator;
|
|
61
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
-
0 && (module.exports = {
|
|
63
|
-
SelectClearTrigger,
|
|
64
|
-
SelectContent,
|
|
65
|
-
SelectControl,
|
|
66
|
-
SelectIndicator,
|
|
67
|
-
SelectItem,
|
|
68
|
-
SelectItemGroup,
|
|
69
|
-
SelectItemGroupLabel,
|
|
70
|
-
SelectItemIndicator,
|
|
71
|
-
SelectItemText,
|
|
72
|
-
SelectLabel,
|
|
73
|
-
SelectPositioner,
|
|
74
|
-
SelectRoot,
|
|
75
|
-
SelectTrigger,
|
|
76
|
-
SelectValueText
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=Select.server.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Select.server.tsx"],"sourcesContent":["import { Select as ArkSelect, type SelectRootProps } from '@ark-ui/react/select'\nimport type { SelectCollectionItem } from './Select'\n\n/**\n * Select Primitive: The context provider for the Select family\n */\nexport function SelectRoot(props: SelectRootProps<SelectCollectionItem>) {\n const { children, ...rootProps } = props\n return (\n <ArkSelect.Root {...rootProps}>\n {children}\n <ArkSelect.HiddenSelect />\n </ArkSelect.Root>\n )\n}\n\n/**\n * Select Primitive: The label that appears above the select input\n */\nexport const SelectLabel = ArkSelect.Label\n\n/**\n * Select Primitive: The wrapper to the select trigger that opens the dropdown\n */\nexport const SelectControl = ArkSelect.Control\n\n/**\n * Select Primitive: The trigger that opens the dropdown\n */\nexport const SelectTrigger = ArkSelect.Trigger\n\n/**\n * Select Primitive: The text that appears in the trigger\n */\nexport const SelectValueText = ArkSelect.ValueText\n\n/**\n * Select Primitive: The indicator that appears in the trigger\n */\nexport const SelectIndicator = ArkSelect.Indicator\n\n/**\n * Select Primitive: The trigger that clears the selected value\n */\nexport const SelectClearTrigger = ArkSelect.ClearTrigger\n\n/**\n * Select Primitive: The positioner that contains the dropdown\n */\nexport const SelectPositioner = ArkSelect.Positioner\n\n/**\n * Select Primitive: The content of the dropdown (i.e. the container itself)\n */\nexport const SelectContent = ArkSelect.Content\n\n/**\n * Select Primitive: The container for a group of item options\n */\nexport const SelectItemGroup = ArkSelect.ItemGroup\n\n/**\n * Select Primitive: The label for a group of item options\n */\nexport const SelectItemGroupLabel = ArkSelect.ItemGroupLabel\n\n/**\n * Select Primitive: The container for an item option\n */\nexport const SelectItem = ArkSelect.Item\n\n/**\n * Select Primitive: The text for an item option\n */\nexport const SelectItemText = ArkSelect.ItemText\n\n/**\n * Select Primitive: The indicator for an item option\n */\nexport const SelectItemIndicator = ArkSelect.ItemIndicator\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0D;AAStD;AAHG,SAAS,WAAW,OAA8C;AACvE,QAAM,EAAE,UAAU,GAAG,UAAU,IAAI;AACnC,SACE,6CAAC,cAAAA,OAAU,MAAV,EAAgB,GAAG,WACjB;AAAA;AAAA,IACD,4CAAC,cAAAA,OAAU,cAAV,EAAuB;AAAA,KAC1B;AAEJ;AAKO,IAAM,cAAc,cAAAA,OAAU;AAK9B,IAAM,gBAAgB,cAAAA,OAAU;AAKhC,IAAM,gBAAgB,cAAAA,OAAU;AAKhC,IAAM,kBAAkB,cAAAA,OAAU;AAKlC,IAAM,kBAAkB,cAAAA,OAAU;AAKlC,IAAM,qBAAqB,cAAAA,OAAU;AAKrC,IAAM,mBAAmB,cAAAA,OAAU;AAKnC,IAAM,gBAAgB,cAAAA,OAAU;AAKhC,IAAM,kBAAkB,cAAAA,OAAU;AAKlC,IAAM,uBAAuB,cAAAA,OAAU;AAKvC,IAAM,aAAa,cAAAA,OAAU;AAK7B,IAAM,iBAAiB,cAAAA,OAAU;AAKjC,IAAM,sBAAsB,cAAAA,OAAU;","names":["ArkSelect"]}
|
|
@@ -1,94 +0,0 @@
|
|
|
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/Toggle.tsx
|
|
22
|
-
var Toggle_exports = {};
|
|
23
|
-
__export(Toggle_exports, {
|
|
24
|
-
Toggle: () => Toggle
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(Toggle_exports);
|
|
27
|
-
var import_field = require("@ark-ui/react/field");
|
|
28
|
-
var import_css = require("@cerberus/styled-system/css");
|
|
29
|
-
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
30
|
-
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
31
|
-
|
|
32
|
-
// src/context/cerberus.tsx
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var CerberusContext = (0, import_react.createContext)(null);
|
|
36
|
-
function useCerberusContext() {
|
|
37
|
-
const context = (0, import_react.useContext)(CerberusContext);
|
|
38
|
-
if (!context) {
|
|
39
|
-
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
40
|
-
}
|
|
41
|
-
return context;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/components/Toggle.tsx
|
|
45
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
46
|
-
function Toggle(props) {
|
|
47
|
-
const { size, ...nativeProps } = props;
|
|
48
|
-
const styles = (0, import_recipes.toggle)({ size });
|
|
49
|
-
const { invalid, disabled, readOnly, required, ariaDescribedby } = (0, import_field.useFieldContext)();
|
|
50
|
-
const { icons } = useCerberusContext();
|
|
51
|
-
const CheckedIcon = icons.toggleChecked;
|
|
52
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
53
|
-
"span",
|
|
54
|
-
{
|
|
55
|
-
className: (0, import_css.cx)("group", styles.track, (0, import_patterns.hstack)()),
|
|
56
|
-
"data-checked": props.checked || props.defaultChecked,
|
|
57
|
-
children: [
|
|
58
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
59
|
-
"input",
|
|
60
|
-
{
|
|
61
|
-
...nativeProps,
|
|
62
|
-
...disabled && { disabled: true },
|
|
63
|
-
...readOnly && { readOnly: true },
|
|
64
|
-
...required && { required: true },
|
|
65
|
-
...ariaDescribedby && {
|
|
66
|
-
"aria-describedby": ariaDescribedby
|
|
67
|
-
},
|
|
68
|
-
...invalid && { "aria-invalid": true },
|
|
69
|
-
className: (0, import_css.cx)("peer", styles.input),
|
|
70
|
-
role: "switch",
|
|
71
|
-
type: "checkbox"
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
75
|
-
"span",
|
|
76
|
-
{
|
|
77
|
-
className: (0, import_css.cx)(
|
|
78
|
-
styles.thumb,
|
|
79
|
-
(0, import_patterns.vstack)({
|
|
80
|
-
justify: "center"
|
|
81
|
-
})
|
|
82
|
-
),
|
|
83
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckedIcon, {})
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
-
0 && (module.exports = {
|
|
92
|
-
Toggle
|
|
93
|
-
});
|
|
94
|
-
//# sourceMappingURL=Toggle.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Toggle.tsx","../../../src/context/cerberus.tsx"],"sourcesContent":["'use client'\n\nimport { useFieldContext } from '@ark-ui/react/field'\nimport type { InputHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n toggle,\n type ToggleVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module provides a toggle component.\n * @module\n */\n\nexport type ToggleBase = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'id' | 'value'\n> & {\n /**\n * @deprecated\n */\n describedBy?: string\n /**\n * A unique identifier for the Toggle. Required for accessibility.\n */\n id: string\n /**\n * The value of the Toggle.\n */\n value: string\n}\nexport type ToggleProps = ToggleBase & ToggleVariantProps\n\n/**\n * The Toggle component is used to switch between two states. Optionally\n * combine with the `useToggle` hook.\n * @see https://cerberus.digitalu.design/react/toggle\n * @example\n * ```tsx\n * const { checked, handleChange } = useToggle({ checked: 'toggle' })\n *\n * <Hstack justify=\"space-between\" w=\"full\">\n * <Field>\n * <Label htmlFor=\"toggle\">Show notifications</Label>\n * <Toggle\n * checked={checked === 'toggle'}\n * id=\"toggle\"\n * onChange={handleChange}\n * value=\"toggle\"\n * />\n * </Field>\n * </Hstack>\n * ```\n */\nexport function Toggle(props: ToggleProps) {\n const { size, ...nativeProps } = props\n const styles = toggle({ size })\n\n const { invalid, disabled, readOnly, required, ariaDescribedby } =\n useFieldContext()\n\n const { icons } = useCerberusContext()\n const CheckedIcon = icons.toggleChecked\n\n return (\n <span\n className={cx('group', styles.track, hstack())}\n data-checked={props.checked || props.defaultChecked}\n >\n <input\n {...nativeProps}\n {...(disabled && { disabled: true })}\n {...(readOnly && { readOnly: true })}\n {...(required && { required: true })}\n {...(ariaDescribedby && {\n 'aria-describedby': ariaDescribedby,\n })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', styles.input)}\n role=\"switch\"\n type=\"checkbox\"\n />\n <span\n className={cx(\n styles.thumb,\n vstack({\n justify: 'center',\n }),\n )}\n >\n <CheckedIcon />\n </span>\n </span>\n )\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;AAEA,mBAAgC;AAEhC,iBAAmB;AACnB,sBAA+B;AAC/B,qBAGO;;;ACPP,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;;;ADyBI,IAAAA,sBAAA;AAXG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,QAAM,aAAS,uBAAO,EAAE,KAAK,CAAC;AAE9B,QAAM,EAAE,SAAS,UAAU,UAAU,UAAU,gBAAgB,QAC7D,8BAAgB;AAElB,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,cAAc,MAAM;AAE1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,eAAG,SAAS,OAAO,WAAO,wBAAO,CAAC;AAAA,MAC7C,gBAAc,MAAM,WAAW,MAAM;AAAA,MAErC;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,mBAAmB;AAAA,cACtB,oBAAoB;AAAA,YACtB;AAAA,YACC,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,eAAW,eAAG,QAAQ,OAAO,KAAK;AAAA,YAClC,MAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW;AAAA,cACT,OAAO;AAAA,kBACP,wBAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,YACH;AAAA,YAEA,uDAAC,eAAY;AAAA;AAAA,QACf;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_jsx_runtime"]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useCerberusContext
|
|
3
|
-
} from "./chunk-GITT5645.js";
|
|
4
|
-
|
|
5
|
-
// src/components/Toggle.tsx
|
|
6
|
-
import { useFieldContext } from "@ark-ui/react/field";
|
|
7
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
8
|
-
import { hstack, vstack } from "@cerberus/styled-system/patterns";
|
|
9
|
-
import {
|
|
10
|
-
toggle
|
|
11
|
-
} from "@cerberus/styled-system/recipes";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
function Toggle(props) {
|
|
14
|
-
const { size, ...nativeProps } = props;
|
|
15
|
-
const styles = toggle({ size });
|
|
16
|
-
const { invalid, disabled, readOnly, required, ariaDescribedby } = useFieldContext();
|
|
17
|
-
const { icons } = useCerberusContext();
|
|
18
|
-
const CheckedIcon = icons.toggleChecked;
|
|
19
|
-
return /* @__PURE__ */ jsxs(
|
|
20
|
-
"span",
|
|
21
|
-
{
|
|
22
|
-
className: cx("group", styles.track, hstack()),
|
|
23
|
-
"data-checked": props.checked || props.defaultChecked,
|
|
24
|
-
children: [
|
|
25
|
-
/* @__PURE__ */ jsx(
|
|
26
|
-
"input",
|
|
27
|
-
{
|
|
28
|
-
...nativeProps,
|
|
29
|
-
...disabled && { disabled: true },
|
|
30
|
-
...readOnly && { readOnly: true },
|
|
31
|
-
...required && { required: true },
|
|
32
|
-
...ariaDescribedby && {
|
|
33
|
-
"aria-describedby": ariaDescribedby
|
|
34
|
-
},
|
|
35
|
-
...invalid && { "aria-invalid": true },
|
|
36
|
-
className: cx("peer", styles.input),
|
|
37
|
-
role: "switch",
|
|
38
|
-
type: "checkbox"
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
/* @__PURE__ */ jsx(
|
|
42
|
-
"span",
|
|
43
|
-
{
|
|
44
|
-
className: cx(
|
|
45
|
-
styles.thumb,
|
|
46
|
-
vstack({
|
|
47
|
-
justify: "center"
|
|
48
|
-
})
|
|
49
|
-
),
|
|
50
|
-
children: /* @__PURE__ */ jsx(CheckedIcon, {})
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export {
|
|
59
|
-
Toggle
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=chunk-GENS32QO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Toggle.tsx"],"sourcesContent":["'use client'\n\nimport { useFieldContext } from '@ark-ui/react/field'\nimport type { InputHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n toggle,\n type ToggleVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module provides a toggle component.\n * @module\n */\n\nexport type ToggleBase = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'id' | 'value'\n> & {\n /**\n * @deprecated\n */\n describedBy?: string\n /**\n * A unique identifier for the Toggle. Required for accessibility.\n */\n id: string\n /**\n * The value of the Toggle.\n */\n value: string\n}\nexport type ToggleProps = ToggleBase & ToggleVariantProps\n\n/**\n * The Toggle component is used to switch between two states. Optionally\n * combine with the `useToggle` hook.\n * @see https://cerberus.digitalu.design/react/toggle\n * @example\n * ```tsx\n * const { checked, handleChange } = useToggle({ checked: 'toggle' })\n *\n * <Hstack justify=\"space-between\" w=\"full\">\n * <Field>\n * <Label htmlFor=\"toggle\">Show notifications</Label>\n * <Toggle\n * checked={checked === 'toggle'}\n * id=\"toggle\"\n * onChange={handleChange}\n * value=\"toggle\"\n * />\n * </Field>\n * </Hstack>\n * ```\n */\nexport function Toggle(props: ToggleProps) {\n const { size, ...nativeProps } = props\n const styles = toggle({ size })\n\n const { invalid, disabled, readOnly, required, ariaDescribedby } =\n useFieldContext()\n\n const { icons } = useCerberusContext()\n const CheckedIcon = icons.toggleChecked\n\n return (\n <span\n className={cx('group', styles.track, hstack())}\n data-checked={props.checked || props.defaultChecked}\n >\n <input\n {...nativeProps}\n {...(disabled && { disabled: true })}\n {...(readOnly && { readOnly: true })}\n {...(required && { required: true })}\n {...(ariaDescribedby && {\n 'aria-describedby': ariaDescribedby,\n })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', styles.input)}\n role=\"switch\"\n type=\"checkbox\"\n />\n <span\n className={cx(\n styles.thumb,\n vstack({\n justify: 'center',\n }),\n )}\n >\n <CheckedIcon />\n </span>\n </span>\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,uBAAuB;AAEhC,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AA2DH,SAIE,KAJF;AAXG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,QAAM,SAAS,OAAO,EAAE,KAAK,CAAC;AAE9B,QAAM,EAAE,SAAS,UAAU,UAAU,UAAU,gBAAgB,IAC7D,gBAAgB;AAElB,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,cAAc,MAAM;AAE1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS,OAAO,OAAO,OAAO,CAAC;AAAA,MAC7C,gBAAc,MAAM,WAAW,MAAM;AAAA,MAErC;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,mBAAmB;AAAA,cACtB,oBAAoB;AAAA,YACtB;AAAA,YACC,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,WAAW,GAAG,QAAQ,OAAO,KAAK;AAAA,YAClC,MAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT,OAAO;AAAA,cACP,OAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,YACH;AAAA,YAEA,8BAAC,eAAY;AAAA;AAAA,QACf;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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 * Provides a hook for using a toggle.\n * @see https://cerberus.digitalu.design/react/use-toggle\n * @memberof module:Toggle\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":";AAEA,SAAS,aAAa,SAAS,gBAAkC;AAiC1D,SAAS,UAAU,SAA8C;AACtE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAiB,SAAS,WAAW,EAAE;AACrE,QAAM,WAAW,SAAS;AAE1B,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,YAAM,SAAS,EAAE;AACjB,iBAAW,CAAC,SAAS;AACnB,eAAO,SAAS,OAAO,QAAQ,KAAK,OAAO;AAAA,MAC7C,CAAC;AACD,iBAAW,CAAC;AAAA,IACd;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,SAAO,QAAQ,OAAO,EAAE,SAAS,aAAa,IAAI,CAAC,SAAS,YAAY,CAAC;AAC3E;","names":[]}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SelectContent,
|
|
3
|
-
SelectControl,
|
|
4
|
-
SelectIndicator,
|
|
5
|
-
SelectItem,
|
|
6
|
-
SelectItemGroup,
|
|
7
|
-
SelectItemGroupLabel,
|
|
8
|
-
SelectItemIndicator,
|
|
9
|
-
SelectItemText,
|
|
10
|
-
SelectPositioner,
|
|
11
|
-
SelectRoot,
|
|
12
|
-
SelectTrigger,
|
|
13
|
-
SelectValueText
|
|
14
|
-
} from "./chunk-YWMPB2JR.js";
|
|
15
|
-
import {
|
|
16
|
-
Portal
|
|
17
|
-
} from "./chunk-IQJDVFPP.js";
|
|
18
|
-
import {
|
|
19
|
-
useCerberusContext
|
|
20
|
-
} from "./chunk-GITT5645.js";
|
|
21
|
-
import {
|
|
22
|
-
Show
|
|
23
|
-
} from "./chunk-BUVVRQLZ.js";
|
|
24
|
-
|
|
25
|
-
// src/components/Select.tsx
|
|
26
|
-
import {
|
|
27
|
-
Select as ArkSelect,
|
|
28
|
-
createListCollection
|
|
29
|
-
} from "@ark-ui/react/select";
|
|
30
|
-
import {
|
|
31
|
-
select
|
|
32
|
-
} from "@cerberus/styled-system/recipes";
|
|
33
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
34
|
-
import { HStack } from "@cerberus/styled-system/jsx";
|
|
35
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
36
|
-
function Select(props) {
|
|
37
|
-
const { collection, placeholder, size, ...rootProps } = props;
|
|
38
|
-
const { icons } = useCerberusContext();
|
|
39
|
-
const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons;
|
|
40
|
-
const styles = select({ size });
|
|
41
|
-
return /* @__PURE__ */ jsxs(SelectRoot, { className: styles.root, collection, ...rootProps, children: [
|
|
42
|
-
/* @__PURE__ */ jsx(SelectControl, { className: styles.control, children: /* @__PURE__ */ jsxs(SelectTrigger, { className: styles.trigger, children: [
|
|
43
|
-
/* @__PURE__ */ jsx(SelectValueText, { placeholder }),
|
|
44
|
-
/* @__PURE__ */ jsxs(HStack, { children: [
|
|
45
|
-
/* @__PURE__ */ jsx(Show, { when: props.invalid, children: /* @__PURE__ */ jsx(InvalidIcon, { "data-part": "invalid-icon" }) }),
|
|
46
|
-
/* @__PURE__ */ jsx(SelectIndicator, { className: styles.indicator, children: /* @__PURE__ */ jsx(SelectArrow, {}) })
|
|
47
|
-
] })
|
|
48
|
-
] }) }),
|
|
49
|
-
/* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(SelectPositioner, { className: styles.positioner, children: /* @__PURE__ */ jsx(SelectContent, { className: styles.content, children: props.children }) }) }),
|
|
50
|
-
/* @__PURE__ */ jsx(ArkSelect.HiddenSelect, {})
|
|
51
|
-
] });
|
|
52
|
-
}
|
|
53
|
-
function Option(props) {
|
|
54
|
-
const { item, ...itemProps } = props;
|
|
55
|
-
const { icons } = useCerberusContext();
|
|
56
|
-
const { selectChecked: CheckedIcon } = icons;
|
|
57
|
-
const styles = select();
|
|
58
|
-
return /* @__PURE__ */ jsxs(SelectItem, { ...itemProps, item, className: styles.item, children: [
|
|
59
|
-
/* @__PURE__ */ jsx(SelectItemText, { className: styles.itemText, children: item?.label }),
|
|
60
|
-
/* @__PURE__ */ jsx(SelectItemIndicator, { className: styles.itemIndicator, children: /* @__PURE__ */ jsx(CheckedIcon, {}) })
|
|
61
|
-
] });
|
|
62
|
-
}
|
|
63
|
-
function OptionGroup(props) {
|
|
64
|
-
return /* @__PURE__ */ jsx(SelectItemGroup, { ...props });
|
|
65
|
-
}
|
|
66
|
-
function OptionGroupLabel(props) {
|
|
67
|
-
const styles = select();
|
|
68
|
-
return /* @__PURE__ */ jsx(
|
|
69
|
-
SelectItemGroupLabel,
|
|
70
|
-
{
|
|
71
|
-
...props,
|
|
72
|
-
className: cx(props.className, styles.itemGroupLabel)
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
function createSelectCollection(collection) {
|
|
77
|
-
return createListCollection({
|
|
78
|
-
items: collection
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export {
|
|
83
|
-
Select,
|
|
84
|
-
Option,
|
|
85
|
-
OptionGroup,
|
|
86
|
-
OptionGroupLabel,
|
|
87
|
-
createSelectCollection
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=chunk-S2X5OEPK.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Select.tsx"],"sourcesContent":["'use client'\n\nimport {\n Select as ArkSelect,\n createListCollection,\n type SelectRootProps,\n type SelectItemProps,\n type SelectItemGroupProps,\n type SelectItemGroupLabelProps,\n type ListCollection,\n type SelectValueChangeDetails,\n} from '@ark-ui/react/select'\nimport {\n select,\n type SelectVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { HStack } from '@cerberus/styled-system/jsx'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Portal } from './Portal'\nimport { Show } from './Show'\nimport {\n SelectContent,\n SelectControl,\n SelectIndicator,\n SelectItem,\n SelectItemGroup,\n SelectItemGroupLabel,\n SelectItemIndicator,\n SelectItemText,\n SelectPositioner,\n SelectRoot,\n SelectTrigger,\n SelectValueText,\n} from './Select.server'\n\n/**\n * This module contains the Select components.\n * @module 'react/select'\n */\n\nexport interface SelectCollectionItem {\n /**\n * What is displayed in the dropdown list.\n */\n label: string\n /**\n * The value of the selected item used in the form.\n */\n value: string\n /**\n * If the item is disabled.\n */\n disabled?: boolean\n}\n\nexport interface SelectCollection {\n /**\n * The items to be displayed in the dropdown list.\n */\n items: SelectCollectionItem[]\n}\n\nexport interface BaseSelectProps {\n /**\n * The placeholder text when no option is selected.\n */\n placeholder?: string\n}\n\nexport type SelectProps = SelectRootProps<SelectCollectionItem> &\n BaseSelectProps &\n SelectVariantProps\n\n/**\n * The Select component is a dropdown list that allows users to select an\n * option from a list.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * import { Select, Option, createListCollection } from '@cerberus-design/react'\n *\n * export function SelectBasicPreview() {\n * const collection = createListCollection({\n * items: [\n * { label: 'Hades', value: 'hades' },\n * { label: 'Persephone', value: 'persephone' },\n * { label: 'Zeus', value: 'zeus', disabled: true },\n * ]\n * })\n *\n * return (\n * <Select\n * collection={collection}\n * label=\"Select Relative\"\n * placeholder=\"Choose option\"\n * >\n * {collection.items.map((item) => (\n * <Option key={item.value} item={item} />\n * ))}\n * </Select>\n * )\n * }\n */\nexport function Select(props: SelectProps) {\n const { collection, placeholder, size, ...rootProps } = props\n const { icons } = useCerberusContext()\n const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons\n\n const styles = select({ size })\n\n return (\n <SelectRoot className={styles.root} collection={collection} {...rootProps}>\n <SelectControl className={styles.control}>\n <SelectTrigger className={styles.trigger}>\n <SelectValueText placeholder={placeholder} />\n\n <HStack>\n <Show when={props.invalid}>\n <InvalidIcon data-part=\"invalid-icon\" />\n </Show>\n <SelectIndicator className={styles.indicator}>\n <SelectArrow />\n </SelectIndicator>\n </HStack>\n </SelectTrigger>\n </SelectControl>\n\n <Portal>\n <SelectPositioner className={styles.positioner}>\n <SelectContent className={styles.content}>\n {props.children}\n </SelectContent>\n </SelectPositioner>\n </Portal>\n\n <ArkSelect.HiddenSelect />\n </SelectRoot>\n )\n}\n\nexport interface OptionProps extends SelectItemProps {\n /**\n * The CollectionListItem to be displayed in the dropdown list.\n */\n item: SelectCollectionItem\n}\n\nexport function Option(props: OptionProps) {\n const { item, ...itemProps } = props\n\n const { icons } = useCerberusContext()\n const { selectChecked: CheckedIcon } = icons\n\n const styles = select()\n\n return (\n <SelectItem {...itemProps} item={item} className={styles.item}>\n <SelectItemText className={styles.itemText}>{item?.label}</SelectItemText>\n <SelectItemIndicator className={styles.itemIndicator}>\n <CheckedIcon />\n </SelectItemIndicator>\n </SelectItem>\n )\n}\n\n/**\n * The OptionGroup component is a group of options in the dropdown list.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * <OptionGroup>\n * <OptionGroupLabel>Greek gods</OptionGroupLabel>\n * ...\n * </OptionGroup>\n * ```\n */\nexport function OptionGroup(props: SelectItemGroupProps) {\n return <SelectItemGroup {...props} />\n}\n\n/**\n * The OptionGroupLabel component is the label of the OptionGroup.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * <OptionGroupLabel>Greek gods</OptionGroupLabel>\n * ```\n */\nexport function OptionGroupLabel(props: SelectItemGroupLabelProps) {\n const styles = select()\n return (\n <SelectItemGroupLabel\n {...props}\n className={cx(props.className, styles.itemGroupLabel)}\n />\n )\n}\n\n/**\n * A helper function to create a SelectCollection object.\n * @param collection - An array of SelectCollectionItem objects that matches\n * the following shape:\n * ```ts\n * [{ label: 'Hades', value: 'hades', disabled?: true }]\n * ```\n */\nexport function createSelectCollection(\n collection: SelectCollectionItem[],\n): ListCollection<SelectCollectionItem> {\n return createListCollection({\n items: collection,\n })\n}\n\nexport type { SelectValueChangeDetails, ListCollection }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE,UAAU;AAAA,EACV;AAAA,OAOK;AACP;AAAA,EACE;AAAA,OAEK;AACP,SAAS,UAAU;AACnB,SAAS,cAAc;AAmGb,cAEA,YAFA;AAXH,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,YAAY,aAAa,MAAM,GAAG,UAAU,IAAI;AACxD,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,aAAa,aAAa,SAAS,YAAY,IAAI;AAE3D,QAAM,SAAS,OAAO,EAAE,KAAK,CAAC;AAE9B,SACE,qBAAC,cAAW,WAAW,OAAO,MAAM,YAAyB,GAAG,WAC9D;AAAA,wBAAC,iBAAc,WAAW,OAAO,SAC/B,+BAAC,iBAAc,WAAW,OAAO,SAC/B;AAAA,0BAAC,mBAAgB,aAA0B;AAAA,MAE3C,qBAAC,UACC;AAAA,4BAAC,QAAK,MAAM,MAAM,SAChB,8BAAC,eAAY,aAAU,gBAAe,GACxC;AAAA,QACA,oBAAC,mBAAgB,WAAW,OAAO,WACjC,8BAAC,eAAY,GACf;AAAA,SACF;AAAA,OACF,GACF;AAAA,IAEA,oBAAC,UACC,8BAAC,oBAAiB,WAAW,OAAO,YAClC,8BAAC,iBAAc,WAAW,OAAO,SAC9B,gBAAM,UACT,GACF,GACF;AAAA,IAEA,oBAAC,UAAU,cAAV,EAAuB;AAAA,KAC1B;AAEJ;AASO,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,UAAU,IAAI;AAE/B,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,eAAe,YAAY,IAAI;AAEvC,QAAM,SAAS,OAAO;AAEtB,SACE,qBAAC,cAAY,GAAG,WAAW,MAAY,WAAW,OAAO,MACvD;AAAA,wBAAC,kBAAe,WAAW,OAAO,UAAW,gBAAM,OAAM;AAAA,IACzD,oBAAC,uBAAoB,WAAW,OAAO,eACrC,8BAAC,eAAY,GACf;AAAA,KACF;AAEJ;AAcO,SAAS,YAAY,OAA6B;AACvD,SAAO,oBAAC,mBAAiB,GAAG,OAAO;AACrC;AAWO,SAAS,iBAAiB,OAAkC;AACjE,QAAM,SAAS,OAAO;AACtB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,MAAM,WAAW,OAAO,cAAc;AAAA;AAAA,EACtD;AAEJ;AAUO,SAAS,uBACd,YACsC;AACtC,SAAO,qBAAqB;AAAA,IAC1B,OAAO;AAAA,EACT,CAAC;AACH;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import type { CheckboxRootProps } from '@ark-ui/react'\nimport { type CheckboxVariantProps } from '@cerberus/styled-system/recipes'\nimport { Show } from '../Show'\nimport { Text } from '../Text'\nimport { CheckboxParts } from './parts'\nimport { CheckboxIcon } from './checkbox-icon'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps & CheckboxRootProps\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function Checkbox(props: CheckboxProps) {\n const { size, children, ...rootProps } = props\n\n return (\n <CheckboxParts.Root {...rootProps}>\n <CheckboxParts.Control size={size}>\n <CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />\n </CheckboxParts.Control>\n\n <CheckboxParts.Label size={size}>\n {children}\n <Show when={props.required}>\n <Text as=\"span\" data-part=\"required-indicator\">\n (required)\n </Text>\n </Show>\n </CheckboxParts.Label>\n\n <CheckboxParts.HiddenInput />\n </CheckboxParts.Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAgCQ,cAGF,YAHE;AAND,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,MAAM,UAAU,GAAG,UAAU,IAAI;AAEzC,SACE,qBAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,wBAAC,cAAc,SAAd,EAAsB,MACrB,8BAAC,gBAAa,eAAe,UAAU,YAAY,iBAAiB,GACtE;AAAA,IAEA,qBAAC,cAAc,OAAd,EAAoB,MAClB;AAAA;AAAA,MACD,oBAAC,QAAK,MAAM,MAAM,UAChB,8BAAC,QAAK,IAAG,QAAO,aAAU,sBAAqB,wBAE/C,GACF;AAAA,OACF;AAAA,IAEA,oBAAC,cAAc,aAAd,EAA0B;AAAA,KAC7B;AAEJ;","names":[]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// src/components/Select.server.tsx
|
|
2
|
-
import { Select as ArkSelect } from "@ark-ui/react/select";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
function SelectRoot(props) {
|
|
5
|
-
const { children, ...rootProps } = props;
|
|
6
|
-
return /* @__PURE__ */ jsxs(ArkSelect.Root, { ...rootProps, children: [
|
|
7
|
-
children,
|
|
8
|
-
/* @__PURE__ */ jsx(ArkSelect.HiddenSelect, {})
|
|
9
|
-
] });
|
|
10
|
-
}
|
|
11
|
-
var SelectLabel = ArkSelect.Label;
|
|
12
|
-
var SelectControl = ArkSelect.Control;
|
|
13
|
-
var SelectTrigger = ArkSelect.Trigger;
|
|
14
|
-
var SelectValueText = ArkSelect.ValueText;
|
|
15
|
-
var SelectIndicator = ArkSelect.Indicator;
|
|
16
|
-
var SelectClearTrigger = ArkSelect.ClearTrigger;
|
|
17
|
-
var SelectPositioner = ArkSelect.Positioner;
|
|
18
|
-
var SelectContent = ArkSelect.Content;
|
|
19
|
-
var SelectItemGroup = ArkSelect.ItemGroup;
|
|
20
|
-
var SelectItemGroupLabel = ArkSelect.ItemGroupLabel;
|
|
21
|
-
var SelectItem = ArkSelect.Item;
|
|
22
|
-
var SelectItemText = ArkSelect.ItemText;
|
|
23
|
-
var SelectItemIndicator = ArkSelect.ItemIndicator;
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
SelectRoot,
|
|
27
|
-
SelectLabel,
|
|
28
|
-
SelectControl,
|
|
29
|
-
SelectTrigger,
|
|
30
|
-
SelectValueText,
|
|
31
|
-
SelectIndicator,
|
|
32
|
-
SelectClearTrigger,
|
|
33
|
-
SelectPositioner,
|
|
34
|
-
SelectContent,
|
|
35
|
-
SelectItemGroup,
|
|
36
|
-
SelectItemGroupLabel,
|
|
37
|
-
SelectItem,
|
|
38
|
-
SelectItemText,
|
|
39
|
-
SelectItemIndicator
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=chunk-YWMPB2JR.js.map
|