@dmsi/wedgekit-react 2.0.0 → 2.0.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/dist/classNames.js +150 -0
- package/dist/components/AccessCard.js +63 -0
- package/dist/components/AccessCardGroup.js +73 -0
- package/dist/components/AccessChangerTabItem.js +51 -0
- package/dist/components/Accordion.js +99 -0
- package/dist/components/Alert.js +78 -0
- package/dist/components/Breadcrumbs.js +111 -0
- package/dist/components/Button.js +137 -0
- package/dist/components/CalendarRange.js +405 -0
- package/dist/components/Caption.js +99 -0
- package/dist/components/Card.js +50 -0
- package/dist/components/Checkbox.js +108 -0
- package/dist/components/CompactImagesPreview.js +120 -0
- package/dist/components/ContentTab.js +68 -0
- package/dist/components/ContentTabs.js +96 -0
- package/dist/components/DMSiLogo.js +54 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +27 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +79 -0
- package/dist/components/DataGrid/PinnedColumns.js +165 -0
- package/dist/components/DataGrid/SummaryRow/SummaryCell.js +51 -0
- package/dist/components/DataGrid/SummaryRow/aggregations.js +55 -0
- package/dist/components/DataGrid/SummaryRow/index.js +86 -0
- package/dist/components/DataGrid/TableBody/GroupRow.js +243 -0
- package/dist/components/DataGrid/TableBody/LoadingCell.js +33 -0
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +136 -0
- package/dist/components/DataGrid/TableBody/index.js +161 -0
- package/dist/components/DataGrid/index.js +696 -0
- package/dist/components/DataGrid/utils.js +20 -0
- package/dist/components/DataGridCell.js +412 -0
- package/dist/components/DataTable.js +700 -0
- package/dist/components/DateInput.js +193 -0
- package/dist/components/DateRangeInput.js +368 -0
- package/dist/components/DebugJson.js +28 -0
- package/dist/components/Display.js +46 -0
- package/dist/components/EditingContext.js +34 -0
- package/dist/components/EmblaCarousel/ArrowButtons.js +83 -0
- package/dist/components/EmblaCarousel/SelectedSnapDisplay.js +12 -0
- package/dist/components/EmblaCarousel/index.js +153 -0
- package/dist/components/EmblaCarousel/usePrevNextButtons.js +21 -0
- package/dist/components/EmblaCarousel/useSelectedSnapDisplay.js +15 -0
- package/dist/components/EmptyCartIcon.js +25 -0
- package/dist/components/FilterGroup.js +198 -0
- package/dist/components/FullViewportBox.js +19 -0
- package/dist/components/Grid.js +54 -0
- package/dist/components/Heading.js +50 -0
- package/dist/components/HorizontalDivider.js +20 -0
- package/dist/components/Icon.js +73 -0
- package/dist/components/ImagePlaceholder.js +22 -0
- package/dist/components/Input.js +469 -0
- package/dist/components/InputGroup.js +45 -0
- package/dist/components/Label.js +37 -0
- package/dist/components/Link.js +69 -0
- package/dist/components/List.js +12 -0
- package/dist/components/ListGroup.js +54 -0
- package/dist/components/LiveChatComponent.js +25 -0
- package/dist/components/LoadingScrim.js +22 -0
- package/dist/components/LogoAgilityTopBar.js +90 -0
- package/dist/components/LogoDMSiTopBar.js +54 -0
- package/dist/components/LogoMillworkTopBar.js +196 -0
- package/dist/components/MainBar.js +58 -0
- package/dist/components/MaxViewportBox.js +19 -0
- package/dist/components/Menu.js +202 -0
- package/dist/components/MenuOption.js +161 -0
- package/dist/components/MobileDataGrid/ColumnList.js +85 -0
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +100 -0
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts.map +1 -1
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +6 -0
- package/dist/components/MobileDataGrid/GridContextProvider/index.js +80 -0
- package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.js +11 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +18 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +130 -0
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +67 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +42 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +58 -0
- package/dist/components/MobileDataGrid/dataGridReducer.js +28 -0
- package/dist/components/MobileDataGrid/index.js +78 -0
- package/dist/components/MobileNavMenu.js +173 -0
- package/dist/components/Modal.js +201 -0
- package/dist/components/ModalButtons.js +57 -0
- package/dist/components/ModalContent.js +24 -0
- package/dist/components/ModalHeader.js +74 -0
- package/dist/components/ModalScrim.js +32 -0
- package/dist/components/NavigationTab.js +72 -0
- package/dist/components/NavigationTabs.js +45 -0
- package/dist/components/NestedMenu.js +119 -0
- package/dist/components/Notification.js +91 -0
- package/dist/components/OptionPill.js +103 -0
- package/dist/components/OrderCheckIcon.js +28 -0
- package/dist/components/PDFViewer/DownloadIcon.js +25 -0
- package/dist/components/PDFViewer/PDFElement.js +77 -0
- package/dist/components/PDFViewer/PDFNavigation.js +64 -0
- package/dist/components/PDFViewer/PDFPage.js +28 -0
- package/dist/components/PDFViewer/index.js +124 -0
- package/dist/components/Pagination.js +117 -0
- package/dist/components/Paragraph.js +43 -0
- package/dist/components/Password.js +47 -0
- package/dist/components/ProductImagePreview/CarouselPagination.js +48 -0
- package/dist/components/ProductImagePreview/MobileImageCarousel.js +146 -0
- package/dist/components/ProductImagePreview/ProductPrimaryImage.js +138 -0
- package/dist/components/ProductImagePreview/Thumbnail.js +46 -0
- package/dist/components/ProductImagePreview/ZoomWindow.js +74 -0
- package/dist/components/ProductImagePreview/index.js +189 -0
- package/dist/components/ProductImagePreview/useProductImagePreview.js +85 -0
- package/dist/components/ProjectBar.js +54 -0
- package/dist/components/Radio.js +113 -0
- package/dist/components/Search.js +89 -0
- package/dist/components/SearchResultImage/index.js +26 -0
- package/dist/components/Select.js +122 -0
- package/dist/components/SideMenu.js +24 -0
- package/dist/components/SideMenuGroup.js +80 -0
- package/dist/components/SideMenuItem.js +79 -0
- package/dist/components/SimpleTable.js +60 -0
- package/dist/components/SkeletonParagraph.js +24 -0
- package/dist/components/Spinner.js +30 -0
- package/dist/components/Stack.js +174 -0
- package/dist/components/StatusPill.js +44 -0
- package/dist/components/Stepper.js +138 -0
- package/dist/components/Subheader.js +41 -0
- package/dist/components/Surface.js +30 -0
- package/dist/components/Swatch.js +1498 -0
- package/dist/components/Textarea.js +106 -0
- package/dist/components/Theme.js +25 -0
- package/dist/components/Time.js +225 -0
- package/dist/components/Toast.js +170 -0
- package/dist/components/Tooltip.js +102 -0
- package/dist/components/TopBar.js +119 -0
- package/dist/components/Upload.js +107 -0
- package/dist/components/WorldpayIframe.js +19 -0
- package/dist/hooks/useEditCell.js +23 -0
- package/dist/hooks/useInfiniteScroll.js +25 -0
- package/dist/hooks/useKeydown.js +20 -0
- package/dist/hooks/useMatchesMedia.js +15 -0
- package/dist/hooks/useMenuSystem.js +186 -0
- package/dist/hooks/useMounted.js +9 -0
- package/dist/hooks/useTableLayout/computeColumns.js +59 -0
- package/dist/hooks/useTableLayout/storage.js +64 -0
- package/dist/hooks/useTableLayout/useTableLayout.js +163 -0
- package/dist/index.js +249 -53839
- package/dist/lib/loadFonts.js +11 -0
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +2299 -0
- package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +367 -0
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
- package/dist/node_modules/@headlessui/react/dist/components/description/description.js +45 -0
- package/dist/node_modules/@headlessui/react/dist/components/keyboard.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/components/label/label.js +62 -0
- package/dist/node_modules/@headlessui/react/dist/components/switch/switch.js +56 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-active-press.js +33 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js +10 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-default-value.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js +9 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js +9 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js +12 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-slot.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js +16 -0
- package/dist/node_modules/@headlessui/react/dist/internal/disabled.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/internal/form-fields.js +35 -0
- package/dist/node_modules/@headlessui/react/dist/internal/hidden.js +13 -0
- package/dist/node_modules/@headlessui/react/dist/internal/id.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/bugs.js +19 -0
- package/dist/node_modules/@headlessui/react/dist/utils/class-names.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/utils/disposables.js +40 -0
- package/dist/node_modules/@headlessui/react/dist/utils/dom.js +34 -0
- package/dist/node_modules/@headlessui/react/dist/utils/env.js +34 -0
- package/dist/node_modules/@headlessui/react/dist/utils/form.js +32 -0
- package/dist/node_modules/@headlessui/react/dist/utils/match.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/owner.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/render.js +126 -0
- package/dist/node_modules/@js-temporal/polyfill/dist/index.esm.js +3913 -0
- package/dist/node_modules/@mikecousins/react-pdf/dist/index.js +83 -0
- package/dist/node_modules/@react-aria/focus/dist/useFocusRing.js +38 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocus.js +31 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +99 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.js +59 -0
- package/dist/node_modules/@react-aria/interactions/dist/useHover.js +86 -0
- package/dist/node_modules/@react-aria/interactions/dist/utils.js +68 -0
- package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +32 -0
- package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +15 -0
- package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +45 -0
- package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +7 -0
- package/dist/node_modules/@react-aria/utils/dist/openLink.js +28 -0
- package/dist/node_modules/@react-aria/utils/dist/platform.js +47 -0
- package/dist/node_modules/@react-aria/utils/dist/useGlobalListeners.js +34 -0
- package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +6 -0
- package/dist/node_modules/@react-stately/flags/dist/import.js +7 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.js +94 -0
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +38 -0
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1954 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +575 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
- package/dist/node_modules/clsx/dist/clsx.js +17 -0
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1204 -0
- package/dist/node_modules/embla-carousel-autoplay/esm/embla-carousel-autoplay.esm.js +126 -0
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +24 -0
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +35 -0
- package/dist/node_modules/jsbi/dist/jsbi.js +1040 -0
- package/dist/node_modules/react-use/esm/usePrevious.js +10 -0
- package/dist/static/no-results-image.png.js +4 -0
- package/dist/utils/date-patch-dashes.js +28 -0
- package/dist/utils/date.js +95 -0
- package/dist/utils/formatting.js +22 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/mergeObjectArrays.js +18 -0
- package/dist/utils.js +20 -0
- package/package.json +1 -1
- /package/dist/{pdf-l6QfMa5e.js → node_modules/pdfjs-dist/build/pdf.js} +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as d } from "../node_modules/clsx/dist/clsx.js";
|
|
3
|
+
const y = [
|
|
4
|
+
"icon-primary-normal",
|
|
5
|
+
"icon-primary-disabled",
|
|
6
|
+
"icon-success-normal",
|
|
7
|
+
"icon-success-disabled",
|
|
8
|
+
"icon-warning-normal",
|
|
9
|
+
"icon-warning-disabled",
|
|
10
|
+
"icon-critical-normal",
|
|
11
|
+
"icon-critical-disabled",
|
|
12
|
+
"icon-action-primary-normal",
|
|
13
|
+
"icon-action-primary-hover",
|
|
14
|
+
"icon-action-primary-active",
|
|
15
|
+
"icon-action-primary-disabled",
|
|
16
|
+
"icon-action-secondary-normal",
|
|
17
|
+
"icon-action-secondary-hover",
|
|
18
|
+
"icon-action-secondary-active",
|
|
19
|
+
"icon-action-secondary-disabled",
|
|
20
|
+
"icon-on-action-primary-normal",
|
|
21
|
+
"icon-on-action-primary-hover",
|
|
22
|
+
"icon-on-action-primary-active",
|
|
23
|
+
"icon-on-action-primary-disabled",
|
|
24
|
+
"icon-on-action-secondary-normal",
|
|
25
|
+
"icon-on-action-secondary-hover",
|
|
26
|
+
"icon-on-action-secondary-active",
|
|
27
|
+
"icon-on-action-secondary-disabled",
|
|
28
|
+
"icon-action-critical-normal",
|
|
29
|
+
"icon-action-critical-hover",
|
|
30
|
+
"icon-action-critical-active",
|
|
31
|
+
"icon-action-critical-disabled",
|
|
32
|
+
"icon-action-critical-secondary-normal",
|
|
33
|
+
"icon-action-critical-secondary-hover",
|
|
34
|
+
"icon-action-critical-secondary-active",
|
|
35
|
+
"icon-action-critical-secondary-disabled",
|
|
36
|
+
"icon-brand-primary-normal",
|
|
37
|
+
"icon-brand-primary-hover",
|
|
38
|
+
"icon-brand-primary-active",
|
|
39
|
+
"icon-brand-primary-disabled"
|
|
40
|
+
];
|
|
41
|
+
function v({
|
|
42
|
+
name: o,
|
|
43
|
+
size: c = 24,
|
|
44
|
+
variant: a = "outline",
|
|
45
|
+
color: n,
|
|
46
|
+
testid: r,
|
|
47
|
+
...i
|
|
48
|
+
}) {
|
|
49
|
+
const t = a === "filled" ? '"FILL" 1' : '"FILL" 0', e = c === 16 ? '"wght" 400' : '"wght" 300';
|
|
50
|
+
return /* @__PURE__ */ l(
|
|
51
|
+
"span",
|
|
52
|
+
{
|
|
53
|
+
...i,
|
|
54
|
+
"data-testid": r,
|
|
55
|
+
className: d(
|
|
56
|
+
"icon",
|
|
57
|
+
`icon-${c}`,
|
|
58
|
+
// size === 16 ? "font-normal" : "font-light", // size 16 font weight is not working as normal from before
|
|
59
|
+
i.className
|
|
60
|
+
),
|
|
61
|
+
style: {
|
|
62
|
+
color: n ? `var(--color-${n})` : void 0,
|
|
63
|
+
fontVariationSettings: t + `, ${e}`,
|
|
64
|
+
...i.style
|
|
65
|
+
},
|
|
66
|
+
children: o
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
y as ICON_COLORS,
|
|
72
|
+
v as Icon
|
|
73
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as e, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useId as l } from "react";
|
|
3
|
+
function c(i) {
|
|
4
|
+
const h = l();
|
|
5
|
+
return /* @__PURE__ */ e(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
width: 242,
|
|
10
|
+
height: 243,
|
|
11
|
+
fill: "none",
|
|
12
|
+
...i,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ t("g", { clipPath: `url(#${h})`, children: /* @__PURE__ */ t("rect", { width: i.width, height: i.width, fill: "#F7F7F7", rx: 2 }) }),
|
|
15
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ t("clipPath", { id: h, children: /* @__PURE__ */ t("rect", { width: i.width, height: i.width, fill: "#fff", rx: 2 }) }) })
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
c as ImagePlaceholder
|
|
22
|
+
};
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s, jsxs as O } from "react/jsx-runtime";
|
|
3
|
+
import { useState as Z, useRef as Y, useEffect as q } from "react";
|
|
4
|
+
import { clsx as f } from "../node_modules/clsx/dist/clsx.js";
|
|
5
|
+
import { componentGap as Q, baseTransition as F, componentPaddingMinusBorder as C, componentPaddingMinusBorderDesktop as tt, typography as W, componentPaddingXUsingComponentGap as et } from "../classNames.js";
|
|
6
|
+
import { Label as rt } from "./Label.js";
|
|
7
|
+
import { Icon as k } from "./Icon.js";
|
|
8
|
+
import { formatDecimalValue as w, formatCurrencyDisplay as E, getDecimalPlaceholder as nt } from "../utils/formatting.js";
|
|
9
|
+
import { Paragraph as at } from "./Paragraph.js";
|
|
10
|
+
function st(e, i) {
|
|
11
|
+
if (!e || !i)
|
|
12
|
+
return !1;
|
|
13
|
+
const y = Number(e.replace(/,/g, "")), l = Number(i.replace(/,/g, ""));
|
|
14
|
+
return !Number.isNaN(y) && !Number.isNaN(l) && y === l;
|
|
15
|
+
}
|
|
16
|
+
function ct({
|
|
17
|
+
id: e,
|
|
18
|
+
testid: i,
|
|
19
|
+
before: y,
|
|
20
|
+
after: l,
|
|
21
|
+
rightAdornment: h,
|
|
22
|
+
type: A,
|
|
23
|
+
label: g,
|
|
24
|
+
error: r,
|
|
25
|
+
className: M,
|
|
26
|
+
align: R = "left",
|
|
27
|
+
caption: S,
|
|
28
|
+
required: $,
|
|
29
|
+
selectOnFocus: U,
|
|
30
|
+
removeRoundness: d,
|
|
31
|
+
inputContainerRef: N,
|
|
32
|
+
removeBorder: H,
|
|
33
|
+
wrapperClassName: D,
|
|
34
|
+
isFocused: L,
|
|
35
|
+
secondaryIconColor: P,
|
|
36
|
+
fullWidth: j = !0,
|
|
37
|
+
width: o,
|
|
38
|
+
wrapperRef: B,
|
|
39
|
+
autocompletePadding: G = !1,
|
|
40
|
+
...m
|
|
41
|
+
}) {
|
|
42
|
+
const X = {
|
|
43
|
+
"data-error": r && !L || null,
|
|
44
|
+
"data-focus": L || null
|
|
45
|
+
}, I = Y(null), T = e ? `${e}-input` : void 0;
|
|
46
|
+
q(() => {
|
|
47
|
+
const n = I.current, x = () => {
|
|
48
|
+
n?.select();
|
|
49
|
+
};
|
|
50
|
+
if (U)
|
|
51
|
+
return I.current?.addEventListener("focus", x), () => {
|
|
52
|
+
n?.removeEventListener("focus", x);
|
|
53
|
+
};
|
|
54
|
+
}, [U]);
|
|
55
|
+
const z = f(
|
|
56
|
+
j ? "w-full" : "w-fit",
|
|
57
|
+
"flex flex-row items-center",
|
|
58
|
+
"bg-background-action-secondary-normal caret-icon-on-action-secondary-normal",
|
|
59
|
+
Q,
|
|
60
|
+
F,
|
|
61
|
+
"outline-transparent outline-2 -outline-offset-2",
|
|
62
|
+
!G && C,
|
|
63
|
+
G && tt,
|
|
64
|
+
!d && "rounded-base",
|
|
65
|
+
!H && "border border-border-primary-normal",
|
|
66
|
+
"relative"
|
|
67
|
+
), J = f(
|
|
68
|
+
"has-[[data-focus]]:border-transparent has-[[data-focus]]:outline-border-primary-focus focus-within:border-transparent focus-within:outline-border-primary-focus"
|
|
69
|
+
), t = f(
|
|
70
|
+
"has-disabled:bg-background-action-secondary-disabled"
|
|
71
|
+
), a = f(
|
|
72
|
+
"has-[input:not(:disabled):read-only]:outline-none has-[input:not(:disabled):read-only]:bg-transparent has-[input:not(:disabled):read-only]:border-transparent has-[input:not(:disabled):read-only]:pl-0"
|
|
73
|
+
), c = f(
|
|
74
|
+
"has-[[data-error]]:border-transparent has-[[data-error]]:not-focus-within:outline-border-primary-error has-[[data-error]]:not-focus-within:outline-1"
|
|
75
|
+
);
|
|
76
|
+
return /* @__PURE__ */ O(
|
|
77
|
+
"label",
|
|
78
|
+
{
|
|
79
|
+
id: e,
|
|
80
|
+
"data-testid": i,
|
|
81
|
+
htmlFor: T,
|
|
82
|
+
ref: N,
|
|
83
|
+
className: f(
|
|
84
|
+
"w-full flex flex-col",
|
|
85
|
+
"block",
|
|
86
|
+
"text-text-primary-normal has-disabled:text-text-primary-disabled",
|
|
87
|
+
Q
|
|
88
|
+
),
|
|
89
|
+
style: {
|
|
90
|
+
...m.style
|
|
91
|
+
},
|
|
92
|
+
children: [
|
|
93
|
+
g && /* @__PURE__ */ O("div", { className: f("flex items-center", Q), children: [
|
|
94
|
+
/* @__PURE__ */ s(
|
|
95
|
+
rt,
|
|
96
|
+
{
|
|
97
|
+
id: e ? `${e}-label` : void 0,
|
|
98
|
+
color: r ? "text-primary-error" : void 0,
|
|
99
|
+
className: f(
|
|
100
|
+
m.disabled || m.readOnly ? "cursor-default" : "cursor-pointer"
|
|
101
|
+
),
|
|
102
|
+
children: g
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
$ && /* @__PURE__ */ s(
|
|
106
|
+
"span",
|
|
107
|
+
{
|
|
108
|
+
className: f(W.label, "text-text-critical-normal"),
|
|
109
|
+
children: "*"
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ O(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: f(
|
|
117
|
+
z,
|
|
118
|
+
!m.disabled && c,
|
|
119
|
+
J,
|
|
120
|
+
t,
|
|
121
|
+
a,
|
|
122
|
+
D
|
|
123
|
+
),
|
|
124
|
+
ref: (n) => {
|
|
125
|
+
B && (B.current = n);
|
|
126
|
+
},
|
|
127
|
+
children: [
|
|
128
|
+
y,
|
|
129
|
+
/* @__PURE__ */ s(
|
|
130
|
+
"input",
|
|
131
|
+
{
|
|
132
|
+
ref: (n) => {
|
|
133
|
+
I.current = n;
|
|
134
|
+
},
|
|
135
|
+
type: A,
|
|
136
|
+
required: $,
|
|
137
|
+
...m,
|
|
138
|
+
...X,
|
|
139
|
+
id: T,
|
|
140
|
+
"data-testid": i ? `${i}-input` : void 0,
|
|
141
|
+
className: f(
|
|
142
|
+
"flex-1 outline-none w-full max-w-full min-h-6 min-w-0",
|
|
143
|
+
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
144
|
+
"placeholder:text-text-secondary-normal disabled:text-text-secondary-disabled",
|
|
145
|
+
R === "right" && "text-right",
|
|
146
|
+
R === "center" && "text-center",
|
|
147
|
+
et,
|
|
148
|
+
W.paragraph,
|
|
149
|
+
M,
|
|
150
|
+
m.readOnly && !m.disabled && "!px-0"
|
|
151
|
+
),
|
|
152
|
+
style: { ...m.style, width: o }
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
P ? /* @__PURE__ */ s("span", { className: "contents text-text-secondary-normal", children: l }) : l,
|
|
156
|
+
h
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
S && /* @__PURE__ */ s(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
id: e ? `${e}-caption` : void 0,
|
|
164
|
+
"data-testid": i ? `${i}-caption` : void 0,
|
|
165
|
+
className: f(W.caption),
|
|
166
|
+
children: S
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function _({
|
|
174
|
+
variant: e = "default",
|
|
175
|
+
decimals: i,
|
|
176
|
+
uom: y,
|
|
177
|
+
currencyFormat: l = !1,
|
|
178
|
+
formatOnBlur: h = !1,
|
|
179
|
+
removeSearchIcon: A,
|
|
180
|
+
value: g,
|
|
181
|
+
onChange: r,
|
|
182
|
+
onBlur: M,
|
|
183
|
+
onClear: R,
|
|
184
|
+
id: S,
|
|
185
|
+
testid: $,
|
|
186
|
+
rightAdornment: U,
|
|
187
|
+
...d
|
|
188
|
+
}) {
|
|
189
|
+
const [N, H] = Z(""), [D, L] = Z(""), P = Y(!1), j = Y(""), o = (t, a) => {
|
|
190
|
+
j.current = t, H(t), L(a);
|
|
191
|
+
};
|
|
192
|
+
q(() => {
|
|
193
|
+
const t = g?.toString() ?? "", a = e === "currency" || e === "uom" && l;
|
|
194
|
+
if (!t) {
|
|
195
|
+
o("", "");
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (!a) {
|
|
199
|
+
o(t, t);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (P.current && st(j.current, t))
|
|
203
|
+
return;
|
|
204
|
+
if (h && P.current) {
|
|
205
|
+
o(t, t);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const c = w(t, i ?? 2);
|
|
209
|
+
o(c, E(c));
|
|
210
|
+
}, [g, e, l, i, h]);
|
|
211
|
+
const B = () => {
|
|
212
|
+
const t = {
|
|
213
|
+
...d,
|
|
214
|
+
id: S,
|
|
215
|
+
...nt(i),
|
|
216
|
+
value: g
|
|
217
|
+
};
|
|
218
|
+
switch (e) {
|
|
219
|
+
case "search":
|
|
220
|
+
return {
|
|
221
|
+
...t,
|
|
222
|
+
placeholder: d.placeholder ?? "Search",
|
|
223
|
+
className: "!mr-6",
|
|
224
|
+
value: D
|
|
225
|
+
};
|
|
226
|
+
case "finder":
|
|
227
|
+
return t;
|
|
228
|
+
case "currency":
|
|
229
|
+
return {
|
|
230
|
+
...t,
|
|
231
|
+
align: "right",
|
|
232
|
+
type: "text",
|
|
233
|
+
inputMode: "decimal",
|
|
234
|
+
value: D
|
|
235
|
+
};
|
|
236
|
+
case "percentage":
|
|
237
|
+
case "uom":
|
|
238
|
+
return {
|
|
239
|
+
...t,
|
|
240
|
+
type: l ? "text" : "number",
|
|
241
|
+
align: "right",
|
|
242
|
+
inputMode: l ? "decimal" : void 0,
|
|
243
|
+
value: l ? D : g
|
|
244
|
+
};
|
|
245
|
+
default:
|
|
246
|
+
return t;
|
|
247
|
+
}
|
|
248
|
+
}, G = () => {
|
|
249
|
+
if (d.before) return d.before;
|
|
250
|
+
switch (e) {
|
|
251
|
+
case "search":
|
|
252
|
+
return A ? null : /* @__PURE__ */ s("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ s(k, { name: "search" }) });
|
|
253
|
+
case "currency":
|
|
254
|
+
return /* @__PURE__ */ s("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ s(k, { name: "attach_money" }) });
|
|
255
|
+
case "uom":
|
|
256
|
+
return l ? /* @__PURE__ */ s("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ s(k, { name: "attach_money" }) }) : null;
|
|
257
|
+
default:
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
}, m = () => {
|
|
261
|
+
if (d.after) return d.after;
|
|
262
|
+
switch (e) {
|
|
263
|
+
case "search":
|
|
264
|
+
return D.length > 0 && !d.readOnly ? /* @__PURE__ */ s(
|
|
265
|
+
k,
|
|
266
|
+
{
|
|
267
|
+
id: S ? `${S}-clear-button` : void 0,
|
|
268
|
+
testid: $ ? `${$}-clear-button` : void 0,
|
|
269
|
+
name: "close",
|
|
270
|
+
onClick: X,
|
|
271
|
+
className: "cursor-pointer absolute right-2 bottom-2/4 translate-y-2/4"
|
|
272
|
+
}
|
|
273
|
+
) : null;
|
|
274
|
+
case "finder":
|
|
275
|
+
return /* @__PURE__ */ s(k, { name: "search" });
|
|
276
|
+
case "uom":
|
|
277
|
+
return y ? /* @__PURE__ */ s(at, { color: "text-secondary-normal", children: y.toUpperCase() }) : null;
|
|
278
|
+
case "percentage":
|
|
279
|
+
return /* @__PURE__ */ s("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ s(k, { name: "percent" }) });
|
|
280
|
+
default:
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}, X = () => {
|
|
284
|
+
o("", ""), r && typeof r == "function" && r({
|
|
285
|
+
target: { value: "" }
|
|
286
|
+
}), R?.();
|
|
287
|
+
}, I = (t) => {
|
|
288
|
+
const a = t.target.value, c = d.max != null ? Number(String(d.max).replace(/,/g, "")) : void 0;
|
|
289
|
+
if (e === "currency") {
|
|
290
|
+
const n = a.replace(/,/g, "");
|
|
291
|
+
if (n === "") {
|
|
292
|
+
if (o("", ""), r) {
|
|
293
|
+
const u = {
|
|
294
|
+
...t,
|
|
295
|
+
target: { ...t.target, value: "" }
|
|
296
|
+
};
|
|
297
|
+
r(u);
|
|
298
|
+
}
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (!/^\d*\.?\d*$/.test(n)) return;
|
|
302
|
+
const b = n.split("."), v = i ?? 2;
|
|
303
|
+
if (b.length === 2 && b[1].length > v) return;
|
|
304
|
+
const p = Number(n);
|
|
305
|
+
if (!isNaN(p) && c != null && p > c) {
|
|
306
|
+
const u = c, V = w(
|
|
307
|
+
u.toString(),
|
|
308
|
+
v
|
|
309
|
+
);
|
|
310
|
+
if (o(
|
|
311
|
+
V,
|
|
312
|
+
h ? V : E(V)
|
|
313
|
+
), r) {
|
|
314
|
+
const K = {
|
|
315
|
+
...t,
|
|
316
|
+
target: { ...t.target, value: u.toString() }
|
|
317
|
+
};
|
|
318
|
+
r(K);
|
|
319
|
+
}
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (o(n, h ? n : E(n)), !isNaN(p) && r) {
|
|
323
|
+
const u = {
|
|
324
|
+
...t,
|
|
325
|
+
target: { ...t.target, value: p.toString() }
|
|
326
|
+
};
|
|
327
|
+
r(u);
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (e === "uom" && l) {
|
|
332
|
+
const n = a.replace(/,/g, "");
|
|
333
|
+
if (n === "") {
|
|
334
|
+
if (o("", ""), r) {
|
|
335
|
+
const u = {
|
|
336
|
+
...t,
|
|
337
|
+
target: { ...t.target, value: "" }
|
|
338
|
+
};
|
|
339
|
+
r(u);
|
|
340
|
+
}
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (!/^\d*\.?\d*$/.test(n)) return;
|
|
344
|
+
const b = n.split("."), v = i ?? 2;
|
|
345
|
+
if (b.length === 2 && b[1].length > v) return;
|
|
346
|
+
const p = Number(n);
|
|
347
|
+
if (!isNaN(p) && c != null && p > c) {
|
|
348
|
+
const u = c, V = w(
|
|
349
|
+
u.toString(),
|
|
350
|
+
v
|
|
351
|
+
);
|
|
352
|
+
if (o(
|
|
353
|
+
V,
|
|
354
|
+
E(V)
|
|
355
|
+
), r) {
|
|
356
|
+
const K = {
|
|
357
|
+
...t,
|
|
358
|
+
target: { ...t.target, value: u.toString() }
|
|
359
|
+
};
|
|
360
|
+
r(K);
|
|
361
|
+
}
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (o(n, E(n)), !isNaN(p) && r) {
|
|
365
|
+
const u = {
|
|
366
|
+
...t,
|
|
367
|
+
target: { ...t.target, value: p.toString() }
|
|
368
|
+
};
|
|
369
|
+
r(u);
|
|
370
|
+
}
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (e === "uom" && t.target.type === "number") {
|
|
374
|
+
const n = Number(a);
|
|
375
|
+
if (!isNaN(n) && c != null && n > c) {
|
|
376
|
+
const x = c, b = w(
|
|
377
|
+
x.toString(),
|
|
378
|
+
i ?? 0
|
|
379
|
+
);
|
|
380
|
+
if (o(b, b), typeof r == "function") {
|
|
381
|
+
const v = {
|
|
382
|
+
...t,
|
|
383
|
+
target: { ...t.target, value: x.toString() }
|
|
384
|
+
};
|
|
385
|
+
r(v);
|
|
386
|
+
}
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
o(a, a), typeof r == "function" && r(t);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
o(a, a), typeof r == "function" && r(t);
|
|
393
|
+
}, T = (t) => {
|
|
394
|
+
if (P.current = !1, !N) {
|
|
395
|
+
M?.(t);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (e === "currency") {
|
|
399
|
+
const a = w(N, i ?? 2);
|
|
400
|
+
o(a, E(a));
|
|
401
|
+
const c = Number(a);
|
|
402
|
+
if (!isNaN(c) && r) {
|
|
403
|
+
const n = {
|
|
404
|
+
...t,
|
|
405
|
+
target: { ...t.target, value: c.toString() }
|
|
406
|
+
};
|
|
407
|
+
r(n);
|
|
408
|
+
}
|
|
409
|
+
} else if (e === "uom")
|
|
410
|
+
if (l) {
|
|
411
|
+
const a = w(N, i ?? 2);
|
|
412
|
+
o(a, E(a));
|
|
413
|
+
const c = Number(a);
|
|
414
|
+
if (!isNaN(c) && r) {
|
|
415
|
+
const n = {
|
|
416
|
+
...t,
|
|
417
|
+
target: { ...t.target, value: c.toString() }
|
|
418
|
+
};
|
|
419
|
+
r(n);
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
const a = w(t.target.value, i);
|
|
423
|
+
t.target.value = a;
|
|
424
|
+
}
|
|
425
|
+
M?.(t);
|
|
426
|
+
}, z = (t) => {
|
|
427
|
+
P.current = !0, h && (e === "currency" || e === "uom" && l) && o(N, N), d.onFocus?.(t);
|
|
428
|
+
}, J = B();
|
|
429
|
+
return /* @__PURE__ */ s(
|
|
430
|
+
ct,
|
|
431
|
+
{
|
|
432
|
+
...J,
|
|
433
|
+
before: G(),
|
|
434
|
+
after: m(),
|
|
435
|
+
onFocus: z,
|
|
436
|
+
onChange: I,
|
|
437
|
+
onBlur: T,
|
|
438
|
+
testid: $,
|
|
439
|
+
rightAdornment: U
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
function bt(e) {
|
|
444
|
+
return /* @__PURE__ */ s(_, { ...e, variant: "finder" });
|
|
445
|
+
}
|
|
446
|
+
function yt(e) {
|
|
447
|
+
return /* @__PURE__ */ s(_, { ...e, variant: "uom" });
|
|
448
|
+
}
|
|
449
|
+
function ht(e) {
|
|
450
|
+
return /* @__PURE__ */ s(
|
|
451
|
+
_,
|
|
452
|
+
{
|
|
453
|
+
...e,
|
|
454
|
+
variant: "currency",
|
|
455
|
+
decimals: e.decimals ?? 2
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
function gt(e) {
|
|
460
|
+
return /* @__PURE__ */ s(_, { ...e, variant: "percentage" });
|
|
461
|
+
}
|
|
462
|
+
export {
|
|
463
|
+
ht as Currency,
|
|
464
|
+
bt as Finder,
|
|
465
|
+
_ as Input,
|
|
466
|
+
ct as InputBase,
|
|
467
|
+
gt as Percentage,
|
|
468
|
+
yt as UOM
|
|
469
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { Label as x } from "./Label.js";
|
|
4
|
+
import { clsx as t } from "../node_modules/clsx/dist/clsx.js";
|
|
5
|
+
import { useId as v } from "react";
|
|
6
|
+
import { layoutGap as b, componentGap as u } from "../classNames.js";
|
|
7
|
+
function k({
|
|
8
|
+
id: o,
|
|
9
|
+
testid: e,
|
|
10
|
+
label: l,
|
|
11
|
+
orientation: r = "horizontal",
|
|
12
|
+
error: n = !1,
|
|
13
|
+
children: c,
|
|
14
|
+
caption: p,
|
|
15
|
+
...i
|
|
16
|
+
}) {
|
|
17
|
+
const m = v(), d = o ? `${o}-label` : void 0, s = e ? `${e}-label` : void 0;
|
|
18
|
+
return /* @__PURE__ */ f("div", { id: o, "data-testid": e, ...i, className: t("flex flex-col", u), children: [
|
|
19
|
+
l && /* @__PURE__ */ a(
|
|
20
|
+
x,
|
|
21
|
+
{
|
|
22
|
+
id: d,
|
|
23
|
+
testid: s,
|
|
24
|
+
as: "label",
|
|
25
|
+
className: t({ "!text-text-primary-error": n }),
|
|
26
|
+
htmlFor: m,
|
|
27
|
+
children: l
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ a(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: t(
|
|
34
|
+
"flex *:py-mobile-component-padding desktop:*:py-desktop-component-padding compact:*:py-desktop-compact-component-padding",
|
|
35
|
+
r === "vertical" ? "flex-col" : t("items-center", b)
|
|
36
|
+
),
|
|
37
|
+
children: c
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
p && /* @__PURE__ */ a("div", { id: o ? `${o}-caption` : void 0, "data-testid": e ? `${e}-caption` : void 0, children: p })
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
k as InputGroup
|
|
45
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as c } from "../node_modules/clsx/dist/clsx.js";
|
|
3
|
+
import { typography as i, componentPaddingXUsingComponentGap as p } from "../classNames.js";
|
|
4
|
+
function g({
|
|
5
|
+
as: r = "span",
|
|
6
|
+
padded: n,
|
|
7
|
+
className: m,
|
|
8
|
+
color: e,
|
|
9
|
+
align: t,
|
|
10
|
+
id: l,
|
|
11
|
+
testid: a,
|
|
12
|
+
...o
|
|
13
|
+
}) {
|
|
14
|
+
return /* @__PURE__ */ s(
|
|
15
|
+
r,
|
|
16
|
+
{
|
|
17
|
+
id: l,
|
|
18
|
+
"data-testid": a,
|
|
19
|
+
className: c(
|
|
20
|
+
i.label,
|
|
21
|
+
t === "left" && "text-left",
|
|
22
|
+
t === "center" && "text-center",
|
|
23
|
+
t === "right" && "text-right",
|
|
24
|
+
m,
|
|
25
|
+
n && p
|
|
26
|
+
),
|
|
27
|
+
...o,
|
|
28
|
+
style: {
|
|
29
|
+
...o.style,
|
|
30
|
+
color: e ? `var(--color-${e})` : void 0
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
g as Label
|
|
37
|
+
};
|