@refraktor/core 0.0.3 → 0.0.4
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/.turbo/turbo-build.log +1 -1
- package/build/components/button/button.styles.js +5 -5
- package/build/components/chip/chip-group/chip-group.d.ts +4 -0
- package/build/components/chip/chip-group/chip-group.d.ts.map +1 -0
- package/build/components/chip/chip-group/chip-group.js +43 -0
- package/build/components/chip/chip-group/index.d.ts +2 -0
- package/build/components/chip/chip-group/index.d.ts.map +1 -0
- package/build/components/chip/chip-group/index.js +1 -0
- package/build/components/chip/chip.context.d.ts +15 -0
- package/build/components/chip/chip.context.d.ts.map +1 -0
- package/build/components/chip/chip.context.js +2 -0
- package/build/components/chip/chip.d.ts +4 -0
- package/build/components/chip/chip.d.ts.map +1 -0
- package/build/components/chip/chip.js +85 -0
- package/build/components/chip/chip.styles.d.ts +5 -0
- package/build/components/chip/chip.styles.d.ts.map +1 -0
- package/build/components/chip/chip.styles.js +19 -0
- package/build/components/chip/chip.test.d.ts +2 -0
- package/build/components/chip/chip.test.d.ts.map +1 -0
- package/build/components/chip/chip.test.js +107 -0
- package/build/components/chip/chip.types.d.ts +95 -0
- package/build/components/chip/chip.types.d.ts.map +1 -0
- package/build/components/chip/chip.types.js +1 -0
- package/build/components/chip/index.d.ts +4 -0
- package/build/components/chip/index.d.ts.map +1 -0
- package/build/components/chip/index.js +2 -0
- package/build/components/combobox/combobox-dropdown/combobox-dropdown.d.ts +4 -0
- package/build/components/combobox/combobox-dropdown/combobox-dropdown.d.ts.map +1 -0
- package/build/components/combobox/combobox-dropdown/combobox-dropdown.js +21 -0
- package/build/components/combobox/combobox-dropdown/index.d.ts +2 -0
- package/build/components/combobox/combobox-dropdown/index.d.ts.map +1 -0
- package/build/components/combobox/combobox-dropdown/index.js +1 -0
- package/build/components/combobox/combobox-group/combobox-group.d.ts +4 -0
- package/build/components/combobox/combobox-group/combobox-group.d.ts.map +1 -0
- package/build/components/combobox/combobox-group/combobox-group.js +15 -0
- package/build/components/combobox/combobox-group/index.d.ts +2 -0
- package/build/components/combobox/combobox-group/index.d.ts.map +1 -0
- package/build/components/combobox/combobox-group/index.js +1 -0
- package/build/components/combobox/combobox-input/combobox-input.d.ts +4 -0
- package/build/components/combobox/combobox-input/combobox-input.d.ts.map +1 -0
- package/build/components/combobox/combobox-input/combobox-input.js +101 -0
- package/build/components/combobox/combobox-input/index.d.ts +2 -0
- package/build/components/combobox/combobox-input/index.d.ts.map +1 -0
- package/build/components/combobox/combobox-input/index.js +1 -0
- package/build/components/combobox/combobox-option/combobox-option.d.ts +4 -0
- package/build/components/combobox/combobox-option/combobox-option.d.ts.map +1 -0
- package/build/components/combobox/combobox-option/combobox-option.js +86 -0
- package/build/components/combobox/combobox-option/index.d.ts +2 -0
- package/build/components/combobox/combobox-option/index.d.ts.map +1 -0
- package/build/components/combobox/combobox-option/index.js +1 -0
- package/build/components/combobox/combobox-root/combobox-root.d.ts +4 -0
- package/build/components/combobox/combobox-root/combobox-root.d.ts.map +1 -0
- package/build/components/combobox/combobox-root/combobox-root.js +282 -0
- package/build/components/combobox/combobox-root/index.d.ts +2 -0
- package/build/components/combobox/combobox-root/index.d.ts.map +1 -0
- package/build/components/combobox/combobox-root/index.js +1 -0
- package/build/components/combobox/combobox.context.d.ts +73 -0
- package/build/components/combobox/combobox.context.d.ts.map +1 -0
- package/build/components/combobox/combobox.context.js +50 -0
- package/build/components/combobox/combobox.d.ts +4 -0
- package/build/components/combobox/combobox.d.ts.map +1 -0
- package/build/components/combobox/combobox.js +31 -0
- package/build/components/combobox/combobox.test.d.ts +2 -0
- package/build/components/combobox/combobox.test.d.ts.map +1 -0
- package/build/components/combobox/combobox.test.js +104 -0
- package/build/components/combobox/combobox.types.d.ts +205 -0
- package/build/components/combobox/combobox.types.d.ts.map +1 -0
- package/build/components/combobox/combobox.types.js +1 -0
- package/build/components/combobox/index.d.ts +8 -0
- package/build/components/combobox/index.d.ts.map +1 -0
- package/build/components/combobox/index.js +6 -0
- package/build/components/combobox/use-combobox.d.ts +32 -0
- package/build/components/combobox/use-combobox.d.ts.map +1 -0
- package/build/components/combobox/use-combobox.js +80 -0
- package/build/components/drawer/drawer-body/drawer-body.d.ts +4 -0
- package/build/components/drawer/drawer-body/drawer-body.d.ts.map +1 -0
- package/build/components/drawer/drawer-body/drawer-body.js +11 -0
- package/build/components/drawer/drawer-body/index.d.ts +2 -0
- package/build/components/drawer/drawer-body/index.d.ts.map +1 -0
- package/build/components/drawer/drawer-body/index.js +1 -0
- package/build/components/drawer/drawer-content/drawer-content.d.ts.map +1 -1
- package/build/components/drawer/drawer-content/drawer-content.js +9 -6
- package/build/components/drawer/drawer-overlay/drawer-overlay.d.ts.map +1 -1
- package/build/components/drawer/drawer-overlay/drawer-overlay.js +4 -4
- package/build/components/drawer/drawer-root/drawer-root.d.ts.map +1 -1
- package/build/components/drawer/drawer-root/drawer-root.js +8 -9
- package/build/components/drawer/drawer.context.d.ts +2 -1
- package/build/components/drawer/drawer.context.d.ts.map +1 -1
- package/build/components/drawer/drawer.d.ts.map +1 -1
- package/build/components/drawer/drawer.js +5 -3
- package/build/components/drawer/drawer.test.js +55 -16
- package/build/components/drawer/drawer.types.d.ts +29 -3
- package/build/components/drawer/drawer.types.d.ts.map +1 -1
- package/build/components/drawer/index.d.ts +2 -1
- package/build/components/drawer/index.d.ts.map +1 -1
- package/build/components/drawer/index.js +1 -0
- package/build/components/drawer/use-drawer.d.ts +8 -1
- package/build/components/drawer/use-drawer.d.ts.map +1 -1
- package/build/components/drawer/use-drawer.js +25 -38
- package/build/components/file-input/file-input.d.ts +4 -0
- package/build/components/file-input/file-input.d.ts.map +1 -0
- package/build/components/file-input/file-input.js +88 -0
- package/build/components/file-input/file-input.test.d.ts +2 -0
- package/build/components/file-input/file-input.test.d.ts.map +1 -0
- package/build/components/file-input/file-input.test.js +74 -0
- package/build/components/file-input/file-input.types.d.ts +46 -0
- package/build/components/file-input/file-input.types.d.ts.map +1 -0
- package/build/components/file-input/file-input.types.js +1 -0
- package/build/components/file-input/file-input.utils.d.ts +11 -0
- package/build/components/file-input/file-input.utils.d.ts.map +1 -0
- package/build/components/file-input/file-input.utils.js +67 -0
- package/build/components/file-input/file-input.utils.test.d.ts +2 -0
- package/build/components/file-input/file-input.utils.test.d.ts.map +1 -0
- package/build/components/file-input/file-input.utils.test.js +27 -0
- package/build/components/file-input/index.d.ts +3 -0
- package/build/components/file-input/index.d.ts.map +1 -0
- package/build/components/file-input/index.js +2 -0
- package/build/components/for/for.d.ts +8 -0
- package/build/components/for/for.d.ts.map +1 -0
- package/build/components/for/for.js +32 -0
- package/build/components/for/for.test.d.ts +2 -0
- package/build/components/for/for.test.d.ts.map +1 -0
- package/build/components/for/for.test.js +31 -0
- package/build/components/for/for.types.d.ts +33 -0
- package/build/components/for/for.types.d.ts.map +1 -0
- package/build/components/for/for.types.js +1 -0
- package/build/components/for/index.d.ts +3 -0
- package/build/components/for/index.d.ts.map +1 -0
- package/build/components/for/index.js +1 -0
- package/build/components/index.d.ts +6 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +6 -0
- package/build/components/modal/index.d.ts +2 -1
- package/build/components/modal/index.d.ts.map +1 -1
- package/build/components/modal/index.js +1 -0
- package/build/components/modal/modal-body/index.d.ts +2 -0
- package/build/components/modal/modal-body/index.d.ts.map +1 -0
- package/build/components/modal/modal-body/index.js +1 -0
- package/build/components/modal/modal-body/modal-body.d.ts +4 -0
- package/build/components/modal/modal-body/modal-body.d.ts.map +1 -0
- package/build/components/modal/modal-body/modal-body.js +11 -0
- package/build/components/modal/modal-content/modal-content.d.ts.map +1 -1
- package/build/components/modal/modal-content/modal-content.js +13 -5
- package/build/components/modal/modal-header/modal-header.js +2 -2
- package/build/components/modal/modal-overlay/modal-overlay.d.ts.map +1 -1
- package/build/components/modal/modal-overlay/modal-overlay.js +4 -4
- package/build/components/modal/modal-root/modal-root.d.ts.map +1 -1
- package/build/components/modal/modal-root/modal-root.js +12 -9
- package/build/components/modal/modal.context.d.ts +5 -2
- package/build/components/modal/modal.context.d.ts.map +1 -1
- package/build/components/modal/modal.d.ts.map +1 -1
- package/build/components/modal/modal.js +5 -3
- package/build/components/modal/modal.test.js +78 -13
- package/build/components/modal/modal.types.d.ts +34 -5
- package/build/components/modal/modal.types.d.ts.map +1 -1
- package/build/components/modal/use-modal.d.ts +8 -1
- package/build/components/modal/use-modal.d.ts.map +1 -1
- package/build/components/modal/use-modal.js +25 -38
- package/build/components/password-input/index.d.ts +3 -0
- package/build/components/password-input/index.d.ts.map +1 -0
- package/build/components/password-input/index.js +2 -0
- package/build/components/password-input/password-input.d.ts +4 -0
- package/build/components/password-input/password-input.d.ts.map +1 -0
- package/build/components/password-input/password-input.js +32 -0
- package/build/components/password-input/password-input.test.d.ts +2 -0
- package/build/components/password-input/password-input.test.d.ts.map +1 -0
- package/build/components/password-input/password-input.test.js +47 -0
- package/build/components/password-input/password-input.types.d.ts +24 -0
- package/build/components/password-input/password-input.types.d.ts.map +1 -0
- package/build/components/password-input/password-input.types.js +1 -0
- package/build/components/pin-input/index.d.ts +3 -0
- package/build/components/pin-input/index.d.ts.map +1 -0
- package/build/components/pin-input/index.js +2 -0
- package/build/components/pin-input/pin-input.d.ts +4 -0
- package/build/components/pin-input/pin-input.d.ts.map +1 -0
- package/build/components/pin-input/pin-input.js +245 -0
- package/build/components/pin-input/pin-input.test.d.ts +2 -0
- package/build/components/pin-input/pin-input.test.d.ts.map +1 -0
- package/build/components/pin-input/pin-input.test.js +87 -0
- package/build/components/pin-input/pin-input.types.d.ts +44 -0
- package/build/components/pin-input/pin-input.types.d.ts.map +1 -0
- package/build/components/pin-input/pin-input.types.js +1 -0
- package/build/components/scroll-area/index.d.ts +3 -0
- package/build/components/scroll-area/index.d.ts.map +1 -0
- package/build/components/scroll-area/index.js +1 -0
- package/build/components/scroll-area/scroll-area.d.ts +4 -0
- package/build/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/build/components/scroll-area/scroll-area.js +30 -0
- package/build/components/scroll-area/scroll-area.test.d.ts +2 -0
- package/build/components/scroll-area/scroll-area.test.d.ts.map +1 -0
- package/build/components/scroll-area/scroll-area.test.js +39 -0
- package/build/components/scroll-area/scroll-area.types.d.ts +25 -0
- package/build/components/scroll-area/scroll-area.types.d.ts.map +1 -0
- package/build/components/scroll-area/scroll-area.types.js +1 -0
- package/build/components/segmented-control/segmented-control.d.ts.map +1 -1
- package/build/components/segmented-control/segmented-control.js +3 -3
- package/build/components/segmented-control/segmented-control.styles.js +13 -13
- package/build/components/segmented-control/segmented-control.test.js +11 -0
- package/build/components/segmented-control/segmented-control.types.d.ts +2 -0
- package/build/components/segmented-control/segmented-control.types.d.ts.map +1 -1
- package/build/icons/eye-off.d.ts +4 -0
- package/build/icons/eye-off.d.ts.map +1 -0
- package/build/icons/eye-off.js +5 -0
- package/build/icons/eye.d.ts +4 -0
- package/build/icons/eye.d.ts.map +1 -0
- package/build/icons/eye.js +5 -0
- package/build/icons/index.d.ts +2 -0
- package/build/icons/index.d.ts.map +1 -1
- package/build/icons/index.js +2 -0
- package/build/style.css +1 -1
- package/package.json +2 -2
- package/src/components/button/button.styles.ts +5 -5
- package/src/components/chip/chip-group/chip-group.tsx +107 -0
- package/src/components/chip/chip-group/index.ts +1 -0
- package/src/components/chip/chip.context.ts +15 -0
- package/src/components/chip/chip.styles.ts +36 -0
- package/src/components/chip/chip.test.tsx +197 -0
- package/src/components/chip/chip.tsx +208 -0
- package/src/components/chip/chip.types.ts +134 -0
- package/src/components/chip/index.ts +10 -0
- package/src/components/drawer/drawer-body/drawer-body.tsx +29 -0
- package/src/components/drawer/drawer-body/index.ts +1 -0
- package/src/components/drawer/drawer-content/drawer-content.tsx +63 -26
- package/src/components/drawer/drawer-overlay/drawer-overlay.tsx +6 -5
- package/src/components/drawer/drawer-root/drawer-root.tsx +17 -18
- package/src/components/drawer/drawer.context.ts +2 -1
- package/src/components/drawer/drawer.test.tsx +144 -36
- package/src/components/drawer/drawer.tsx +31 -3
- package/src/components/drawer/drawer.types.ts +37 -3
- package/src/components/drawer/index.ts +2 -0
- package/src/components/drawer/use-drawer.ts +44 -51
- package/src/components/file-input/file-input.test.tsx +134 -0
- package/src/components/file-input/file-input.tsx +224 -0
- package/src/components/file-input/file-input.types.ts +78 -0
- package/src/components/file-input/file-input.utils.test.ts +36 -0
- package/src/components/file-input/file-input.utils.ts +130 -0
- package/src/components/file-input/index.ts +2 -0
- package/src/components/for/for.test.tsx +66 -0
- package/src/components/for/for.tsx +53 -0
- package/src/components/for/for.types.ts +40 -0
- package/src/components/for/index.ts +2 -0
- package/src/components/index.ts +6 -0
- package/src/components/menu/menu-dropdown/menu-dropdown.tsx +220 -220
- package/src/components/menu/menu-sub-dropdown/menu-sub-dropdown.tsx +221 -221
- package/src/components/modal/index.ts +4 -1
- package/src/components/modal/modal-body/index.ts +1 -0
- package/src/components/modal/modal-body/modal-body.tsx +29 -0
- package/src/components/modal/modal-content/modal-content.tsx +71 -24
- package/src/components/modal/modal-header/modal-header.tsx +2 -2
- package/src/components/modal/modal-overlay/modal-overlay.tsx +46 -45
- package/src/components/modal/modal-root/modal-root.tsx +22 -17
- package/src/components/modal/modal.context.ts +5 -2
- package/src/components/modal/modal.test.tsx +234 -64
- package/src/components/modal/modal.tsx +36 -4
- package/src/components/modal/modal.types.ts +49 -8
- package/src/components/modal/use-modal.ts +44 -51
- package/src/components/password-input/index.ts +2 -0
- package/src/components/password-input/password-input.test.tsx +72 -0
- package/src/components/password-input/password-input.tsx +85 -0
- package/src/components/password-input/password-input.types.ts +30 -0
- package/src/components/pin-input/index.ts +2 -0
- package/src/components/pin-input/pin-input.test.tsx +149 -0
- package/src/components/pin-input/pin-input.tsx +473 -0
- package/src/components/pin-input/pin-input.types.ts +78 -0
- package/src/components/scroll-area/index.ts +6 -0
- package/src/components/scroll-area/scroll-area.test.tsx +72 -0
- package/src/components/scroll-area/scroll-area.tsx +70 -0
- package/src/components/scroll-area/scroll-area.types.ts +37 -0
- package/src/components/segmented-control/segmented-control.styles.ts +13 -13
- package/src/components/segmented-control/segmented-control.test.tsx +18 -0
- package/src/components/segmented-control/segmented-control.tsx +11 -1
- package/src/components/segmented-control/segmented-control.types.ts +3 -0
- package/src/components/select/select-dropdown/select-dropdown.tsx +299 -299
- package/src/components/select/select-root/select-root.tsx +333 -333
- package/src/components/select/select-trigger/select-trigger.tsx +123 -123
- package/src/components/select/select.context.ts +140 -140
- package/src/components/select/select.test.tsx +190 -190
- package/src/components/select/select.types.ts +272 -272
- package/src/components/select/use-select.ts +170 -170
- package/src/icons/eye-off.tsx +30 -0
- package/src/icons/eye.tsx +24 -0
- package/src/icons/index.ts +2 -0
- package/src/style.css +14 -8
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createClassNamesConfig, createComponentConfig, factory } from "../../utils";
|
|
3
|
+
import { ComboboxDropdown } from "./combobox-dropdown";
|
|
4
|
+
import { ComboboxGroup } from "./combobox-group";
|
|
5
|
+
import { ComboboxInput } from "./combobox-input";
|
|
6
|
+
import { ComboboxOption } from "./combobox-option";
|
|
7
|
+
import { ComboboxRoot } from "./combobox-root";
|
|
8
|
+
function isGroupData(item) {
|
|
9
|
+
return "items" in item;
|
|
10
|
+
}
|
|
11
|
+
const Combobox = factory((_props, ref) => {
|
|
12
|
+
const { data, children, ...props } = _props;
|
|
13
|
+
if (children !== undefined && children !== null) {
|
|
14
|
+
return (_jsx(ComboboxRoot, { ref: ref, ...props, children: children }));
|
|
15
|
+
}
|
|
16
|
+
return (_jsxs(ComboboxRoot, { ref: ref, ...props, children: [_jsx(ComboboxInput, {}), _jsx(ComboboxDropdown, { children: (data ?? []).map((entry, index) => {
|
|
17
|
+
if (isGroupData(entry)) {
|
|
18
|
+
return (_jsx(ComboboxGroup, { label: entry.label, children: entry.items.map((item) => (_jsx(ComboboxOption, { value: item.value, disabled: item.disabled, textValue: item.textValue, children: item.label }, item.value))) }, `group-${index}`));
|
|
19
|
+
}
|
|
20
|
+
return (_jsx(ComboboxOption, { value: entry.value, disabled: entry.disabled, textValue: entry.textValue, children: entry.label }, entry.value));
|
|
21
|
+
}) })] }));
|
|
22
|
+
});
|
|
23
|
+
Combobox.displayName = "@refraktor/core/Combobox";
|
|
24
|
+
Combobox.configure = createComponentConfig();
|
|
25
|
+
Combobox.classNames = createClassNamesConfig();
|
|
26
|
+
Combobox.Root = ComboboxRoot;
|
|
27
|
+
Combobox.Input = ComboboxInput;
|
|
28
|
+
Combobox.Dropdown = ComboboxDropdown;
|
|
29
|
+
Combobox.Group = ComboboxGroup;
|
|
30
|
+
Combobox.Option = ComboboxOption;
|
|
31
|
+
export default Combobox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.test.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/combobox.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { render, screen, userEvent, waitFor } from "../../vitest";
|
|
5
|
+
import Combobox from "./combobox";
|
|
6
|
+
describe("@refraktor/core/Combobox", () => {
|
|
7
|
+
const transitionProps = {
|
|
8
|
+
duration: 0,
|
|
9
|
+
immediate: true
|
|
10
|
+
};
|
|
11
|
+
it("supports built-in data mode", async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
await render(_jsx(Combobox, { placeholder: "Pick framework", transitionProps: transitionProps, data: [
|
|
14
|
+
{ value: "react", label: "React" },
|
|
15
|
+
{ value: "vue", label: "Vue" }
|
|
16
|
+
] }));
|
|
17
|
+
const input = screen.getByRole("combobox");
|
|
18
|
+
expect(input).toHaveAttribute("placeholder", "Pick framework");
|
|
19
|
+
await user.click(input);
|
|
20
|
+
await user.click(screen.getByRole("option", { name: "React" }));
|
|
21
|
+
expect(input).toHaveValue("React");
|
|
22
|
+
await waitFor(() => {
|
|
23
|
+
expect(screen.queryByRole("listbox")).not.toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
it("renders defaultValue label in input before opening", async () => {
|
|
27
|
+
await render(_jsx(Combobox, { defaultValue: "apple", data: [
|
|
28
|
+
{ value: "apple", label: "Apple" },
|
|
29
|
+
{ value: "orange", label: "Orange" }
|
|
30
|
+
] }));
|
|
31
|
+
expect(screen.getByRole("combobox")).toHaveValue("Apple");
|
|
32
|
+
});
|
|
33
|
+
it("filters options based on typed query", async () => {
|
|
34
|
+
const user = userEvent.setup();
|
|
35
|
+
await render(_jsx(Combobox, { transitionProps: transitionProps, data: [
|
|
36
|
+
{ value: "react", label: "React" },
|
|
37
|
+
{ value: "vue", label: "Vue" },
|
|
38
|
+
{ value: "solid", label: "Solid" }
|
|
39
|
+
] }));
|
|
40
|
+
const input = screen.getByRole("combobox");
|
|
41
|
+
await user.click(input);
|
|
42
|
+
await user.type(input, "vu");
|
|
43
|
+
expect(screen.getByRole("option", { name: "Vue" })).toBeInTheDocument();
|
|
44
|
+
expect(screen.queryByRole("option", { name: "React" })).not.toBeInTheDocument();
|
|
45
|
+
await user.clear(input);
|
|
46
|
+
await user.type(input, "unknown");
|
|
47
|
+
expect(screen.getByText("No options")).toBeInTheDocument();
|
|
48
|
+
});
|
|
49
|
+
it("supports keyboard navigation and selection", async () => {
|
|
50
|
+
const user = userEvent.setup();
|
|
51
|
+
await render(_jsx(Combobox, { transitionProps: transitionProps, data: [
|
|
52
|
+
{ value: "react", label: "React" },
|
|
53
|
+
{ value: "vue", label: "Vue" }
|
|
54
|
+
] }));
|
|
55
|
+
const input = screen.getByRole("combobox");
|
|
56
|
+
input.focus();
|
|
57
|
+
await user.keyboard("{ArrowDown}");
|
|
58
|
+
await user.keyboard("{ArrowDown}");
|
|
59
|
+
await user.keyboard("{Enter}");
|
|
60
|
+
expect(input).toHaveValue("Vue");
|
|
61
|
+
});
|
|
62
|
+
it("supports compound mode with groups", async () => {
|
|
63
|
+
const user = userEvent.setup();
|
|
64
|
+
await render(_jsxs(Combobox.Root, { transitionProps: transitionProps, children: [_jsx(Combobox.Input, {}), _jsxs(Combobox.Dropdown, { children: [_jsx(Combobox.Group, { label: "Frontend", children: _jsx(Combobox.Option, { value: "react", children: "React" }) }), _jsx(Combobox.Group, { label: "Backend", children: _jsx(Combobox.Option, { value: "node", children: "Node.js" }) })] })] }));
|
|
65
|
+
const input = screen.getByRole("combobox");
|
|
66
|
+
await user.click(input);
|
|
67
|
+
expect(screen.getByText("Frontend")).toBeInTheDocument();
|
|
68
|
+
expect(screen.getByText("Backend")).toBeInTheDocument();
|
|
69
|
+
await user.click(screen.getByRole("option", { name: "Node.js" }));
|
|
70
|
+
expect(input).toHaveValue("Node.js");
|
|
71
|
+
});
|
|
72
|
+
it("supports controlled mode", async () => {
|
|
73
|
+
const user = userEvent.setup();
|
|
74
|
+
const onChange = vi.fn();
|
|
75
|
+
function Demo() {
|
|
76
|
+
const [value, setValue] = useState("react");
|
|
77
|
+
return (_jsx(Combobox, { value: value, onChange: (nextValue) => {
|
|
78
|
+
onChange(nextValue);
|
|
79
|
+
setValue(nextValue);
|
|
80
|
+
}, transitionProps: transitionProps, data: [
|
|
81
|
+
{ value: "react", label: "React" },
|
|
82
|
+
{ value: "vue", label: "Vue" }
|
|
83
|
+
] }));
|
|
84
|
+
}
|
|
85
|
+
await render(_jsx(Demo, {}));
|
|
86
|
+
await user.click(screen.getByRole("combobox"));
|
|
87
|
+
await user.click(screen.getByRole("option", { name: "Vue" }));
|
|
88
|
+
expect(onChange).toHaveBeenCalledWith("vue");
|
|
89
|
+
expect(screen.getByRole("combobox")).toHaveValue("Vue");
|
|
90
|
+
});
|
|
91
|
+
it("supports custom filter and limit", async () => {
|
|
92
|
+
const user = userEvent.setup();
|
|
93
|
+
await render(_jsx(Combobox, { transitionProps: transitionProps, filter: (item, query) => item.textValue.toLowerCase().startsWith(query.toLowerCase()), limit: 1, data: [
|
|
94
|
+
{ value: "react", label: "React" },
|
|
95
|
+
{ value: "ruby", label: "Ruby" },
|
|
96
|
+
{ value: "vue", label: "Vue" }
|
|
97
|
+
] }));
|
|
98
|
+
const input = screen.getByRole("combobox");
|
|
99
|
+
await user.click(input);
|
|
100
|
+
await user.type(input, "r");
|
|
101
|
+
expect(screen.getByRole("option", { name: "React" })).toBeInTheDocument();
|
|
102
|
+
expect(screen.queryByRole("option", { name: "Ruby" })).not.toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import type { FlipOptions, InlineOptions, Placement, ShiftOptions } from "@floating-ui/react";
|
|
3
|
+
import type { RefraktorRadius, RefraktorSize } from "../../theme";
|
|
4
|
+
import { createClassNamesConfig, createComponentConfig, FactoryPayload } from "../../utils";
|
|
5
|
+
import type { TransitionProps } from "../transition";
|
|
6
|
+
import type { InputVariant } from "../input";
|
|
7
|
+
import type { ComboboxRoot } from "./combobox-root";
|
|
8
|
+
import type { ComboboxInput } from "./combobox-input";
|
|
9
|
+
import type { ComboboxDropdown } from "./combobox-dropdown";
|
|
10
|
+
import type { ComboboxGroup } from "./combobox-group";
|
|
11
|
+
import type { ComboboxOption } from "./combobox-option";
|
|
12
|
+
export type ComboboxClassNames = {
|
|
13
|
+
root?: string;
|
|
14
|
+
input?: string;
|
|
15
|
+
inputField?: string;
|
|
16
|
+
inputIcon?: string;
|
|
17
|
+
dropdown?: string;
|
|
18
|
+
options?: string;
|
|
19
|
+
group?: string;
|
|
20
|
+
groupLabel?: string;
|
|
21
|
+
option?: string;
|
|
22
|
+
optionLabel?: string;
|
|
23
|
+
optionCheck?: string;
|
|
24
|
+
empty?: string;
|
|
25
|
+
};
|
|
26
|
+
export type ComboboxPositioning = {
|
|
27
|
+
/** The placement of the dropdown relative to the input @default `bottom-start` */
|
|
28
|
+
placement?: Placement;
|
|
29
|
+
/** Offset distance from the input in pixels @default `4` */
|
|
30
|
+
offset?: number;
|
|
31
|
+
};
|
|
32
|
+
export type ComboboxMiddlewares = {
|
|
33
|
+
shift?: boolean | ShiftOptions;
|
|
34
|
+
flip?: boolean | FlipOptions;
|
|
35
|
+
inline?: boolean | InlineOptions;
|
|
36
|
+
};
|
|
37
|
+
export interface ComboboxItemData {
|
|
38
|
+
/** Option value */
|
|
39
|
+
value: string;
|
|
40
|
+
/** Option label */
|
|
41
|
+
label: ReactNode;
|
|
42
|
+
/** Optional searchable text for non-string labels */
|
|
43
|
+
textValue?: string;
|
|
44
|
+
/** Whether the option is disabled */
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface ComboboxGroupData {
|
|
48
|
+
/** Group label */
|
|
49
|
+
label?: ReactNode;
|
|
50
|
+
/** Group items */
|
|
51
|
+
items: ComboboxItemData[];
|
|
52
|
+
}
|
|
53
|
+
export type ComboboxData = ComboboxItemData | ComboboxGroupData;
|
|
54
|
+
export interface ComboboxFilterItem {
|
|
55
|
+
value: string;
|
|
56
|
+
label: string;
|
|
57
|
+
textValue: string;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
groupId?: string;
|
|
60
|
+
}
|
|
61
|
+
export type ComboboxFilter = (item: ComboboxFilterItem, query: string) => boolean;
|
|
62
|
+
export interface ComboboxRootProps extends Omit<ComponentPropsWithoutRef<"div">, "value" | "defaultValue" | "onChange"> {
|
|
63
|
+
/** Children containing combobox subcomponents */
|
|
64
|
+
children: ReactNode;
|
|
65
|
+
/** Label text */
|
|
66
|
+
label?: ReactNode;
|
|
67
|
+
/** Description text */
|
|
68
|
+
description?: ReactNode;
|
|
69
|
+
/** Error message */
|
|
70
|
+
error?: ReactNode;
|
|
71
|
+
/** Whether the field is required */
|
|
72
|
+
required?: boolean;
|
|
73
|
+
/** Display an asterisk next to the label */
|
|
74
|
+
withAsterisk?: boolean;
|
|
75
|
+
/** Selected value (controlled) */
|
|
76
|
+
value?: string | null;
|
|
77
|
+
/** Initial selected value (uncontrolled) */
|
|
78
|
+
defaultValue?: string | null;
|
|
79
|
+
/** Callback called when selected value changes */
|
|
80
|
+
onChange?: (value: string | null) => void;
|
|
81
|
+
/** Search value (controlled) */
|
|
82
|
+
searchValue?: string;
|
|
83
|
+
/** Initial search value (uncontrolled) */
|
|
84
|
+
defaultSearchValue?: string;
|
|
85
|
+
/** Callback called when search value changes */
|
|
86
|
+
onSearchChange?: (value: string) => void;
|
|
87
|
+
/** Dropdown open state (controlled) */
|
|
88
|
+
opened?: boolean;
|
|
89
|
+
/** Initial dropdown open state (uncontrolled) */
|
|
90
|
+
defaultOpened?: boolean;
|
|
91
|
+
/** Callback called when dropdown open state changes */
|
|
92
|
+
onOpenedChange?: (opened: boolean) => void;
|
|
93
|
+
/** Positioning settings */
|
|
94
|
+
positioning?: ComboboxPositioning;
|
|
95
|
+
/** Floating middleware settings */
|
|
96
|
+
middlewares?: ComboboxMiddlewares;
|
|
97
|
+
/** Whether combobox is disabled @default `false` */
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
/** Whether to open dropdown when input receives focus @default `true` */
|
|
100
|
+
openOnFocus?: boolean;
|
|
101
|
+
/** Input placeholder text @default `Type to search` */
|
|
102
|
+
placeholder?: string;
|
|
103
|
+
/** Content rendered when no options match @default `No options` */
|
|
104
|
+
nothingFound?: ReactNode;
|
|
105
|
+
/** Filter function for options */
|
|
106
|
+
filter?: ComboboxFilter;
|
|
107
|
+
/** Optional maximum number of visible options */
|
|
108
|
+
limit?: number;
|
|
109
|
+
/** Input size @default `md` */
|
|
110
|
+
size?: RefraktorSize;
|
|
111
|
+
/** Input radius @default `default` */
|
|
112
|
+
radius?: RefraktorRadius;
|
|
113
|
+
/** Input variant @default `default` */
|
|
114
|
+
variant?: InputVariant;
|
|
115
|
+
/** Whether to render dropdown in portal @default `true` */
|
|
116
|
+
withinPortal?: boolean;
|
|
117
|
+
/** Whether to close on click outside @default `true` */
|
|
118
|
+
closeOnClickOutside?: boolean;
|
|
119
|
+
/** Whether to close on Escape key @default `true` */
|
|
120
|
+
closeOnEscape?: boolean;
|
|
121
|
+
/** Transition props for dropdown, uses Transition internally */
|
|
122
|
+
transitionProps?: Omit<TransitionProps, "children" | "mounted">;
|
|
123
|
+
/** Used for editing root class name */
|
|
124
|
+
className?: string;
|
|
125
|
+
/** Used for styling different parts of the component */
|
|
126
|
+
classNames?: ComboboxClassNames;
|
|
127
|
+
}
|
|
128
|
+
export interface ComboboxInputProps extends ComponentPropsWithoutRef<"div"> {
|
|
129
|
+
/** Input placeholder override */
|
|
130
|
+
placeholder?: string;
|
|
131
|
+
/** Optional custom left section */
|
|
132
|
+
leftSection?: ReactNode;
|
|
133
|
+
/** Optional custom right section */
|
|
134
|
+
rightSection?: ReactNode;
|
|
135
|
+
/** Used for editing root class name */
|
|
136
|
+
className?: string;
|
|
137
|
+
}
|
|
138
|
+
export interface ComboboxDropdownProps extends ComponentPropsWithoutRef<"div"> {
|
|
139
|
+
/** Content displayed inside dropdown */
|
|
140
|
+
children: ReactNode;
|
|
141
|
+
/** Used for editing root class name */
|
|
142
|
+
className?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ComboboxGroupProps extends ComponentPropsWithoutRef<"div"> {
|
|
145
|
+
/** Group label */
|
|
146
|
+
label?: ReactNode;
|
|
147
|
+
/** Group content */
|
|
148
|
+
children: ReactNode;
|
|
149
|
+
/** Used for editing root class name */
|
|
150
|
+
className?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface ComboboxOptionProps extends Omit<ComponentPropsWithoutRef<"button">, "value" | "onSelect"> {
|
|
153
|
+
/** Option value */
|
|
154
|
+
value: string;
|
|
155
|
+
/** Option content */
|
|
156
|
+
children: ReactNode;
|
|
157
|
+
/** Callback called when option is selected */
|
|
158
|
+
onSelect?: (value: string) => void;
|
|
159
|
+
/** Optional searchable text for non-string children */
|
|
160
|
+
textValue?: string;
|
|
161
|
+
/** Whether option is disabled */
|
|
162
|
+
disabled?: boolean;
|
|
163
|
+
/** Used for editing root class name */
|
|
164
|
+
className?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface ComboboxProps extends Omit<ComboboxRootProps, "children"> {
|
|
167
|
+
/** Compound children. If provided, data-based rendering is skipped */
|
|
168
|
+
children?: ReactNode;
|
|
169
|
+
/** Data used for built-in rendering mode */
|
|
170
|
+
data?: ComboboxData[];
|
|
171
|
+
}
|
|
172
|
+
export interface ComboboxFactoryPayload extends FactoryPayload {
|
|
173
|
+
props: ComboboxProps;
|
|
174
|
+
ref: HTMLDivElement;
|
|
175
|
+
compound: {
|
|
176
|
+
configure: ReturnType<typeof createComponentConfig<ComboboxProps>>;
|
|
177
|
+
classNames: ReturnType<typeof createClassNamesConfig<ComboboxClassNames>>;
|
|
178
|
+
Root: typeof ComboboxRoot;
|
|
179
|
+
Input: typeof ComboboxInput;
|
|
180
|
+
Dropdown: typeof ComboboxDropdown;
|
|
181
|
+
Group: typeof ComboboxGroup;
|
|
182
|
+
Option: typeof ComboboxOption;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export interface ComboboxRootFactoryPayload extends FactoryPayload {
|
|
186
|
+
props: ComboboxRootProps;
|
|
187
|
+
ref: HTMLDivElement;
|
|
188
|
+
}
|
|
189
|
+
export interface ComboboxInputFactoryPayload extends FactoryPayload {
|
|
190
|
+
props: ComboboxInputProps;
|
|
191
|
+
ref: HTMLDivElement;
|
|
192
|
+
}
|
|
193
|
+
export interface ComboboxDropdownFactoryPayload extends FactoryPayload {
|
|
194
|
+
props: ComboboxDropdownProps;
|
|
195
|
+
ref: HTMLDivElement;
|
|
196
|
+
}
|
|
197
|
+
export interface ComboboxGroupFactoryPayload extends FactoryPayload {
|
|
198
|
+
props: ComboboxGroupProps;
|
|
199
|
+
ref: HTMLDivElement;
|
|
200
|
+
}
|
|
201
|
+
export interface ComboboxOptionFactoryPayload extends FactoryPayload {
|
|
202
|
+
props: ComboboxOptionProps;
|
|
203
|
+
ref: HTMLButtonElement;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=combobox.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.types.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/combobox.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EACR,WAAW,EACX,aAAa,EACb,SAAS,EACT,YAAY,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EACH,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,C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AAc;IAC9D,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAC/D,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IAClE,KAAK,EAAE,qBAAqB,CAAC;IAC7B,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAC/D,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,4BAA6B,SAAQ,cAAc;IAChE,KAAK,EAAE,mBAAmB,CAAC;IAC3B,GAAG,EAAE,iBAAiB,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Combobox } from "./combobox";
|
|
2
|
+
export { ComboboxRoot } from "./combobox-root";
|
|
3
|
+
export { ComboboxInput } from "./combobox-input";
|
|
4
|
+
export { ComboboxDropdown } from "./combobox-dropdown";
|
|
5
|
+
export { ComboboxGroup } from "./combobox-group";
|
|
6
|
+
export { ComboboxOption } from "./combobox-option";
|
|
7
|
+
export type { ComboboxProps, ComboboxRootProps, ComboboxInputProps, ComboboxDropdownProps, ComboboxGroupProps, ComboboxOptionProps, ComboboxItemData, ComboboxGroupData, ComboboxData, ComboboxClassNames, ComboboxPositioning, ComboboxMiddlewares, ComboboxFilter, ComboboxFilterItem } from "./combobox.types";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EACR,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EACrB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Combobox } from "./combobox";
|
|
2
|
+
export { ComboboxRoot } from "./combobox-root";
|
|
3
|
+
export { ComboboxInput } from "./combobox-input";
|
|
4
|
+
export { ComboboxDropdown } from "./combobox-dropdown";
|
|
5
|
+
export { ComboboxGroup } from "./combobox-group";
|
|
6
|
+
export { ComboboxOption } from "./combobox-option";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FloatingContext, Placement } from "@floating-ui/react";
|
|
2
|
+
import type { ComboboxMiddlewares, ComboboxPositioning } from "./combobox.types";
|
|
3
|
+
interface UseComboboxProps {
|
|
4
|
+
opened?: boolean;
|
|
5
|
+
defaultOpened?: boolean;
|
|
6
|
+
onOpenedChange?: (opened: boolean) => void;
|
|
7
|
+
positioning?: ComboboxPositioning;
|
|
8
|
+
middlewares?: ComboboxMiddlewares;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
closeOnClickOutside?: boolean;
|
|
11
|
+
closeOnEscape?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UseComboboxReturn {
|
|
14
|
+
opened: boolean;
|
|
15
|
+
open: () => void;
|
|
16
|
+
close: () => void;
|
|
17
|
+
toggle: () => void;
|
|
18
|
+
context: FloatingContext;
|
|
19
|
+
refs: {
|
|
20
|
+
setReference: (node: HTMLElement | null) => void;
|
|
21
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
22
|
+
reference: React.MutableRefObject<HTMLElement | null>;
|
|
23
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
24
|
+
};
|
|
25
|
+
floatingStyles: React.CSSProperties;
|
|
26
|
+
getReferenceProps: (userProps?: React.HTMLAttributes<HTMLElement>) => Record<string, unknown>;
|
|
27
|
+
getFloatingProps: (userProps?: React.HTMLAttributes<HTMLElement>) => Record<string, unknown>;
|
|
28
|
+
placement: Placement;
|
|
29
|
+
}
|
|
30
|
+
export declare function useCombobox(options?: UseComboboxProps): UseComboboxReturn;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=use-combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-combobox.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/use-combobox.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,eAAe,EAIf,SAAS,EAKZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEjF,UAAU,gBAAgB;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,EAAE;QACF,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;QACjD,WAAW,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;QAChD,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;QACtD,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;KACxD,CAAC;IACF,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,iBAAiB,EAAE,CACf,SAAS,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,KAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,gBAAgB,EAAE,CACd,SAAS,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,KAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC;CACxB;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,gBAAqB,GAAG,iBAAiB,CA+G7E"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useUncontrolled } from "@refraktor/utils";
|
|
2
|
+
import { autoUpdate, flip, inline, offset, shift, useDismiss, useFloating, useInteractions } from "@floating-ui/react";
|
|
3
|
+
import { useCallback, useMemo } from "react";
|
|
4
|
+
export function useCombobox(options = {}) {
|
|
5
|
+
const { opened, defaultOpened, onOpenedChange, positioning = {
|
|
6
|
+
placement: "bottom-start",
|
|
7
|
+
offset: 4
|
|
8
|
+
}, middlewares = { flip: true, shift: true }, disabled = false, closeOnClickOutside = true, closeOnEscape = true } = options;
|
|
9
|
+
const [isOpen, setIsOpen] = useUncontrolled({
|
|
10
|
+
value: opened,
|
|
11
|
+
defaultValue: defaultOpened,
|
|
12
|
+
finalValue: false,
|
|
13
|
+
onChange: onOpenedChange
|
|
14
|
+
});
|
|
15
|
+
const middleware = useMemo(() => {
|
|
16
|
+
const middlewareList = [];
|
|
17
|
+
middlewareList.push(offset(positioning.offset ?? 4));
|
|
18
|
+
if (middlewares.flip) {
|
|
19
|
+
middlewareList.push(flip(typeof middlewares.flip === "boolean"
|
|
20
|
+
? undefined
|
|
21
|
+
: middlewares.flip));
|
|
22
|
+
}
|
|
23
|
+
if (middlewares.shift) {
|
|
24
|
+
middlewareList.push(shift(typeof middlewares.shift === "boolean"
|
|
25
|
+
? undefined
|
|
26
|
+
: middlewares.shift));
|
|
27
|
+
}
|
|
28
|
+
if (middlewares.inline) {
|
|
29
|
+
middlewareList.push(inline(typeof middlewares.inline === "boolean"
|
|
30
|
+
? undefined
|
|
31
|
+
: middlewares.inline));
|
|
32
|
+
}
|
|
33
|
+
return middlewareList;
|
|
34
|
+
}, [positioning.offset, middlewares]);
|
|
35
|
+
const floating = useFloating({
|
|
36
|
+
placement: positioning.placement,
|
|
37
|
+
open: isOpen,
|
|
38
|
+
onOpenChange: setIsOpen,
|
|
39
|
+
middleware,
|
|
40
|
+
whileElementsMounted: autoUpdate,
|
|
41
|
+
strategy: "fixed"
|
|
42
|
+
});
|
|
43
|
+
const dismiss = useDismiss(floating.context, {
|
|
44
|
+
outsidePress: closeOnClickOutside,
|
|
45
|
+
escapeKey: closeOnEscape
|
|
46
|
+
});
|
|
47
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);
|
|
48
|
+
const open = useCallback(() => {
|
|
49
|
+
if (!disabled) {
|
|
50
|
+
setIsOpen(true);
|
|
51
|
+
}
|
|
52
|
+
}, [disabled, setIsOpen]);
|
|
53
|
+
const close = useCallback(() => {
|
|
54
|
+
setIsOpen(false);
|
|
55
|
+
}, [setIsOpen]);
|
|
56
|
+
const toggle = useCallback(() => {
|
|
57
|
+
if (!disabled) {
|
|
58
|
+
setIsOpen(!isOpen);
|
|
59
|
+
}
|
|
60
|
+
}, [disabled, isOpen, setIsOpen]);
|
|
61
|
+
return {
|
|
62
|
+
opened: isOpen,
|
|
63
|
+
open,
|
|
64
|
+
close,
|
|
65
|
+
toggle,
|
|
66
|
+
context: floating.context,
|
|
67
|
+
refs: {
|
|
68
|
+
setReference: floating.refs.setReference,
|
|
69
|
+
setFloating: floating.refs.setFloating,
|
|
70
|
+
reference: floating.refs
|
|
71
|
+
.reference,
|
|
72
|
+
floating: floating.refs
|
|
73
|
+
.floating
|
|
74
|
+
},
|
|
75
|
+
floatingStyles: floating.floatingStyles,
|
|
76
|
+
getReferenceProps,
|
|
77
|
+
getFloatingProps,
|
|
78
|
+
placement: floating.placement
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer-body.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-body/drawer-body.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,QAAA,MAAM,UAAU,iEAmBf,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "../../../theme";
|
|
3
|
+
import { factory } from "../../../utils";
|
|
4
|
+
import { useDrawerContext } from "../drawer.context";
|
|
5
|
+
const DrawerBody = factory(({ children, className, ...props }, ref) => {
|
|
6
|
+
const { cx } = useTheme();
|
|
7
|
+
const { getStyles } = useDrawerContext();
|
|
8
|
+
return (_jsx("div", { ref: ref, className: cx("overflow-y-auto", getStyles("body"), className), ...props, children: children }));
|
|
9
|
+
});
|
|
10
|
+
DrawerBody.displayName = "@refraktor/core/Drawer.Body";
|
|
11
|
+
export default DrawerBody;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-body/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DrawerBody } from "./drawer-body";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-content.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-content/drawer-content.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawer-content.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-content/drawer-content.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAkB,MAAM,iBAAiB,CAAC;AAoB9E,QAAA,MAAM,aAAa,oEAsGlB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FloatingFocusManager, FloatingPortal } from "@floating-ui/react";
|
|
2
3
|
import { useTheme } from "../../../theme";
|
|
3
4
|
import { factory } from "../../../utils";
|
|
4
|
-
import { Portal } from "../../portal";
|
|
5
5
|
import { Transition } from "../../transition";
|
|
6
6
|
import { useDrawerContext } from "../drawer.context";
|
|
7
7
|
import { getSizeStyles } from "../drawer.styles";
|
|
@@ -19,9 +19,9 @@ const transitionsByPosition = {
|
|
|
19
19
|
};
|
|
20
20
|
const DrawerContent = factory(({ children, className, style, ...props }, ref) => {
|
|
21
21
|
const { cx, getRadius } = useTheme();
|
|
22
|
-
const { drawer, withinPortal, radius, position, size, transitionProps, headerId,
|
|
22
|
+
const { drawer, withinPortal, radius, position, size, trapFocus, returnFocus, transitionProps, headerId, getStyles } = useDrawerContext();
|
|
23
23
|
const setRefs = (node) => {
|
|
24
|
-
|
|
24
|
+
drawer.refs.setFloating(node);
|
|
25
25
|
if (typeof ref === "function") {
|
|
26
26
|
ref(node);
|
|
27
27
|
}
|
|
@@ -31,11 +31,14 @@ const DrawerContent = factory(({ children, className, style, ...props }, ref) =>
|
|
|
31
31
|
};
|
|
32
32
|
const { className: transitionClassName, ...resolvedTransitionProps } = transitionProps ?? {};
|
|
33
33
|
const sizeStyles = getSizeStyles(position, size);
|
|
34
|
-
const content = (_jsx(Transition, { transition: transitionsByPosition[position], duration: 200, mounted: drawer.opened, ...resolvedTransitionProps, className: cx("fixed inset-0 z-50 pointer-events-none", transitionClassName), children: _jsx(
|
|
34
|
+
const content = (_jsx(Transition, { transition: transitionsByPosition[position], duration: 200, mounted: drawer.opened, ...resolvedTransitionProps, className: cx("fixed inset-0 z-50 pointer-events-none", transitionClassName), children: drawer.opened ? (_jsx(FloatingFocusManager, { context: drawer.context, modal: trapFocus, returnFocus: returnFocus, outsideElementsInert: false, children: _jsx("div", { ref: setRefs, "aria-labelledby": headerId, "data-opened": drawer.opened, "data-position": position, style: {
|
|
35
|
+
...sizeStyles,
|
|
36
|
+
...style
|
|
37
|
+
}, className: cx("pointer-events-auto fixed z-50 border border-[var(--refraktor-border)] bg-[var(--refraktor-bg)] p-4 text-[var(--refraktor-text)] shadow-md", positionClasses[position], getRadius(radius), getStyles("content"), className), ...drawer.getFloatingProps(), ...props, children: children }) })) : (_jsx("div", { ref: setRefs, "aria-labelledby": headerId, "data-opened": drawer.opened, "data-position": position, style: {
|
|
35
38
|
...sizeStyles,
|
|
36
39
|
...style
|
|
37
|
-
}, className: cx("pointer-events-auto fixed z-50 border border-[var(--refraktor-border)] bg-[var(--refraktor-bg)] p-4 text-[var(--refraktor-text)] shadow-md", positionClasses[position], getRadius(radius), getStyles("content"), className), ...props, children: children }) }));
|
|
38
|
-
return withinPortal ? _jsx(
|
|
40
|
+
}, className: cx("pointer-events-auto fixed z-50 border border-[var(--refraktor-border)] bg-[var(--refraktor-bg)] p-4 text-[var(--refraktor-text)] shadow-md", positionClasses[position], getRadius(radius), getStyles("content"), className), ...props, children: children })) }));
|
|
41
|
+
return withinPortal ? (_jsx(FloatingPortal, { children: content })) : (content);
|
|
39
42
|
});
|
|
40
43
|
DrawerContent.displayName = "@refraktor/core/Drawer.Content";
|
|
41
44
|
export default DrawerContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-overlay.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-overlay/drawer-overlay.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"drawer-overlay.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-overlay/drawer-overlay.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,QAAA,MAAM,aAAa,oEA2ElB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FloatingOverlay, FloatingPortal } from "@floating-ui/react";
|
|
2
3
|
import { useTheme } from "../../../theme";
|
|
3
4
|
import { factory } from "../../../utils";
|
|
4
|
-
import { Portal } from "../../portal";
|
|
5
5
|
import { Transition } from "../../transition";
|
|
6
6
|
import { useDrawerContext } from "../drawer.context";
|
|
7
7
|
const DrawerOverlay = factory(({ closeOnClick = true, backgroundOpacity = 0.5, blur = 0, className, onMouseDown, style, ...props }, ref) => {
|
|
8
8
|
const { cx } = useTheme();
|
|
9
|
-
const { drawer, closeOnClickOutside, withinPortal, transitionProps, getStyles } = useDrawerContext();
|
|
9
|
+
const { drawer, closeOnClickOutside, lockScroll, withinPortal, transitionProps, getStyles } = useDrawerContext();
|
|
10
10
|
const blurValue = typeof blur === "number" ? `${blur}px` : blur;
|
|
11
11
|
const backdropFilterValue = blurValue !== "0" && blurValue !== "0px"
|
|
12
12
|
? `blur(${blurValue})`
|
|
@@ -20,12 +20,12 @@ const DrawerOverlay = factory(({ closeOnClick = true, backgroundOpacity = 0.5, b
|
|
|
20
20
|
}
|
|
21
21
|
drawer.close();
|
|
22
22
|
};
|
|
23
|
-
const overlayContent = (_jsx(Transition, { transition: "fade", duration: 150, mounted: drawer.opened, ...transitionProps, children: _jsx(
|
|
23
|
+
const overlayContent = (_jsx(Transition, { transition: "fade", duration: 150, mounted: drawer.opened, ...transitionProps, children: _jsx(FloatingOverlay, { lockScroll: lockScroll, ref: ref, className: cx("z-40", getStyles("overlay"), className), style: {
|
|
24
24
|
backgroundColor: `rgba(0, 0, 0, ${backgroundOpacity})`,
|
|
25
25
|
backdropFilter: backdropFilterValue,
|
|
26
26
|
...style
|
|
27
27
|
}, onMouseDown: handleMouseDown, ...props }) }));
|
|
28
|
-
return withinPortal ? (_jsx(
|
|
28
|
+
return withinPortal ? (_jsx(FloatingPortal, { children: overlayContent })) : (overlayContent);
|
|
29
29
|
});
|
|
30
30
|
DrawerOverlay.displayName = "@refraktor/core/Drawer.Overlay";
|
|
31
31
|
export default DrawerOverlay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-root.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-root/drawer-root.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawer-root.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer-root/drawer-root.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEH,wBAAwB,EAE3B,MAAM,iBAAiB,CAAC;AAczB,QAAA,MAAM,UAAU,iEAiEd,CAAC;AAIH,eAAe,UAAU,CAAC"}
|