@m4l/components 9.9.0 → 9.9.1-beta-feature-m4l-components-rhf-image-selector.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.
Files changed (41) hide show
  1. package/@types/types.d.ts +8 -0
  2. package/components/ImageSelector/ImageSelector.d.ts +6 -0
  3. package/components/ImageSelector/ImageSelector.d.ts.map +1 -0
  4. package/components/ImageSelector/ImageSelector.js +226 -0
  5. package/components/ImageSelector/ImageSelector.styles.d.ts +3 -0
  6. package/components/ImageSelector/ImageSelector.styles.d.ts.map +1 -0
  7. package/components/ImageSelector/ImageSelector.styles.js +246 -0
  8. package/components/ImageSelector/constants.d.ts +16 -0
  9. package/components/ImageSelector/constants.d.ts.map +1 -0
  10. package/components/ImageSelector/constants.js +23 -0
  11. package/components/ImageSelector/dictionary.d.ts +8 -0
  12. package/components/ImageSelector/dictionary.d.ts.map +1 -0
  13. package/components/ImageSelector/dictionary.js +11 -0
  14. package/components/ImageSelector/hooks/useImageSelector.d.ts +6 -0
  15. package/components/ImageSelector/hooks/useImageSelector.d.ts.map +1 -0
  16. package/components/ImageSelector/hooks/useImageSelector.js +279 -0
  17. package/components/ImageSelector/index.d.ts +4 -0
  18. package/components/ImageSelector/index.d.ts.map +1 -0
  19. package/components/ImageSelector/slots/ImageSelectorEnum.d.ts +15 -0
  20. package/components/ImageSelector/slots/ImageSelectorEnum.d.ts.map +1 -0
  21. package/components/ImageSelector/slots/ImageSelectorEnum.js +4 -0
  22. package/components/ImageSelector/slots/ImageSelectorSlots.d.ts +19 -0
  23. package/components/ImageSelector/slots/ImageSelectorSlots.d.ts.map +1 -0
  24. package/components/ImageSelector/slots/ImageSelectorSlots.js +75 -0
  25. package/components/ImageSelector/slots/index.d.ts +3 -0
  26. package/components/ImageSelector/slots/index.d.ts.map +1 -0
  27. package/components/ImageSelector/types.d.ts +210 -0
  28. package/components/ImageSelector/types.d.ts.map +1 -0
  29. package/components/hook-form/RHFImageSelector/RHFImageSelector.d.ts +9 -0
  30. package/components/hook-form/RHFImageSelector/RHFImageSelector.d.ts.map +1 -0
  31. package/components/hook-form/RHFImageSelector/RHFImageSelector.js +6 -0
  32. package/components/hook-form/RHFImageSelector/index.d.ts +3 -0
  33. package/components/hook-form/RHFImageSelector/index.d.ts.map +1 -0
  34. package/components/hook-form/RHFImageSelector/types.d.ts +7 -0
  35. package/components/hook-form/RHFImageSelector/types.d.ts.map +1 -0
  36. package/components/hook-form/index.d.ts +1 -0
  37. package/components/hook-form/index.d.ts.map +1 -1
  38. package/components/index.d.ts +1 -0
  39. package/components/index.d.ts.map +1 -1
  40. package/index.js +296 -290
  41. package/package.json +6 -6
package/@types/types.d.ts CHANGED
@@ -366,6 +366,7 @@ import {
366
366
  VariableSizeListOwnerState,
367
367
  VariableSizeListSlotsType,
368
368
  } from '../components/extended/React-Window/VariableSizeList/types';
369
+ import { ImageSelectorOwnerState, ImageSelectorSlotsType } from 'src/components/ImageSelector/types';
369
370
 
