@cmdniels/uikit 1.5.2 → 1.5.3
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/out/components/combobox/Combobox.d.ts +1 -2
- package/out/components/combobox/Combobox.js +45 -2
- package/out/components/radio-group/RadioGroup.d.ts +2 -0
- package/out/components/radio-group/RadioGroup.js +19 -0
- package/out/components/radio-group/RadioGroupItem.d.ts +2 -0
- package/out/components/radio-group/RadioGroupItem.js +19 -0
- package/out/index.d.ts +2 -0
- package/out/index.js +3 -0
- package/package.json +1 -1
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
2
|
-
|
|
3
|
-
export default Combobox;
|
|
2
|
+
export default function Combobox({ children, itemToStringLabel: itemToStringLabelProp, ...props }: ComboboxPrimitive.Root.Props<unknown, boolean | undefined>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
14
|
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
3
|
-
|
|
4
|
-
|
|
15
|
+
import { useMemo, Children, isValidElement } from "react";
|
|
16
|
+
function extractItemsFromChildren(children, items) {
|
|
17
|
+
Children.forEach(children, (child) => {
|
|
18
|
+
if (isValidElement(child)) {
|
|
19
|
+
const props = child.props;
|
|
20
|
+
if (props.value !== undefined && props.children) {
|
|
21
|
+
const label = typeof props.children === "string"
|
|
22
|
+
? props.children
|
|
23
|
+
: typeof props.children === "number"
|
|
24
|
+
? String(props.children)
|
|
25
|
+
: String(props.value);
|
|
26
|
+
items.set(props.value, label);
|
|
27
|
+
}
|
|
28
|
+
if (props.children) {
|
|
29
|
+
extractItemsFromChildren(props.children, items);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export default function Combobox(_a) {
|
|
35
|
+
var { children, itemToStringLabel: itemToStringLabelProp } = _a, props = __rest(_a, ["children", "itemToStringLabel"]);
|
|
36
|
+
const itemsMap = useMemo(() => {
|
|
37
|
+
const map = new Map();
|
|
38
|
+
extractItemsFromChildren(children, map);
|
|
39
|
+
return map;
|
|
40
|
+
}, [children]);
|
|
41
|
+
const autoItemToStringLabel = useMemo(() => {
|
|
42
|
+
if (itemToStringLabelProp)
|
|
43
|
+
return itemToStringLabelProp;
|
|
44
|
+
return (value) => { var _a; return (_a = itemsMap.get(value)) !== null && _a !== void 0 ? _a : String(value); };
|
|
45
|
+
}, [itemsMap, itemToStringLabelProp]);
|
|
46
|
+
return (_jsx(ComboboxPrimitive.Root, Object.assign({}, props, { itemToStringLabel: autoItemToStringLabel, children: children })));
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
|
|
15
|
+
import cn from "../../cn";
|
|
16
|
+
export default function RadioGroup(_a) {
|
|
17
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
18
|
+
return _jsx(RadioGroupPrimitive, Object.assign({ "data-slot": "radio-group", className: cn("grid w-full gap-2", className) }, props));
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
15
|
+
import cn from "../../cn";
|
|
16
|
+
export default function RadioGroupItem(_a) {
|
|
17
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
18
|
+
return (_jsx(RadioPrimitive.Root, Object.assign({ "data-slot": "radio-group-item", className: cn("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-card/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className) }, props, { children: _jsx(RadioPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "flex size-4 items-center justify-center", children: _jsx("span", { className: "absolute top-1/2 left-1/2 size-2 -translate-1/2 rounded-full bg-primary-foreground" }) }) })));
|
|
19
|
+
}
|
package/out/index.d.ts
CHANGED
|
@@ -144,6 +144,8 @@ export { default as PopoverDescription } from "./components/popover/PopoverDescr
|
|
|
144
144
|
export { default as PopoverHeader } from "./components/popover/PopoverHeader";
|
|
145
145
|
export { default as PopoverTitle } from "./components/popover/PopoverTitle";
|
|
146
146
|
export { default as PopoverTrigger } from "./components/popover/PopoverTrigger";
|
|
147
|
+
export { default as RadioGroup } from "./components/radio-group/RadioGroup";
|
|
148
|
+
export { default as RadioGroupItem } from "./components/radio-group/RadioGroupItem";
|
|
147
149
|
export { default as ScrollArea } from "./components/scroll-area/ScrollArea";
|
|
148
150
|
export { default as ScrollBar } from "./components/scroll-area/ScrollBar";
|
|
149
151
|
export { default as Select } from "./components/select/Select";
|
package/out/index.js
CHANGED
|
@@ -170,6 +170,9 @@ export { default as PopoverDescription } from "./components/popover/PopoverDescr
|
|
|
170
170
|
export { default as PopoverHeader } from "./components/popover/PopoverHeader";
|
|
171
171
|
export { default as PopoverTitle } from "./components/popover/PopoverTitle";
|
|
172
172
|
export { default as PopoverTrigger } from "./components/popover/PopoverTrigger";
|
|
173
|
+
// Radio Group
|
|
174
|
+
export { default as RadioGroup } from "./components/radio-group/RadioGroup";
|
|
175
|
+
export { default as RadioGroupItem } from "./components/radio-group/RadioGroupItem";
|
|
173
176
|
// Scroll Area
|
|
174
177
|
export { default as ScrollArea } from "./components/scroll-area/ScrollArea";
|
|
175
178
|
export { default as ScrollBar } from "./components/scroll-area/ScrollBar";
|