@oslokommune/punkt-react 19.15.5 → 19.16.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 +27 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion/Accordion.js +28 -0
- package/dist/components/accordion/AccordionItem.js +60 -0
- package/dist/components/alert/Alert.js +76 -0
- package/dist/components/backlink/BackLink.js +35 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +67 -0
- package/dist/components/button/Button.js +54 -0
- package/dist/components/calendar/Calendar.js +49 -0
- package/dist/components/calendar/CalendarGrid.js +99 -0
- package/dist/components/calendar/CalendarNav.js +89 -0
- package/dist/components/calendar/calendar-utils.js +44 -0
- package/dist/components/calendar/useCalendarState.js +214 -0
- package/dist/components/card/Card.js +99 -0
- package/dist/components/checkbox/Checkbox.js +101 -0
- package/dist/components/checkboxgroup/CheckboxGroup.js +88 -0
- package/dist/components/checkboxgroup/CheckboxGroupContext.js +5 -0
- package/dist/components/combobox/Combobox.js +65 -0
- package/dist/components/combobox/ComboboxInput.js +87 -0
- package/dist/components/combobox/ComboboxTags.js +82 -0
- package/dist/components/combobox/Listbox.js +136 -0
- package/dist/components/combobox/useComboboxState.js +577 -0
- package/dist/components/consent/Consent.js +110 -0
- package/dist/components/datepicker/DateTags.js +28 -0
- package/dist/components/datepicker/Datepicker.js +79 -0
- package/dist/components/datepicker/DatepickerInputs.js +149 -0
- package/dist/components/datepicker/DatepickerPopup.js +41 -0
- package/dist/components/datepicker/useDatepickerState.js +243 -0
- package/dist/components/fileupload/DropZone.js +131 -0
- package/dist/components/fileupload/FileUpload.js +223 -0
- package/dist/components/fileupload/FileUploadContext.d.ts +2 -0
- package/dist/components/fileupload/FileUploadContext.js +6 -0
- package/dist/components/fileupload/QueueDisplay.js +67 -0
- package/dist/components/fileupload/QueueItemContent.js +88 -0
- package/dist/components/fileupload/Subcomponents.js +265 -0
- package/dist/components/fileupload/Truncate.js +22 -0
- package/dist/components/fileupload/extensions/Comments.js +128 -0
- package/dist/components/fileupload/extensions/Remove.js +9 -0
- package/dist/components/fileupload/extensions/Rename.js +66 -0
- package/dist/components/fileupload/hooks/useFileAttributes.js +25 -0
- package/dist/components/fileupload/hooks/useImageObjectUrl.js +15 -0
- package/dist/components/fileupload/hooks/useImagePreview.js +24 -0
- package/dist/components/fileupload/hooks/useOperationState.js +31 -0
- package/dist/components/fileupload/hooks/useRequiredFormValidation.js +23 -0
- package/dist/components/fileupload/types.d.ts +0 -1
- package/dist/components/fileupload/types.js +12 -0
- package/dist/components/footer/Footer.js +134 -0
- package/dist/components/footer/FooterGlobal.js +105 -0
- package/dist/components/footerSimple/FooterSimple.js +87 -0
- package/dist/components/header/Header.js +15 -0
- package/dist/components/header/HeaderGlobal.js +286 -0
- package/dist/components/header/HeaderService.js +281 -0
- package/dist/components/header-menu/HeaderMenu.js +197 -0
- package/dist/components/headerUserMenu/UserMenu.js +134 -0
- package/dist/components/heading/Heading.js +37 -0
- package/dist/components/helptext/Helptext.js +50 -0
- package/dist/components/icon/Icon.d.ts +6 -0
- package/dist/components/icon/Icon.js +69 -0
- package/dist/components/input/Input.js +23 -0
- package/dist/components/inputwrapper/InputWrapper.js +128 -0
- package/dist/components/link/Link.js +34 -0
- package/dist/components/linkcard/LinkCard.js +38 -0
- package/dist/components/loader/Loader.js +47 -0
- package/dist/components/messagebox/Messagebox.js +50 -0
- package/dist/components/modal/Modal.js +89 -0
- package/dist/components/progressbar/Progressbar.d.ts +1 -1
- package/dist/components/progressbar/Progressbar.js +62 -0
- package/dist/components/radio/RadioButton.js +85 -0
- package/dist/components/radiogroup/RadioGroup.js +70 -0
- package/dist/components/radiogroup/RadioGroupContext.js +5 -0
- package/dist/components/searchinput/SearchInput.js +102 -0
- package/dist/components/select/Select.js +56 -0
- package/dist/components/stepper/Step.js +78 -0
- package/dist/components/stepper/Stepper.js +21 -0
- package/dist/components/strings/PktStringsProvider.js +21 -0
- package/dist/components/table/Table.js +19 -0
- package/dist/components/table/TableBody.js +13 -0
- package/dist/components/table/TableDataCell.js +14 -0
- package/dist/components/table/TableHeader.js +12 -0
- package/dist/components/table/TableHeaderCell.js +12 -0
- package/dist/components/table/TableRow.js +12 -0
- package/dist/components/tabs/TabItem.js +60 -0
- package/dist/components/tabs/Tabs.js +90 -0
- package/dist/components/tag/Tag.js +76 -0
- package/dist/components/textarea/Textarea.js +74 -0
- package/dist/components/textinput/Textinput.js +106 -0
- package/dist/components/timepicker/Timepicker.js +224 -0
- package/dist/components/timepicker/useTimepickerState.js +483 -0
- package/dist/hooks/useElementWidth.js +23 -0
- package/dist/hooks/useFocusModality.js +28 -0
- package/dist/hooks/useGeneratedId.js +8 -0
- package/dist/hooks/useHeaderChrome.js +36 -0
- package/dist/hooks/useOptionGroupField.js +70 -0
- package/dist/hooks/useOwnerForm.js +15 -0
- package/dist/hooks/usePktStrings.js +16 -0
- package/dist/hooks/useScrollLock.js +12 -0
- package/dist/node_modules/@date-fns/tz/date/index.js +57 -0
- package/dist/node_modules/@date-fns/tz/date/mini.js +75 -0
- package/dist/node_modules/@date-fns/tz/index.js +6 -0
- package/dist/node_modules/@date-fns/tz/tz/index.js +1 -0
- package/dist/node_modules/@date-fns/tz/tzName/index.js +10 -0
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +22 -0
- package/dist/node_modules/classnames/index.js +32 -0
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +6 -0
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/date-fns/_lib/format/formatters.js +389 -0
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +43 -0
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +38 -0
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +8 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +8 -0
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +11 -0
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +23 -0
- package/dist/node_modules/date-fns/addDays.js +9 -0
- package/dist/node_modules/date-fns/constants.js +10 -0
- package/dist/node_modules/date-fns/constructFrom.js +7 -0
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +11 -0
- package/dist/node_modules/date-fns/eachDayOfInterval.js +15 -0
- package/dist/node_modules/date-fns/endOfDay.js +8 -0
- package/dist/node_modules/date-fns/format.js +59 -0
- package/dist/node_modules/date-fns/getDayOfYear.js +10 -0
- package/dist/node_modules/date-fns/getISODay.js +8 -0
- package/dist/node_modules/date-fns/getISOWeek.js +11 -0
- package/dist/node_modules/date-fns/getISOWeekYear.js +14 -0
- package/dist/node_modules/date-fns/getWeek.js +11 -0
- package/dist/node_modules/date-fns/getWeekYear.js +15 -0
- package/dist/node_modules/date-fns/isDate.js +6 -0
- package/dist/node_modules/date-fns/isValid.js +8 -0
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +17 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +22 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +18 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +69 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +32 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +202 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +124 -0
- package/dist/node_modules/date-fns/locale/en-US.js +20 -0
- package/dist/node_modules/date-fns/startOfDay.js +8 -0
- package/dist/node_modules/date-fns/startOfISOWeek.js +10 -0
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +10 -0
- package/dist/node_modules/date-fns/startOfWeek.js +9 -0
- package/dist/node_modules/date-fns/startOfWeekYear.js +11 -0
- package/dist/node_modules/date-fns/startOfYear.js +8 -0
- package/dist/node_modules/date-fns/toDate.js +7 -0
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +55 -9394
- package/dist/shared-strings/consent.js +113 -0
- package/dist/shared-strings/format.js +18 -0
- package/dist/shared-strings/nb.js +201 -0
- package/dist/shared-strings/resolve.js +40 -0
- package/dist/shared-strings/store.js +35 -0
- package/dist/shared-types/accordion.js +4 -0
- package/dist/shared-types/calendar.js +12 -0
- package/dist/shared-types/card.js +15 -0
- package/dist/shared-types/checkbox.js +15 -0
- package/dist/shared-types/combobox.js +19 -0
- package/dist/shared-types/consent.js +8 -0
- package/dist/shared-types/footer.js +4 -0
- package/dist/shared-types/header-footer.js +4 -0
- package/dist/shared-types/icon.js +7 -0
- package/dist/shared-types/messagebox.js +8 -0
- package/dist/shared-types/option-group.js +14 -0
- package/dist/shared-types/radiobutton.js +11 -0
- package/dist/shared-types/select.js +14 -0
- package/dist/shared-types/table.js +8 -0
- package/dist/shared-utils/calendar/calendar-grid.js +19 -0
- package/dist/shared-utils/calendar/date-validation.js +19 -0
- package/dist/shared-utils/calendar/keyboard-navigation.js +26 -0
- package/dist/shared-utils/calendar/selection-manager.js +52 -0
- package/dist/shared-utils/combobox/input-utils.js +39 -0
- package/dist/shared-utils/combobox/keyboard-navigation.js +41 -0
- package/dist/shared-utils/combobox/option-utils.js +48 -0
- package/dist/shared-utils/date-utils.js +71 -0
- package/dist/shared-utils/datepicker-utils.js +32 -0
- package/dist/shared-utils/device-utils.js +7 -0
- package/dist/shared-utils/fileupload/announcements.js +21 -0
- package/dist/shared-utils/fileupload/filename.js +8 -0
- package/dist/shared-utils/fileupload/focus-trap.js +2 -0
- package/dist/shared-utils/fileupload/formats.js +29 -0
- package/dist/shared-utils/fileupload/index.js +11 -0
- package/dist/shared-utils/fileupload/navigation.js +6 -0
- package/dist/shared-utils/fileupload/size.js +25 -0
- package/dist/shared-utils/fileupload/transfers.js +23 -0
- package/dist/shared-utils/fileupload/truncate.js +9 -0
- package/dist/shared-utils/fileupload/validation.js +32 -0
- package/dist/shared-utils/focus-trap/index.js +60 -0
- package/dist/shared-utils/forms/described-by.js +7 -0
- package/dist/shared-utils/header-footer/external-domain.js +30 -0
- package/dist/shared-utils/header-footer/fetch-header-footer-data.js +29 -0
- package/dist/shared-utils/header-footer/icon-map.js +55 -0
- package/dist/shared-utils/header-footer/select-megamenu.js +7 -0
- package/dist/shared-utils/scroll-lock/index.js +21 -0
- package/dist/shared-utils/timepicker/options.js +10 -0
- package/dist/shared-utils/timepicker/stepper.js +10 -0
- package/dist/shared-utils/timepicker/time-utils.js +7 -0
- package/dist/shared-utils/value-utils.js +12 -0
- package/dist/utils/nativeInputValue.js +6 -0
- package/dist/utils/stableKeys.js +13 -0
- package/dist/utils/stringutils.js +7 -0
- package/package.json +3 -2
- package/src/components/checkbox/Checkbox.tsx +2 -0
- package/src/components/combobox/types.ts +0 -2
- package/src/components/fileupload/FileUpload.tsx +3 -1
- package/src/components/fileupload/FileUploadContext.ts +7 -0
- package/src/components/fileupload/QueueDisplay.tsx +3 -3
- package/src/components/fileupload/Subcomponents.tsx +2 -7
- package/src/components/fileupload/extensions/Comments.tsx +2 -1
- package/src/components/fileupload/extensions/Rename.tsx +2 -1
- package/src/components/fileupload/types.ts +1 -2
- package/src/components/header/Header.test.tsx +0 -7
- package/src/components/header/Header.tsx +0 -2
- package/src/components/heading/Heading.tsx +0 -2
- package/src/components/helptext/Helptext.tsx +3 -4
- package/src/components/hydration.test.tsx +32 -0
- package/src/components/icon/Icon.test.tsx +0 -7
- package/src/components/icon/Icon.tsx +7 -0
- package/src/components/input/Input.tsx +0 -2
- package/src/components/inputwrapper/InputWrapper.tsx +3 -4
- package/src/components/link/Link.tsx +0 -2
- package/src/components/progressbar/Progressbar.test.tsx +8 -29
- package/src/components/progressbar/Progressbar.tsx +17 -12
- package/src/components/radio/RadioButton.tsx +2 -0
- package/src/components/searchinput/SearchInput.tsx +3 -4
- package/src/components/server-components.test.ts +69 -0
- package/src/components/ssr.test.tsx +3 -35
- package/src/components/stepper/Step.tsx +0 -2
- package/src/components/stepper/Stepper.tsx +0 -2
- package/src/components/strings/PktStringsProvider.tsx +2 -0
- package/src/components/table/Table.tsx +0 -2
- package/src/components/table/TableBody.tsx +1 -3
- package/src/components/table/TableDataCell.tsx +0 -2
- package/src/components/table/TableHeader.tsx +0 -2
- package/src/components/table/TableHeaderCell.tsx +0 -2
- package/src/components/table/TableRow.tsx +0 -2
- package/dist/components/accordion/Accordion.test.d.ts +0 -0
- package/dist/components/alert/Alert.test.d.ts +0 -0
- package/dist/components/backlink/BackLink.test.d.ts +0 -0
- package/dist/components/breadcrumbs/Breadcrumbs.test.d.ts +0 -1
- package/dist/components/button/Button.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.accessibility.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.constraints.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.core.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.interaction.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.selection.test.d.ts +0 -0
- package/dist/components/card/Card.test.d.ts +0 -0
- package/dist/components/checkbox/Checkbox.test.d.ts +0 -0
- package/dist/components/checkboxgroup/CheckboxGroup.forms.test.d.ts +0 -0
- package/dist/components/checkboxgroup/CheckboxGroup.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.accessibility.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.core.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.interaction.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.preselection.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.selection.test.d.ts +0 -0
- package/dist/components/consent/Consent.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.accessibility.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.core.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.input.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.selection.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.validation.test.d.ts +0 -0
- package/dist/components/fileupload/FileUpload.test.d.ts +0 -0
- package/dist/components/fileupload/QueueDisplay.test.d.ts +0 -0
- package/dist/components/fileupload/Truncate.test.d.ts +0 -0
- package/dist/components/footer/Footer.accessibility.test.d.ts +0 -0
- package/dist/components/footer/Footer.test.d.ts +0 -1
- package/dist/components/footerSimple/FooterSimple.test.d.ts +0 -1
- package/dist/components/formAttribute.test.d.ts +0 -1
- package/dist/components/header/Header.test.d.ts +0 -0
- package/dist/components/header/HeaderGlobal.accessibility.test.d.ts +0 -0
- package/dist/components/header/HeaderGlobal.test.d.ts +0 -0
- package/dist/components/header/HeaderService.accessibility.test.d.ts +0 -0
- package/dist/components/header/HeaderService.test.d.ts +0 -0
- package/dist/components/header-menu/HeaderMenu.test.d.ts +0 -0
- package/dist/components/headerUserMenu/UserMenu.test.d.ts +0 -0
- package/dist/components/heading/Heading.test.d.ts +0 -0
- package/dist/components/helptext/Helptext.test.d.ts +0 -0
- package/dist/components/helptext/helptextAssociation.test.d.ts +0 -1
- package/dist/components/icon/Icon.test.d.ts +0 -9
- package/dist/components/inputwrapper/InputWrapper.test.d.ts +0 -0
- package/dist/components/link/Link.test.d.ts +0 -1
- package/dist/components/linkcard/LinkCard.test.d.ts +0 -0
- package/dist/components/loader/Loader.test.d.ts +0 -0
- package/dist/components/messagebox/Messagebox.test.d.ts +0 -1
- package/dist/components/modal/Modal.test.d.ts +0 -0
- package/dist/components/progressbar/Progressbar.test.d.ts +0 -0
- package/dist/components/radio/RadioButton.test.d.ts +0 -0
- package/dist/components/radiogroup/RadioGroup.forms.test.d.ts +0 -0
- package/dist/components/radiogroup/RadioGroup.test.d.ts +0 -0
- package/dist/components/searchinput/SearchInput.test.d.ts +0 -0
- package/dist/components/select/Select.test.d.ts +0 -0
- package/dist/components/ssr.test.d.ts +0 -1
- package/dist/components/stepper/Stepper.test.d.ts +0 -0
- package/dist/components/strings/strings-override.test.d.ts +0 -1
- package/dist/components/table/Table.test.d.ts +0 -0
- package/dist/components/tabs/Tabs.test.d.ts +0 -0
- package/dist/components/tag/Tag.test.d.ts +0 -0
- package/dist/components/textarea/Textarea.test.d.ts +0 -0
- package/dist/components/textinput/Textinput.test.d.ts +0 -0
- package/dist/components/timepicker/Timepicker.test.d.ts +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { PktIcon as n } from "../icon/Icon.js";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/link/Link.tsx
|
|
6
|
+
var o = /* @__PURE__ */ e(t(), 1), s = ({ href: e, iconName: t, className: s, iconPosition: c, external: l, target: u, renderLink: d, children: f, ...p }) => {
|
|
7
|
+
let m = {
|
|
8
|
+
"pkt-link": !0,
|
|
9
|
+
"pkt-link--icon-left": !!t && c === "left" || !!(t && !c),
|
|
10
|
+
"pkt-link--icon-right": !!t && c === "right",
|
|
11
|
+
"pkt-link--external": l
|
|
12
|
+
}, h = /* @__PURE__ */ a(r, { children: [t && /* @__PURE__ */ i(n, {
|
|
13
|
+
name: t,
|
|
14
|
+
className: "pkt-link__icon"
|
|
15
|
+
}), f] });
|
|
16
|
+
return (d || (({ href: e, className: t, children: n, props: r }) => /* @__PURE__ */ i("a", {
|
|
17
|
+
href: e,
|
|
18
|
+
className: t,
|
|
19
|
+
...r,
|
|
20
|
+
children: n
|
|
21
|
+
})))({
|
|
22
|
+
href: e ?? "",
|
|
23
|
+
className: (0, o.default)(m, s),
|
|
24
|
+
children: h,
|
|
25
|
+
props: {
|
|
26
|
+
...p,
|
|
27
|
+
target: u,
|
|
28
|
+
rel: l ? "noopener noreferrer" : void 0
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
s.displayName = "PktLink";
|
|
33
|
+
//#endregion
|
|
34
|
+
export { s as PktLink };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { PktIcon as n } from "../icon/Icon.js";
|
|
5
|
+
import { usePktStrings as r } from "../../hooks/usePktStrings.js";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/linkcard/LinkCard.tsx
|
|
8
|
+
var o = /* @__PURE__ */ e(t(), 1), s = ({ children: e, skin: t, title: s, href: c, iconName: l, openInNewTab: u, external: d, className: f, strings: p, ...m }) => {
|
|
9
|
+
let h = r(["linkcard"], p), g = ["pkt-linkcard", t && `pkt-linkcard--${t}`].filter(Boolean).join(" "), _ = ["pkt-linkcard__title", d && "pkt-link pkt-link--external"].filter(Boolean).join(" ");
|
|
10
|
+
return /* @__PURE__ */ a("a", {
|
|
11
|
+
...m,
|
|
12
|
+
href: c,
|
|
13
|
+
className: (0, o.default)(g, f),
|
|
14
|
+
target: u ? "_blank" : "_self",
|
|
15
|
+
rel: u ? "noopener noreferrer" : void 0,
|
|
16
|
+
children: [
|
|
17
|
+
l && /* @__PURE__ */ i(n, {
|
|
18
|
+
className: "pkt-link__icon",
|
|
19
|
+
name: l
|
|
20
|
+
}),
|
|
21
|
+
s && /* @__PURE__ */ i("div", {
|
|
22
|
+
className: (0, o.default)(_),
|
|
23
|
+
children: s
|
|
24
|
+
}),
|
|
25
|
+
u && h.linkcard.openInNewTab ? /* @__PURE__ */ i("span", {
|
|
26
|
+
className: "pkt-sr-only",
|
|
27
|
+
children: h.linkcard.openInNewTab
|
|
28
|
+
}) : null,
|
|
29
|
+
/* @__PURE__ */ i("div", {
|
|
30
|
+
className: "pkt-linkcard__text",
|
|
31
|
+
children: e
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
s.displayName = "PktLinkCard";
|
|
37
|
+
//#endregion
|
|
38
|
+
export { s as PktLinkCard };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { ANIMATION_DEFAULT_PATH as t } from "../../shared-types/icon.js";
|
|
4
|
+
import { require_classnames as n } from "../../node_modules/classnames/index.js";
|
|
5
|
+
import { PktIcon as r } from "../icon/Icon.js";
|
|
6
|
+
import { forwardRef as i, useEffect as a, useState as o } from "react";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/loader/Loader.tsx
|
|
9
|
+
var l = /* @__PURE__ */ e(n(), 1);
|
|
10
|
+
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/");
|
|
11
|
+
var u = (e) => {
|
|
12
|
+
switch (e) {
|
|
13
|
+
case "blue": return "spinner-blue";
|
|
14
|
+
case "rainbow": return "spinner";
|
|
15
|
+
default: return "loader";
|
|
16
|
+
}
|
|
17
|
+
}, d = i(function({ delay: e = 0, inline: n = !1, isLoading: i = !0, message: d = null, size: f = "medium", variant: p = "rainbow", loadingAnimationPath: m = typeof window < "u" ? window.pktAnimationPath : t, className: h, children: g, ..._ }, v) {
|
|
18
|
+
let [y, b] = o(!1), [x, S] = o(e);
|
|
19
|
+
e !== x && (S(e), b(!1)), a(() => {
|
|
20
|
+
if (e <= 0) return;
|
|
21
|
+
let t = setTimeout(() => b(!0), e);
|
|
22
|
+
return () => clearTimeout(t);
|
|
23
|
+
}, [e]);
|
|
24
|
+
let C = e <= 0 || y, w = (0, l.default)("pkt-loader", n ? "pkt-loader--inline" : "pkt-loader--box", `pkt-loader--${f}`, h);
|
|
25
|
+
return /* @__PURE__ */ c("div", {
|
|
26
|
+
..._,
|
|
27
|
+
ref: v,
|
|
28
|
+
role: "status",
|
|
29
|
+
"aria-live": "polite",
|
|
30
|
+
"aria-busy": i ? "true" : "false",
|
|
31
|
+
className: w,
|
|
32
|
+
children: [i && C && /* @__PURE__ */ c("div", {
|
|
33
|
+
className: "pkt-loader__spinner",
|
|
34
|
+
children: [/* @__PURE__ */ s(r, {
|
|
35
|
+
name: u(p),
|
|
36
|
+
path: m,
|
|
37
|
+
className: `pkt-loader__svg pkt-loader__${p}`
|
|
38
|
+
}), d && /* @__PURE__ */ s("p", { children: d })]
|
|
39
|
+
}), /* @__PURE__ */ s("div", {
|
|
40
|
+
className: (0, l.default)("pkt-contents", i && "pkt-hide"),
|
|
41
|
+
children: g
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
d.displayName = "PktLoader";
|
|
46
|
+
//#endregion
|
|
47
|
+
export { d as PktLoader };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { MESSAGEBOX_DEFAULTS as t } from "../../shared-types/messagebox.js";
|
|
4
|
+
import { require_classnames as n } from "../../node_modules/classnames/index.js";
|
|
5
|
+
import { PktIcon as r } from "../icon/Icon.js";
|
|
6
|
+
import { usePktStrings as i } from "../../hooks/usePktStrings.js";
|
|
7
|
+
import { createRef as a, useCallback as o, useState as s } from "react";
|
|
8
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/messagebox/Messagebox.tsx
|
|
10
|
+
var u = /* @__PURE__ */ e(n(), 1), d = ({ children: e, className: n, skin: d = t.skin, title: f, compact: p = t.compact, closable: m = t.closable, onClose: h, strings: g, ..._ }) => {
|
|
11
|
+
let v = i(["generic"], g), [y, b] = s(!1), x = {
|
|
12
|
+
"pkt-messagebox": !0,
|
|
13
|
+
"pkt-messagebox--compact": p,
|
|
14
|
+
[`pkt-messagebox--${d}`]: d,
|
|
15
|
+
"pkt-messagebox--closable": m,
|
|
16
|
+
"pkt-hide": y
|
|
17
|
+
}, S = a(), C = o(() => {
|
|
18
|
+
b(!0), h && h();
|
|
19
|
+
}, [b, h]);
|
|
20
|
+
return /* @__PURE__ */ l("div", {
|
|
21
|
+
..._,
|
|
22
|
+
className: (0, u.default)(x, n),
|
|
23
|
+
ref: S,
|
|
24
|
+
children: [
|
|
25
|
+
m && /* @__PURE__ */ c("div", {
|
|
26
|
+
className: "pkt-messagebox__close",
|
|
27
|
+
children: /* @__PURE__ */ c("button", {
|
|
28
|
+
onClick: C,
|
|
29
|
+
className: "pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",
|
|
30
|
+
"aria-label": v.generic.close,
|
|
31
|
+
children: /* @__PURE__ */ c(r, {
|
|
32
|
+
name: "close",
|
|
33
|
+
className: "pkt-link__icon"
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
}),
|
|
37
|
+
f && /* @__PURE__ */ c("div", {
|
|
38
|
+
className: "pkt-messagebox__title",
|
|
39
|
+
children: f
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ c("div", {
|
|
42
|
+
className: "pkt-messagebox__text",
|
|
43
|
+
children: e
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
d.displayName = "PktMessagebox";
|
|
49
|
+
//#endregion
|
|
50
|
+
export { d as PktMessagebox };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { PktIcon as n } from "../icon/Icon.js";
|
|
5
|
+
import { PktButton as r } from "../button/Button.js";
|
|
6
|
+
import { usePktStrings as i } from "../../hooks/usePktStrings.js";
|
|
7
|
+
import { useGeneratedId as a } from "../../hooks/useGeneratedId.js";
|
|
8
|
+
import { createScrollLockToken as o, setScrollLock as s } from "../../shared-utils/scroll-lock/index.js";
|
|
9
|
+
import { forwardRef as c, useCallback as l, useEffect as u, useRef as d } from "react";
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/modal/Modal.tsx
|
|
12
|
+
var m = /* @__PURE__ */ e(t(), 1), h = c(({ children: e, className: t, open: c = !1, headingText: h = "", headingIconName: g, headingIconPath: _, hideCloseButton: v = !1, closeOnBackdropClick: y = !1, size: b = "medium", removePadding: x = !1, closeButtonSkin: S = "blue", variant: C = "dialog", drawerPosition: w = "right", transparentBackdrop: T = !1, onClose: E, strings: D, ...O }, k) => {
|
|
13
|
+
let A = i(["generic"], D), j = d(null), M = d(o()), N = a(), P = `pkt-modal__headingText-${N}`, F = `pkt-modal__content-${N}`, I = l((e) => {
|
|
14
|
+
j.current = e, typeof k == "function" ? k(e) : k && (k.current = e);
|
|
15
|
+
}, [k]), L = l(() => {
|
|
16
|
+
j.current?.open && (j.current.close(), s(M.current, !1), E?.());
|
|
17
|
+
}, [E]);
|
|
18
|
+
u(() => {
|
|
19
|
+
c ? (j.current?.open || j.current?.showModal(), s(M.current, !0)) : (j.current?.open && j.current.close(), s(M.current, !1));
|
|
20
|
+
}, [c]), u(() => {
|
|
21
|
+
let e = M.current;
|
|
22
|
+
return () => {
|
|
23
|
+
s(e, !1);
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
let R = l((e) => {
|
|
27
|
+
y && e.target === j.current && L();
|
|
28
|
+
}, [y, L]), z = l(() => {
|
|
29
|
+
s(M.current, !1), E?.();
|
|
30
|
+
}, [E]), B = S === "blue", V = (0, m.default)({
|
|
31
|
+
"pkt-modal": !0,
|
|
32
|
+
"pkt-modal--removePadding": x,
|
|
33
|
+
"pkt-modal--noHeadingText": !h,
|
|
34
|
+
"pkt-modal--noShadow": S === "yellow-filled",
|
|
35
|
+
"pkt-modal--transparentBackdrop": T,
|
|
36
|
+
[`pkt-modal--${b}`]: b,
|
|
37
|
+
[`pkt-modal__${C}`]: C,
|
|
38
|
+
[`pkt-modal__drawer--${w}`]: C === "drawer"
|
|
39
|
+
}, t);
|
|
40
|
+
return /* @__PURE__ */ f("dialog", {
|
|
41
|
+
...O,
|
|
42
|
+
className: V,
|
|
43
|
+
ref: I,
|
|
44
|
+
"aria-labelledby": h ? P : void 0,
|
|
45
|
+
"aria-describedby": F,
|
|
46
|
+
onClick: R,
|
|
47
|
+
onClose: z,
|
|
48
|
+
children: /* @__PURE__ */ p("div", {
|
|
49
|
+
className: "pkt-modal__wrapper",
|
|
50
|
+
children: [(h || !v) && /* @__PURE__ */ p("div", {
|
|
51
|
+
className: "pkt-modal__header",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ f("div", { className: "pkt-modal__header-background" }),
|
|
54
|
+
h ? /* @__PURE__ */ p("h1", {
|
|
55
|
+
id: P,
|
|
56
|
+
className: (0, m.default)("pkt-modal__headingText", "pkt-txt-24", { "pkt-modal__headingText--hasIcon": g }),
|
|
57
|
+
children: [g && /* @__PURE__ */ f(n, {
|
|
58
|
+
className: "pkt-modal__headingIcon",
|
|
59
|
+
name: g,
|
|
60
|
+
..._ && { path: _ }
|
|
61
|
+
}), h]
|
|
62
|
+
}) : /* @__PURE__ */ f("div", { className: "pkt-modal__headingText" }),
|
|
63
|
+
v ? /* @__PURE__ */ f("div", { className: "pkt-modal__noCloseButton" }) : /* @__PURE__ */ f("div", {
|
|
64
|
+
className: (0, m.default)("pkt-modal__closeButton", { [`pkt-modal__closeButton--${S}`]: !0 }),
|
|
65
|
+
children: /* @__PURE__ */ f(r, {
|
|
66
|
+
onClick: L,
|
|
67
|
+
"aria-label": A.generic.close,
|
|
68
|
+
iconName: "close",
|
|
69
|
+
variant: "icon-only",
|
|
70
|
+
size: "medium",
|
|
71
|
+
skin: B ? "tertiary" : "primary",
|
|
72
|
+
children: A.generic.close
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}), /* @__PURE__ */ f("div", {
|
|
77
|
+
className: "pkt-modal__container",
|
|
78
|
+
children: /* @__PURE__ */ f("div", {
|
|
79
|
+
id: F,
|
|
80
|
+
className: "pkt-modal__content pkt-txt-18-light",
|
|
81
|
+
children: e
|
|
82
|
+
})
|
|
83
|
+
})]
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
h.displayName = "PktModal";
|
|
88
|
+
//#endregion
|
|
89
|
+
export { h as PktModal };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, Ref } from 'react';
|
|
2
2
|
import { TAriaLive, TProgressbarRole, TProgressbarSkin, TProgressbarStatusPlacement, TProgressbarStatusType, TProgressbarTitlePosition } from '../../shared-types';
|
|
3
|
-
export type { TProgressbarRole, TProgressbarSkin, TProgressbarStatusPlacement, TProgressbarStatusType, TProgressbarTitlePosition };
|
|
3
|
+
export type { TProgressbarRole, TProgressbarSkin, TProgressbarStatusPlacement, TProgressbarStatusType, TProgressbarTitlePosition, };
|
|
4
4
|
export interface IPktProgressbar extends Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'title'> {
|
|
5
5
|
ariaLabel?: string | null;
|
|
6
6
|
ariaLabelledby?: string | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { useGeneratedId as n } from "../../hooks/useGeneratedId.js";
|
|
5
|
+
import { forwardRef as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/progressbar/Progressbar.tsx
|
|
8
|
+
var l = /* @__PURE__ */ e(t(), 1), u = r(({ ariaLabel: e, ariaLabelledby: t, ariaLive: r = "polite", ariaValueText: u, id: d, role: f = "progressbar", skin: p = "dark-blue", statusPlacement: m = "following", statusType: h = "none", title: g, titlePosition: _ = "left", valueCurrent: v = 0, valueMax: y = 100, valueMin: b = 0, className: x, ...S }, C) => {
|
|
9
|
+
let w = n(d), T = a(null), [E, D] = o(0);
|
|
10
|
+
i(() => {
|
|
11
|
+
T.current && D(T.current.getBoundingClientRect().width || 0);
|
|
12
|
+
}, [v]);
|
|
13
|
+
let O = y - b, k = Math.round(h === "fraction" ? v / O * 100 : (v - b) / O * 100), A = `${v} av ${O}`, j = h === "fraction" && !u ? `${v} av ${y - b}` : u || void 0, M = e ? void 0 : t || `${w}-title`;
|
|
14
|
+
return /* @__PURE__ */ s("div", {
|
|
15
|
+
ref: C,
|
|
16
|
+
id: w,
|
|
17
|
+
role: f,
|
|
18
|
+
"aria-live": r,
|
|
19
|
+
"aria-atomic": "true",
|
|
20
|
+
"aria-valuenow": v,
|
|
21
|
+
"aria-valuemin": b,
|
|
22
|
+
"aria-valuemax": y,
|
|
23
|
+
"aria-valuetext": j,
|
|
24
|
+
"aria-label": e || void 0,
|
|
25
|
+
"aria-labelledby": M,
|
|
26
|
+
className: (0, l.default)("pkt-progressbar", x),
|
|
27
|
+
...S,
|
|
28
|
+
children: /* @__PURE__ */ c("div", {
|
|
29
|
+
className: "pkt-progressbar__container",
|
|
30
|
+
style: {
|
|
31
|
+
"--pkt-progress-label-width": `${E}px`,
|
|
32
|
+
"--pkt-progress-width": `${k}%`
|
|
33
|
+
},
|
|
34
|
+
children: [
|
|
35
|
+
g && /* @__PURE__ */ s("p", {
|
|
36
|
+
id: `${w}-title`,
|
|
37
|
+
className: (0, l.default)("pkt-progressbar__title", { "pkt-progressbar__title-center": _ === "center" }),
|
|
38
|
+
children: g
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ s("div", {
|
|
41
|
+
className: "pkt-progressbar__bar-wrapper",
|
|
42
|
+
children: /* @__PURE__ */ s("div", { className: (0, l.default)("pkt-progressbar__bar", `pkt-progressbar__bar--${p}`) })
|
|
43
|
+
}),
|
|
44
|
+
h !== "none" && /* @__PURE__ */ s("div", {
|
|
45
|
+
className: (0, l.default)("pkt-progressbar__status", { "pkt-progressbar__status--center": m === "center" }),
|
|
46
|
+
children: /* @__PURE__ */ s("span", {
|
|
47
|
+
ref: T,
|
|
48
|
+
className: (0, l.default)({
|
|
49
|
+
"pkt-progressbar__status-placement--following": m === "following",
|
|
50
|
+
"pkt-progressbar__status-placement--center": m === "center",
|
|
51
|
+
"pkt-progressbar__status-placement--left": m === "left"
|
|
52
|
+
}),
|
|
53
|
+
children: h === "percentage" ? `${k}%` : A
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
u.displayName = "PktProgressbar";
|
|
61
|
+
//#endregion
|
|
62
|
+
export { u as PktProgressbar };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { RADIOBUTTON_DEFAULTS as e } from "../../shared-types/radiobutton.js";
|
|
3
|
+
import { usePktStrings as t } from "../../hooks/usePktStrings.js";
|
|
4
|
+
import { useGeneratedId as n } from "../../hooks/useGeneratedId.js";
|
|
5
|
+
import { useRadioGroupContext as r } from "../radiogroup/RadioGroupContext.js";
|
|
6
|
+
import { forwardRef as i, useEffect as a } from "react";
|
|
7
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/radio/RadioButton.tsx
|
|
9
|
+
var l = i(({ id: i, name: l, label: u, className: d, hasTile: f = e.hasTile, inputSize: p, disabled: m = e.disabled, checkHelptext: h, hasError: g = e.hasError, defaultChecked: _, checked: v, optionalTag: y, optionalText: b, requiredTag: x, requiredText: S, strings: C, tagText: w, value: T, required: E, onChange: D, "aria-describedby": O, ...k }, A) => {
|
|
10
|
+
let j = t(["forms"], C), M = n(i), N = r(), P = T ?? "on", F = N?.value, I = F !== void 0, L = I ? F === P : v, R = _ ?? (N?.defaultValue === void 0 ? void 0 : N.defaultValue === P), z = f || !!N?.hasTile, B = g || !!N?.hasError, V = m || !!N?.disabled;
|
|
11
|
+
a(() => {
|
|
12
|
+
I && v !== void 0 && console.warn(`PktRadioButton (${M}): checked ignoreres når PktRadioGroup har value. Styr valget med value på gruppen.`);
|
|
13
|
+
}, [
|
|
14
|
+
I,
|
|
15
|
+
v,
|
|
16
|
+
M
|
|
17
|
+
]);
|
|
18
|
+
let H = (e) => {
|
|
19
|
+
D?.(e), N?.onOptionChange(e);
|
|
20
|
+
}, U = [
|
|
21
|
+
d,
|
|
22
|
+
"pkt-input-check",
|
|
23
|
+
p ? `pkt-input-check--${p}` : ""
|
|
24
|
+
].filter(Boolean).join(" "), W = [
|
|
25
|
+
"pkt-input-check__input",
|
|
26
|
+
z ? "pkt-input-check__input--tile" : "",
|
|
27
|
+
V && z ? "pkt-input-check__input--tile-disabled" : ""
|
|
28
|
+
].filter(Boolean).join(" "), G = ["pkt-input-check__input-checkbox", B ? "pkt-input-check__input-checkbox--error" : ""].filter(Boolean).join(" "), K = ["pkt-input-check__input-label", V ? "pkt-input-check__input-label--disabled" : ""].filter(Boolean).join(" "), q = [
|
|
29
|
+
"pkt-tag",
|
|
30
|
+
"pkt-tag--small",
|
|
31
|
+
"pkt-tag--thin-text"
|
|
32
|
+
].join(" "), J = () => /* @__PURE__ */ c(o, { children: [
|
|
33
|
+
w && /* @__PURE__ */ s("span", {
|
|
34
|
+
className: q + " pkt-tag--gray",
|
|
35
|
+
children: w
|
|
36
|
+
}),
|
|
37
|
+
y && /* @__PURE__ */ s("span", {
|
|
38
|
+
className: q + " pkt-tag--blue-light",
|
|
39
|
+
children: b ?? j.forms.optional
|
|
40
|
+
}),
|
|
41
|
+
x && /* @__PURE__ */ s("span", {
|
|
42
|
+
className: q + " pkt-tag--beige",
|
|
43
|
+
children: S ?? j.forms.required
|
|
44
|
+
})
|
|
45
|
+
] }), Y = `${M}-check-label`, X = `${M}-check-helptext`, Z = [h ? X : void 0, O].filter(Boolean).join(" ") || void 0;
|
|
46
|
+
return /* @__PURE__ */ s("div", {
|
|
47
|
+
className: U,
|
|
48
|
+
children: /* @__PURE__ */ c("div", {
|
|
49
|
+
className: W,
|
|
50
|
+
children: [/* @__PURE__ */ s("input", {
|
|
51
|
+
ref: A,
|
|
52
|
+
id: M,
|
|
53
|
+
type: "radio",
|
|
54
|
+
name: l ?? N?.name,
|
|
55
|
+
value: T,
|
|
56
|
+
required: E || N?.required || void 0,
|
|
57
|
+
disabled: V,
|
|
58
|
+
className: G,
|
|
59
|
+
"aria-labelledby": u ? Y : void 0,
|
|
60
|
+
"aria-describedby": Z,
|
|
61
|
+
...L === void 0 ? { defaultChecked: R } : { checked: L },
|
|
62
|
+
onChange: N ? H : D,
|
|
63
|
+
...k
|
|
64
|
+
}), /* @__PURE__ */ c("label", {
|
|
65
|
+
className: K,
|
|
66
|
+
htmlFor: M,
|
|
67
|
+
children: [/* @__PURE__ */ c("span", {
|
|
68
|
+
id: Y,
|
|
69
|
+
children: [
|
|
70
|
+
u,
|
|
71
|
+
" ",
|
|
72
|
+
J()
|
|
73
|
+
]
|
|
74
|
+
}), h && /* @__PURE__ */ s("div", {
|
|
75
|
+
id: X,
|
|
76
|
+
className: "pkt-input-check__input-helptext",
|
|
77
|
+
children: h
|
|
78
|
+
})]
|
|
79
|
+
})]
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
l.displayName = "PktRadioButton";
|
|
84
|
+
//#endregion
|
|
85
|
+
export { l as PktRadioButton };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { OPTION_GROUP_DEFAULTS as e } from "../../shared-types/option-group.js";
|
|
3
|
+
import { useGeneratedId as t } from "../../hooks/useGeneratedId.js";
|
|
4
|
+
import { useOptionGroupField as n } from "../../hooks/useOptionGroupField.js";
|
|
5
|
+
import { PktInputWrapper as r } from "../inputwrapper/InputWrapper.js";
|
|
6
|
+
import { RadioGroupContext as i } from "./RadioGroupContext.js";
|
|
7
|
+
import { forwardRef as a, useMemo as o } from "react";
|
|
8
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/radiogroup/RadioGroup.tsx
|
|
10
|
+
var c = a(({ id: a, name: c, label: l, helptext: u, helptextDropdown: d, helptextDropdownButton: f, value: p, defaultValue: m, layout: h = e.layout, inputSize: g = e.inputSize, hasTile: _ = e.hasTile, required: v = e.required, disabled: y = e.disabled, hasError: b = e.hasError, errorMessage: x, useWrapper: S = e.useWrapper, optionalTag: C = e.optionalTag, optionalText: w, requiredTag: T = e.requiredTag, requiredText: E, tagText: D, strings: O, className: k, children: A, onChange: j, onValueChange: M, onFocus: N, onBlur: P }, F) => {
|
|
11
|
+
let I = t(a), L = c || I, R = n({
|
|
12
|
+
type: "radio",
|
|
13
|
+
name: L,
|
|
14
|
+
forwardedRef: F,
|
|
15
|
+
onChange: j,
|
|
16
|
+
onValueChange: M,
|
|
17
|
+
onFocus: N,
|
|
18
|
+
onBlur: P
|
|
19
|
+
}), z = o(() => ({
|
|
20
|
+
name: L,
|
|
21
|
+
hasTile: _,
|
|
22
|
+
hasError: b,
|
|
23
|
+
disabled: y,
|
|
24
|
+
required: v,
|
|
25
|
+
value: p,
|
|
26
|
+
defaultValue: m,
|
|
27
|
+
onOptionChange: R.onOptionChange
|
|
28
|
+
}), [
|
|
29
|
+
L,
|
|
30
|
+
_,
|
|
31
|
+
b,
|
|
32
|
+
y,
|
|
33
|
+
v,
|
|
34
|
+
p,
|
|
35
|
+
m,
|
|
36
|
+
R
|
|
37
|
+
]);
|
|
38
|
+
return /* @__PURE__ */ s(i.Provider, {
|
|
39
|
+
value: z,
|
|
40
|
+
children: /* @__PURE__ */ s(r, {
|
|
41
|
+
ref: R.mergedRef,
|
|
42
|
+
onFocus: R.onRootFocus,
|
|
43
|
+
onBlur: R.onRootBlur,
|
|
44
|
+
id: a,
|
|
45
|
+
forId: I,
|
|
46
|
+
className: k,
|
|
47
|
+
label: l,
|
|
48
|
+
helptext: u,
|
|
49
|
+
helptextDropdown: d,
|
|
50
|
+
helptextDropdownButton: f,
|
|
51
|
+
hasError: b,
|
|
52
|
+
errorMessage: x,
|
|
53
|
+
disabled: y,
|
|
54
|
+
optionalTag: C,
|
|
55
|
+
optionalText: w,
|
|
56
|
+
requiredTag: T,
|
|
57
|
+
requiredText: E,
|
|
58
|
+
tagText: D,
|
|
59
|
+
useWrapper: S,
|
|
60
|
+
hasFieldset: !0,
|
|
61
|
+
layout: h,
|
|
62
|
+
size: g,
|
|
63
|
+
strings: O,
|
|
64
|
+
children: A
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
c.displayName = "PktRadioGroup";
|
|
69
|
+
//#endregion
|
|
70
|
+
export { c as PktRadioGroup };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PktButton as e } from "../button/Button.js";
|
|
3
|
+
import { usePktStrings as t } from "../../hooks/usePktStrings.js";
|
|
4
|
+
import { textKey as n, withStableKeys as r } from "../../utils/stableKeys.js";
|
|
5
|
+
import { useGeneratedId as i } from "../../hooks/useGeneratedId.js";
|
|
6
|
+
import { useFocusModality as a } from "../../hooks/useFocusModality.js";
|
|
7
|
+
import { forwardRef as o } from "react";
|
|
8
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/searchinput/SearchInput.tsx
|
|
10
|
+
var u = o(({ appearance: o = "local", inputSize: u = "medium", disabled: d = !1, fullwidth: f = !1, id: p, label: m, name: h, placeholder: g, suggestions: _, value: v = "", action: y, method: b, onChange: x, onSearch: S, onSuggestionClick: C, strings: w, ...T }, E) => {
|
|
11
|
+
let D = t(["searchinput"], w), O = g ?? D.searchinput.placeholder, k = (e, t) => {
|
|
12
|
+
e ? e() : C && C(t);
|
|
13
|
+
}, A = (e) => {
|
|
14
|
+
v = e.target.value;
|
|
15
|
+
}, j = [
|
|
16
|
+
"pkt-searchinput",
|
|
17
|
+
`pkt-searchinput--${o}`,
|
|
18
|
+
`pkt-searchinput--${u}`,
|
|
19
|
+
f && "pkt-searchinput--fullwidth"
|
|
20
|
+
].filter(Boolean).join(" "), M = i(p), N = {
|
|
21
|
+
role: "search",
|
|
22
|
+
className: j,
|
|
23
|
+
...a()
|
|
24
|
+
}, P = (e) => y ? /* @__PURE__ */ c("form", {
|
|
25
|
+
...N,
|
|
26
|
+
action: y,
|
|
27
|
+
method: b,
|
|
28
|
+
children: e
|
|
29
|
+
}) : /* @__PURE__ */ c("div", {
|
|
30
|
+
...N,
|
|
31
|
+
children: e
|
|
32
|
+
}), F = (e) => /* @__PURE__ */ l(s, { children: [e.title && /* @__PURE__ */ c("h3", {
|
|
33
|
+
className: "pkt-searchinput__suggestion-title",
|
|
34
|
+
children: e.title
|
|
35
|
+
}), e.text && /* @__PURE__ */ c("p", {
|
|
36
|
+
className: "pkt-searchinput__suggestion-text",
|
|
37
|
+
children: e.text
|
|
38
|
+
})] }), I = (e) => ["pkt-searchinput__suggestion", e.onClick ? "pkt-link-button" : ""].filter(Boolean).join(" "), L = o === "local" ? `pkt-input__container pkt-input__container--${u}` : "pkt-searchinput__field";
|
|
39
|
+
return P(/* @__PURE__ */ l(s, { children: [
|
|
40
|
+
m && /* @__PURE__ */ c("label", {
|
|
41
|
+
htmlFor: m ? M : void 0,
|
|
42
|
+
className: m ? "pkt-inputwrapper__label" : "",
|
|
43
|
+
children: m
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ l("div", {
|
|
46
|
+
className: L,
|
|
47
|
+
children: [/* @__PURE__ */ c("input", {
|
|
48
|
+
className: `pkt-input pkt-input--${u} ${f ? "pkt-input--fullwidth" : ""}`,
|
|
49
|
+
type: "search",
|
|
50
|
+
name: h || M,
|
|
51
|
+
id: M,
|
|
52
|
+
placeholder: O,
|
|
53
|
+
defaultValue: v,
|
|
54
|
+
disabled: d,
|
|
55
|
+
autoComplete: "off",
|
|
56
|
+
"aria-autocomplete": _ ? "list" : void 0,
|
|
57
|
+
ref: E,
|
|
58
|
+
"aria-controls": _ ? `${M}-suggestions` : void 0,
|
|
59
|
+
onChange: x || A,
|
|
60
|
+
onKeyUp: S && ((e) => {
|
|
61
|
+
e.key === "Enter" && (e.preventDefault(), S(v));
|
|
62
|
+
}),
|
|
63
|
+
...T
|
|
64
|
+
}), /* @__PURE__ */ c(e, {
|
|
65
|
+
className: `pkt-searchinput__button ${o === "local" ? "pkt-input-icon" : ""}`,
|
|
66
|
+
variant: "icon-only",
|
|
67
|
+
iconName: "magnifying-glass-big",
|
|
68
|
+
size: u,
|
|
69
|
+
skin: o === "local" ? "tertiary" : "primary",
|
|
70
|
+
color: o === "global" ? "yellow" : void 0,
|
|
71
|
+
type: "submit",
|
|
72
|
+
disabled: d,
|
|
73
|
+
onClick: S && ((e) => {
|
|
74
|
+
e.preventDefault(), S(v);
|
|
75
|
+
}),
|
|
76
|
+
children: m || O
|
|
77
|
+
})]
|
|
78
|
+
}),
|
|
79
|
+
_ && /* @__PURE__ */ c("ul", {
|
|
80
|
+
id: `${M}-suggestions`,
|
|
81
|
+
className: "pkt-searchinput__suggestions",
|
|
82
|
+
"aria-live": "assertive",
|
|
83
|
+
children: r(_, (e) => `${e.href ?? ""}|${n(e.title)}|${n(e.text)}`).map(({ item: e, key: t }, n) => e.href ? /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c("a", {
|
|
84
|
+
href: e.href,
|
|
85
|
+
className: I(e),
|
|
86
|
+
onClick: () => k(e.onClick, n),
|
|
87
|
+
children: F(e)
|
|
88
|
+
}) }, t) : e.nonInteractive ? /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c("div", {
|
|
89
|
+
className: "pkt-searchinput__suggestion",
|
|
90
|
+
children: F(e)
|
|
91
|
+
}) }, t) : /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c("button", {
|
|
92
|
+
type: "button",
|
|
93
|
+
className: I(e),
|
|
94
|
+
onClick: () => k(e.onClick, n),
|
|
95
|
+
children: F(e)
|
|
96
|
+
}) }, t))
|
|
97
|
+
})
|
|
98
|
+
] }));
|
|
99
|
+
});
|
|
100
|
+
u.displayName = "PktSearchInput";
|
|
101
|
+
//#endregion
|
|
102
|
+
export { u as PktSearchInput };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SELECT_DEFAULTS as e } from "../../shared-types/select.js";
|
|
3
|
+
import { useGeneratedId as t } from "../../hooks/useGeneratedId.js";
|
|
4
|
+
import { describedByIds as n } from "../../shared-utils/forms/described-by.js";
|
|
5
|
+
import { PktInputWrapper as r } from "../inputwrapper/InputWrapper.js";
|
|
6
|
+
import { forwardRef as i } from "react";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/select/Select.tsx
|
|
9
|
+
var o = i(({ ariaDescribedby: i, ariaLabelledby: o, children: s, className: c, disabled: l = e.disabled, errorMessage: u, hasError: d = e.hasError, helptext: f, helptextDropdown: p, helptextDropdownButton: m, id: h, inline: g = e.inline, fullwidth: _ = e.fullwidth, label: v, name: y, optionalTag: b = e.optionalTag, optionalText: x, requiredTag: S = e.requiredTag, requiredText: C, tagText: w, useWrapper: T = e.useWrapper, hasFieldset: E, inputSize: D = e.inputSize, strings: O, ...k }, A) => {
|
|
10
|
+
let j = t(h), M = [c, "pkt-select"].filter(Boolean).join(" ");
|
|
11
|
+
return /* @__PURE__ */ a("div", {
|
|
12
|
+
className: M,
|
|
13
|
+
children: /* @__PURE__ */ a(r, {
|
|
14
|
+
strings: O,
|
|
15
|
+
forId: `${j}-input`,
|
|
16
|
+
label: v,
|
|
17
|
+
helptext: f,
|
|
18
|
+
helptextDropdown: p,
|
|
19
|
+
helptextDropdownButton: m,
|
|
20
|
+
optionalTag: b,
|
|
21
|
+
optionalText: x,
|
|
22
|
+
requiredTag: S,
|
|
23
|
+
requiredText: C,
|
|
24
|
+
tagText: w,
|
|
25
|
+
hasError: d,
|
|
26
|
+
errorMessage: u,
|
|
27
|
+
disabled: l,
|
|
28
|
+
inline: g,
|
|
29
|
+
ariaDescribedby: i,
|
|
30
|
+
useWrapper: T,
|
|
31
|
+
hasFieldset: E ?? !1,
|
|
32
|
+
size: D,
|
|
33
|
+
children: /* @__PURE__ */ a("select", {
|
|
34
|
+
ref: A,
|
|
35
|
+
className: `pkt-input pkt-input--${D} ${_ ? "pkt-input--fullwidth" : ""}`,
|
|
36
|
+
"aria-invalid": d,
|
|
37
|
+
"aria-errormessage": d ? `${j}-error` : void 0,
|
|
38
|
+
"aria-describedby": n({
|
|
39
|
+
id: `${j}-input`,
|
|
40
|
+
hasHelptext: !!f,
|
|
41
|
+
hasCounter: !1,
|
|
42
|
+
ariaDescribedby: i
|
|
43
|
+
}),
|
|
44
|
+
"aria-labelledby": o || void 0,
|
|
45
|
+
disabled: l,
|
|
46
|
+
id: `${j}-input`,
|
|
47
|
+
name: y || j,
|
|
48
|
+
...k,
|
|
49
|
+
children: s
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
o.displayName = "PktSelect";
|
|
55
|
+
//#endregion
|
|
56
|
+
export { o as PktSelect };
|