@oslokommune/punkt-react 19.15.6 → 19.16.1
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 +30 -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.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 -9388
- 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/hydration.test.tsx +61 -15
- 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/link/Link.tsx +0 -2
- package/src/components/radio/RadioButton.tsx +2 -0
- package/src/components/server-components.test.ts +69 -0
- 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/hydration.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,78 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/stepper/Step.tsx
|
|
5
|
+
var i = /* @__PURE__ */ e(t(), 1), a = /* @__PURE__ */ n("svg", {
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: "24",
|
|
8
|
+
height: "24",
|
|
9
|
+
fill: "none",
|
|
10
|
+
children: /* @__PURE__ */ n("circle", {
|
|
11
|
+
cx: "12",
|
|
12
|
+
cy: "12",
|
|
13
|
+
r: "7",
|
|
14
|
+
style: { fill: "var(--pkt-color-brand-neutrals-300, #CCC)" }
|
|
15
|
+
})
|
|
16
|
+
}), o = /* @__PURE__ */ r("svg", {
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
width: "24",
|
|
19
|
+
height: "24",
|
|
20
|
+
fill: "none",
|
|
21
|
+
children: [/* @__PURE__ */ n("circle", {
|
|
22
|
+
opacity: ".15",
|
|
23
|
+
cx: "12",
|
|
24
|
+
cy: "12",
|
|
25
|
+
r: "12",
|
|
26
|
+
fill: "#2A2859"
|
|
27
|
+
}), /* @__PURE__ */ n("circle", {
|
|
28
|
+
cx: "12",
|
|
29
|
+
cy: "12",
|
|
30
|
+
r: "6",
|
|
31
|
+
fill: "#2A2859"
|
|
32
|
+
})]
|
|
33
|
+
}), s = /* @__PURE__ */ r("svg", {
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
+
width: "24",
|
|
36
|
+
height: "24",
|
|
37
|
+
fill: "none",
|
|
38
|
+
children: [/* @__PURE__ */ n("path", {
|
|
39
|
+
fill: "#2A2859",
|
|
40
|
+
d: "M3 3h18v18H3z"
|
|
41
|
+
}), /* @__PURE__ */ n("path", {
|
|
42
|
+
d: "m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",
|
|
43
|
+
fill: "#F1FDFF"
|
|
44
|
+
})]
|
|
45
|
+
}), c = ({ children: e, className: t, status: c = "incomplete", title: l }) => /* @__PURE__ */ r("li", {
|
|
46
|
+
className: (0, i.default)("pkt-step", t, `pkt-step--${c}`),
|
|
47
|
+
"data-testid": "pkt-step",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ n("span", {
|
|
50
|
+
className: "pkt-step__line pkt-step__line--1",
|
|
51
|
+
"aria-hidden": !0
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ n("span", {
|
|
54
|
+
className: "pkt-step__line pkt-step__line--2",
|
|
55
|
+
"aria-hidden": !0
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ n("span", {
|
|
58
|
+
className: (0, i.default)("pkt-step__indicator"),
|
|
59
|
+
children: c === "current" ? o : c === "completed" ? s : a
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ n("span", {
|
|
62
|
+
className: "pkt-step__line pkt-step__line--3",
|
|
63
|
+
"aria-hidden": !0
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ r("div", {
|
|
66
|
+
className: "pkt-step__wrapper",
|
|
67
|
+
children: [/* @__PURE__ */ n("div", {
|
|
68
|
+
className: "pkt-step__title",
|
|
69
|
+
children: l
|
|
70
|
+
}), /* @__PURE__ */ n("div", {
|
|
71
|
+
className: "pkt-step__content",
|
|
72
|
+
children: e
|
|
73
|
+
})]
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
//#endregion
|
|
78
|
+
export { c as PktStep };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { Children as n, cloneElement as r, forwardRef as i, isValidElement as a } from "react";
|
|
4
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/stepper/Stepper.tsx
|
|
6
|
+
var s = /* @__PURE__ */ e(t(), 1), c = i(({ activeStep: e, className: t, children: i, hideNonActiveSteps: c = !1, hideNonActiveStepsContent: l = !0, orientation: u = "vertical", ...d }, f) => {
|
|
7
|
+
let p = (0, s.default)(t, "pkt-stepper", u === "horizontal" ? "pkt-stepper--horizontal" : "pkt-stepper--vertical"), m = n.map(i, (t, n) => a(t) ? r(t, { className: (0, s.default)(t.props.className, {
|
|
8
|
+
"pkt-step--hideStep": c && n !== e,
|
|
9
|
+
"pkt-step--hideContent": l && n !== e
|
|
10
|
+
}) }) : t);
|
|
11
|
+
return /* @__PURE__ */ o("ol", {
|
|
12
|
+
"data-testid": "pkt-stepper",
|
|
13
|
+
className: p,
|
|
14
|
+
ref: f,
|
|
15
|
+
...d,
|
|
16
|
+
children: m
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
c.displayName = "PktStepper";
|
|
20
|
+
//#endregion
|
|
21
|
+
export { c as PktStepper };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, useContext as t, useMemo as n } from "react";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/strings/PktStringsProvider.tsx
|
|
5
|
+
var i = e(void 0), a = ({ strings: e, children: a }) => {
|
|
6
|
+
let o = t(i), s = n(() => {
|
|
7
|
+
if (!o) return e;
|
|
8
|
+
let t = { ...o };
|
|
9
|
+
for (let n of Object.keys(e)) t[n] = {
|
|
10
|
+
...t[n],
|
|
11
|
+
...e[n]
|
|
12
|
+
};
|
|
13
|
+
return t;
|
|
14
|
+
}, [o, e]);
|
|
15
|
+
return /* @__PURE__ */ r(i.Provider, {
|
|
16
|
+
value: s,
|
|
17
|
+
children: a
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { i as PktStringsContext, a as PktStringsProvider };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { TABLE_DEFAULTS as t } from "../../shared-types/table.js";
|
|
3
|
+
import { require_classnames as n } from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/table/Table.tsx
|
|
6
|
+
var i = /* @__PURE__ */ e(n(), 1), a = ({ className: e, compact: n = t.compact, skin: a = t.skin, responsiveView: o = t.responsiveView, children: s, ...c }) => /* @__PURE__ */ r("table", {
|
|
7
|
+
"data-testid": "pkt-table",
|
|
8
|
+
className: (0, i.default)(e, "pkt-table", {
|
|
9
|
+
"pkt-table--responsive": o,
|
|
10
|
+
"pkt-table--compact": n,
|
|
11
|
+
"pkt-table--basic": a === "basic",
|
|
12
|
+
"pkt-table--zebra-blue": a === "zebra-blue"
|
|
13
|
+
}),
|
|
14
|
+
role: "table",
|
|
15
|
+
...c,
|
|
16
|
+
children: s
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { a as PktTable };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/table/TableBody.tsx
|
|
5
|
+
var r = /* @__PURE__ */ e(t(), 1), i = ({ id: e, children: t, className: i, ...a }) => /* @__PURE__ */ n("tbody", {
|
|
6
|
+
id: e,
|
|
7
|
+
className: (0, r.default)(i, "pkt-table__body", {}),
|
|
8
|
+
role: "rowgroup",
|
|
9
|
+
...a,
|
|
10
|
+
children: t
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { i as PktTableBody };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/table/TableDataCell.tsx
|
|
5
|
+
var r = /* @__PURE__ */ e(t(), 1), i = ({ children: e, className: t, dataLabel: i, ...a }) => /* @__PURE__ */ n("td", {
|
|
6
|
+
className: (0, r.default)(t, "pkt-table__data-cell", {}),
|
|
7
|
+
"data-label": i,
|
|
8
|
+
role: "cell",
|
|
9
|
+
"data-testid": "pkt-table__data-cell",
|
|
10
|
+
...a,
|
|
11
|
+
children: e
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as PktTableDataCell };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/table/TableHeader.tsx
|
|
5
|
+
var r = /* @__PURE__ */ e(t(), 1), i = ({ className: e, children: t, ...i }) => /* @__PURE__ */ n("thead", {
|
|
6
|
+
className: (0, r.default)(e, "pkt-table__header", {}),
|
|
7
|
+
role: "rowgroup",
|
|
8
|
+
...i,
|
|
9
|
+
children: t
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { i as PktTableHeader };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/table/TableHeaderCell.tsx
|
|
5
|
+
var r = /* @__PURE__ */ e(t(), 1), i = ({ className: e, children: t, ...i }) => /* @__PURE__ */ n("th", {
|
|
6
|
+
className: (0, r.default)(e, "pkt-table__header-cell", {}),
|
|
7
|
+
role: "columnheader",
|
|
8
|
+
...i,
|
|
9
|
+
children: t
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { i as PktTableHeaderCell };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/table/TableRow.tsx
|
|
5
|
+
var r = /* @__PURE__ */ e(t(), 1), i = ({ className: e, children: t, ...i }) => /* @__PURE__ */ n("tr", {
|
|
6
|
+
className: (0, r.default)(e, "pkt-table__row", {}),
|
|
7
|
+
role: "row",
|
|
8
|
+
...i,
|
|
9
|
+
children: t
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { i as PktTableRow };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PktIcon as e } from "../icon/Icon.js";
|
|
3
|
+
import { PktTag as t } from "../tag/Tag.js";
|
|
4
|
+
import { useTabsContext as n } from "./Tabs.js";
|
|
5
|
+
import { forwardRef as r } from "react";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/tabs/TabItem.tsx
|
|
8
|
+
var s = r(({ children: r, active: s, disabled: c = !1, href: l, onClick: u, icon: d, controls: f, tag: p, tagSkin: m, index: h = 0 }, g) => {
|
|
9
|
+
let { arrowNav: _, registerTabRef: v, handleKeyPress: y, selectTab: b } = n(), x = !!s && !c, S = {
|
|
10
|
+
"aria-selected": _ ? x : void 0,
|
|
11
|
+
"aria-controls": f,
|
|
12
|
+
role: _ ? "tab" : void 0,
|
|
13
|
+
onKeyDown: (e) => {
|
|
14
|
+
if (c && (e.key === "Enter" || e.key === " " || e.key === "Spacebar")) {
|
|
15
|
+
e.preventDefault(), e.stopPropagation();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
y(h, e);
|
|
19
|
+
},
|
|
20
|
+
onClick: (e) => {
|
|
21
|
+
if (c) {
|
|
22
|
+
e.preventDefault(), e.stopPropagation();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
b(h), u?.(e);
|
|
26
|
+
},
|
|
27
|
+
tabIndex: c ? -1 : x || !_ ? void 0 : -1,
|
|
28
|
+
ref: (e) => {
|
|
29
|
+
v(h, e, c), typeof g == "function" ? g(e) : g && (g.current = e);
|
|
30
|
+
}
|
|
31
|
+
}, C = /* @__PURE__ */ o(i, { children: [
|
|
32
|
+
d && /* @__PURE__ */ a(e, {
|
|
33
|
+
name: d,
|
|
34
|
+
className: `pkt-icon--small ${d === "check" ? "pkt-tabs__status-icon" : ""}`
|
|
35
|
+
}),
|
|
36
|
+
r,
|
|
37
|
+
p && /* @__PURE__ */ a(t, {
|
|
38
|
+
skin: m,
|
|
39
|
+
size: "small",
|
|
40
|
+
children: p
|
|
41
|
+
})
|
|
42
|
+
] });
|
|
43
|
+
return l ? /* @__PURE__ */ a("a", {
|
|
44
|
+
...S,
|
|
45
|
+
href: c ? void 0 : l,
|
|
46
|
+
"aria-disabled": c || void 0,
|
|
47
|
+
className: `pkt-tabs__link ${x ? "active" : ""} ${c ? "pkt-tabs__item--disabled" : ""}`,
|
|
48
|
+
children: C
|
|
49
|
+
}) : /* @__PURE__ */ a("button", {
|
|
50
|
+
...S,
|
|
51
|
+
type: "button",
|
|
52
|
+
disabled: c,
|
|
53
|
+
"aria-disabled": c || void 0,
|
|
54
|
+
className: `pkt-tabs__button pkt-link-button ${x ? "active" : ""} ${c ? "pkt-tabs__item--disabled" : ""}`,
|
|
55
|
+
children: C
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
s.displayName = "PktTabItem";
|
|
59
|
+
//#endregion
|
|
60
|
+
export { s as PktTabItem };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PktIcon as e } from "../icon/Icon.js";
|
|
3
|
+
import { withStableKeys as t } from "../../utils/stableKeys.js";
|
|
4
|
+
import { PktTabItem as n } from "./TabItem.js";
|
|
5
|
+
import { Children as r, createContext as i, forwardRef as a, useContext as o, useEffect as s, useRef as c } from "react";
|
|
6
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/tabs/Tabs.tsx
|
|
8
|
+
var u = i(null), d = () => {
|
|
9
|
+
let e = o(u);
|
|
10
|
+
if (!e) throw Error("TabItem must be used within a Tabs component");
|
|
11
|
+
return e;
|
|
12
|
+
}, f = a(({ arrowNav: i = !0, disableArrowNav: a = !1, separatorIconName: o, separatorIconPath: d, tabs: f, onTabSelected: p, children: m }, h) => {
|
|
13
|
+
let g = c([]), _ = c({}), v = i && !a, y = r.toArray(m), b = y.length > 0, x = b ? y.length : f?.length || 0, S = !!(o || d);
|
|
14
|
+
s(() => {
|
|
15
|
+
g.current = g.current.slice(0, x), Object.keys(_.current).forEach((e) => {
|
|
16
|
+
let t = Number(e);
|
|
17
|
+
t >= x && delete _.current[t];
|
|
18
|
+
});
|
|
19
|
+
}, [x]);
|
|
20
|
+
let C = (e) => f ? !!f[e]?.disabled : !!_.current[e], w = (e) => {
|
|
21
|
+
if (C(e)) return;
|
|
22
|
+
let t = f?.[e];
|
|
23
|
+
t?.action && t.action(e), p && p(e);
|
|
24
|
+
}, T = (e, t) => {
|
|
25
|
+
let n = e + t;
|
|
26
|
+
for (; n >= 0 && n < x;) {
|
|
27
|
+
if (!C(n)) return n;
|
|
28
|
+
n += t;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}, E = (e, t) => {
|
|
32
|
+
if (v) {
|
|
33
|
+
if (t.key === "ArrowLeft") {
|
|
34
|
+
t.preventDefault();
|
|
35
|
+
let n = T(e, -1);
|
|
36
|
+
n !== null && g.current[n]?.focus();
|
|
37
|
+
}
|
|
38
|
+
if (t.key === "ArrowRight") {
|
|
39
|
+
t.preventDefault();
|
|
40
|
+
let n = T(e, 1);
|
|
41
|
+
n !== null && g.current[n]?.focus();
|
|
42
|
+
}
|
|
43
|
+
(t.key === "Enter" || t.key === " " || t.key === "Spacebar" || t.key === "ArrowDown") && (t.preventDefault(), C(e) || w(e));
|
|
44
|
+
}
|
|
45
|
+
}, D = (e, t, n = !1) => {
|
|
46
|
+
g.current[e] = t, _.current[e] = n;
|
|
47
|
+
}, O = (t) => /* @__PURE__ */ l("span", {
|
|
48
|
+
className: "pkt-tabs__separator",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
role: "presentation",
|
|
51
|
+
children: d ? /* @__PURE__ */ l("img", {
|
|
52
|
+
src: d,
|
|
53
|
+
alt: "",
|
|
54
|
+
"aria-hidden": "true"
|
|
55
|
+
}) : o ? /* @__PURE__ */ l(e, {
|
|
56
|
+
name: o,
|
|
57
|
+
className: "pkt-tabs__separator-icon"
|
|
58
|
+
}) : null
|
|
59
|
+
}, t), k = (e) => !S || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, O(`separator-${n}`)] : [t]), A = t(f ?? [], (e) => `${e.href ?? ""}|${e.text}`).map(({ item: e, key: t }, r) => /* @__PURE__ */ l(n, {
|
|
60
|
+
active: !e.disabled && e.active,
|
|
61
|
+
disabled: e.disabled,
|
|
62
|
+
href: e.href,
|
|
63
|
+
icon: e.icon,
|
|
64
|
+
controls: e.controls,
|
|
65
|
+
tag: e.tag?.text,
|
|
66
|
+
tagSkin: e.tag?.skin,
|
|
67
|
+
index: r,
|
|
68
|
+
children: e.text
|
|
69
|
+
}, t)), j = ["pkt-tabs", S && "pkt-tabs--with-separator"].filter(Boolean).join(" "), M = k(b ? y : A || []);
|
|
70
|
+
return /* @__PURE__ */ l(u.Provider, {
|
|
71
|
+
value: {
|
|
72
|
+
arrowNav: v,
|
|
73
|
+
registerTabRef: D,
|
|
74
|
+
handleKeyPress: E,
|
|
75
|
+
selectTab: w
|
|
76
|
+
},
|
|
77
|
+
children: /* @__PURE__ */ l("div", {
|
|
78
|
+
className: j,
|
|
79
|
+
ref: h,
|
|
80
|
+
children: /* @__PURE__ */ l("div", {
|
|
81
|
+
className: "pkt-tabs__list",
|
|
82
|
+
role: v ? "tablist" : "navigation",
|
|
83
|
+
children: M
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
f.displayName = "PktTabs";
|
|
89
|
+
//#endregion
|
|
90
|
+
export { f as PktTabs, d as useTabsContext };
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { formatString as r } from "../../shared-strings/format.js";
|
|
6
|
+
import { usePktStrings as i } from "../../hooks/usePktStrings.js";
|
|
7
|
+
import { forwardRef as a, useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/tag/Tag.tsx
|
|
10
|
+
var p = /* @__PURE__ */ e(t(), 1), m = a(({ children: e, skin: t = "blue", textStyle: a, size: m = "medium", closeTag: h, className: g, iconName: _, ariaLabel: v, onClose: y, type: b = "button", "aria-description": x, strings: S, ...C }, w) => {
|
|
11
|
+
let [T, E] = u(!1), D = o(() => {
|
|
12
|
+
E(!0), y && y();
|
|
13
|
+
}, [y]), O = l(null), [k, A] = u("");
|
|
14
|
+
s(() => {
|
|
15
|
+
A(O.current?.textContent?.trim() ?? "");
|
|
16
|
+
}, [e]);
|
|
17
|
+
let j = i(["tag"], S), M = c(() => {
|
|
18
|
+
if (h && !v) return k && r(j.tag.remove, { label: k }) || x;
|
|
19
|
+
}, [
|
|
20
|
+
h,
|
|
21
|
+
v,
|
|
22
|
+
k,
|
|
23
|
+
x,
|
|
24
|
+
j
|
|
25
|
+
]), N = {
|
|
26
|
+
"pkt-tag": !0,
|
|
27
|
+
[`pkt-tag--${m}`]: !!m,
|
|
28
|
+
[`pkt-tag--${t}`]: !!t,
|
|
29
|
+
[`pkt-tag--${a}`]: !!a
|
|
30
|
+
}, P = {
|
|
31
|
+
"pkt-tag": !0,
|
|
32
|
+
[`pkt-tag--${a}`]: !!a,
|
|
33
|
+
[`pkt-tag--${m}`]: !!m,
|
|
34
|
+
[`pkt-tag--${t}`]: !!t,
|
|
35
|
+
"pkt-hide": T
|
|
36
|
+
};
|
|
37
|
+
return h ? /* @__PURE__ */ f("button", {
|
|
38
|
+
...C,
|
|
39
|
+
className: (0, p.default)(P, g),
|
|
40
|
+
type: b,
|
|
41
|
+
onClick: D,
|
|
42
|
+
"aria-label": v,
|
|
43
|
+
"aria-description": M,
|
|
44
|
+
ref: w,
|
|
45
|
+
children: [
|
|
46
|
+
_ && /* @__PURE__ */ d(n, {
|
|
47
|
+
className: "pkt-tag__icon",
|
|
48
|
+
name: _,
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ d("span", {
|
|
52
|
+
ref: O,
|
|
53
|
+
children: e
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ d(n, {
|
|
56
|
+
className: "pkt-tag__close-btn",
|
|
57
|
+
name: "close"
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}) : /* @__PURE__ */ f("span", {
|
|
61
|
+
...C,
|
|
62
|
+
className: (0, p.default)(N, g),
|
|
63
|
+
ref: w,
|
|
64
|
+
children: [_ && /* @__PURE__ */ d(n, {
|
|
65
|
+
className: "pkt-tag__icon",
|
|
66
|
+
name: _,
|
|
67
|
+
"aria-hidden": "true"
|
|
68
|
+
}), /* @__PURE__ */ d("span", {
|
|
69
|
+
ref: O,
|
|
70
|
+
children: e
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
m.displayName = "PktTag";
|
|
75
|
+
//#endregion
|
|
76
|
+
export { m as PktTag };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGeneratedId as e } from "../../hooks/useGeneratedId.js";
|
|
3
|
+
import { describedByIds as t } from "../../shared-utils/forms/described-by.js";
|
|
4
|
+
import { PktInputWrapper as n } from "../inputwrapper/InputWrapper.js";
|
|
5
|
+
import { forwardRef as r, useState as i } from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/textarea/Textarea.tsx
|
|
8
|
+
var o = r(({ id: r, ariaDescribedby: o, ariaLabelledby: s, counter: c, hasFieldset: l, counterMaxLength: u, className: d, disabled: f, errorMessage: p, hasError: m = !1, helptext: h, helptextDropdown: g, helptextDropdownButton: _, inline: v, fullwidth: y = !1, label: b, name: x, optionalTag: S = !1, optionalText: C, requiredTag: w = !1, requiredText: T, tagText: E = null, placeholder: D, rows: O, useWrapper: k = !0, onChange: A, value: j, autoComplete: M = "off", minLength: N, maxLength: P, readOnly: F, skipForwardTestid: I = !1, inputSize: L = "medium", strings: R, ...z }, B) => {
|
|
9
|
+
let V = c ?? (u ?? 0) > 0, H = [
|
|
10
|
+
d,
|
|
11
|
+
"pkt-textinput",
|
|
12
|
+
"pkt-textarea"
|
|
13
|
+
].filter(Boolean).join(" "), U = e(r), W = `${U}-input`, G = `${W}-label`, K = s || G, [q, J] = i(0), Y = j === void 0 ? q : j?.length || 0, X = (e) => {
|
|
14
|
+
V && J(e.currentTarget?.value?.length || 0), A && A(e);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ a("div", {
|
|
17
|
+
className: H,
|
|
18
|
+
children: /* @__PURE__ */ a(n, {
|
|
19
|
+
strings: R,
|
|
20
|
+
ariaDescribedby: o,
|
|
21
|
+
disabled: f,
|
|
22
|
+
errorMessage: p,
|
|
23
|
+
forId: W,
|
|
24
|
+
hasError: m,
|
|
25
|
+
helptext: h,
|
|
26
|
+
helptextDropdown: g,
|
|
27
|
+
helptextDropdownButton: _,
|
|
28
|
+
inline: v,
|
|
29
|
+
label: b,
|
|
30
|
+
optionalTag: S,
|
|
31
|
+
optionalText: C,
|
|
32
|
+
requiredTag: w,
|
|
33
|
+
requiredText: T,
|
|
34
|
+
tagText: E,
|
|
35
|
+
useWrapper: k,
|
|
36
|
+
counter: V,
|
|
37
|
+
counterCurrent: Y,
|
|
38
|
+
counterMaxLength: u,
|
|
39
|
+
hasFieldset: l ?? !1,
|
|
40
|
+
size: L,
|
|
41
|
+
children: /* @__PURE__ */ a("textarea", {
|
|
42
|
+
ref: (e) => {
|
|
43
|
+
J(e?.value?.length || 0), typeof B == "function" ? B(e) : B && (B.current = e);
|
|
44
|
+
},
|
|
45
|
+
className: `pkt-input pkt-input--${L} ${y ? "pkt-input--fullwidth" : ""} ${u && Y > u ? "pkt-input--counter-error" : ""}`,
|
|
46
|
+
name: `${x || U}`,
|
|
47
|
+
id: W,
|
|
48
|
+
placeholder: D,
|
|
49
|
+
disabled: f,
|
|
50
|
+
rows: O,
|
|
51
|
+
"aria-labelledby": K,
|
|
52
|
+
"aria-invalid": m,
|
|
53
|
+
"aria-errormessage": m ? `${U}-error` : void 0,
|
|
54
|
+
"aria-describedby": t({
|
|
55
|
+
id: W,
|
|
56
|
+
hasHelptext: !!h,
|
|
57
|
+
hasCounter: V,
|
|
58
|
+
ariaDescribedby: o
|
|
59
|
+
}),
|
|
60
|
+
...z,
|
|
61
|
+
onChange: X,
|
|
62
|
+
value: j,
|
|
63
|
+
autoComplete: M,
|
|
64
|
+
minLength: N,
|
|
65
|
+
maxLength: P,
|
|
66
|
+
readOnly: F,
|
|
67
|
+
"data-skip-forward-testid": I ? "true" : void 0
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
o.displayName = "PktTextarea";
|
|
73
|
+
//#endregion
|
|
74
|
+
export { o as PktTextarea };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PktIcon as e } from "../icon/Icon.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, useState as a } from "react";
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/textinput/Textinput.tsx
|
|
9
|
+
var c = i(({ id: i, ariaDescribedby: c, ariaLabelledby: ee, autocomplete: te = "off", counter: l, hasFieldset: u, counterMaxLength: d, className: f, disabled: p = !1, errorMessage: m, hasError: h = !1, helptext: g, helptextDropdown: ne, helptextDropdownButton: re, iconNameRight: _, inline: ie = !1, fullwidth: v = !1, label: y, name: b, optionalTag: x = !1, optionalText: S, requiredTag: C = !1, requiredText: w, tagText: T = null, placeholder: E, prefix: D, suffix: O, type: k = "text", useWrapper: A = !0, omitSearchIcon: j = !1, value: M, minLength: N, maxLength: P, min: F, max: I, step: ae, size: L, readonly: R, required: z, dataTestid: B, onChange: V, skipForwardTestid: H = !1, inputSize: U = "medium", strings: W, ...G }, K) => {
|
|
10
|
+
let q = l ?? (d ?? 0) > 0, J = [f, "pkt-textinput"].filter(Boolean).join(" "), Y = k === "search" && !_ && !j, oe = k === "date" && M ? M.slice(0, 10) : M, [se, ce] = a(0), X = M === void 0 ? se : M?.length || 0, Z = t(i), Q = `${Z}`, le = `${Q}-label`, $ = ee || le, ue = (e) => {
|
|
11
|
+
q && ce(e.currentTarget?.value?.length || 0), V && V(e);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ o("div", {
|
|
14
|
+
className: J,
|
|
15
|
+
children: /* @__PURE__ */ o(r, {
|
|
16
|
+
strings: W,
|
|
17
|
+
ariaDescribedby: c,
|
|
18
|
+
disabled: p,
|
|
19
|
+
errorMessage: m,
|
|
20
|
+
forId: Q,
|
|
21
|
+
hasError: h,
|
|
22
|
+
helptext: g,
|
|
23
|
+
helptextDropdown: ne,
|
|
24
|
+
helptextDropdownButton: re,
|
|
25
|
+
inline: ie,
|
|
26
|
+
label: y,
|
|
27
|
+
optionalTag: x,
|
|
28
|
+
optionalText: S,
|
|
29
|
+
requiredTag: C,
|
|
30
|
+
requiredText: w,
|
|
31
|
+
tagText: T,
|
|
32
|
+
useWrapper: A,
|
|
33
|
+
counter: q,
|
|
34
|
+
counterCurrent: X,
|
|
35
|
+
counterMaxLength: d,
|
|
36
|
+
hasFieldset: u ?? !1,
|
|
37
|
+
size: U,
|
|
38
|
+
children: /* @__PURE__ */ s("div", {
|
|
39
|
+
className: `pkt-input__container pkt-input__container--${U}`,
|
|
40
|
+
"data-testid": B,
|
|
41
|
+
"data-skip-forward-testid": H ? "true" : void 0,
|
|
42
|
+
children: [
|
|
43
|
+
D && /* @__PURE__ */ o("div", {
|
|
44
|
+
className: "pkt-input-prefix",
|
|
45
|
+
children: D
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ o("input", {
|
|
48
|
+
...G,
|
|
49
|
+
ref: K,
|
|
50
|
+
className: `pkt-input pkt-input--${U} ${v ? "pkt-input--fullwidth" : ""} ${d && X > d ? "pkt-input--counter-error" : ""}`,
|
|
51
|
+
type: k,
|
|
52
|
+
name: `${b || Z}`,
|
|
53
|
+
value: oe,
|
|
54
|
+
id: Q,
|
|
55
|
+
placeholder: E,
|
|
56
|
+
autoComplete: te,
|
|
57
|
+
disabled: p,
|
|
58
|
+
"aria-invalid": h,
|
|
59
|
+
"aria-errormessage": h ? `${Z}-error` : void 0,
|
|
60
|
+
"aria-describedby": n({
|
|
61
|
+
id: Q,
|
|
62
|
+
hasHelptext: !!g,
|
|
63
|
+
hasCounter: q,
|
|
64
|
+
ariaDescribedby: c
|
|
65
|
+
}),
|
|
66
|
+
"aria-labelledby": $,
|
|
67
|
+
min: F,
|
|
68
|
+
max: I,
|
|
69
|
+
onChange: ue,
|
|
70
|
+
step: ae,
|
|
71
|
+
minLength: N,
|
|
72
|
+
maxLength: P,
|
|
73
|
+
size: L,
|
|
74
|
+
readOnly: R,
|
|
75
|
+
required: z
|
|
76
|
+
}),
|
|
77
|
+
O && /* @__PURE__ */ s("p", {
|
|
78
|
+
className: "pkt-input-suffix",
|
|
79
|
+
children: [
|
|
80
|
+
O,
|
|
81
|
+
_ && /* @__PURE__ */ o(e, {
|
|
82
|
+
className: "pkt-input-suffix-icon",
|
|
83
|
+
name: _
|
|
84
|
+
}),
|
|
85
|
+
Y && /* @__PURE__ */ o(e, {
|
|
86
|
+
className: "pkt-input-suffix-icon",
|
|
87
|
+
name: "magnifying-glass-big"
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}),
|
|
91
|
+
!O && _ && /* @__PURE__ */ o(e, {
|
|
92
|
+
className: "pkt-input-icon",
|
|
93
|
+
name: _
|
|
94
|
+
}),
|
|
95
|
+
!O && Y && /* @__PURE__ */ o(e, {
|
|
96
|
+
className: "pkt-input-icon",
|
|
97
|
+
name: "magnifying-glass-big"
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
c.displayName = "PktTextinput";
|
|
105
|
+
//#endregion
|
|
106
|
+
export { c as PktTextinput };
|