@gnist/design-system 7.5.0 → 7.6.0
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/CHANGELOG.md +12 -0
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.js +2 -1
- package/dist/components/inputs/dropdowns/Combobox.cjs +133 -0
- package/dist/components/inputs/dropdowns/Combobox.d.ts +42 -0
- package/dist/components/inputs/dropdowns/Combobox.d.ts.map +1 -0
- package/dist/components/inputs/dropdowns/Combobox.js +131 -0
- package/dist/components/inputs/dropdowns/combobox.css.cjs +23 -0
- package/dist/components/inputs/dropdowns/combobox.css.d.ts +3 -0
- package/dist/components/inputs/dropdowns/combobox.css.d.ts.map +1 -0
- package/dist/components/inputs/dropdowns/combobox.css.js +22 -0
- package/dist/components/inputs/dropdowns/index.cjs +2 -0
- package/dist/components/inputs/dropdowns/index.d.ts +2 -0
- package/dist/components/inputs/dropdowns/index.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/index.js +2 -1
- package/dist/components/inputs/index.cjs +2 -0
- package/dist/components/inputs/index.js +2 -1
- package/dist/components/surfaces/accordion/accordion.css.cjs +1 -1
- package/dist/components/surfaces/accordion/accordion.css.js +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.js +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.6.0](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@7.5.1...@gnist/design-system@7.6.0) (2026-09-04)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add Combobox component ([53a66b0](https://github.com/mollerdigital/design-system-design-system/commit/53a66b0bc70c3b0d82b5e77befc63f318d0bc4a9))
|
|
11
|
+
|
|
12
|
+
## [7.5.1](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@7.5.0...@gnist/design-system@7.5.1) (2026-09-04)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* adjust spacing for Accordion ([79a6ad3](https://github.com/mollerdigital/design-system-design-system/commit/79a6ad381ee6d12b11bd24999da3f9eac5107266))
|
|
17
|
+
|
|
6
18
|
## [7.5.0](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@7.4.0...@gnist/design-system@7.5.0) (2026-08-31)
|
|
7
19
|
|
|
8
20
|
### Features
|
|
@@ -26,6 +26,7 @@ const require_FeedbackInput = require("./feedback/feedbackInput/FeedbackInput.cj
|
|
|
26
26
|
const require_Lozenge = require("./feedback/notifications/Lozenge.cjs");
|
|
27
27
|
const require_ProgressBar = require("./feedback/progress/ProgressBar.cjs");
|
|
28
28
|
require("./feedback/index.cjs");
|
|
29
|
+
const require_Combobox = require("./inputs/dropdowns/Combobox.cjs");
|
|
29
30
|
const require_MultiSelect = require("./inputs/dropdowns/MultiSelect.cjs");
|
|
30
31
|
const require_SingleSelect = require("./inputs/dropdowns/SingleSelect.cjs");
|
|
31
32
|
const require_calendar = require("./inputs/pickers/calendar.cjs");
|
|
@@ -46,6 +47,7 @@ exports.AlertBanner = require_AlertBanner.AlertBanner;
|
|
|
46
47
|
exports.Calendar = require_calendar.Calendar;
|
|
47
48
|
exports.Checkbox = require_Checkbox.Checkbox;
|
|
48
49
|
exports.CheckboxCard = require_CheckboxCard.CheckboxCard;
|
|
50
|
+
exports.Combobox = require_Combobox.Combobox;
|
|
49
51
|
exports.DangerButton = require_DangerButton.DangerButton;
|
|
50
52
|
exports.FeedbackInput = require_FeedbackInput.FeedbackInput;
|
|
51
53
|
exports.FilterChip = require_FilterChip.FilterChip;
|
package/dist/components/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import { FeedbackInput } from "./feedback/feedbackInput/FeedbackInput.js";
|
|
|
25
25
|
import { Lozenge } from "./feedback/notifications/Lozenge.js";
|
|
26
26
|
import { ProgressBar, ProgressBarComponent } from "./feedback/progress/ProgressBar.js";
|
|
27
27
|
import "./feedback/index.js";
|
|
28
|
+
import { Combobox } from "./inputs/dropdowns/Combobox.js";
|
|
28
29
|
import { MultiSelect } from "./inputs/dropdowns/MultiSelect.js";
|
|
29
30
|
import { SingleSelect } from "./inputs/dropdowns/SingleSelect.js";
|
|
30
31
|
import { Calendar } from "./inputs/pickers/calendar.js";
|
|
@@ -38,4 +39,4 @@ import { RadioCard } from "./surfaces/cards/RadioCard.js";
|
|
|
38
39
|
import { Modal } from "./surfaces/modal/Modal.js";
|
|
39
40
|
import { Accordion } from "./surfaces/accordion/Accordion.js";
|
|
40
41
|
import "./surfaces/index.js";
|
|
41
|
-
export { Accordion, ActionCard, ActionChip, AlertBanner, Calendar, Checkbox, CheckboxCard, DangerButton, FeedbackInput, FilterChip, GhostButton, IconButton, InfoCard, LinkCard, LoadingBar, LoadingBarComponent, LoadingSpinner, Lozenge, Modal, MultiSelect, PrimaryButton, ProgressBar, ProgressBarComponent, RadioButton, RadioCard, RadioGroup, SecondaryButton, SingleSelect, Spinner, StatusIndicator, SuccessButton, Switch, TagChip, TextArea, TextButton, TextField, characterCount, wordCount };
|
|
42
|
+
export { Accordion, ActionCard, ActionChip, AlertBanner, Calendar, Checkbox, CheckboxCard, Combobox, DangerButton, FeedbackInput, FilterChip, GhostButton, IconButton, InfoCard, LinkCard, LoadingBar, LoadingBarComponent, LoadingSpinner, Lozenge, Modal, MultiSelect, PrimaryButton, ProgressBar, ProgressBarComponent, RadioButton, RadioCard, RadioGroup, SecondaryButton, SingleSelect, Spinner, StatusIndicator, SuccessButton, Switch, TagChip, TextArea, TextButton, TextField, characterCount, wordCount };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_Icon = require("../../../foundation/iconography/Icon.cjs");
|
|
4
|
+
require("../../../foundation/index.cjs");
|
|
5
|
+
const require_InputHelperText = require("../../../building-blocks/inputs/InputHelperText.cjs");
|
|
6
|
+
require("../../../building-blocks/index.cjs");
|
|
7
|
+
const require_inputFieldConstants_css = require("../shared-styles/inputFieldConstants.css.cjs");
|
|
8
|
+
const require_inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
9
|
+
const require_labelStyles_css = require("../shared-styles/labelStyles.css.cjs");
|
|
10
|
+
const require_shared = require("../shared.cjs");
|
|
11
|
+
const require_select_css = require("./select.css.cjs");
|
|
12
|
+
const require_combobox_css = require("./combobox.css.cjs");
|
|
13
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
|
+
let _gnist_themes_atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
15
|
+
let react = require("react");
|
|
16
|
+
let _gnist_themes_tokens_css_js = require("@gnist/themes/tokens.css.js");
|
|
17
|
+
let _vanilla_extract_dynamic = require("@vanilla-extract/dynamic");
|
|
18
|
+
let classnames = require("classnames");
|
|
19
|
+
classnames = require_runtime.__toESM(classnames, 1);
|
|
20
|
+
let _base_ui_react_combobox = require("@base-ui/react/combobox");
|
|
21
|
+
//#region src/components/inputs/dropdowns/Combobox.tsx
|
|
22
|
+
/**
|
|
23
|
+
Combobox lets users select one item from a filterable list. Type to narrow the list down — useful when the list is too long to scroll through comfortably.
|
|
24
|
+
|
|
25
|
+
Each option can carry an optional `secondaryLabel` (e.g. a dial code) which is not displayed or searched, but is available for lookup after the user makes a selection.
|
|
26
|
+
|
|
27
|
+
Documentation: [Combobox](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-dropdowns-combobox--docs)
|
|
28
|
+
*/
|
|
29
|
+
var Combobox = (props) => {
|
|
30
|
+
const { contentProps, wrapperProps, commonInputProps } = require_shared.useSelectInputLogic(props);
|
|
31
|
+
const [isOpen, setIsOpen] = (0, react.useState)(false);
|
|
32
|
+
const hasValue = !!props.value;
|
|
33
|
+
const selectedOption = (0, react.useMemo)(() => props.options.find((o) => o.value === props.value) ?? null, [props.options, props.value]);
|
|
34
|
+
return (0, react_jsx_runtime.jsxs)("span", {
|
|
35
|
+
className: (0, classnames.default)(wrapperProps.className, require_inputField_css.wrapperStyle),
|
|
36
|
+
children: [(0, react_jsx_runtime.jsxs)("label", {
|
|
37
|
+
className: require_inputField_css.inputFieldWrapperRecipe({
|
|
38
|
+
disabled: props.disabled,
|
|
39
|
+
density: props.density,
|
|
40
|
+
validityType: props.validity?.type
|
|
41
|
+
}),
|
|
42
|
+
children: [(0, react_jsx_runtime.jsxs)(_base_ui_react_combobox.Combobox.Root, {
|
|
43
|
+
items: props.options,
|
|
44
|
+
value: selectedOption,
|
|
45
|
+
onValueChange: (val) => {
|
|
46
|
+
props.onChange?.(val?.value ?? "");
|
|
47
|
+
},
|
|
48
|
+
isItemEqualToValue: (a, b) => a?.value === b?.value,
|
|
49
|
+
onOpenChange: (open) => setIsOpen(open),
|
|
50
|
+
disabled: props.disabled,
|
|
51
|
+
children: [(0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Input, {
|
|
52
|
+
ref: props.ref,
|
|
53
|
+
className: require_combobox_css.comboboxInputStyle,
|
|
54
|
+
style: (0, _vanilla_extract_dynamic.assignInlineVars)({
|
|
55
|
+
[require_inputFieldConstants_css.preInputWidth]: wrapperProps.preInputWidth,
|
|
56
|
+
[require_inputFieldConstants_css.postInputWidth]: wrapperProps.postInputWidth
|
|
57
|
+
}),
|
|
58
|
+
...commonInputProps
|
|
59
|
+
}), (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Portal, { children: (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Positioner, {
|
|
60
|
+
className: require_select_css.popUpStyle,
|
|
61
|
+
sideOffset: 4,
|
|
62
|
+
align: "start",
|
|
63
|
+
children: (0, react_jsx_runtime.jsxs)(_base_ui_react_combobox.Combobox.Popup, {
|
|
64
|
+
className: require_select_css.listBoxStyle,
|
|
65
|
+
children: [props.noOptionsText && (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Empty, {
|
|
66
|
+
className: require_combobox_css.comboboxEmptyStyle,
|
|
67
|
+
children: props.noOptionsText
|
|
68
|
+
}), (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.List, { children: (item) => (0, react_jsx_runtime.jsxs)(_base_ui_react_combobox.Combobox.Item, {
|
|
69
|
+
value: item,
|
|
70
|
+
className: require_select_css.optionStyle,
|
|
71
|
+
children: [(0, react_jsx_runtime.jsx)("div", { className: require_select_css.optionBackground }), (0, react_jsx_runtime.jsxs)("div", {
|
|
72
|
+
className: require_select_css.singleOptionStyle,
|
|
73
|
+
children: [(0, react_jsx_runtime.jsxs)("span", {
|
|
74
|
+
style: {
|
|
75
|
+
display: "flex",
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
gap: _gnist_themes_tokens_css_js.tokens.spacing.xxs
|
|
78
|
+
},
|
|
79
|
+
children: [item.leadingContent && (0, react_jsx_runtime.jsx)("span", {
|
|
80
|
+
"aria-hidden": true,
|
|
81
|
+
children: item.leadingContent
|
|
82
|
+
}), item.label]
|
|
83
|
+
}), (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.ItemIndicator, { children: (0, react_jsx_runtime.jsx)(require_Icon.Icon, { icon: "check" }) })]
|
|
84
|
+
})]
|
|
85
|
+
}, item.value) })]
|
|
86
|
+
})
|
|
87
|
+
}) })]
|
|
88
|
+
}), (0, react_jsx_runtime.jsxs)("span", {
|
|
89
|
+
className: require_inputField_css.inputContentWrapper({ density: props.density }),
|
|
90
|
+
children: [
|
|
91
|
+
props.leadingIcon && (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
92
|
+
icon: props.leadingIcon,
|
|
93
|
+
className: (0, _gnist_themes_atoms_css_js.atoms)({
|
|
94
|
+
paddingRight: "xxs",
|
|
95
|
+
color: props.disabled ? "on-disabled" : "on-surface"
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
99
|
+
id: contentProps.labelId,
|
|
100
|
+
className: require_labelStyles_css.labelStyle({
|
|
101
|
+
density: props.density,
|
|
102
|
+
validityType: props.validity?.type,
|
|
103
|
+
isElevated: hasValue || isOpen,
|
|
104
|
+
disabled: props.disabled,
|
|
105
|
+
visuallyHidden: props.hideLabel && hasValue || false
|
|
106
|
+
}),
|
|
107
|
+
style: (0, _vanilla_extract_dynamic.assignInlineVars)({ [require_inputFieldConstants_css.preInputWidth]: wrapperProps.preInputWidth }),
|
|
108
|
+
children: (0, react_jsx_runtime.jsx)("span", {
|
|
109
|
+
style: { position: "relative" },
|
|
110
|
+
children: props.label
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
(0, react_jsx_runtime.jsx)("span", { style: { flexGrow: "1" } }),
|
|
114
|
+
(0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
115
|
+
icon: isOpen ? "expand_less" : "expand_more",
|
|
116
|
+
className: (0, _gnist_themes_atoms_css_js.atoms)({
|
|
117
|
+
paddingLeft: "xxs",
|
|
118
|
+
color: props.disabled ? "on-disabled" : "on-surface"
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
})]
|
|
123
|
+
}), (0, react_jsx_runtime.jsx)(require_InputHelperText.InputHelperText, {
|
|
124
|
+
id: contentProps.helperId,
|
|
125
|
+
validity: props.validity,
|
|
126
|
+
helperText: props.helperText,
|
|
127
|
+
disabled: props.disabled,
|
|
128
|
+
reserveSpaceForMessage: props.reserveSpaceForMessage
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
exports.Combobox = Combobox;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { SelectBaseInputProps } from "../shared.js";
|
|
3
|
+
export type ComboboxOption = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
/**
|
|
7
|
+
* Optional content rendered before the label in each list item (e.g. a flag emoji or icon).
|
|
8
|
+
* Hidden from screen readers.
|
|
9
|
+
*/
|
|
10
|
+
leadingContent?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional secondary value associated with the option (e.g. a dial code "+47").
|
|
13
|
+
* Not displayed or searched — available for lookup after selection.
|
|
14
|
+
*/
|
|
15
|
+
secondaryLabel?: string;
|
|
16
|
+
};
|
|
17
|
+
export interface ComboboxProps extends Omit<SelectBaseInputProps<string>, "ref"> {
|
|
18
|
+
/**
|
|
19
|
+
* Values to be listed as options
|
|
20
|
+
* @default []
|
|
21
|
+
*/
|
|
22
|
+
options: ComboboxOption[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether to visually hide the label. Label should still have a meaningful name, as it's read by screen reader.
|
|
25
|
+
*/
|
|
26
|
+
hideLabel?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Text shown when no options match the search query.
|
|
29
|
+
* No default is provided — consumers are responsible for supplying a translated string.
|
|
30
|
+
*/
|
|
31
|
+
noOptionsText?: string;
|
|
32
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
Combobox lets users select one item from a filterable list. Type to narrow the list down — useful when the list is too long to scroll through comfortably.
|
|
36
|
+
|
|
37
|
+
Each option can carry an optional `secondaryLabel` (e.g. a dial code) which is not displayed or searched, but is available for lookup after the user makes a selection.
|
|
38
|
+
|
|
39
|
+
Documentation: [Combobox](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-dropdowns-combobox--docs)
|
|
40
|
+
*/
|
|
41
|
+
export declare const Combobox: React.FC<ComboboxProps>;
|
|
42
|
+
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,OAAO,EAAE,oBAAoB,EAAuB,MAAM,cAAc,CAAC;AAOzE,MAAM,MAAM,cAAc,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,aACb,SAAQ,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IACjD;;;OAGG;IACH,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAgJ5C,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../../../foundation/iconography/Icon.js";
|
|
3
|
+
import "../../../foundation/index.js";
|
|
4
|
+
import { InputHelperText } from "../../../building-blocks/inputs/InputHelperText.js";
|
|
5
|
+
import "../../../building-blocks/index.js";
|
|
6
|
+
import { postInputWidth, preInputWidth } from "../shared-styles/inputFieldConstants.css.js";
|
|
7
|
+
import { inputContentWrapper, inputFieldWrapperRecipe, wrapperStyle } from "../shared-styles/inputField.css.js";
|
|
8
|
+
import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
9
|
+
import { useSelectInputLogic } from "../shared.js";
|
|
10
|
+
import { listBoxStyle, optionBackground, optionStyle, popUpStyle, singleOptionStyle } from "./select.css.js";
|
|
11
|
+
import { comboboxEmptyStyle, comboboxInputStyle } from "./combobox.css.js";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
14
|
+
import { useMemo, useState } from "react";
|
|
15
|
+
import { tokens } from "@gnist/themes/tokens.css.js";
|
|
16
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
17
|
+
import classNames from "classnames";
|
|
18
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
19
|
+
//#region src/components/inputs/dropdowns/Combobox.tsx
|
|
20
|
+
/**
|
|
21
|
+
Combobox lets users select one item from a filterable list. Type to narrow the list down — useful when the list is too long to scroll through comfortably.
|
|
22
|
+
|
|
23
|
+
Each option can carry an optional `secondaryLabel` (e.g. a dial code) which is not displayed or searched, but is available for lookup after the user makes a selection.
|
|
24
|
+
|
|
25
|
+
Documentation: [Combobox](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-dropdowns-combobox--docs)
|
|
26
|
+
*/
|
|
27
|
+
var Combobox$1 = (props) => {
|
|
28
|
+
const { contentProps, wrapperProps, commonInputProps } = useSelectInputLogic(props);
|
|
29
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
30
|
+
const hasValue = !!props.value;
|
|
31
|
+
const selectedOption = useMemo(() => props.options.find((o) => o.value === props.value) ?? null, [props.options, props.value]);
|
|
32
|
+
return jsxs("span", {
|
|
33
|
+
className: classNames(wrapperProps.className, wrapperStyle),
|
|
34
|
+
children: [jsxs("label", {
|
|
35
|
+
className: inputFieldWrapperRecipe({
|
|
36
|
+
disabled: props.disabled,
|
|
37
|
+
density: props.density,
|
|
38
|
+
validityType: props.validity?.type
|
|
39
|
+
}),
|
|
40
|
+
children: [jsxs(Combobox.Root, {
|
|
41
|
+
items: props.options,
|
|
42
|
+
value: selectedOption,
|
|
43
|
+
onValueChange: (val) => {
|
|
44
|
+
props.onChange?.(val?.value ?? "");
|
|
45
|
+
},
|
|
46
|
+
isItemEqualToValue: (a, b) => a?.value === b?.value,
|
|
47
|
+
onOpenChange: (open) => setIsOpen(open),
|
|
48
|
+
disabled: props.disabled,
|
|
49
|
+
children: [jsx(Combobox.Input, {
|
|
50
|
+
ref: props.ref,
|
|
51
|
+
className: comboboxInputStyle,
|
|
52
|
+
style: assignInlineVars({
|
|
53
|
+
[preInputWidth]: wrapperProps.preInputWidth,
|
|
54
|
+
[postInputWidth]: wrapperProps.postInputWidth
|
|
55
|
+
}),
|
|
56
|
+
...commonInputProps
|
|
57
|
+
}), jsx(Combobox.Portal, { children: jsx(Combobox.Positioner, {
|
|
58
|
+
className: popUpStyle,
|
|
59
|
+
sideOffset: 4,
|
|
60
|
+
align: "start",
|
|
61
|
+
children: jsxs(Combobox.Popup, {
|
|
62
|
+
className: listBoxStyle,
|
|
63
|
+
children: [props.noOptionsText && jsx(Combobox.Empty, {
|
|
64
|
+
className: comboboxEmptyStyle,
|
|
65
|
+
children: props.noOptionsText
|
|
66
|
+
}), jsx(Combobox.List, { children: (item) => jsxs(Combobox.Item, {
|
|
67
|
+
value: item,
|
|
68
|
+
className: optionStyle,
|
|
69
|
+
children: [jsx("div", { className: optionBackground }), jsxs("div", {
|
|
70
|
+
className: singleOptionStyle,
|
|
71
|
+
children: [jsxs("span", {
|
|
72
|
+
style: {
|
|
73
|
+
display: "flex",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
gap: tokens.spacing.xxs
|
|
76
|
+
},
|
|
77
|
+
children: [item.leadingContent && jsx("span", {
|
|
78
|
+
"aria-hidden": true,
|
|
79
|
+
children: item.leadingContent
|
|
80
|
+
}), item.label]
|
|
81
|
+
}), jsx(Combobox.ItemIndicator, { children: jsx(Icon, { icon: "check" }) })]
|
|
82
|
+
})]
|
|
83
|
+
}, item.value) })]
|
|
84
|
+
})
|
|
85
|
+
}) })]
|
|
86
|
+
}), jsxs("span", {
|
|
87
|
+
className: inputContentWrapper({ density: props.density }),
|
|
88
|
+
children: [
|
|
89
|
+
props.leadingIcon && jsx(Icon, {
|
|
90
|
+
icon: props.leadingIcon,
|
|
91
|
+
className: atoms({
|
|
92
|
+
paddingRight: "xxs",
|
|
93
|
+
color: props.disabled ? "on-disabled" : "on-surface"
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
jsx("span", {
|
|
97
|
+
id: contentProps.labelId,
|
|
98
|
+
className: labelStyle({
|
|
99
|
+
density: props.density,
|
|
100
|
+
validityType: props.validity?.type,
|
|
101
|
+
isElevated: hasValue || isOpen,
|
|
102
|
+
disabled: props.disabled,
|
|
103
|
+
visuallyHidden: props.hideLabel && hasValue || false
|
|
104
|
+
}),
|
|
105
|
+
style: assignInlineVars({ [preInputWidth]: wrapperProps.preInputWidth }),
|
|
106
|
+
children: jsx("span", {
|
|
107
|
+
style: { position: "relative" },
|
|
108
|
+
children: props.label
|
|
109
|
+
})
|
|
110
|
+
}),
|
|
111
|
+
jsx("span", { style: { flexGrow: "1" } }),
|
|
112
|
+
jsx(Icon, {
|
|
113
|
+
icon: isOpen ? "expand_less" : "expand_more",
|
|
114
|
+
className: atoms({
|
|
115
|
+
paddingLeft: "xxs",
|
|
116
|
+
color: props.disabled ? "on-disabled" : "on-surface"
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
})]
|
|
121
|
+
}), jsx(InputHelperText, {
|
|
122
|
+
id: contentProps.helperId,
|
|
123
|
+
validity: props.validity,
|
|
124
|
+
helperText: props.helperText,
|
|
125
|
+
disabled: props.disabled,
|
|
126
|
+
reserveSpaceForMessage: props.reserveSpaceForMessage
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
//#endregion
|
|
131
|
+
export { Combobox$1 as Combobox };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
3
|
+
let _gnist_themes_atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
4
|
+
let _gnist_themes_layers_css_js = require("@gnist/themes/layers.css.js");
|
|
5
|
+
//#region src/components/inputs/dropdowns/combobox.css.ts
|
|
6
|
+
var comboboxInputStyle = (0, _gnist_themes_layers_css_js.gnistStyle)([require_inputField_css.inputFieldStyle, {
|
|
7
|
+
position: "absolute",
|
|
8
|
+
inset: 0,
|
|
9
|
+
paddingTop: "inherit",
|
|
10
|
+
paddingBottom: "inherit",
|
|
11
|
+
boxSizing: "border-box"
|
|
12
|
+
}]);
|
|
13
|
+
var comboboxEmptyStyle = (0, _gnist_themes_layers_css_js.gnistStyle)([(0, _gnist_themes_atoms_css_js.atoms)({
|
|
14
|
+
display: "flex",
|
|
15
|
+
padding: "base",
|
|
16
|
+
color: "on-surface"
|
|
17
|
+
}), {
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
opacity: .6
|
|
20
|
+
}]);
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.comboboxEmptyStyle = comboboxEmptyStyle;
|
|
23
|
+
exports.comboboxInputStyle = comboboxInputStyle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.css.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/combobox.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,QAS7B,CAAC;AAEH,eAAO,MAAM,kBAAkB,QAU7B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { inputFieldStyle } from "../shared-styles/inputField.css.js";
|
|
3
|
+
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
4
|
+
import { gnistStyle } from "@gnist/themes/layers.css.js";
|
|
5
|
+
//#region src/components/inputs/dropdowns/combobox.css.ts
|
|
6
|
+
var comboboxInputStyle = gnistStyle([inputFieldStyle, {
|
|
7
|
+
position: "absolute",
|
|
8
|
+
inset: 0,
|
|
9
|
+
paddingTop: "inherit",
|
|
10
|
+
paddingBottom: "inherit",
|
|
11
|
+
boxSizing: "border-box"
|
|
12
|
+
}]);
|
|
13
|
+
var comboboxEmptyStyle = gnistStyle([atoms({
|
|
14
|
+
display: "flex",
|
|
15
|
+
padding: "base",
|
|
16
|
+
color: "on-surface"
|
|
17
|
+
}), {
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
opacity: .6
|
|
20
|
+
}]);
|
|
21
|
+
//#endregion
|
|
22
|
+
export { comboboxEmptyStyle, comboboxInputStyle };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_Combobox = require("./Combobox.cjs");
|
|
3
4
|
const require_MultiSelect = require("./MultiSelect.cjs");
|
|
4
5
|
const require_SingleSelect = require("./SingleSelect.cjs");
|
|
6
|
+
exports.Combobox = require_Combobox.Combobox;
|
|
5
7
|
exports.MultiSelect = require_MultiSelect.MultiSelect;
|
|
6
8
|
exports.SingleSelect = require_SingleSelect.SingleSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_TextArea = require("./textFields/TextArea.cjs");
|
|
4
|
+
const require_Combobox = require("./dropdowns/Combobox.cjs");
|
|
4
5
|
const require_MultiSelect = require("./dropdowns/MultiSelect.cjs");
|
|
5
6
|
const require_SingleSelect = require("./dropdowns/SingleSelect.cjs");
|
|
6
7
|
require("./dropdowns/index.cjs");
|
|
@@ -9,6 +10,7 @@ require("./pickers/index.cjs");
|
|
|
9
10
|
const require_TextField = require("./textFields/TextField.cjs");
|
|
10
11
|
require("./textFields/index.cjs");
|
|
11
12
|
exports.Calendar = require_calendar.Calendar;
|
|
13
|
+
exports.Combobox = require_Combobox.Combobox;
|
|
12
14
|
exports.MultiSelect = require_MultiSelect.MultiSelect;
|
|
13
15
|
exports.SingleSelect = require_SingleSelect.SingleSelect;
|
|
14
16
|
exports.TextArea = require_TextArea.TextArea;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { TextArea, characterCount, wordCount } from "./textFields/TextArea.js";
|
|
3
|
+
import { Combobox } from "./dropdowns/Combobox.js";
|
|
3
4
|
import { MultiSelect } from "./dropdowns/MultiSelect.js";
|
|
4
5
|
import { SingleSelect } from "./dropdowns/SingleSelect.js";
|
|
5
6
|
import "./dropdowns/index.js";
|
|
@@ -7,4 +8,4 @@ import { Calendar } from "./pickers/calendar.js";
|
|
|
7
8
|
import "./pickers/index.js";
|
|
8
9
|
import { TextField } from "./textFields/TextField.js";
|
|
9
10
|
import "./textFields/index.js";
|
|
10
|
-
export { Calendar, MultiSelect, SingleSelect, TextArea, TextField, characterCount, wordCount };
|
|
11
|
+
export { Calendar, Combobox, MultiSelect, SingleSelect, TextArea, TextField, characterCount, wordCount };
|
|
@@ -18,9 +18,9 @@ var head = (0, _gnist_themes_layers_css_js.gnistStyle)([(0, _gnist_themes_atoms_
|
|
|
18
18
|
display: "flex",
|
|
19
19
|
justifyContent: "space-between",
|
|
20
20
|
alignItems: "center",
|
|
21
|
-
padding: "xs",
|
|
22
21
|
typography: "heading3-small"
|
|
23
22
|
}), {
|
|
23
|
+
padding: `${_gnist_themes_tokens_css_js.tokens.spacing.xxs} ${_gnist_themes_tokens_css_js.tokens.spacing.xxs}`,
|
|
24
24
|
cursor: "pointer",
|
|
25
25
|
position: "relative",
|
|
26
26
|
selectors: { "&:focus": { outline: `${_gnist_themes_tokens_css_js.tokens.stroke.medium} solid ${_gnist_themes_tokens_css_js.tokens.color.interactive}` } }
|
|
@@ -18,9 +18,9 @@ var head = gnistStyle([atoms({
|
|
|
18
18
|
display: "flex",
|
|
19
19
|
justifyContent: "space-between",
|
|
20
20
|
alignItems: "center",
|
|
21
|
-
padding: "xs",
|
|
22
21
|
typography: "heading3-small"
|
|
23
22
|
}), {
|
|
23
|
+
padding: `${tokens.spacing.xxs} ${tokens.spacing.xxs}`,
|
|
24
24
|
cursor: "pointer",
|
|
25
25
|
position: "relative",
|
|
26
26
|
selectors: { "&:focus": { outline: `${tokens.stroke.medium} solid ${tokens.color.interactive}` } }
|
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ const require_TextArea = require("./components/inputs/textFields/TextArea.cjs");
|
|
|
41
41
|
const require_FeedbackInput = require("./components/feedback/feedbackInput/FeedbackInput.cjs");
|
|
42
42
|
const require_Lozenge = require("./components/feedback/notifications/Lozenge.cjs");
|
|
43
43
|
const require_ProgressBar = require("./components/feedback/progress/ProgressBar.cjs");
|
|
44
|
+
const require_Combobox = require("./components/inputs/dropdowns/Combobox.cjs");
|
|
44
45
|
const require_MultiSelect = require("./components/inputs/dropdowns/MultiSelect.cjs");
|
|
45
46
|
const require_SingleSelect = require("./components/inputs/dropdowns/SingleSelect.cjs");
|
|
46
47
|
const require_date = require("./utilities/time/date.cjs");
|
|
@@ -71,6 +72,7 @@ exports.Calendar = require_calendar.Calendar;
|
|
|
71
72
|
exports.Checkbox = require_Checkbox.Checkbox;
|
|
72
73
|
exports.CheckboxCard = require_CheckboxCard.CheckboxCard;
|
|
73
74
|
exports.Column = require_Column.Column;
|
|
75
|
+
exports.Combobox = require_Combobox.Combobox;
|
|
74
76
|
exports.CupraFont = require_index$7.CupraFont;
|
|
75
77
|
exports.DahlesFont = require_index$7.DahlesFont;
|
|
76
78
|
exports.DangerButton = require_DangerButton.DangerButton;
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import { TextArea, characterCount, wordCount } from "./components/inputs/textFie
|
|
|
40
40
|
import { FeedbackInput } from "./components/feedback/feedbackInput/FeedbackInput.js";
|
|
41
41
|
import { Lozenge } from "./components/feedback/notifications/Lozenge.js";
|
|
42
42
|
import { ProgressBar, ProgressBarComponent } from "./components/feedback/progress/ProgressBar.js";
|
|
43
|
+
import { Combobox } from "./components/inputs/dropdowns/Combobox.js";
|
|
43
44
|
import { MultiSelect } from "./components/inputs/dropdowns/MultiSelect.js";
|
|
44
45
|
import { SingleSelect } from "./components/inputs/dropdowns/SingleSelect.js";
|
|
45
46
|
import { addDays, addMonths, getStartOfDay, isNorwegianHoliday, isSameDate, maxDayOfMonth, minDayOfMonth, nextMonth, today } from "./utilities/time/date.js";
|
|
@@ -58,4 +59,4 @@ import { FormProvider, useForm } from "./utilities/forms/formContext.js";
|
|
|
58
59
|
import { formInputs } from "./utilities/forms/formInputs.js";
|
|
59
60
|
import { useLocalFormState } from "./utilities/forms/useLocalFormState.js";
|
|
60
61
|
import "./utilities/index.js";
|
|
61
|
-
export { Accordion, ActionCard, ActionChip, AlertBanner, AudiFont, AutoriaFont, BilholdFont, BodyText, Calendar, Checkbox, CheckboxCard, Column, CupraFont, DahlesFont, DangerButton, DetailText, DisplayText, ExtraIconsProvider, FeedbackInput, FilterChip, FormProvider, GhostButton, GumpenFont, HeaderLevels, Heading1Text, Heading2Text, Heading3Text, Icon, IconButton, IconVariantProvider, InfoCard, InputHelperText, LeadText, Link, LinkCard, LoadingBar, LoadingBarComponent, LoadingSpinner, LocalizationProvider, Logo, Lozenge, Modal, MollerFont, MultiSelect, PrimaryButton, ProgressBar, ProgressBarComponent, RadioButton, RadioCard, RadioGroup, Row, ScreenReaderOnly, SecondaryButton, SingleSelect, SkodaFont, Spinner, StatusIndicator, SuccessButton, Switch, TagChip, TextArea, TextButton, TextContainer, TextField, ToolsFont, VWFont, addDays, addMonths, breakpointDesktop, breakpointMobile, breakpointTablet, characterCount, defineIcons, formInputs, getStartOfDay, isNorwegianHoliday, isSameDate, maxDayOfMonth, minDayOfMonth, nextMonth, sliceTranslate, today, translate, useForm, useInputHelperText, useLanguage, useLocalFormState, useTranslation, visuallyHidden, wordCount };
|
|
62
|
+
export { Accordion, ActionCard, ActionChip, AlertBanner, AudiFont, AutoriaFont, BilholdFont, BodyText, Calendar, Checkbox, CheckboxCard, Column, Combobox, CupraFont, DahlesFont, DangerButton, DetailText, DisplayText, ExtraIconsProvider, FeedbackInput, FilterChip, FormProvider, GhostButton, GumpenFont, HeaderLevels, Heading1Text, Heading2Text, Heading3Text, Icon, IconButton, IconVariantProvider, InfoCard, InputHelperText, LeadText, Link, LinkCard, LoadingBar, LoadingBarComponent, LoadingSpinner, LocalizationProvider, Logo, Lozenge, Modal, MollerFont, MultiSelect, PrimaryButton, ProgressBar, ProgressBarComponent, RadioButton, RadioCard, RadioGroup, Row, ScreenReaderOnly, SecondaryButton, SingleSelect, SkodaFont, Spinner, StatusIndicator, SuccessButton, Switch, TagChip, TextArea, TextButton, TextContainer, TextField, ToolsFont, VWFont, addDays, addMonths, breakpointDesktop, breakpointMobile, breakpointTablet, characterCount, defineIcons, formInputs, getStartOfDay, isNorwegianHoliday, isSameDate, maxDayOfMonth, minDayOfMonth, nextMonth, sliceTranslate, today, translate, useForm, useInputHelperText, useLanguage, useLocalFormState, useTranslation, visuallyHidden, wordCount };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnist/design-system",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"optional": true
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "184a0f0afd1a0a1272fe253dee4a8c9ba1c40f5f"
|
|
108
108
|
}
|