@hebium-ui/core 0.1.0-alpha.3 → 0.1.0-alpha.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/dist/index.d.ts +12 -2
- package/dist/index.js +15 -5
- package/dist/logics/avatar-placeholder/get-avatar-placeholder.d.ts +1 -2
- package/dist/logics/avatar-placeholder/should-show-avatar-placeholder.d.ts +1 -2
- package/dist/logics/bool/to-bool.d.ts +1 -2
- package/dist/logics/bool/to-strbool.d.ts +1 -2
- package/dist/logics/button-control/button-control.d.ts +16 -0
- package/dist/logics/button-control/button-control.js +26 -0
- package/dist/logics/button-control/button-control.js.map +1 -0
- package/dist/logics/cc/cc-all.d.ts +1 -2
- package/dist/logics/cc/cc.d.ts +1 -2
- package/dist/logics/checkbox-control/checkbox-control.d.ts +1 -2
- package/dist/logics/combobox-control/combobox-control.d.ts +100 -0
- package/dist/logics/combobox-control/combobox-control.js +100 -0
- package/dist/logics/combobox-control/combobox-control.js.map +1 -0
- package/dist/logics/combobox-control/combobox-filter.d.ts +13 -0
- package/dist/logics/combobox-control/combobox-filter.js +11 -0
- package/dist/logics/combobox-control/combobox-filter.js.map +1 -0
- package/dist/logics/combobox-control/combobox-navigation.d.ts +2 -0
- package/dist/logics/combobox-control/combobox-navigation.js +10 -0
- package/dist/logics/combobox-control/combobox-navigation.js.map +1 -0
- package/dist/logics/dialog-control/dialog-control.d.ts +1 -2
- package/dist/logics/input-control/input-control.d.ts +1 -2
- package/dist/logics/label-marker/label-marker.d.ts +1 -2
- package/dist/logics/menu-control/menu-control.d.ts +1 -2
- package/dist/logics/menu-control/menu-control.js.map +1 -1
- package/dist/logics/ms/ms-all.d.ts +1 -2
- package/dist/logics/multi-combobox-control/multi-combobox-control.d.ts +58 -0
- package/dist/logics/multi-combobox-control/multi-combobox-control.js +76 -0
- package/dist/logics/multi-combobox-control/multi-combobox-control.js.map +1 -0
- package/dist/logics/multi-combobox-control/multi-combobox-focus.d.ts +15 -0
- package/dist/logics/multi-combobox-control/multi-combobox-focus.js +46 -0
- package/dist/logics/multi-combobox-control/multi-combobox-focus.js.map +1 -0
- package/dist/logics/popover-control/popover-control.d.ts +3 -2
- package/dist/logics/popover-control/popover-control.js +5 -1
- package/dist/logics/popover-control/popover-control.js.map +1 -1
- package/dist/logics/progress-control/progress-control.d.ts +1 -2
- package/dist/logics/progress-control/progress-control.js +1 -1
- package/dist/logics/progress-control/progress-control.js.map +1 -1
- package/dist/logics/radio-control/radio-control.d.ts +1 -2
- package/dist/logics/radiogroup-control/radiogroup-control.d.ts +1 -2
- package/dist/logics/segmented-control/segmented-control.d.ts +2 -3
- package/dist/logics/segmented-control/segmented-control.js +1 -1
- package/dist/logics/segmented-control/segmented-control.js.map +1 -1
- package/dist/logics/tabs-control/tabs-control.d.ts +1 -2
- package/dist/logics/tooltip-control/tooltip-control.d.ts +1 -2
- package/dist/recipes/alert/alert.d.ts +2 -3
- package/dist/recipes/alert/alert.js +1 -5
- package/dist/recipes/alert/alert.js.map +1 -1
- package/dist/recipes/anchor/anchor.d.ts +1 -2
- package/dist/recipes/avatar/avatar.d.ts +1 -2
- package/dist/recipes/blockquote/blockquote.d.ts +1 -2
- package/dist/recipes/button/button.d.ts +10 -3
- package/dist/recipes/button/button.js +32 -12
- package/dist/recipes/button/button.js.map +1 -1
- package/dist/recipes/checkbox/checkbox.d.ts +2 -3
- package/dist/recipes/code/code.d.ts +1 -2
- package/dist/recipes/combobox/combobox.d.ts +8 -0
- package/dist/recipes/combobox/combobox.js +34 -0
- package/dist/recipes/combobox/combobox.js.map +1 -0
- package/dist/recipes/container/container.d.ts +1 -2
- package/dist/recipes/details/details.d.ts +1 -2
- package/dist/recipes/dialog/dialog.d.ts +1 -2
- package/dist/recipes/dl/dl.d.ts +1 -2
- package/dist/recipes/drawer/drawer.d.ts +1 -2
- package/dist/recipes/fieldset/fieldset.d.ts +1 -2
- package/dist/recipes/focus-ring/focus-ring.d.ts +1 -2
- package/dist/recipes/heading/heading.d.ts +1 -2
- package/dist/recipes/hr/hr.d.ts +1 -2
- package/dist/recipes/inline-feedback/inline-feedback.d.ts +50 -0
- package/dist/recipes/inline-feedback/inline-feedback.js +45 -0
- package/dist/recipes/inline-feedback/inline-feedback.js.map +1 -0
- package/dist/recipes/input/input.d.ts +1 -2
- package/dist/recipes/label/label.d.ts +2 -3
- package/dist/recipes/label/label.js +1 -0
- package/dist/recipes/label/label.js.map +1 -1
- package/dist/recipes/menu/menu.d.ts +1 -2
- package/dist/recipes/menu/menu.js +4 -1
- package/dist/recipes/menu/menu.js.map +1 -1
- package/dist/recipes/multi-combobox/multi-combobox.d.ts +8 -0
- package/dist/recipes/multi-combobox/multi-combobox.js +52 -0
- package/dist/recipes/multi-combobox/multi-combobox.js.map +1 -0
- package/dist/recipes/paragraph/paragraph.d.ts +1 -2
- package/dist/recipes/popover/popover.d.ts +1 -2
- package/dist/recipes/popover/popover.js +0 -1
- package/dist/recipes/popover/popover.js.map +1 -1
- package/dist/recipes/progress/progress.d.ts +2 -3
- package/dist/recipes/radio/radio.d.ts +2 -3
- package/dist/recipes/radiogroup/radiogroup.d.ts +1 -2
- package/dist/recipes/section/section.d.ts +1 -2
- package/dist/recipes/segmented-control/segmented-control.d.ts +1 -2
- package/dist/recipes/segmented-control/segmented-control.js +6 -3
- package/dist/recipes/segmented-control/segmented-control.js.map +1 -1
- package/dist/recipes/select/select.d.ts +1 -2
- package/dist/recipes/skip-link/skip-link.d.ts +1 -2
- package/dist/recipes/status-icon/status-icon.d.ts +55 -0
- package/dist/recipes/status-icon/status-icon.js +39 -0
- package/dist/recipes/status-icon/status-icon.js.map +1 -0
- package/dist/recipes/table/table.d.ts +1 -2
- package/dist/recipes/tabs/tabs.d.ts +1 -2
- package/dist/recipes/tag/tag.d.ts +64 -0
- package/dist/recipes/tag/tag.js +86 -0
- package/dist/recipes/tag/tag.js.map +1 -0
- package/dist/recipes/text/text.d.ts +1 -2
- package/dist/recipes/visually-hidden/visually-hidden.d.ts +1 -2
- package/dist/style.css +1 -1
- package/dist/styles/css-vars.d.ts +1 -2
- package/dist/styles/make-recipe-type.d.ts +1 -2
- package/dist/styles/make-recipe.d.ts +1 -2
- package/dist/styles/primitive-css/{active.module.js → active.module.css.js} +1 -1
- package/dist/styles/primitive-css/active.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{base.module.js → base.module.css.js} +1 -1
- package/dist/styles/primitive-css/base.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{checked.module.js → checked.module.css.js} +1 -1
- package/dist/styles/primitive-css/checked.module.css.js.map +1 -0
- package/dist/styles/primitive-css/composite.module.css.js +5 -0
- package/dist/styles/primitive-css/composite.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{disabled.module.js → disabled.module.css.js} +1 -1
- package/dist/styles/primitive-css/disabled.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{focus.module.js → focus.module.css.js} +3 -2
- package/dist/styles/primitive-css/focus.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{hover.module.js → hover.module.css.js} +1 -1
- package/dist/styles/primitive-css/hover.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{icon.module.js → icon.module.css.js} +6 -2
- package/dist/styles/primitive-css/icon.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{misc.module.js → misc.module.css.js} +5 -4
- package/dist/styles/primitive-css/misc.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{neutral.module.js → neutral.module.css.js} +11 -1
- package/dist/styles/primitive-css/neutral.module.css.js.map +1 -0
- package/dist/styles/primitive-css/{pseudo-element.module.js → pseudo-element.module.css.js} +1 -1
- package/dist/styles/primitive-css/pseudo-element.module.css.js.map +1 -0
- package/dist/styles/primitive.gen.d.ts +32 -4
- package/dist/styles/primitive.gen.js +42 -21
- package/dist/styles/primitive.gen.js.map +1 -1
- package/package.json +5 -5
- package/dist/styles/primitive-css/active.module.js.map +0 -1
- package/dist/styles/primitive-css/base.module.js.map +0 -1
- package/dist/styles/primitive-css/checked.module.js.map +0 -1
- package/dist/styles/primitive-css/composite.module.js +0 -5
- package/dist/styles/primitive-css/composite.module.js.map +0 -1
- package/dist/styles/primitive-css/disabled.module.js.map +0 -1
- package/dist/styles/primitive-css/focus.module.js.map +0 -1
- package/dist/styles/primitive-css/hover.module.js.map +0 -1
- package/dist/styles/primitive-css/icon.module.js.map +0 -1
- package/dist/styles/primitive-css/misc.module.js.map +0 -1
- package/dist/styles/primitive-css/neutral.module.js.map +0 -1
- package/dist/styles/primitive-css/pseudo-element.module.js.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ComboboxKeyEvent, comboboxControl } from "../combobox-control/combobox-control.js";
|
|
2
|
+
import { ComboboxMode, ComboboxSelectOption } from "../combobox-control/combobox-filter.js";
|
|
3
|
+
import { createTagRemovalFocus, focusLastTag, getTagRemovalFocusValue, getTagRemoveButtonAttributes } from "./multi-combobox-focus.js";
|
|
4
|
+
export interface MultiComboboxState {
|
|
5
|
+
mode: ComboboxMode;
|
|
6
|
+
value: readonly string[];
|
|
7
|
+
query: string;
|
|
8
|
+
activeValue: string | null;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
readOnly: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MultiComboboxItemState {
|
|
13
|
+
selected: boolean;
|
|
14
|
+
active: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function getTagLabel(mode: ComboboxMode, value: string, option: Readonly<ComboboxSelectOption> | undefined): string;
|
|
17
|
+
declare function toggle(state: Readonly<MultiComboboxState>, option: Readonly<ComboboxSelectOption>): string[] | null;
|
|
18
|
+
declare function remove(state: Readonly<MultiComboboxState>, value: string): string[] | null;
|
|
19
|
+
declare function addText(state: Readonly<MultiComboboxState>): string[] | null;
|
|
20
|
+
interface MultiComboboxValidationState extends Pick<MultiComboboxState, "value" | "disabled" | "readOnly"> {
|
|
21
|
+
required: boolean;
|
|
22
|
+
requiredMessage?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
declare function getValidationMessage(state: Readonly<MultiComboboxValidationState>): string;
|
|
25
|
+
export interface MultiComboboxFormValueProps {
|
|
26
|
+
name: string;
|
|
27
|
+
value: readonly string[];
|
|
28
|
+
form: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
interface MultiComboboxFormValueOptions extends Omit<MultiComboboxFormValueProps, "name"> {
|
|
31
|
+
name: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
declare function getFormValueProps({ name, value, form }: Readonly<MultiComboboxFormValueOptions>): MultiComboboxFormValueProps | null;
|
|
34
|
+
export type MultiComboboxKeyAction = "none" | "next" | "previous" | "commit" | "blocked" | "submit" | "add" | "focus-tag";
|
|
35
|
+
interface MultiComboboxKeyState extends MultiComboboxState {
|
|
36
|
+
opened: boolean;
|
|
37
|
+
}
|
|
38
|
+
declare function getKeyAction(event: Readonly<ComboboxKeyEvent>, state: Readonly<MultiComboboxKeyState>, activeOption: Readonly<ComboboxSelectOption> | undefined): MultiComboboxKeyAction;
|
|
39
|
+
declare function getListAttributes(listId: string, inputId: string, state: Pick<MultiComboboxState, "disabled" | "readOnly">): ReturnType<typeof comboboxControl.getListAttributes> & {
|
|
40
|
+
"aria-multiselectable": true;
|
|
41
|
+
};
|
|
42
|
+
declare function getItemAttributes(id: string, { selected, active }: Readonly<MultiComboboxItemState>, disabled: boolean): ReturnType<typeof comboboxControl.getItemAttributes>;
|
|
43
|
+
export declare const multiComboboxControl: {
|
|
44
|
+
readonly getTagLabel: typeof getTagLabel;
|
|
45
|
+
readonly toggle: typeof toggle;
|
|
46
|
+
readonly remove: typeof remove;
|
|
47
|
+
readonly addText: typeof addText;
|
|
48
|
+
readonly getValidationMessage: typeof getValidationMessage;
|
|
49
|
+
readonly getFormValueProps: typeof getFormValueProps;
|
|
50
|
+
readonly getKeyAction: typeof getKeyAction;
|
|
51
|
+
readonly getListAttributes: typeof getListAttributes;
|
|
52
|
+
readonly getItemAttributes: typeof getItemAttributes;
|
|
53
|
+
readonly getTagRemoveButtonAttributes: typeof getTagRemoveButtonAttributes;
|
|
54
|
+
readonly getTagRemovalFocusValue: typeof getTagRemovalFocusValue;
|
|
55
|
+
readonly createTagRemovalFocus: typeof createTagRemovalFocus;
|
|
56
|
+
readonly focusLastTag: typeof focusLastTag;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { comboboxControl } from "../combobox-control/combobox-control.js";
|
|
2
|
+
import { getComboboxOptionText } from "../combobox-control/combobox-filter.js";
|
|
3
|
+
import { createTagRemovalFocus, focusLastTag, getTagRemovalFocusValue, getTagRemoveButtonAttributes } from "./multi-combobox-focus.js";
|
|
4
|
+
// src/logics/multi-combobox-control/multi-combobox-control.ts
|
|
5
|
+
function getTagLabel(mode, value, option) {
|
|
6
|
+
return option ? getComboboxOptionText(mode, option) : value;
|
|
7
|
+
}
|
|
8
|
+
function toggle(state, option) {
|
|
9
|
+
if (!comboboxControl.canEdit(state) || option.disabled) return null;
|
|
10
|
+
return state.value.includes(option.value) ? state.value.filter((value) => value !== option.value) : [...state.value, option.value];
|
|
11
|
+
}
|
|
12
|
+
function remove(state, value) {
|
|
13
|
+
if (!comboboxControl.canEdit(state) || !state.value.includes(value)) return null;
|
|
14
|
+
return state.value.filter((selected) => selected !== value);
|
|
15
|
+
}
|
|
16
|
+
function addText(state) {
|
|
17
|
+
if (!comboboxControl.canEdit(state) || state.mode !== "text") return null;
|
|
18
|
+
const value = state.query.trim();
|
|
19
|
+
if (value === "" || state.value.includes(value)) return null;
|
|
20
|
+
return [...state.value, value];
|
|
21
|
+
}
|
|
22
|
+
function getValidationMessage(state) {
|
|
23
|
+
if (!state.required || !comboboxControl.canEdit(state) || state.value.length > 0) return "";
|
|
24
|
+
return state.requiredMessage || "Please fill out this field.";
|
|
25
|
+
}
|
|
26
|
+
function getFormValueProps({ name, value, form }) {
|
|
27
|
+
return name !== void 0 ? {
|
|
28
|
+
name,
|
|
29
|
+
value,
|
|
30
|
+
form
|
|
31
|
+
} : null;
|
|
32
|
+
}
|
|
33
|
+
function getKeyAction(event, state, activeOption) {
|
|
34
|
+
if (!comboboxControl.canEdit(state)) return "none";
|
|
35
|
+
if (event.isComposing || event.keyCode === 229) return "none";
|
|
36
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return "none";
|
|
37
|
+
if (event.key === "Backspace") {
|
|
38
|
+
if (state.query !== "") return "none";
|
|
39
|
+
if (state.value.length === 0) return "none";
|
|
40
|
+
return "focus-tag";
|
|
41
|
+
}
|
|
42
|
+
const action = comboboxControl.getKeyAction(event, state, activeOption);
|
|
43
|
+
if (action !== "submit") return action;
|
|
44
|
+
if (state.mode === "select" || state.query.trim() === "") return "submit";
|
|
45
|
+
else return "add";
|
|
46
|
+
}
|
|
47
|
+
function getListAttributes(listId, inputId, state) {
|
|
48
|
+
return {
|
|
49
|
+
...comboboxControl.getListAttributes(listId, inputId, state),
|
|
50
|
+
"aria-multiselectable": true
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function getItemAttributes(id, { selected, active }, disabled) {
|
|
54
|
+
return {
|
|
55
|
+
...comboboxControl.getItemAttributes(id, active, disabled),
|
|
56
|
+
"aria-selected": selected
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const multiComboboxControl = {
|
|
60
|
+
getTagLabel,
|
|
61
|
+
toggle,
|
|
62
|
+
remove,
|
|
63
|
+
addText,
|
|
64
|
+
getValidationMessage,
|
|
65
|
+
getFormValueProps,
|
|
66
|
+
getKeyAction,
|
|
67
|
+
getListAttributes,
|
|
68
|
+
getItemAttributes,
|
|
69
|
+
getTagRemoveButtonAttributes,
|
|
70
|
+
getTagRemovalFocusValue,
|
|
71
|
+
createTagRemovalFocus,
|
|
72
|
+
focusLastTag
|
|
73
|
+
};
|
|
74
|
+
export { multiComboboxControl };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=multi-combobox-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-combobox-control.js","names":[],"sources":["../../../src/logics/multi-combobox-control/multi-combobox-control.ts"],"sourcesContent":["import {\n comboboxControl,\n type ComboboxKeyEvent,\n type ComboboxMode,\n type ComboboxSelectOption,\n getComboboxOptionText,\n} from \"../combobox-control\";\nimport {\n createTagRemovalFocus,\n focusLastTag,\n getTagRemovalFocusValue,\n getTagRemoveButtonAttributes,\n} from \"./multi-combobox-focus\";\n\nexport interface MultiComboboxState {\n mode: ComboboxMode;\n value: readonly string[];\n query: string;\n activeValue: string | null;\n disabled: boolean;\n readOnly: boolean;\n}\n\nexport interface MultiComboboxItemState {\n selected: boolean;\n active: boolean;\n}\n\nfunction getTagLabel(\n mode: ComboboxMode,\n value: string,\n option: Readonly<ComboboxSelectOption> | undefined,\n): string {\n return option ? getComboboxOptionText(mode, option) : value;\n}\n\nfunction toggle(\n state: Readonly<MultiComboboxState>,\n option: Readonly<ComboboxSelectOption>,\n): string[] | null {\n if (!comboboxControl.canEdit(state) || option.disabled) return null;\n return state.value.includes(option.value)\n ? state.value.filter((value) => value !== option.value)\n : [...state.value, option.value];\n}\n\nfunction remove(\n state: Readonly<MultiComboboxState>,\n value: string,\n): string[] | null {\n if (!comboboxControl.canEdit(state) || !state.value.includes(value)) return null;\n return state.value.filter((selected) => selected !== value);\n}\n\nfunction addText(state: Readonly<MultiComboboxState>): string[] | null {\n if (!comboboxControl.canEdit(state) || state.mode !== \"text\") return null;\n const value = state.query.trim();\n if (value === \"\" || state.value.includes(value)) return null;\n return [...state.value, value];\n}\n\ninterface MultiComboboxValidationState extends Pick<MultiComboboxState, \"value\" | \"disabled\" | \"readOnly\"> {\n required: boolean;\n requiredMessage?: string | undefined;\n}\n\nfunction getValidationMessage(state: Readonly<MultiComboboxValidationState>): string {\n if (!state.required || !comboboxControl.canEdit(state) || state.value.length > 0) return \"\";\n return state.requiredMessage || \"Please fill out this field.\";\n}\n\nexport interface MultiComboboxFormValueProps {\n name: string;\n value: readonly string[];\n form: string | undefined;\n}\n\ninterface MultiComboboxFormValueOptions extends Omit<MultiComboboxFormValueProps, \"name\"> {\n name: string | undefined;\n}\n\nfunction getFormValueProps(\n { name, value, form }: Readonly<MultiComboboxFormValueOptions>,\n): MultiComboboxFormValueProps | null {\n return name !== undefined\n ? { name, value, form }\n : null;\n}\n\nexport type MultiComboboxKeyAction =\n | \"none\"\n | \"next\"\n | \"previous\"\n | \"commit\"\n | \"blocked\"\n | \"submit\"\n | \"add\"\n | \"focus-tag\";\n\ninterface MultiComboboxKeyState extends MultiComboboxState {\n opened: boolean;\n}\n\nfunction getKeyAction(\n event: Readonly<ComboboxKeyEvent>,\n state: Readonly<MultiComboboxKeyState>,\n activeOption: Readonly<ComboboxSelectOption> | undefined,\n): MultiComboboxKeyAction {\n if (!comboboxControl.canEdit(state)) return \"none\";\n if (event.isComposing || event.keyCode === 229) return \"none\";\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return \"none\";\n\n if (event.key === \"Backspace\") {\n if (state.query !== \"\") return \"none\";\n if (state.value.length === 0) return \"none\";\n return \"focus-tag\";\n }\n\n const action = comboboxControl.getKeyAction(event, state, activeOption);\n if (action !== \"submit\") return action;\n\n if (state.mode === \"select\" || state.query.trim() === \"\") {\n return \"submit\";\n } else {\n return \"add\";\n }\n}\n\nfunction getListAttributes(\n listId: string,\n inputId: string,\n state: Pick<MultiComboboxState, \"disabled\" | \"readOnly\">,\n): ReturnType<typeof comboboxControl.getListAttributes> & { \"aria-multiselectable\": true } {\n return {\n ...comboboxControl.getListAttributes(listId, inputId, state),\n \"aria-multiselectable\": true,\n };\n}\n\nfunction getItemAttributes(\n id: string,\n { selected, active }: Readonly<MultiComboboxItemState>,\n disabled: boolean,\n): ReturnType<typeof comboboxControl.getItemAttributes> {\n return {\n ...comboboxControl.getItemAttributes(id, active, disabled),\n \"aria-selected\": selected,\n };\n}\n\nexport const multiComboboxControl = {\n getTagLabel,\n toggle,\n remove,\n addText,\n getValidationMessage,\n getFormValueProps,\n getKeyAction,\n getListAttributes,\n getItemAttributes,\n getTagRemoveButtonAttributes,\n getTagRemovalFocusValue,\n createTagRemovalFocus,\n focusLastTag,\n} as const;\n"],"mappings":";;;;AA4BA,SAAS,YACP,MACA,OACA,QACQ;CACR,OAAO,SAAS,sBAAsB,MAAM,MAAM,IAAI;AACxD;AAEA,SAAS,OACP,OACA,QACiB;CACjB,IAAI,CAAC,gBAAgB,QAAQ,KAAK,KAAK,OAAO,UAAU,OAAO;CAC/D,OAAO,MAAM,MAAM,SAAS,OAAO,KAAK,IACpC,MAAM,MAAM,QAAQ,UAAU,UAAU,OAAO,KAAK,IACpD,CAAC,GAAG,MAAM,OAAO,OAAO,KAAK;AACnC;AAEA,SAAS,OACP,OACA,OACiB;CACjB,IAAI,CAAC,gBAAgB,QAAQ,KAAK,KAAK,CAAC,MAAM,MAAM,SAAS,KAAK,GAAG,OAAO;CAC5E,OAAO,MAAM,MAAM,QAAQ,aAAa,aAAa,KAAK;AAC5D;AAEA,SAAS,QAAQ,OAAsD;CACrE,IAAI,CAAC,gBAAgB,QAAQ,KAAK,KAAK,MAAM,SAAS,QAAQ,OAAO;CACrE,MAAM,QAAQ,MAAM,MAAM,KAAK;CAC/B,IAAI,UAAU,MAAM,MAAM,MAAM,SAAS,KAAK,GAAG,OAAO;CACxD,OAAO,CAAC,GAAG,MAAM,OAAO,KAAK;AAC/B;AAOA,SAAS,qBAAqB,OAAuD;CACnF,IAAI,CAAC,MAAM,YAAY,CAAC,gBAAgB,QAAQ,KAAK,KAAK,MAAM,MAAM,SAAS,GAAG,OAAO;CACzF,OAAO,MAAM,mBAAmB;AAClC;AAYA,SAAS,kBACP,EAAE,MAAM,OAAO,QACqB;CACpC,OAAO,SAAS,KAAA,IACZ;EAAE;EAAM;EAAO;CAAK,IACpB;AACN;AAgBA,SAAS,aACP,OACA,OACA,cACwB;CACxB,IAAI,CAAC,gBAAgB,QAAQ,KAAK,GAAG,OAAO;CAC5C,IAAI,MAAM,eAAe,MAAM,YAAY,KAAK,OAAO;CACvD,IAAI,MAAM,UAAU,MAAM,WAAW,MAAM,WAAW,MAAM,UAAU,OAAO;CAE7E,IAAI,MAAM,QAAQ,aAAa;EAC7B,IAAI,MAAM,UAAU,IAAI,OAAO;EAC/B,IAAI,MAAM,MAAM,WAAW,GAAG,OAAO;EACrC,OAAO;CACT;CAEA,MAAM,SAAS,gBAAgB,aAAa,OAAO,OAAO,YAAY;CACtE,IAAI,WAAW,UAAU,OAAO;CAEhC,IAAI,MAAM,SAAS,YAAY,MAAM,MAAM,KAAK,MAAM,IACpD,OAAO;MAEP,OAAO;AAEX;AAEA,SAAS,kBACP,QACA,SACA,OACyF;CACzF,OAAO;EACL,GAAG,gBAAgB,kBAAkB,QAAQ,SAAS,KAAK;EAC3D,wBAAwB;CAC1B;AACF;AAEA,SAAS,kBACP,IACA,EAAE,UAAU,UACZ,UACsD;CACtD,OAAO;EACL,GAAG,gBAAgB,kBAAkB,IAAI,QAAQ,QAAQ;EACzD,iBAAiB;CACnB;AACF;AAEA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface MultiComboboxTagRemoveButtonAttributes {
|
|
2
|
+
"data-hui-multi-combobox-remove": string;
|
|
3
|
+
}
|
|
4
|
+
export declare function getTagRemoveButtonAttributes(value: string): MultiComboboxTagRemoveButtonAttributes;
|
|
5
|
+
export declare function getTagRemovalFocusValue(previousValues: readonly string[], removedValue: string, focusableValues: readonly string[]): string | null;
|
|
6
|
+
interface MultiComboboxRemovalFocusOptions {
|
|
7
|
+
root: HTMLElement | null;
|
|
8
|
+
input: HTMLInputElement | null;
|
|
9
|
+
button: HTMLButtonElement;
|
|
10
|
+
value: readonly string[];
|
|
11
|
+
removedValue: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createTagRemovalFocus({ root, input, button, value, removedValue }: MultiComboboxRemovalFocusOptions): (() => void) | undefined;
|
|
14
|
+
export declare function focusLastTag(root: HTMLElement | null, value: readonly string[]): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/logics/multi-combobox-control/multi-combobox-focus.ts
|
|
2
|
+
const TAG_REMOVE_BUTTON_ATTRIBUTE = "data-hui-multi-combobox-remove";
|
|
3
|
+
function getTagRemoveButtonAttributes(value) {
|
|
4
|
+
return { [TAG_REMOVE_BUTTON_ATTRIBUTE]: value };
|
|
5
|
+
}
|
|
6
|
+
function getTagRemoveButtons(root) {
|
|
7
|
+
return root?.isConnected ? Array.from(root.querySelectorAll(`button[${TAG_REMOVE_BUTTON_ATTRIBUTE}]`)) : [];
|
|
8
|
+
}
|
|
9
|
+
function canFocus(element) {
|
|
10
|
+
return element.isConnected && !element.matches(":disabled");
|
|
11
|
+
}
|
|
12
|
+
function getTagRemovalFocusValue(previousValues, removedValue, focusableValues) {
|
|
13
|
+
const index = previousValues.indexOf(removedValue);
|
|
14
|
+
if (index === -1) return null;
|
|
15
|
+
const nextValue = previousValues.slice(index + 1).find((value) => focusableValues.includes(value));
|
|
16
|
+
if (nextValue !== void 0) return nextValue;
|
|
17
|
+
return previousValues.slice(0, index).toReversed().find((value) => focusableValues.includes(value)) ?? null;
|
|
18
|
+
}
|
|
19
|
+
function createTagRemovalFocus({ root, input, button, value, removedValue }) {
|
|
20
|
+
if (!root || !input || !root.contains(button) || button.ownerDocument.activeElement !== button) return;
|
|
21
|
+
const previousValues = [...value];
|
|
22
|
+
return () => {
|
|
23
|
+
if (!root.isConnected) return;
|
|
24
|
+
const buttons = getTagRemoveButtons(root).filter(canFocus);
|
|
25
|
+
const buttonsByValue = /* @__PURE__ */ new Map();
|
|
26
|
+
for (const candidate of buttons) {
|
|
27
|
+
const candidateValue = candidate.getAttribute(TAG_REMOVE_BUTTON_ATTRIBUTE);
|
|
28
|
+
if (candidateValue === null) continue;
|
|
29
|
+
buttonsByValue.set(candidateValue, candidate);
|
|
30
|
+
}
|
|
31
|
+
const focusableValues = [...buttonsByValue.keys()];
|
|
32
|
+
const nextValue = getTagRemovalFocusValue(previousValues, removedValue, focusableValues);
|
|
33
|
+
const target = nextValue === null ? input : buttonsByValue.get(nextValue);
|
|
34
|
+
if (target && canFocus(target)) target.focus();
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function focusLastTag(root, value) {
|
|
38
|
+
const lastValue = value.at(-1);
|
|
39
|
+
if (lastValue === void 0) return;
|
|
40
|
+
const button = getTagRemoveButtons(root).find((candidate) => candidate.getAttribute(TAG_REMOVE_BUTTON_ATTRIBUTE) === lastValue);
|
|
41
|
+
if (!button || !canFocus(button)) return;
|
|
42
|
+
button.focus();
|
|
43
|
+
}
|
|
44
|
+
export { createTagRemovalFocus, focusLastTag, getTagRemovalFocusValue, getTagRemoveButtonAttributes };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=multi-combobox-focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-combobox-focus.js","names":[],"sources":["../../../src/logics/multi-combobox-control/multi-combobox-focus.ts"],"sourcesContent":["const TAG_REMOVE_BUTTON_ATTRIBUTE = \"data-hui-multi-combobox-remove\";\n\ninterface MultiComboboxTagRemoveButtonAttributes {\n \"data-hui-multi-combobox-remove\": string;\n}\n\nexport function getTagRemoveButtonAttributes(value: string): MultiComboboxTagRemoveButtonAttributes {\n return { [TAG_REMOVE_BUTTON_ATTRIBUTE]: value };\n}\n\nfunction getTagRemoveButtons(root: HTMLElement | null): HTMLButtonElement[] {\n return root?.isConnected\n ? Array.from(root.querySelectorAll<HTMLButtonElement>(`button[${TAG_REMOVE_BUTTON_ATTRIBUTE}]`))\n : [];\n}\n\nfunction canFocus(element: HTMLButtonElement | HTMLInputElement): boolean {\n return element.isConnected && !element.matches(\":disabled\");\n}\n\nexport function getTagRemovalFocusValue(\n previousValues: readonly string[],\n removedValue: string,\n focusableValues: readonly string[],\n): string | null {\n const index = previousValues.indexOf(removedValue);\n if (index === -1) return null;\n\n const nextValue = previousValues\n .slice(index + 1)\n .find((value) => focusableValues.includes(value));\n if (nextValue !== undefined) return nextValue;\n\n const previousValue = previousValues\n .slice(0, index)\n .toReversed()\n .find((value) => focusableValues.includes(value));\n return previousValue ?? null;\n}\n\ninterface MultiComboboxRemovalFocusOptions {\n root: HTMLElement | null;\n input: HTMLInputElement | null;\n button: HTMLButtonElement;\n value: readonly string[];\n removedValue: string;\n}\n\nexport function createTagRemovalFocus({\n root,\n input,\n button,\n value,\n removedValue,\n}: MultiComboboxRemovalFocusOptions): (() => void) | undefined {\n if (!root || !input || !root.contains(button) || button.ownerDocument.activeElement !== button) return;\n const previousValues = [...value];\n\n return () => {\n if (!root.isConnected) return;\n const buttons = getTagRemoveButtons(root).filter(canFocus);\n const buttonsByValue = new Map<string, HTMLButtonElement>();\n for (const candidate of buttons) {\n const candidateValue = candidate.getAttribute(TAG_REMOVE_BUTTON_ATTRIBUTE);\n if (candidateValue === null) continue;\n buttonsByValue.set(candidateValue, candidate);\n }\n\n const focusableValues = [...buttonsByValue.keys()];\n const nextValue = getTagRemovalFocusValue(previousValues, removedValue, focusableValues);\n const target = nextValue === null ? input : buttonsByValue.get(nextValue);\n if (target && canFocus(target)) target.focus();\n };\n}\n\nexport function focusLastTag(root: HTMLElement | null, value: readonly string[]): void {\n const lastValue = value.at(-1);\n if (lastValue === undefined) return;\n\n const button = getTagRemoveButtons(root).find((candidate) =>\n candidate.getAttribute(TAG_REMOVE_BUTTON_ATTRIBUTE) === lastValue\n );\n if (!button || !canFocus(button)) return;\n button.focus();\n}\n"],"mappings":";AAAA,MAAM,8BAA8B;AAMpC,SAAgB,6BAA6B,OAAuD;CAClG,OAAO,GAAG,8BAA8B,MAAM;AAChD;AAEA,SAAS,oBAAoB,MAA+C;CAC1E,OAAO,MAAM,cACT,MAAM,KAAK,KAAK,iBAAoC,UAAU,4BAA4B,EAAE,CAAC,IAC7F,CAAC;AACP;AAEA,SAAS,SAAS,SAAwD;CACxE,OAAO,QAAQ,eAAe,CAAC,QAAQ,QAAQ,WAAW;AAC5D;AAEA,SAAgB,wBACd,gBACA,cACA,iBACe;CACf,MAAM,QAAQ,eAAe,QAAQ,YAAY;CACjD,IAAI,UAAU,IAAI,OAAO;CAEzB,MAAM,YAAY,eACf,MAAM,QAAQ,CAAC,CAAC,CAChB,MAAM,UAAU,gBAAgB,SAAS,KAAK,CAAC;CAClD,IAAI,cAAc,KAAA,GAAW,OAAO;CAMpC,OAJsB,eACnB,MAAM,GAAG,KAAK,CAAC,CACf,WAAW,CAAC,CACZ,MAAM,UAAU,gBAAgB,SAAS,KAAK,CAC9B,KAAK;AAC1B;AAUA,SAAgB,sBAAsB,EACpC,MACA,OACA,QACA,OACA,gBAC6D;CAC7D,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,SAAS,MAAM,KAAK,OAAO,cAAc,kBAAkB,QAAQ;CAChG,MAAM,iBAAiB,CAAC,GAAG,KAAK;CAEhC,aAAa;EACX,IAAI,CAAC,KAAK,aAAa;EACvB,MAAM,UAAU,oBAAoB,IAAI,CAAC,CAAC,OAAO,QAAQ;EACzD,MAAM,iCAAiB,IAAI,IAA+B;EAC1D,KAAK,MAAM,aAAa,SAAS;GAC/B,MAAM,iBAAiB,UAAU,aAAa,2BAA2B;GACzE,IAAI,mBAAmB,MAAM;GAC7B,eAAe,IAAI,gBAAgB,SAAS;EAC9C;EAEA,MAAM,kBAAkB,CAAC,GAAG,eAAe,KAAK,CAAC;EACjD,MAAM,YAAY,wBAAwB,gBAAgB,cAAc,eAAe;EACvF,MAAM,SAAS,cAAc,OAAO,QAAQ,eAAe,IAAI,SAAS;EACxE,IAAI,UAAU,SAAS,MAAM,GAAG,OAAO,MAAM;CAC/C;AACF;AAEA,SAAgB,aAAa,MAA0B,OAAgC;CACrF,MAAM,YAAY,MAAM,GAAG,EAAE;CAC7B,IAAI,cAAc,KAAA,GAAW;CAE7B,MAAM,SAAS,oBAAoB,IAAI,CAAC,CAAC,MAAM,cAC7C,UAAU,aAAa,2BAA2B,MAAM,SAC1D;CACA,IAAI,CAAC,UAAU,CAAC,SAAS,MAAM,GAAG;CAClC,OAAO,MAAM;AACf"}
|
|
@@ -14,9 +14,10 @@ export interface PopoverContentAttributes {
|
|
|
14
14
|
popover: "auto";
|
|
15
15
|
}
|
|
16
16
|
declare function getContentAttributes(state: Readonly<PopoverState>): PopoverContentAttributes;
|
|
17
|
+
declare function isOpened(element: Element | null): boolean;
|
|
17
18
|
export declare const popoverControl: {
|
|
18
19
|
readonly getTriggerAttributes: typeof getTriggerAttributes;
|
|
19
20
|
readonly getContentAttributes: typeof getContentAttributes;
|
|
21
|
+
readonly isOpened: typeof isOpened;
|
|
20
22
|
};
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=popover-control.d.ts.map
|
|
23
|
+
export {};
|
|
@@ -11,9 +11,13 @@ function getContentAttributes(state) {
|
|
|
11
11
|
popover: "auto"
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
function isOpened(element) {
|
|
15
|
+
return element?.matches(":popover-open") ?? false;
|
|
16
|
+
}
|
|
14
17
|
const popoverControl = {
|
|
15
18
|
getTriggerAttributes,
|
|
16
|
-
getContentAttributes
|
|
19
|
+
getContentAttributes,
|
|
20
|
+
isOpened
|
|
17
21
|
};
|
|
18
22
|
export { popoverControl };
|
|
19
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-control.js","names":[],"sources":["../../../src/logics/popover-control/popover-control.ts"],"sourcesContent":["export interface PopoverState {\n popoverId: string;\n}\n\nexport interface PopoverTriggerAttributeOptions {\n isButtonElement: boolean;\n}\n\nexport interface PopoverTriggerAttributes {\n popovertarget: string;\n type: \"button\" | undefined;\n}\n\nfunction getTriggerAttributes(\n state: Readonly<PopoverState>,\n options: Readonly<PopoverTriggerAttributeOptions>,\n): PopoverTriggerAttributes {\n return {\n popovertarget: state.popoverId,\n type: options.isButtonElement ? \"button\" : undefined,\n };\n}\n\nexport interface PopoverContentAttributes {\n id: string;\n popover: \"auto\";\n}\n\nfunction getContentAttributes(state: Readonly<PopoverState>): PopoverContentAttributes {\n return {\n id: state.popoverId,\n popover: \"auto\",\n };\n}\n\nexport const popoverControl = {\n getTriggerAttributes,\n getContentAttributes,\n} as const;\n"],"mappings":";AAaA,SAAS,qBACP,OACA,SAC0B;CAC1B,OAAO;EACL,eAAe,MAAM;EACrB,MAAM,QAAQ,kBAAkB,WAAW,KAAA;CAC7C;AACF;AAOA,SAAS,qBAAqB,OAAyD;CACrF,OAAO;EACL,IAAI,MAAM;EACV,SAAS;CACX;AACF;AAEA,MAAa,iBAAiB;CAC5B;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"popover-control.js","names":[],"sources":["../../../src/logics/popover-control/popover-control.ts"],"sourcesContent":["export interface PopoverState {\n popoverId: string;\n}\n\nexport interface PopoverTriggerAttributeOptions {\n isButtonElement: boolean;\n}\n\nexport interface PopoverTriggerAttributes {\n popovertarget: string;\n type: \"button\" | undefined;\n}\n\nfunction getTriggerAttributes(\n state: Readonly<PopoverState>,\n options: Readonly<PopoverTriggerAttributeOptions>,\n): PopoverTriggerAttributes {\n return {\n popovertarget: state.popoverId,\n type: options.isButtonElement ? \"button\" : undefined,\n };\n}\n\nexport interface PopoverContentAttributes {\n id: string;\n popover: \"auto\";\n}\n\nfunction getContentAttributes(state: Readonly<PopoverState>): PopoverContentAttributes {\n return {\n id: state.popoverId,\n popover: \"auto\",\n };\n}\n\nfunction isOpened(element: Element | null): boolean {\n return element?.matches(\":popover-open\") ?? false;\n}\n\nexport const popoverControl = {\n getTriggerAttributes,\n getContentAttributes,\n isOpened,\n} as const;\n"],"mappings":";AAaA,SAAS,qBACP,OACA,SAC0B;CAC1B,OAAO;EACL,eAAe,MAAM;EACrB,MAAM,QAAQ,kBAAkB,WAAW,KAAA;CAC7C;AACF;AAOA,SAAS,qBAAqB,OAAyD;CACrF,OAAO;EACL,IAAI,MAAM;EACV,SAAS;CACX;AACF;AAEA,SAAS,SAAS,SAAkC;CAClD,OAAO,SAAS,QAAQ,eAAe,KAAK;AAC9C;AAEA,MAAa,iBAAiB;CAC5B;CACA;CACA;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-control.js","names":[],"sources":["../../../src/logics/progress-control/progress-control.ts"],"sourcesContent":["const INDETERMINATE_BAR_WIDTH = \"
|
|
1
|
+
{"version":3,"file":"progress-control.js","names":[],"sources":["../../../src/logics/progress-control/progress-control.ts"],"sourcesContent":["const INDETERMINATE_BAR_WIDTH = \"30%\";\n\nexport interface ProgressState {\n progressId: string;\n hasLabel: boolean;\n isIndeterminate: boolean;\n min: number;\n max: number;\n value: number | undefined;\n valueText: string | undefined;\n width: string;\n}\n\nexport interface ProgressResolveOptions {\n progressId: string;\n hasLabel: boolean;\n min: number | undefined;\n max: number | undefined;\n value: number | undefined;\n valueText: string | undefined;\n}\n\nfunction resolve(options: Readonly<ProgressResolveOptions>): ProgressState {\n const min = options.min ?? 0;\n const max = options.max ?? 100;\n const range = max - min;\n const isIndeterminate = typeof options.value === \"undefined\";\n const percentage = typeof options.value === \"undefined\"\n ? undefined\n : range === 0\n ? 0\n : ((options.value - min) / range) * 100;\n\n return {\n progressId: options.progressId,\n hasLabel: options.hasLabel,\n isIndeterminate,\n min,\n max,\n value: options.value,\n valueText: options.valueText,\n width: percentage === undefined ? INDETERMINATE_BAR_WIDTH : `${percentage}%`,\n };\n}\n\nfunction labelId(progressId: string): string {\n return `${progressId}-label`;\n}\n\nexport interface ProgressLabelAttributes {\n id: string;\n}\n\nfunction getLabelAttributes(state: Readonly<ProgressState>): ProgressLabelAttributes {\n return {\n id: labelId(state.progressId),\n };\n}\n\nexport interface ProgressBarAttributes {\n role: \"progressbar\";\n \"aria-valuemin\": number;\n \"aria-valuemax\": number;\n \"aria-valuenow\": number | undefined;\n \"aria-valuetext\": string | undefined;\n \"aria-labelledby\": string | undefined;\n}\n\nfunction getBarAttributes(state: Readonly<ProgressState>): ProgressBarAttributes {\n return {\n role: \"progressbar\",\n \"aria-valuemin\": state.min,\n \"aria-valuemax\": state.max,\n \"aria-valuenow\": state.value,\n \"aria-valuetext\": state.valueText,\n \"aria-labelledby\": state.hasLabel ? labelId(state.progressId) : undefined,\n };\n}\n\nexport interface ProgressValueAttributes {\n \"aria-hidden\": \"true\";\n}\n\nfunction getValueAttributes(): ProgressValueAttributes {\n return {\n \"aria-hidden\": \"true\",\n };\n}\n\nexport const progressControl = {\n resolve,\n getLabelAttributes,\n getBarAttributes,\n getValueAttributes,\n} as const;\n"],"mappings":";AAAA,MAAM,0BAA0B;AAsBhC,SAAS,QAAQ,SAA0D;CACzE,MAAM,MAAM,QAAQ,OAAO;CAC3B,MAAM,MAAM,QAAQ,OAAO;CAC3B,MAAM,QAAQ,MAAM;CACpB,MAAM,kBAAkB,OAAO,QAAQ,UAAU;CACjD,MAAM,aAAa,OAAO,QAAQ,UAAU,cACxC,KAAA,IACA,UAAU,IACV,KACE,QAAQ,QAAQ,OAAO,QAAS;CAEtC,OAAO;EACL,YAAY,QAAQ;EACpB,UAAU,QAAQ;EAClB;EACA;EACA;EACA,OAAO,QAAQ;EACf,WAAW,QAAQ;EACnB,OAAO,eAAe,KAAA,IAAY,0BAA0B,GAAG,WAAW;CAC5E;AACF;AAEA,SAAS,QAAQ,YAA4B;CAC3C,OAAO,GAAG,WAAW;AACvB;AAMA,SAAS,mBAAmB,OAAyD;CACnF,OAAO,EACL,IAAI,QAAQ,MAAM,UAAU,EAC9B;AACF;AAWA,SAAS,iBAAiB,OAAuD;CAC/E,OAAO;EACL,MAAM;EACN,iBAAiB,MAAM;EACvB,iBAAiB,MAAM;EACvB,iBAAiB,MAAM;EACvB,kBAAkB,MAAM;EACxB,mBAAmB,MAAM,WAAW,QAAQ,MAAM,UAAU,IAAI,KAAA;CAClE;AACF;AAMA,SAAS,qBAA8C;CACrD,OAAO,EACL,eAAe,OACjB;AACF;AAEA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;AACF"}
|
|
@@ -4,11 +4,10 @@ export interface SegmentedControlItemState<Value extends string> {
|
|
|
4
4
|
}
|
|
5
5
|
export interface SegmentedControlItemAttributes {
|
|
6
6
|
type: "button" | undefined;
|
|
7
|
-
"aria-
|
|
7
|
+
"aria-current": boolean;
|
|
8
8
|
}
|
|
9
9
|
declare function getItemAttributes<Value extends string>(state: Readonly<SegmentedControlItemState<Value>>, value: Value): SegmentedControlItemAttributes;
|
|
10
10
|
export declare const segmentedControl: {
|
|
11
11
|
readonly getItemAttributes: typeof getItemAttributes;
|
|
12
12
|
};
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=segmented-control.d.ts.map
|
|
13
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-control.js","names":[],"sources":["../../../src/logics/segmented-control/segmented-control.ts"],"sourcesContent":["export interface SegmentedControlItemState<Value extends string> {\n isButtonElement: boolean;\n selectedValue: Value | undefined;\n}\n\nexport interface SegmentedControlItemAttributes {\n type: \"button\" | undefined;\n \"aria-
|
|
1
|
+
{"version":3,"file":"segmented-control.js","names":[],"sources":["../../../src/logics/segmented-control/segmented-control.ts"],"sourcesContent":["export interface SegmentedControlItemState<Value extends string> {\n isButtonElement: boolean;\n selectedValue: Value | undefined;\n}\n\nexport interface SegmentedControlItemAttributes {\n type: \"button\" | undefined;\n \"aria-current\": boolean;\n}\n\nfunction getItemAttributes<Value extends string>(\n state: Readonly<SegmentedControlItemState<Value>>,\n value: Value,\n): SegmentedControlItemAttributes {\n return {\n type: state.isButtonElement ? \"button\" : undefined,\n \"aria-current\": state.selectedValue === value,\n };\n}\n\nexport const segmentedControl = {\n getItemAttributes,\n} as const;\n"],"mappings":";AAUA,SAAS,kBACP,OACA,OACgC;CAChC,OAAO;EACL,MAAM,MAAM,kBAAkB,WAAW,KAAA;EACzC,gBAAgB,MAAM,kBAAkB;CAC1C;AACF;AAEA,MAAa,mBAAmB,EAC9B,kBACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Recipe } from "../../styles/make-recipe.js";
|
|
2
2
|
import { RecipeSlots, RecipeVariants } from "../../styles/make-recipe-type.js";
|
|
3
|
-
export declare const alertRecipe: Recipe<"
|
|
3
|
+
export declare const alertRecipe: Recipe<"root" | "content" | "message" | "description", {
|
|
4
4
|
variant: {
|
|
5
5
|
light: {
|
|
6
6
|
root: {
|
|
@@ -59,5 +59,4 @@ export declare const alertRecipe: Recipe<"icon" | "root" | "content" | "errorIco
|
|
|
59
59
|
};
|
|
60
60
|
}>;
|
|
61
61
|
export type AlertVariants = RecipeVariants<typeof alertRecipe>;
|
|
62
|
-
export type AlertSlots = RecipeSlots<typeof alertRecipe>;
|
|
63
|
-
//# sourceMappingURL=alert.d.ts.map
|
|
62
|
+
export type AlertSlots = RecipeSlots<typeof alertRecipe>;
|
|
@@ -6,6 +6,7 @@ const alertRecipe = makeRecipe({
|
|
|
6
6
|
reset: "true",
|
|
7
7
|
display: "flex",
|
|
8
8
|
gap: "0.5x",
|
|
9
|
+
color: "base",
|
|
9
10
|
borderWidth: "base",
|
|
10
11
|
borderStyle: "solid",
|
|
11
12
|
borderRadius: "base"
|
|
@@ -14,11 +15,6 @@ const alertRecipe = makeRecipe({
|
|
|
14
15
|
display: "flex-col",
|
|
15
16
|
rowGap: "0.5x"
|
|
16
17
|
},
|
|
17
|
-
icon: { lineHeight: "1" },
|
|
18
|
-
errorIcon: {
|
|
19
|
-
color: "base",
|
|
20
|
-
icon: "error"
|
|
21
|
-
},
|
|
22
18
|
message: {
|
|
23
19
|
fontWeight: "bold",
|
|
24
20
|
lineHeight: "1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/recipes/alert/alert.ts"],"sourcesContent":["import { makeRecipe } from \"~/styles/make-recipe\";\nimport { type RecipeSlots, type RecipeVariants } from \"~/styles/make-recipe-type\";\n\nexport const alertRecipe = makeRecipe({\n base: {\n root: {\n reset: \"true\",\n display: \"flex\",\n gap: \"0.5x\",\n borderWidth: \"base\",\n borderStyle: \"solid\",\n borderRadius: \"base\",\n },\n content: {\n display: \"flex-col\",\n rowGap: \"0.5x\",\n },\n
|
|
1
|
+
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/recipes/alert/alert.ts"],"sourcesContent":["import { makeRecipe } from \"~/styles/make-recipe\";\nimport { type RecipeSlots, type RecipeVariants } from \"~/styles/make-recipe-type\";\n\nexport const alertRecipe = makeRecipe({\n base: {\n root: {\n reset: \"true\",\n display: \"flex\",\n gap: \"0.5x\",\n color: \"base\",\n borderWidth: \"base\",\n borderStyle: \"solid\",\n borderRadius: \"base\",\n },\n content: {\n display: \"flex-col\",\n rowGap: \"0.5x\",\n },\n message: {\n fontWeight: \"bold\",\n lineHeight: \"1\",\n color: \"base\",\n },\n description: {\n color: \"text\",\n },\n },\n variants: {\n variant: {\n light: {\n root: {\n bgColor: \"base-alpha\",\n borderColor: \"base-alpha-peak\",\n },\n },\n outline: {\n root: {\n borderColor: \"base\",\n },\n },\n },\n color: {\n accent: { root: { baseColor: \"accent\" } },\n danger: { root: { baseColor: \"danger\" } },\n caution: { root: { baseColor: \"caution\" } },\n neutral: { root: { baseColor: \"neutral\" } },\n },\n padding: {\n none: {},\n sm: {\n root: {\n paddingInline: \"0.75x\",\n paddingBlock: \"0.75x\",\n },\n },\n md: {\n root: {\n paddingInline: \"1x\",\n paddingBlock: \"1x\",\n },\n },\n lg: {\n root: {\n paddingInline: \"1.25x\",\n paddingBlock: \"1.25x\",\n },\n },\n },\n },\n defaultVariants: {\n variant: \"light\",\n color: \"danger\",\n padding: \"md\",\n },\n});\n\nexport type AlertVariants = RecipeVariants<typeof alertRecipe>;\nexport type AlertSlots = RecipeSlots<typeof alertRecipe>;\n"],"mappings":";;AAGA,MAAa,cAAc,WAAW;CACpC,MAAM;EACJ,MAAM;GACJ,OAAO;GACP,SAAS;GACT,KAAK;GACL,OAAO;GACP,aAAa;GACb,aAAa;GACb,cAAc;EAChB;EACA,SAAS;GACP,SAAS;GACT,QAAQ;EACV;EACA,SAAS;GACP,YAAY;GACZ,YAAY;GACZ,OAAO;EACT;EACA,aAAa,EACX,OAAO,OACT;CACF;CACA,UAAU;EACR,SAAS;GACP,OAAO,EACL,MAAM;IACJ,SAAS;IACT,aAAa;GACf,EACF;GACA,SAAS,EACP,MAAM,EACJ,aAAa,OACf,EACF;EACF;EACA,OAAO;GACL,QAAQ,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE;GACxC,QAAQ,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE;GACxC,SAAS,EAAE,MAAM,EAAE,WAAW,UAAU,EAAE;GAC1C,SAAS,EAAE,MAAM,EAAE,WAAW,UAAU,EAAE;EAC5C;EACA,SAAS;GACP,MAAM,CAAC;GACP,IAAI,EACF,MAAM;IACJ,eAAe;IACf,cAAc;GAChB,EACF;GACA,IAAI,EACF,MAAM;IACJ,eAAe;IACf,cAAc;GAChB,EACF;GACA,IAAI,EACF,MAAM;IACJ,eAAe;IACf,cAAc;GAChB,EACF;EACF;CACF;CACA,iBAAiB;EACf,SAAS;EACT,OAAO;EACP,SAAS;CACX;AACF,CAAC"}
|
|
@@ -102,5 +102,4 @@ export declare const anchorRecipe: Recipe<"root", {
|
|
|
102
102
|
};
|
|
103
103
|
}>;
|
|
104
104
|
export type AnchorVariants = RecipeVariants<typeof anchorRecipe>;
|
|
105
|
-
export type AnchorSlots = RecipeSlots<typeof anchorRecipe>;
|
|
106
|
-
//# sourceMappingURL=anchor.d.ts.map
|
|
105
|
+
export type AnchorSlots = RecipeSlots<typeof anchorRecipe>;
|
|
@@ -15,5 +15,4 @@ export declare const avatartRecipe: Recipe<"root" | "img" | "placeholder", {
|
|
|
15
15
|
};
|
|
16
16
|
}>;
|
|
17
17
|
export type AvatarVariants = RecipeVariants<typeof avatartRecipe>;
|
|
18
|
-
export type AvatarSlots = RecipeSlots<typeof avatartRecipe>;
|
|
19
|
-
//# sourceMappingURL=avatar.d.ts.map
|
|
18
|
+
export type AvatarSlots = RecipeSlots<typeof avatartRecipe>;
|
|
@@ -25,5 +25,4 @@ export declare const blockquoteRecipe: Recipe<"root" | "blockquote" | "caption",
|
|
|
25
25
|
};
|
|
26
26
|
}>;
|
|
27
27
|
export type BlockquoteVariants = RecipeVariants<typeof blockquoteRecipe>;
|
|
28
|
-
export type BlockquoteSlots = RecipeSlots<typeof blockquoteRecipe>;
|
|
29
|
-
//# sourceMappingURL=blockquote.d.ts.map
|
|
28
|
+
export type BlockquoteSlots = RecipeSlots<typeof blockquoteRecipe>;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Recipe } from "../../styles/make-recipe.js";
|
|
2
2
|
import { RecipeSlots, RecipeVariants } from "../../styles/make-recipe-type.js";
|
|
3
|
-
export declare const buttonRecipe: Recipe<"root", {
|
|
3
|
+
export declare const buttonRecipe: Recipe<"root" | "content" | "spinner" | "status", {
|
|
4
|
+
loading: {
|
|
5
|
+
true: {
|
|
6
|
+
content: {
|
|
7
|
+
opacity: "0";
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
false: {};
|
|
11
|
+
};
|
|
4
12
|
variant: {
|
|
5
13
|
solid: {
|
|
6
14
|
root: {
|
|
@@ -118,5 +126,4 @@ export declare const buttonRecipe: Recipe<"root", {
|
|
|
118
126
|
};
|
|
119
127
|
}>;
|
|
120
128
|
export type ButtonVariants = RecipeVariants<typeof buttonRecipe>;
|
|
121
|
-
export type ButtonSlots = RecipeSlots<typeof buttonRecipe>;
|
|
122
|
-
//# sourceMappingURL=button.d.ts.map
|
|
129
|
+
export type ButtonSlots = RecipeSlots<typeof buttonRecipe>;
|
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
import { makeRecipe } from "../../styles/make-recipe.js";
|
|
2
2
|
// src/recipes/button/button.ts
|
|
3
3
|
const buttonRecipe = makeRecipe({
|
|
4
|
-
base: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
base: {
|
|
5
|
+
root: {
|
|
6
|
+
reset: "true",
|
|
7
|
+
position: "relative",
|
|
8
|
+
borderRadius: "base",
|
|
9
|
+
display: "inline-flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
minHeight: "2x",
|
|
13
|
+
transition: "colors",
|
|
14
|
+
_focusVisible: { outline: "focus-ring" },
|
|
15
|
+
_disabled: { cursor: "not-allowed" }
|
|
16
|
+
},
|
|
17
|
+
content: {
|
|
18
|
+
display: "inline-flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
gap: "0.5x"
|
|
22
|
+
},
|
|
23
|
+
spinner: {
|
|
24
|
+
icon: "spinner",
|
|
25
|
+
position: "absolute",
|
|
26
|
+
inset: "0",
|
|
27
|
+
margin: "auto"
|
|
28
|
+
},
|
|
29
|
+
status: { visuallyHidden: "true" }
|
|
30
|
+
},
|
|
16
31
|
variants: {
|
|
32
|
+
loading: {
|
|
33
|
+
true: { content: { opacity: "0" } },
|
|
34
|
+
false: {}
|
|
35
|
+
},
|
|
17
36
|
variant: {
|
|
18
37
|
solid: { root: {
|
|
19
38
|
color: "base-fg",
|
|
@@ -83,6 +102,7 @@ const buttonRecipe = makeRecipe({
|
|
|
83
102
|
}
|
|
84
103
|
},
|
|
85
104
|
defaultVariants: {
|
|
105
|
+
loading: "false",
|
|
86
106
|
variant: "solid",
|
|
87
107
|
color: "accent",
|
|
88
108
|
shape: "rectangle"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":[],"sources":["../../../src/recipes/button/button.ts"],"sourcesContent":["import { makeRecipe } from \"~/styles/make-recipe\";\nimport { type RecipeSlots, type RecipeVariants } from \"~/styles/make-recipe-type\";\n\nexport const buttonRecipe = makeRecipe({\n base: {\n root: {\n reset: \"true\",\n borderRadius: \"base\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n
|
|
1
|
+
{"version":3,"file":"button.js","names":[],"sources":["../../../src/recipes/button/button.ts"],"sourcesContent":["import { makeRecipe } from \"~/styles/make-recipe\";\nimport { type RecipeSlots, type RecipeVariants } from \"~/styles/make-recipe-type\";\n\nexport const buttonRecipe = makeRecipe({\n base: {\n root: {\n reset: \"true\",\n position: \"relative\",\n borderRadius: \"base\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minHeight: \"2x\",\n transition: \"colors\",\n _focusVisible: {\n outline: \"focus-ring\",\n },\n _disabled: {\n cursor: \"not-allowed\",\n },\n },\n content: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"0.5x\",\n },\n spinner: {\n icon: \"spinner\",\n position: \"absolute\",\n inset: \"0\",\n margin: \"auto\",\n },\n status: {\n visuallyHidden: \"true\",\n },\n },\n variants: {\n loading: {\n true: { content: { opacity: \"0\" } },\n false: {},\n },\n variant: {\n solid: {\n root: {\n color: \"base-fg\",\n bgColor: \"base\",\n _hover: {\n bgColor: \"base-top\",\n },\n _active: {\n bgColor: \"base-bottom\",\n },\n _disabled: {\n color: \"base-fg-muted\",\n bgColor: \"base-muted\",\n },\n },\n },\n subtle: {\n root: {\n color: \"base\",\n bgColor: \"section\",\n borderWidth: \"base\",\n borderStyle: \"solid\",\n borderColor: \"divider\",\n _hover: {\n bgColor: \"base-alpha\",\n },\n _active: {\n bgColor: \"base-alpha-peak\",\n },\n _disabled: {\n color: \"base-muted\",\n bgColor: \"section\",\n },\n },\n },\n outline: {\n root: {\n color: \"base\",\n bgColor: \"transparent\",\n borderWidth: \"base\",\n borderStyle: \"solid\",\n borderColor: \"base\",\n _hover: {\n bgColor: \"base-alpha\",\n },\n _active: {\n bgColor: \"base-alpha-peak\",\n },\n _disabled: {\n color: \"base-muted\",\n bgColor: \"transparent\",\n borderColor: \"base-muted\",\n },\n },\n },\n ghost: {\n root: {\n color: \"base\",\n bgColor: \"transparent\",\n _hover: {\n bgColor: \"base-alpha\",\n },\n _active: {\n bgColor: \"base-alpha-peak\",\n },\n _disabled: {\n color: \"base-muted\",\n bgColor: \"transparent\",\n },\n },\n },\n },\n color: {\n accent: { root: { baseColor: \"accent\" } },\n danger: { root: { baseColor: \"danger\" } },\n caution: { root: { baseColor: \"caution\" } },\n neutral: { root: { baseColor: \"neutral\" } },\n },\n shape: {\n rectangle: {\n root: {\n paddingInline: \"1x\",\n },\n },\n square: {\n root: {\n justifyContent: \"center\",\n aspectRatio: \"1:1\",\n },\n },\n circle: {\n root: {\n justifyContent: \"center\",\n aspectRatio: \"1:1\",\n borderRadius: \"full\",\n },\n },\n },\n },\n defaultVariants: {\n loading: \"false\",\n variant: \"solid\",\n color: \"accent\",\n shape: \"rectangle\",\n },\n});\n\nexport type ButtonVariants = RecipeVariants<typeof buttonRecipe>;\nexport type ButtonSlots = RecipeSlots<typeof buttonRecipe>;\n"],"mappings":";;AAGA,MAAa,eAAe,WAAW;CACrC,MAAM;EACJ,MAAM;GACJ,OAAO;GACP,UAAU;GACV,cAAc;GACd,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,WAAW;GACX,YAAY;GACZ,eAAe,EACb,SAAS,aACX;GACA,WAAW,EACT,QAAQ,cACV;EACF;EACA,SAAS;GACP,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,KAAK;EACP;EACA,SAAS;GACP,MAAM;GACN,UAAU;GACV,OAAO;GACP,QAAQ;EACV;EACA,QAAQ,EACN,gBAAgB,OAClB;CACF;CACA,UAAU;EACR,SAAS;GACP,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE;GAClC,OAAO,CAAC;EACV;EACA,SAAS;GACP,OAAO,EACL,MAAM;IACJ,OAAO;IACP,SAAS;IACT,QAAQ,EACN,SAAS,WACX;IACA,SAAS,EACP,SAAS,cACX;IACA,WAAW;KACT,OAAO;KACP,SAAS;IACX;GACF,EACF;GACA,QAAQ,EACN,MAAM;IACJ,OAAO;IACP,SAAS;IACT,aAAa;IACb,aAAa;IACb,aAAa;IACb,QAAQ,EACN,SAAS,aACX;IACA,SAAS,EACP,SAAS,kBACX;IACA,WAAW;KACT,OAAO;KACP,SAAS;IACX;GACF,EACF;GACA,SAAS,EACP,MAAM;IACJ,OAAO;IACP,SAAS;IACT,aAAa;IACb,aAAa;IACb,aAAa;IACb,QAAQ,EACN,SAAS,aACX;IACA,SAAS,EACP,SAAS,kBACX;IACA,WAAW;KACT,OAAO;KACP,SAAS;KACT,aAAa;IACf;GACF,EACF;GACA,OAAO,EACL,MAAM;IACJ,OAAO;IACP,SAAS;IACT,QAAQ,EACN,SAAS,aACX;IACA,SAAS,EACP,SAAS,kBACX;IACA,WAAW;KACT,OAAO;KACP,SAAS;IACX;GACF,EACF;EACF;EACA,OAAO;GACL,QAAQ,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE;GACxC,QAAQ,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE;GACxC,SAAS,EAAE,MAAM,EAAE,WAAW,UAAU,EAAE;GAC1C,SAAS,EAAE,MAAM,EAAE,WAAW,UAAU,EAAE;EAC5C;EACA,OAAO;GACL,WAAW,EACT,MAAM,EACJ,eAAe,KACjB,EACF;GACA,QAAQ,EACN,MAAM;IACJ,gBAAgB;IAChB,aAAa;GACf,EACF;GACA,QAAQ,EACN,MAAM;IACJ,gBAAgB;IAChB,aAAa;IACb,cAAc;GAChB,EACF;EACF;CACF;CACA,iBAAiB;EACf,SAAS;EACT,SAAS;EACT,OAAO;EACP,OAAO;CACT;AACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Recipe } from "../../styles/make-recipe.js";
|
|
2
2
|
import { RecipeSlots, RecipeVariants } from "../../styles/make-recipe-type.js";
|
|
3
|
-
export declare const checkboxRecipe: Recipe<"
|
|
3
|
+
export declare const checkboxRecipe: Recipe<"root" | "label" | "error" | "checkbox" | "errorIcon" | "errorMessage", {
|
|
4
4
|
color: {
|
|
5
5
|
accent: {
|
|
6
6
|
checkbox: {
|
|
@@ -38,5 +38,4 @@ export declare const checkboxRecipe: Recipe<"label" | "root" | "errorIcon" | "er
|
|
|
38
38
|
};
|
|
39
39
|
}>;
|
|
40
40
|
export type CheckboxVariants = RecipeVariants<typeof checkboxRecipe>;
|
|
41
|
-
export type CheckboxSlots = RecipeSlots<typeof checkboxRecipe>;
|
|
42
|
-
//# sourceMappingURL=checkbox.d.ts.map
|
|
41
|
+
export type CheckboxSlots = RecipeSlots<typeof checkboxRecipe>;
|
|
@@ -2,5 +2,4 @@ import { Recipe } from "../../styles/make-recipe.js";
|
|
|
2
2
|
import { RecipeSlots, RecipeVariants } from "../../styles/make-recipe-type.js";
|
|
3
3
|
export declare const codeRecipe: Recipe<"root", {}>;
|
|
4
4
|
export type CodeVariants = RecipeVariants<typeof codeRecipe>;
|
|
5
|
-
export type CodeSlots = RecipeSlots<typeof codeRecipe>;
|
|
6
|
-
//# sourceMappingURL=code.d.ts.map
|
|
5
|
+
export type CodeSlots = RecipeSlots<typeof codeRecipe>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Recipe } from "../../styles/make-recipe.js";
|
|
2
|
+
import { RecipeSlots } from "../../styles/make-recipe-type.js";
|
|
3
|
+
import { InputSlots, InputVariants } from "../input/input.js";
|
|
4
|
+
declare const structureRecipe: Recipe<"list" | "item", {}>;
|
|
5
|
+
export type ComboboxVariants = Pick<InputVariants, "color" | "error">;
|
|
6
|
+
export type ComboboxSlots = InputSlots | RecipeSlots<typeof structureRecipe>;
|
|
7
|
+
export declare function comboboxRecipe(variants?: ComboboxVariants): Record<ComboboxSlots, string>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cc } from "../../logics/cc/cc.js";
|
|
2
|
+
import { makeRecipe } from "../../styles/make-recipe.js";
|
|
3
|
+
import { inputRecipe } from "../input/input.js";
|
|
4
|
+
import { menuitemRecipe } from "../menu/menu.js";
|
|
5
|
+
import { popoverRecipe } from "../popover/popover.js";
|
|
6
|
+
// src/recipes/combobox/combobox.ts
|
|
7
|
+
const structureRecipe = makeRecipe({
|
|
8
|
+
base: {
|
|
9
|
+
list: {
|
|
10
|
+
width: "anchor",
|
|
11
|
+
maxHeight: "15x",
|
|
12
|
+
overflowY: "auto"
|
|
13
|
+
},
|
|
14
|
+
item: { _focusVisible: { outlineOffset: "-1px" } }
|
|
15
|
+
},
|
|
16
|
+
variants: {}
|
|
17
|
+
});
|
|
18
|
+
function comboboxRecipe(variants = {}) {
|
|
19
|
+
const input = inputRecipe(variants);
|
|
20
|
+
const list = popoverRecipe({
|
|
21
|
+
position: "block-end",
|
|
22
|
+
padding: "sm"
|
|
23
|
+
});
|
|
24
|
+
const structure = structureRecipe();
|
|
25
|
+
return {
|
|
26
|
+
root: input.root,
|
|
27
|
+
input: input.input,
|
|
28
|
+
list: cc(list.root, structure.list),
|
|
29
|
+
item: cc(menuitemRecipe().root, structure.item)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export { comboboxRecipe };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=combobox.js.map
|