370
371
  declare module '@mui/material/styles' {
371
372
  // Define the slots in the theme
@@ -476,6 +477,7 @@ declare module '@mui/material/styles' {
476
477
  M4LReactJsonViewer: ReactJsonViewerSlotsType;
477
478
  M4LResizable: ResizableSlotsType;
478
479
  M4LResizableBox: ResizableBoxSlotsType;
480
+ M4LImageSelector: ImageSelectorSlotsType;
479
481
  }
480
482
  interface ComponentsPropsList {
481
483
  // Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
@@ -585,6 +587,7 @@ declare module '@mui/material/styles' {
585
587
  M4LReactJsonViewer: Partial<ReactJsonViewerOwnerState>;
586
588
  M4LResizable: Partial<ReactResizableOwnerState>;
587
589
  M4LResizableBox: Partial<ResizableBoxOwnerState>;
590
+ M4LImageSelector: Partial<ImageSelectorOwnerState>;
588
591
  }
589
592
  interface Components {
590
593
  M4LDynamicFilter?: {
@@ -1121,5 +1124,10 @@ declare module '@mui/material/styles' {
1121
1124
  styleOverrides?: ComponentsOverrides<Theme>['M4LResizableBox'];
1122
1125
  variants?: ComponentsVariants['M4LResizableBox'];
1123
1126
  };
1127
+ M4LImageSelector?: {
1128
+ defaultProps?: ComponentsPropsList['M4LImageSelector'];
1129
+ styleOverrides?: ComponentsOverrides<Theme>['M4LImageSelector'];
1130
+ variants?: ComponentsVariants['M4LImageSelector'];
1131
+ };
1124
1132
  }
1125
1133
  }
@@ -0,0 +1,6 @@
1
+ import { Ref } from 'react';
2
+ import { ImageSelectorProps } from './types';
3
+ export declare const ImageSelector: <T = unknown>(props: ImageSelectorProps<T> & {
4
+ ref?: Ref<HTMLButtonElement>;
5
+ }) => JSX.Element;
6
+ //# sourceMappingURL=ImageSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageSelector.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/ImageSelector/ImageSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,GAAG,EACJ,MAAM,OAAO,CAAC;AAWf,OAAO,EAEL,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAgPjB,eAAO,MAAM,aAAa,EAAyC,CACjE,CAAC,GAAG,OAAO,EAEX,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAC7B,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;CAC9B,KACE,GAAG,CAAC,OAAO,CAAC"}
@@ -0,0 +1,226 @@
1
+ import { jsx as e, jsxs as b, Fragment as ie } from "@emotion/react/jsx-runtime";
2
+ import se from "clsx";
3
+ import { forwardRef as de } from "react";
4
+ import { Icon as ce } from "@m4l/base";
5
+ import { useModuleDictionary as me } from "@m4l/core";
6
+ import { getPropDataTestId as pe } from "../../test/getNameDataTestId.js";
7
+ import { DEFAULT_PRESENTATION_TYPE as Se, IMAGE_SELECTOR_CLASSES as t, IMAGE_SELECTOR_KEY_COMPONENT as ge } from "./constants.js";
8
+ import { DICTIONARY as he } from "./dictionary.js";
9
+ import { useImageSelector as ue } from "./hooks/useImageSelector.js";
10
+ import { LoadingStateStyled as fe, CircularProgressStyled as we, OptionsGridStyled as Oe, OptionButtonStyled as Ie, OptionImageStyled as ye, EmptyStateStyled as be, RootStyled as ve, TriggerStyled as Ee, PreviewFrameStyled as Ce, PreviewImageStyled as Te, OverlayStyled as Le, PopoverStyled as Ne } from "./slots/ImageSelectorSlots.js";
11
+ import { ImageSelectorSlots as Re } from "./slots/ImageSelectorEnum.js";
12
+ function Ae(c, v) {
13
+ const {
14
+ value: E,
15
+ onChange: C,
16
+ endpoint: T,
17
+ refetchOnOpen: L = !1,
18
+ getOptionLabel: m,
19
+ getOptionImage: p,
20
+ isOptionEqualToValue: N,
21
+ presentationType: S = Se,
22
+ imageSize: g,
23
+ maxColumns: R,
24
+ maxRows: A,
25
+ size: l = "medium",
26
+ disabled: r = !1,
27
+ error: h = !1,
28
+ className: F,
29
+ dataTestId: P,
30
+ id: _,
31
+ name: x,
32
+ timeout: D,
33
+ parms: B,
34
+ resultField: K,
35
+ isExternalUrl: M,
36
+ isRemote: z,
37
+ responseToCamelCase: G
38
+ } = c, Y = c.onBlur, { getLabel: $ } = me(), {
39
+ getOptionId: j,
40
+ gridOwnerState: i,
41
+ handleBlur: k,
42
+ handleFocus: H,
43
+ handleKeyDown: U,
44
+ handleOptionFocus: V,
45
+ handleOptionKeyDown: q,
46
+ handleOptionRef: W,
47
+ handlePopoverClose: J,
48
+ handleSelect: Q,
49
+ handleToggle: X,
50
+ handleTriggerRef: Z,
51
+ isOptionSelected: ee,
52
+ loading: te,
53
+ open: u,
54
+ options: f,
55
+ optionsListId: w,
56
+ overlayIconSrc: oe,
57
+ previewLabel: O,
58
+ previewOwnerState: re,
59
+ previewSource: ae,
60
+ rootOwnerState: a,
61
+ triggerElement: ne
62
+ } = ue({
63
+ blurHandler: Y,
64
+ disabled: r,
65
+ endpoint: T,
66
+ error: h,
67
+ forwardedRef: v,
68
+ getOptionImage: p,
69
+ getOptionLabel: m,
70
+ isExternalUrl: M,
71
+ isOptionEqualToValue: N,
72
+ isRemote: z,
73
+ imageSize: g,
74
+ maxColumns: R,
75
+ maxRows: A,
76
+ onChange: C,
77
+ presentationType: S,
78
+ parms: B,
79
+ refetchOnOpen: L,
80
+ responseToCamelCase: G,
81
+ resultField: K,
82
+ size: l,
83
+ timeout: D,
84
+ value: E
85
+ }), I = te ? /* @__PURE__ */ e(fe, { ownerState: i, children: /* @__PURE__ */ e(we, { size: l }) }) : f.length > 0 ? /* @__PURE__ */ e(
86
+ Oe,
87
+ {
88
+ id: w,
89
+ role: "listbox",
90
+ "aria-label": "Image options",
91
+ ownerState: i,
92
+ children: f.map((n, o) => {
93
+ const y = ee(n), s = m(n), le = {
94
+ disabled: r,
95
+ imageSize: g,
96
+ selected: y,
97
+ size: l
98
+ };
99
+ return /* @__PURE__ */ e(
100
+ Ie,
101
+ {
102
+ id: j(o),
103
+ ref: (d) => W(o, d),
104
+ role: "option",
105
+ "aria-selected": y,
106
+ "aria-label": s,
107
+ ownerState: le,
108
+ disabled: r,
109
+ onFocus: () => V(o),
110
+ onKeyDown: (d) => q(o, d),
111
+ onClick: () => Q(n),
112
+ children: /* @__PURE__ */ e(
113
+ ye,
114
+ {
115
+ className: t.optionImage,
116
+ src: p(n),
117
+ alt: s,
118
+ width: "100%",
119
+ height: "100%",
120
+ enableIntersectionObserver: !1
121
+ }
122
+ )
123
+ },
124
+ `${s}-${o}`
125
+ );
126
+ })
127
+ }
128
+ ) : /* @__PURE__ */ e(
129
+ be,
130
+ {
131
+ ownerState: i,
132
+ variant: "bodyStandard",
133
+ children: $(he.LABEL_NO_IMAGES_AVAILABLE)
134
+ }
135
+ );
136
+ return /* @__PURE__ */ e(
137
+ ve,
138
+ {
139
+ ownerState: a,
140
+ className: se(F, t.root),
141
+ ...pe(ge, Re.root, P),
142
+ children: S === "standard" ? /* @__PURE__ */ b(ie, { children: [
143
+ /* @__PURE__ */ e(
144
+ Ee,
145
+ {
146
+ ref: Z,
147
+ type: "button",
148
+ id: _,
149
+ name: x,
150
+ ownerState: a,
151
+ className: t.trigger,
152
+ disabled: r,
153
+ "aria-haspopup": "listbox",
154
+ "aria-expanded": u,
155
+ "aria-controls": w,
156
+ "aria-invalid": h || void 0,
157
+ "aria-label": `Image selector: ${O}`,
158
+ onClick: X,
159
+ onFocus: H,
160
+ onBlur: k,
161
+ onKeyDown: U,
162
+ disableRipple: !0,
163
+ children: /* @__PURE__ */ b(
164
+ Ce,
165
+ {
166
+ ownerState: a,
167
+ className: t.previewFrame,
168
+ children: [
169
+ /* @__PURE__ */ e(
170
+ Te,
171
+ {
172
+ ownerState: re,
173
+ className: t.previewImage,
174
+ src: ae,
175
+ alt: O,
176
+ width: "100%",
177
+ height: "100%",
178
+ enableIntersectionObserver: !1
179
+ }
180
+ ),
181
+ /* @__PURE__ */ e(
182
+ Le,
183
+ {
184
+ ownerState: a,
185
+ className: t.overlay,
186
+ "aria-hidden": !0,
187
+ children: /* @__PURE__ */ e(ce, { src: oe })
188
+ }
189
+ )
190
+ ]
191
+ }
192
+ )
193
+ }
194
+ ),
195
+ /* @__PURE__ */ e(
196
+ Ne,
197
+ {
198
+ open: u,
199
+ anchorEl: ne,
200
+ onClose: J,
201
+ disableRestoreFocus: !0,
202
+ disableEnforceFocus: !0,
203
+ disableAutoFocus: !0,
204
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
205
+ transformOrigin: { vertical: "top", horizontal: "left" },
206
+ slotProps: {
207
+ paper: {
208
+ "aria-label": "Image selector options paper",
209
+ sx: {
210
+ p: 2,
211
+ overflow: "hidden",
212
+ maxWidth: "calc(100vw - 32px)"
213
+ }
214
+ }
215
+ },
216
+ children: I
217
+ }
218
+ )
219
+ ] }) : I
220
+ }
221
+ );
222
+ }
223
+ const $e = de(Ae);
224
+ export {
225
+ $e as ImageSelector
226
+ };
@@ -0,0 +1,3 @@
1
+ import { ImageSelectorStyles } from './types';
2
+ export declare const imageSelectorStyles: ImageSelectorStyles;
3
+ //# sourceMappingURL=ImageSelector.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageSelector.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/ImageSelector/ImageSelector.styles.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,mBAAmB,EACpB,MAAM,SAAS,CAAC;AA0BjB,eAAO,MAAM,mBAAmB,EAAE,mBAqSjC,CAAC"}
@@ -0,0 +1,246 @@
1
+ import { OPTION_DIMENSION as d, DEFAULT_MAX_COLUMNS as b, GRID_GAP as i, DEFAULT_MAX_ROWS as y, SCROLLBAR_TRACK_SIZE as w, TRIGGER_DIMENSION as f, IMAGE_SELECTOR_CLASSES as s } from "./constants.js";
2
+ const R = /^(-?\d+(?:\.\d+)?)px$/;
3
+ function u(o) {
4
+ return o?.presentationType === "grid" && o.error;
5
+ }
6
+ function h(o, e) {
7
+ const r = R.exec(e.trim());
8
+ return r ? `${o + Number.parseFloat(r[1]) * 2}px` : `calc(${o}px + (${e} * 2))`;
9
+ }
10
+ const $ = {
11
+ /**
12
+ * Base styles for the root element of the ImageSelector component.
13
+ */
14
+ root: (o) => {
15
+ const { ownerState: e } = o;
16
+ return {
17
+ display: e?.presentationType === "grid" ? "flex" : "inline-flex",
18
+ flexDirection: "column",
19
+ position: "relative",
20
+ width: e?.presentationType === "grid" ? "100%" : "fit-content",
21
+ maxWidth: "100%"
22
+ };
23
+ },
24
+ /**
25
+ * Interactive trigger styles.
26
+ */
27
+ trigger: (o) => {
28
+ const { theme: e, ownerState: r = {} } = o, t = r.imageSize ?? f;
29
+ return {
30
+ width: `${t}px`,
31
+ height: `${t}px`,
32
+ aspectRatio: "1 / 1",
33
+ borderRadius: e.vars.size.borderRadius.r2,
34
+ border: e.vars.size.borderStroke.container,
35
+ borderColor: r.error ? e.vars.palette.error.main : "transparent",
36
+ backgroundColor: e.vars.palette.background.default,
37
+ overflow: "hidden",
38
+ padding: 0,
39
+ transition: "border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease",
40
+ [`& .${s.overlay}`]: {
41
+ opacity: 0
42
+ },
43
+ [`&:hover .${s.previewImage}`]: {
44
+ filter: r.disabled || r.isOpen ? "none" : "blur(1px)"
45
+ },
46
+ [`&:hover .${s.overlay}`]: {
47
+ opacity: r.disabled || r.isOpen ? 0 : 1
48
+ },
49
+ [`&:active .${s.previewImage}`]: {
50
+ filter: r.disabled || r.isOpen ? "none" : "blur(1px)"
51
+ },
52
+ [`&:active .${s.overlay}`]: {
53
+ opacity: r.disabled || r.isOpen ? 0 : 1
54
+ },
55
+ "&:focus-visible": {
56
+ outline: "none",
57
+ borderColor: e.vars.palette.primary.focus,
58
+ boxShadow: `0 0 0 1px ${e.vars.palette.primary.focus}`
59
+ },
60
+ "&.Mui-disabled": {
61
+ opacity: 0.64,
62
+ cursor: "not-allowed"
63
+ }
64
+ };
65
+ },
66
+ /**
67
+ * Preview frame styles.
68
+ */
69
+ previewFrame: (o) => {
70
+ const { theme: e } = o;
71
+ return {
72
+ position: "relative",
73
+ width: "100%",
74
+ height: "100%",
75
+ display: "flex",
76
+ alignItems: "center",
77
+ justifyContent: "center",
78
+ backgroundColor: e.vars.palette.background.default
79
+ };
80
+ },
81
+ /**
82
+ * Preview image styles.
83
+ */
84
+ previewImage: (o) => {
85
+ const { theme: e, ownerState: r } = o;
86
+ return {
87
+ width: "100%",
88
+ height: "100%",
89
+ objectFit: "contain",
90
+ transition: "filter 0.2s ease, opacity 0.2s ease, transform 0.2s ease",
91
+ opacity: r?.isPlaceholder ? 0.82 : 1,
92
+ transform: r?.disabled ? "scale(0.98)" : "scale(1)",
93
+ borderRadius: e.vars.size.borderRadius.r2
94
+ };
95
+ },
96
+ /**
97
+ * Overlay container styles.
98
+ */
99
+ overlay: (o) => {
100
+ const { theme: e } = o;
101
+ return {
102
+ position: "absolute",
103
+ inset: 0,
104
+ overflow: "hidden",
105
+ display: "flex",
106
+ alignItems: "center",
107
+ justifyContent: "center",
108
+ opacity: 0,
109
+ pointerEvents: "none",
110
+ borderRadius: e.vars.size.borderRadius.r2,
111
+ "&::before": {
112
+ content: '""',
113
+ position: "absolute",
114
+ inset: 0,
115
+ backgroundColor: e.vars.palette.background.surface,
116
+ opacity: 0.5
117
+ },
118
+ transition: "opacity 0.2s ease"
119
+ };
120
+ },
121
+ /**
122
+ * Refresh icon styles rendered above the blur layer.
123
+ */
124
+ overlayIcon: (o) => {
125
+ const { theme: e } = o;
126
+ return {
127
+ position: "relative",
128
+ zIndex: 1,
129
+ fontSize: 18,
130
+ color: e.vars.palette.primary.contrastText
131
+ };
132
+ },
133
+ popover: {},
134
+ /**
135
+ * Options grid layout styles.
136
+ */
137
+ optionsGrid: (o) => {
138
+ const { theme: e, ownerState: r } = o, t = r?.imageSize ?? d, a = r?.maxColumns ?? b, l = r?.maxRows ?? y, p = a > 0, g = l > 0, n = r?.presentationType === "grid" ? e.vars.size.baseSpacings.sp1 : void 0, x = r?.hasVerticalScroll ? w : 0, m = a * t + (a - 1) * i + x, v = l * t + (l - 1) * i, S = p ? n ? h(m, n) : `${m}px` : void 0, c = g ? n ? h(v, n) : `${v}px` : void 0;
139
+ return {
140
+ boxSizing: r?.presentationType === "grid" ? "border-box" : void 0,
141
+ ...p ? {
142
+ display: "grid",
143
+ gridTemplateColumns: `repeat(${a}, ${t}px)`,
144
+ width: S
145
+ } : {
146
+ display: "flex",
147
+ flexWrap: "wrap",
148
+ width: "100%"
149
+ },
150
+ gap: `${i}px`,
151
+ alignContent: "flex-start",
152
+ minWidth: `${t}px`,
153
+ maxWidth: "100%",
154
+ padding: r?.presentationType === "grid" ? e.vars.size.baseSpacings.sp1 : void 0,
155
+ borderRadius: e.vars.size.borderRadius.r2,
156
+ boxShadow: u(r) ? `0 0 0 1px ${e.vars.palette.error.main}` : "none",
157
+ ...r?.hasVerticalScroll && {
158
+ scrollbarGutter: "stable"
159
+ },
160
+ overflowX: p ? "auto" : "hidden",
161
+ overflowY: c ? "auto" : "visible",
162
+ ...c && {
163
+ maxHeight: c
164
+ }
165
+ };
166
+ },
167
+ /**
168
+ * Selectable option tile styles.
169
+ */
170
+ option: (o) => {
171
+ const { theme: e, ownerState: r } = o, t = r?.imageSize ?? d;
172
+ return {
173
+ width: `${t}px`,
174
+ height: `${t}px`,
175
+ aspectRatio: "1 / 1",
176
+ padding: r?.size === "small" ? e.vars.size.baseSpacings["sp0-5"] : e.vars.size.baseSpacings.sp1,
177
+ borderRadius: e.vars.size.borderRadius.r2,
178
+ border: e.vars.size.borderStroke.container,
179
+ borderColor: r?.selected ? e.vars.palette.primary.focus : "transparent",
180
+ backgroundColor: r?.selected ? e.vars.palette.primary.opacity : e.vars.palette.background.default,
181
+ boxShadow: r?.selected ? e.vars.customShadows.z4 : "none",
182
+ transition: "border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease",
183
+ "&:hover": {
184
+ borderColor: r?.selected ? e.vars.palette.primary.focus : e.vars.palette.border.secondary,
185
+ backgroundColor: e.vars.palette.background.base
186
+ },
187
+ "&:focus-visible": {
188
+ outline: "none",
189
+ borderColor: e.vars.palette.primary.focus
190
+ },
191
+ "&.Mui-disabled": {
192
+ opacity: 0.64
193
+ }
194
+ };
195
+ },
196
+ /**
197
+ * Option image sizing styles.
198
+ */
199
+ optionImage: () => ({
200
+ width: "100%",
201
+ height: "100%",
202
+ objectFit: "contain"
203
+ }),
204
+ /**
205
+ * Loading state container styles.
206
+ */
207
+ loadingState: (o) => {
208
+ const { theme: e, ownerState: r } = o, t = r?.imageSize ?? d, a = r?.maxColumns ?? b;
209
+ return {
210
+ width: `${a * t + (a - 1) * i}px`,
211
+ maxWidth: "100%",
212
+ minHeight: `${t * 1.45}px`,
213
+ display: "flex",
214
+ alignItems: "center",
215
+ justifyContent: "center",
216
+ borderRadius: e.vars.size.borderRadius.r2,
217
+ boxShadow: u(r) ? `0 0 0 1px ${e.vars.palette.error.main}` : "none"
218
+ };
219
+ },
220
+ /**
221
+ * Empty state message layout styles.
222
+ */
223
+ emptyState: (o) => {
224
+ const { theme: e, ownerState: r } = o, t = r?.imageSize ?? d, a = r?.maxColumns ?? b;
225
+ return {
226
+ boxSizing: "border-box",
227
+ width: `${a * t + (a - 1) * i}px`,
228
+ maxWidth: "100%",
229
+ minHeight: `${t * 1.45}px`,
230
+ display: "flex",
231
+ alignItems: "center",
232
+ justifyContent: "center",
233
+ borderRadius: e.vars.size.borderRadius.r2,
234
+ boxShadow: u(r) ? `0 0 0 1px ${e.vars.palette.error.main}` : "none",
235
+ textAlign: "center",
236
+ whiteSpace: "normal",
237
+ overflowWrap: "anywhere",
238
+ wordBreak: "break-word",
239
+ color: e.vars.palette.text.secondary,
240
+ padding: e.vars.size.baseSpacings.sp3
241
+ };
242
+ }
243
+ };
244
+ export {
245
+ $ as imageSelectorStyles
246
+ };
@@ -0,0 +1,16 @@
1
+ export declare const IMAGE_SELECTOR_KEY_COMPONENT = "M4LImageSelector";
2
+ export declare const IMAGE_SELECTOR_DICTIONARY_KEY = "image_selector";
3
+ export declare const IMAGE_SELECTOR_CLASSES: Record<"overlay" | "option" | "popover" | "root" | "trigger" | "previewFrame" | "previewImage" | "overlayIcon" | "optionsGrid" | "optionImage" | "loadingState" | "emptyState", string>;
4
+ export declare const DEFAULT_PRESENTATION_TYPE = "standard";
5
+ export declare const DEFAULT_TIMEOUT = 5000;
6
+ export declare const DEFAULT_RESULT_FIELD = "data";
7
+ export declare const DEFAULT_PLACEHOLDER_ALT = "No image selected";
8
+ export declare const DEFAULT_MAX_COLUMNS = 4;
9
+ export declare const DEFAULT_MAX_ROWS = 2;
10
+ export declare const TRIGGER_DIMENSION = 42;
11
+ export declare const OPTION_DIMENSION = 48;
12
+ export declare const GRID_GAP = 8;
13
+ export declare const SCROLLBAR_TRACK_SIZE = 12;
14
+ export declare const DEFAULT_PLACEHOLDER_IMAGE_SRC = "frontend/components/ImageSelector/assets/icons/no_image.png";
15
+ export declare const OVERLAY_ICON = "frontend/components/ImageSelector/assets/icons/arrow_reload_horizontal.svg";
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/ImageSelector/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,6BAA6B,mBAAmB,CAAC;AAE9D,eAAO,MAAM,sBAAsB,yLAGlC,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAa,CAAC;AACpD,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAC3C,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAC3D,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,eAAO,MAAM,QAAQ,IAAI,CAAC;AAE1B,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,eAAO,MAAM,6BAA6B,gEAAgE,CAAC;AAC3G,eAAO,MAAM,YAAY,+EAA+E,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { getComponentClasses as o } from "../../utils/getComponentSlotRoot.js";
2
+ import { ImageSelectorSlots as t } from "./slots/ImageSelectorEnum.js";
3
+ const E = "M4LImageSelector", _ = "image_selector", n = o(
4
+ E,
5
+ t
6
+ ), c = "standard", A = 5e3, L = "data", I = "No image selected", T = 4, S = 2, O = 42, a = 48, r = 8, R = 12, C = "frontend/components/ImageSelector/assets/icons/no_image.png", m = "frontend/components/ImageSelector/assets/icons/arrow_reload_horizontal.svg";
7
+ export {
8
+ T as DEFAULT_MAX_COLUMNS,
9
+ S as DEFAULT_MAX_ROWS,
10
+ I as DEFAULT_PLACEHOLDER_ALT,
11
+ C as DEFAULT_PLACEHOLDER_IMAGE_SRC,
12
+ c as DEFAULT_PRESENTATION_TYPE,
13
+ L as DEFAULT_RESULT_FIELD,
14
+ A as DEFAULT_TIMEOUT,
15
+ r as GRID_GAP,
16
+ n as IMAGE_SELECTOR_CLASSES,
17
+ _ as IMAGE_SELECTOR_DICTIONARY_KEY,
18
+ E as IMAGE_SELECTOR_KEY_COMPONENT,
19
+ a as OPTION_DIMENSION,
20
+ m as OVERLAY_ICON,
21
+ R as SCROLLBAR_TRACK_SIZE,
22
+ O as TRIGGER_DIMENSION
23
+ };
@@ -0,0 +1,8 @@
1
+ export declare const DICTIONARY: {
2
+ readonly LABEL_NO_IMAGES_AVAILABLE: "image_selector.label_no_images_available";
3
+ };
4
+ /**
5
+ * Return the dictionary namespaces required by ImageSelector.
6
+ */
7
+ export declare function getImageSelectorComponentsDictionary(): string[];
8
+ //# sourceMappingURL=dictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/ImageSelector/dictionary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;CAEb,CAAC;AAEX;;GAEG;AACH,wBAAgB,oCAAoC,aAEnD"}
@@ -0,0 +1,11 @@
1
+ import { IMAGE_SELECTOR_DICTIONARY_KEY as e } from "./constants.js";
2
+ const t = {
3
+ LABEL_NO_IMAGES_AVAILABLE: `${e}.label_no_images_available`
4
+ };
5
+ function _() {
6
+ return [e];
7
+ }
8
+ export {
9
+ t as DICTIONARY,
10
+ _ as getImageSelectorComponentsDictionary
11
+ };
@@ -0,0 +1,6 @@
1
+ import { UseImageSelectorProps, UseImageSelectorResult } from '../types';
2
+ /**
3
+ * Resolve the async options and interactive state used by ImageSelector.
4
+ */
5
+ export declare function useImageSelector<T>(props: UseImageSelectorProps<T>): UseImageSelectorResult<T>;
6
+ //# sourceMappingURL=useImageSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useImageSelector.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/ImageSelector/hooks/useImageSelector.ts"],"names":[],"mappings":"AAwBA,OAAO,EAEL,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAalB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC9B,sBAAsB,CAAC,CAAC,CAAC,CAwgB3B"}