@pismo/marola 2.1.14 → 2.1.16
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/assets/TransactionRow.css +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +9 -3
- package/dist/components/Autocomplete/Autocomplete.js +220 -202
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +2 -1
- package/dist/components/TransactionRow/TransactionRow.js +83 -43
- package/dist/components/TransactionRow/TransactionRow.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_sv3th_1{width:100%;height:56px;border-top:1px solid var(--border-secondary)}._container-grid_sv3th_6{display:grid;grid-template-columns:1fr 1.5fr .5fr 5fr 2fr 2fr;align-items:center;justify-content:space-between;padding:12px 16px}._container-pending_sv3th_13{display:flex;align-items:center;justify-content:flex-start;padding:12px 16px}._container-pending--right_sv3th_19{margin-left:auto}._container_sv3th_1 :hover{cursor:pointer;background-color:var(--border-secondary)}._info-section_sv3th_27,._info-section--content_sv3th_31{width:100%;overflow:hidden}._info-section--item_sv3th_35{display:inline-flex;flex-shrink:0;padding-left:8px}._info-section--item_sv3th_35:not(:last-child){flex-shrink:0}._info-section--item_sv3th_35:last-child{flex-shrink:1;min-width:0;overflow:hidden}._info-section--item_sv3th_35:not(:first-child){margin-left:8px;border-left:1px solid var(--border-secondary)}._info-section--right_sv3th_52{display:flex;justify-content:flex-end}._info-section_sv3th_27 ._truncate-text_sv3th_56{display:block;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._info-section_sv3th_27 ._separator_sv3th_63{display:inline-block;width:1px;height:16px;margin:0 8px;vertical-align:middle;background-color:var(--border-secondary)}
|
|
@@ -15,9 +15,15 @@ export type AutocompleteProps<T> = Omit<InputProps, 'onChange' | 'value'> & {
|
|
|
15
15
|
options?: Array<T>;
|
|
16
16
|
/** CSS classes to be applied on the input container element */
|
|
17
17
|
classNameInputWrapper?: string;
|
|
18
|
-
/**
|
|
18
|
+
/** Callback for new option selected */
|
|
19
19
|
onChange?: (event: SyntheticEvent<Element, Event>, newValue: T) => void;
|
|
20
|
-
/**
|
|
20
|
+
/** Callback when characters are entered into the input box */
|
|
21
21
|
onInputChange?: (event: SyntheticEvent<Element, Event>, newValue: string) => void;
|
|
22
|
+
/** Control programmatically the state of the autocomplete list. Using this prop will disable the auto open/close handling and you must provide the behavior for yourself. */
|
|
23
|
+
open?: boolean;
|
|
24
|
+
/** Callback when the autocomplete list is opened */
|
|
25
|
+
onOpen?: () => void;
|
|
26
|
+
/** Callback when the autocomplete list is closed */
|
|
27
|
+
onClose?: () => void;
|
|
22
28
|
};
|
|
23
|
-
export declare const Autocomplete: <T extends string | object>({ labelKey, valueKey, renderOption, customSelectedOptionLabel, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, ...props }: AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const Autocomplete: <T extends string | object>({ labelKey, valueKey, renderOption, customSelectedOptionLabel, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, open, onOpen, onClose, ...props }: AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,8 +6,8 @@ import { Icon as ct } from "../Icon/Icon.js";
|
|
|
6
6
|
import { Input as ft } from "../Input/Input.js";
|
|
7
7
|
import { s as dt, b as Me } from "../../useSlotProps-C7dqSmdM.js";
|
|
8
8
|
import { u as pt } from "../../useId-BW-oWmul.js";
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as
|
|
9
|
+
import { u as Ee } from "../../useControlled-CCMYYdCM.js";
|
|
10
|
+
import { u as pe } from "../../useEventCallback-BAQJJ3ye.js";
|
|
11
11
|
import '../../assets/Autocomplete.css';const gt = (c) => {
|
|
12
12
|
const h = g.useRef({});
|
|
13
13
|
return g.useEffect(() => {
|
|
@@ -21,25 +21,25 @@ function ht(c = {}) {
|
|
|
21
21
|
const {
|
|
22
22
|
ignoreAccents: h = !0,
|
|
23
23
|
ignoreCase: m = !0,
|
|
24
|
-
limit:
|
|
25
|
-
matchFrom:
|
|
26
|
-
stringify:
|
|
24
|
+
limit: A,
|
|
25
|
+
matchFrom: v = "any",
|
|
26
|
+
stringify: j,
|
|
27
27
|
trim: V = !1
|
|
28
28
|
} = c;
|
|
29
|
-
return (
|
|
29
|
+
return (D, {
|
|
30
30
|
inputValue: M,
|
|
31
31
|
getOptionLabel: b
|
|
32
32
|
}) => {
|
|
33
33
|
let k = V ? M.trim() : M;
|
|
34
34
|
m && (k = k.toLowerCase()), h && (k = Re(k));
|
|
35
|
-
const
|
|
36
|
-
let w = (
|
|
37
|
-
return m && (w = w.toLowerCase()), h && (w = Re(w)),
|
|
38
|
-
}) :
|
|
39
|
-
return typeof
|
|
35
|
+
const B = k ? D.filter((J) => {
|
|
36
|
+
let w = (j || b)(J);
|
|
37
|
+
return m && (w = w.toLowerCase()), h && (w = Re(w)), v === "start" ? w.indexOf(k) === 0 : w.indexOf(k) > -1;
|
|
38
|
+
}) : D;
|
|
39
|
+
return typeof A == "number" ? B.slice(0, A) : B;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function ge(c, h) {
|
|
43
43
|
for (let m = 0; m < c.length; m += 1)
|
|
44
44
|
if (h(c[m]))
|
|
45
45
|
return m;
|
|
@@ -55,50 +55,50 @@ function yt(c) {
|
|
|
55
55
|
unstable_isActiveElementInListbox: h = xt,
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
57
57
|
unstable_classNamePrefix: m = "Mui",
|
|
58
|
-
autoComplete:
|
|
59
|
-
autoHighlight:
|
|
60
|
-
autoSelect:
|
|
58
|
+
autoComplete: A = !1,
|
|
59
|
+
autoHighlight: v = !1,
|
|
60
|
+
autoSelect: j = !1,
|
|
61
61
|
blurOnSelect: V = !1,
|
|
62
|
-
clearOnBlur:
|
|
62
|
+
clearOnBlur: D = !c.freeSolo,
|
|
63
63
|
clearOnEscape: M = !1,
|
|
64
64
|
componentName: b = "useAutocomplete",
|
|
65
65
|
defaultValue: k = c.multiple ? [] : null,
|
|
66
|
-
disableClearable:
|
|
67
|
-
disableCloseOnSelect:
|
|
66
|
+
disableClearable: B = !1,
|
|
67
|
+
disableCloseOnSelect: J = !1,
|
|
68
68
|
disabled: w,
|
|
69
|
-
disabledItemsFocusable:
|
|
70
|
-
disableListWrap:
|
|
71
|
-
filterOptions:
|
|
72
|
-
filterSelectedOptions:
|
|
73
|
-
freeSolo:
|
|
74
|
-
getOptionDisabled:
|
|
75
|
-
getOptionKey:
|
|
76
|
-
getOptionLabel:
|
|
69
|
+
disabledItemsFocusable: he = !1,
|
|
70
|
+
disableListWrap: W = !1,
|
|
71
|
+
filterOptions: me = mt,
|
|
72
|
+
filterSelectedOptions: ee = !1,
|
|
73
|
+
freeSolo: L = !1,
|
|
74
|
+
getOptionDisabled: U,
|
|
75
|
+
getOptionKey: te,
|
|
76
|
+
getOptionLabel: ne = (t) => {
|
|
77
77
|
var e;
|
|
78
78
|
return (e = t.label) != null ? e : t;
|
|
79
79
|
},
|
|
80
|
-
groupBy:
|
|
81
|
-
handleHomeEndKeys:
|
|
82
|
-
id:
|
|
83
|
-
includeInputInList:
|
|
84
|
-
inputValue:
|
|
85
|
-
isOptionEqualToValue:
|
|
80
|
+
groupBy: R,
|
|
81
|
+
handleHomeEndKeys: re = !c.freeSolo,
|
|
82
|
+
id: be,
|
|
83
|
+
includeInputInList: i = !1,
|
|
84
|
+
inputValue: y,
|
|
85
|
+
isOptionEqualToValue: E = (t, e) => t === e,
|
|
86
86
|
multiple: l = !1,
|
|
87
|
-
onChange:
|
|
88
|
-
onClose:
|
|
89
|
-
onHighlightChange:
|
|
90
|
-
onInputChange:
|
|
87
|
+
onChange: T,
|
|
88
|
+
onClose: oe,
|
|
89
|
+
onHighlightChange: se,
|
|
90
|
+
onInputChange: H,
|
|
91
91
|
onOpen: Te,
|
|
92
92
|
open: He,
|
|
93
93
|
openOnFocus: Fe = !1,
|
|
94
|
-
options:
|
|
94
|
+
options: xe,
|
|
95
95
|
readOnly: Y = !1,
|
|
96
96
|
selectOnFocus: qe = !c.freeSolo,
|
|
97
97
|
value: je
|
|
98
|
-
} = c,
|
|
99
|
-
let O =
|
|
98
|
+
} = c, _ = pt(be);
|
|
99
|
+
let O = ne;
|
|
100
100
|
O = (t) => {
|
|
101
|
-
const e =
|
|
101
|
+
const e = ne(t);
|
|
102
102
|
if (typeof e != "string") {
|
|
103
103
|
if (process.env.NODE_ENV !== "production") {
|
|
104
104
|
const n = e === void 0 ? "undefined" : `${typeof e} (${e})`;
|
|
@@ -108,17 +108,17 @@ function yt(c) {
|
|
|
108
108
|
}
|
|
109
109
|
return e;
|
|
110
110
|
};
|
|
111
|
-
const
|
|
111
|
+
const ye = g.useRef(!1), Oe = g.useRef(!0), d = g.useRef(null), $ = g.useRef(null), [ie, Be] = g.useState(null), [P, Ie] = g.useState(-1), _e = v ? 0 : -1, x = g.useRef(_e), [r, Ue] = Ee({
|
|
112
112
|
controlled: je,
|
|
113
113
|
default: k,
|
|
114
114
|
name: b
|
|
115
|
-
}), [u,
|
|
116
|
-
controlled:
|
|
115
|
+
}), [u, le] = Ee({
|
|
116
|
+
controlled: y,
|
|
117
117
|
default: "",
|
|
118
118
|
name: b,
|
|
119
119
|
state: "inputValue"
|
|
120
|
-
}), [
|
|
121
|
-
if (!(l ? r.length < e.length : e !== null) && !
|
|
120
|
+
}), [ae, $e] = g.useState(!1), ue = g.useCallback((t, e) => {
|
|
121
|
+
if (!(l ? r.length < e.length : e !== null) && !D)
|
|
122
122
|
return;
|
|
123
123
|
let o;
|
|
124
124
|
if (l)
|
|
@@ -129,75 +129,75 @@ function yt(c) {
|
|
|
129
129
|
const s = O(e);
|
|
130
130
|
o = typeof s == "string" ? s : "";
|
|
131
131
|
}
|
|
132
|
-
u !== o && (
|
|
133
|
-
}, [O, u, l,
|
|
132
|
+
u !== o && (le(o), H && H(t, o, "reset"));
|
|
133
|
+
}, [O, u, l, H, le, D, r]), [K, Pe] = Ee({
|
|
134
134
|
controlled: He,
|
|
135
135
|
default: !1,
|
|
136
136
|
name: b,
|
|
137
137
|
state: "open"
|
|
138
|
-
}), [Ke, Ae] = g.useState(!0), De = !l && r != null && u === O(r), S =
|
|
139
|
-
|
|
138
|
+
}), [Ke, Ae] = g.useState(!0), De = !l && r != null && u === O(r), S = K && !Y, f = S ? me(
|
|
139
|
+
xe.filter((t) => !(ee && (l ? r : [r]).some((e) => e !== null && E(t, e)))),
|
|
140
140
|
// we use the empty string to manipulate `filterOptions` to not filter any options
|
|
141
141
|
// i.e. the filter predicate always returns true
|
|
142
142
|
{
|
|
143
143
|
inputValue: De && Ke ? "" : u,
|
|
144
144
|
getOptionLabel: O
|
|
145
145
|
}
|
|
146
|
-
) : [],
|
|
146
|
+
) : [], C = gt({
|
|
147
147
|
filteredOptions: f,
|
|
148
148
|
value: r,
|
|
149
149
|
inputValue: u
|
|
150
150
|
});
|
|
151
151
|
g.useEffect(() => {
|
|
152
|
-
const t = r !==
|
|
153
|
-
|
|
154
|
-
}, [r,
|
|
155
|
-
const
|
|
156
|
-
if (process.env.NODE_ENV !== "production" && r !== null && !
|
|
157
|
-
const t = (l ? r : [r]).filter((e) => !
|
|
152
|
+
const t = r !== C.value;
|
|
153
|
+
ae && !t || L && !t || ue(null, r);
|
|
154
|
+
}, [r, ue, ae, C.value, L]);
|
|
155
|
+
const we = K && f.length > 0 && !Y;
|
|
156
|
+
if (process.env.NODE_ENV !== "production" && r !== null && !L && xe.length > 0) {
|
|
157
|
+
const t = (l ? r : [r]).filter((e) => !xe.some((n) => E(n, e)));
|
|
158
158
|
t.length > 0 && console.warn([`MUI: The value provided to ${b} is invalid.`, `None of the options match with \`${t.length > 1 ? JSON.stringify(t) : JSON.stringify(t[0])}\`.`, "You can use the `isOptionEqualToValue` prop to customize the equality test."].join(`
|
|
159
159
|
`));
|
|
160
160
|
}
|
|
161
|
-
const
|
|
162
|
-
t === -1 ? d.current.focus() :
|
|
161
|
+
const ce = pe((t) => {
|
|
162
|
+
t === -1 ? d.current.focus() : ie.querySelector(`[data-tag-index="${t}"]`).focus();
|
|
163
163
|
});
|
|
164
164
|
g.useEffect(() => {
|
|
165
|
-
l &&
|
|
166
|
-
}, [r, l,
|
|
165
|
+
l && P > r.length - 1 && (Ie(-1), ce(-1));
|
|
166
|
+
}, [r, l, P, ce]);
|
|
167
167
|
function ze(t, e) {
|
|
168
|
-
if (
|
|
168
|
+
if (!$.current || t < 0 || t >= f.length)
|
|
169
169
|
return -1;
|
|
170
170
|
let n = t;
|
|
171
171
|
for (; ; ) {
|
|
172
|
-
const o =
|
|
172
|
+
const o = $.current.querySelector(`[data-option-index="${n}"]`), s = he ? !1 : !o || o.disabled || o.getAttribute("aria-disabled") === "true";
|
|
173
173
|
if (o && o.hasAttribute("tabindex") && !s)
|
|
174
174
|
return n;
|
|
175
175
|
if (e === "next" ? n = (n + 1) % f.length : n = (n - 1 + f.length) % f.length, n === t)
|
|
176
176
|
return -1;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const F = pe(({
|
|
180
180
|
event: t,
|
|
181
181
|
index: e,
|
|
182
182
|
reason: n = "auto"
|
|
183
183
|
}) => {
|
|
184
|
-
if (
|
|
184
|
+
if (x.current = e, e === -1 ? d.current.removeAttribute("aria-activedescendant") : d.current.setAttribute("aria-activedescendant", `${_}-option-${e}`), se && se(t, e === -1 ? null : f[e], n), !$.current)
|
|
185
185
|
return;
|
|
186
|
-
const o =
|
|
186
|
+
const o = $.current.querySelector(`[role="option"].${m}-focused`);
|
|
187
187
|
o && (o.classList.remove(`${m}-focused`), o.classList.remove(`${m}-focusVisible`));
|
|
188
|
-
let s =
|
|
189
|
-
if (
|
|
188
|
+
let s = $.current;
|
|
189
|
+
if ($.current.getAttribute("role") !== "listbox" && (s = $.current.parentElement.querySelector('[role="listbox"]')), !s)
|
|
190
190
|
return;
|
|
191
191
|
if (e === -1) {
|
|
192
192
|
s.scrollTop = 0;
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
const a =
|
|
195
|
+
const a = $.current.querySelector(`[data-option-index="${e}"]`);
|
|
196
196
|
if (a && (a.classList.add(`${m}-focused`), n === "keyboard" && a.classList.add(`${m}-focusVisible`), s.scrollHeight > s.clientHeight && n !== "mouse" && n !== "touch")) {
|
|
197
|
-
const p = a, I = s.clientHeight + s.scrollTop,
|
|
198
|
-
|
|
197
|
+
const p = a, I = s.clientHeight + s.scrollTop, de = p.offsetTop + p.offsetHeight;
|
|
198
|
+
de > I ? s.scrollTop = de - s.clientHeight : p.offsetTop - p.offsetHeight * (R ? 1.3 : 0) < s.scrollTop && (s.scrollTop = p.offsetTop - p.offsetHeight * (R ? 1.3 : 0));
|
|
199
199
|
}
|
|
200
|
-
}),
|
|
200
|
+
}), N = pe(({
|
|
201
201
|
event: t,
|
|
202
202
|
diff: e,
|
|
203
203
|
direction: n = "next",
|
|
@@ -213,14 +213,14 @@ function yt(c) {
|
|
|
213
213
|
return 0;
|
|
214
214
|
if (e === "end")
|
|
215
215
|
return p;
|
|
216
|
-
const I =
|
|
217
|
-
return I < 0 ? I === -1 &&
|
|
216
|
+
const I = x.current + e;
|
|
217
|
+
return I < 0 ? I === -1 && i ? -1 : W && x.current !== -1 || Math.abs(e) > 1 ? 0 : p : I > p ? I === p + 1 && i ? -1 : W || Math.abs(e) > 1 ? p : 0 : I;
|
|
218
218
|
})(), n);
|
|
219
|
-
if (
|
|
219
|
+
if (F({
|
|
220
220
|
index: a,
|
|
221
221
|
reason: o,
|
|
222
222
|
event: t
|
|
223
|
-
}),
|
|
223
|
+
}), A && e !== "reset")
|
|
224
224
|
if (a === -1)
|
|
225
225
|
d.current.value = u;
|
|
226
226
|
else {
|
|
@@ -232,48 +232,48 @@ function yt(c) {
|
|
|
232
232
|
const o = e ? O(e) : "", s = n ? O(n) : "";
|
|
233
233
|
return o === s;
|
|
234
234
|
};
|
|
235
|
-
if (
|
|
236
|
-
const e =
|
|
235
|
+
if (x.current !== -1 && C.filteredOptions && C.filteredOptions.length !== f.length && C.inputValue === u && (l ? r.length === C.value.length && C.value.every((e, n) => O(r[n]) === O(e)) : t(C.value, r))) {
|
|
236
|
+
const e = C.filteredOptions[x.current];
|
|
237
237
|
if (e)
|
|
238
|
-
return
|
|
238
|
+
return ge(f, (n) => O(n) === O(e));
|
|
239
239
|
}
|
|
240
240
|
return -1;
|
|
241
|
-
},
|
|
241
|
+
}, Se = g.useCallback(() => {
|
|
242
242
|
if (!S)
|
|
243
243
|
return;
|
|
244
244
|
const t = Je();
|
|
245
245
|
if (t !== -1) {
|
|
246
|
-
|
|
246
|
+
x.current = t;
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
249
|
const e = l ? r[0] : r;
|
|
250
250
|
if (f.length === 0 || e == null) {
|
|
251
|
-
|
|
251
|
+
N({
|
|
252
252
|
diff: "reset"
|
|
253
253
|
});
|
|
254
254
|
return;
|
|
255
255
|
}
|
|
256
|
-
if (
|
|
256
|
+
if ($.current) {
|
|
257
257
|
if (e != null) {
|
|
258
|
-
const n = f[
|
|
259
|
-
if (l && n &&
|
|
258
|
+
const n = f[x.current];
|
|
259
|
+
if (l && n && ge(r, (s) => E(n, s)) !== -1)
|
|
260
260
|
return;
|
|
261
|
-
const o =
|
|
262
|
-
o === -1 ?
|
|
261
|
+
const o = ge(f, (s) => E(s, e));
|
|
262
|
+
o === -1 ? N({
|
|
263
263
|
diff: "reset"
|
|
264
|
-
}) :
|
|
264
|
+
}) : F({
|
|
265
265
|
index: o
|
|
266
266
|
});
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
-
if (
|
|
270
|
-
|
|
269
|
+
if (x.current >= f.length - 1) {
|
|
270
|
+
F({
|
|
271
271
|
index: f.length - 1
|
|
272
272
|
});
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
|
|
276
|
-
index:
|
|
275
|
+
F({
|
|
276
|
+
index: x.current
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
}, [
|
|
@@ -282,47 +282,47 @@ function yt(c) {
|
|
|
282
282
|
// Don't sync the highlighted index with the value when multiple
|
|
283
283
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
284
284
|
l ? !1 : r,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
ee,
|
|
286
|
+
N,
|
|
287
|
+
F,
|
|
288
288
|
S,
|
|
289
289
|
u,
|
|
290
290
|
l
|
|
291
|
-
]), We =
|
|
292
|
-
dt(
|
|
291
|
+
]), We = pe((t) => {
|
|
292
|
+
dt($, t), t && Se();
|
|
293
293
|
});
|
|
294
294
|
process.env.NODE_ENV !== "production" && g.useEffect(() => {
|
|
295
295
|
(!d.current || d.current.nodeName !== "INPUT") && (d.current && d.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${b} where input was expected.`, "This is not a supported scenario but it may work under certain conditions.", "A textarea keyboard navigation may conflict with Autocomplete controls (for example enter and arrow keys).", "Make sure to test keyboard navigation and add custom event handlers if necessary."].join(`
|
|
296
296
|
`)) : console.error([`MUI: Unable to find the input element. It was resolved to ${d.current} while an HTMLInputElement was expected.`, `Instead, ${b} expects an input element.`, "", b === "useAutocomplete" ? "Make sure you have bound getInputProps correctly and that the normal ref/effect resolutions order is guaranteed." : "Make sure you have customized the input component correctly."].join(`
|
|
297
297
|
`)));
|
|
298
298
|
}, [b]), g.useEffect(() => {
|
|
299
|
-
|
|
300
|
-
}, [
|
|
301
|
-
const
|
|
302
|
-
|
|
299
|
+
Se();
|
|
300
|
+
}, [Se]);
|
|
301
|
+
const q = (t) => {
|
|
302
|
+
K || (Pe(!0), Ae(!0), Te && Te(t));
|
|
303
303
|
}, X = (t, e) => {
|
|
304
|
-
|
|
305
|
-
},
|
|
304
|
+
K && (Pe(!1), oe && oe(t, e));
|
|
305
|
+
}, z = (t, e, n, o) => {
|
|
306
306
|
if (l) {
|
|
307
307
|
if (r.length === e.length && r.every((s, a) => s === e[a]))
|
|
308
308
|
return;
|
|
309
309
|
} else if (r === e)
|
|
310
310
|
return;
|
|
311
|
-
|
|
312
|
-
},
|
|
311
|
+
T && T(t, e, n, o), Ue(e);
|
|
312
|
+
}, fe = g.useRef(!1), G = (t, e, n = "selectOption", o = "options") => {
|
|
313
313
|
let s = n, a = e;
|
|
314
314
|
if (l) {
|
|
315
315
|
if (a = Array.isArray(r) ? r.slice() : [], process.env.NODE_ENV !== "production") {
|
|
316
|
-
const I = a.filter((
|
|
316
|
+
const I = a.filter((de) => E(e, de));
|
|
317
317
|
I.length > 1 && console.error([`MUI: The \`isOptionEqualToValue\` method of ${b} does not handle the arguments correctly.`, `The component expects a single value to match a given option but found ${I.length} matches.`].join(`
|
|
318
318
|
`));
|
|
319
319
|
}
|
|
320
|
-
const p =
|
|
320
|
+
const p = ge(a, (I) => E(e, I));
|
|
321
321
|
p === -1 ? a.push(e) : o !== "freeSolo" && (a.splice(p, 1), s = "removeOption");
|
|
322
322
|
}
|
|
323
|
-
|
|
323
|
+
ue(t, a), z(t, a, s, {
|
|
324
324
|
option: e
|
|
325
|
-
}), !
|
|
325
|
+
}), !J && (!t || !t.ctrlKey && !t.metaKey) && X(t, s), (V === !0 || V === "touch" && fe.current || V === "mouse" && !fe.current) && d.current.blur();
|
|
326
326
|
};
|
|
327
327
|
function Ye(t, e) {
|
|
328
328
|
if (t === -1)
|
|
@@ -331,7 +331,7 @@ function yt(c) {
|
|
|
331
331
|
for (; ; ) {
|
|
332
332
|
if (e === "next" && n === r.length || e === "previous" && n === -1)
|
|
333
333
|
return -1;
|
|
334
|
-
const o =
|
|
334
|
+
const o = ie.querySelector(`[data-tag-index="${n}"]`);
|
|
335
335
|
if (!o || !o.hasAttribute("tabindex") || o.disabled || o.getAttribute("aria-disabled") === "true")
|
|
336
336
|
n += e === "next" ? 1 : -1;
|
|
337
337
|
else
|
|
@@ -342,15 +342,15 @@ function yt(c) {
|
|
|
342
342
|
if (!l)
|
|
343
343
|
return;
|
|
344
344
|
u === "" && X(t, "toggleInput");
|
|
345
|
-
let n =
|
|
346
|
-
|
|
345
|
+
let n = P;
|
|
346
|
+
P === -1 ? u === "" && e === "previous" && (n = r.length - 1) : (n += e === "next" ? 1 : -1, n < 0 && (n = 0), n === r.length && (n = -1)), n = Ye(n, e), Ie(n), ce(n);
|
|
347
347
|
}, Ne = (t) => {
|
|
348
|
-
|
|
348
|
+
ye.current = !0, le(""), H && H(t, "", "clear"), z(t, l ? [] : null, "clear");
|
|
349
349
|
}, Xe = (t) => (e) => {
|
|
350
|
-
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (
|
|
350
|
+
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (P !== -1 && ["ArrowLeft", "ArrowRight"].indexOf(e.key) === -1 && (Ie(-1), ce(-1)), e.which !== 229))
|
|
351
351
|
switch (e.key) {
|
|
352
352
|
case "Home":
|
|
353
|
-
S &&
|
|
353
|
+
S && re && (e.preventDefault(), N({
|
|
354
354
|
diff: "start",
|
|
355
355
|
direction: "next",
|
|
356
356
|
reason: "keyboard",
|
|
@@ -358,7 +358,7 @@ function yt(c) {
|
|
|
358
358
|
}));
|
|
359
359
|
break;
|
|
360
360
|
case "End":
|
|
361
|
-
S &&
|
|
361
|
+
S && re && (e.preventDefault(), N({
|
|
362
362
|
diff: "end",
|
|
363
363
|
direction: "previous",
|
|
364
364
|
reason: "keyboard",
|
|
@@ -366,36 +366,36 @@ function yt(c) {
|
|
|
366
366
|
}));
|
|
367
367
|
break;
|
|
368
368
|
case "PageUp":
|
|
369
|
-
e.preventDefault(),
|
|
369
|
+
e.preventDefault(), N({
|
|
370
370
|
diff: -5,
|
|
371
371
|
direction: "previous",
|
|
372
372
|
reason: "keyboard",
|
|
373
373
|
event: e
|
|
374
|
-
}),
|
|
374
|
+
}), q(e);
|
|
375
375
|
break;
|
|
376
376
|
case "PageDown":
|
|
377
|
-
e.preventDefault(),
|
|
377
|
+
e.preventDefault(), N({
|
|
378
378
|
diff: bt,
|
|
379
379
|
direction: "next",
|
|
380
380
|
reason: "keyboard",
|
|
381
381
|
event: e
|
|
382
|
-
}),
|
|
382
|
+
}), q(e);
|
|
383
383
|
break;
|
|
384
384
|
case "ArrowDown":
|
|
385
|
-
e.preventDefault(),
|
|
385
|
+
e.preventDefault(), N({
|
|
386
386
|
diff: 1,
|
|
387
387
|
direction: "next",
|
|
388
388
|
reason: "keyboard",
|
|
389
389
|
event: e
|
|
390
|
-
}),
|
|
390
|
+
}), q(e);
|
|
391
391
|
break;
|
|
392
392
|
case "ArrowUp":
|
|
393
|
-
e.preventDefault(),
|
|
393
|
+
e.preventDefault(), N({
|
|
394
394
|
diff: -1,
|
|
395
395
|
direction: "previous",
|
|
396
396
|
reason: "keyboard",
|
|
397
397
|
event: e
|
|
398
|
-
}),
|
|
398
|
+
}), q(e);
|
|
399
399
|
break;
|
|
400
400
|
case "ArrowLeft":
|
|
401
401
|
Ce(e, "previous");
|
|
@@ -404,82 +404,82 @@ function yt(c) {
|
|
|
404
404
|
Ce(e, "next");
|
|
405
405
|
break;
|
|
406
406
|
case "Enter":
|
|
407
|
-
if (
|
|
408
|
-
const n = f[
|
|
407
|
+
if (x.current !== -1 && S) {
|
|
408
|
+
const n = f[x.current], o = U ? U(n) : !1;
|
|
409
409
|
if (e.preventDefault(), o)
|
|
410
410
|
return;
|
|
411
|
-
G(e, n, "selectOption"),
|
|
412
|
-
} else
|
|
411
|
+
G(e, n, "selectOption"), A && d.current.setSelectionRange(d.current.value.length, d.current.value.length);
|
|
412
|
+
} else L && u !== "" && De === !1 && (l && e.preventDefault(), G(e, u, "createOption", "freeSolo"));
|
|
413
413
|
break;
|
|
414
414
|
case "Escape":
|
|
415
415
|
S ? (e.preventDefault(), e.stopPropagation(), X(e, "escape")) : M && (u !== "" || l && r.length > 0) && (e.preventDefault(), e.stopPropagation(), Ne(e));
|
|
416
416
|
break;
|
|
417
417
|
case "Backspace":
|
|
418
418
|
if (l && !Y && u === "" && r.length > 0) {
|
|
419
|
-
const n =
|
|
420
|
-
o.splice(n, 1),
|
|
419
|
+
const n = P === -1 ? r.length - 1 : P, o = r.slice();
|
|
420
|
+
o.splice(n, 1), z(e, o, "removeOption", {
|
|
421
421
|
option: r[n]
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
break;
|
|
425
425
|
case "Delete":
|
|
426
|
-
if (l && !Y && u === "" && r.length > 0 &&
|
|
427
|
-
const n =
|
|
428
|
-
o.splice(n, 1),
|
|
426
|
+
if (l && !Y && u === "" && r.length > 0 && P !== -1) {
|
|
427
|
+
const n = P, o = r.slice();
|
|
428
|
+
o.splice(n, 1), z(e, o, "removeOption", {
|
|
429
429
|
option: r[n]
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
break;
|
|
433
433
|
}
|
|
434
434
|
}, Ge = (t) => {
|
|
435
|
-
$e(!0), Fe && !
|
|
435
|
+
$e(!0), Fe && !ye.current && q(t);
|
|
436
436
|
}, ve = (t) => {
|
|
437
|
-
if (h(
|
|
437
|
+
if (h($)) {
|
|
438
438
|
d.current.focus();
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
$e(!1),
|
|
441
|
+
$e(!1), Oe.current = !0, ye.current = !1, j && x.current !== -1 && S ? G(t, f[x.current], "blur") : j && L && u !== "" ? G(t, u, "blur", "freeSolo") : D && ue(t, r), X(t, "blur");
|
|
442
442
|
}, Qe = (t) => {
|
|
443
443
|
const e = t.target.value;
|
|
444
|
-
u !== e && (
|
|
444
|
+
u !== e && (le(e), Ae(!1), H && H(t, e, "input")), e === "" ? !B && !l && z(t, null, "clear") : q(t);
|
|
445
445
|
}, Ze = (t) => {
|
|
446
446
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
447
|
-
|
|
447
|
+
x.current !== e && F({
|
|
448
448
|
event: t,
|
|
449
449
|
index: e,
|
|
450
450
|
reason: "mouse"
|
|
451
451
|
});
|
|
452
452
|
}, et = (t) => {
|
|
453
|
-
|
|
453
|
+
F({
|
|
454
454
|
event: t,
|
|
455
455
|
index: Number(t.currentTarget.getAttribute("data-option-index")),
|
|
456
456
|
reason: "touch"
|
|
457
|
-
}),
|
|
457
|
+
}), fe.current = !0;
|
|
458
458
|
}, tt = (t) => {
|
|
459
459
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
460
|
-
G(t, f[e], "selectOption"),
|
|
460
|
+
G(t, f[e], "selectOption"), fe.current = !1;
|
|
461
461
|
}, nt = (t) => (e) => {
|
|
462
462
|
const n = r.slice();
|
|
463
|
-
n.splice(t, 1),
|
|
463
|
+
n.splice(t, 1), z(e, n, "removeOption", {
|
|
464
464
|
option: r[t]
|
|
465
465
|
});
|
|
466
466
|
}, Le = (t) => {
|
|
467
|
-
|
|
467
|
+
K ? X(t, "toggleInput") : q(t);
|
|
468
468
|
}, rt = (t) => {
|
|
469
|
-
t.currentTarget.contains(t.target) && t.target.getAttribute("id") !==
|
|
469
|
+
t.currentTarget.contains(t.target) && t.target.getAttribute("id") !== _ && t.preventDefault();
|
|
470
470
|
}, ot = (t) => {
|
|
471
|
-
t.currentTarget.contains(t.target) && (d.current.focus(), qe &&
|
|
471
|
+
t.currentTarget.contains(t.target) && (d.current.focus(), qe && Oe.current && d.current.selectionEnd - d.current.selectionStart === 0 && d.current.select(), Oe.current = !1);
|
|
472
472
|
}, st = (t) => {
|
|
473
|
-
!w && (u === "" || !
|
|
473
|
+
!w && (u === "" || !K) && Le(t);
|
|
474
474
|
};
|
|
475
|
-
let
|
|
476
|
-
|
|
475
|
+
let ke = L && u.length > 0;
|
|
476
|
+
ke = ke || (l ? r.length > 0 : r !== null);
|
|
477
477
|
let Ve = f;
|
|
478
|
-
if (
|
|
478
|
+
if (R) {
|
|
479
479
|
const t = /* @__PURE__ */ new Map();
|
|
480
480
|
let e = !1;
|
|
481
481
|
Ve = f.reduce((n, o, s) => {
|
|
482
|
-
const a =
|
|
482
|
+
const a = R(o);
|
|
483
483
|
return n.length > 0 && n[n.length - 1].group === a ? n[n.length - 1].options.push(o) : (process.env.NODE_ENV !== "production" && (t.get(a) && !e && (console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${b} returns duplicated headers.`, "You can solve the issue by sorting the options with the output of `groupBy`."), e = !0), t.set(a, !0)), n.push({
|
|
484
484
|
key: s,
|
|
485
485
|
index: s,
|
|
@@ -488,20 +488,20 @@ function yt(c) {
|
|
|
488
488
|
})), n;
|
|
489
489
|
}, []);
|
|
490
490
|
}
|
|
491
|
-
return w &&
|
|
491
|
+
return w && ae && ve(), {
|
|
492
492
|
getRootProps: (t = {}) => Me({
|
|
493
|
-
"aria-owns":
|
|
493
|
+
"aria-owns": we ? `${_}-listbox` : null
|
|
494
494
|
}, t, {
|
|
495
495
|
onKeyDown: Xe(t),
|
|
496
496
|
onMouseDown: rt,
|
|
497
497
|
onClick: ot
|
|
498
498
|
}),
|
|
499
499
|
getInputLabelProps: () => ({
|
|
500
|
-
id: `${
|
|
501
|
-
htmlFor:
|
|
500
|
+
id: `${_}-label`,
|
|
501
|
+
htmlFor: _
|
|
502
502
|
}),
|
|
503
503
|
getInputProps: () => ({
|
|
504
|
-
id:
|
|
504
|
+
id: _,
|
|
505
505
|
value: u,
|
|
506
506
|
onBlur: ve,
|
|
507
507
|
onFocus: Ge,
|
|
@@ -510,9 +510,9 @@ function yt(c) {
|
|
|
510
510
|
// if open then this is handled imperatively so don't let react override
|
|
511
511
|
// only have an opinion about this when closed
|
|
512
512
|
"aria-activedescendant": S ? "" : null,
|
|
513
|
-
"aria-autocomplete":
|
|
514
|
-
"aria-controls":
|
|
515
|
-
"aria-expanded":
|
|
513
|
+
"aria-autocomplete": A ? "both" : "list",
|
|
514
|
+
"aria-controls": we ? `${_}-listbox` : void 0,
|
|
515
|
+
"aria-expanded": we,
|
|
516
516
|
// Disable browser's suggestion that might overlap with the popup.
|
|
517
517
|
// Handle autocomplete but not autofill.
|
|
518
518
|
autoComplete: "off",
|
|
@@ -543,8 +543,8 @@ function yt(c) {
|
|
|
543
543
|
}),
|
|
544
544
|
getListboxProps: () => ({
|
|
545
545
|
role: "listbox",
|
|
546
|
-
id: `${
|
|
547
|
-
"aria-labelledby": `${
|
|
546
|
+
id: `${_}-listbox`,
|
|
547
|
+
"aria-labelledby": `${_}-label`,
|
|
548
548
|
ref: We,
|
|
549
549
|
onMouseDown: (t) => {
|
|
550
550
|
t.preventDefault();
|
|
@@ -555,12 +555,12 @@ function yt(c) {
|
|
|
555
555
|
option: e
|
|
556
556
|
}) => {
|
|
557
557
|
var n;
|
|
558
|
-
const o = (l ? r : [r]).some((a) => a != null &&
|
|
558
|
+
const o = (l ? r : [r]).some((a) => a != null && E(e, a)), s = U ? U(e) : !1;
|
|
559
559
|
return {
|
|
560
|
-
key: (n =
|
|
560
|
+
key: (n = te == null ? void 0 : te(e)) != null ? n : O(e),
|
|
561
561
|
tabIndex: -1,
|
|
562
562
|
role: "option",
|
|
563
|
-
id: `${
|
|
563
|
+
id: `${_}-option-${t}`,
|
|
564
564
|
onMouseMove: Ze,
|
|
565
565
|
onClick: tt,
|
|
566
566
|
onTouchStart: et,
|
|
@@ -569,16 +569,16 @@ function yt(c) {
|
|
|
569
569
|
"aria-selected": o
|
|
570
570
|
};
|
|
571
571
|
},
|
|
572
|
-
id:
|
|
572
|
+
id: _,
|
|
573
573
|
inputValue: u,
|
|
574
574
|
value: r,
|
|
575
|
-
dirty:
|
|
576
|
-
expanded: S &&
|
|
575
|
+
dirty: ke,
|
|
576
|
+
expanded: S && ie,
|
|
577
577
|
popupOpen: S,
|
|
578
|
-
focused:
|
|
579
|
-
anchorEl:
|
|
578
|
+
focused: ae || P !== -1,
|
|
579
|
+
anchorEl: ie,
|
|
580
580
|
setAnchorEl: Be,
|
|
581
|
-
focusedTag:
|
|
581
|
+
focusedTag: P,
|
|
582
582
|
groupedOptions: Ve
|
|
583
583
|
};
|
|
584
584
|
}
|
|
@@ -591,66 +591,84 @@ const Ot = "_autocomplete_mj65r_65", Z = {
|
|
|
591
591
|
labelKey: c,
|
|
592
592
|
valueKey: h,
|
|
593
593
|
renderOption: m,
|
|
594
|
-
customSelectedOptionLabel:
|
|
595
|
-
options:
|
|
596
|
-
type:
|
|
594
|
+
customSelectedOptionLabel: A,
|
|
595
|
+
options: v,
|
|
596
|
+
type: j,
|
|
597
597
|
value: V,
|
|
598
|
-
onChange:
|
|
598
|
+
onChange: D,
|
|
599
599
|
onInputChange: M,
|
|
600
600
|
classNameWrapper: b,
|
|
601
601
|
"data-testid-wrapper": k,
|
|
602
|
-
classNameInputWrapper:
|
|
603
|
-
|
|
602
|
+
classNameInputWrapper: B,
|
|
603
|
+
open: J = void 0,
|
|
604
|
+
onOpen: w = void 0,
|
|
605
|
+
onClose: he = void 0,
|
|
606
|
+
...W
|
|
604
607
|
}) => {
|
|
605
|
-
const
|
|
606
|
-
|
|
608
|
+
const me = lt(), [ee, L] = at("");
|
|
609
|
+
v != null && v.some((i) => typeof i != "string") && (!c && !m || !h) && console.error(
|
|
607
610
|
'[autocomplete] When options is a list of objects, you must provide the "labelKey" or "renderOption" and "valueKey" parameters.'
|
|
608
611
|
);
|
|
609
|
-
const { getRootProps:
|
|
610
|
-
id: `autocomplete_${
|
|
611
|
-
options:
|
|
612
|
-
|
|
612
|
+
const { getRootProps: U, getInputProps: te, getOptionProps: ne, groupedOptions: R, getListboxProps: re } = yt({
|
|
613
|
+
id: `autocomplete_${me}`,
|
|
614
|
+
options: v,
|
|
615
|
+
open: J,
|
|
616
|
+
onOpen: w,
|
|
617
|
+
onClose: he,
|
|
618
|
+
getOptionLabel: (i) => typeof i == "string" ? i : A ? A(i) : String(i[c || "label"]),
|
|
613
619
|
value: V,
|
|
614
|
-
inputValue:
|
|
615
|
-
isOptionEqualToValue: (i,
|
|
620
|
+
inputValue: ee,
|
|
621
|
+
isOptionEqualToValue: (i, y) => typeof i == "string" ? String(i) === String(y) : String(i[h || "id"]) === String(y[h || "id"]),
|
|
616
622
|
getOptionKey(i) {
|
|
617
623
|
return String(typeof i == "string" ? i : i[h || "id"]);
|
|
618
624
|
},
|
|
619
|
-
onChange: (i,
|
|
620
|
-
|
|
625
|
+
onChange: (i, y) => {
|
|
626
|
+
D && D(i, y);
|
|
621
627
|
},
|
|
622
|
-
onInputChange: (i,
|
|
623
|
-
M && M(i,
|
|
628
|
+
onInputChange: (i, y) => {
|
|
629
|
+
M && M(i, y), L(y);
|
|
624
630
|
},
|
|
625
|
-
onHighlightChange: (i,
|
|
626
|
-
var
|
|
627
|
-
if (
|
|
628
|
-
const
|
|
629
|
-
|
|
631
|
+
onHighlightChange: (i, y, E) => {
|
|
632
|
+
var l;
|
|
633
|
+
if (E === "keyboard") {
|
|
634
|
+
const T = document.querySelector("#autocomplete-list"), oe = (i == null ? void 0 : i.target).getAttribute("aria-activedescendant");
|
|
635
|
+
T == null || T.querySelectorAll("li").forEach((se) => se.classList.remove(Z["option-focused"])), (l = T == null ? void 0 : T.querySelector(`[id="${oe}"]`)) == null || l.classList.add(Z["option-focused"]);
|
|
630
636
|
}
|
|
631
637
|
}
|
|
632
|
-
}),
|
|
638
|
+
}), be = {
|
|
633
639
|
...te(),
|
|
634
|
-
...
|
|
635
|
-
classNameWrapper:
|
|
640
|
+
...W,
|
|
641
|
+
classNameWrapper: B
|
|
636
642
|
};
|
|
637
|
-
return /* @__PURE__ */ Q("div", { className: ut(Z.autocomplete, b), "data-testid": k, children: /* @__PURE__ */ it("div", { ...
|
|
643
|
+
return /* @__PURE__ */ Q("div", { className: ut(Z.autocomplete, b), "data-testid": k, children: /* @__PURE__ */ it("div", { ...U(), children: [
|
|
638
644
|
/* @__PURE__ */ Q(
|
|
639
645
|
ft,
|
|
640
646
|
{
|
|
641
|
-
rightIcon:
|
|
642
|
-
...
|
|
647
|
+
rightIcon: j === "search" && /* @__PURE__ */ Q(ct, { color: "var(--accent)", icon: "magnifying-glass" }),
|
|
648
|
+
...be
|
|
643
649
|
}
|
|
644
650
|
),
|
|
645
|
-
R.length > 0 && !
|
|
651
|
+
R.length > 0 && !W.disabled && /* @__PURE__ */ Q(
|
|
646
652
|
"ul",
|
|
647
653
|
{
|
|
648
|
-
...
|
|
654
|
+
...re(),
|
|
649
655
|
id: "autocomplete-list",
|
|
650
656
|
className: Z["autocomplete__dropdown-list"],
|
|
651
|
-
children: R.map((i,
|
|
652
|
-
const
|
|
653
|
-
|
|
657
|
+
children: R.map((i, y) => {
|
|
658
|
+
const { key: E, ...l } = ne({
|
|
659
|
+
option: i,
|
|
660
|
+
index: y
|
|
661
|
+
}), T = typeof i == "string" ? i : m ? m(i) : String(i[c || "label"]);
|
|
662
|
+
return /* @__PURE__ */ Q(
|
|
663
|
+
"li",
|
|
664
|
+
{
|
|
665
|
+
tabIndex: y,
|
|
666
|
+
className: Z["autocomplete__dropdown-item"],
|
|
667
|
+
...l,
|
|
668
|
+
children: T
|
|
669
|
+
},
|
|
670
|
+
E
|
|
671
|
+
);
|
|
654
672
|
})
|
|
655
673
|
}
|
|
656
674
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: <T extends string | object>({ labelKey, valueKey, renderOption, customSelectedOptionLabel, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, ...props }: import('./Autocomplete.tsx').AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: <T extends string | object>({ labelKey, valueKey, renderOption, customSelectedOptionLabel, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, open, onOpen, onClose, ...props }: import('./Autocomplete.tsx').AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
@@ -22,3 +22,4 @@ export declare const WithLeftIcon: Story;
|
|
|
22
22
|
export declare const WithBothIcons: Story;
|
|
23
23
|
export declare const WithInfoMessage: Story;
|
|
24
24
|
export declare const WithErrorMessage: Story;
|
|
25
|
+
export declare const HandleOpenCloseState: Story;
|
|
@@ -1,49 +1,89 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { Avatar as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { SkeletonCircle as
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as o } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar as _ } from "../Avatar/Avatar.js";
|
|
3
|
+
import { Icon as y } from "../Icon/Icon.js";
|
|
4
|
+
import { SkeletonCircle as f, Skeleton as r } from "../Skeleton/Skeleton.js";
|
|
5
5
|
import { Typography as a } from "../Typography/Typography.js";
|
|
6
|
-
import '../../assets/TransactionRow.css';const
|
|
7
|
-
container:
|
|
8
|
-
"container-grid": "_container-
|
|
9
|
-
"container-pending": "_container-
|
|
10
|
-
"container-pending--right": "_container-pending--
|
|
11
|
-
"info-section": "_info-
|
|
12
|
-
"info-section--
|
|
13
|
-
"info-section--
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
import '../../assets/TransactionRow.css';const k = "_container_sv3th_1", w = "_separator_sv3th_63", n = {
|
|
7
|
+
container: k,
|
|
8
|
+
"container-grid": "_container-grid_sv3th_6",
|
|
9
|
+
"container-pending": "_container-pending_sv3th_13",
|
|
10
|
+
"container-pending--right": "_container-pending--right_sv3th_19",
|
|
11
|
+
"info-section": "_info-section_sv3th_27",
|
|
12
|
+
"info-section--content": "_info-section--content_sv3th_31",
|
|
13
|
+
"info-section--item": "_info-section--item_sv3th_35",
|
|
14
|
+
"info-section--right": "_info-section--right_sv3th_52",
|
|
15
|
+
"truncate-text": "_truncate-text_sv3th_56",
|
|
16
|
+
separator: w
|
|
17
|
+
}, D = ({
|
|
18
|
+
dateTime: g,
|
|
19
|
+
category: l,
|
|
20
|
+
categoryType: d,
|
|
21
|
+
name: h,
|
|
19
22
|
type: N,
|
|
20
|
-
installments:
|
|
21
|
-
amount:
|
|
22
|
-
month:
|
|
23
|
-
icon:
|
|
24
|
-
onClick:
|
|
25
|
-
isPendingTransaction:
|
|
26
|
-
isLoading:
|
|
27
|
-
"data-testid":
|
|
28
|
-
}) =>
|
|
29
|
-
|
|
30
|
-
/* @__PURE__ */ e("div", { className:
|
|
31
|
-
/* @__PURE__ */ e("div", { className:
|
|
32
|
-
] }) }) : /* @__PURE__ */ e("div", { className:
|
|
33
|
-
/* @__PURE__ */ e("div", { children:
|
|
34
|
-
/* @__PURE__ */ e("div", { children:
|
|
35
|
-
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */ e(
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
installments: v,
|
|
24
|
+
amount: m,
|
|
25
|
+
month: $,
|
|
26
|
+
icon: p,
|
|
27
|
+
onClick: c,
|
|
28
|
+
isPendingTransaction: b,
|
|
29
|
+
isLoading: i = !1,
|
|
30
|
+
"data-testid": t = "Description"
|
|
31
|
+
}) => b ? /* @__PURE__ */ e("div", { className: n.container, children: /* @__PURE__ */ s("div", { className: n["container-pending"], onClick: () => c == null ? void 0 : c(), children: [
|
|
32
|
+
i ? /* @__PURE__ */ e(f, { size: "32px", "data-testid": `${t}-skeletonIcon` }) : /* @__PURE__ */ e(_, { type: "icon", children: /* @__PURE__ */ e(y, { icon: p || "clock" }) }),
|
|
33
|
+
/* @__PURE__ */ e("div", { className: n["info-section"], children: /* @__PURE__ */ e("div", { className: n["info-section--item"], children: i ? /* @__PURE__ */ e(r, { style: { width: 140 }, "data-testid": `${t}-skeletonName` }) : /* @__PURE__ */ e(a, { color: "var(--gray-95)", variant: "base", "data-testid": `${t}-content`, children: h }) }) }),
|
|
34
|
+
/* @__PURE__ */ e("div", { className: n["container-pending--right"], children: i ? /* @__PURE__ */ e(r, { style: { width: 70 }, "data-testid": `${t}-skeletonAmount` }) : /* @__PURE__ */ e(a, { bold: !0, color: "var(--gray-95)", variant: "base", children: m }) })
|
|
35
|
+
] }) }) : /* @__PURE__ */ e("div", { className: n.container, children: /* @__PURE__ */ s("div", { onClick: () => c == null ? void 0 : c(), className: n["container-grid"], children: [
|
|
36
|
+
/* @__PURE__ */ e("div", { children: i ? /* @__PURE__ */ e(r, { style: { width: 50 }, "data-testid": `${t}-skeletonMonth` }) : /* @__PURE__ */ e(a, { color: "var(--gray-95)", variant: "base", children: $ }) }),
|
|
37
|
+
/* @__PURE__ */ e("div", { children: i ? /* @__PURE__ */ e(r, { style: { width: 90 }, "data-testid": `${t}-skeletonDate` }) : /* @__PURE__ */ e(a, { color: "var(--gray-95)", variant: "base", children: g }) }),
|
|
38
|
+
i ? /* @__PURE__ */ e(f, { size: "32px", "data-testid": `${t}-skeletonIcon` }) : /* @__PURE__ */ e(_, { type: "icon", children: /* @__PURE__ */ e(y, { icon: p || "coin" }) }),
|
|
39
|
+
/* @__PURE__ */ e("div", { className: n["info-section"], children: /* @__PURE__ */ e("div", { className: n["info-section--content"], children: i ? /* @__PURE__ */ s(o, { children: [
|
|
40
|
+
/* @__PURE__ */ e(
|
|
41
|
+
r,
|
|
42
|
+
{
|
|
43
|
+
style: { width: 70, display: "inline-block", marginLeft: "8px" },
|
|
44
|
+
"data-testid": `${t}-skeletonName`
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ e(
|
|
48
|
+
r,
|
|
49
|
+
{
|
|
50
|
+
style: { width: 70, display: "inline-block", marginLeft: "8px" },
|
|
51
|
+
"data-testid": `${t}-skeletonCategory`
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ e(
|
|
55
|
+
r,
|
|
56
|
+
{
|
|
57
|
+
style: { width: 70, display: "inline-block", marginLeft: "8px" },
|
|
58
|
+
"data-testid": `${t}-skeletonCategoryType`
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }) : /* @__PURE__ */ s(
|
|
62
|
+
a,
|
|
63
|
+
{
|
|
64
|
+
color: "var(--gray-95)",
|
|
65
|
+
variant: "base",
|
|
66
|
+
className: n["truncate-text"],
|
|
67
|
+
"data-testid": `${t}-content`,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ e("span", { "data-testid": `${t}-name`, children: h }),
|
|
70
|
+
l && /* @__PURE__ */ s(o, { children: [
|
|
71
|
+
/* @__PURE__ */ e("span", { className: n.separator }),
|
|
72
|
+
/* @__PURE__ */ e("span", { "data-testid": `${t}-category`, children: l })
|
|
73
|
+
] }),
|
|
74
|
+
d && /* @__PURE__ */ s(o, { children: [
|
|
75
|
+
/* @__PURE__ */ e("span", { className: n.separator }),
|
|
76
|
+
/* @__PURE__ */ e("span", { "data-testid": `${t}-categoryType`, children: d })
|
|
77
|
+
] })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
) }) }),
|
|
81
|
+
/* @__PURE__ */ s("div", { className: n["info-section--right"], children: [
|
|
82
|
+
v && /* @__PURE__ */ e("div", { className: n["info-section--item"], children: i ? /* @__PURE__ */ e(r, { style: { width: 70 }, "data-testid": `${t}-skeletonInstallments` }) : /* @__PURE__ */ e(a, { color: "var(--gray-95)", variant: "base", children: v }) }),
|
|
83
|
+
/* @__PURE__ */ e("div", { className: n["info-section--item"], children: i ? /* @__PURE__ */ e(r, { style: { width: 70 }, "data-testid": `${t}-skeletonType` }) : /* @__PURE__ */ e(a, { color: "var(--gray-95)", variant: "base", children: N }) })
|
|
40
84
|
] }),
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
h && /* @__PURE__ */ e("div", { className: i["info-section--item"], children: t ? /* @__PURE__ */ e(r, { style: { width: 70 }, "data-testid": `${n}-skeletonInstallments` }) : /* @__PURE__ */ e(a, { color: "var(--gray-95)", variant: "base", children: h }) }),
|
|
43
|
-
/* @__PURE__ */ e("div", { className: i["info-section--item"], children: t ? /* @__PURE__ */ e(r, { style: { width: 70 }, "data-testid": `${n}-skeletonType` }) : /* @__PURE__ */ e(a, { color: "var(--gray-95)", variant: "base", children: N }) })
|
|
44
|
-
] }),
|
|
45
|
-
/* @__PURE__ */ e("div", { className: i["info-section--right"], children: t ? /* @__PURE__ */ e(r, { style: { width: 140 }, "data-testid": `${n}-skeletonAmount` }) : /* @__PURE__ */ e(a, { bold: !0, variant: "base", children: v }) })
|
|
85
|
+
/* @__PURE__ */ e("div", { className: n["info-section--right"], children: i ? /* @__PURE__ */ e(r, { style: { width: 140 }, "data-testid": `${t}-skeletonAmount` }) : /* @__PURE__ */ e(a, { bold: !0, variant: "base", children: m }) })
|
|
46
86
|
] }) });
|
|
47
87
|
export {
|
|
48
|
-
|
|
88
|
+
D as TransactionRow
|
|
49
89
|
};
|