@rolster/react-components 19.2.0 → 19.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index.js → index.cjs} +1 -1
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/components/organisms/Snackbar/Snackbar.js.map +1 -1
- package/package.json +20 -17
- package/dist/cjs/index.js.map +0 -1
- package/dist/es/assets/index-CvUJnmkm.css +0 -3556
- package/dist/es/index.js +0 -3376
- package/dist/es/index.js.map +0 -1
package/dist/es/index.js
DELETED
|
@@ -1,3376 +0,0 @@
|
|
|
1
|
-
import require$$0, { useMemo, useState, useEffect, useCallback, useRef, useEffectEvent, createContext } from 'react';
|
|
2
|
-
import { currencyFormat, BigDecimal, valueIsDefined, SealedPartial } from '@rolster/commons';
|
|
3
|
-
import { i18n, i18nSubscribe } from '@rolster/i18n';
|
|
4
|
-
import { PaginationController, verifyDayPicker, createDayPicker, createDayRangePicker, verifyMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, verifyYearPicker, ListCollection, locationListCanTop, navigationListFromInput, navigationListFromElement, createAutocompleteStore, PickerListenerEvent, dateOutRange, verifyDateRange } from '@rolster/components';
|
|
5
|
-
import { DAY_LABELS, DateRange, normalizeMinTime, assignDayInDate, dateIsBefore, MONTH_NAMES, Month, Time, dateFormatTemplate, assignYearInDate, assignMonthInDate } from '@rolster/dates';
|
|
6
|
-
import ReactDOM from 'react-dom';
|
|
7
|
-
import { useReactControl } from '@rolster/react-forms';
|
|
8
|
-
|
|
9
|
-
var jsxRuntime = {exports: {}};
|
|
10
|
-
|
|
11
|
-
var reactJsxRuntime_production = {};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @license React
|
|
15
|
-
* react-jsx-runtime.production.js
|
|
16
|
-
*
|
|
17
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the MIT license found in the
|
|
20
|
-
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
var hasRequiredReactJsxRuntime_production;
|
|
24
|
-
|
|
25
|
-
function requireReactJsxRuntime_production () {
|
|
26
|
-
if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
|
|
27
|
-
hasRequiredReactJsxRuntime_production = 1;
|
|
28
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
29
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
30
|
-
function jsxProd(type, config, maybeKey) {
|
|
31
|
-
var key = null;
|
|
32
|
-
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
33
|
-
void 0 !== config.key && (key = "" + config.key);
|
|
34
|
-
if ("key" in config) {
|
|
35
|
-
maybeKey = {};
|
|
36
|
-
for (var propName in config)
|
|
37
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
38
|
-
} else maybeKey = config;
|
|
39
|
-
config = maybeKey.ref;
|
|
40
|
-
return {
|
|
41
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
42
|
-
type: type,
|
|
43
|
-
key: key,
|
|
44
|
-
ref: void 0 !== config ? config : null,
|
|
45
|
-
props: maybeKey
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
49
|
-
reactJsxRuntime_production.jsx = jsxProd;
|
|
50
|
-
reactJsxRuntime_production.jsxs = jsxProd;
|
|
51
|
-
return reactJsxRuntime_production;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var reactJsxRuntime_development = {};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @license React
|
|
58
|
-
* react-jsx-runtime.development.js
|
|
59
|
-
*
|
|
60
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
61
|
-
*
|
|
62
|
-
* This source code is licensed under the MIT license found in the
|
|
63
|
-
* LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
var hasRequiredReactJsxRuntime_development;
|
|
67
|
-
|
|
68
|
-
function requireReactJsxRuntime_development () {
|
|
69
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
70
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
71
|
-
"production" !== process.env.NODE_ENV &&
|
|
72
|
-
(function () {
|
|
73
|
-
function getComponentNameFromType(type) {
|
|
74
|
-
if (null == type) return null;
|
|
75
|
-
if ("function" === typeof type)
|
|
76
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE
|
|
77
|
-
? null
|
|
78
|
-
: type.displayName || type.name || null;
|
|
79
|
-
if ("string" === typeof type) return type;
|
|
80
|
-
switch (type) {
|
|
81
|
-
case REACT_FRAGMENT_TYPE:
|
|
82
|
-
return "Fragment";
|
|
83
|
-
case REACT_PROFILER_TYPE:
|
|
84
|
-
return "Profiler";
|
|
85
|
-
case REACT_STRICT_MODE_TYPE:
|
|
86
|
-
return "StrictMode";
|
|
87
|
-
case REACT_SUSPENSE_TYPE:
|
|
88
|
-
return "Suspense";
|
|
89
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
90
|
-
return "SuspenseList";
|
|
91
|
-
case REACT_ACTIVITY_TYPE:
|
|
92
|
-
return "Activity";
|
|
93
|
-
}
|
|
94
|
-
if ("object" === typeof type)
|
|
95
|
-
switch (
|
|
96
|
-
("number" === typeof type.tag &&
|
|
97
|
-
console.error(
|
|
98
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
99
|
-
),
|
|
100
|
-
type.$$typeof)
|
|
101
|
-
) {
|
|
102
|
-
case REACT_PORTAL_TYPE:
|
|
103
|
-
return "Portal";
|
|
104
|
-
case REACT_CONTEXT_TYPE:
|
|
105
|
-
return type.displayName || "Context";
|
|
106
|
-
case REACT_CONSUMER_TYPE:
|
|
107
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
108
|
-
case REACT_FORWARD_REF_TYPE:
|
|
109
|
-
var innerType = type.render;
|
|
110
|
-
type = type.displayName;
|
|
111
|
-
type ||
|
|
112
|
-
((type = innerType.displayName || innerType.name || ""),
|
|
113
|
-
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
|
114
|
-
return type;
|
|
115
|
-
case REACT_MEMO_TYPE:
|
|
116
|
-
return (
|
|
117
|
-
(innerType = type.displayName || null),
|
|
118
|
-
null !== innerType
|
|
119
|
-
? innerType
|
|
120
|
-
: getComponentNameFromType(type.type) || "Memo"
|
|
121
|
-
);
|
|
122
|
-
case REACT_LAZY_TYPE:
|
|
123
|
-
innerType = type._payload;
|
|
124
|
-
type = type._init;
|
|
125
|
-
try {
|
|
126
|
-
return getComponentNameFromType(type(innerType));
|
|
127
|
-
} catch (x) {}
|
|
128
|
-
}
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
function testStringCoercion(value) {
|
|
132
|
-
return "" + value;
|
|
133
|
-
}
|
|
134
|
-
function checkKeyStringCoercion(value) {
|
|
135
|
-
try {
|
|
136
|
-
testStringCoercion(value);
|
|
137
|
-
var JSCompiler_inline_result = !1;
|
|
138
|
-
} catch (e) {
|
|
139
|
-
JSCompiler_inline_result = true;
|
|
140
|
-
}
|
|
141
|
-
if (JSCompiler_inline_result) {
|
|
142
|
-
JSCompiler_inline_result = console;
|
|
143
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
144
|
-
var JSCompiler_inline_result$jscomp$0 =
|
|
145
|
-
("function" === typeof Symbol &&
|
|
146
|
-
Symbol.toStringTag &&
|
|
147
|
-
value[Symbol.toStringTag]) ||
|
|
148
|
-
value.constructor.name ||
|
|
149
|
-
"Object";
|
|
150
|
-
JSCompiler_temp_const.call(
|
|
151
|
-
JSCompiler_inline_result,
|
|
152
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
153
|
-
JSCompiler_inline_result$jscomp$0
|
|
154
|
-
);
|
|
155
|
-
return testStringCoercion(value);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function getTaskName(type) {
|
|
159
|
-
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
160
|
-
if (
|
|
161
|
-
"object" === typeof type &&
|
|
162
|
-
null !== type &&
|
|
163
|
-
type.$$typeof === REACT_LAZY_TYPE
|
|
164
|
-
)
|
|
165
|
-
return "<...>";
|
|
166
|
-
try {
|
|
167
|
-
var name = getComponentNameFromType(type);
|
|
168
|
-
return name ? "<" + name + ">" : "<...>";
|
|
169
|
-
} catch (x) {
|
|
170
|
-
return "<...>";
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function getOwner() {
|
|
174
|
-
var dispatcher = ReactSharedInternals.A;
|
|
175
|
-
return null === dispatcher ? null : dispatcher.getOwner();
|
|
176
|
-
}
|
|
177
|
-
function UnknownOwner() {
|
|
178
|
-
return Error("react-stack-top-frame");
|
|
179
|
-
}
|
|
180
|
-
function hasValidKey(config) {
|
|
181
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
182
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
183
|
-
if (getter && getter.isReactWarning) return false;
|
|
184
|
-
}
|
|
185
|
-
return void 0 !== config.key;
|
|
186
|
-
}
|
|
187
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
188
|
-
function warnAboutAccessingKey() {
|
|
189
|
-
specialPropKeyWarningShown ||
|
|
190
|
-
((specialPropKeyWarningShown = true),
|
|
191
|
-
console.error(
|
|
192
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
193
|
-
displayName
|
|
194
|
-
));
|
|
195
|
-
}
|
|
196
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
197
|
-
Object.defineProperty(props, "key", {
|
|
198
|
-
get: warnAboutAccessingKey,
|
|
199
|
-
configurable: true
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
203
|
-
var componentName = getComponentNameFromType(this.type);
|
|
204
|
-
didWarnAboutElementRef[componentName] ||
|
|
205
|
-
((didWarnAboutElementRef[componentName] = true),
|
|
206
|
-
console.error(
|
|
207
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
208
|
-
));
|
|
209
|
-
componentName = this.props.ref;
|
|
210
|
-
return void 0 !== componentName ? componentName : null;
|
|
211
|
-
}
|
|
212
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
213
|
-
var refProp = props.ref;
|
|
214
|
-
type = {
|
|
215
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
216
|
-
type: type,
|
|
217
|
-
key: key,
|
|
218
|
-
props: props,
|
|
219
|
-
_owner: owner
|
|
220
|
-
};
|
|
221
|
-
null !== (void 0 !== refProp ? refProp : null)
|
|
222
|
-
? Object.defineProperty(type, "ref", {
|
|
223
|
-
enumerable: false,
|
|
224
|
-
get: elementRefGetterWithDeprecationWarning
|
|
225
|
-
})
|
|
226
|
-
: Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
227
|
-
type._store = {};
|
|
228
|
-
Object.defineProperty(type._store, "validated", {
|
|
229
|
-
configurable: false,
|
|
230
|
-
enumerable: false,
|
|
231
|
-
writable: true,
|
|
232
|
-
value: 0
|
|
233
|
-
});
|
|
234
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
235
|
-
configurable: false,
|
|
236
|
-
enumerable: false,
|
|
237
|
-
writable: true,
|
|
238
|
-
value: null
|
|
239
|
-
});
|
|
240
|
-
Object.defineProperty(type, "_debugStack", {
|
|
241
|
-
configurable: false,
|
|
242
|
-
enumerable: false,
|
|
243
|
-
writable: true,
|
|
244
|
-
value: debugStack
|
|
245
|
-
});
|
|
246
|
-
Object.defineProperty(type, "_debugTask", {
|
|
247
|
-
configurable: false,
|
|
248
|
-
enumerable: false,
|
|
249
|
-
writable: true,
|
|
250
|
-
value: debugTask
|
|
251
|
-
});
|
|
252
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
253
|
-
return type;
|
|
254
|
-
}
|
|
255
|
-
function jsxDEVImpl(
|
|
256
|
-
type,
|
|
257
|
-
config,
|
|
258
|
-
maybeKey,
|
|
259
|
-
isStaticChildren,
|
|
260
|
-
debugStack,
|
|
261
|
-
debugTask
|
|
262
|
-
) {
|
|
263
|
-
var children = config.children;
|
|
264
|
-
if (void 0 !== children)
|
|
265
|
-
if (isStaticChildren)
|
|
266
|
-
if (isArrayImpl(children)) {
|
|
267
|
-
for (
|
|
268
|
-
isStaticChildren = 0;
|
|
269
|
-
isStaticChildren < children.length;
|
|
270
|
-
isStaticChildren++
|
|
271
|
-
)
|
|
272
|
-
validateChildKeys(children[isStaticChildren]);
|
|
273
|
-
Object.freeze && Object.freeze(children);
|
|
274
|
-
} else
|
|
275
|
-
console.error(
|
|
276
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
277
|
-
);
|
|
278
|
-
else validateChildKeys(children);
|
|
279
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
280
|
-
children = getComponentNameFromType(type);
|
|
281
|
-
var keys = Object.keys(config).filter(function (k) {
|
|
282
|
-
return "key" !== k;
|
|
283
|
-
});
|
|
284
|
-
isStaticChildren =
|
|
285
|
-
0 < keys.length
|
|
286
|
-
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
|
287
|
-
: "{key: someKey}";
|
|
288
|
-
didWarnAboutKeySpread[children + isStaticChildren] ||
|
|
289
|
-
((keys =
|
|
290
|
-
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
|
291
|
-
console.error(
|
|
292
|
-
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
293
|
-
isStaticChildren,
|
|
294
|
-
children,
|
|
295
|
-
keys,
|
|
296
|
-
children
|
|
297
|
-
),
|
|
298
|
-
(didWarnAboutKeySpread[children + isStaticChildren] = true));
|
|
299
|
-
}
|
|
300
|
-
children = null;
|
|
301
|
-
void 0 !== maybeKey &&
|
|
302
|
-
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
|
303
|
-
hasValidKey(config) &&
|
|
304
|
-
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
|
305
|
-
if ("key" in config) {
|
|
306
|
-
maybeKey = {};
|
|
307
|
-
for (var propName in config)
|
|
308
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
309
|
-
} else maybeKey = config;
|
|
310
|
-
children &&
|
|
311
|
-
defineKeyPropWarningGetter(
|
|
312
|
-
maybeKey,
|
|
313
|
-
"function" === typeof type
|
|
314
|
-
? type.displayName || type.name || "Unknown"
|
|
315
|
-
: type
|
|
316
|
-
);
|
|
317
|
-
return ReactElement(
|
|
318
|
-
type,
|
|
319
|
-
children,
|
|
320
|
-
maybeKey,
|
|
321
|
-
getOwner(),
|
|
322
|
-
debugStack,
|
|
323
|
-
debugTask
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
function validateChildKeys(node) {
|
|
327
|
-
isValidElement(node)
|
|
328
|
-
? node._store && (node._store.validated = 1)
|
|
329
|
-
: "object" === typeof node &&
|
|
330
|
-
null !== node &&
|
|
331
|
-
node.$$typeof === REACT_LAZY_TYPE &&
|
|
332
|
-
("fulfilled" === node._payload.status
|
|
333
|
-
? isValidElement(node._payload.value) &&
|
|
334
|
-
node._payload.value._store &&
|
|
335
|
-
(node._payload.value._store.validated = 1)
|
|
336
|
-
: node._store && (node._store.validated = 1));
|
|
337
|
-
}
|
|
338
|
-
function isValidElement(object) {
|
|
339
|
-
return (
|
|
340
|
-
"object" === typeof object &&
|
|
341
|
-
null !== object &&
|
|
342
|
-
object.$$typeof === REACT_ELEMENT_TYPE
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
var React = require$$0,
|
|
346
|
-
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
347
|
-
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
348
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
349
|
-
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
350
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
351
|
-
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
352
|
-
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
353
|
-
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
354
|
-
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
355
|
-
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
356
|
-
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
357
|
-
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
358
|
-
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
|
359
|
-
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
|
360
|
-
ReactSharedInternals =
|
|
361
|
-
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
362
|
-
hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
363
|
-
isArrayImpl = Array.isArray,
|
|
364
|
-
createTask = console.createTask
|
|
365
|
-
? console.createTask
|
|
366
|
-
: function () {
|
|
367
|
-
return null;
|
|
368
|
-
};
|
|
369
|
-
React = {
|
|
370
|
-
react_stack_bottom_frame: function (callStackForError) {
|
|
371
|
-
return callStackForError();
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
var specialPropKeyWarningShown;
|
|
375
|
-
var didWarnAboutElementRef = {};
|
|
376
|
-
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
|
|
377
|
-
React,
|
|
378
|
-
UnknownOwner
|
|
379
|
-
)();
|
|
380
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
381
|
-
var didWarnAboutKeySpread = {};
|
|
382
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
383
|
-
reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
|
|
384
|
-
var trackActualOwner =
|
|
385
|
-
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
386
|
-
return jsxDEVImpl(
|
|
387
|
-
type,
|
|
388
|
-
config,
|
|
389
|
-
maybeKey,
|
|
390
|
-
false,
|
|
391
|
-
trackActualOwner
|
|
392
|
-
? Error("react-stack-top-frame")
|
|
393
|
-
: unknownOwnerDebugStack,
|
|
394
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
395
|
-
);
|
|
396
|
-
};
|
|
397
|
-
reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
|
|
398
|
-
var trackActualOwner =
|
|
399
|
-
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
400
|
-
return jsxDEVImpl(
|
|
401
|
-
type,
|
|
402
|
-
config,
|
|
403
|
-
maybeKey,
|
|
404
|
-
true,
|
|
405
|
-
trackActualOwner
|
|
406
|
-
? Error("react-stack-top-frame")
|
|
407
|
-
: unknownOwnerDebugStack,
|
|
408
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
409
|
-
);
|
|
410
|
-
};
|
|
411
|
-
})();
|
|
412
|
-
return reactJsxRuntime_development;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (process.env.NODE_ENV === 'production') {
|
|
416
|
-
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
417
|
-
} else {
|
|
418
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
422
|
-
|
|
423
|
-
function renderClassStatus(base, status = {}, additionals) {
|
|
424
|
-
const _classElement = [base];
|
|
425
|
-
Object.entries(status).forEach(([key, state]) => {
|
|
426
|
-
state &&
|
|
427
|
-
(typeof state === 'string'
|
|
428
|
-
? _classElement.push(`${base}--${state}`)
|
|
429
|
-
: _classElement.push(`${base}--${key}`));
|
|
430
|
-
});
|
|
431
|
-
additionals && _classElement.push(additionals);
|
|
432
|
-
return _classElement.join(' ').trim();
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
const className = 'rls-tabular-text';
|
|
436
|
-
const pointers = ['.', ','];
|
|
437
|
-
function getCharClass(char) {
|
|
438
|
-
return pointers.includes(char)
|
|
439
|
-
? `${className}__pointer`
|
|
440
|
-
: `${className}__char`;
|
|
441
|
-
}
|
|
442
|
-
function RlsTabularText({ className, value }) {
|
|
443
|
-
const codes = useMemo(() => {
|
|
444
|
-
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: value?.split('').map((char, index) => (jsxRuntimeExports.jsx("span", { className: getCharClass(char), children: char }, index))) }));
|
|
445
|
-
}, [value]);
|
|
446
|
-
const _className = useMemo(() => {
|
|
447
|
-
return renderClassStatus('rls-tabular-text', {}, className);
|
|
448
|
-
}, [className]);
|
|
449
|
-
return jsxRuntimeExports.jsx("div", { className: _className, children: codes });
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
function RlsAmount({ value, className, decimals, rlsTheme, symbol }) {
|
|
453
|
-
const classNameAmount = useMemo(() => {
|
|
454
|
-
return renderClassStatus('rls-amount', {}, className);
|
|
455
|
-
}, [className]);
|
|
456
|
-
const { decimal, integer } = useMemo(() => {
|
|
457
|
-
const currency = currencyFormat({ value, decimals });
|
|
458
|
-
if (!currency.includes(',')) {
|
|
459
|
-
return { integer: currency, decimal: '' };
|
|
460
|
-
}
|
|
461
|
-
const currencySplit = currency.split(',');
|
|
462
|
-
return {
|
|
463
|
-
integer: currencySplit[0] + (currencySplit[1] ? ',' : ''),
|
|
464
|
-
decimal: currencySplit[1] || ''
|
|
465
|
-
};
|
|
466
|
-
}, [value, decimals]);
|
|
467
|
-
return (jsxRuntimeExports.jsxs("div", { className: classNameAmount, "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { className: "rls-amount__symbol", children: symbol }), jsxRuntimeExports.jsxs("div", { className: "rls-amount__content", children: [jsxRuntimeExports.jsx(RlsTabularText, { className: "rls-amount__integer", value: integer }), decimal && (jsxRuntimeExports.jsx(RlsTabularText, { className: "rls-amount__decimal", value: decimal }))] })] }));
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
function RlsAvatar({ children, contrasted, rounded, skeleton, rlsTheme }) {
|
|
471
|
-
const className = useMemo(() => {
|
|
472
|
-
return renderClassStatus('rls-avatar', { contrasted, rounded, skeleton });
|
|
473
|
-
}, [contrasted, rounded, skeleton]);
|
|
474
|
-
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: children }));
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
function RlsBadge({ children, contrasted, rlsTheme }) {
|
|
478
|
-
const className = useMemo(() => {
|
|
479
|
-
return renderClassStatus('rls-badge', { contrasted });
|
|
480
|
-
}, [contrasted]);
|
|
481
|
-
return (jsxRuntimeExports.jsx("span", { className: className, "rls-theme": rlsTheme, children: children }));
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
function RlsBreadcrumbLabel({ label }) {
|
|
485
|
-
const className = useMemo(() => {
|
|
486
|
-
return renderClassStatus('rls-breadcrumb__label__a', {
|
|
487
|
-
actionable: !!label.onClick
|
|
488
|
-
});
|
|
489
|
-
}, [label.onClick]);
|
|
490
|
-
return (jsxRuntimeExports.jsx("span", { className: "rls-breadcrumb__label", onClick: label.onClick, children: jsxRuntimeExports.jsx("a", { className: className, "rls-theme": label.rlsTheme, children: label.label }) }));
|
|
491
|
-
}
|
|
492
|
-
function RlsBreadcrumb({ labels }) {
|
|
493
|
-
const children = useMemo(() => {
|
|
494
|
-
return labels.map((label, index) => (jsxRuntimeExports.jsx(RlsBreadcrumbLabel, { label: label }, index)));
|
|
495
|
-
}, [labels]);
|
|
496
|
-
return jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: children });
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
function RlsIcon({ value, className, rlsTheme, skeleton }) {
|
|
500
|
-
const classNameIcon = useMemo(() => {
|
|
501
|
-
return renderClassStatus('rls-icon', { skeleton }, className);
|
|
502
|
-
}, [className, skeleton]);
|
|
503
|
-
return (jsxRuntimeExports.jsx("div", { className: classNameIcon, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("i", { className: `rls-icon-${value}` }) }));
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function RlsSpinner() {
|
|
507
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-spinner", children: [jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--1", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--2", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--3", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--4", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--5", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--6", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--7", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--8", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) }), jsxRuntimeExports.jsx("svg", { className: "rls-spinner__svg rls-spinner__svg--9", viewBox: "0 0 64 64", children: jsxRuntimeExports.jsx("circle", {}) })] }));
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
function RlsButton({ type, children, disabled, identifier, onClick, prefixIcon, requesting, rlsTheme, suffixIcon }) {
|
|
511
|
-
const className = useMemo(() => {
|
|
512
|
-
return renderClassStatus('rls-button__content', { type });
|
|
513
|
-
}, [type]);
|
|
514
|
-
return (jsxRuntimeExports.jsx("button", { id: identifier, className: "rls-button", onClick: onClick, "rls-theme": rlsTheme, disabled: disabled, children: jsxRuntimeExports.jsxs("div", { className: className, children: [requesting && jsxRuntimeExports.jsx(RlsSpinner, {}), prefixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: prefixIcon }), children && jsxRuntimeExports.jsx("div", { className: "rls-button__description", children: children }), suffixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: suffixIcon })] }) }));
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
function RlsButtonAction({ icon, disabled, identifier, onClick, tooltip }) {
|
|
518
|
-
return (jsxRuntimeExports.jsxs("button", { id: identifier, className: "rls-button-action", onClick: onClick, disabled: disabled, children: [jsxRuntimeExports.jsx("div", { className: "rls-button-action__content", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) }), tooltip && (jsxRuntimeExports.jsx("div", { className: "rls-button-action__tooltip rls-overline-medium", children: jsxRuntimeExports.jsx("span", { children: tooltip }) }))] }));
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function useFormSingleSelectionController({ disabled, formControl, onValue, value }) {
|
|
522
|
-
const [checked, setChecked] = useState(formControl?.value === value);
|
|
523
|
-
useEffect(() => {
|
|
524
|
-
setChecked(formControl?.value === value);
|
|
525
|
-
}, [formControl?.value]);
|
|
526
|
-
const onSelect = useCallback(() => {
|
|
527
|
-
if (!disabled) {
|
|
528
|
-
formControl && formControl.setValue(value);
|
|
529
|
-
onValue && onValue(value);
|
|
530
|
-
}
|
|
531
|
-
}, [formControl, value, onValue, disabled]);
|
|
532
|
-
return { checked, onSelect };
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
function RlsButtonOption({ icon, children, disabled, formControl, identifier, onClick, onValue, value }) {
|
|
536
|
-
const { checked, onSelect } = useFormSingleSelectionController({
|
|
537
|
-
disabled,
|
|
538
|
-
formControl,
|
|
539
|
-
onValue,
|
|
540
|
-
value
|
|
541
|
-
});
|
|
542
|
-
const className = useMemo(() => {
|
|
543
|
-
return renderClassStatus('rls-button-option', { checked });
|
|
544
|
-
}, [checked]);
|
|
545
|
-
const onAction = useCallback(() => {
|
|
546
|
-
onSelect();
|
|
547
|
-
onClick && onClick();
|
|
548
|
-
}, [onSelect, onClick]);
|
|
549
|
-
return (jsxRuntimeExports.jsxs("button", { id: identifier, className: className, onClick: onAction, disabled: disabled, children: [jsxRuntimeExports.jsx(RlsIcon, { value: icon }), children] }));
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
function RlsCheckBox({ checked, disabled, identifier, onClick, rlsTheme }) {
|
|
553
|
-
const className = useMemo(() => {
|
|
554
|
-
return renderClassStatus('rls-checkbox', { checked, disabled });
|
|
555
|
-
}, [checked, disabled]);
|
|
556
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx(RlsIcon, { value: "checkmark" }) }));
|
|
557
|
-
}
|
|
558
|
-
function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
559
|
-
const onClick = useCallback(() => {
|
|
560
|
-
formControl.setValue(!formControl.value);
|
|
561
|
-
}, [formControl.value]);
|
|
562
|
-
return (jsxRuntimeExports.jsx(RlsCheckBox, { identifier: identifier, checked: !!formControl.value, disabled: disabled, onClick: onClick, rlsTheme: rlsTheme }));
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function RlsSkeleton({ rlsTheme }) {
|
|
566
|
-
return jsxRuntimeExports.jsx("div", { className: "rls-skeleton", "rls-theme": rlsTheme });
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
function RlsImage({ src, rlsTheme }) {
|
|
570
|
-
const [srcIsComplet, setSrcIsComplet] = useState(false);
|
|
571
|
-
const refSrc = useRef(src);
|
|
572
|
-
const className = useMemo(() => {
|
|
573
|
-
return renderClassStatus('rls-image', { complet: srcIsComplet });
|
|
574
|
-
}, [srcIsComplet]);
|
|
575
|
-
useEffect(() => {
|
|
576
|
-
if (refSrc.current !== src) {
|
|
577
|
-
setSrcIsComplet(false);
|
|
578
|
-
refSrc.current = src;
|
|
579
|
-
}
|
|
580
|
-
}, [src]);
|
|
581
|
-
const onLoad = useCallback(() => {
|
|
582
|
-
setSrcIsComplet(true);
|
|
583
|
-
}, []);
|
|
584
|
-
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [!srcIsComplet && jsxRuntimeExports.jsx(RlsSkeleton, { rlsTheme: rlsTheme }), jsxRuntimeExports.jsx("img", { src: src, onLoad: onLoad })] }));
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
function RlsInput({ children, decimals, disabled, formControl, identifier, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
588
|
-
const valueInitial = (formControl?.value ?? value) ? String(value) : '';
|
|
589
|
-
const [valueInput, setValueInput] = useState(valueInitial);
|
|
590
|
-
const [focused, setFocused] = useState(false);
|
|
591
|
-
const changeIsInternal = useRef(false);
|
|
592
|
-
useEffect(() => {
|
|
593
|
-
if (!changeIsInternal.current && formControl) {
|
|
594
|
-
const valueControl = formControl.value ? String(formControl.value) : '';
|
|
595
|
-
valueInput !== valueControl && setValueInput(valueControl);
|
|
596
|
-
}
|
|
597
|
-
changeIsInternal.current = false;
|
|
598
|
-
}, [formControl?.value]);
|
|
599
|
-
const onChangeInput = useCallback((event) => {
|
|
600
|
-
const valueInput = event.target.value;
|
|
601
|
-
const value = type === 'number'
|
|
602
|
-
? parseFloat((+valueInput).toFixed(decimals))
|
|
603
|
-
: valueInput;
|
|
604
|
-
changeIsInternal.current = true;
|
|
605
|
-
onValue?.(value);
|
|
606
|
-
setValueInput(valueInput);
|
|
607
|
-
formControl?.setValue(value);
|
|
608
|
-
}, [formControl, onValue, type, decimals]);
|
|
609
|
-
const onKeyDownInput = useCallback((event) => {
|
|
610
|
-
onKeyDown?.(event);
|
|
611
|
-
event.key === 'Enter' && onEnter?.();
|
|
612
|
-
}, [onKeyDown, onEnter]);
|
|
613
|
-
const onKeyUpInput = useCallback((event) => {
|
|
614
|
-
onKeyUp?.(event);
|
|
615
|
-
}, [onKeyUp]);
|
|
616
|
-
const onFocusInput = useCallback(() => {
|
|
617
|
-
formControl?.focus();
|
|
618
|
-
setFocused(() => true);
|
|
619
|
-
onFocus?.();
|
|
620
|
-
}, [formControl, onFocus]);
|
|
621
|
-
const onBlurInput = useCallback(() => {
|
|
622
|
-
formControl?.blur();
|
|
623
|
-
setFocused(() => false);
|
|
624
|
-
onBlur?.();
|
|
625
|
-
}, [formControl, onBlur]);
|
|
626
|
-
const className = useMemo(() => {
|
|
627
|
-
return renderClassStatus('rls-input', {
|
|
628
|
-
disabled: formControl?.disabled || disabled,
|
|
629
|
-
focused: formControl?.focused ?? focused
|
|
630
|
-
});
|
|
631
|
-
}, [formControl?.focused, formControl?.disabled, focused, disabled]);
|
|
632
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type ?? 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, readOnly: readOnly, onFocus: onFocusInput, onBlur: onBlurInput, onChange: onChangeInput, onKeyDown: onKeyDownInput, onKeyUp: onKeyUpInput, value: valueInput }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
function RlsInputDecimal(props) {
|
|
636
|
-
const { decimals, formControl, identifier, onValue, symbol, value } = props;
|
|
637
|
-
const [valueInput, setValueInput] = useState((formControl?.value ?? value ?? BigDecimal.zero()).rounded);
|
|
638
|
-
const amount = useMemo(() => {
|
|
639
|
-
return formControl?.value?.rounded ?? valueInput;
|
|
640
|
-
}, [formControl?.value, valueInput]);
|
|
641
|
-
const onValueInput = useCallback((value) => {
|
|
642
|
-
const valueDecimal = BigDecimal.create(value);
|
|
643
|
-
formControl ? formControl.setValue(valueDecimal) : setValueInput(value);
|
|
644
|
-
onValue?.(valueDecimal);
|
|
645
|
-
}, [formControl, onValue]);
|
|
646
|
-
const decimalProps = { ...props, formControl: undefined };
|
|
647
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-decimal", children: jsxRuntimeExports.jsx(RlsInput, { ...decimalProps, type: "number", value: valueInput, onValue: onValueInput, children: jsxRuntimeExports.jsx(RlsAmount, { value: amount, symbol: symbol, decimals: decimals }) }) }));
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
function RlsInputMoney(props) {
|
|
651
|
-
const { decimals, formControl, identifier, onValue, symbol, value } = props;
|
|
652
|
-
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
653
|
-
const onValueInput = useCallback((value) => {
|
|
654
|
-
!formControl && setValueInput(value);
|
|
655
|
-
onValue?.(value);
|
|
656
|
-
}, [formControl, onValue]);
|
|
657
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { ...props, type: "number", value: valueInput, onValue: onValueInput, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value ?? valueInput, symbol: symbol, decimals: decimals }) }) }));
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
function RlsInputNumber(props) {
|
|
661
|
-
const { formControl, identifier, onValue, value } = props;
|
|
662
|
-
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
663
|
-
const onValueInput = useCallback((value) => {
|
|
664
|
-
!formControl && setValueInput(value);
|
|
665
|
-
onValue?.(value);
|
|
666
|
-
}, [formControl, onValue]);
|
|
667
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { ...props, type: "number", value: valueInput, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
function RlsInputPassword({ disabled, formControl, identifier, onEnter, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type }) {
|
|
671
|
-
const [focused, setFocused] = useState(false);
|
|
672
|
-
const _onChange = useCallback((event) => {
|
|
673
|
-
formControl?.setValue(event.target.value);
|
|
674
|
-
onValue?.(event.target.value);
|
|
675
|
-
}, [formControl, onValue]);
|
|
676
|
-
const _onKeyDown = useCallback((event) => {
|
|
677
|
-
onKeyDown && onKeyDown(event);
|
|
678
|
-
event.key === 'Enter' && onEnter && onEnter();
|
|
679
|
-
}, [onKeyDown, onEnter]);
|
|
680
|
-
const _onKeyUp = useCallback((event) => {
|
|
681
|
-
onKeyUp && onKeyUp(event);
|
|
682
|
-
}, [onKeyUp]);
|
|
683
|
-
const _onFocus = useCallback(() => {
|
|
684
|
-
formControl?.focus();
|
|
685
|
-
setFocused(() => true);
|
|
686
|
-
}, [formControl]);
|
|
687
|
-
const _onBlur = useCallback(() => {
|
|
688
|
-
formControl?.blur();
|
|
689
|
-
setFocused(() => false);
|
|
690
|
-
}, [formControl]);
|
|
691
|
-
const className = useMemo(() => {
|
|
692
|
-
return renderClassStatus('rls-input-password', {
|
|
693
|
-
disabled: formControl?.disabled || disabled,
|
|
694
|
-
focused: formControl?.focused ?? focused
|
|
695
|
-
});
|
|
696
|
-
}, [formControl?.focused, formControl?.disabled, focused, disabled]);
|
|
697
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type ?? 'password', placeholder: placeholder, disabled: disabled, readOnly: readOnly, onFocus: _onFocus, onBlur: _onBlur, onChange: _onChange, onKeyDown: _onKeyDown, onKeyUp: _onKeyUp }) }));
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function RlsInputPercentage(props) {
|
|
701
|
-
const { formControl, identifier, onValue, value } = props;
|
|
702
|
-
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
703
|
-
const onValueInput = useCallback((value) => {
|
|
704
|
-
!formControl && setValueInput(value);
|
|
705
|
-
onValue?.(value);
|
|
706
|
-
}, [formControl, onValue]);
|
|
707
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-percentage", children: jsxRuntimeExports.jsxs(RlsInput, { ...props, type: "number", value: valueInput, onValue: onValueInput, children: [formControl?.value ?? valueInput, "%"] }) }));
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
function RlsInputSearch({ formControl, disabled, identifier, onEnter, onSearch, placeholder }) {
|
|
711
|
-
const [value, setValue] = useState('');
|
|
712
|
-
const className = useMemo(() => {
|
|
713
|
-
return renderClassStatus('rls-input-search', { disabled });
|
|
714
|
-
}, [disabled]);
|
|
715
|
-
const onValue = useCallback((value) => {
|
|
716
|
-
!formControl && setValue(() => value);
|
|
717
|
-
}, [formControl]);
|
|
718
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, placeholder: placeholder, onEnter: onEnter, onValue: onValue, disabled: disabled, children: formControl?.value ?? value }), onSearch && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: "search", onClick: onSearch, disabled: disabled }))] }));
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
function RlsInputText(props) {
|
|
722
|
-
const { formControl, identifier, onValue, value } = props;
|
|
723
|
-
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? '');
|
|
724
|
-
const onValueInput = useCallback((value) => {
|
|
725
|
-
!formControl && setValueInput(value);
|
|
726
|
-
onValue?.(value);
|
|
727
|
-
}, [formControl, onValue]);
|
|
728
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { ...props, type: "text", value: valueInput, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
function RlsLabel({ children, rlsTheme }) {
|
|
732
|
-
return (jsxRuntimeExports.jsx("span", { className: "rls-label", "rls-theme": rlsTheme, children: children }));
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
function RlsMessageIcon({ icon, children, rlsTheme }) {
|
|
736
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-message-icon", "rls-theme": rlsTheme, children: [icon && jsxRuntimeExports.jsx(RlsIcon, { value: icon }), jsxRuntimeExports.jsx("span", { className: "truncate", children: children })] }));
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
function RlsPoster({ children, contrasted, rlsTheme }) {
|
|
740
|
-
const className = useMemo(() => {
|
|
741
|
-
return renderClassStatus('rls-poster', { contrasted });
|
|
742
|
-
}, [contrasted]);
|
|
743
|
-
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: children }));
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
function RlsProgressBar({ indeterminate, percentage, rlsTheme }) {
|
|
747
|
-
const className = useMemo(() => {
|
|
748
|
-
return renderClassStatus('rls-progress-bar', { indeterminate });
|
|
749
|
-
}, [indeterminate]);
|
|
750
|
-
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-progress-bar__component", style: { width: `${percentage ?? 0}%` } }) }));
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
function RlsProgressCircular({ rlsTheme }) {
|
|
754
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-progress-circular", "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("svg", { className: "rls-progress-circular__svg", viewBox: "0 0 36 36", children: jsxRuntimeExports.jsx("circle", { className: "rls-progress-circular__circle", cx: "18", cy: "18", r: "12" }) }) }));
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
function RlsRadioButton({ checked, disabled, identifier, rlsTheme, onClick }) {
|
|
758
|
-
const className = useMemo(() => {
|
|
759
|
-
return renderClassStatus('rls-radiobutton', { checked, disabled });
|
|
760
|
-
}, [checked, disabled]);
|
|
761
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-radiobutton__component" }) }));
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
function RlsSkeletonText({ active, children, rlsTheme }) {
|
|
765
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-skeleton-text", "rls-theme": rlsTheme, children: active ? (jsxRuntimeExports.jsx(RlsSkeleton, {})) : (jsxRuntimeExports.jsx("div", { className: "rls-skeleton-text__value", children: children })) }));
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
function RlsSwitch({ checked, capsule, disabled, identifier, onClick, rlsTheme }) {
|
|
769
|
-
const className = useMemo(() => {
|
|
770
|
-
return renderClassStatus('rls-switch', { checked, capsule, disabled });
|
|
771
|
-
}, [checked, capsule, disabled]);
|
|
772
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-switch__component", children: jsxRuntimeExports.jsx("div", { className: "rls-switch__component__element" }) }) }));
|
|
773
|
-
}
|
|
774
|
-
function RlsSwitchControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
775
|
-
const onClick = useCallback(() => {
|
|
776
|
-
formControl.setValue(!formControl.value);
|
|
777
|
-
}, [formControl.value]);
|
|
778
|
-
return (jsxRuntimeExports.jsx(RlsSwitch, { identifier: identifier, checked: formControl.value, disabled: disabled, onClick: onClick, rlsTheme: rlsTheme }));
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
function RlsAlert({ bordered, children, icon, identifier, rlsTheme }) {
|
|
782
|
-
const className = useMemo(() => {
|
|
783
|
-
return renderClassStatus('rls-alert', { bordered });
|
|
784
|
-
}, [bordered]);
|
|
785
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [icon && (jsxRuntimeExports.jsx("div", { className: "rls-alert__icon", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) })), jsxRuntimeExports.jsx("div", { className: "rls-alert__content", children: children })] }));
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
function RlsBallot({ bordered, className, children, img, initials, skeleton, subtitle, rlsTheme }) {
|
|
789
|
-
const classNameBallot = useMemo(() => {
|
|
790
|
-
return renderClassStatus('rls-ballot', { bordered, skeleton }, className);
|
|
791
|
-
}, [bordered, skeleton, className]);
|
|
792
|
-
return (jsxRuntimeExports.jsxs("div", { className: classNameBallot, "rls-theme": rlsTheme, children: [(img || initials) && (jsxRuntimeExports.jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsxRuntimeExports.jsx("img", { src: img }), initials && jsxRuntimeExports.jsx("span", { children: initials })] })), jsxRuntimeExports.jsxs("div", { className: "rls-ballot__component", children: [jsxRuntimeExports.jsx("div", { className: "rls-ballot__title", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-ballot__subtitle", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: subtitle }) }))] })] }));
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
function RlsButtonProgress({ icon, disabled, onClick, progressing, rlsTheme }) {
|
|
796
|
-
const className = useMemo(() => {
|
|
797
|
-
return renderClassStatus('rls-button-progress', { progressing });
|
|
798
|
-
}, [progressing]);
|
|
799
|
-
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [!progressing && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: icon, onClick: onClick, disabled: disabled })), progressing && jsxRuntimeExports.jsx(RlsProgressCircular, {})] }));
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsTheme }) {
|
|
803
|
-
const componentRef = useRef(null);
|
|
804
|
-
const [action, setAction] = useState(options[0]);
|
|
805
|
-
const [visible, setVisible] = useState(false);
|
|
806
|
-
useEffect(() => {
|
|
807
|
-
function onCloseMenu({ target }) {
|
|
808
|
-
!componentRef?.current?.contains(target) && setVisible(false);
|
|
809
|
-
}
|
|
810
|
-
document.addEventListener('click', onCloseMenu);
|
|
811
|
-
return () => {
|
|
812
|
-
document.removeEventListener('click', onCloseMenu);
|
|
813
|
-
};
|
|
814
|
-
}, []);
|
|
815
|
-
const classNameList = useMemo(() => {
|
|
816
|
-
return renderClassStatus('rls-button-toggle__list', {
|
|
817
|
-
hide: !visible,
|
|
818
|
-
visible
|
|
819
|
-
});
|
|
820
|
-
}, [visible]);
|
|
821
|
-
const onClickMenu = useCallback(() => {
|
|
822
|
-
setVisible((visible) => !visible);
|
|
823
|
-
}, []);
|
|
824
|
-
const onSelectAction = useCallback((action) => {
|
|
825
|
-
setAction(() => action);
|
|
826
|
-
setVisible(() => false);
|
|
827
|
-
automatic && onAction(action.value);
|
|
828
|
-
}, [onAction, automatic]);
|
|
829
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: () => {
|
|
830
|
-
onAction(action.value);
|
|
831
|
-
}, children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className: classNameList, children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "truncate", onClick: () => {
|
|
832
|
-
onSelectAction(action);
|
|
833
|
-
}, children: action.label }, index))) }) })] }));
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
function RlsContent({ children, identifier, rlsTheme }) {
|
|
837
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-app__page__content", "rls-theme": rlsTheme, children: children }));
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
const errors = {
|
|
841
|
-
es: {
|
|
842
|
-
alphabetic: 'Campo solo permite caracteres',
|
|
843
|
-
alphanumber: 'Campo solo permite caracteres y número',
|
|
844
|
-
checked: 'Campo debe ser seleccionado',
|
|
845
|
-
decimal: 'Campo debe ser número decimal',
|
|
846
|
-
defined: 'Campo debe estar definido',
|
|
847
|
-
email: 'Campo debe ser correo electrónico',
|
|
848
|
-
greaterThanValue: 'Campo debe tener un valor mayor a {thanValue}',
|
|
849
|
-
greaterOrEqualsThanValue: 'Campo debe tener un valor mayor o igual a {thanValue}',
|
|
850
|
-
lessThanValue: 'Campo debe tener un valor menor a {thanValue}',
|
|
851
|
-
lessOrEqualsThanValue: 'Campo debe tener un valor menor o igual a {thanValue}',
|
|
852
|
-
maxValue: 'Campo debe tener un valor máximo de {thanValue}',
|
|
853
|
-
minValue: 'Campo debe tener un valor mínimo de {thanValue}',
|
|
854
|
-
nickname: 'Campo inválido para nombre de usuario',
|
|
855
|
-
onlyNumber: 'Campo debe ser númerico',
|
|
856
|
-
password: 'Campo no permitido para password',
|
|
857
|
-
required: 'Campo es requerido',
|
|
858
|
-
strMinlength: 'Campo debe tener mínimo {length} caracter(es)',
|
|
859
|
-
strMaxlength: 'Campo debe tener máximo {length} caracter(es)',
|
|
860
|
-
strReqLength: 'Campo debe tener {length} caracter(es)',
|
|
861
|
-
textonly: 'Campo solo permite caracteres (sin espacio)',
|
|
862
|
-
_unknown: 'Campo inválido {error}'
|
|
863
|
-
},
|
|
864
|
-
en: {
|
|
865
|
-
alphabetic: 'Field only allows characters',
|
|
866
|
-
alphanumber: 'Field only allows characters and number',
|
|
867
|
-
checked: 'Field must be selected',
|
|
868
|
-
decimal: 'Field must be decimal number',
|
|
869
|
-
defined: 'Field must be defined',
|
|
870
|
-
email: 'Field must be email',
|
|
871
|
-
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
872
|
-
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
873
|
-
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
874
|
-
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
875
|
-
minValue: 'Field must have a minimum value of {thanValue}',
|
|
876
|
-
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
877
|
-
nickname: 'Invalid field for username',
|
|
878
|
-
onlyNumber: 'Field must be numeric',
|
|
879
|
-
password: 'Field not allowed for password',
|
|
880
|
-
strReqLength: 'Field must be {length} characters',
|
|
881
|
-
required: 'Field is required',
|
|
882
|
-
strMinlength: 'Field must have minimum {length} characters',
|
|
883
|
-
strMaxlength: 'Field must have maximum {length} characters',
|
|
884
|
-
textonly: 'Field only allows characters (no space)',
|
|
885
|
-
_unknown: 'Invalid field {error}'
|
|
886
|
-
},
|
|
887
|
-
fr: {
|
|
888
|
-
alphabetic: 'Field only allows characters',
|
|
889
|
-
alphanumber: 'Field only allows characters and number',
|
|
890
|
-
checked: 'Field must be selected',
|
|
891
|
-
decimal: 'Field must be decimal number',
|
|
892
|
-
defined: 'Field must be defined',
|
|
893
|
-
email: 'Field must be email',
|
|
894
|
-
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
895
|
-
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
896
|
-
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
897
|
-
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
898
|
-
minValue: 'Field must have a minimum value of {thanValue}',
|
|
899
|
-
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
900
|
-
nickname: 'Invalid field for username',
|
|
901
|
-
onlyNumber: 'Field must be numeric',
|
|
902
|
-
password: 'Field not allowed for password',
|
|
903
|
-
strReqLength: 'Field must be {length} characters',
|
|
904
|
-
required: 'Field is required',
|
|
905
|
-
strMinlength: 'Field must have minimum {length} characters',
|
|
906
|
-
strMaxlength: 'Field must have maximum {length} characters',
|
|
907
|
-
textonly: 'Field only allows characters (no space)',
|
|
908
|
-
_unknown: 'Invalid field {error}'
|
|
909
|
-
},
|
|
910
|
-
pt: {
|
|
911
|
-
alphabetic: 'Field only allows characters',
|
|
912
|
-
alphanumber: 'Field only allows characters and number',
|
|
913
|
-
checked: 'Field must be selected',
|
|
914
|
-
decimal: 'Field must be decimal number',
|
|
915
|
-
defined: 'Field must be defined',
|
|
916
|
-
email: 'Field must be email',
|
|
917
|
-
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
918
|
-
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
919
|
-
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
920
|
-
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
921
|
-
minValue: 'Field must have a minimum value of {thanValue}',
|
|
922
|
-
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
923
|
-
nickname: 'Invalid field for username',
|
|
924
|
-
onlyNumber: 'Field must be numeric',
|
|
925
|
-
password: 'Field not allowed for password',
|
|
926
|
-
strReqLength: 'Field must be {length} characters',
|
|
927
|
-
required: 'Field is required',
|
|
928
|
-
strMinlength: 'Field must have minimum {length} characters',
|
|
929
|
-
strMaxlength: 'Field must have maximum {length} characters',
|
|
930
|
-
textonly: 'Field only allows characters (no space)',
|
|
931
|
-
_unknown: 'Invalid field {error}'
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
let _msgErrorsI18n = i18n(errors);
|
|
935
|
-
function setErrorsI18n(dictionary) {
|
|
936
|
-
_msgErrorsI18n = i18n(Object.entries(errors).reduce((errors, [key, value]) => {
|
|
937
|
-
// Merge keys from dictionary in errors i18n
|
|
938
|
-
errors[key] = {
|
|
939
|
-
...value,
|
|
940
|
-
...dictionary[key]
|
|
941
|
-
};
|
|
942
|
-
return errors;
|
|
943
|
-
}, {}));
|
|
944
|
-
}
|
|
945
|
-
function msgErrorsI18n(key, language, interpolators) {
|
|
946
|
-
return _msgErrorsI18n(key, { language, interpolators });
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
function RlsMessageFormError({ className, formControl }) {
|
|
950
|
-
const [language, setLanguage] = useState('es');
|
|
951
|
-
useEffect(() => {
|
|
952
|
-
return i18nSubscribe((language) => {
|
|
953
|
-
setLanguage(language);
|
|
954
|
-
});
|
|
955
|
-
}, []);
|
|
956
|
-
const msgError = useMemo(() => {
|
|
957
|
-
return (formControl?.error &&
|
|
958
|
-
(msgErrorsI18n(formControl.error.id, language, formControl.error.data) ||
|
|
959
|
-
msgErrorsI18n('_unknown', language, { error: formControl.error.id })));
|
|
960
|
-
}, [formControl?.error, language]);
|
|
961
|
-
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: formControl?.wrong && (jsxRuntimeExports.jsx("div", { className: className, children: jsxRuntimeExports.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: msgError }) })) }));
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
function RlsFieldDecimal(props) {
|
|
965
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
966
|
-
const disabled = useMemo(() => {
|
|
967
|
-
return formControl?.disabled || props.disabled;
|
|
968
|
-
}, [formControl?.disabled, props.disabled]);
|
|
969
|
-
const className = useMemo(() => {
|
|
970
|
-
return renderClassStatus('rls-field-box', {
|
|
971
|
-
disabled,
|
|
972
|
-
error: formControl?.wrong,
|
|
973
|
-
focused: formControl?.focused && !disabled,
|
|
974
|
-
readonly: props.readOnly
|
|
975
|
-
}, 'rls-field-decimal');
|
|
976
|
-
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
977
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputDecimal, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
function RlsFieldMoney(props) {
|
|
981
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
982
|
-
const disabled = useMemo(() => {
|
|
983
|
-
return formControl?.disabled || props.disabled;
|
|
984
|
-
}, [formControl?.disabled, props.disabled]);
|
|
985
|
-
const className = useMemo(() => {
|
|
986
|
-
return renderClassStatus('rls-field-box', {
|
|
987
|
-
disabled,
|
|
988
|
-
error: formControl?.wrong,
|
|
989
|
-
focused: formControl?.focused && !disabled,
|
|
990
|
-
readonly: props.readOnly
|
|
991
|
-
}, 'rls-field-money');
|
|
992
|
-
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
993
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputMoney, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
function RlsFieldNumber(props) {
|
|
997
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
998
|
-
const disabled = useMemo(() => {
|
|
999
|
-
return formControl?.disabled || props.disabled;
|
|
1000
|
-
}, [formControl?.disabled, props.disabled]);
|
|
1001
|
-
const className = useMemo(() => {
|
|
1002
|
-
return renderClassStatus('rls-field-box', {
|
|
1003
|
-
disabled,
|
|
1004
|
-
error: formControl?.wrong,
|
|
1005
|
-
focused: formControl?.focused && !disabled,
|
|
1006
|
-
readonly: props.readOnly
|
|
1007
|
-
}, 'rls-field-number');
|
|
1008
|
-
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1009
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputNumber, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
function RlsFieldPassword(props) {
|
|
1013
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
1014
|
-
const [passwordIsActive, setPasswordIsActive] = useState(true);
|
|
1015
|
-
const disabled = useMemo(() => {
|
|
1016
|
-
return formControl?.disabled || props.disabled;
|
|
1017
|
-
}, [formControl?.disabled, props.disabled]);
|
|
1018
|
-
const className = useMemo(() => {
|
|
1019
|
-
return renderClassStatus('rls-field-box', {
|
|
1020
|
-
disabled,
|
|
1021
|
-
error: formControl?.wrong,
|
|
1022
|
-
focused: formControl?.focused && !disabled,
|
|
1023
|
-
readonly: props.readOnly
|
|
1024
|
-
}, 'rls-field-password');
|
|
1025
|
-
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1026
|
-
const onTogglePassword = useCallback(() => {
|
|
1027
|
-
setPasswordIsActive((password) => !password);
|
|
1028
|
-
}, []);
|
|
1029
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx(RlsInputPassword, { ...props, type: passwordIsActive ? 'password' : 'text' }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: passwordIsActive ? 'eye' : 'eye-off', onClick: onTogglePassword })] }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
function RlsFieldPercentage(props) {
|
|
1033
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
1034
|
-
const disabled = useMemo(() => {
|
|
1035
|
-
return formControl?.disabled || props.disabled;
|
|
1036
|
-
}, [formControl?.disabled, props.disabled]);
|
|
1037
|
-
const className = useMemo(() => {
|
|
1038
|
-
return renderClassStatus('rls-field-box', {
|
|
1039
|
-
disabled,
|
|
1040
|
-
error: formControl?.wrong,
|
|
1041
|
-
focused: formControl?.focused && !disabled,
|
|
1042
|
-
readonly: props.readOnly
|
|
1043
|
-
}, 'rls-field-percentage');
|
|
1044
|
-
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1045
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputPercentage, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
function RlsFieldReadonly({ children, identifier, rlsTheme, value }) {
|
|
1049
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-readonly rls-field-box", "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx("input", { className: "rls-input__component", autoComplete: "off", type: 'text', readOnly: true, value: value }) }) })] }));
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
function RlsFieldText(props) {
|
|
1053
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
1054
|
-
const disabled = useMemo(() => {
|
|
1055
|
-
return formControl?.disabled || props.disabled;
|
|
1056
|
-
}, [formControl?.disabled, props.disabled]);
|
|
1057
|
-
const className = useMemo(() => {
|
|
1058
|
-
return renderClassStatus('rls-field-box', {
|
|
1059
|
-
disabled,
|
|
1060
|
-
error: formControl?.wrong,
|
|
1061
|
-
focused: formControl?.focused && !disabled,
|
|
1062
|
-
readonly: props.readOnly
|
|
1063
|
-
}, 'rls-field-text');
|
|
1064
|
-
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1065
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputText, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
function useFormToggleController({ disabled, formControl }) {
|
|
1069
|
-
const [checked, setChecked] = useState(!!formControl?.value);
|
|
1070
|
-
useEffect(() => {
|
|
1071
|
-
setChecked(!!formControl?.value);
|
|
1072
|
-
}, [formControl?.value]);
|
|
1073
|
-
const onToggle = useCallback(() => {
|
|
1074
|
-
if (!disabled) {
|
|
1075
|
-
formControl
|
|
1076
|
-
? formControl.enabled && formControl.setValue(!formControl.value)
|
|
1077
|
-
: setChecked((checked) => !checked);
|
|
1078
|
-
}
|
|
1079
|
-
}, [formControl, disabled]);
|
|
1080
|
-
return { checked, onToggle };
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
function RlsLabelCheckBox({ children, disabled, extended, identifier, formControl, reverse, rlsTheme }) {
|
|
1084
|
-
const { checked, onToggle } = useFormToggleController({
|
|
1085
|
-
disabled,
|
|
1086
|
-
formControl
|
|
1087
|
-
});
|
|
1088
|
-
const className = useMemo(() => {
|
|
1089
|
-
return renderClassStatus('rls-label-checkbox', {
|
|
1090
|
-
disabled,
|
|
1091
|
-
extended,
|
|
1092
|
-
reverse
|
|
1093
|
-
});
|
|
1094
|
-
}, [disabled, extended, reverse]);
|
|
1095
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__text", children: children })] }));
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
function RlsLabelRadioButton({ children, disabled, extended, identifier, formControl, onValue, reverse, rlsTheme, value }) {
|
|
1099
|
-
const { checked, onSelect } = useFormSingleSelectionController({
|
|
1100
|
-
disabled,
|
|
1101
|
-
formControl,
|
|
1102
|
-
onValue,
|
|
1103
|
-
value
|
|
1104
|
-
});
|
|
1105
|
-
const className = useMemo(() => {
|
|
1106
|
-
return renderClassStatus('rls-label-radiobutton', {
|
|
1107
|
-
disabled,
|
|
1108
|
-
extended,
|
|
1109
|
-
reverse
|
|
1110
|
-
});
|
|
1111
|
-
}, [disabled, extended, reverse]);
|
|
1112
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsxRuntimeExports.jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__text", children: children })] }));
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
function RlsLabelSwitch({ capsule, children, disabled, extended, identifier, formControl, reverse, rlsTheme }) {
|
|
1116
|
-
const { checked, onToggle } = useFormToggleController({
|
|
1117
|
-
disabled,
|
|
1118
|
-
formControl
|
|
1119
|
-
});
|
|
1120
|
-
const className = useMemo(() => {
|
|
1121
|
-
return renderClassStatus('rls-label-switch', {
|
|
1122
|
-
disabled,
|
|
1123
|
-
extended,
|
|
1124
|
-
reverse
|
|
1125
|
-
});
|
|
1126
|
-
}, [disabled, extended, reverse]);
|
|
1127
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsSwitch, { checked: checked, capsule: capsule, disabled: disabled }) }), jsxRuntimeExports.jsx("div", { className: "rls-label-switch__text", children: children })] }));
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
function RlsNavbar({ children, identifier, rlsTheme }) {
|
|
1131
|
-
return (jsxRuntimeExports.jsxs("nav", { id: identifier, className: "rls-app__page__nav", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-app__page__nav__content", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-app__page__nav__backdrop" })] }));
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
1135
|
-
const [template, setTemplate] = useState();
|
|
1136
|
-
const controller = useRef(undefined);
|
|
1137
|
-
const refreshTemplate = useCallback((template, suggestions) => {
|
|
1138
|
-
const { firstPage, lastPage } = template;
|
|
1139
|
-
onPagination && onPagination({ firstPage, lastPage, suggestions });
|
|
1140
|
-
setTemplate(template);
|
|
1141
|
-
}, [onPagination]);
|
|
1142
|
-
const refreshPagination = useCallback((pagination) => {
|
|
1143
|
-
pagination &&
|
|
1144
|
-
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1145
|
-
}, []);
|
|
1146
|
-
useEffect(() => {
|
|
1147
|
-
const pagination = new PaginationController({
|
|
1148
|
-
suggestions,
|
|
1149
|
-
count,
|
|
1150
|
-
position: template?.currentPage.value
|
|
1151
|
-
});
|
|
1152
|
-
controller.current = pagination;
|
|
1153
|
-
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1154
|
-
}, [suggestions, count]);
|
|
1155
|
-
useEffect(() => {
|
|
1156
|
-
refreshPagination(controller.current?.filtrable(filter));
|
|
1157
|
-
}, [filter]);
|
|
1158
|
-
const goToPagination = useCallback((page) => {
|
|
1159
|
-
refreshPagination(controller.current?.goToPage(page));
|
|
1160
|
-
}, []);
|
|
1161
|
-
const goFirstPagination = useCallback(() => {
|
|
1162
|
-
refreshPagination(controller.current?.goFirstPage());
|
|
1163
|
-
}, []);
|
|
1164
|
-
const goPreviousPagination = useCallback(() => {
|
|
1165
|
-
refreshPagination(controller.current?.goPreviousPage());
|
|
1166
|
-
}, []);
|
|
1167
|
-
const goNextPagination = useCallback(() => {
|
|
1168
|
-
refreshPagination(controller.current?.goNextPage());
|
|
1169
|
-
}, []);
|
|
1170
|
-
const goLastPagination = useCallback(() => {
|
|
1171
|
-
refreshPagination(controller.current?.goLastPage());
|
|
1172
|
-
}, []);
|
|
1173
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__body", children: [jsxRuntimeExports.jsx("div", { className: "rls-pagination__pages", children: template?.pages.map((page, index) => {
|
|
1174
|
-
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
1175
|
-
active: page.active
|
|
1176
|
-
}), onClick: () => {
|
|
1177
|
-
goToPagination(page);
|
|
1178
|
-
}, children: page.label }, index));
|
|
1179
|
-
}) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template?.description }), jsxRuntimeExports.jsx("span", { className: "rls-pagination__count", children: suggestions.length })] }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
function RlsPickerDayHeaders() {
|
|
1183
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("span", { className: "rls-picker-day__label", children: title }, index))) }));
|
|
1184
|
-
}
|
|
1185
|
-
function RlsPickerDayElement({ day, onSelect, disabled }) {
|
|
1186
|
-
const className = useMemo(() => {
|
|
1187
|
-
return renderClassStatus('rls-picker-day__element', {
|
|
1188
|
-
disabled: day.disabled || disabled,
|
|
1189
|
-
focused: day.focused,
|
|
1190
|
-
forbidden: day.forbidden,
|
|
1191
|
-
selected: day.selected,
|
|
1192
|
-
today: day.today
|
|
1193
|
-
});
|
|
1194
|
-
}, [day, disabled]);
|
|
1195
|
-
const onClick = useCallback(() => {
|
|
1196
|
-
day.value && !day.disabled && !disabled && onSelect(day.value);
|
|
1197
|
-
}, [day.value, day.disabled, disabled, onSelect]);
|
|
1198
|
-
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day__element__span", children: day.value || '??' }) }));
|
|
1199
|
-
}
|
|
1200
|
-
function RlsPickerDay({ date: _date, disabled, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
|
|
1201
|
-
const date = useMemo(() => _date ?? new Date(), [_date]);
|
|
1202
|
-
const [weeks, setWeeks] = useState([]);
|
|
1203
|
-
const [value, setValue] = useState(formControl?.value || date.getDate());
|
|
1204
|
-
const [headers, setHeaders] = useState(jsxRuntimeExports.jsx(RlsPickerDayHeaders, {}));
|
|
1205
|
-
const [component, setComponent] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1206
|
-
const setDayValue = useCallback((value) => {
|
|
1207
|
-
formControl ? formControl.setValue(value) : setValue(value);
|
|
1208
|
-
}, [formControl]);
|
|
1209
|
-
const onSelect = useCallback((value) => {
|
|
1210
|
-
setDayValue(value);
|
|
1211
|
-
onValue?.(value);
|
|
1212
|
-
}, [setDayValue, onValue]);
|
|
1213
|
-
useEffect(() => {
|
|
1214
|
-
return i18nSubscribe(() => {
|
|
1215
|
-
setHeaders(jsxRuntimeExports.jsx(RlsPickerDayHeaders, {}));
|
|
1216
|
-
});
|
|
1217
|
-
}, []);
|
|
1218
|
-
useEffect(() => {
|
|
1219
|
-
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) }));
|
|
1220
|
-
}, [weeks, onSelect, disabled]);
|
|
1221
|
-
useEffect(() => {
|
|
1222
|
-
const options = createPickerOptions();
|
|
1223
|
-
const day = verifyDayPicker(options);
|
|
1224
|
-
day ? setDayValue(day) : setWeeks(createDayPicker(options));
|
|
1225
|
-
}, [date, month, year, value, minDate, maxDate]);
|
|
1226
|
-
useEffect(() => {
|
|
1227
|
-
const day = verifyDayPicker(createPickerOptions());
|
|
1228
|
-
day
|
|
1229
|
-
? formControl?.setValue(day)
|
|
1230
|
-
: setValue(formControl?.value || date.getDate());
|
|
1231
|
-
}, [formControl?.value]);
|
|
1232
|
-
const createPickerOptions = useCallback(() => {
|
|
1233
|
-
return {
|
|
1234
|
-
date,
|
|
1235
|
-
day: formControl?.value ?? value,
|
|
1236
|
-
month: month ?? date.getMonth(),
|
|
1237
|
-
year: year ?? date.getFullYear(),
|
|
1238
|
-
minDate,
|
|
1239
|
-
maxDate
|
|
1240
|
-
};
|
|
1241
|
-
}, [date, formControl?.value, value, month, year, minDate, maxDate]);
|
|
1242
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [headers, component] }));
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
function RlsPickerDayRangeHeaders() {
|
|
1246
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }));
|
|
1247
|
-
}
|
|
1248
|
-
function RlsPickerDayRangeElement({ day, onSelect, disabled }) {
|
|
1249
|
-
const className = useMemo(() => {
|
|
1250
|
-
return renderClassStatus('rls-picker-day-range__element', {
|
|
1251
|
-
disabled: day.disabled || disabled,
|
|
1252
|
-
end: day.end,
|
|
1253
|
-
forbidden: day.forbidden,
|
|
1254
|
-
ranged: day.ranged,
|
|
1255
|
-
source: day.source
|
|
1256
|
-
});
|
|
1257
|
-
}, [day.disabled, day.end, day.forbidden, day.ranged, day.source, disabled]);
|
|
1258
|
-
const onClick = useCallback(() => {
|
|
1259
|
-
day.value && !day.disabled && !disabled && onSelect(day.value);
|
|
1260
|
-
}, [day.value, day.disabled, disabled, onSelect]);
|
|
1261
|
-
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day-range__element__span", children: day.value || '??' }) }));
|
|
1262
|
-
}
|
|
1263
|
-
function RlsPickerDayRange({ date: _date, disabled, formControl, maxDate, minDate, rlsTheme }) {
|
|
1264
|
-
const _range = useMemo(() => {
|
|
1265
|
-
return formControl?.value ?? DateRange.now();
|
|
1266
|
-
}, [formControl?.value]);
|
|
1267
|
-
const date = useMemo(() => {
|
|
1268
|
-
return normalizeMinTime(_date ?? _range.minDate);
|
|
1269
|
-
}, [_date]);
|
|
1270
|
-
const sourceDate = useRef(_range.minDate);
|
|
1271
|
-
const [weeks, setWeeks] = useState([]);
|
|
1272
|
-
const [range, setRange] = useState(_range);
|
|
1273
|
-
const [headers, setHeaders] = useState(jsxRuntimeExports.jsx(RlsPickerDayRangeHeaders, {}));
|
|
1274
|
-
const [component, setComponent] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1275
|
-
const onSelect = useCallback((value) => {
|
|
1276
|
-
const _date = assignDayInDate(date, value);
|
|
1277
|
-
const range = dateIsBefore(_date, sourceDate.current)
|
|
1278
|
-
? new DateRange(sourceDate.current, _date)
|
|
1279
|
-
: new DateRange(_date, sourceDate.current);
|
|
1280
|
-
sourceDate.current = _date;
|
|
1281
|
-
setRange(range);
|
|
1282
|
-
formControl?.setValue(range);
|
|
1283
|
-
}, [date, sourceDate.current, formControl]);
|
|
1284
|
-
useEffect(() => {
|
|
1285
|
-
return i18nSubscribe(() => {
|
|
1286
|
-
setHeaders(jsxRuntimeExports.jsx(RlsPickerDayRangeHeaders, {}));
|
|
1287
|
-
});
|
|
1288
|
-
}, []);
|
|
1289
|
-
useEffect(() => {
|
|
1290
|
-
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayRangeElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) }));
|
|
1291
|
-
}, [weeks, onSelect, disabled]);
|
|
1292
|
-
useEffect(() => {
|
|
1293
|
-
setWeeks(createDayRangePicker({
|
|
1294
|
-
date,
|
|
1295
|
-
range,
|
|
1296
|
-
sourceDate: sourceDate.current,
|
|
1297
|
-
minDate,
|
|
1298
|
-
maxDate
|
|
1299
|
-
}));
|
|
1300
|
-
}, [date, range, minDate, maxDate]);
|
|
1301
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [headers, component] }));
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
function RlsPickerMonthElement({ month, onSelect, disabled }) {
|
|
1305
|
-
const [label, setLabel] = useState(MONTH_NAMES(month.value));
|
|
1306
|
-
useEffect(() => {
|
|
1307
|
-
return i18nSubscribe(() => {
|
|
1308
|
-
setLabel(MONTH_NAMES(month.value));
|
|
1309
|
-
});
|
|
1310
|
-
}, []);
|
|
1311
|
-
const className = useMemo(() => {
|
|
1312
|
-
return renderClassStatus('rls-picker-month__component', {
|
|
1313
|
-
disabled: month.disabled || disabled,
|
|
1314
|
-
focused: month.focused,
|
|
1315
|
-
selected: month.selected
|
|
1316
|
-
});
|
|
1317
|
-
}, [month.disabled, month.focused, month.selected, disabled]);
|
|
1318
|
-
const onClick = useCallback(() => {
|
|
1319
|
-
valueIsDefined(month.value) &&
|
|
1320
|
-
!month.disabled &&
|
|
1321
|
-
!disabled &&
|
|
1322
|
-
onSelect(month.value);
|
|
1323
|
-
}, [month.value, month.disabled, disabled, onSelect]);
|
|
1324
|
-
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-month__span", children: label }) }));
|
|
1325
|
-
}
|
|
1326
|
-
function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
|
|
1327
|
-
const date = useMemo(() => _date || new Date(), [_date]);
|
|
1328
|
-
const [months, setMonths] = useState([]);
|
|
1329
|
-
const [value, setValue] = useState(formControl?.value ?? date.getMonth());
|
|
1330
|
-
const [component, setComponent] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1331
|
-
const setMonthValue = useCallback((value) => {
|
|
1332
|
-
formControl ? formControl.setValue(value) : setValue(value);
|
|
1333
|
-
}, [formControl]);
|
|
1334
|
-
const onSelect = useCallback((value) => {
|
|
1335
|
-
setMonthValue(value);
|
|
1336
|
-
onValue?.(value);
|
|
1337
|
-
}, [setMonthValue, onValue]);
|
|
1338
|
-
useEffect(() => {
|
|
1339
|
-
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: months.map((month, index) => (jsxRuntimeExports.jsx(RlsPickerMonthElement, { month: month, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
1340
|
-
}, [months, onSelect, disabled]);
|
|
1341
|
-
useEffect(() => {
|
|
1342
|
-
const options = {
|
|
1343
|
-
date,
|
|
1344
|
-
month: formControl?.value ?? value,
|
|
1345
|
-
year: year ?? date.getFullYear(),
|
|
1346
|
-
minDate,
|
|
1347
|
-
maxDate
|
|
1348
|
-
};
|
|
1349
|
-
const month = verifyMonthPicker(options);
|
|
1350
|
-
valueIsDefined(month)
|
|
1351
|
-
? setMonthValue(month)
|
|
1352
|
-
: setMonths(createMonthPicker(options));
|
|
1353
|
-
}, [date, year, value, minDate, maxDate]);
|
|
1354
|
-
useEffect(() => {
|
|
1355
|
-
const month = verifyMonthPicker({
|
|
1356
|
-
date,
|
|
1357
|
-
month: formControl?.value ?? value,
|
|
1358
|
-
year: year ?? date.getFullYear(),
|
|
1359
|
-
minDate,
|
|
1360
|
-
maxDate
|
|
1361
|
-
});
|
|
1362
|
-
valueIsDefined(month)
|
|
1363
|
-
? formControl?.setValue(month)
|
|
1364
|
-
: setValue(formControl?.value ?? date.getMonth());
|
|
1365
|
-
}, [formControl?.value]);
|
|
1366
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: component }));
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
|
|
1370
|
-
const { limitNext, limitPrevious } = useMemo(() => {
|
|
1371
|
-
return monthLimitTemplate({
|
|
1372
|
-
date,
|
|
1373
|
-
maxDate,
|
|
1374
|
-
minDate,
|
|
1375
|
-
month: monthControl.value
|
|
1376
|
-
});
|
|
1377
|
-
}, [date, maxDate, minDate, monthControl.value]);
|
|
1378
|
-
const [label, setLabel] = useState(MONTH_NAMES(monthControl.value ?? Month.January));
|
|
1379
|
-
useEffect(() => {
|
|
1380
|
-
return i18nSubscribe(() => {
|
|
1381
|
-
setLabel(MONTH_NAMES(monthControl.value ?? Month.January));
|
|
1382
|
-
});
|
|
1383
|
-
}, []);
|
|
1384
|
-
useEffect(() => {
|
|
1385
|
-
setLabel(MONTH_NAMES(monthControl.value ?? Month.January));
|
|
1386
|
-
}, [monthControl.value]);
|
|
1387
|
-
const onPreviousMonth = useCallback(() => {
|
|
1388
|
-
if (valueIsDefined(monthControl.value) &&
|
|
1389
|
-
valueIsDefined(yearControl.value)) {
|
|
1390
|
-
if (monthControl.value > Month.January) {
|
|
1391
|
-
monthControl.setValue(monthControl.value - 1);
|
|
1392
|
-
}
|
|
1393
|
-
else {
|
|
1394
|
-
monthControl.setValue(Month.December);
|
|
1395
|
-
yearControl.setValue(yearControl.value - 1);
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
}, [monthControl.value, yearControl.value]);
|
|
1399
|
-
const onMonth = useCallback(() => {
|
|
1400
|
-
onClick && onClick('month');
|
|
1401
|
-
}, [onClick]);
|
|
1402
|
-
const onYear = useCallback(() => {
|
|
1403
|
-
onClick && onClick('year');
|
|
1404
|
-
}, [onClick]);
|
|
1405
|
-
const onPreviousYear = useCallback(() => {
|
|
1406
|
-
valueIsDefined(yearControl.value) &&
|
|
1407
|
-
yearControl.setValue(yearControl.value - 1);
|
|
1408
|
-
}, [yearControl.value]);
|
|
1409
|
-
const onPrevious = useCallback(() => {
|
|
1410
|
-
type === 'month' ? onPreviousMonth() : onPreviousYear();
|
|
1411
|
-
}, [type, onPreviousMonth, onPreviousYear]);
|
|
1412
|
-
const onNextMonth = useCallback(() => {
|
|
1413
|
-
if (valueIsDefined(monthControl.value) &&
|
|
1414
|
-
valueIsDefined(yearControl.value)) {
|
|
1415
|
-
if (monthControl.value < Month.December) {
|
|
1416
|
-
monthControl.setValue(monthControl.value + 1);
|
|
1417
|
-
}
|
|
1418
|
-
else {
|
|
1419
|
-
monthControl.setValue(Month.January);
|
|
1420
|
-
yearControl.setValue(yearControl.value + 1);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
}, [monthControl.value, yearControl.value]);
|
|
1424
|
-
const onNextYear = useCallback(() => {
|
|
1425
|
-
valueIsDefined(yearControl.value) &&
|
|
1426
|
-
yearControl.setValue(yearControl.value + 1);
|
|
1427
|
-
}, [yearControl.value]);
|
|
1428
|
-
const onNext = useCallback(() => {
|
|
1429
|
-
type === 'month' ? onNextMonth() : onNextYear();
|
|
1430
|
-
}, [type, onNextMonth, onNextYear]);
|
|
1431
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-selector-title", children: [jsxRuntimeExports.jsx("button", { onClick: onPrevious, disabled: limitPrevious || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-selector-title__label", children: [jsxRuntimeExports.jsxs("span", { onClick: onMonth, children: [label, ","] }), jsxRuntimeExports.jsx("span", { onClick: onYear, children: yearControl.value })] }), jsxRuntimeExports.jsx("button", { onClick: onNext, disabled: limitNext || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) })] }));
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
function RlsPickerYearElement({ onSelect, year, disabled }) {
|
|
1435
|
-
const className = useMemo(() => {
|
|
1436
|
-
return renderClassStatus('rls-picker-year__element', {
|
|
1437
|
-
disabled: year.disabled || disabled,
|
|
1438
|
-
focused: year.focused,
|
|
1439
|
-
selected: year.selected
|
|
1440
|
-
});
|
|
1441
|
-
}, [year.disabled, year.focused, year.selected, disabled]);
|
|
1442
|
-
const onClick = useCallback(() => {
|
|
1443
|
-
year.value && !year.disabled && !disabled && onSelect(year.value);
|
|
1444
|
-
}, [year.value, year.disabled, disabled, onSelect]);
|
|
1445
|
-
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-year__span", children: year.value || '????' }) }));
|
|
1446
|
-
}
|
|
1447
|
-
function RlsPickerYear({ date: _date, disabled, formControl, maxDate, minDate, onValue, rlsTheme }) {
|
|
1448
|
-
const date = useMemo(() => _date || new Date(), [_date]);
|
|
1449
|
-
const [value, setValue] = useState(formControl?.value ?? date.getFullYear());
|
|
1450
|
-
const [year, setYear] = useState(formControl?.value ?? date.getFullYear());
|
|
1451
|
-
const [component, setComponent] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
1452
|
-
const createPickerOptions = useCallback(() => {
|
|
1453
|
-
return {
|
|
1454
|
-
date,
|
|
1455
|
-
year,
|
|
1456
|
-
minDate,
|
|
1457
|
-
maxDate
|
|
1458
|
-
};
|
|
1459
|
-
}, [date, year, minDate, maxDate]);
|
|
1460
|
-
const [template, setTemplate] = useState(createYearPicker(createPickerOptions()));
|
|
1461
|
-
const setYearValue = useCallback((value) => {
|
|
1462
|
-
formControl ? formControl.setValue(value) : setValue(value);
|
|
1463
|
-
setYear(value);
|
|
1464
|
-
}, [formControl]);
|
|
1465
|
-
const onSelect = useCallback((value) => {
|
|
1466
|
-
setYearValue(value);
|
|
1467
|
-
onValue?.(value);
|
|
1468
|
-
}, [setYearValue, onValue]);
|
|
1469
|
-
useEffect(() => {
|
|
1470
|
-
const options = createPickerOptions(); // YearPickerProps
|
|
1471
|
-
const year = verifyYearPicker(options);
|
|
1472
|
-
year ? setYearValue(year) : setTemplate(createYearPicker(options));
|
|
1473
|
-
}, [date, year, value, minDate, maxDate]);
|
|
1474
|
-
useEffect(() => {
|
|
1475
|
-
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: template.years.map((year, index) => (jsxRuntimeExports.jsx(RlsPickerYearElement, { year: year, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
1476
|
-
}, [template.years, onSelect, disabled]);
|
|
1477
|
-
useEffect(() => {
|
|
1478
|
-
const year = verifyYearPicker(createPickerOptions());
|
|
1479
|
-
valueIsDefined(year)
|
|
1480
|
-
? formControl?.setValue(year)
|
|
1481
|
-
: setValue(formControl?.value ?? date.getFullYear());
|
|
1482
|
-
}, [formControl?.value]);
|
|
1483
|
-
const onClickPrev = useCallback(() => {
|
|
1484
|
-
setYear((year) => year - 8);
|
|
1485
|
-
}, []);
|
|
1486
|
-
const onClickNext = useCallback(() => {
|
|
1487
|
-
setYear((year) => year + 8);
|
|
1488
|
-
}, []);
|
|
1489
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("button", { className: "rls-picker-year__action rls-picker-year__action--prev", onClick: onClickPrev, disabled: !template.canPrevious || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) }), jsxRuntimeExports.jsxs("span", { children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("button", { className: "rls-picker-year__action rls-picker-year__action--next", onClick: onClickNext, disabled: !template.canNext || disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children: component })] }));
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
function calculateInitialValue(value, minValue, maxValue) {
|
|
1493
|
-
return minValue > value ? minValue : maxValue < value ? maxValue : value;
|
|
1494
|
-
}
|
|
1495
|
-
function calculateInitialRate(value, minValue, maxValue) {
|
|
1496
|
-
const rateMax = maxValue - minValue;
|
|
1497
|
-
const rateValue = value - minValue;
|
|
1498
|
-
return Math.ceil((rateValue / rateMax) * 100);
|
|
1499
|
-
}
|
|
1500
|
-
function RlsSlider(props) {
|
|
1501
|
-
const minValue = useMemo(() => {
|
|
1502
|
-
return props.minValue ?? 0;
|
|
1503
|
-
}, [props.minValue]);
|
|
1504
|
-
const maxValue = useMemo(() => {
|
|
1505
|
-
return props.maxValue ?? 100;
|
|
1506
|
-
}, [props.maxValue]);
|
|
1507
|
-
const [value, setValue] = useState(calculateInitialValue(props.formControl?.value ?? props.value ?? 0, minValue, maxValue));
|
|
1508
|
-
const [rate, setRate] = useState(calculateInitialRate(value, minValue, maxValue));
|
|
1509
|
-
const refComponent = useRef(null);
|
|
1510
|
-
const refTrack = useRef(null);
|
|
1511
|
-
const refTrackOn = useRef(null);
|
|
1512
|
-
const refThumb = useRef(null);
|
|
1513
|
-
const className = useMemo(() => {
|
|
1514
|
-
return renderClassStatus('rls-slider', {
|
|
1515
|
-
complet: value === maxValue,
|
|
1516
|
-
disabled: props.disabled,
|
|
1517
|
-
empty: value === minValue
|
|
1518
|
-
});
|
|
1519
|
-
}, [value, minValue, maxValue, props.disabled]);
|
|
1520
|
-
useEffect(() => {
|
|
1521
|
-
const valueInitial = props.formControl?.value ?? props.value ?? 0;
|
|
1522
|
-
refThumb.current.style.left = `${rate}%`;
|
|
1523
|
-
refTrackOn.current.style.width = `${rate}%`;
|
|
1524
|
-
if (valueInitial !== value) {
|
|
1525
|
-
props.formControl?.setValue(value);
|
|
1526
|
-
props.onValue && props.onValue(value);
|
|
1527
|
-
}
|
|
1528
|
-
}, []);
|
|
1529
|
-
const calculateValueWithRate = useCallback((rate) => {
|
|
1530
|
-
const value = Math.ceil(((maxValue - minValue) * rate) / 100);
|
|
1531
|
-
refThumb.current.style.left = `${rate}%`;
|
|
1532
|
-
refTrackOn.current.style.width = `${rate}%`;
|
|
1533
|
-
const sliderValue = value + minValue;
|
|
1534
|
-
setRate(rate);
|
|
1535
|
-
setValue(sliderValue);
|
|
1536
|
-
props.formControl?.setValue(sliderValue);
|
|
1537
|
-
props.onValue && props.onValue(sliderValue);
|
|
1538
|
-
}, [minValue, maxValue, props.formControl, props.onValue]);
|
|
1539
|
-
const onClickTrack = useCallback((event) => {
|
|
1540
|
-
const { left, width } = refTrack.current.getBoundingClientRect();
|
|
1541
|
-
const rate = Math.ceil(((event.clientX - left) / width) * 100);
|
|
1542
|
-
calculateValueWithRate(rate);
|
|
1543
|
-
}, [minValue, maxValue]);
|
|
1544
|
-
return (jsxRuntimeExports.jsxs("div", { className: className, children: [props.children && (jsxRuntimeExports.jsx("span", { className: "rls-slider__label", children: props.children })), jsxRuntimeExports.jsxs("div", { className: "rls-slider__body", children: [props.prefixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: props.prefixIcon }), jsxRuntimeExports.jsxs("div", { ref: refComponent, className: "rls-slider__component", children: [jsxRuntimeExports.jsx("div", { ref: refTrack, className: "rls-slider__track", onClick: onClickTrack, children: jsxRuntimeExports.jsx("div", { ref: refTrackOn, className: "rls-slider__track__on" }) }), jsxRuntimeExports.jsxs("div", { ref: refThumb, className: "rls-slider__thumb", children: [rate, "%"] })] })] })] }));
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
function RlsTab({ onSelect, tab, value }) {
|
|
1548
|
-
const className = useMemo(() => {
|
|
1549
|
-
return renderClassStatus('rls-tabs__children', {
|
|
1550
|
-
active: tab.value === value,
|
|
1551
|
-
disabled: tab.disabled
|
|
1552
|
-
});
|
|
1553
|
-
}, [tab, value]);
|
|
1554
|
-
const onClick = useCallback(() => {
|
|
1555
|
-
!tab.disabled && onSelect(tab.value);
|
|
1556
|
-
}, [tab.disabled]);
|
|
1557
|
-
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { children: tab.label }) }));
|
|
1558
|
-
}
|
|
1559
|
-
function RlsTabs({ tabs, onValue, rlsTheme }) {
|
|
1560
|
-
const [value, setValue] = useState();
|
|
1561
|
-
const onSelect = useCallback((value) => {
|
|
1562
|
-
setValue(value);
|
|
1563
|
-
onValue?.(value);
|
|
1564
|
-
}, [onValue]);
|
|
1565
|
-
useEffect(() => {
|
|
1566
|
-
const initial = tabs.find((tab) => tab.defaultActive) ?? tabs[0];
|
|
1567
|
-
initial && onSelect(initial.value);
|
|
1568
|
-
}, []);
|
|
1569
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-tabs", "rls-theme": rlsTheme, children: tabs.map((tab, index) => {
|
|
1570
|
-
return (jsxRuntimeExports.jsx(RlsTab, { tab: tab, value: value, onSelect: onSelect }, index));
|
|
1571
|
-
}) }));
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
function RlsToolbar({ actions, children, subtitle }) {
|
|
1575
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-toolbar", children: [jsxRuntimeExports.jsxs("div", { className: "rls-toolbar__description", children: [children && jsxRuntimeExports.jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsxRuntimeExports.jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsxRuntimeExports.jsx("div", { children: action }, index))) }))] }));
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
function RlsBottomSheet({ autoclose, children, className, controller, onBackdrop, visible, rlsTheme }) {
|
|
1579
|
-
const classNameSheet = useMemo(() => {
|
|
1580
|
-
return renderClassStatus('rls-bottom-sheet', { visible: controller?.visible ?? visible }, className);
|
|
1581
|
-
}, [className, visible, controller?.visible]);
|
|
1582
|
-
const onClickBackdrop = useCallback(() => {
|
|
1583
|
-
autoclose && controller?.close();
|
|
1584
|
-
onBackdrop?.();
|
|
1585
|
-
}, [autoclose, controller, onBackdrop]);
|
|
1586
|
-
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: classNameSheet, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-bottom-sheet__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-bottom-sheet__backdrop", onClick: onClickBackdrop })] }), document.body);
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
function RlsCard({ children, className, outline, rlsTheme }) {
|
|
1590
|
-
const classNameCard = useMemo(() => {
|
|
1591
|
-
return renderClassStatus('rls-card', { outline }, className);
|
|
1592
|
-
}, [outline, className]);
|
|
1593
|
-
return (jsxRuntimeExports.jsx("div", { className: classNameCard, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-card__content", children: children }) }));
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
const reactI18n = i18n({
|
|
1597
|
-
es: {
|
|
1598
|
-
confirmationActionApproved: 'Aceptar',
|
|
1599
|
-
dateActionCancel: 'Cancelar',
|
|
1600
|
-
dateActionSelect: 'Establecer',
|
|
1601
|
-
dateActionToday: 'Hoy',
|
|
1602
|
-
chooserImageActionCancel: 'Cancelar',
|
|
1603
|
-
editorImageActionRestore: 'Restaurar',
|
|
1604
|
-
editorImageActionSelect: 'Seleccionar',
|
|
1605
|
-
listEmptyDescription: 'Lo sentimos, en el momento no hay elementos en el listado',
|
|
1606
|
-
listEmptyTitle: 'Selección no disponible',
|
|
1607
|
-
listInputPlaceholder: 'Escriba palabre clave para filtrar...'
|
|
1608
|
-
},
|
|
1609
|
-
en: {
|
|
1610
|
-
confirmationActionApproved: 'Approved',
|
|
1611
|
-
dateActionCancel: 'Cancel',
|
|
1612
|
-
dateActionSelect: 'Select',
|
|
1613
|
-
dateActionToday: 'Today',
|
|
1614
|
-
chooserImageActionCancel: 'Cancel',
|
|
1615
|
-
editorImageActionRestore: 'Restore',
|
|
1616
|
-
editorImageActionSelect: 'Select',
|
|
1617
|
-
listEmptyDescription: 'Sorry, there are currently no items in the list',
|
|
1618
|
-
listEmptyTitle: 'Selection not available',
|
|
1619
|
-
listInputPlaceholder: 'Enter keyword to filter...'
|
|
1620
|
-
}
|
|
1621
|
-
});
|
|
1622
|
-
|
|
1623
|
-
class ConfirmationResult extends SealedPartial {
|
|
1624
|
-
static approved() {
|
|
1625
|
-
return new ConfirmationResult('approved');
|
|
1626
|
-
}
|
|
1627
|
-
static reject() {
|
|
1628
|
-
return new ConfirmationResult('reject');
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
function RlsConfirmation({ approved, className, content, reject, rlsTheme, subtitle, title, visible }) {
|
|
1632
|
-
const classConfirmation = useMemo(() => {
|
|
1633
|
-
return renderClassStatus('rls-confirmation', { visible }, className);
|
|
1634
|
-
}, [visible, className]);
|
|
1635
|
-
return (jsxRuntimeExports.jsxs("div", { className: classConfirmation, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__content", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { identifier: approved.identifier, type: approved.type, onClick: approved.onClick, disabled: approved.disabled, rlsTheme: approved.rlsTheme, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { identifier: reject.identifier, type: reject.type, onClick: reject.onClick, disabled: reject.disabled, rlsTheme: reject.rlsTheme, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
|
|
1636
|
-
}
|
|
1637
|
-
function useConfirmation() {
|
|
1638
|
-
const [config, setConfig] = useState({});
|
|
1639
|
-
const [visible, setVisible] = useState(false);
|
|
1640
|
-
const component = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
|
|
1641
|
-
const confirmation = useCallback((options) => {
|
|
1642
|
-
return new Promise((resolve) => {
|
|
1643
|
-
setConfig({
|
|
1644
|
-
...options,
|
|
1645
|
-
approved: {
|
|
1646
|
-
label: options.approved?.label ?? reactI18n('confirmationActionApproved'),
|
|
1647
|
-
onClick: () => {
|
|
1648
|
-
setVisible(false);
|
|
1649
|
-
resolve(ConfirmationResult.approved());
|
|
1650
|
-
},
|
|
1651
|
-
type: options.approved?.type ?? 'raised',
|
|
1652
|
-
disabled: options.approved?.disabled,
|
|
1653
|
-
identifier: options.approved?.identifier,
|
|
1654
|
-
rlsTheme: options.approved?.rlsTheme
|
|
1655
|
-
},
|
|
1656
|
-
reject: options.reject
|
|
1657
|
-
? {
|
|
1658
|
-
label: options.reject.label,
|
|
1659
|
-
onClick: () => {
|
|
1660
|
-
setVisible(false);
|
|
1661
|
-
resolve(ConfirmationResult.reject());
|
|
1662
|
-
},
|
|
1663
|
-
type: options.reject.type ?? 'outline',
|
|
1664
|
-
disabled: options.reject.disabled,
|
|
1665
|
-
identifier: options.reject.identifier,
|
|
1666
|
-
rlsTheme: options.reject.rlsTheme
|
|
1667
|
-
}
|
|
1668
|
-
: undefined
|
|
1669
|
-
});
|
|
1670
|
-
setVisible(true);
|
|
1671
|
-
});
|
|
1672
|
-
}, []);
|
|
1673
|
-
return {
|
|
1674
|
-
RlsConfirmation: component,
|
|
1675
|
-
confirmation
|
|
1676
|
-
};
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
function createObserver(options) {
|
|
1680
|
-
const { setScrolleable, table } = options;
|
|
1681
|
-
const observer = new ResizeObserver(() => {
|
|
1682
|
-
const scrollHeight = table.scrollHeight || 0;
|
|
1683
|
-
const clientHeight = table.clientHeight || 0;
|
|
1684
|
-
setScrolleable(scrollHeight > clientHeight);
|
|
1685
|
-
});
|
|
1686
|
-
observer.observe(table);
|
|
1687
|
-
return observer;
|
|
1688
|
-
}
|
|
1689
|
-
function useDatatable(table) {
|
|
1690
|
-
const [scrolleable, setScrolleable] = useState(false);
|
|
1691
|
-
const refTable = useRef(table ? table : null);
|
|
1692
|
-
useEffect(() => {
|
|
1693
|
-
const observer = refTable.current &&
|
|
1694
|
-
createObserver({ setScrolleable, table: refTable.current });
|
|
1695
|
-
return () => {
|
|
1696
|
-
observer?.disconnect();
|
|
1697
|
-
};
|
|
1698
|
-
}, []);
|
|
1699
|
-
return { refTable, scrolleable };
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
function RlsDatatable({ children, footer, header, identifier, rlsTheme, resizable, summary, table, toolbar }) {
|
|
1703
|
-
const datatable = useDatatable(table);
|
|
1704
|
-
const className = useMemo(() => {
|
|
1705
|
-
return renderClassStatus('rls-datatable', {
|
|
1706
|
-
resizable,
|
|
1707
|
-
scrolleable: resizable && datatable?.scrolleable
|
|
1708
|
-
});
|
|
1709
|
-
}, [resizable, datatable.scrolleable]);
|
|
1710
|
-
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [toolbar && jsxRuntimeExports.jsx("div", { className: "rls-datatable__toolbar", children: toolbar }), jsxRuntimeExports.jsx("div", { className: "rls-datatable__table", children: jsxRuntimeExports.jsxs("table", { id: identifier, children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__head", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.refTable, className: "rls-datatable__body", children: children })] }) }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__summary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__footer", children: footer })] }));
|
|
1711
|
-
}
|
|
1712
|
-
function RlsDatatableHeader({ children, identifier, rlsTheme }) {
|
|
1713
|
-
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: "rls-datatable__header", "rls-theme": rlsTheme, children: children }));
|
|
1714
|
-
}
|
|
1715
|
-
function RlsDatatableTitle({ children, className, contained, control, identifier, rlsTheme }) {
|
|
1716
|
-
const classNameTitle = useMemo(() => {
|
|
1717
|
-
return renderClassStatus('rls-datatable__title', { contained, control }, className);
|
|
1718
|
-
}, [className, contained, control]);
|
|
1719
|
-
return (jsxRuntimeExports.jsx("th", { id: identifier, className: classNameTitle, "rls-theme": rlsTheme, children: children }));
|
|
1720
|
-
}
|
|
1721
|
-
function RlsDatatableSubheader({ children, className, identifier, rlsTheme }) {
|
|
1722
|
-
const classNameSubheader = useMemo(() => {
|
|
1723
|
-
return renderClassStatus('rls-datatable__subheader', {}, className);
|
|
1724
|
-
}, [className]);
|
|
1725
|
-
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameSubheader, "rls-theme": rlsTheme, children: children }));
|
|
1726
|
-
}
|
|
1727
|
-
function RlsDatatableRecord({ children, className, contained, error, identifier, info, success, warning, rlsTheme }) {
|
|
1728
|
-
const classNameRecord = useMemo(() => {
|
|
1729
|
-
return renderClassStatus('rls-datatable__record', { error, info, contained, success, warning }, className);
|
|
1730
|
-
}, [className, contained, error, info, success, warning]);
|
|
1731
|
-
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameRecord, "rls-theme": rlsTheme, children: children }));
|
|
1732
|
-
}
|
|
1733
|
-
function RlsDatatableTotals({ children, className, contained, error, identifier, info, success, warning, rlsTheme }) {
|
|
1734
|
-
const classNameTotals = useMemo(() => {
|
|
1735
|
-
return renderClassStatus('rls-datatable__totals', { error, info, contained, success, warning }, className);
|
|
1736
|
-
}, [className, contained, error, info, success, warning]);
|
|
1737
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameTotals, "rls-theme": rlsTheme, children: children }));
|
|
1738
|
-
}
|
|
1739
|
-
function RlsDatatableCell({ children, className, contained, control, identifier, rlsTheme }) {
|
|
1740
|
-
const classNameCell = useMemo(() => {
|
|
1741
|
-
return renderClassStatus('rls-datatable__cell', { control, contained }, className);
|
|
1742
|
-
}, [className, contained, control]);
|
|
1743
|
-
return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameCell, "rls-theme": rlsTheme, children: children }));
|
|
1744
|
-
}
|
|
1745
|
-
function RlsDatatableData({ children, className, contained, control, identifier }) {
|
|
1746
|
-
const classNameData = useMemo(() => {
|
|
1747
|
-
return renderClassStatus('rls-datatable__data', { control, contained }, className);
|
|
1748
|
-
}, [className, contained, control]);
|
|
1749
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameData, children: children }));
|
|
1750
|
-
}
|
|
1751
|
-
function RlsDatatableFloating({ children, className, identifier, invested, rlsTheme }) {
|
|
1752
|
-
const classNameFloating = useMemo(() => {
|
|
1753
|
-
return renderClassStatus('rls-datatable__floating', { invested }, className);
|
|
1754
|
-
}, [className, invested]);
|
|
1755
|
-
return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameFloating, "rls-theme": rlsTheme, children: children }));
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
function RlsDropdown({ children, controller, rlsTheme }) {
|
|
1759
|
-
const className = useMemo(() => {
|
|
1760
|
-
return renderClassStatus('rls-dropdown', {
|
|
1761
|
-
visible: controller.visible
|
|
1762
|
-
});
|
|
1763
|
-
}, [controller.visible]);
|
|
1764
|
-
useEffect(() => {
|
|
1765
|
-
function onCloseDropdown({ target }) {
|
|
1766
|
-
!controller.component.current.contains(target) &&
|
|
1767
|
-
controller.close();
|
|
1768
|
-
}
|
|
1769
|
-
document.addEventListener('click', onCloseDropdown);
|
|
1770
|
-
return () => {
|
|
1771
|
-
document.removeEventListener('click', onCloseDropdown);
|
|
1772
|
-
};
|
|
1773
|
-
}, []);
|
|
1774
|
-
return (jsxRuntimeExports.jsx("div", { ref: controller.component, className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-dropdown__content", children: children }) }));
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
function calculateMinHeightList(count, height) {
|
|
1778
|
-
return count <= 0 ? 160 : (count < 6 ? count : 6) * height;
|
|
1779
|
-
}
|
|
1780
|
-
function useListController(props) {
|
|
1781
|
-
const { count, suggestions, automatic, formControl, lineHeight, reference } = props;
|
|
1782
|
-
const refContent = useRef(null);
|
|
1783
|
-
const refList = useRef(null);
|
|
1784
|
-
const refInput = useRef(null);
|
|
1785
|
-
const listIsOpen = useRef(false);
|
|
1786
|
-
const [collection, setCollection] = useState(new ListCollection(suggestions));
|
|
1787
|
-
const [state, refreshState] = useState({
|
|
1788
|
-
focused: false,
|
|
1789
|
-
higher: false,
|
|
1790
|
-
modalIsVisible: false,
|
|
1791
|
-
value: ''
|
|
1792
|
-
});
|
|
1793
|
-
const changeValueInternal = useRef(false);
|
|
1794
|
-
const position = useRef(0);
|
|
1795
|
-
const valueProtected = useRef(undefined);
|
|
1796
|
-
useEffect(() => {
|
|
1797
|
-
function onCloseSuggestions({ target }) {
|
|
1798
|
-
!refContent?.current?.contains(target) &&
|
|
1799
|
-
refreshState((state) => ({ ...state, modalIsVisible: false }));
|
|
1800
|
-
}
|
|
1801
|
-
document.addEventListener('click', onCloseSuggestions);
|
|
1802
|
-
return () => {
|
|
1803
|
-
document.removeEventListener('click', onCloseSuggestions);
|
|
1804
|
-
};
|
|
1805
|
-
}, []);
|
|
1806
|
-
useEffect(() => {
|
|
1807
|
-
if (!listIsOpen.current && state.modalIsVisible) {
|
|
1808
|
-
listIsOpen.current = true;
|
|
1809
|
-
}
|
|
1810
|
-
if (listIsOpen.current && !state.modalIsVisible) {
|
|
1811
|
-
formControl?.touch();
|
|
1812
|
-
}
|
|
1813
|
-
}, [state.modalIsVisible]);
|
|
1814
|
-
useEffect(() => {
|
|
1815
|
-
setCollection(new ListCollection(suggestions, reference));
|
|
1816
|
-
}, [suggestions]);
|
|
1817
|
-
useEffect(() => {
|
|
1818
|
-
if (!changeValueInternal.current) {
|
|
1819
|
-
if (formControl?.value) {
|
|
1820
|
-
const element = collection.find(formControl.value);
|
|
1821
|
-
if (!element) {
|
|
1822
|
-
valueProtected.current = formControl.value;
|
|
1823
|
-
automatic
|
|
1824
|
-
? setFormValue(collection.value[0], true)
|
|
1825
|
-
: setFormValue(undefined);
|
|
1826
|
-
}
|
|
1827
|
-
else {
|
|
1828
|
-
refreshState((state) => ({ ...state, value: element.description }));
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
else if (valueProtected.current) {
|
|
1832
|
-
const element = collection.find(valueProtected.current);
|
|
1833
|
-
element ? setFormValue(element) : refreshState({ ...state, value: '' });
|
|
1834
|
-
}
|
|
1835
|
-
else {
|
|
1836
|
-
automatic
|
|
1837
|
-
? setFormValue(collection.value[0], true)
|
|
1838
|
-
: refreshState({ ...state, value: '' });
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
changeValueInternal.current = false;
|
|
1842
|
-
}, [collection, formControl?.value]);
|
|
1843
|
-
const setState = useCallback((state) => {
|
|
1844
|
-
const minHeightList = calculateMinHeightList(count, lineHeight ?? 48);
|
|
1845
|
-
const _state = state.modalIsVisible
|
|
1846
|
-
? {
|
|
1847
|
-
...state,
|
|
1848
|
-
higher: locationListCanTop(refContent.current, refList.current, minHeightList)
|
|
1849
|
-
}
|
|
1850
|
-
: state;
|
|
1851
|
-
refreshState((state) => ({ ...state, ..._state }));
|
|
1852
|
-
}, [count]);
|
|
1853
|
-
const setFormValue = useCallback((element, valueIsDefault = false) => {
|
|
1854
|
-
refreshState((state) => ({
|
|
1855
|
-
...state,
|
|
1856
|
-
value: element?.description || ''
|
|
1857
|
-
}));
|
|
1858
|
-
changeValueInternal.current = true;
|
|
1859
|
-
valueIsDefault
|
|
1860
|
-
? formControl?.setDefaultValue(element?.value)
|
|
1861
|
-
: formControl?.setValue(element?.value);
|
|
1862
|
-
}, [formControl]);
|
|
1863
|
-
const navigationInput = useCallback((event) => {
|
|
1864
|
-
if (state.modalIsVisible) {
|
|
1865
|
-
const _position = navigationListFromInput({
|
|
1866
|
-
content: refContent.current,
|
|
1867
|
-
event: event,
|
|
1868
|
-
list: refList.current
|
|
1869
|
-
});
|
|
1870
|
-
position.current = _position ?? 0;
|
|
1871
|
-
}
|
|
1872
|
-
}, [state.modalIsVisible]);
|
|
1873
|
-
const navigationElement = useCallback((event) => {
|
|
1874
|
-
position.current = navigationListFromElement({
|
|
1875
|
-
content: refContent.current,
|
|
1876
|
-
event: event,
|
|
1877
|
-
input: refInput.current,
|
|
1878
|
-
list: refList.current,
|
|
1879
|
-
position: position.current
|
|
1880
|
-
});
|
|
1881
|
-
}, [state.modalIsVisible]);
|
|
1882
|
-
return {
|
|
1883
|
-
...state,
|
|
1884
|
-
navigationElement,
|
|
1885
|
-
navigationInput,
|
|
1886
|
-
refContent,
|
|
1887
|
-
refInput,
|
|
1888
|
-
refList,
|
|
1889
|
-
setFormValue,
|
|
1890
|
-
setState
|
|
1891
|
-
};
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
const DURATION_ANIMATION$1 = 240;
|
|
1895
|
-
const MAX_ELEMENTS = 6;
|
|
1896
|
-
function useFieldAutocomplete(props) {
|
|
1897
|
-
const count = useRef(props.suggestions.length);
|
|
1898
|
-
const controller = useListController({
|
|
1899
|
-
...props,
|
|
1900
|
-
count: count.current
|
|
1901
|
-
});
|
|
1902
|
-
const [coincidences, setCoincidences] = useState([]);
|
|
1903
|
-
const [pattern, setPattern] = useState('');
|
|
1904
|
-
const _store = useRef({
|
|
1905
|
-
coincidences: [],
|
|
1906
|
-
pattern: '',
|
|
1907
|
-
previous: null
|
|
1908
|
-
});
|
|
1909
|
-
const refreshCoincidences = useCallback((suggestions, pattern, reboot = false) => {
|
|
1910
|
-
const { collection, store } = createAutocompleteStore({
|
|
1911
|
-
pattern,
|
|
1912
|
-
suggestions,
|
|
1913
|
-
reboot,
|
|
1914
|
-
store: _store.current
|
|
1915
|
-
});
|
|
1916
|
-
_store.current = store;
|
|
1917
|
-
const coincidences = collection.slice(0, MAX_ELEMENTS);
|
|
1918
|
-
setCoincidences(coincidences);
|
|
1919
|
-
count.current = coincidences.length;
|
|
1920
|
-
}, []);
|
|
1921
|
-
useEffect(() => {
|
|
1922
|
-
refreshCoincidences(props.suggestions, pattern, true);
|
|
1923
|
-
}, [props.suggestions]);
|
|
1924
|
-
useEffect(() => {
|
|
1925
|
-
refreshCoincidences(props.suggestions, pattern);
|
|
1926
|
-
}, [pattern]);
|
|
1927
|
-
useEffect(() => {
|
|
1928
|
-
props.disabled && controller.setState({ focused: false });
|
|
1929
|
-
}, [props.disabled]);
|
|
1930
|
-
const onFocusInput = useCallback(() => {
|
|
1931
|
-
controller.setState({ focused: true });
|
|
1932
|
-
}, [controller.setState]);
|
|
1933
|
-
const onBlurInput = useCallback(() => {
|
|
1934
|
-
controller.setState({ focused: false });
|
|
1935
|
-
}, [controller.setState]);
|
|
1936
|
-
const onKeydownInput = useCallback((event) => {
|
|
1937
|
-
switch (event.code) {
|
|
1938
|
-
case 'Escape':
|
|
1939
|
-
case 'Tab':
|
|
1940
|
-
controller.setState({ modalIsVisible: false });
|
|
1941
|
-
break;
|
|
1942
|
-
default:
|
|
1943
|
-
controller.navigationInput(event);
|
|
1944
|
-
break;
|
|
1945
|
-
}
|
|
1946
|
-
}, [controller.setState, controller.navigationInput]);
|
|
1947
|
-
const onClickControl = useCallback(() => {
|
|
1948
|
-
if (!props.readOnly) {
|
|
1949
|
-
controller.setState({ modalIsVisible: true });
|
|
1950
|
-
setTimeout(() => {
|
|
1951
|
-
controller.refInput?.current?.focus();
|
|
1952
|
-
}, DURATION_ANIMATION$1);
|
|
1953
|
-
}
|
|
1954
|
-
}, [controller.setState, props.readOnly]);
|
|
1955
|
-
const onClickAction = useCallback(() => {
|
|
1956
|
-
if (controller.value) {
|
|
1957
|
-
controller.setState({ modalIsVisible: false });
|
|
1958
|
-
controller.setFormValue(undefined);
|
|
1959
|
-
props.onValue && props.onValue(props.value);
|
|
1960
|
-
}
|
|
1961
|
-
else {
|
|
1962
|
-
onClickControl();
|
|
1963
|
-
}
|
|
1964
|
-
}, [
|
|
1965
|
-
controller.value,
|
|
1966
|
-
controller.setState,
|
|
1967
|
-
controller.setFormValue,
|
|
1968
|
-
props.onValue
|
|
1969
|
-
]);
|
|
1970
|
-
const onClickBackdrop = useCallback(() => {
|
|
1971
|
-
controller.setState({ modalIsVisible: false });
|
|
1972
|
-
}, [controller.setState]);
|
|
1973
|
-
const onChange = useCallback((element) => {
|
|
1974
|
-
if (props.onSelect) {
|
|
1975
|
-
element.value && props.onSelect(element.value);
|
|
1976
|
-
}
|
|
1977
|
-
else {
|
|
1978
|
-
controller.setFormValue(element);
|
|
1979
|
-
}
|
|
1980
|
-
if (props.keepOpen) {
|
|
1981
|
-
setPattern('');
|
|
1982
|
-
controller.refInput?.current?.focus();
|
|
1983
|
-
}
|
|
1984
|
-
else {
|
|
1985
|
-
controller.setState({ modalIsVisible: false });
|
|
1986
|
-
}
|
|
1987
|
-
props.onValue && props.onValue(element.value);
|
|
1988
|
-
}, [
|
|
1989
|
-
controller.setState,
|
|
1990
|
-
controller.setFormValue,
|
|
1991
|
-
setPattern,
|
|
1992
|
-
props.keepOpen,
|
|
1993
|
-
props.onSelect,
|
|
1994
|
-
props.onValue
|
|
1995
|
-
]);
|
|
1996
|
-
const onClickElement = useCallback((element) => {
|
|
1997
|
-
return () => {
|
|
1998
|
-
onChange(element);
|
|
1999
|
-
};
|
|
2000
|
-
}, [onChange]);
|
|
2001
|
-
const onKeydownElement = useCallback((element) => {
|
|
2002
|
-
return (event) => {
|
|
2003
|
-
event.code === 'Enter'
|
|
2004
|
-
? onChange(element)
|
|
2005
|
-
: controller.navigationElement(event);
|
|
2006
|
-
};
|
|
2007
|
-
}, [onChange, controller.navigationElement]);
|
|
2008
|
-
return {
|
|
2009
|
-
...controller,
|
|
2010
|
-
coincidences,
|
|
2011
|
-
onBlurInput,
|
|
2012
|
-
onClickAction,
|
|
2013
|
-
onClickBackdrop,
|
|
2014
|
-
onClickControl,
|
|
2015
|
-
onClickElement,
|
|
2016
|
-
onFocusInput,
|
|
2017
|
-
onKeydownElement,
|
|
2018
|
-
onKeydownInput,
|
|
2019
|
-
pattern,
|
|
2020
|
-
setPattern
|
|
2021
|
-
};
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
|
-
function RlsFieldAutocompleteTemplate(props) {
|
|
2025
|
-
const autocomplete = useFieldAutocomplete(props);
|
|
2026
|
-
const { render, children, formControl, msgErrorDisabled, onSearch, placeholder, rlsTheme, searching } = props;
|
|
2027
|
-
const [labels, setLabels] = useState({
|
|
2028
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2029
|
-
listEmptyTitle: reactI18n('listEmptyTitle'),
|
|
2030
|
-
listInputPlaceholder: reactI18n('listInputPlaceholder')
|
|
2031
|
-
});
|
|
2032
|
-
useEffect(() => {
|
|
2033
|
-
return i18nSubscribe(() => {
|
|
2034
|
-
setLabels({
|
|
2035
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2036
|
-
listEmptyTitle: reactI18n('listEmptyTitle'),
|
|
2037
|
-
listInputPlaceholder: reactI18n('listInputPlaceholder')
|
|
2038
|
-
});
|
|
2039
|
-
});
|
|
2040
|
-
}, []);
|
|
2041
|
-
const disabled = useMemo(() => {
|
|
2042
|
-
return formControl?.disabled || props.disabled;
|
|
2043
|
-
}, [formControl?.disabled, props.disabled]);
|
|
2044
|
-
const className = useMemo(() => {
|
|
2045
|
-
return renderClassStatus('rls-field-box', {
|
|
2046
|
-
focused: autocomplete.focused && !disabled,
|
|
2047
|
-
error: formControl?.wrong,
|
|
2048
|
-
disabled,
|
|
2049
|
-
readonly: props.readOnly,
|
|
2050
|
-
selected: !!autocomplete.value
|
|
2051
|
-
}, `rls-field-list rls-field-autocomplete ${props.className ?? ''}`);
|
|
2052
|
-
}, [
|
|
2053
|
-
formControl?.wrong,
|
|
2054
|
-
autocomplete.value,
|
|
2055
|
-
autocomplete.focused,
|
|
2056
|
-
props.className,
|
|
2057
|
-
props.readOnly,
|
|
2058
|
-
disabled
|
|
2059
|
-
]);
|
|
2060
|
-
const classNameSuggestions = useMemo(() => {
|
|
2061
|
-
return renderClassStatus('rls-field-list__suggestions', {
|
|
2062
|
-
disabled,
|
|
2063
|
-
higher: autocomplete.higher,
|
|
2064
|
-
visible: autocomplete.modalIsVisible
|
|
2065
|
-
});
|
|
2066
|
-
}, [autocomplete.higher, autocomplete.modalIsVisible, disabled]);
|
|
2067
|
-
const onChangePattern = useCallback((event) => {
|
|
2068
|
-
autocomplete.setPattern(event.target.value);
|
|
2069
|
-
}, [autocomplete.setPattern]);
|
|
2070
|
-
const onClickPattern = useCallback(() => {
|
|
2071
|
-
onSearch && onSearch(autocomplete.pattern);
|
|
2072
|
-
}, [onSearch, autocomplete.pattern]);
|
|
2073
|
-
const onKeyDownPattern = useCallback((event) => {
|
|
2074
|
-
event.key === 'Enter' && onSearch && onSearch(autocomplete.pattern);
|
|
2075
|
-
autocomplete.onKeydownInput(event);
|
|
2076
|
-
}, [autocomplete.onKeydownInput, onSearch, autocomplete.pattern]);
|
|
2077
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: autocomplete.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: autocomplete.value, onClick: autocomplete.onClickControl }), !props.readOnly && (jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: autocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: autocomplete.value ? 'trash-2' : 'arrow-ios-down' }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameSuggestions, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: autocomplete.refList, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: autocomplete.refInput, className: "rls-field-list__ul__control", type: "text", placeholder: labels.listInputPlaceholder, value: autocomplete.pattern, onChange: onChangePattern, onFocus: autocomplete.onFocusInput, onBlur: autocomplete.onBlurInput, onKeyDown: onKeyDownPattern, disabled: disabled || searching }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: onClickPattern, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), autocomplete.coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: autocomplete.onClickElement(element), onKeyDown: autocomplete.onKeydownElement(element), children: render(element) }, index))), !autocomplete.coincidences.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: autocomplete.onClickBackdrop })] })] }));
|
|
2078
|
-
}
|
|
2079
|
-
function RlsFieldAutocomplete(props) {
|
|
2080
|
-
const render = useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { className: "rls-field-list__ballot", subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
2081
|
-
return jsxRuntimeExports.jsx(RlsFieldAutocompleteTemplate, { ...props, render: render });
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
function RlsModal({ autoclose, children, className, controller, onBackdrop, visible, rlsTheme }) {
|
|
2085
|
-
const classNameModal = useMemo(() => {
|
|
2086
|
-
return renderClassStatus('rls-modal', { visible: controller?.visible ?? visible }, className);
|
|
2087
|
-
}, [className, visible, controller?.visible]);
|
|
2088
|
-
const onClickBackdrop = useCallback(() => {
|
|
2089
|
-
autoclose && controller?.close();
|
|
2090
|
-
onBackdrop?.();
|
|
2091
|
-
}, [autoclose, controller, onBackdrop]);
|
|
2092
|
-
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: classNameModal, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal__backdrop", onClick: onClickBackdrop })] }), document.body);
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
function formatTime(value) {
|
|
2096
|
-
return String(value).padStart(2, '0');
|
|
2097
|
-
}
|
|
2098
|
-
const CLOCK_VALUES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
2099
|
-
const RADIUS = 48;
|
|
2100
|
-
const DIAL_RADIUS = 60;
|
|
2101
|
-
const TICK_RADIUS = 7;
|
|
2102
|
-
function RlsPickerClockTick({ onValue, selectionIsHours, value }) {
|
|
2103
|
-
const styleTick = useMemo(() => {
|
|
2104
|
-
const radian = (value / 6) * Math.PI;
|
|
2105
|
-
const x = Math.sin(radian) * RADIUS;
|
|
2106
|
-
const y = Math.cos(radian) * RADIUS;
|
|
2107
|
-
return {
|
|
2108
|
-
left: `${DIAL_RADIUS + x - TICK_RADIUS - 1}rem`,
|
|
2109
|
-
top: `${DIAL_RADIUS - y - TICK_RADIUS - 1}rem`
|
|
2110
|
-
};
|
|
2111
|
-
}, []);
|
|
2112
|
-
const label = useMemo(() => {
|
|
2113
|
-
if (selectionIsHours) {
|
|
2114
|
-
return formatTime(value);
|
|
2115
|
-
}
|
|
2116
|
-
if (value === 12) {
|
|
2117
|
-
return formatTime(0);
|
|
2118
|
-
}
|
|
2119
|
-
return formatTime(value * 5);
|
|
2120
|
-
}, [selectionIsHours]);
|
|
2121
|
-
const onClick = useCallback((event) => {
|
|
2122
|
-
event.preventDefault();
|
|
2123
|
-
onValue(value);
|
|
2124
|
-
}, [onValue]);
|
|
2125
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__tick", style: styleTick, onClick: onClick, children: label }));
|
|
2126
|
-
}
|
|
2127
|
-
function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
2128
|
-
const timeInitial = useMemo(() => {
|
|
2129
|
-
return formControl?.value ?? time ?? Time.now();
|
|
2130
|
-
}, [formControl?.value, time]);
|
|
2131
|
-
const plateElement = useRef(null);
|
|
2132
|
-
const lineElement = useRef(null);
|
|
2133
|
-
const centerElement = useRef(null);
|
|
2134
|
-
const indicatorElement = useRef(null);
|
|
2135
|
-
const pointElement = useRef(null);
|
|
2136
|
-
const [labels, setLabels] = useState({
|
|
2137
|
-
timeActionCancel: reactI18n('dateActionCancel'),
|
|
2138
|
-
timeActionSelect: reactI18n('dateActionSelect')
|
|
2139
|
-
});
|
|
2140
|
-
const [zoneIsPM, setZoneIsPM] = useState(timeInitial.hour >= 12);
|
|
2141
|
-
const [hour, setHour] = useState(zoneIsPM ? timeInitial.hour - 12 : timeInitial.hour);
|
|
2142
|
-
const [minute, setMinute] = useState(timeInitial.minute);
|
|
2143
|
-
const [selectionIsHours, setSelectionIsHours] = useState(true);
|
|
2144
|
-
const changeIsInternal = useRef(true);
|
|
2145
|
-
const selectionIsActive = useRef(false);
|
|
2146
|
-
const radianUnit = useMemo(() => {
|
|
2147
|
-
return Math.PI / (selectionIsHours ? 6 : 30);
|
|
2148
|
-
}, [selectionIsHours]);
|
|
2149
|
-
const hourFormat = useMemo(() => {
|
|
2150
|
-
return formatTime(hour === 0 ? 12 : hour);
|
|
2151
|
-
}, [hour]);
|
|
2152
|
-
const minuteFormat = useMemo(() => {
|
|
2153
|
-
return formatTime(minute);
|
|
2154
|
-
}, [minute]);
|
|
2155
|
-
const classNameHour = useMemo(() => {
|
|
2156
|
-
return renderClassStatus('rls-picker-clock__title__value', {
|
|
2157
|
-
active: selectionIsHours
|
|
2158
|
-
});
|
|
2159
|
-
}, [selectionIsHours]);
|
|
2160
|
-
const classNameMinute = useMemo(() => {
|
|
2161
|
-
return renderClassStatus('rls-picker-clock__title__value', {
|
|
2162
|
-
active: !selectionIsHours
|
|
2163
|
-
});
|
|
2164
|
-
}, [selectionIsHours]);
|
|
2165
|
-
const classNameAM = useMemo(() => {
|
|
2166
|
-
return renderClassStatus('rls-picker-clock__zone__value', {
|
|
2167
|
-
active: !zoneIsPM
|
|
2168
|
-
});
|
|
2169
|
-
}, [zoneIsPM]);
|
|
2170
|
-
const classNamePM = useMemo(() => {
|
|
2171
|
-
return renderClassStatus('rls-picker-clock__zone__value', {
|
|
2172
|
-
active: zoneIsPM
|
|
2173
|
-
});
|
|
2174
|
-
}, [zoneIsPM]);
|
|
2175
|
-
const refreshClockHour = useEffectEvent(() => {
|
|
2176
|
-
refreshClock(hour > 12 ? hour - 12 : hour);
|
|
2177
|
-
});
|
|
2178
|
-
const refreshClockMinute = useEffectEvent(() => {
|
|
2179
|
-
refreshClock(minute);
|
|
2180
|
-
});
|
|
2181
|
-
useEffect(() => {
|
|
2182
|
-
return i18nSubscribe(() => {
|
|
2183
|
-
setLabels({
|
|
2184
|
-
timeActionCancel: reactI18n('dateActionCancel'),
|
|
2185
|
-
timeActionSelect: reactI18n('dateActionSelect')
|
|
2186
|
-
});
|
|
2187
|
-
});
|
|
2188
|
-
}, []);
|
|
2189
|
-
useEffect(() => {
|
|
2190
|
-
selectionIsHours ? refreshClockHour() : refreshClockMinute();
|
|
2191
|
-
}, [selectionIsHours]);
|
|
2192
|
-
useEffect(() => {
|
|
2193
|
-
if (!changeIsInternal.current && formControl?.value) {
|
|
2194
|
-
const zoneIsPM = formControl.value.hour >= 12;
|
|
2195
|
-
setZoneIsPM(zoneIsPM);
|
|
2196
|
-
setHour(zoneIsPM ? formControl.value.hour - 12 : formControl.value.hour);
|
|
2197
|
-
setMinute(formControl.value.minute);
|
|
2198
|
-
}
|
|
2199
|
-
changeIsInternal.current = false;
|
|
2200
|
-
}, [formControl?.value]);
|
|
2201
|
-
const refreshComponent = useCallback((clientX, clientY) => {
|
|
2202
|
-
const rectangle = plateElement.current.getBoundingClientRect();
|
|
2203
|
-
const centerX = rectangle.left + rectangle.width / 2;
|
|
2204
|
-
const centerY = rectangle.top + rectangle.height / 2;
|
|
2205
|
-
const positionX = clientX - centerX;
|
|
2206
|
-
const positionY = clientY - centerY;
|
|
2207
|
-
const angle = Math.atan2(-positionX, positionY) + Math.PI;
|
|
2208
|
-
const value = Math.round(angle / radianUnit);
|
|
2209
|
-
refreshClock(value);
|
|
2210
|
-
selectionIsHours ? setHour(value === 0 ? 12 : value) : setMinute(value);
|
|
2211
|
-
}, [selectionIsHours, radianUnit]);
|
|
2212
|
-
const refreshClock = useCallback((value) => {
|
|
2213
|
-
const angle = value * radianUnit;
|
|
2214
|
-
const x2 = Math.sin(angle) * (RADIUS - TICK_RADIUS);
|
|
2215
|
-
const y2 = -Math.cos(angle) * (RADIUS - TICK_RADIUS);
|
|
2216
|
-
const cx = Math.sin(angle) * RADIUS;
|
|
2217
|
-
const cy = -Math.cos(angle) * RADIUS;
|
|
2218
|
-
lineElement.current.setAttribute('x2', `${x2 - 1}rem`);
|
|
2219
|
-
lineElement.current.setAttribute('y2', `${y2 - 1}rem`);
|
|
2220
|
-
indicatorElement.current.setAttribute('cx', `${cx - 1}rem`);
|
|
2221
|
-
indicatorElement.current.setAttribute('cy', `${cy - 1}rem`);
|
|
2222
|
-
pointElement.current.setAttribute('cx', `${cx - 1}rem`);
|
|
2223
|
-
pointElement.current.setAttribute('cy', `${cy - 1}rem`);
|
|
2224
|
-
pointElement.current.style.visibility =
|
|
2225
|
-
selectionIsHours || value % 5 === 0 ? 'hidden' : 'visible';
|
|
2226
|
-
}, [selectionIsHours, radianUnit]);
|
|
2227
|
-
const onClickHour = useCallback(() => {
|
|
2228
|
-
setSelectionIsHours(true);
|
|
2229
|
-
}, []);
|
|
2230
|
-
const onClickMinute = useCallback(() => {
|
|
2231
|
-
setSelectionIsHours(false);
|
|
2232
|
-
}, []);
|
|
2233
|
-
const onClickAM = useCallback(() => {
|
|
2234
|
-
setZoneIsPM(false);
|
|
2235
|
-
}, []);
|
|
2236
|
-
const onClickPM = useCallback(() => {
|
|
2237
|
-
setZoneIsPM(true);
|
|
2238
|
-
}, []);
|
|
2239
|
-
const onActiveSelection = useCallback(() => {
|
|
2240
|
-
selectionIsActive.current = true;
|
|
2241
|
-
}, []);
|
|
2242
|
-
const onMouseSelection = useCallback((event) => {
|
|
2243
|
-
if (selectionIsActive.current) {
|
|
2244
|
-
event.preventDefault();
|
|
2245
|
-
refreshComponent(event.clientX, event.clientY);
|
|
2246
|
-
}
|
|
2247
|
-
}, [refreshComponent]);
|
|
2248
|
-
const onTouchSelection = useCallback((event) => {
|
|
2249
|
-
const touch = event.touches.item(0);
|
|
2250
|
-
if (selectionIsActive.current && touch) {
|
|
2251
|
-
refreshComponent(touch.clientX, touch.clientY);
|
|
2252
|
-
}
|
|
2253
|
-
}, [refreshComponent]);
|
|
2254
|
-
const onInactiveSelection = useCallback(() => {
|
|
2255
|
-
selectionIsActive.current = false;
|
|
2256
|
-
}, []);
|
|
2257
|
-
const onClickValue = useCallback((value) => {
|
|
2258
|
-
if (selectionIsHours) {
|
|
2259
|
-
setHour(value);
|
|
2260
|
-
refreshClock(value);
|
|
2261
|
-
}
|
|
2262
|
-
else {
|
|
2263
|
-
const minute = value === 12 ? 0 : value * 5;
|
|
2264
|
-
setMinute(minute);
|
|
2265
|
-
refreshClock(minute);
|
|
2266
|
-
}
|
|
2267
|
-
}, [selectionIsHours]);
|
|
2268
|
-
const onCancel = useCallback(() => {
|
|
2269
|
-
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
2270
|
-
}, [onListener]);
|
|
2271
|
-
const onCurrentTime = useCallback(() => {
|
|
2272
|
-
const currentTime = Time.now();
|
|
2273
|
-
changeIsInternal.current = true;
|
|
2274
|
-
formControl?.setValue(currentTime);
|
|
2275
|
-
setHour(currentTime.hour);
|
|
2276
|
-
setMinute(currentTime.minute);
|
|
2277
|
-
onListener?.({
|
|
2278
|
-
event: PickerListenerEvent.Select,
|
|
2279
|
-
value: currentTime
|
|
2280
|
-
});
|
|
2281
|
-
}, [formControl, onListener]);
|
|
2282
|
-
const onSelect = useCallback(() => {
|
|
2283
|
-
const hourValue = zoneIsPM
|
|
2284
|
-
? hour !== 12
|
|
2285
|
-
? hour + 12
|
|
2286
|
-
: 12
|
|
2287
|
-
: hour === 12
|
|
2288
|
-
? 0
|
|
2289
|
-
: hour;
|
|
2290
|
-
const timeValue = new Time(hourValue, minute);
|
|
2291
|
-
changeIsInternal.current = true;
|
|
2292
|
-
formControl?.setValue(timeValue);
|
|
2293
|
-
onListener?.({
|
|
2294
|
-
event: PickerListenerEvent.Select,
|
|
2295
|
-
value: timeValue
|
|
2296
|
-
});
|
|
2297
|
-
}, [formControl, hour, minute, zoneIsPM, onListener]);
|
|
2298
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__header", children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__title", children: [jsxRuntimeExports.jsx("span", { className: classNameHour, onClick: onClickHour, children: hourFormat }), jsxRuntimeExports.jsx("span", { className: "rls-picker-clock__title__separator", children: ":" }), jsxRuntimeExports.jsx("span", { className: classNameMinute, onClick: onClickMinute, children: minuteFormat })] }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__zone", children: [jsxRuntimeExports.jsx("span", { className: classNameAM, onClick: onClickAM, children: "AM" }), jsxRuntimeExports.jsx("span", { className: classNamePM, onClick: onClickPM, children: "PM" })] })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__body", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__plate", ref: plateElement, onMouseDown: onActiveSelection, onMouseMove: onMouseSelection, onMouseUp: onInactiveSelection, onMouseLeave: onInactiveSelection, onTouchStart: onActiveSelection, onTouchMove: onTouchSelection, onTouchEnd: onInactiveSelection, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__canvas", children: jsxRuntimeExports.jsx("svg", { width: "120rem", height: "120rem", children: jsxRuntimeExports.jsxs("g", { style: {
|
|
2299
|
-
transform: `translate(${DIAL_RADIUS}rem, ${DIAL_RADIUS}rem)`
|
|
2300
|
-
}, children: [jsxRuntimeExports.jsx("line", { ref: lineElement, className: "rls-picker-clock__canvas__line", x1: "-1", y1: "-1" }), jsxRuntimeExports.jsx("circle", { ref: centerElement, className: "rls-picker-clock__canvas__center", r: "4", cx: "-1", cy: "-1" }), jsxRuntimeExports.jsx("circle", { ref: indicatorElement, className: "rls-picker-clock__canvas__indicator", r: `${TICK_RADIUS}rem` }), jsxRuntimeExports.jsx("circle", { ref: pointElement, className: "rls-picker-clock__canvas__point", r: "3.5" })] }) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__hours", children: CLOCK_VALUES.map((value) => {
|
|
2301
|
-
return (jsxRuntimeExports.jsx(RlsPickerClockTick, { value: value, selectionIsHours: selectionIsHours, onValue: onClickValue }, value));
|
|
2302
|
-
}) })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__footer", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.timeActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--today", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "timer", onClick: onCurrentTime }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.timeActionSelect }) })] })] }));
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
|
-
function RlsFieldClock({ children, disabled: disabledProps, formControl, identifier, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, time, value: valueInitial }) {
|
|
2306
|
-
const [value, setValue] = useState(formControl?.value ?? valueInitial);
|
|
2307
|
-
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
2308
|
-
const disabled = useMemo(() => {
|
|
2309
|
-
return formControl?.disabled || disabledProps;
|
|
2310
|
-
}, [formControl?.disabled, disabledProps]);
|
|
2311
|
-
const className = useMemo(() => {
|
|
2312
|
-
return renderClassStatus('rls-field-box', {
|
|
2313
|
-
disabled,
|
|
2314
|
-
readonly: readOnly
|
|
2315
|
-
});
|
|
2316
|
-
}, [disabled, readOnly]);
|
|
2317
|
-
const timeValue = useMemo(() => {
|
|
2318
|
-
return formControl ? formControl.value : value;
|
|
2319
|
-
}, [formControl?.value, value]);
|
|
2320
|
-
const status = useMemo(() => {
|
|
2321
|
-
return {
|
|
2322
|
-
icon: timeValue ? 'trash-2' : 'timer',
|
|
2323
|
-
valueInput: timeValue?.normalizeMeridiemFormat || ''
|
|
2324
|
-
};
|
|
2325
|
-
}, [timeValue]);
|
|
2326
|
-
const onClickInput = useCallback(() => {
|
|
2327
|
-
!readOnly && setModalIsVisible(true);
|
|
2328
|
-
}, [readOnly]);
|
|
2329
|
-
const onChange = useCallback((value) => {
|
|
2330
|
-
setValue(value);
|
|
2331
|
-
onValue?.(value);
|
|
2332
|
-
}, [onValue]);
|
|
2333
|
-
const onClickAction = useCallback(() => {
|
|
2334
|
-
if (timeValue) {
|
|
2335
|
-
formControl?.setValue(valueInitial);
|
|
2336
|
-
formControl?.touch();
|
|
2337
|
-
onChange(valueInitial);
|
|
2338
|
-
}
|
|
2339
|
-
else {
|
|
2340
|
-
setModalIsVisible(true);
|
|
2341
|
-
}
|
|
2342
|
-
}, [timeValue, formControl, valueInitial, onChange]);
|
|
2343
|
-
const onListener = useCallback(({ event, value }) => {
|
|
2344
|
-
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2345
|
-
formControl?.touch();
|
|
2346
|
-
setModalIsVisible(false);
|
|
2347
|
-
}, [formControl, onChange]);
|
|
2348
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date__control", type: "text", value: status.valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: status.icon }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-clock-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerClock, { formControl: formControl, time: time, disabled: disabled, onListener: onListener }) })] }));
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
const DATE_FORMAT = '{dd}/{mx}/{yy}';
|
|
2352
|
-
const DATE_FORMAT_TITLE = '{dw}, {mx} {dd} de {yy}';
|
|
2353
|
-
const DATE_RANGE_FORMAT = '{dd}/{mx}/{yy}';
|
|
2354
|
-
|
|
2355
|
-
function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
2356
|
-
const today = useRef(new Date()); // Initial current date in component
|
|
2357
|
-
const _date = useMemo(() => {
|
|
2358
|
-
return formControl?.value ?? date ?? today.current;
|
|
2359
|
-
}, [formControl?.value, date]);
|
|
2360
|
-
const yearControl = useReactControl(_date.getFullYear());
|
|
2361
|
-
const dayControl = useReactControl(_date.getDate());
|
|
2362
|
-
const monthControl = useReactControl(_date.getMonth());
|
|
2363
|
-
const [value, setValue] = useState(_date);
|
|
2364
|
-
const [visibility, setVisibility] = useState('DAY');
|
|
2365
|
-
const [labels, setLabels] = useState({
|
|
2366
|
-
dateActionCancel: reactI18n('dateActionCancel'),
|
|
2367
|
-
dateActionSelect: reactI18n('dateActionSelect'),
|
|
2368
|
-
dateActionToday: reactI18n('dateActionToday')
|
|
2369
|
-
});
|
|
2370
|
-
const classNameComponent = useMemo(() => {
|
|
2371
|
-
return renderClassStatus('rls-picker-date__component', {
|
|
2372
|
-
day: visibility === 'DAY',
|
|
2373
|
-
month: visibility === 'MONTH',
|
|
2374
|
-
year: visibility === 'YEAR'
|
|
2375
|
-
});
|
|
2376
|
-
}, [visibility]);
|
|
2377
|
-
const title = useMemo(() => {
|
|
2378
|
-
return dateFormatTemplate(_date, DATE_FORMAT_TITLE);
|
|
2379
|
-
}, [_date]);
|
|
2380
|
-
const itIsDisabledToday = useMemo(() => dateOutRange({
|
|
2381
|
-
date: today.current,
|
|
2382
|
-
maxDate,
|
|
2383
|
-
minDate
|
|
2384
|
-
}), [today.current, maxDate, minDate]);
|
|
2385
|
-
useEffect(() => {
|
|
2386
|
-
const date = verifyDateRange({ date: _date, minDate, maxDate });
|
|
2387
|
-
setValue(date);
|
|
2388
|
-
formControl?.setValue(date);
|
|
2389
|
-
return i18nSubscribe(() => {
|
|
2390
|
-
setLabels({
|
|
2391
|
-
dateActionCancel: reactI18n('dateActionCancel'),
|
|
2392
|
-
dateActionSelect: reactI18n('dateActionSelect'),
|
|
2393
|
-
dateActionToday: reactI18n('dateActionToday')
|
|
2394
|
-
});
|
|
2395
|
-
});
|
|
2396
|
-
}, []);
|
|
2397
|
-
useEffect(() => {
|
|
2398
|
-
setValue(new Date(yearControl.value, monthControl.value, dayControl.value));
|
|
2399
|
-
}, [yearControl.value, monthControl.value, dayControl.value]);
|
|
2400
|
-
const onVisibilityDay = useCallback(() => {
|
|
2401
|
-
setVisibility('DAY');
|
|
2402
|
-
}, []);
|
|
2403
|
-
const onVisibilityTitle = useCallback((type) => {
|
|
2404
|
-
type === 'month' ? setVisibility('MONTH') : setVisibility('YEAR');
|
|
2405
|
-
}, []);
|
|
2406
|
-
const onCancel = useCallback(() => {
|
|
2407
|
-
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
2408
|
-
}, [onListener]);
|
|
2409
|
-
const onToday = useCallback(() => {
|
|
2410
|
-
yearControl.setValue(today.current.getFullYear());
|
|
2411
|
-
dayControl.setValue(today.current.getDate());
|
|
2412
|
-
monthControl.setValue(today.current.getMonth());
|
|
2413
|
-
formControl?.setValue(today.current);
|
|
2414
|
-
onListener?.({
|
|
2415
|
-
event: PickerListenerEvent.Now,
|
|
2416
|
-
value: today.current
|
|
2417
|
-
});
|
|
2418
|
-
}, [formControl, onListener]);
|
|
2419
|
-
const onSelect = useCallback(() => {
|
|
2420
|
-
formControl?.setValue(value);
|
|
2421
|
-
onListener?.({
|
|
2422
|
-
event: PickerListenerEvent.Select,
|
|
2423
|
-
value
|
|
2424
|
-
});
|
|
2425
|
-
}, [formControl, value, onListener]);
|
|
2426
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date: _date, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: _date, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: _date, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), !automatic && (jsxRuntimeExports.jsx("div", { className: "rls-picker-date__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "calendar", onClick: onToday, disabled: itIsDisabledToday }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) }))] }));
|
|
2427
|
-
}
|
|
2428
|
-
|
|
2429
|
-
function RlsFieldDate({ children, date, disabled: disabledProps, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
2430
|
-
const today = useRef(new Date()); // Initial current date in component
|
|
2431
|
-
const [value, setValue] = useState(formControl?.value ?? valueInitial);
|
|
2432
|
-
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
2433
|
-
const disabled = useMemo(() => {
|
|
2434
|
-
return formControl?.disabled || disabledProps;
|
|
2435
|
-
}, [formControl?.disabled, disabledProps]);
|
|
2436
|
-
const className = useMemo(() => {
|
|
2437
|
-
return renderClassStatus('rls-field-box', {
|
|
2438
|
-
disabled,
|
|
2439
|
-
readonly: readOnly
|
|
2440
|
-
});
|
|
2441
|
-
}, [disabled, readOnly]);
|
|
2442
|
-
const dateValue = useMemo(() => {
|
|
2443
|
-
return formControl ? formControl.value : value;
|
|
2444
|
-
}, [formControl?.value, value]);
|
|
2445
|
-
const status = useMemo(() => {
|
|
2446
|
-
return {
|
|
2447
|
-
icon: dateValue ? 'trash-2' : 'calendar',
|
|
2448
|
-
label: dateValue
|
|
2449
|
-
? dateFormatTemplate(dateValue, format || DATE_FORMAT)
|
|
2450
|
-
: ''
|
|
2451
|
-
};
|
|
2452
|
-
}, [dateValue, format]);
|
|
2453
|
-
useEffect(() => {
|
|
2454
|
-
const dateSecure = verifyDateRange({
|
|
2455
|
-
date: formControl?.value ?? date ?? today.current,
|
|
2456
|
-
minDate,
|
|
2457
|
-
maxDate
|
|
2458
|
-
});
|
|
2459
|
-
setValue(dateSecure);
|
|
2460
|
-
formControl?.setValue(dateSecure);
|
|
2461
|
-
}, []);
|
|
2462
|
-
const onClickInput = useCallback(() => {
|
|
2463
|
-
!readOnly && setModalIsVisible(true);
|
|
2464
|
-
}, [readOnly]);
|
|
2465
|
-
const onChange = useCallback((value) => {
|
|
2466
|
-
setValue(value);
|
|
2467
|
-
onValue?.(value);
|
|
2468
|
-
}, [onValue]);
|
|
2469
|
-
const onClickAction = useCallback(() => {
|
|
2470
|
-
if (dateValue) {
|
|
2471
|
-
formControl?.setValue(valueInitial);
|
|
2472
|
-
formControl?.touch();
|
|
2473
|
-
onChange(valueInitial);
|
|
2474
|
-
}
|
|
2475
|
-
else {
|
|
2476
|
-
setModalIsVisible(true);
|
|
2477
|
-
}
|
|
2478
|
-
}, [dateValue, formControl, valueInitial, onChange]);
|
|
2479
|
-
const onListener = useCallback(({ event, value }) => {
|
|
2480
|
-
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2481
|
-
formControl?.touch();
|
|
2482
|
-
setModalIsVisible(false);
|
|
2483
|
-
}, [formControl, onChange]);
|
|
2484
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date__control", type: "text", value: status.label, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: status.icon }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-date-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: onListener }) })] }));
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
2488
|
-
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
2489
|
-
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
2490
|
-
return `${minFormat} - ${maxFormat}`;
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
|
-
function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
2494
|
-
const _date = useMemo(() => normalizeMinTime(datePicker ?? new Date()), [datePicker]);
|
|
2495
|
-
const _range = useMemo(() => formControl?.value ?? DateRange.now(), [formControl?.value]);
|
|
2496
|
-
const yearControl = useReactControl(_date.getFullYear());
|
|
2497
|
-
const monthControl = useReactControl(_date.getMonth());
|
|
2498
|
-
const rangeControl = useReactControl(_range);
|
|
2499
|
-
const [value, setValue] = useState(_range);
|
|
2500
|
-
const [date, setDate] = useState(_date);
|
|
2501
|
-
const [visibility, setVisibility] = useState('DAY');
|
|
2502
|
-
const [labels, setLabels] = useState({
|
|
2503
|
-
dateActionCancel: reactI18n('dateActionCancel'),
|
|
2504
|
-
dateActionSelect: reactI18n('dateActionSelect')
|
|
2505
|
-
});
|
|
2506
|
-
const classNameComponent = useMemo(() => {
|
|
2507
|
-
return renderClassStatus('rls-picker-date-range__component', {
|
|
2508
|
-
day: visibility === 'DAY',
|
|
2509
|
-
month: visibility === 'MONTH',
|
|
2510
|
-
year: visibility === 'YEAR'
|
|
2511
|
-
});
|
|
2512
|
-
}, [visibility]);
|
|
2513
|
-
const classNameFooter = useMemo(() => {
|
|
2514
|
-
return renderClassStatus('rls-picker-date-range__footer', { automatic });
|
|
2515
|
-
}, [automatic]);
|
|
2516
|
-
const title = useMemo(() => rangeFormatTemplate(value), [value]);
|
|
2517
|
-
useEffect(() => {
|
|
2518
|
-
return i18nSubscribe(() => {
|
|
2519
|
-
setLabels({
|
|
2520
|
-
dateActionCancel: reactI18n('dateActionCancel'),
|
|
2521
|
-
dateActionSelect: reactI18n('dateActionSelect')
|
|
2522
|
-
});
|
|
2523
|
-
});
|
|
2524
|
-
}, []);
|
|
2525
|
-
useEffect(() => {
|
|
2526
|
-
setDate((date) => {
|
|
2527
|
-
return valueIsDefined(yearControl.value)
|
|
2528
|
-
? assignYearInDate(date, yearControl.value)
|
|
2529
|
-
: date;
|
|
2530
|
-
});
|
|
2531
|
-
}, [yearControl.value]);
|
|
2532
|
-
useEffect(() => {
|
|
2533
|
-
setDate((date) => {
|
|
2534
|
-
return valueIsDefined(monthControl.value)
|
|
2535
|
-
? assignMonthInDate(date, monthControl.value)
|
|
2536
|
-
: date;
|
|
2537
|
-
});
|
|
2538
|
-
}, [monthControl.value]);
|
|
2539
|
-
useEffect(() => {
|
|
2540
|
-
rangeControl.value && setValue(rangeControl.value);
|
|
2541
|
-
setVisibility('DAY');
|
|
2542
|
-
}, [rangeControl.value]);
|
|
2543
|
-
const onVisibilityDay = useCallback(() => {
|
|
2544
|
-
setVisibility('DAY');
|
|
2545
|
-
}, []);
|
|
2546
|
-
const onVisibilityTitle = useCallback((type) => {
|
|
2547
|
-
type === 'month' ? setVisibility('MONTH') : setVisibility('YEAR');
|
|
2548
|
-
}, []);
|
|
2549
|
-
const onCancel = useCallback(() => {
|
|
2550
|
-
onListener && onListener({ event: PickerListenerEvent.Cancel });
|
|
2551
|
-
}, [onListener]);
|
|
2552
|
-
const onSelect = useCallback(() => {
|
|
2553
|
-
formControl?.setValue(value);
|
|
2554
|
-
onListener && onListener({ event: PickerListenerEvent.Select, value });
|
|
2555
|
-
}, [formControl, value, onListener]);
|
|
2556
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDayRange, { formControl: rangeControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntimeExports.jsx("div", { className: classNameFooter, children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) })] }));
|
|
2557
|
-
}
|
|
2558
|
-
|
|
2559
|
-
function RlsFieldDateRange({ children, date, disabled: disabledProps, formControl, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
2560
|
-
const currentDate = useMemo(() => date ?? new Date(), [date]);
|
|
2561
|
-
const [value, setValue] = useState(formControl?.value || valueInitial);
|
|
2562
|
-
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
2563
|
-
const disabled = useMemo(() => {
|
|
2564
|
-
return formControl?.disabled || disabledProps;
|
|
2565
|
-
}, [formControl?.disabled, disabledProps]);
|
|
2566
|
-
const className = useMemo(() => {
|
|
2567
|
-
return renderClassStatus('rls-field-box', {
|
|
2568
|
-
disabled,
|
|
2569
|
-
readonly: readOnly
|
|
2570
|
-
});
|
|
2571
|
-
}, [disabled, readOnly]);
|
|
2572
|
-
const dateRangeValue = useMemo(() => {
|
|
2573
|
-
return formControl ? formControl.value : value;
|
|
2574
|
-
}, [formControl?.value, value]);
|
|
2575
|
-
const status = useMemo(() => {
|
|
2576
|
-
return {
|
|
2577
|
-
icon: dateRangeValue ? 'trash-2' : 'calendar',
|
|
2578
|
-
valueInput: dateRangeValue ? rangeFormatTemplate(dateRangeValue) : ''
|
|
2579
|
-
};
|
|
2580
|
-
}, [dateRangeValue]);
|
|
2581
|
-
const onClickInput = useCallback(() => {
|
|
2582
|
-
!readOnly && setModalIsVisible(true);
|
|
2583
|
-
}, [readOnly]);
|
|
2584
|
-
const onChange = useCallback((value) => {
|
|
2585
|
-
setValue(value);
|
|
2586
|
-
onValue?.(value);
|
|
2587
|
-
}, [onValue]);
|
|
2588
|
-
const onClickAction = useCallback(() => {
|
|
2589
|
-
if (dateRangeValue) {
|
|
2590
|
-
formControl?.setValue(valueInitial);
|
|
2591
|
-
formControl?.touch();
|
|
2592
|
-
onChange(valueInitial);
|
|
2593
|
-
}
|
|
2594
|
-
else {
|
|
2595
|
-
setModalIsVisible(true);
|
|
2596
|
-
}
|
|
2597
|
-
}, [dateRangeValue, formControl, valueInitial, onChange]);
|
|
2598
|
-
const onListener = useCallback(({ event, value }) => {
|
|
2599
|
-
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2600
|
-
formControl?.touch();
|
|
2601
|
-
setModalIsVisible(false);
|
|
2602
|
-
}, [formControl, onChange]);
|
|
2603
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date-range__control", type: "text", value: status.valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: status.icon }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-date-range-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: onListener }) })] }));
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
function useFieldSelect(props) {
|
|
2607
|
-
const count = useRef(props.suggestions.length);
|
|
2608
|
-
const controller = useListController({
|
|
2609
|
-
...props,
|
|
2610
|
-
count: count.current
|
|
2611
|
-
});
|
|
2612
|
-
useEffect(() => {
|
|
2613
|
-
count.current = props.suggestions.length;
|
|
2614
|
-
}, [props.suggestions]);
|
|
2615
|
-
useEffect(() => {
|
|
2616
|
-
props.disabled && controller.setState({ focused: false });
|
|
2617
|
-
}, [props.disabled]);
|
|
2618
|
-
const onFocusInput = useCallback(() => {
|
|
2619
|
-
controller.setState({ focused: true });
|
|
2620
|
-
}, [controller.setState]);
|
|
2621
|
-
const onBlurInput = useCallback(() => {
|
|
2622
|
-
controller.setState({ focused: false });
|
|
2623
|
-
}, [controller.setState]);
|
|
2624
|
-
const onClickInput = useCallback(() => {
|
|
2625
|
-
!props.readOnly && controller.setState({ modalIsVisible: true });
|
|
2626
|
-
}, [controller.setState, props.readOnly]);
|
|
2627
|
-
const onKeydownInput = useCallback((event) => {
|
|
2628
|
-
switch (event.code) {
|
|
2629
|
-
case 'Space':
|
|
2630
|
-
case 'Enter':
|
|
2631
|
-
controller.setState({ modalIsVisible: true });
|
|
2632
|
-
break;
|
|
2633
|
-
case 'Escape':
|
|
2634
|
-
case 'Tab':
|
|
2635
|
-
controller.setState({ modalIsVisible: false });
|
|
2636
|
-
break;
|
|
2637
|
-
default:
|
|
2638
|
-
controller.navigationInput(event);
|
|
2639
|
-
break;
|
|
2640
|
-
}
|
|
2641
|
-
}, [controller.setState, controller.navigationInput]);
|
|
2642
|
-
const onClickAction = useCallback(() => {
|
|
2643
|
-
const removable = !props.unremovable && !!controller.value;
|
|
2644
|
-
if (removable) {
|
|
2645
|
-
controller.setState({ modalIsVisible: false });
|
|
2646
|
-
controller.setFormValue(undefined);
|
|
2647
|
-
props.onValue && props.onValue(props.value);
|
|
2648
|
-
}
|
|
2649
|
-
else {
|
|
2650
|
-
const modalIsVisible = !controller.modalIsVisible;
|
|
2651
|
-
controller.setState({ modalIsVisible });
|
|
2652
|
-
modalIsVisible && controller.refInput?.current?.focus();
|
|
2653
|
-
}
|
|
2654
|
-
}, [
|
|
2655
|
-
controller.modalIsVisible,
|
|
2656
|
-
controller.value,
|
|
2657
|
-
controller.setState,
|
|
2658
|
-
controller.setFormValue,
|
|
2659
|
-
props.unremovable,
|
|
2660
|
-
props.onValue
|
|
2661
|
-
]);
|
|
2662
|
-
const onClickBackdrop = useCallback(() => {
|
|
2663
|
-
controller.setState({ modalIsVisible: false });
|
|
2664
|
-
}, [controller.setState]);
|
|
2665
|
-
const onChange = useCallback((element) => {
|
|
2666
|
-
!props.disabled && controller.refInput?.current?.focus();
|
|
2667
|
-
if (props.onSelect) {
|
|
2668
|
-
controller.setState({ modalIsVisible: false });
|
|
2669
|
-
element.value && props.onSelect(element.value);
|
|
2670
|
-
}
|
|
2671
|
-
else {
|
|
2672
|
-
controller.setFormValue(element);
|
|
2673
|
-
controller.setState({ modalIsVisible: false });
|
|
2674
|
-
}
|
|
2675
|
-
props.onValue && props.onValue(element.value);
|
|
2676
|
-
}, [
|
|
2677
|
-
controller.setState,
|
|
2678
|
-
controller.setFormValue,
|
|
2679
|
-
props.onSelect,
|
|
2680
|
-
props.onValue,
|
|
2681
|
-
props.disabled
|
|
2682
|
-
]);
|
|
2683
|
-
const onClickElement = useCallback((element) => {
|
|
2684
|
-
return () => {
|
|
2685
|
-
onChange(element);
|
|
2686
|
-
};
|
|
2687
|
-
}, [onChange]);
|
|
2688
|
-
const onKeydownElement = useCallback((element) => {
|
|
2689
|
-
return (event) => {
|
|
2690
|
-
event.code === 'Enter'
|
|
2691
|
-
? onChange(element)
|
|
2692
|
-
: controller.navigationElement(event);
|
|
2693
|
-
};
|
|
2694
|
-
}, [onChange, controller.navigationElement]);
|
|
2695
|
-
return {
|
|
2696
|
-
...controller,
|
|
2697
|
-
onBlurInput,
|
|
2698
|
-
onClickAction,
|
|
2699
|
-
onClickBackdrop,
|
|
2700
|
-
onClickInput,
|
|
2701
|
-
onClickElement,
|
|
2702
|
-
onFocusInput,
|
|
2703
|
-
onKeydownElement,
|
|
2704
|
-
onKeydownInput
|
|
2705
|
-
};
|
|
2706
|
-
}
|
|
2707
|
-
|
|
2708
|
-
function RlsFieldSelectTemplate(props) {
|
|
2709
|
-
const select = useFieldSelect(props);
|
|
2710
|
-
const { render, suggestions, children, formControl, msgErrorDisabled, placeholder, rlsTheme, unremovable } = props;
|
|
2711
|
-
const [labels, setLabels] = useState({
|
|
2712
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2713
|
-
listEmptyTitle: reactI18n('listEmptyTitle')
|
|
2714
|
-
});
|
|
2715
|
-
useEffect(() => {
|
|
2716
|
-
return i18nSubscribe(() => {
|
|
2717
|
-
setLabels({
|
|
2718
|
-
listEmptyDescription: reactI18n('listEmptyDescription'),
|
|
2719
|
-
listEmptyTitle: reactI18n('listEmptyTitle')
|
|
2720
|
-
});
|
|
2721
|
-
});
|
|
2722
|
-
}, []);
|
|
2723
|
-
const disabled = useMemo(() => {
|
|
2724
|
-
return formControl?.disabled || props.disabled;
|
|
2725
|
-
}, [formControl?.disabled, props.disabled]);
|
|
2726
|
-
const className = useMemo(() => {
|
|
2727
|
-
return renderClassStatus('rls-field-box', {
|
|
2728
|
-
focused: select.focused && !disabled,
|
|
2729
|
-
error: formControl?.wrong,
|
|
2730
|
-
disabled: disabled,
|
|
2731
|
-
readonly: props.readOnly
|
|
2732
|
-
}, `rls-field-list rls-field-select ${props.className ?? ''}`);
|
|
2733
|
-
}, [
|
|
2734
|
-
formControl?.wrong,
|
|
2735
|
-
select.focused,
|
|
2736
|
-
props.className,
|
|
2737
|
-
props.readOnly,
|
|
2738
|
-
disabled
|
|
2739
|
-
]);
|
|
2740
|
-
const classNameSuggestions = useMemo(() => {
|
|
2741
|
-
return renderClassStatus('rls-field-list__suggestions', {
|
|
2742
|
-
disabled,
|
|
2743
|
-
higher: select.higher,
|
|
2744
|
-
visible: select.modalIsVisible
|
|
2745
|
-
});
|
|
2746
|
-
}, [select.modalIsVisible, select.higher, disabled]);
|
|
2747
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { ref: select.refInput, className: "rls-field-list__control", readOnly: true, placeholder: placeholder, value: select.value, onFocus: select.onFocusInput, onBlur: select.onBlurInput, onClick: select.onClickInput, onKeyDown: select.onKeydownInput, disabled: disabled }), !props.readOnly && (jsxRuntimeExports.jsx("button", { className: 'rls-field-list__action', disabled: disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: !unremovable && !!select.value ? 'close' : 'arrow-ios-down' }) }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameSuggestions, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: select.refList, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: select.onClickElement(element), onKeyDown: select.onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: select.onClickBackdrop })] })] }));
|
|
2748
|
-
}
|
|
2749
|
-
function RlsFieldSelect(props) {
|
|
2750
|
-
const render = useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { className: "rls-field-list__ballot", subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
2751
|
-
return jsxRuntimeExports.jsx(RlsFieldSelectTemplate, { ...props, render: render });
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
|
-
function RlsFormNavigation({ children, className, controller, visible, rlsTheme }) {
|
|
2755
|
-
const classNameForm = useMemo(() => {
|
|
2756
|
-
return renderClassStatus('rls-form-navigation', { visible: controller?.visible ?? visible }, className);
|
|
2757
|
-
}, [className, visible, controller?.visible]);
|
|
2758
|
-
return ReactDOM.createPortal(jsxRuntimeExports.jsx("div", { className: classNameForm, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__component", children: children }) }), document.body);
|
|
2759
|
-
}
|
|
2760
|
-
|
|
2761
|
-
function useRelocationOnComponent({ container, element, onDrag }) {
|
|
2762
|
-
const position = useRef({ x: 0, y: 0 });
|
|
2763
|
-
const dragOffset = useRef({ x: 0, y: 0 });
|
|
2764
|
-
const dragging = useRef(false);
|
|
2765
|
-
const getClientX = useCallback((positionX) => {
|
|
2766
|
-
let clientX = position.current.x + positionX - dragOffset.current.x;
|
|
2767
|
-
if (clientX < 0) {
|
|
2768
|
-
clientX = 0;
|
|
2769
|
-
}
|
|
2770
|
-
else {
|
|
2771
|
-
const width = clientX + element.current.offsetWidth;
|
|
2772
|
-
if (width > container.current.offsetWidth) {
|
|
2773
|
-
clientX = container.current.offsetWidth - element.current.offsetWidth;
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
return clientX;
|
|
2777
|
-
}, []);
|
|
2778
|
-
const getClientY = useCallback((positionY) => {
|
|
2779
|
-
let clientY = position.current.y + positionY - dragOffset.current.y;
|
|
2780
|
-
if (clientY < 0) {
|
|
2781
|
-
clientY = 0;
|
|
2782
|
-
}
|
|
2783
|
-
else {
|
|
2784
|
-
const height = clientY + element.current.offsetHeight;
|
|
2785
|
-
if (height > container.current.offsetHeight) {
|
|
2786
|
-
clientY = container.current.offsetHeight - element.current.offsetHeight;
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
return clientY;
|
|
2790
|
-
}, []);
|
|
2791
|
-
const start = useCallback((positionX, positionY) => {
|
|
2792
|
-
dragOffset.current = {
|
|
2793
|
-
x: positionX,
|
|
2794
|
-
y: positionY
|
|
2795
|
-
};
|
|
2796
|
-
position.current = {
|
|
2797
|
-
x: element.current.offsetLeft,
|
|
2798
|
-
y: element.current.offsetTop
|
|
2799
|
-
};
|
|
2800
|
-
dragging.current = true;
|
|
2801
|
-
}, []);
|
|
2802
|
-
const relocation = useCallback((positionX, positionY) => {
|
|
2803
|
-
const clientX = getClientX(positionX);
|
|
2804
|
-
const clientY = getClientY(positionY);
|
|
2805
|
-
element.current.style.top = `${clientY}px`;
|
|
2806
|
-
element.current.style.left = `${clientX}px`;
|
|
2807
|
-
onDrag && onDrag();
|
|
2808
|
-
}, []);
|
|
2809
|
-
useEffect(() => {
|
|
2810
|
-
const mousedown = (event) => {
|
|
2811
|
-
start(event.clientX, event.clientY);
|
|
2812
|
-
};
|
|
2813
|
-
const mousemove = (event) => {
|
|
2814
|
-
if (dragging.current) {
|
|
2815
|
-
relocation(event.clientX, event.clientY);
|
|
2816
|
-
event.preventDefault();
|
|
2817
|
-
}
|
|
2818
|
-
};
|
|
2819
|
-
const mouseup = () => {
|
|
2820
|
-
dragging.current = false;
|
|
2821
|
-
};
|
|
2822
|
-
const touchstart = (event) => {
|
|
2823
|
-
if (event.touches[0]) {
|
|
2824
|
-
start(event.touches[0].clientX, event.touches[0].clientY);
|
|
2825
|
-
}
|
|
2826
|
-
};
|
|
2827
|
-
const touchmove = (event) => {
|
|
2828
|
-
if (event.touches[0] && dragging.current) {
|
|
2829
|
-
relocation(event.touches[0].clientX, event.touches[0].clientY);
|
|
2830
|
-
event.preventDefault();
|
|
2831
|
-
}
|
|
2832
|
-
};
|
|
2833
|
-
const touchend = () => {
|
|
2834
|
-
dragging.current = false;
|
|
2835
|
-
};
|
|
2836
|
-
element.current.addEventListener('mousedown', mousedown);
|
|
2837
|
-
element.current.addEventListener('mousemove', mousemove);
|
|
2838
|
-
element.current.addEventListener('mouseup', mouseup);
|
|
2839
|
-
element.current.addEventListener('touchstart', touchstart);
|
|
2840
|
-
element.current.addEventListener('touchmove', touchmove);
|
|
2841
|
-
element.current.addEventListener('touchend', touchend);
|
|
2842
|
-
return () => {
|
|
2843
|
-
element.current?.removeEventListener('mousedown', mousedown);
|
|
2844
|
-
element.current?.removeEventListener('mousemove', mousemove);
|
|
2845
|
-
element.current?.removeEventListener('mouseup', mouseup);
|
|
2846
|
-
element.current?.removeEventListener('touchstart', touchstart);
|
|
2847
|
-
element.current?.removeEventListener('touchmove', touchmove);
|
|
2848
|
-
element.current?.removeEventListener('touchend', touchend);
|
|
2849
|
-
};
|
|
2850
|
-
}, []);
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
function useResize(props) {
|
|
2854
|
-
const { refElement, onResize } = props;
|
|
2855
|
-
const dimension = useRef({ height: 0, width: 0 });
|
|
2856
|
-
const observer = useCallback((entries) => {
|
|
2857
|
-
const { height, width } = entries[0].contentRect;
|
|
2858
|
-
onResize &&
|
|
2859
|
-
onResize({
|
|
2860
|
-
current: dimension.current,
|
|
2861
|
-
dimension: {
|
|
2862
|
-
height,
|
|
2863
|
-
width
|
|
2864
|
-
}
|
|
2865
|
-
});
|
|
2866
|
-
dimension.current = { height, width };
|
|
2867
|
-
}, []);
|
|
2868
|
-
useEffect(() => {
|
|
2869
|
-
dimension.current = {
|
|
2870
|
-
height: refElement.current.offsetHeight,
|
|
2871
|
-
width: refElement.current.offsetWidth
|
|
2872
|
-
};
|
|
2873
|
-
const resizeObserver = new ResizeObserver(observer);
|
|
2874
|
-
resizeObserver.observe(refElement.current);
|
|
2875
|
-
return () => {
|
|
2876
|
-
resizeObserver.disconnect();
|
|
2877
|
-
};
|
|
2878
|
-
}, []);
|
|
2879
|
-
}
|
|
2880
|
-
|
|
2881
|
-
const minValueSlider = 50;
|
|
2882
|
-
const maxValueSlider = 100;
|
|
2883
|
-
function getRatioFactor(ratio) {
|
|
2884
|
-
switch (ratio) {
|
|
2885
|
-
case '16:9':
|
|
2886
|
-
return 9 / 16;
|
|
2887
|
-
case '8:5':
|
|
2888
|
-
return 5 / 8;
|
|
2889
|
-
case '4:3':
|
|
2890
|
-
return 3 / 4;
|
|
2891
|
-
case '3:4':
|
|
2892
|
-
return 4 / 3;
|
|
2893
|
-
case '3:2':
|
|
2894
|
-
return 2 / 3;
|
|
2895
|
-
default:
|
|
2896
|
-
return 1;
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
function simpleThreeRule(a1, b1, a2) {
|
|
2900
|
-
return (b1 * a2) / a1;
|
|
2901
|
-
}
|
|
2902
|
-
function calculateImgDimension(image, dimension) {
|
|
2903
|
-
let { height, width } = image;
|
|
2904
|
-
if (height > width) {
|
|
2905
|
-
height = height > dimension ? dimension : height;
|
|
2906
|
-
width = simpleThreeRule(image.height, height, width);
|
|
2907
|
-
return { height, width };
|
|
2908
|
-
}
|
|
2909
|
-
width = width > dimension ? dimension : width;
|
|
2910
|
-
height = simpleThreeRule(image.width, width, height);
|
|
2911
|
-
return { height, width };
|
|
2912
|
-
}
|
|
2913
|
-
function RlsImageEditor(props) {
|
|
2914
|
-
const [selection, setSelection] = useState(props.selection ?? 60);
|
|
2915
|
-
const [labels, setLabels] = useState({
|
|
2916
|
-
actionRestore: reactI18n('editorImageActionRestore'),
|
|
2917
|
-
actionSelect: reactI18n('editorImageActionSelect')
|
|
2918
|
-
});
|
|
2919
|
-
const refBody = useRef(null);
|
|
2920
|
-
const refImage = useRef(null);
|
|
2921
|
-
const refSelection = useRef(null);
|
|
2922
|
-
const refOverlayTop = useRef(null);
|
|
2923
|
-
const refOverlayBottom = useRef(null);
|
|
2924
|
-
const refOverlayLeft = useRef(null);
|
|
2925
|
-
const refOverlayRight = useRef(null);
|
|
2926
|
-
const refCanvas = useRef(null);
|
|
2927
|
-
const refPicture = useRef(null);
|
|
2928
|
-
const image = useRef(new Image());
|
|
2929
|
-
const originalImage = useRef(undefined);
|
|
2930
|
-
const ratio = useMemo(() => {
|
|
2931
|
-
return props.ratio || '1:1';
|
|
2932
|
-
}, [props.ratio]);
|
|
2933
|
-
const getCropProperties = useCallback(() => {
|
|
2934
|
-
return {
|
|
2935
|
-
height: simpleThreeRule(refImage.current.offsetHeight, image.current.height, refSelection.current.offsetHeight),
|
|
2936
|
-
left: simpleThreeRule(refImage.current.offsetWidth, image.current.width, refSelection.current.offsetLeft),
|
|
2937
|
-
top: simpleThreeRule(refImage.current.offsetHeight, image.current.height, refSelection.current.offsetTop),
|
|
2938
|
-
width: simpleThreeRule(refImage.current.offsetWidth, image.current.width, refSelection.current.offsetWidth)
|
|
2939
|
-
};
|
|
2940
|
-
}, []);
|
|
2941
|
-
const refreshOverlaysStyle = useCallback(() => {
|
|
2942
|
-
const width = refSelection.current.offsetWidth;
|
|
2943
|
-
const height = refSelection.current.offsetHeight;
|
|
2944
|
-
const top = refSelection.current.offsetTop;
|
|
2945
|
-
const left = refSelection.current.offsetLeft;
|
|
2946
|
-
refOverlayTop.current.style.width = `${width}px`;
|
|
2947
|
-
refOverlayTop.current.style.bottom = `calc(100% - ${top}px)`;
|
|
2948
|
-
refOverlayTop.current.style.left = `${left}px`;
|
|
2949
|
-
refOverlayRight.current.style.left = `calc(${width + left}px)`;
|
|
2950
|
-
refOverlayRight.current.style.width = `calc(100% - ${width + left}px)`;
|
|
2951
|
-
refOverlayBottom.current.style.width = `${width}px`;
|
|
2952
|
-
refOverlayBottom.current.style.top = `calc(${height + top}px)`;
|
|
2953
|
-
refOverlayBottom.current.style.left = `${left}px`;
|
|
2954
|
-
refOverlayLeft.current.style.right = `calc(100% - ${left}px)`;
|
|
2955
|
-
refOverlayLeft.current.style.width = `calc(${left}px)`;
|
|
2956
|
-
}, []);
|
|
2957
|
-
const refreshSelectionFromWidth = useCallback((rateSelection) => {
|
|
2958
|
-
const ratioFactor = getRatioFactor(ratio);
|
|
2959
|
-
const _ratio = rateSelection * ratioFactor;
|
|
2960
|
-
const offsetWidth = refImage.current?.offsetWidth || 0;
|
|
2961
|
-
const offsetHeight = refImage.current?.offsetHeight || 0;
|
|
2962
|
-
let width = (offsetWidth * rateSelection) / 100;
|
|
2963
|
-
let height = (offsetWidth * _ratio) / 100;
|
|
2964
|
-
if (height > offsetHeight) {
|
|
2965
|
-
height = offsetHeight;
|
|
2966
|
-
width = height / ratioFactor;
|
|
2967
|
-
}
|
|
2968
|
-
return { height, width };
|
|
2969
|
-
}, [ratio]);
|
|
2970
|
-
const refreshSelectionFromHeight = useCallback((rateSelection) => {
|
|
2971
|
-
const ratioFactor = getRatioFactor(ratio);
|
|
2972
|
-
const _ratio = rateSelection / ratioFactor;
|
|
2973
|
-
const offsetWidth = refImage.current?.offsetWidth || 0;
|
|
2974
|
-
const offsetHeight = refImage.current?.offsetHeight || 0;
|
|
2975
|
-
let height = (offsetHeight * rateSelection) / 100;
|
|
2976
|
-
let width = (offsetHeight * _ratio) / 100;
|
|
2977
|
-
if (width > offsetWidth) {
|
|
2978
|
-
width = offsetWidth;
|
|
2979
|
-
height = width * ratioFactor;
|
|
2980
|
-
}
|
|
2981
|
-
return { height, width };
|
|
2982
|
-
}, [ratio]);
|
|
2983
|
-
const refreshSelectionStyle = useCallback((rateSelection) => {
|
|
2984
|
-
if (refSelection.current &&
|
|
2985
|
-
image.current.width > 0 &&
|
|
2986
|
-
image.current.height > 0) {
|
|
2987
|
-
const { height, width } = image.current.width >= image.current.height
|
|
2988
|
-
? refreshSelectionFromHeight(rateSelection)
|
|
2989
|
-
: refreshSelectionFromWidth(rateSelection);
|
|
2990
|
-
refSelection.current.style.width = `${width}px`;
|
|
2991
|
-
refSelection.current.style.height = `${height}px`;
|
|
2992
|
-
if (refSelection.current.offsetLeft + width >
|
|
2993
|
-
refImage.current.offsetWidth) {
|
|
2994
|
-
const left = refImage.current.offsetWidth - width;
|
|
2995
|
-
refSelection.current.style.left = `${left < 0 ? 0 : left}px`;
|
|
2996
|
-
}
|
|
2997
|
-
if (refSelection.current.offsetTop + height >
|
|
2998
|
-
refImage.current.offsetHeight) {
|
|
2999
|
-
const top = refImage.current.offsetHeight - height;
|
|
3000
|
-
refSelection.current.style.top = `${top < 0 ? 0 : top}px`;
|
|
3001
|
-
}
|
|
3002
|
-
refreshOverlaysStyle();
|
|
3003
|
-
}
|
|
3004
|
-
}, [ratio]);
|
|
3005
|
-
const setImageStyle = useCallback((width, height) => {
|
|
3006
|
-
refImage.current.style.width = width;
|
|
3007
|
-
refImage.current.style.height = height;
|
|
3008
|
-
refCanvas.current.style.width = width;
|
|
3009
|
-
refCanvas.current.style.height = height;
|
|
3010
|
-
}, []);
|
|
3011
|
-
const refreshImageStyle = useCallback(() => {
|
|
3012
|
-
if (image.current.width <= 0 || image.current.height <= 0) {
|
|
3013
|
-
return setImageStyle('0px', '0px');
|
|
3014
|
-
}
|
|
3015
|
-
const height = (refBody.current.offsetWidth * image.current.height) /
|
|
3016
|
-
image.current.width;
|
|
3017
|
-
if (height <= refBody.current.offsetHeight) {
|
|
3018
|
-
return setImageStyle('100%', `${height}px`);
|
|
3019
|
-
}
|
|
3020
|
-
const width = (refBody.current.offsetHeight * image.current.width) /
|
|
3021
|
-
image.current.height;
|
|
3022
|
-
return setImageStyle(`${width}px`, '100%');
|
|
3023
|
-
}, [ratio]);
|
|
3024
|
-
useEffect(() => {
|
|
3025
|
-
image.current.onload = () => {
|
|
3026
|
-
const context = refCanvas.current.getContext('2d', {
|
|
3027
|
-
willReadFrequently: true
|
|
3028
|
-
});
|
|
3029
|
-
const width = image.current.width;
|
|
3030
|
-
const height = image.current.height;
|
|
3031
|
-
refCanvas.current.width = width;
|
|
3032
|
-
refCanvas.current.height = height;
|
|
3033
|
-
context?.drawImage(image.current, 0, 0, width, height);
|
|
3034
|
-
originalImage.current = context?.getImageData(0, 0, width, height);
|
|
3035
|
-
refreshImageStyle();
|
|
3036
|
-
refreshSelectionStyle(selection);
|
|
3037
|
-
};
|
|
3038
|
-
const unsubscription = i18nSubscribe(() => {
|
|
3039
|
-
setLabels({
|
|
3040
|
-
actionRestore: reactI18n('editorImageActionRestore'),
|
|
3041
|
-
actionSelect: reactI18n('editorImageActionSelect')
|
|
3042
|
-
});
|
|
3043
|
-
});
|
|
3044
|
-
window.addEventListener('resize', refreshImageStyle);
|
|
3045
|
-
return () => {
|
|
3046
|
-
window.removeEventListener('resize', refreshImageStyle);
|
|
3047
|
-
unsubscription();
|
|
3048
|
-
};
|
|
3049
|
-
}, []);
|
|
3050
|
-
useEffect(() => {
|
|
3051
|
-
image.current.src = props.src || '';
|
|
3052
|
-
}, [props.src]);
|
|
3053
|
-
useEffect(() => {
|
|
3054
|
-
refreshSelectionStyle(selection);
|
|
3055
|
-
}, [ratio, selection]);
|
|
3056
|
-
const onResizeElement = useCallback(() => {
|
|
3057
|
-
refreshSelectionStyle(selection);
|
|
3058
|
-
}, [selection]);
|
|
3059
|
-
useRelocationOnComponent({
|
|
3060
|
-
container: refImage,
|
|
3061
|
-
element: refSelection,
|
|
3062
|
-
onDrag: refreshOverlaysStyle
|
|
3063
|
-
});
|
|
3064
|
-
useResize({ refElement: refImage, onResize: onResizeElement });
|
|
3065
|
-
const onCropImage = useCallback(() => {
|
|
3066
|
-
const cropProps = getCropProperties();
|
|
3067
|
-
const width = props.maxWidth || cropProps.width;
|
|
3068
|
-
const height = width * getRatioFactor(ratio);
|
|
3069
|
-
refPicture.current.width = width;
|
|
3070
|
-
refPicture.current.height = height;
|
|
3071
|
-
const context = refPicture.current.getContext('2d');
|
|
3072
|
-
context?.drawImage(refCanvas.current, cropProps.left, cropProps.top, cropProps.width, cropProps.height, 0, 0, width, height);
|
|
3073
|
-
refPicture.current.toBlob((blob) => {
|
|
3074
|
-
if (blob) {
|
|
3075
|
-
const reader = new FileReader();
|
|
3076
|
-
reader.readAsDataURL(blob);
|
|
3077
|
-
reader.onloadend = function () {
|
|
3078
|
-
const value = {
|
|
3079
|
-
base64: reader.result,
|
|
3080
|
-
blob
|
|
3081
|
-
};
|
|
3082
|
-
props.onValue && props.onValue(value);
|
|
3083
|
-
props.formControl?.setValue(value);
|
|
3084
|
-
};
|
|
3085
|
-
}
|
|
3086
|
-
}, props.mimeType || 'image/jpeg', props.quality || 1);
|
|
3087
|
-
}, [
|
|
3088
|
-
ratio,
|
|
3089
|
-
props.mimeType,
|
|
3090
|
-
props.onValue,
|
|
3091
|
-
props.formControl,
|
|
3092
|
-
props.maxWidth,
|
|
3093
|
-
props.quality
|
|
3094
|
-
]);
|
|
3095
|
-
const onRestore = useCallback(() => {
|
|
3096
|
-
const context = refCanvas.current.getContext('2d');
|
|
3097
|
-
if (originalImage.current) {
|
|
3098
|
-
context?.putImageData(originalImage.current, 0, 0);
|
|
3099
|
-
}
|
|
3100
|
-
}, []);
|
|
3101
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-editor", children: [jsxRuntimeExports.jsx("div", { ref: refBody, className: "rls-image-editor__body", children: jsxRuntimeExports.jsxs("div", { ref: refImage, className: "rls-image-editor__body__image", children: [jsxRuntimeExports.jsx("div", { ref: refSelection, className: "rls-image-editor__body__selection" }), jsxRuntimeExports.jsx("div", { ref: refOverlayTop, className: "rls-image-editor__body__overlay--top" }), jsxRuntimeExports.jsx("div", { ref: refOverlayRight, className: "rls-image-editor__body__overlay--right" }), jsxRuntimeExports.jsx("div", { ref: refOverlayBottom, className: "rls-image-editor__body__overlay--bottom" }), jsxRuntimeExports.jsx("div", { ref: refOverlayLeft, className: "rls-image-editor__body__overlay--left" }), jsxRuntimeExports.jsx("canvas", { ref: refCanvas })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-image-editor__footer", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-editor__sliders", children: jsxRuntimeExports.jsx(RlsSlider, { prefixIcon: "external-link", value: selection, minValue: minValueSlider, maxValue: maxValueSlider, onValue: setSelection, disabled: props.disabled }) }), jsxRuntimeExports.jsxs("div", { className: "rls-image-editor__actions", children: [props.children, jsxRuntimeExports.jsx(RlsButton, { type: "classic", prefixIcon: "refresh", onClick: onRestore, disabled: props.disabled, children: labels.actionRestore }), jsxRuntimeExports.jsx(RlsButton, { type: "raised", prefixIcon: "crop", onClick: onCropImage, disabled: props.disabled, children: labels.actionSelect })] })] }), jsxRuntimeExports.jsx("canvas", { ref: refPicture })] }));
|
|
3102
|
-
}
|
|
3103
|
-
|
|
3104
|
-
function RlsImageEditorModal(props) {
|
|
3105
|
-
return (jsxRuntimeExports.jsx(RlsModal, { className: "rls-image-editor-modal", visible: props.visible, children: jsxRuntimeExports.jsx(RlsImageEditor, { ...props, children: props.children }) }));
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
|
-
const MIME_TYPE_SUPPORTS = [
|
|
3109
|
-
'image/png',
|
|
3110
|
-
'image/jpg',
|
|
3111
|
-
'image/jpeg',
|
|
3112
|
-
'image/bmp',
|
|
3113
|
-
'image/webp',
|
|
3114
|
-
'image/gif',
|
|
3115
|
-
'image/svg+xml'
|
|
3116
|
-
];
|
|
3117
|
-
|
|
3118
|
-
function useImageEditorController(options) {
|
|
3119
|
-
const refInput = useRef(null);
|
|
3120
|
-
const [srcEditor, setSrcEditor] = useState();
|
|
3121
|
-
const [labels, setLabels] = useState({
|
|
3122
|
-
actionCancel: reactI18n('chooserImageActionCancel')
|
|
3123
|
-
});
|
|
3124
|
-
const processImage = useCallback((file) => {
|
|
3125
|
-
const reader = new FileReader();
|
|
3126
|
-
reader.onload = function () {
|
|
3127
|
-
setSrcEditor(reader.result);
|
|
3128
|
-
refInput.current.value = '';
|
|
3129
|
-
};
|
|
3130
|
-
reader.readAsDataURL(file);
|
|
3131
|
-
}, []);
|
|
3132
|
-
useEffect(() => {
|
|
3133
|
-
refInput.current = document.createElement('input');
|
|
3134
|
-
refInput.current.type = 'file';
|
|
3135
|
-
refInput.current.onchange = () => {
|
|
3136
|
-
if (refInput.current.files &&
|
|
3137
|
-
MIME_TYPE_SUPPORTS.includes(refInput.current.files[0].type)) {
|
|
3138
|
-
processImage(refInput.current.files[0]);
|
|
3139
|
-
}
|
|
3140
|
-
};
|
|
3141
|
-
return i18nSubscribe(() => {
|
|
3142
|
-
setLabels({
|
|
3143
|
-
actionCancel: reactI18n('chooserImageActionCancel')
|
|
3144
|
-
});
|
|
3145
|
-
});
|
|
3146
|
-
}, []);
|
|
3147
|
-
const onEditorValue = useCallback((image) => {
|
|
3148
|
-
setSrcEditor(undefined);
|
|
3149
|
-
options.onValue && options.onValue(image);
|
|
3150
|
-
}, [options.onValue]);
|
|
3151
|
-
const onCancel = useCallback(() => {
|
|
3152
|
-
setSrcEditor(undefined);
|
|
3153
|
-
}, []);
|
|
3154
|
-
const RlsImageEditorChooser = useMemo(() => {
|
|
3155
|
-
return (srcEditor && (jsxRuntimeExports.jsx(RlsImageEditorModal, { visible: true, src: srcEditor, formControl: options.formControl, maxWidth: options.maxWidth, quality: options.quality, ratio: options.ratio, selection: options.selection, onValue: onEditorValue, children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", rlsTheme: "danger", onClick: onCancel, disabled: options.disabled, children: labels.actionCancel }) })));
|
|
3156
|
-
}, [
|
|
3157
|
-
srcEditor,
|
|
3158
|
-
labels,
|
|
3159
|
-
options.formControl,
|
|
3160
|
-
options.maxWidth,
|
|
3161
|
-
options.quality,
|
|
3162
|
-
options.ratio,
|
|
3163
|
-
options.disabled,
|
|
3164
|
-
onEditorValue,
|
|
3165
|
-
onCancel
|
|
3166
|
-
]);
|
|
3167
|
-
const onImageChooser = useCallback(() => {
|
|
3168
|
-
!options.disabled && refInput.current.click();
|
|
3169
|
-
}, [options.disabled]);
|
|
3170
|
-
return { onImageChooser, RlsImageEditorChooser };
|
|
3171
|
-
}
|
|
3172
|
-
|
|
3173
|
-
function RlsImageChooser(props) {
|
|
3174
|
-
const [src, setSrc] = useState();
|
|
3175
|
-
const onValue = useCallback((image) => {
|
|
3176
|
-
setSrc(image.base64);
|
|
3177
|
-
props.onValue && props.onValue(image);
|
|
3178
|
-
}, [props.onValue]);
|
|
3179
|
-
const controller = useImageEditorController({ ...props, onValue });
|
|
3180
|
-
useEffect(() => {
|
|
3181
|
-
props.src && setSrc(props.src);
|
|
3182
|
-
}, [props.src]);
|
|
3183
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-chooser", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-chooser__avatar", onClick: controller.onImageChooser, children: src && jsxRuntimeExports.jsx("img", { src: src }) }), controller.RlsImageEditorChooser] }));
|
|
3184
|
-
}
|
|
3185
|
-
|
|
3186
|
-
function RlsModalSheet({ children, className, onAutoClose, visible, rlsTheme }) {
|
|
3187
|
-
const classNameModal = useMemo(() => {
|
|
3188
|
-
return renderClassStatus('rls-modal-sheet', { visible }, className);
|
|
3189
|
-
}, [className, visible]);
|
|
3190
|
-
const onClickBackdrop = useCallback(() => {
|
|
3191
|
-
onAutoClose && onAutoClose();
|
|
3192
|
-
}, [onAutoClose]);
|
|
3193
|
-
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: classNameModal, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal-sheet__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal-sheet__backdrop", onClick: onClickBackdrop })] }), document.body);
|
|
3194
|
-
}
|
|
3195
|
-
|
|
3196
|
-
const DURATION_ANIMATION = 240;
|
|
3197
|
-
const DURATION_CHAR = 75;
|
|
3198
|
-
const DURATION_MAX = 9000;
|
|
3199
|
-
const DURATION_MIN = 3000;
|
|
3200
|
-
const DURATION_RESET = 480;
|
|
3201
|
-
function calculateDuration({ length }) {
|
|
3202
|
-
let duration = length * DURATION_CHAR;
|
|
3203
|
-
if (duration < DURATION_MIN) {
|
|
3204
|
-
duration = DURATION_MIN;
|
|
3205
|
-
}
|
|
3206
|
-
else if (duration > DURATION_MAX) {
|
|
3207
|
-
duration = DURATION_MAX;
|
|
3208
|
-
}
|
|
3209
|
-
return duration + DURATION_RESET;
|
|
3210
|
-
}
|
|
3211
|
-
function RlsSnackbar({ content, onClose, icon, rlsTheme, title, visible }) {
|
|
3212
|
-
const className = useMemo(() => {
|
|
3213
|
-
return renderClassStatus('rls-snackbar', { visible });
|
|
3214
|
-
}, [visible]);
|
|
3215
|
-
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [icon && (jsxRuntimeExports.jsx("div", { className: "rls-snackbar__avatar", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) })), jsxRuntimeExports.jsxs("div", { className: "rls-snackbar__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-snackbar__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-snackbar__title", children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, children: jsxRuntimeExports.jsx(RlsIcon, { value: "close" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-snackbar__content", children: content })] })] }));
|
|
3216
|
-
}
|
|
3217
|
-
function useSnackbar() {
|
|
3218
|
-
const timeoutId = useRef(undefined);
|
|
3219
|
-
const duration = useRef(4000);
|
|
3220
|
-
const [state, setState] = useState({
|
|
3221
|
-
config: {},
|
|
3222
|
-
visible: false
|
|
3223
|
-
});
|
|
3224
|
-
const onClose = useCallback(() => {
|
|
3225
|
-
timeoutId.current && clearTimeout(timeoutId.current);
|
|
3226
|
-
timeoutId.current = undefined;
|
|
3227
|
-
setState((state) => ({ ...state, visible: false }));
|
|
3228
|
-
}, []);
|
|
3229
|
-
const rlsSnackbar = (jsxRuntimeExports.jsx(RlsSnackbar, { ...state.config, visible: state.visible, onClose: onClose }));
|
|
3230
|
-
useEffect(() => {
|
|
3231
|
-
if (state.visible) {
|
|
3232
|
-
timeoutId.current = setTimeout(() => {
|
|
3233
|
-
timeoutId.current = undefined;
|
|
3234
|
-
setState((state) => ({ ...state, visible: false }));
|
|
3235
|
-
}, duration.current);
|
|
3236
|
-
}
|
|
3237
|
-
else if (timeoutId.current) {
|
|
3238
|
-
clearTimeout(timeoutId.current);
|
|
3239
|
-
timeoutId.current = undefined;
|
|
3240
|
-
setTimeout(() => {
|
|
3241
|
-
snackbar(state.config);
|
|
3242
|
-
}, DURATION_ANIMATION);
|
|
3243
|
-
}
|
|
3244
|
-
}, [state.visible]);
|
|
3245
|
-
const snackbar = useCallback((config) => {
|
|
3246
|
-
duration.current = calculateDuration(String(config.content));
|
|
3247
|
-
setState((state) => ({
|
|
3248
|
-
...state,
|
|
3249
|
-
config,
|
|
3250
|
-
visible: !state.visible
|
|
3251
|
-
}));
|
|
3252
|
-
}, []);
|
|
3253
|
-
return {
|
|
3254
|
-
RlsSnackbar: rlsSnackbar,
|
|
3255
|
-
snackbar
|
|
3256
|
-
};
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
const RlsContext = createContext({
|
|
3260
|
-
confirmation: () => {
|
|
3261
|
-
return Promise.resolve(ConfirmationResult.approved());
|
|
3262
|
-
},
|
|
3263
|
-
snackbar: () => { },
|
|
3264
|
-
setIsMobile: () => { },
|
|
3265
|
-
setNavbarInApp: () => { },
|
|
3266
|
-
setNavbarIsCondense: () => { }
|
|
3267
|
-
});
|
|
3268
|
-
function RlsApplication({ children }) {
|
|
3269
|
-
const { RlsConfirmation, confirmation } = useConfirmation();
|
|
3270
|
-
const { RlsSnackbar, snackbar } = useSnackbar();
|
|
3271
|
-
const [navbarInApp, setNavbarInApp] = useState(false);
|
|
3272
|
-
const [navbarIsCondense, setNavbarIsCondense] = useState(false);
|
|
3273
|
-
const [appIsMobile, setIsMobile] = useState(false);
|
|
3274
|
-
const className = useMemo(() => {
|
|
3275
|
-
return renderClassStatus('rls-app__body', {
|
|
3276
|
-
mobile: appIsMobile,
|
|
3277
|
-
'navbar-snackbar': navbarInApp,
|
|
3278
|
-
'navbar-condense': navbarIsCondense
|
|
3279
|
-
});
|
|
3280
|
-
}, [appIsMobile, navbarInApp, navbarIsCondense]);
|
|
3281
|
-
return (jsxRuntimeExports.jsxs(RlsContext, { value: {
|
|
3282
|
-
confirmation,
|
|
3283
|
-
snackbar,
|
|
3284
|
-
setIsMobile,
|
|
3285
|
-
setNavbarInApp,
|
|
3286
|
-
setNavbarIsCondense
|
|
3287
|
-
}, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
|
|
3288
|
-
}
|
|
3289
|
-
|
|
3290
|
-
function useDropdownController() {
|
|
3291
|
-
const [visible, setVisible] = useState(false);
|
|
3292
|
-
const component = useRef(null);
|
|
3293
|
-
const open = useCallback((positionX, positionY) => {
|
|
3294
|
-
component.current.style.transformOrigin = '0% 0%';
|
|
3295
|
-
component.current.style.top = `${positionY}px`;
|
|
3296
|
-
component.current.style.left = `${positionX}px`;
|
|
3297
|
-
setVisible(true);
|
|
3298
|
-
}, []);
|
|
3299
|
-
const openWithEvent = useCallback((event) => {
|
|
3300
|
-
const rectContent = component.current.getBoundingClientRect();
|
|
3301
|
-
const rectElement = event.target.getBoundingClientRect();
|
|
3302
|
-
let positionX = 0;
|
|
3303
|
-
let positionY = 0;
|
|
3304
|
-
let effect = '0% 0%';
|
|
3305
|
-
let transform = 0;
|
|
3306
|
-
const elementX = rectElement.x + rectElement.width / 2;
|
|
3307
|
-
const elementY = rectElement.y + rectElement.height / 2;
|
|
3308
|
-
if (elementX + rectContent.width <= window.innerWidth) {
|
|
3309
|
-
positionX = elementX;
|
|
3310
|
-
transform += 1;
|
|
3311
|
-
}
|
|
3312
|
-
else if (elementX + rectElement.width - rectContent.width > 0) {
|
|
3313
|
-
positionX = elementX + rectElement.width - rectContent.width;
|
|
3314
|
-
transform += 3;
|
|
3315
|
-
}
|
|
3316
|
-
else {
|
|
3317
|
-
positionX = window.innerWidth - rectContent.width;
|
|
3318
|
-
transform += 1;
|
|
3319
|
-
}
|
|
3320
|
-
if (elementY + rectContent.height <= window.innerHeight) {
|
|
3321
|
-
positionY = elementY;
|
|
3322
|
-
transform += 4;
|
|
3323
|
-
}
|
|
3324
|
-
else if (elementY + rectElement.height - rectContent.height > 0) {
|
|
3325
|
-
positionY = elementY + rectElement.height - rectContent.height;
|
|
3326
|
-
transform += 7;
|
|
3327
|
-
}
|
|
3328
|
-
else {
|
|
3329
|
-
positionY = window.innerHeight - rectContent.height;
|
|
3330
|
-
transform += 4;
|
|
3331
|
-
}
|
|
3332
|
-
switch (transform) {
|
|
3333
|
-
case 7:
|
|
3334
|
-
effect = '100% 0%';
|
|
3335
|
-
break;
|
|
3336
|
-
case 8:
|
|
3337
|
-
effect = '0% 100%';
|
|
3338
|
-
break;
|
|
3339
|
-
case 10:
|
|
3340
|
-
effect = '100% 100%';
|
|
3341
|
-
break;
|
|
3342
|
-
default:
|
|
3343
|
-
effect = '0% 0%';
|
|
3344
|
-
break;
|
|
3345
|
-
}
|
|
3346
|
-
component.current.style.transformOrigin = effect;
|
|
3347
|
-
component.current.style.top = `${positionY}px`;
|
|
3348
|
-
component.current.style.left = `${positionX}px`;
|
|
3349
|
-
setVisible(true);
|
|
3350
|
-
event.stopPropagation();
|
|
3351
|
-
}, []);
|
|
3352
|
-
const close = useCallback(() => {
|
|
3353
|
-
setVisible(false);
|
|
3354
|
-
}, []);
|
|
3355
|
-
return {
|
|
3356
|
-
close,
|
|
3357
|
-
component,
|
|
3358
|
-
open,
|
|
3359
|
-
openWithEvent,
|
|
3360
|
-
visible
|
|
3361
|
-
};
|
|
3362
|
-
}
|
|
3363
|
-
|
|
3364
|
-
function usePortalController() {
|
|
3365
|
-
const [visible, setVisible] = useState(false);
|
|
3366
|
-
const open = useCallback(() => {
|
|
3367
|
-
setVisible(true);
|
|
3368
|
-
}, []);
|
|
3369
|
-
const close = useCallback(() => {
|
|
3370
|
-
setVisible(false);
|
|
3371
|
-
}, []);
|
|
3372
|
-
return { close, open, visible };
|
|
3373
|
-
}
|
|
3374
|
-
|
|
3375
|
-
export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBottomSheet, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonOption, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContent, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsDropdown, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldClock, RlsFieldDate, RlsFieldDateRange, RlsFieldDecimal, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldPercentage, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputDecimal, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputPercentage, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsModalSheet, RlsNavbar, RlsPagination, RlsPickerClock, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSpinner, RlsSwitch, RlsSwitchControl, RlsTabs, RlsTabularText, RlsToolbar, calculateImgDimension, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useDropdownController, useFieldAutocomplete, useFieldSelect, useFormSingleSelectionController, useFormToggleController, useImageEditorController, useListController, usePortalController, useRelocationOnComponent, useResize, useSnackbar };
|
|
3376
|
-
//# sourceMappingURL=index.js.map
|