@gnist/design-system 3.12.1 → 3.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/components/actions/selectionControls/Switch.cjs +2 -3
- package/dist/components/actions/selectionControls/Switch.d.ts +3 -1
- package/dist/components/actions/selectionControls/Switch.d.ts.map +1 -1
- package/dist/components/actions/selectionControls/Switch.js +2 -3
- package/dist/components/inputs/dropdowns/MultiSelect.cjs +1 -3
- package/dist/components/inputs/dropdowns/MultiSelect.d.ts +1 -1
- package/dist/components/inputs/dropdowns/MultiSelect.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/MultiSelect.js +1 -3
- package/dist/components/inputs/dropdowns/SelectBase.cjs +50 -26
- package/dist/components/inputs/dropdowns/SelectBase.d.ts +4 -0
- package/dist/components/inputs/dropdowns/SelectBase.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/SelectBase.js +34 -27
- package/dist/components/inputs/dropdowns/SingleSelect.cjs +1 -3
- package/dist/components/inputs/dropdowns/SingleSelect.d.ts +2 -1
- package/dist/components/inputs/dropdowns/SingleSelect.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/SingleSelect.js +1 -3
- package/dist/components/inputs/dropdowns/select.css.cjs +8 -2
- package/dist/components/inputs/dropdowns/select.css.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/select.css.js +8 -2
- package/dist/components/inputs/pickers/calendar.cjs +1 -1
- package/dist/components/inputs/pickers/calendar.js +1 -1
- package/dist/components/inputs/shared.cjs +1 -20
- package/dist/components/inputs/shared.d.ts +1 -0
- package/dist/components/inputs/shared.d.ts.map +1 -1
- package/dist/components/inputs/shared.js +1 -20
- package/dist/components/surfaces/modal/Modal.cjs +1 -1
- package/dist/components/surfaces/modal/Modal.js +1 -1
- package/dist/translations/LocalizationProvider.d.ts +2 -0
- package/dist/translations/LocalizationProvider.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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
|
+
## [3.12.3](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@3.12.2...@gnist/design-system@3.12.3) (2025-09-19)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add link to documentation for LocalizationProvider ([3c6ba95](https://github.com/mollerdigital/design-system-design-system/commit/3c6ba9583c30eb6f2706ebfe20b75b94d7a2d903))
|
|
11
|
+
|
|
12
|
+
## [3.12.2](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@3.12.1...@gnist/design-system@3.12.2) (2025-09-16)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @gnist/design-system
|
|
15
|
+
|
|
6
16
|
## [3.12.1](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@3.12.0...@gnist/design-system@3.12.1) (2025-09-12)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
|
@@ -6,12 +6,11 @@ const InputHelperText = require("../../../building-blocks/inputs/InputHelperText
|
|
|
6
6
|
const ScreenReaderOnly = require("../../../utilities/accessibility/ScreenReaderOnly.cjs");
|
|
7
7
|
require("../../../utilities/accessibility/visuallyHidden.css.cjs");
|
|
8
8
|
const index = require("../../../utilities/html/index.cjs");
|
|
9
|
-
const React = require("react");
|
|
10
9
|
const switch_css = require("./switch.css.cjs");
|
|
11
10
|
const shared_css = require("./shared.css.cjs");
|
|
12
11
|
const shared = require("./shared.cjs");
|
|
13
12
|
const defaultRender = (switchElement, description) => jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [switchElement, jsxRuntime.jsx("div", { className: switch_css.switchDescription, children: description })] });
|
|
14
|
-
|
|
13
|
+
function Switch({ offLabel, onLabel, description, value = false, onChange, disabled, validity, id = index.createValidHtmlId(offLabel || onLabel || "toggle"), hideLabel = false, canShowErrorMessage = false, className, ref, ...rest }) {
|
|
15
14
|
const inputId = id;
|
|
16
15
|
const labelId = `${id}-label`;
|
|
17
16
|
const helperId = `${id}-helper`;
|
|
@@ -45,5 +44,5 @@ const Switch = React.forwardRef(function Switch2({ offLabel, onLabel, descriptio
|
|
|
45
44
|
disabled
|
|
46
45
|
}), children: onLabel })] }) });
|
|
47
46
|
return jsxRuntime.jsx(shared.HelperTextWrapper, { ...helperTextProps, children: defaultRender(switchElement, descriptionElement) });
|
|
48
|
-
}
|
|
47
|
+
}
|
|
49
48
|
exports.Switch = Switch;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
1
2
|
import { SelectionControlProps } from "./shared.js";
|
|
2
3
|
export interface SwitchProps extends Omit<SelectionControlProps<boolean>, "render"> {
|
|
3
4
|
/** The left side label of the switch. */
|
|
4
5
|
offLabel?: string;
|
|
5
6
|
/** The right side label of the switch. */
|
|
6
7
|
onLabel: string;
|
|
8
|
+
ref?: Ref<HTMLSpanElement>;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* Use switches to:
|
|
@@ -13,5 +15,5 @@ export interface SwitchProps extends Omit<SelectionControlProps<boolean>, "rende
|
|
|
13
15
|
*
|
|
14
16
|
* Documentation: [Switch](https://gnist.moller.no/developers/components/latest/?path=/docs/components-actions-selectioncontrols-switch--docs)
|
|
15
17
|
*/
|
|
16
|
-
export declare
|
|
18
|
+
export declare function Switch({ offLabel, onLabel, description, value, onChange, disabled, validity, id, hideLabel, canShowErrorMessage, className, ref, ...rest }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/Switch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/Switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgB,GAAG,EAAE,MAAM,OAAO,CAAC;AAS1C,OAAO,EAEH,qBAAqB,EAExB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,WACb,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACtD,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC9B;AAYD;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,WAAW,EACX,KAAa,EACb,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,EAAuD,EACvD,SAAiB,EACjB,mBAA2B,EAC3B,SAAS,EACT,GAAG,EACH,GAAG,IAAI,EACV,EAAE,WAAW,2CAkGb"}
|
|
@@ -4,12 +4,11 @@ import { useInputHelperText } from "../../../building-blocks/inputs/InputHelperT
|
|
|
4
4
|
import { ScreenReaderOnly } from "../../../utilities/accessibility/ScreenReaderOnly.js";
|
|
5
5
|
import "../../../utilities/accessibility/visuallyHidden.css.js";
|
|
6
6
|
import { createValidHtmlId } from "../../../utilities/html/index.js";
|
|
7
|
-
import { forwardRef } from "react";
|
|
8
7
|
import { switchContainerStyle, SwitchLabelRecipe, SwitchRecipe, SwitchThumbRecipe, switchDescription } from "./switch.css.js";
|
|
9
8
|
import { InputWrapper, InputStyleRecipe } from "./shared.css.js";
|
|
10
9
|
import { SelectionDescription, HelperTextWrapper } from "./shared.js";
|
|
11
10
|
const defaultRender = (switchElement, description) => jsxs(Fragment, { children: [switchElement, jsx("div", { className: switchDescription, children: description })] });
|
|
12
|
-
|
|
11
|
+
function Switch({ offLabel, onLabel, description, value = false, onChange, disabled, validity, id = createValidHtmlId(offLabel || onLabel || "toggle"), hideLabel = false, canShowErrorMessage = false, className, ref, ...rest }) {
|
|
13
12
|
const inputId = id;
|
|
14
13
|
const labelId = `${id}-label`;
|
|
15
14
|
const helperId = `${id}-helper`;
|
|
@@ -43,7 +42,7 @@ const Switch = forwardRef(function Switch2({ offLabel, onLabel, description, val
|
|
|
43
42
|
disabled
|
|
44
43
|
}), children: onLabel })] }) });
|
|
45
44
|
return jsx(HelperTextWrapper, { ...helperTextProps, children: defaultRender(switchElement, descriptionElement) });
|
|
46
|
-
}
|
|
45
|
+
}
|
|
47
46
|
export {
|
|
48
47
|
Switch
|
|
49
48
|
};
|
|
@@ -2,7 +2,5 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const SelectBase = require("./SelectBase.cjs");
|
|
5
|
-
|
|
6
|
-
return SelectBase.SelectBase(props, true);
|
|
7
|
-
}
|
|
5
|
+
const MultiSelect = (props) => SelectBase.SelectBase(props, true);
|
|
8
6
|
exports.MultiSelect = MultiSelect;
|
|
@@ -5,5 +5,5 @@ export type MultiSelectProps = SelectBaseProps<string[]>;
|
|
|
5
5
|
|
|
6
6
|
Documentation: [MultiSelect](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-dropdowns-multiselect--docs)
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare const MultiSelect: React.FC<MultiSelectProps>;
|
|
9
9
|
//# sourceMappingURL=MultiSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;AAEzD;;;;GAIG;AAEH,
|
|
1
|
+
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;AAEzD;;;;GAIG;AAEH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAEb,CAAC"}
|
|
@@ -2,23 +2,26 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const componentUtils = require("@gnist/component-utils");
|
|
6
|
-
const InputHelperText = require("../../../building-blocks/inputs/InputHelperText.cjs");
|
|
7
|
-
require("../../../utilities/layout/Row.cjs");
|
|
8
|
-
require("@gnist/themes/tokens.css.js");
|
|
9
|
-
require("react-content-loader");
|
|
10
5
|
const React = require("react");
|
|
6
|
+
const select = require("@base-ui-components/react/select");
|
|
7
|
+
const classNames = require("classnames");
|
|
8
|
+
const inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
9
|
+
const select_css = require("./select.css.cjs");
|
|
10
|
+
const dynamic = require("@vanilla-extract/dynamic");
|
|
11
|
+
const inputFieldConstants_css = require("../shared-styles/inputFieldConstants.css.cjs");
|
|
11
12
|
const shared = require("../shared.cjs");
|
|
12
13
|
require("../../../foundation/iconography/ExtraIconsProvider.cjs");
|
|
13
14
|
require("../../../foundation/iconography/IconVariantProvider.cjs");
|
|
14
15
|
require("../../../foundation/iconography/icons.cjs");
|
|
15
16
|
const Icon = require("../../../foundation/iconography/Icon.cjs");
|
|
16
17
|
require("../../../foundation/typography/index.cjs");
|
|
17
|
-
const classNames = require("classnames");
|
|
18
18
|
require("../../../foundation/logos/Logo.css.cjs");
|
|
19
19
|
const atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const labelStyles_css = require("../shared-styles/labelStyles.css.cjs");
|
|
21
|
+
const InputHelperText = require("../../../building-blocks/inputs/InputHelperText.cjs");
|
|
22
|
+
require("../../../utilities/layout/Row.cjs");
|
|
23
|
+
require("@gnist/themes/tokens.css.js");
|
|
24
|
+
require("react-content-loader");
|
|
22
25
|
require("../../../utilities/accessibility/ScreenReaderOnly.cjs");
|
|
23
26
|
require("../../../utilities/accessibility/visuallyHidden.css.cjs");
|
|
24
27
|
require("../../progress/Spinner.cjs");
|
|
@@ -28,42 +31,63 @@ const Checkbox = require("../../actions/selectionControls/Checkbox.cjs");
|
|
|
28
31
|
require("../../actions/selectionControls/radiobutton.css.cjs");
|
|
29
32
|
require("../../actions/selectionControls/shared.css.cjs");
|
|
30
33
|
require("../../../utilities/layout/Column.cjs");
|
|
31
|
-
require("../../actions/selectionControls/
|
|
34
|
+
require("../../actions/selectionControls/switch.css.cjs");
|
|
32
35
|
require("../../../styles/animations.css.cjs");
|
|
33
36
|
require("../../actions/chips/styles.css.cjs");
|
|
34
|
-
const inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
35
|
-
const inputFieldConstants_css = require("../shared-styles/inputFieldConstants.css.cjs");
|
|
36
|
-
const labelStyles_css = require("../shared-styles/labelStyles.css.cjs");
|
|
37
|
-
const select_css = require("./select.css.cjs");
|
|
38
37
|
const _interopDefaultCompat = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
38
|
+
function _interopNamespaceCompat(e) {
|
|
39
|
+
if (e && typeof e === "object" && "default" in e) return e;
|
|
40
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
41
|
+
if (e) {
|
|
42
|
+
for (const k in e) {
|
|
43
|
+
if (k !== "default") {
|
|
44
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
45
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: () => e[k]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
n.default = e;
|
|
53
|
+
return Object.freeze(n);
|
|
54
|
+
}
|
|
55
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceCompat(React);
|
|
39
56
|
const classNames__default = /* @__PURE__ */ _interopDefaultCompat(classNames);
|
|
40
|
-
const listBoxComponent = base.prepareForSlot(componentUtils.component("listBox", select_css.listBoxStyle, "div"));
|
|
41
|
-
const popUpComponent = base.prepareForSlot(componentUtils.component("popUp", select_css.popUpStyle, "div"));
|
|
42
57
|
function SelectBase(props, isMultiple) {
|
|
43
58
|
const { contentProps, wrapperProps, commonInputProps } = shared.useSelectInputLogic(props);
|
|
44
|
-
const
|
|
59
|
+
const itemsMap = React__namespace.useMemo(() => Object.fromEntries(props.options.map((o) => [o.value, o.label])), [props.options]);
|
|
45
60
|
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
46
|
-
|
|
61
|
+
const hasValue = isMultiple ? props.value.length > 0 : props.value !== "";
|
|
62
|
+
return jsxRuntime.jsxs("span", { className: classNames__default.default(wrapperProps.className, inputField_css.wrapperStyle), children: [jsxRuntime.jsxs("label", { className: inputField_css.inputFieldWrapperRecipe({
|
|
47
63
|
disabled: props.disabled,
|
|
48
64
|
density: props.density,
|
|
49
65
|
validityType: props.validity?.type
|
|
50
|
-
}), children: [jsxRuntime.
|
|
66
|
+
}), children: [jsxRuntime.jsxs(select.Select.Root, { items: itemsMap, onValueChange: (val) => {
|
|
67
|
+
if (Array.isArray(val)) {
|
|
68
|
+
props.onChange?.(val);
|
|
69
|
+
} else {
|
|
70
|
+
const next = val ?? "";
|
|
71
|
+
props.onChange?.(next);
|
|
72
|
+
}
|
|
73
|
+
}, onOpenChange: setIsExpanded, value: props.value, disabled: props.disabled, multiple: isMultiple, children: [jsxRuntime.jsx(select.Select.Trigger, { ref: props.ref, className: select_css.selectStyle, style: {
|
|
51
74
|
...dynamic.assignInlineVars({
|
|
52
75
|
[inputFieldConstants_css.preInputWidth]: wrapperProps.preInputWidth,
|
|
53
76
|
[inputFieldConstants_css.postInputWidth]: wrapperProps.postInputWidth
|
|
54
77
|
})
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
}, ...commonInputProps, children: jsxRuntime.jsx(select.Select.Value, { children: (value) => {
|
|
79
|
+
const selectedValues = Array.isArray(value) ? value : [value];
|
|
80
|
+
if (selectedValues.length === 0) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return selectedValues.map((value2) => itemsMap[value2]).join(", ");
|
|
84
|
+
} }) }), jsxRuntime.jsx(select.Select.Portal, { children: jsxRuntime.jsx(select.Select.Positioner, { className: select_css.popUpStyle, side: "bottom", alignItemWithTrigger: false, align: "start", children: jsxRuntime.jsx(select.Select.Popup, { className: select_css.listBoxStyle, children: props.options.map((opt) => jsxRuntime.jsxs(select.Select.Item, { value: opt.value, label: opt.label, className: select_css.optionStyle, children: [jsxRuntime.jsx("div", { className: select_css.optionBackground }), isMultiple ? jsxRuntime.jsx(Checkbox.Checkbox, { label: opt.label, value: Array.isArray(props.value) && props.value?.includes(opt.value), readOnly: true, tabIndex: -1 }) : jsxRuntime.jsxs("div", { className: select_css.singleOptionStyle, children: [jsxRuntime.jsx(select.Select.ItemText, { children: opt.label }), jsxRuntime.jsx(select.Select.ItemIndicator, { children: jsxRuntime.jsx(Icon.Icon, { icon: "check" }) })] })] }, opt.value)) }) }) })] }), jsxRuntime.jsxs("span", { className: inputField_css.inputContentWrapper({ density: props.density }), children: [props.leadingIcon && jsxRuntime.jsx(Icon.Icon, { icon: props.leadingIcon, className: atoms_css_js.atoms({
|
|
61
85
|
paddingRight: "xxs",
|
|
62
86
|
color: props.disabled ? "on-disabled" : "on-surface"
|
|
63
|
-
}) }), jsxRuntime.jsx("
|
|
87
|
+
}) }), jsxRuntime.jsx("span", { id: contentProps.labelId, className: labelStyles_css.labelStyle({
|
|
64
88
|
density: props.density,
|
|
65
89
|
validityType: props.validity?.type,
|
|
66
|
-
isElevated:
|
|
90
|
+
isElevated: hasValue,
|
|
67
91
|
disabled: props.disabled
|
|
68
92
|
}), style: {
|
|
69
93
|
...dynamic.assignInlineVars({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBase.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/SelectBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectBase.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/SelectBase.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,oBAAoB,EAAuB,MAAM,cAAc,CAAC;AAOzE,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D,MAAM,WAAW,eAAe,CAAC,IAAI,CAAE,SAAQ,oBAAoB,CAAC,IAAI,CAAC;IACrE;;;OAGG;IACH,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,2CA6K3E"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { InputHelperText } from "../../../building-blocks/inputs/InputHelperText.js";
|
|
5
|
-
import "../../../utilities/layout/Row.js";
|
|
6
|
-
import "@gnist/themes/tokens.css.js";
|
|
7
|
-
import "react-content-loader";
|
|
3
|
+
import * as React from "react";
|
|
8
4
|
import { useState } from "react";
|
|
9
|
-
import {
|
|
5
|
+
import { Select } from "@base-ui-components/react/select";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
import { inputFieldWrapperRecipe, inputContentWrapper, wrapperStyle } from "../shared-styles/inputField.css.js";
|
|
8
|
+
import { selectStyle, popUpStyle, listBoxStyle, optionStyle, optionBackground, singleOptionStyle } from "./select.css.js";
|
|
9
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
10
|
+
import { postInputWidth, preInputWidth } from "../shared-styles/inputFieldConstants.css.js";
|
|
11
|
+
import { useSelectInputLogic } from "../shared.js";
|
|
10
12
|
import "../../../foundation/iconography/ExtraIconsProvider.js";
|
|
11
13
|
import "../../../foundation/iconography/IconVariantProvider.js";
|
|
12
14
|
import "../../../foundation/iconography/icons.js";
|
|
13
15
|
import { Icon } from "../../../foundation/iconography/Icon.js";
|
|
14
16
|
import "../../../foundation/typography/index.js";
|
|
15
|
-
import classNames from "classnames";
|
|
16
17
|
import "../../../foundation/logos/Logo.css.js";
|
|
17
18
|
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
20
|
+
import { InputHelperText } from "../../../building-blocks/inputs/InputHelperText.js";
|
|
21
|
+
import "../../../utilities/layout/Row.js";
|
|
22
|
+
import "@gnist/themes/tokens.css.js";
|
|
23
|
+
import "react-content-loader";
|
|
20
24
|
import "../../../utilities/accessibility/ScreenReaderOnly.js";
|
|
21
25
|
import "../../../utilities/accessibility/visuallyHidden.css.js";
|
|
22
26
|
import "../../progress/Spinner.js";
|
|
@@ -26,40 +30,43 @@ import { Checkbox } from "../../actions/selectionControls/Checkbox.js";
|
|
|
26
30
|
import "../../actions/selectionControls/radiobutton.css.js";
|
|
27
31
|
import "../../actions/selectionControls/shared.css.js";
|
|
28
32
|
import "../../../utilities/layout/Column.js";
|
|
29
|
-
import "../../actions/selectionControls/
|
|
33
|
+
import "../../actions/selectionControls/switch.css.js";
|
|
30
34
|
import "../../../styles/animations.css.js";
|
|
31
35
|
import "../../actions/chips/styles.css.js";
|
|
32
|
-
import { inputFieldWrapperRecipe, inputContentWrapper, wrapperStyle } from "../shared-styles/inputField.css.js";
|
|
33
|
-
import { postInputWidth, preInputWidth } from "../shared-styles/inputFieldConstants.css.js";
|
|
34
|
-
import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
35
|
-
import { listBoxStyle, popUpStyle, selectStyle, optionStyle, optionBackground, singleOptionStyle } from "./select.css.js";
|
|
36
|
-
const listBoxComponent = prepareForSlot(component("listBox", listBoxStyle, "div"));
|
|
37
|
-
const popUpComponent = prepareForSlot(component("popUp", popUpStyle, "div"));
|
|
38
36
|
function SelectBase(props, isMultiple) {
|
|
39
37
|
const { contentProps, wrapperProps, commonInputProps } = useSelectInputLogic(props);
|
|
40
|
-
const
|
|
38
|
+
const itemsMap = React.useMemo(() => Object.fromEntries(props.options.map((o) => [o.value, o.label])), [props.options]);
|
|
41
39
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
42
|
-
|
|
40
|
+
const hasValue = isMultiple ? props.value.length > 0 : props.value !== "";
|
|
41
|
+
return jsxs("span", { className: classNames(wrapperProps.className, wrapperStyle), children: [jsxs("label", { className: inputFieldWrapperRecipe({
|
|
43
42
|
disabled: props.disabled,
|
|
44
43
|
density: props.density,
|
|
45
44
|
validityType: props.validity?.type
|
|
46
|
-
}), children: [
|
|
45
|
+
}), children: [jsxs(Select.Root, { items: itemsMap, onValueChange: (val) => {
|
|
46
|
+
if (Array.isArray(val)) {
|
|
47
|
+
props.onChange?.(val);
|
|
48
|
+
} else {
|
|
49
|
+
const next = val ?? "";
|
|
50
|
+
props.onChange?.(next);
|
|
51
|
+
}
|
|
52
|
+
}, onOpenChange: setIsExpanded, value: props.value, disabled: props.disabled, multiple: isMultiple, children: [jsx(Select.Trigger, { ref: props.ref, className: selectStyle, style: {
|
|
47
53
|
...assignInlineVars({
|
|
48
54
|
[preInputWidth]: wrapperProps.preInputWidth,
|
|
49
55
|
[postInputWidth]: wrapperProps.postInputWidth
|
|
50
56
|
})
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
}, ...commonInputProps, children: jsx(Select.Value, { children: (value) => {
|
|
58
|
+
const selectedValues = Array.isArray(value) ? value : [value];
|
|
59
|
+
if (selectedValues.length === 0) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return selectedValues.map((value2) => itemsMap[value2]).join(", ");
|
|
63
|
+
} }) }), jsx(Select.Portal, { children: jsx(Select.Positioner, { className: popUpStyle, side: "bottom", alignItemWithTrigger: false, align: "start", children: jsx(Select.Popup, { className: listBoxStyle, children: props.options.map((opt) => jsxs(Select.Item, { value: opt.value, label: opt.label, className: optionStyle, children: [jsx("div", { className: optionBackground }), isMultiple ? jsx(Checkbox, { label: opt.label, value: Array.isArray(props.value) && props.value?.includes(opt.value), readOnly: true, tabIndex: -1 }) : jsxs("div", { className: singleOptionStyle, children: [jsx(Select.ItemText, { children: opt.label }), jsx(Select.ItemIndicator, { children: jsx(Icon, { icon: "check" }) })] })] }, opt.value)) }) }) })] }), jsxs("span", { className: inputContentWrapper({ density: props.density }), children: [props.leadingIcon && jsx(Icon, { icon: props.leadingIcon, className: atoms({
|
|
57
64
|
paddingRight: "xxs",
|
|
58
65
|
color: props.disabled ? "on-disabled" : "on-surface"
|
|
59
|
-
}) }), jsx("
|
|
66
|
+
}) }), jsx("span", { id: contentProps.labelId, className: labelStyle({
|
|
60
67
|
density: props.density,
|
|
61
68
|
validityType: props.validity?.type,
|
|
62
|
-
isElevated:
|
|
69
|
+
isElevated: hasValue,
|
|
63
70
|
disabled: props.disabled
|
|
64
71
|
}), style: {
|
|
65
72
|
...assignInlineVars({
|
|
@@ -2,7 +2,5 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const SelectBase = require("./SelectBase.cjs");
|
|
5
|
-
|
|
6
|
-
return SelectBase.SelectBase(props, false);
|
|
7
|
-
}
|
|
5
|
+
const SingleSelect = (props) => SelectBase.SelectBase(props, false);
|
|
8
6
|
exports.SingleSelect = SingleSelect;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { SelectBaseProps } from "./SelectBase.js";
|
|
2
3
|
export type SingleSelectProps = SelectBaseProps<string>;
|
|
3
4
|
/**
|
|
@@ -7,5 +8,5 @@ export type SingleSelectProps = SelectBaseProps<string>;
|
|
|
7
8
|
|
|
8
9
|
Documentation: [SingleSelect](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-dropdowns-singleselect--docs)
|
|
9
10
|
*/
|
|
10
|
-
export declare
|
|
11
|
+
export declare const SingleSelect: React.FC<SingleSelectProps>;
|
|
11
12
|
//# sourceMappingURL=SingleSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/SingleSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAExD;;;;;;GAMG;AAEH,
|
|
1
|
+
{"version":3,"file":"SingleSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/SingleSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAExD;;;;;;GAMG;AAEH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAExB,CAAC"}
|
|
@@ -7,9 +7,9 @@ const css = require("@vanilla-extract/css");
|
|
|
7
7
|
const inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
8
8
|
const listBoxStyle = css.style([
|
|
9
9
|
atoms_css_js.atoms({
|
|
10
|
+
marginTop: "xxs",
|
|
10
11
|
display: "flex",
|
|
11
12
|
flexDirection: "column",
|
|
12
|
-
marginTop: "s",
|
|
13
13
|
padding: "base",
|
|
14
14
|
borderRadius: "picker",
|
|
15
15
|
backgroundColor: "surface",
|
|
@@ -35,7 +35,13 @@ const selectStyle = css.style([
|
|
|
35
35
|
overflow: "hidden",
|
|
36
36
|
textOverflow: "ellipsis",
|
|
37
37
|
whiteSpace: "nowrap",
|
|
38
|
-
cursor: "default"
|
|
38
|
+
cursor: "default",
|
|
39
|
+
// Makes trigger cover the wrapper, allowing trigger to activate
|
|
40
|
+
position: "absolute",
|
|
41
|
+
inset: 0,
|
|
42
|
+
paddingTop: "inherit",
|
|
43
|
+
paddingBottom: "inherit",
|
|
44
|
+
boxSizing: "border-box"
|
|
39
45
|
}
|
|
40
46
|
]);
|
|
41
47
|
const optionStyle = css.style([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.css.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/select.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,QAkBvB,CAAC;AAEH,eAAO,MAAM,UAAU,QAIrB,CAAC;AAEH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"select.css.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/dropdowns/select.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,QAkBvB,CAAC;AAEH,eAAO,MAAM,UAAU,QAIrB,CAAC;AAEH,eAAO,MAAM,WAAW,QAetB,CAAC;AAEH,eAAO,MAAM,WAAW,QAkBtB,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAO5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAoB3B,CAAC"}
|
|
@@ -5,9 +5,9 @@ import { style } from "@vanilla-extract/css";
|
|
|
5
5
|
import { inputFieldStyle } from "../shared-styles/inputField.css.js";
|
|
6
6
|
const listBoxStyle = style([
|
|
7
7
|
atoms({
|
|
8
|
+
marginTop: "xxs",
|
|
8
9
|
display: "flex",
|
|
9
10
|
flexDirection: "column",
|
|
10
|
-
marginTop: "s",
|
|
11
11
|
padding: "base",
|
|
12
12
|
borderRadius: "picker",
|
|
13
13
|
backgroundColor: "surface",
|
|
@@ -33,7 +33,13 @@ const selectStyle = style([
|
|
|
33
33
|
overflow: "hidden",
|
|
34
34
|
textOverflow: "ellipsis",
|
|
35
35
|
whiteSpace: "nowrap",
|
|
36
|
-
cursor: "default"
|
|
36
|
+
cursor: "default",
|
|
37
|
+
// Makes trigger cover the wrapper, allowing trigger to activate
|
|
38
|
+
position: "absolute",
|
|
39
|
+
inset: 0,
|
|
40
|
+
paddingTop: "inherit",
|
|
41
|
+
paddingBottom: "inherit",
|
|
42
|
+
boxSizing: "border-box"
|
|
37
43
|
}
|
|
38
44
|
]);
|
|
39
45
|
const optionStyle = style([
|
|
@@ -32,7 +32,7 @@ require("../../actions/selectionControls/checkbox.css.cjs");
|
|
|
32
32
|
require("../../actions/selectionControls/shared.css.cjs");
|
|
33
33
|
require("../../../utilities/layout/Column.cjs");
|
|
34
34
|
require("../../actions/selectionControls/radiobutton.css.cjs");
|
|
35
|
-
require("../../actions/selectionControls/
|
|
35
|
+
require("../../actions/selectionControls/switch.css.cjs");
|
|
36
36
|
require("../../../styles/animations.css.cjs");
|
|
37
37
|
require("../../actions/chips/styles.css.cjs");
|
|
38
38
|
const Calendar_css = require("./Calendar.css.cjs");
|
|
@@ -30,7 +30,7 @@ import "../../actions/selectionControls/checkbox.css.js";
|
|
|
30
30
|
import "../../actions/selectionControls/shared.css.js";
|
|
31
31
|
import "../../../utilities/layout/Column.js";
|
|
32
32
|
import "../../actions/selectionControls/radiobutton.css.js";
|
|
33
|
-
import "../../actions/selectionControls/
|
|
33
|
+
import "../../actions/selectionControls/switch.css.js";
|
|
34
34
|
import "../../../styles/animations.css.js";
|
|
35
35
|
import "../../actions/chips/styles.css.js";
|
|
36
36
|
import { headerCell, containerStyle, selectMonthRow, buttonRow, arrowButton, gridStyle, rowStyle, cellSkeletonStyle, firstDay, cellRecipe } from "./Calendar.css.js";
|
|
@@ -77,6 +77,7 @@ function useSelectInputLogic({ label, density: _density = "default", validity =
|
|
|
77
77
|
"aria-invalid": true,
|
|
78
78
|
"aria-errormessage": helperId
|
|
79
79
|
},
|
|
80
|
+
"aria-labelledby": labelId,
|
|
80
81
|
"aria-describedby": helperId,
|
|
81
82
|
id,
|
|
82
83
|
// Placeholder must be whitespace to ensure :placeholder-shown triggers when field is empty
|
|
@@ -99,27 +100,7 @@ function getInputFieldProps({ label, density, prefix, suffix, leadingIcon, trail
|
|
|
99
100
|
inputProps
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
|
-
function getSelectInputProps({ label, density, leadingIcon, helperText, ...selectProps }) {
|
|
103
|
-
return {
|
|
104
|
-
extraInformation: {
|
|
105
|
-
label,
|
|
106
|
-
density,
|
|
107
|
-
leadingIcon,
|
|
108
|
-
helperText
|
|
109
|
-
},
|
|
110
|
-
selectProps: {
|
|
111
|
-
onChange: selectProps.onChange,
|
|
112
|
-
validity: selectProps.validity,
|
|
113
|
-
id: selectProps.id,
|
|
114
|
-
disabled: selectProps.disabled,
|
|
115
|
-
value: selectProps.value,
|
|
116
|
-
ref: selectProps.ref,
|
|
117
|
-
key: selectProps.key
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
103
|
exports.getInputFieldProps = getInputFieldProps;
|
|
122
|
-
exports.getSelectInputProps = getSelectInputProps;
|
|
123
104
|
exports.isClickableIcon = isClickableIcon;
|
|
124
105
|
exports.useInputFieldLogic = useInputFieldLogic;
|
|
125
106
|
exports.useSelectInputLogic = useSelectInputLogic;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,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B,CAAC,CAAC,CAAC;;;;;;;;gCAvIK,IAAI;;;;;;;;;;EAyJlC"}
|
|
@@ -75,6 +75,7 @@ function useSelectInputLogic({ label, density: _density = "default", validity =
|
|
|
75
75
|
"aria-invalid": true,
|
|
76
76
|
"aria-errormessage": helperId
|
|
77
77
|
},
|
|
78
|
+
"aria-labelledby": labelId,
|
|
78
79
|
"aria-describedby": helperId,
|
|
79
80
|
id,
|
|
80
81
|
// Placeholder must be whitespace to ensure :placeholder-shown triggers when field is empty
|
|
@@ -97,28 +98,8 @@ function getInputFieldProps({ label, density, prefix, suffix, leadingIcon, trail
|
|
|
97
98
|
inputProps
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
|
-
function getSelectInputProps({ label, density, leadingIcon, helperText, ...selectProps }) {
|
|
101
|
-
return {
|
|
102
|
-
extraInformation: {
|
|
103
|
-
label,
|
|
104
|
-
density,
|
|
105
|
-
leadingIcon,
|
|
106
|
-
helperText
|
|
107
|
-
},
|
|
108
|
-
selectProps: {
|
|
109
|
-
onChange: selectProps.onChange,
|
|
110
|
-
validity: selectProps.validity,
|
|
111
|
-
id: selectProps.id,
|
|
112
|
-
disabled: selectProps.disabled,
|
|
113
|
-
value: selectProps.value,
|
|
114
|
-
ref: selectProps.ref,
|
|
115
|
-
key: selectProps.key
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
101
|
export {
|
|
120
102
|
getInputFieldProps,
|
|
121
|
-
getSelectInputProps,
|
|
122
103
|
isClickableIcon,
|
|
123
104
|
useInputFieldLogic,
|
|
124
105
|
useSelectInputLogic
|
|
@@ -26,7 +26,7 @@ require("../../actions/selectionControls/shared.css.cjs");
|
|
|
26
26
|
require("../../../utilities/layout/Column.cjs");
|
|
27
27
|
require("../../../utilities/layout/Row.cjs");
|
|
28
28
|
require("../../actions/selectionControls/radiobutton.css.cjs");
|
|
29
|
-
require("../../actions/selectionControls/
|
|
29
|
+
require("../../actions/selectionControls/switch.css.cjs");
|
|
30
30
|
require("../../../styles/animations.css.cjs");
|
|
31
31
|
require("../../actions/chips/styles.css.cjs");
|
|
32
32
|
const index = require("../../../translations/index.cjs");
|
|
@@ -24,7 +24,7 @@ import "../../actions/selectionControls/shared.css.js";
|
|
|
24
24
|
import "../../../utilities/layout/Column.js";
|
|
25
25
|
import "../../../utilities/layout/Row.js";
|
|
26
26
|
import "../../actions/selectionControls/radiobutton.css.js";
|
|
27
|
-
import "../../actions/selectionControls/
|
|
27
|
+
import "../../actions/selectionControls/switch.css.js";
|
|
28
28
|
import "../../../styles/animations.css.js";
|
|
29
29
|
import "../../actions/chips/styles.css.js";
|
|
30
30
|
import { useTranslation } from "../../../translations/index.js";
|
|
@@ -6,6 +6,8 @@ export interface LocalizationState {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Use this to set the localization context for the library.
|
|
9
|
+
*
|
|
10
|
+
* Documentation: [LocalizationProvider](https://gnist.moller.no/developers/components/latest/?path=/docs/configuration-localizationprovider--docs)
|
|
9
11
|
*/
|
|
10
12
|
export declare const LocalizationProvider: React.FC<React.PropsWithChildren<LocalizationState>>;
|
|
11
13
|
export declare function useLocalization(): LocalizationState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationProvider.d.ts","sourceRoot":"","sources":["../../src/translations/LocalizationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAC9B,4GAA4G;IAC5G,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAMD
|
|
1
|
+
{"version":3,"file":"LocalizationProvider.d.ts","sourceRoot":"","sources":["../../src/translations/LocalizationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAC9B,4GAA4G;IAC5G,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAMD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CACvC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAK7C,CAAC;AAEF,wBAAgB,eAAe,sBAE9B;AAED,wBAAgB,WAAW,aAE1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnist/design-system",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"build-storybook": "cd docs && pnpm run build"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@base-ui-components/react": "1.0.0-beta.2",
|
|
50
51
|
"@formkit/auto-animate": "^0.8.2",
|
|
51
|
-
"@gnist/component-utils": "3.0.
|
|
52
|
-
"@gnist/themes": "^3.
|
|
53
|
-
"@mui/base": "^5.0.0-beta.70",
|
|
52
|
+
"@gnist/component-utils": "3.0.10",
|
|
53
|
+
"@gnist/themes": "^3.17.0",
|
|
54
54
|
"@vanilla-extract/css": "^1.17.4",
|
|
55
55
|
"@vanilla-extract/css-utils": "^0.1.6",
|
|
56
56
|
"@vanilla-extract/dynamic": "^2.1.5",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"tslib": "^2.8.1",
|
|
91
91
|
"tsx": "^4.20.4",
|
|
92
92
|
"typescript-transform-paths": "^3.5.5",
|
|
93
|
-
"vite": "7.1.
|
|
93
|
+
"vite": "7.1.5",
|
|
94
94
|
"vite-plugin-svgr": "^4.3.0",
|
|
95
95
|
"vite-tsconfig-paths": "^5.1.4"
|
|
96
96
|
},
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"optional": true
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "879ab31f050b17a16676d47b551fc712b5d6ed11"
|
|
106
106
|
}
|