@oslokommune/punkt-react 20.0.3 → 20.0.5
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 +5 -0
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/defineProperty.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/toPrimitive.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/toPropertyKey.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/typeof.js +1 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/components/accordion/Accordion.js +1 -2
- package/dist/components/accordion/AccordionItem.js +9 -10
- package/dist/components/alert/Alert.js +7 -8
- package/dist/components/backlink/BackLink.js +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.js +1 -2
- package/dist/components/button/Button.js +1 -2
- package/dist/components/calendar/Calendar.js +1 -2
- package/dist/components/calendar/CalendarGrid.js +1 -2
- package/dist/components/calendar/CalendarNav.js +5 -6
- package/dist/components/calendar/calendar-utils.js +1 -2
- package/dist/components/calendar/useCalendarState.js +90 -91
- package/dist/components/card/Card.js +14 -15
- package/dist/components/checkbox/Checkbox.js +3 -8
- package/dist/components/checkboxgroup/CheckboxGroup.js +10 -11
- package/dist/components/checkboxgroup/CheckboxGroupContext.js +1 -2
- package/dist/components/combobox/Combobox.js +5 -6
- package/dist/components/combobox/ComboboxInput.js +6 -7
- package/dist/components/combobox/ComboboxTags.js +11 -12
- package/dist/components/combobox/Listbox.js +25 -26
- package/dist/components/combobox/useComboboxState.js +38 -39
- package/dist/components/consent/Consent.js +6 -7
- package/dist/components/datepicker/DateTags.js +14 -15
- package/dist/components/datepicker/Datepicker.js +1 -2
- package/dist/components/datepicker/DatepickerInputs.js +1 -2
- package/dist/components/datepicker/DatepickerPopup.js +5 -6
- package/dist/components/datepicker/useDatepickerState.js +20 -21
- package/dist/components/fileupload/DropZone.js +6 -7
- package/dist/components/fileupload/FileUpload.js +36 -37
- package/dist/components/fileupload/FileUploadContext.js +1 -2
- package/dist/components/fileupload/QueueDisplay.js +12 -13
- package/dist/components/fileupload/QueueItemContent.js +14 -15
- package/dist/components/fileupload/Subcomponents.js +70 -71
- package/dist/components/fileupload/Truncate.js +1 -2
- package/dist/components/fileupload/extensions/Comments.js +21 -22
- package/dist/components/fileupload/extensions/Remove.js +1 -2
- package/dist/components/fileupload/extensions/Rename.js +8 -9
- package/dist/components/fileupload/hooks/useFileAttributes.js +1 -2
- package/dist/components/fileupload/hooks/useImageObjectUrl.js +1 -2
- package/dist/components/fileupload/hooks/useImagePreview.js +1 -2
- package/dist/components/fileupload/hooks/useOperationState.js +1 -2
- package/dist/components/fileupload/hooks/useRequiredFormValidation.js +1 -2
- package/dist/components/fileupload/types.js +4 -5
- package/dist/components/footer/Footer.js +23 -24
- package/dist/components/footer/FooterGlobal.js +24 -25
- package/dist/components/footerSimple/FooterSimple.js +5 -6
- package/dist/components/header/Header.js +1 -2
- package/dist/components/header/HeaderGlobal.js +127 -128
- package/dist/components/header/HeaderService.js +84 -85
- package/dist/components/header-menu/HeaderMenu.js +34 -35
- package/dist/components/headerUserMenu/UserMenu.js +14 -15
- package/dist/components/heading/Heading.js +1 -2
- package/dist/components/helptext/Helptext.js +5 -6
- package/dist/components/icon/Icon.js +2 -3
- package/dist/components/input/Input.js +1 -2
- package/dist/components/inputwrapper/InputWrapper.js +12 -17
- package/dist/components/link/Link.js +1 -2
- package/dist/components/linkcard/LinkCard.js +2 -3
- package/dist/components/loader/Loader.js +2 -3
- package/dist/components/messagebox/Messagebox.js +6 -7
- package/dist/components/modal/Modal.js +13 -14
- package/dist/components/progressbar/Progressbar.js +5 -6
- package/dist/components/radio/RadioButton.js +3 -8
- package/dist/components/radiogroup/RadioGroup.js +1 -2
- package/dist/components/radiogroup/RadioGroupContext.js +1 -2
- package/dist/components/searchinput/SearchInput.js +11 -12
- package/dist/components/select/Select.js +6 -7
- package/dist/components/stepper/Step.js +1 -2
- package/dist/components/stepper/Stepper.js +1 -2
- package/dist/components/strings/PktStringsProvider.js +1 -2
- package/dist/components/table/Table.js +2 -3
- package/dist/components/table/TableBody.js +1 -2
- package/dist/components/table/TableDataCell.js +1 -2
- package/dist/components/table/TableHeader.js +1 -2
- package/dist/components/table/TableHeaderCell.js +1 -2
- package/dist/components/table/TableRow.js +1 -2
- package/dist/components/tabs/TabItem.js +1 -2
- package/dist/components/tabs/Tabs.js +5 -6
- package/dist/components/tag/Tag.js +6 -7
- package/dist/components/textarea/Textarea.js +5 -6
- package/dist/components/textinput/Textinput.js +6 -7
- package/dist/components/timepicker/Timepicker.js +6 -7
- package/dist/components/timepicker/useTimepickerState.js +27 -28
- package/dist/hooks/useElementWidth.js +1 -2
- package/dist/hooks/useFocusModality.js +1 -2
- package/dist/hooks/useGeneratedId.js +1 -2
- package/dist/hooks/useHeaderChrome.js +1 -2
- package/dist/hooks/useOptionGroupField.js +1 -2
- package/dist/hooks/useOwnerForm.js +1 -2
- package/dist/hooks/usePktStrings.js +1 -2
- package/dist/hooks/useScrollLock.js +1 -2
- package/dist/node_modules/@date-fns/tz/date/index.js +1 -2
- package/dist/node_modules/@date-fns/tz/date/mini.js +1 -2
- package/dist/node_modules/@date-fns/tz/index.js +3 -3
- package/dist/node_modules/@date-fns/tz/tzName/index.js +1 -2
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +1 -2
- package/dist/node_modules/classnames/index.js +1 -2
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +1 -2
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +1 -2
- package/dist/node_modules/date-fns/_lib/format/formatters.js +18 -19
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +1 -2
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +1 -2
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +1 -2
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +1 -2
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +1 -2
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +1 -2
- package/dist/node_modules/date-fns/addDays.js +1 -2
- package/dist/node_modules/date-fns/constants.js +1 -2
- package/dist/node_modules/date-fns/constructFrom.js +1 -2
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +6 -7
- package/dist/node_modules/date-fns/eachDayOfInterval.js +5 -6
- package/dist/node_modules/date-fns/endOfDay.js +1 -2
- package/dist/node_modules/date-fns/format.js +15 -16
- package/dist/node_modules/date-fns/getDayOfYear.js +6 -7
- package/dist/node_modules/date-fns/getISODay.js +1 -2
- package/dist/node_modules/date-fns/getISOWeek.js +5 -6
- package/dist/node_modules/date-fns/getISOWeekYear.js +6 -7
- package/dist/node_modules/date-fns/getWeek.js +5 -6
- package/dist/node_modules/date-fns/getWeekYear.js +8 -9
- package/dist/node_modules/date-fns/isDate.js +1 -2
- package/dist/node_modules/date-fns/isValid.js +4 -5
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +1 -2
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +1 -2
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +1 -2
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +1 -2
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +1 -2
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +1 -2
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -1
- package/dist/node_modules/date-fns/locale/en-US.js +1 -2
- package/dist/node_modules/date-fns/startOfDay.js +1 -2
- package/dist/node_modules/date-fns/startOfISOWeek.js +1 -2
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +5 -6
- package/dist/node_modules/date-fns/startOfWeek.js +4 -5
- package/dist/node_modules/date-fns/startOfWeekYear.js +7 -8
- package/dist/node_modules/date-fns/startOfYear.js +1 -2
- package/dist/node_modules/date-fns/toDate.js +1 -2
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-strings/consent.js +1 -2
- package/dist/shared-strings/format.js +1 -2
- package/dist/shared-strings/nb.js +1 -2
- package/dist/shared-strings/resolve.js +1 -2
- package/dist/shared-strings/store.js +1 -2
- package/dist/shared-types/accordion.js +1 -2
- package/dist/shared-types/calendar.js +1 -2
- package/dist/shared-types/card.js +1 -2
- package/dist/shared-types/checkbox.js +1 -2
- package/dist/shared-types/combobox.js +1 -2
- package/dist/shared-types/consent.js +1 -2
- package/dist/shared-types/footer.js +1 -2
- package/dist/shared-types/header-footer.js +1 -2
- package/dist/shared-types/icon.js +1 -2
- package/dist/shared-types/input-wrapper.js +1 -2
- package/dist/shared-types/linkcard.js +1 -2
- package/dist/shared-types/loader.js +1 -2
- package/dist/shared-types/messagebox.js +1 -2
- package/dist/shared-types/option-group.js +1 -2
- package/dist/shared-types/progressbar.js +1 -2
- package/dist/shared-types/radiobutton.js +1 -2
- package/dist/shared-types/select.js +1 -2
- package/dist/shared-types/size.js +1 -2
- package/dist/shared-types/table.js +1 -2
- package/dist/shared-types/tag.js +1 -2
- package/dist/shared-types/textarea.js +1 -2
- package/dist/shared-types/textinput.js +1 -2
- package/dist/shared-utils/calendar/calendar-grid.js +4 -5
- package/dist/shared-utils/calendar/date-validation.js +1 -2
- package/dist/shared-utils/calendar/keyboard-navigation.js +1 -2
- package/dist/shared-utils/calendar/selection-manager.js +31 -32
- package/dist/shared-utils/combobox/input-utils.js +1 -2
- package/dist/shared-utils/combobox/keyboard-navigation.js +1 -2
- package/dist/shared-utils/combobox/option-utils.js +1 -2
- package/dist/shared-utils/date-utils.js +10 -11
- package/dist/shared-utils/datepicker-utils.js +4 -5
- package/dist/shared-utils/device-utils.js +1 -2
- package/dist/shared-utils/fileupload/announcements.js +1 -2
- package/dist/shared-utils/fileupload/filename.js +1 -2
- package/dist/shared-utils/fileupload/formats.js +1 -2
- package/dist/shared-utils/fileupload/navigation.js +1 -2
- package/dist/shared-utils/fileupload/size.js +1 -2
- package/dist/shared-utils/fileupload/transfers.js +1 -2
- package/dist/shared-utils/fileupload/truncate.js +1 -2
- package/dist/shared-utils/fileupload/validation.js +8 -9
- package/dist/shared-utils/focus-trap/index.js +13 -31
- package/dist/shared-utils/forms/described-by.js +1 -2
- package/dist/shared-utils/header-footer/external-domain.js +1 -2
- package/dist/shared-utils/header-footer/fetch-header-footer-data.js +1 -2
- package/dist/shared-utils/header-footer/icon-map.js +1 -2
- package/dist/shared-utils/header-footer/select-megamenu.js +1 -2
- package/dist/shared-utils/scroll-lock/index.js +1 -2
- package/dist/shared-utils/timepicker/options.js +1 -2
- package/dist/shared-utils/timepicker/stepper.js +1 -2
- package/dist/shared-utils/timepicker/time-utils.js +1 -2
- package/dist/shared-utils/value-utils.js +1 -2
- package/dist/utils/nativeInputValue.js +1 -2
- package/dist/utils/stableKeys.js +1 -2
- package/dist/utils/stringutils.js +1 -2
- package/package.json +20 -21
- package/src/components/accordion/Accordion.test.tsx +2 -4
- package/src/components/tag/Tag.tsx +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { CARD_DEFAULTS as t, CARD_LIGHT_ONLY_SKINS as n } from "../../shared-types/card.js";
|
|
4
|
-
import "../../shared-types/index.js";
|
|
5
4
|
import { require_classnames as r } from "../../node_modules/classnames/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { plural as i } from "../../shared-strings/format.js";
|
|
6
|
+
import "../../shared-types/index.js";
|
|
7
|
+
import { PktHeading as a } from "../heading/Heading.js";
|
|
8
|
+
import { PktIcon as o } from "../icon/Icon.js";
|
|
9
|
+
import { PktTag as s } from "../tag/Tag.js";
|
|
10
|
+
import { usePktStrings as c } from "../../hooks/usePktStrings.js";
|
|
11
|
+
import { withStableKeys as l } from "../../utils/stableKeys.js";
|
|
12
12
|
import { forwardRef as u } from "react";
|
|
13
13
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
14
|
-
|
|
14
|
+
// src/components/card/Card.tsx
|
|
15
15
|
var p = /* @__PURE__ */ e(r(), 1), m = u(({ children: e, className: r, ariaLabel: u, metaLead: m, metaTrail: h, layout: g = t.layout, heading: _ = "", headingLevel: v = t.headingLevel, image: y, imageAspect: b, clickCardLink: x, openLinkInNewTab: S = t.openLinkInNewTab, skin: C = t.skin, subheading: w = "", tagPosition: T = t.tagPosition, zoom: E = t.zoom, tags: D = [], strings: O, ...k }, A) => {
|
|
16
|
-
let j =
|
|
16
|
+
let j = c(["card"], O), M = (0, p.default)({
|
|
17
17
|
"pkt-card": !0,
|
|
18
18
|
[`pkt-card--${C}`]: C,
|
|
19
19
|
[`pkt-card--${g}`]: g,
|
|
@@ -28,8 +28,8 @@ var p = /* @__PURE__ */ e(r(), 1), m = u(({ children: e, className: r, ariaLabel
|
|
|
28
28
|
}) : null, I = () => D.length === 0 ? null : /* @__PURE__ */ d("div", {
|
|
29
29
|
className: (0, p.default)("pkt-card__tags", `pkt-card__tags-${T}`),
|
|
30
30
|
role: "list",
|
|
31
|
-
"aria-label":
|
|
32
|
-
children:
|
|
31
|
+
"aria-label": i(D.length, j.card.tagsLabelOne, j.card.tagsLabelOther),
|
|
32
|
+
children: l(D, (e) => e.text).map(({ item: e, key: t }) => /* @__PURE__ */ d(s, {
|
|
33
33
|
role: "listitem",
|
|
34
34
|
textStyle: "normal-text",
|
|
35
35
|
size: "medium",
|
|
@@ -37,13 +37,13 @@ var p = /* @__PURE__ */ e(r(), 1), m = u(({ children: e, className: r, ariaLabel
|
|
|
37
37
|
iconName: e.iconName,
|
|
38
38
|
children: /* @__PURE__ */ d("span", { children: e.text })
|
|
39
39
|
}, t))
|
|
40
|
-
}), L = () => !_ || x ? null : /* @__PURE__ */ d(
|
|
40
|
+
}), L = () => !_ || x ? null : /* @__PURE__ */ d(a, {
|
|
41
41
|
className: "pkt-card__heading",
|
|
42
42
|
level: v,
|
|
43
43
|
size: "medium",
|
|
44
44
|
weight: "medium",
|
|
45
45
|
children: _
|
|
46
|
-
}), R = () => x ? /* @__PURE__ */ f(
|
|
46
|
+
}), R = () => x ? /* @__PURE__ */ f(a, {
|
|
47
47
|
className: "pkt-card__link-heading pkt-card__heading",
|
|
48
48
|
level: v,
|
|
49
49
|
size: "medium",
|
|
@@ -54,7 +54,7 @@ var p = /* @__PURE__ */ e(r(), 1), m = u(({ children: e, className: r, ariaLabel
|
|
|
54
54
|
target: S ? "_blank" : "_self",
|
|
55
55
|
rel: S ? "noopener noreferrer" : void 0,
|
|
56
56
|
children: _
|
|
57
|
-
}), /* @__PURE__ */ d(
|
|
57
|
+
}), /* @__PURE__ */ d(o, {
|
|
58
58
|
className: "pkt-card__link-icon",
|
|
59
59
|
name: "arrow-link"
|
|
60
60
|
})]
|
|
@@ -103,5 +103,4 @@ var p = /* @__PURE__ */ e(r(), 1), m = u(({ children: e, className: r, ariaLabel
|
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
m.displayName = "PktCard";
|
|
106
|
-
//#endregion
|
|
107
106
|
export { m as PktCard };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { CHECKBOX_DEFAULTS as e } from "../../shared-types/checkbox.js";
|
|
3
|
-
import "../../shared-types/index.js";
|
|
4
3
|
import { usePktStrings as t } from "../../hooks/usePktStrings.js";
|
|
5
4
|
import { useGeneratedId as n } from "../../hooks/useGeneratedId.js";
|
|
5
|
+
import "../../shared-types/index.js";
|
|
6
6
|
import { useCheckboxGroupContext as ee } from "../checkboxgroup/CheckboxGroupContext.js";
|
|
7
7
|
import { forwardRef as r, useEffect as i, useRef as a } from "react";
|
|
8
8
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/checkbox/Checkbox.tsx
|
|
10
10
|
var l = r(({ id: r, hasTile: l = e.hasTile, disabled: u = e.disabled, label: d, checkHelptext: f, hasError: p = e.hasError, className: m, isSwitch: h = e.isSwitch, hideLabel: g = e.hideLabel, labelPosition: _ = e.labelPosition, inputSize: v, defaultChecked: te, checked: y, indeterminate: b, optionalTag: x, optionalText: S, requiredTag: C, requiredText: w, strings: T, tagText: E, name: D, value: O, onChange: k, "aria-describedby": A, ...j }, M) => {
|
|
11
11
|
let N = t(["forms"], T), P = n(r), F = a(null), I = ee(), L = O ?? "on", R = I?.value, z = R !== void 0, B = z ? R.includes(L) : y, V = te ?? (I?.defaultValue === void 0 ? void 0 : I.defaultValue.includes(L)), H = l || !!I?.hasTile, U = p || !!I?.hasError, W = u || !!I?.disabled;
|
|
12
12
|
i(() => {
|
|
@@ -38,11 +38,7 @@ var l = r(({ id: r, hasTile: l = e.hasTile, disabled: u = e.disabled, label: d,
|
|
|
38
38
|
"pkt-input-check__input",
|
|
39
39
|
H ? "pkt-input-check__input--tile" : "",
|
|
40
40
|
W && H ? "pkt-input-check__input--tile-disabled" : ""
|
|
41
|
-
].filter(Boolean).join(" "), Y = [
|
|
42
|
-
"pkt-tag",
|
|
43
|
-
"pkt-tag--small",
|
|
44
|
-
"pkt-tag--thin-text"
|
|
45
|
-
].join(" "), X = () => /* @__PURE__ */ c(o, { children: [
|
|
41
|
+
].filter(Boolean).join(" "), Y = "pkt-tag pkt-tag--small pkt-tag--thin-text", X = () => /* @__PURE__ */ c(o, { children: [
|
|
46
42
|
E && /* @__PURE__ */ s("span", {
|
|
47
43
|
className: Y + " pkt-tag--gray",
|
|
48
44
|
children: E
|
|
@@ -98,5 +94,4 @@ var l = r(({ id: r, hasTile: l = e.hasTile, disabled: u = e.disabled, label: d,
|
|
|
98
94
|
});
|
|
99
95
|
});
|
|
100
96
|
l.displayName = "PktCheckbox";
|
|
101
|
-
//#endregion
|
|
102
97
|
export { l as PktCheckbox };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { OPTION_GROUP_DEFAULTS as e } from "../../shared-types/option-group.js";
|
|
3
3
|
import "../../shared-types/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { useGeneratedId as t } from "../../hooks/useGeneratedId.js";
|
|
5
|
+
import { isActiveOption as n, useOptionGroupField as r } from "../../hooks/useOptionGroupField.js";
|
|
6
|
+
import { usePktStrings as i } from "../../hooks/usePktStrings.js";
|
|
7
|
+
import { PktInputWrapper as a } from "../inputwrapper/InputWrapper.js";
|
|
8
|
+
import { CheckboxGroupContext as o } from "./CheckboxGroupContext.js";
|
|
9
9
|
import { forwardRef as s, useEffect as c, useMemo as l, useRef as u } from "react";
|
|
10
10
|
import { jsx as d } from "react/jsx-runtime";
|
|
11
|
-
|
|
11
|
+
// src/components/checkboxgroup/CheckboxGroup.tsx
|
|
12
12
|
var f = s(({ id: s, name: f, label: p, helptext: m, helptextDropdown: h, helptextDropdownButton: g, value: _, defaultValue: v, layout: y = e.layout, inputSize: b = e.inputSize, hasTile: x = e.hasTile, required: S = e.required, disabled: C = e.disabled, hasError: w = e.hasError, errorMessage: T, useWrapper: E = e.useWrapper, optionalTag: D = e.optionalTag, optionalText: O, requiredTag: k = e.requiredTag, requiredText: A, tagText: j, strings: M, className: N, children: P, onChange: F, onValueChange: I, onFocus: L, onBlur: R }, z) => {
|
|
13
|
-
let B =
|
|
13
|
+
let B = t(s), V = f || B, H = i(["validation"], M).validation.checkboxGroupValueMissing, U = u(!1), W = r({
|
|
14
14
|
type: "checkbox",
|
|
15
15
|
name: V,
|
|
16
16
|
forwardedRef: z,
|
|
@@ -22,7 +22,7 @@ var f = s(({ id: s, name: f, label: p, helptext: m, helptextDropdown: h, helptex
|
|
|
22
22
|
}), G = () => {
|
|
23
23
|
if (!S && !U.current) return;
|
|
24
24
|
U.current = S;
|
|
25
|
-
let e = W.options(), t = S && !e.some((e) => e.checked &&
|
|
25
|
+
let e = W.options(), t = S && !e.some((e) => e.checked && n(e));
|
|
26
26
|
e.forEach((e) => e.setCustomValidity(t ? H : ""));
|
|
27
27
|
};
|
|
28
28
|
c(() => {
|
|
@@ -54,9 +54,9 @@ var f = s(({ id: s, name: f, label: p, helptext: m, helptextDropdown: h, helptex
|
|
|
54
54
|
v,
|
|
55
55
|
W
|
|
56
56
|
]);
|
|
57
|
-
return /* @__PURE__ */ d(
|
|
57
|
+
return /* @__PURE__ */ d(o.Provider, {
|
|
58
58
|
value: K,
|
|
59
|
-
children: /* @__PURE__ */ d(
|
|
59
|
+
children: /* @__PURE__ */ d(a, {
|
|
60
60
|
ref: W.mergedRef,
|
|
61
61
|
onFocus: W.onRootFocus,
|
|
62
62
|
onBlur: W.onRootBlur,
|
|
@@ -85,5 +85,4 @@ var f = s(({ id: s, name: f, label: p, helptext: m, helptextDropdown: h, helptex
|
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
f.displayName = "PktCheckboxGroup";
|
|
88
|
-
//#endregion
|
|
89
88
|
export { f as PktCheckboxGroup };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createContext as e, useContext as t } from "react";
|
|
2
|
-
|
|
2
|
+
// src/components/checkboxgroup/CheckboxGroupContext.ts
|
|
3
3
|
var n = e(null), r = () => t(n);
|
|
4
|
-
//#endregion
|
|
5
4
|
export { n as CheckboxGroupContext, r as useCheckboxGroupContext };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { PktInputWrapper as e } from "../inputwrapper/InputWrapper.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ComboboxInput as t } from "./ComboboxInput.js";
|
|
4
|
+
import { ComboboxTags as n } from "./ComboboxTags.js";
|
|
5
5
|
import { Listbox as r } from "./Listbox.js";
|
|
6
6
|
import { useComboboxState as i } from "./useComboboxState.js";
|
|
7
7
|
import { forwardRef as a } from "react";
|
|
8
8
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/combobox/Combobox.tsx
|
|
10
10
|
var c = a((a, c) => {
|
|
11
11
|
let l = i(a, c), u = [
|
|
12
12
|
"pkt-combobox-component",
|
|
@@ -43,8 +43,8 @@ var c = a((a, c) => {
|
|
|
43
43
|
children: [/* @__PURE__ */ s("div", {
|
|
44
44
|
className: "pkt-combobox",
|
|
45
45
|
onBlur: l.handleFocusOut,
|
|
46
|
-
children: [/* @__PURE__ */ o(
|
|
47
|
-
}), l.tagPlacement === "outside" && l.multiple && /* @__PURE__ */ o(
|
|
46
|
+
children: [/* @__PURE__ */ o(t, { state: l }), /* @__PURE__ */ o(r, { state: l })]
|
|
47
|
+
}), l.tagPlacement === "outside" && l.multiple && /* @__PURE__ */ o(n, {
|
|
48
48
|
state: l,
|
|
49
49
|
outside: !0
|
|
50
50
|
})]
|
|
@@ -61,5 +61,4 @@ var c = a((a, c) => {
|
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
63
|
c.displayName = "PktCombobox";
|
|
64
|
-
//#endregion
|
|
65
64
|
export { c as PktCombobox };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { describedByIds as
|
|
4
|
-
import {
|
|
2
|
+
import { findOptionByValue as e, findOptionIndex as t } from "../../shared-utils/combobox/option-utils.js";
|
|
3
|
+
import { describedByIds as n } from "../../shared-utils/forms/described-by.js";
|
|
4
|
+
import { PktIcon as r } from "../icon/Icon.js";
|
|
5
5
|
import { ComboboxTags as i, SingleValueDisplay as a } from "./ComboboxTags.js";
|
|
6
6
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/components/combobox/ComboboxInput.tsx
|
|
8
8
|
var c = ({ state: c }) => {
|
|
9
9
|
let { id: l, inputId: u, listboxId: d, values: f, options: p, isOpen: m, multiple: h, typeahead: g, allowUserInput: _, tagPlacement: v, placeholder: y, disabled: b, fullwidth: x, hasError: S, label: C, inputFocus: w, skipInputTab: T, restoreInputTab: E, inputRef: D, triggerRef: O, handleInputChange: k, handleInputKeydown: A, handleInputFocus: j, handleInputBlur: M, handleInputClick: N, handlePlaceholderClick: P, handleSelectOnlyKeydown: F, name: I, inputSize: L } = c, R = [
|
|
10
10
|
"pkt-combobox__input",
|
|
@@ -13,7 +13,7 @@ var c = ({ state: c }) => {
|
|
|
13
13
|
m && "pkt-combobox__input--open",
|
|
14
14
|
S && "pkt-combobox__input--error",
|
|
15
15
|
b && "pkt-combobox__input--disabled"
|
|
16
|
-
].filter(Boolean).join(" "), z = ["pkt-combobox__arrow-icon", m && "pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "), B = g || _, V = !B && y && (!f.length || h && v === "outside") && !w, H = v !== "outside", U = m && f[0] &&
|
|
16
|
+
].filter(Boolean).join(" "), z = ["pkt-combobox__arrow-icon", m && "pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "), B = g || _, V = !B && y && (!f.length || h && v === "outside") && !w, H = v !== "outside", U = m && f[0] && e(p, f[0]) ? `${d}-${t(p, f[0])}` : void 0, W = h && f.length > 0 ? `${f.length} valgt` : void 0, G = n({
|
|
17
17
|
id: B ? u : `${l}-combobox`,
|
|
18
18
|
hasHelptext: !!c.helptext,
|
|
19
19
|
ariaDescribedby: c.ariaDescribedby
|
|
@@ -75,7 +75,7 @@ var c = ({ state: c }) => {
|
|
|
75
75
|
name: `${I || l}-input`,
|
|
76
76
|
value: f.join(",")
|
|
77
77
|
}),
|
|
78
|
-
/* @__PURE__ */ o(
|
|
78
|
+
/* @__PURE__ */ o(r, {
|
|
79
79
|
className: z,
|
|
80
80
|
name: "chevron-thin-down",
|
|
81
81
|
"aria-hidden": "true"
|
|
@@ -83,5 +83,4 @@ var c = ({ state: c }) => {
|
|
|
83
83
|
]
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
//#endregion
|
|
87
86
|
export { c as ComboboxInput };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { findOptionByValue as e, getOptionDisplayText as t } from "../../shared-utils/combobox/option-utils.js";
|
|
3
|
+
import { PktTag as n } from "../tag/Tag.js";
|
|
4
4
|
import { useEffect as r, useRef as i } from "react";
|
|
5
5
|
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/combobox/ComboboxTags.tsx
|
|
7
7
|
var o = ({ state: o, outside: s = !1 }) => {
|
|
8
8
|
let { values: c, options: l, disabled: u, displayValueAs: d, handleTagRemove: f, handleTagKeydown: p, focusedTagIndex: m } = o, h = i([]);
|
|
9
9
|
if (r(() => {
|
|
@@ -14,10 +14,10 @@ var o = ({ state: o, outside: s = !1 }) => {
|
|
|
14
14
|
c.length
|
|
15
15
|
]), c.length === 0) return null;
|
|
16
16
|
let g = c.map((r, i) => {
|
|
17
|
-
let o =
|
|
17
|
+
let o = e(l, r), c = o?.tagSkinColor, g = o ? t(o, d) : r;
|
|
18
18
|
return u ? /* @__PURE__ */ a("li", {
|
|
19
19
|
role: "listitem",
|
|
20
|
-
children: /* @__PURE__ */ a(
|
|
20
|
+
children: /* @__PURE__ */ a(n, {
|
|
21
21
|
skin: c || "blue",
|
|
22
22
|
children: /* @__PURE__ */ a("span", {
|
|
23
23
|
className: "pkt-combobox__value",
|
|
@@ -26,7 +26,7 @@ var o = ({ state: o, outside: s = !1 }) => {
|
|
|
26
26
|
})
|
|
27
27
|
}, r) : s ? /* @__PURE__ */ a("li", {
|
|
28
28
|
role: "listitem",
|
|
29
|
-
children: /* @__PURE__ */ a(
|
|
29
|
+
children: /* @__PURE__ */ a(n, {
|
|
30
30
|
skin: c || "blue",
|
|
31
31
|
closeTag: !0,
|
|
32
32
|
onClose: () => f(r),
|
|
@@ -39,7 +39,7 @@ var o = ({ state: o, outside: s = !1 }) => {
|
|
|
39
39
|
role: "listitem",
|
|
40
40
|
onClick: (e) => e.stopPropagation(),
|
|
41
41
|
onMouseDown: (e) => e.preventDefault(),
|
|
42
|
-
children: /* @__PURE__ */ a(
|
|
42
|
+
children: /* @__PURE__ */ a(n, {
|
|
43
43
|
ref: (e) => {
|
|
44
44
|
h.current[i] = e;
|
|
45
45
|
},
|
|
@@ -67,16 +67,15 @@ var o = ({ state: o, outside: s = !1 }) => {
|
|
|
67
67
|
className: "pkt-combobox__tag-list",
|
|
68
68
|
children: g
|
|
69
69
|
});
|
|
70
|
-
}, s = ({ state:
|
|
71
|
-
let { values: r, options: i, editingSingleValue: o, displayValueAs: s } =
|
|
70
|
+
}, s = ({ state: n }) => {
|
|
71
|
+
let { values: r, options: i, editingSingleValue: o, displayValueAs: s } = n;
|
|
72
72
|
if (o || r.length === 0) return null;
|
|
73
|
-
let c =
|
|
73
|
+
let c = e(i, r[0]);
|
|
74
74
|
if (!c) return null;
|
|
75
|
-
let l =
|
|
75
|
+
let l = t(c, s);
|
|
76
76
|
return /* @__PURE__ */ a("span", {
|
|
77
77
|
className: "pkt-combobox__value",
|
|
78
78
|
children: l
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
|
-
//#endregion
|
|
82
81
|
export { o as ComboboxTags, s as SingleValueDisplay };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { formatString as e } from "../../shared-strings/format.js";
|
|
3
|
+
import { PktIcon as t } from "../icon/Icon.js";
|
|
4
4
|
import { usePktStrings as n } from "../../hooks/usePktStrings.js";
|
|
5
5
|
import { withStableKeys as r } from "../../utils/stableKeys.js";
|
|
6
6
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/components/combobox/Listbox.tsx
|
|
8
8
|
var s = ({ state: s }) => {
|
|
9
9
|
let c = n(["listbox"], s.strings), { listboxId: l, label: u, isOpen: d, options: f, filteredOptions: p, multiple: m, disabled: h, maxIsReached: g, maxlength: _, includeSearch: v, allowUserInput: y, addValueText: b, userInfoMessage: x, searchPlaceholder: S, searchValue: C, handleOptionClick: w, handleOptionKeydown: T, handleSearchInput: E, handleSearchKeydown: D, handleNewOptionClick: O, handleNewOptionKeydown: k, listboxRef: A } = s, j = p.filter((e) => e.selected).length, M = m && j > 0 && _ != null && _ > 0, N = y && b && !g, P = !!x, F = [
|
|
10
10
|
"pkt-listbox",
|
|
@@ -25,7 +25,7 @@ var s = ({ state: s }) => {
|
|
|
25
25
|
className: "pkt-listbox__search",
|
|
26
26
|
children: [/* @__PURE__ */ a("span", {
|
|
27
27
|
className: "pkt-listbox__search-icon",
|
|
28
|
-
children: /* @__PURE__ */ a(
|
|
28
|
+
children: /* @__PURE__ */ a(t, { name: "magnifying-glass-small" })
|
|
29
29
|
}), /* @__PURE__ */ a("input", {
|
|
30
30
|
className: "pkt-txt-16-light",
|
|
31
31
|
type: "text",
|
|
@@ -43,14 +43,14 @@ var s = ({ state: s }) => {
|
|
|
43
43
|
}),
|
|
44
44
|
M && /* @__PURE__ */ a("div", {
|
|
45
45
|
className: "pkt-listbox__banner pkt-listbox__banner--maximum-reached",
|
|
46
|
-
children:
|
|
46
|
+
children: e(c.listbox.maxReached, {
|
|
47
47
|
selected: j,
|
|
48
48
|
max: _
|
|
49
49
|
})
|
|
50
50
|
}),
|
|
51
51
|
P && /* @__PURE__ */ o("div", {
|
|
52
52
|
className: "pkt-listbox__banner pkt-listbox__banner--user-message",
|
|
53
|
-
children: [/* @__PURE__ */ a(
|
|
53
|
+
children: [/* @__PURE__ */ a(t, {
|
|
54
54
|
className: "pkt-listbox__banner-icon",
|
|
55
55
|
name: "exclamation-mark-circle"
|
|
56
56
|
}), x]
|
|
@@ -63,14 +63,14 @@ var s = ({ state: s }) => {
|
|
|
63
63
|
tabIndex: 0,
|
|
64
64
|
onClick: () => O(b),
|
|
65
65
|
onKeyDown: k,
|
|
66
|
-
children: [/* @__PURE__ */ a(
|
|
66
|
+
children: [/* @__PURE__ */ a(t, {
|
|
67
67
|
className: "pkt-listbox__banner-icon",
|
|
68
68
|
name: "plus-sign"
|
|
69
|
-
}),
|
|
69
|
+
}), e(c.listbox.addValue, { value: b })]
|
|
70
70
|
}),
|
|
71
71
|
f.length === 0 && p.length === 0 && !P && /* @__PURE__ */ o("div", {
|
|
72
72
|
className: "pkt-listbox__banner pkt-listbox__banner--empty",
|
|
73
|
-
children: [/* @__PURE__ */ a(
|
|
73
|
+
children: [/* @__PURE__ */ a(t, {
|
|
74
74
|
className: "pkt-listbox__banner-icon",
|
|
75
75
|
name: "exclamation-mark-circle"
|
|
76
76
|
}), c.listbox.empty]
|
|
@@ -79,21 +79,21 @@ var s = ({ state: s }) => {
|
|
|
79
79
|
}), /* @__PURE__ */ a("ul", {
|
|
80
80
|
className: "pkt-listbox__options",
|
|
81
81
|
role: "presentation",
|
|
82
|
-
children: r(p, (e) => e.value).map(({ item:
|
|
82
|
+
children: r(p, (e) => e.value).map(({ item: e, key: n }, r) => {
|
|
83
83
|
let i = [
|
|
84
84
|
"pkt-listbox__option",
|
|
85
|
-
!m &&
|
|
85
|
+
!m && e.selected && "pkt-listbox__option--selected",
|
|
86
86
|
m && "pkt-listbox__option--checkBox"
|
|
87
|
-
].filter(Boolean).join(" "), s = h ||
|
|
87
|
+
].filter(Boolean).join(" "), s = h || e.disabled || g && !e.selected;
|
|
88
88
|
return /* @__PURE__ */ o("li", {
|
|
89
89
|
className: i,
|
|
90
|
-
onClick: () => w(
|
|
91
|
-
onKeyDown: (
|
|
92
|
-
"aria-selected":
|
|
90
|
+
onClick: () => w(e.value),
|
|
91
|
+
onKeyDown: (t) => T(t, e.value),
|
|
92
|
+
"aria-selected": e.selected ? "true" : "false",
|
|
93
93
|
tabIndex: s ? -1 : 0,
|
|
94
94
|
"data-index": r,
|
|
95
|
-
"data-value":
|
|
96
|
-
"data-selected":
|
|
95
|
+
"data-value": e.value,
|
|
96
|
+
"data-selected": e.selected ? "true" : "false",
|
|
97
97
|
"data-disabled": s || void 0,
|
|
98
98
|
"aria-disabled": s ? "true" : "false",
|
|
99
99
|
role: "option",
|
|
@@ -104,23 +104,23 @@ var s = ({ state: s }) => {
|
|
|
104
104
|
type: "checkbox",
|
|
105
105
|
inert: !0,
|
|
106
106
|
tabIndex: -1,
|
|
107
|
-
value:
|
|
108
|
-
checked:
|
|
107
|
+
value: e.value,
|
|
108
|
+
checked: e.selected || !1,
|
|
109
109
|
onChange: () => {},
|
|
110
110
|
"aria-hidden": "true",
|
|
111
111
|
disabled: s
|
|
112
|
-
}) :
|
|
112
|
+
}) : e.selected ? /* @__PURE__ */ a(t, { name: "check-big" }) : null,
|
|
113
113
|
/* @__PURE__ */ o("span", {
|
|
114
114
|
className: "pkt-listbox__option-label",
|
|
115
115
|
id: `${l}-option-label-${r}`,
|
|
116
|
-
children: [
|
|
116
|
+
children: [e.prefix && /* @__PURE__ */ a("span", {
|
|
117
117
|
className: "pkt-listbox__option-prefix",
|
|
118
|
-
children:
|
|
119
|
-
}),
|
|
118
|
+
children: e.prefix
|
|
119
|
+
}), e.label || e.value]
|
|
120
120
|
}),
|
|
121
|
-
|
|
121
|
+
e.description && /* @__PURE__ */ a("span", {
|
|
122
122
|
className: "pkt-listbox__option-description pkt-txt-14-light",
|
|
123
|
-
children:
|
|
123
|
+
children: e.description
|
|
124
124
|
})
|
|
125
125
|
]
|
|
126
126
|
}, n);
|
|
@@ -132,5 +132,4 @@ var s = ({ state: s }) => {
|
|
|
132
132
|
children: x
|
|
133
133
|
})] });
|
|
134
134
|
};
|
|
135
|
-
//#endregion
|
|
136
135
|
export { s as Listbox };
|