@lumx/react 3.0.2-alpha-react-utils.2 → 3.0.2-alpha-react-utils.3
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/_internal/{6340c129.js → ClickAwayProvider.js} +107 -2
- package/_internal/ClickAwayProvider.js.map +1 -0
- package/_internal/{eca6d4dc.d.ts → types.d.ts} +1 -1
- package/index.d.ts +2627 -56
- package/index.js +12438 -56
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
- package/_internal/0062d1bc.js +0 -220
- package/_internal/0062d1bc.js.map +0 -1
- package/_internal/03e8323d.d.ts +0 -118
- package/_internal/0402f9bc.d.ts +0 -183
- package/_internal/0b370acc.js +0 -796
- package/_internal/0b370acc.js.map +0 -1
- package/_internal/0d154d73.d.ts +0 -67
- package/_internal/113e3b40.d.ts +0 -31
- package/_internal/12ab39e4.js +0 -58
- package/_internal/12ab39e4.js.map +0 -1
- package/_internal/13e759f3.js +0 -343
- package/_internal/13e759f3.js.map +0 -1
- package/_internal/158b46d5.js +0 -151
- package/_internal/158b46d5.js.map +0 -1
- package/_internal/17b74e16.d.ts +0 -31
- package/_internal/1b1530a4.d.ts +0 -43
- package/_internal/20976405.js +0 -87
- package/_internal/20976405.js.map +0 -1
- package/_internal/20b0e9a5.d.ts +0 -77
- package/_internal/26cd9c63.js +0 -118
- package/_internal/26cd9c63.js.map +0 -1
- package/_internal/27f21164.js +0 -79
- package/_internal/27f21164.js.map +0 -1
- package/_internal/288dfd0f.js +0 -13
- package/_internal/288dfd0f.js.map +0 -1
- package/_internal/28aaf23a.d.ts +0 -41
- package/_internal/2c829c0b.d.ts +0 -57
- package/_internal/2cc0aec5.js +0 -86
- package/_internal/2cc0aec5.js.map +0 -1
- package/_internal/2d0a5b28.js +0 -23
- package/_internal/2d0a5b28.js.map +0 -1
- package/_internal/2d4b5a5e.d.ts +0 -92
- package/_internal/2d770113.d.ts +0 -38
- package/_internal/2fe97f00.js +0 -291
- package/_internal/2fe97f00.js.map +0 -1
- package/_internal/31c16fa0.d.ts +0 -37
- package/_internal/329a01d3.js +0 -25
- package/_internal/329a01d3.js.map +0 -1
- package/_internal/3326e990.js +0 -168
- package/_internal/3326e990.js.map +0 -1
- package/_internal/377b2f44.js +0 -70
- package/_internal/377b2f44.js.map +0 -1
- package/_internal/3b8d2a6e.js +0 -124
- package/_internal/3b8d2a6e.js.map +0 -1
- package/_internal/3bd3186e.d.ts +0 -57
- package/_internal/48e40868.js +0 -101
- package/_internal/48e40868.js.map +0 -1
- package/_internal/490ec1da.js +0 -322
- package/_internal/490ec1da.js.map +0 -1
- package/_internal/49127d69.d.ts +0 -52
- package/_internal/4dcd87cb.js +0 -78
- package/_internal/4dcd87cb.js.map +0 -1
- package/_internal/4f44d848.js +0 -157
- package/_internal/4f44d848.js.map +0 -1
- package/_internal/4fc64a2e.js +0 -27
- package/_internal/4fc64a2e.js.map +0 -1
- package/_internal/53a831be.js +0 -108
- package/_internal/53a831be.js.map +0 -1
- package/_internal/55271fa1.d.ts +0 -34
- package/_internal/55d30377.d.ts +0 -22
- package/_internal/56385b04.js +0 -116
- package/_internal/56385b04.js.map +0 -1
- package/_internal/599e250a.d.ts +0 -88
- package/_internal/5a054691.d.ts +0 -33
- package/_internal/5a127b58.js +0 -82
- package/_internal/5a127b58.js.map +0 -1
- package/_internal/5a1c0db4.js +0 -156
- package/_internal/5a1c0db4.js.map +0 -1
- package/_internal/5babcc39.js +0 -147
- package/_internal/5babcc39.js.map +0 -1
- package/_internal/5c1bf4d4.d.ts +0 -81
- package/_internal/5d8ed4ee.js +0 -113
- package/_internal/5d8ed4ee.js.map +0 -1
- package/_internal/616f2912.js +0 -301
- package/_internal/616f2912.js.map +0 -1
- package/_internal/61f915de.d.ts +0 -49
- package/_internal/620081fa.js +0 -122
- package/_internal/620081fa.js.map +0 -1
- package/_internal/6340c129.js.map +0 -1
- package/_internal/6581c863.d.ts +0 -34
- package/_internal/66de4d45.d.ts +0 -32
- package/_internal/6735c5c8.d.ts +0 -62
- package/_internal/69dd1472.js +0 -112
- package/_internal/69dd1472.js.map +0 -1
- package/_internal/6a0e1c77.js +0 -327
- package/_internal/6a0e1c77.js.map +0 -1
- package/_internal/701c20b0.d.ts +0 -24
- package/_internal/7391188a.js +0 -81
- package/_internal/7391188a.js.map +0 -1
- package/_internal/74cb6c26.js +0 -136
- package/_internal/74cb6c26.js.map +0 -1
- package/_internal/761031bf.js +0 -314
- package/_internal/761031bf.js.map +0 -1
- package/_internal/76fed69d.js +0 -50
- package/_internal/76fed69d.js.map +0 -1
- package/_internal/78ef8e34.js +0 -40
- package/_internal/78ef8e34.js.map +0 -1
- package/_internal/7b906e16.d.ts +0 -17
- package/_internal/7be11ddc.d.ts +0 -35
- package/_internal/7d39705e.d.ts +0 -20
- package/_internal/7e03266f.js +0 -47
- package/_internal/7e03266f.js.map +0 -1
- package/_internal/7e8d0ac5.js +0 -84
- package/_internal/7e8d0ac5.js.map +0 -1
- package/_internal/7ffa45f6.js +0 -48
- package/_internal/7ffa45f6.js.map +0 -1
- package/_internal/84c1ec44.js +0 -257
- package/_internal/84c1ec44.js.map +0 -1
- package/_internal/8518279f.js +0 -96
- package/_internal/8518279f.js.map +0 -1
- package/_internal/853713cd.js +0 -25
- package/_internal/853713cd.js.map +0 -1
- package/_internal/86566d75.d.ts +0 -27
- package/_internal/86d22dde.d.ts +0 -57
- package/_internal/8e755ded.d.ts +0 -101
- package/_internal/901471f5.d.ts +0 -37
- package/_internal/935ce959.d.ts +0 -49
- package/_internal/97089888.d.ts +0 -16
- package/_internal/97cc728c.d.ts +0 -26
- package/_internal/9ab3c637.js +0 -2474
- package/_internal/9ab3c637.js.map +0 -1
- package/_internal/9ca3f59c.js +0 -60
- package/_internal/9ca3f59c.js.map +0 -1
- package/_internal/9e95ea38.d.ts +0 -43
- package/_internal/a0108f92.js +0 -84
- package/_internal/a0108f92.js.map +0 -1
- package/_internal/a493a193.d.ts +0 -65
- package/_internal/a521723d.js +0 -120
- package/_internal/a521723d.js.map +0 -1
- package/_internal/a6fad025.d.ts +0 -107
- package/_internal/a8fa525f.js +0 -124
- package/_internal/a8fa525f.js.map +0 -1
- package/_internal/aca2ecf5.js +0 -141
- package/_internal/aca2ecf5.js.map +0 -1
- package/_internal/aef2ef1c.js +0 -53
- package/_internal/aef2ef1c.js.map +0 -1
- package/_internal/af048b0c.js +0 -89
- package/_internal/af048b0c.js.map +0 -1
- package/_internal/af2cd0cd.d.ts +0 -17
- package/_internal/afec6b62.js +0 -864
- package/_internal/afec6b62.js.map +0 -1
- package/_internal/b0eb3a30.js +0 -72
- package/_internal/b0eb3a30.js.map +0 -1
- package/_internal/b89517ea.js +0 -275
- package/_internal/b89517ea.js.map +0 -1
- package/_internal/bafa6fcc.js +0 -116
- package/_internal/bafa6fcc.js.map +0 -1
- package/_internal/bbbeb49e.js +0 -47
- package/_internal/bbbeb49e.js.map +0 -1
- package/_internal/c11f6162.d.ts +0 -52
- package/_internal/c723dab4.js +0 -133
- package/_internal/c723dab4.js.map +0 -1
- package/_internal/c87cc857.d.ts +0 -42
- package/_internal/c97f8d04.js +0 -424
- package/_internal/c97f8d04.js.map +0 -1
- package/_internal/cbb373ea.d.ts +0 -6
- package/_internal/cbef23b6.d.ts +0 -104
- package/_internal/cdf77f06.d.ts +0 -88
- package/_internal/d350f2ff.js +0 -105
- package/_internal/d350f2ff.js.map +0 -1
- package/_internal/d71a8cf7.js +0 -54
- package/_internal/d71a8cf7.js.map +0 -1
- package/_internal/d9337952.js +0 -96
- package/_internal/d9337952.js.map +0 -1
- package/_internal/def14e1a.d.ts +0 -24
- package/_internal/e0cd29c7.d.ts +0 -35
- package/_internal/e354228f.js +0 -145
- package/_internal/e354228f.js.map +0 -1
- package/_internal/e3922a05.d.ts +0 -22
- package/_internal/e3cb6177.d.ts +0 -75
- package/_internal/e810c841.d.ts +0 -182
- package/_internal/ea700b01.d.ts +0 -43
- package/_internal/eed07003.js +0 -122
- package/_internal/eed07003.js.map +0 -1
- package/_internal/f1c9b334.d.ts +0 -22
- package/_internal/f3c3a674.js +0 -281
- package/_internal/f3c3a674.js.map +0 -1
- package/_internal/f571cdcd.js +0 -132
- package/_internal/f571cdcd.js.map +0 -1
- package/_internal/f5bdff7e.js +0 -282
- package/_internal/f5bdff7e.js.map +0 -1
- package/_internal/f851fc00.d.ts +0 -34
- package/_internal/f859b007.d.ts +0 -49
- package/_internal/fb384b79.d.ts +0 -38
- package/_internal/fc4c034b.js +0 -63
- package/_internal/fc4c034b.js.map +0 -1
- package/_internal/fc608bd9.js +0 -16
- package/_internal/fc608bd9.js.map +0 -1
- package/_internal/fd1f4d68.d.ts +0 -36
- package/_internal/fd867c9d.js +0 -346
- package/_internal/fd867c9d.js.map +0 -1
- package/_internal/ff8081e5.js +0 -57
- package/_internal/ff8081e5.js.map +0 -1
- package/_internal/ffd1bfe3.js +0 -123
- package/_internal/ffd1bfe3.js.map +0 -1
- package/components/alert-dialog.d.ts +0 -6
- package/components/alert-dialog.js +0 -2
- package/components/alert-dialog.js.map +0 -1
- package/components/autocomplete.d.ts +0 -8
- package/components/autocomplete.js +0 -2
- package/components/autocomplete.js.map +0 -1
- package/components/avatar.d.ts +0 -4
- package/components/avatar.js +0 -2
- package/components/avatar.js.map +0 -1
- package/components/badge.d.ts +0 -3
- package/components/badge.js +0 -2
- package/components/badge.js.map +0 -1
- package/components/button.d.ts +0 -8
- package/components/button.js +0 -4
- package/components/button.js.map +0 -1
- package/components/checkbox.d.ts +0 -3
- package/components/checkbox.js +0 -2
- package/components/checkbox.js.map +0 -1
- package/components/chip.d.ts +0 -3
- package/components/chip.js +0 -3
- package/components/chip.js.map +0 -1
- package/components/comment-block.d.ts +0 -5
- package/components/comment-block.js +0 -2
- package/components/comment-block.js.map +0 -1
- package/components/date-picker.d.ts +0 -7
- package/components/date-picker.js +0 -2
- package/components/date-picker.js.map +0 -1
- package/components/dialog.d.ts +0 -3
- package/components/dialog.js +0 -2
- package/components/dialog.js.map +0 -1
- package/components/divider.d.ts +0 -3
- package/components/divider.js +0 -2
- package/components/divider.js.map +0 -1
- package/components/drag-handle.d.ts +0 -3
- package/components/drag-handle.js +0 -2
- package/components/drag-handle.js.map +0 -1
- package/components/dropdown.d.ts +0 -4
- package/components/dropdown.js +0 -2
- package/components/dropdown.js.map +0 -1
- package/components/expansion-panel.d.ts +0 -7
- package/components/expansion-panel.js +0 -2
- package/components/expansion-panel.js.map +0 -1
- package/components/flag.d.ts +0 -3
- package/components/flag.js +0 -2
- package/components/flag.js.map +0 -1
- package/components/flex-box.d.ts +0 -3
- package/components/flex-box.js +0 -2
- package/components/flex-box.js.map +0 -1
- package/components/generic-block.d.ts +0 -4
- package/components/generic-block.js +0 -2
- package/components/generic-block.js.map +0 -1
- package/components/grid.d.ts +0 -3
- package/components/grid.js +0 -2
- package/components/grid.js.map +0 -1
- package/components/heading.d.ts +0 -4
- package/components/heading.js +0 -2
- package/components/heading.js.map +0 -1
- package/components/icon.d.ts +0 -3
- package/components/icon.js +0 -2
- package/components/icon.js.map +0 -1
- package/components/image-block.d.ts +0 -4
- package/components/image-block.js +0 -2
- package/components/image-block.js.map +0 -1
- package/components/input-helper.d.ts +0 -3
- package/components/input-helper.js +0 -2
- package/components/input-helper.js.map +0 -1
- package/components/input-label.d.ts +0 -3
- package/components/input-label.js +0 -2
- package/components/input-label.js.map +0 -1
- package/components/lightbox.d.ts +0 -7
- package/components/lightbox.js +0 -2
- package/components/lightbox.js.map +0 -1
- package/components/link-preview.d.ts +0 -5
- package/components/link-preview.js +0 -2
- package/components/link-preview.js.map +0 -1
- package/components/link.d.ts +0 -3
- package/components/link.js +0 -2
- package/components/link.js.map +0 -1
- package/components/list.d.ts +0 -3
- package/components/list.js +0 -3
- package/components/list.js.map +0 -1
- package/components/message.d.ts +0 -3
- package/components/message.js +0 -2
- package/components/message.js.map +0 -1
- package/components/mosaic.d.ts +0 -4
- package/components/mosaic.js +0 -2
- package/components/mosaic.js.map +0 -1
- package/components/notification.d.ts +0 -3
- package/components/notification.js +0 -2
- package/components/notification.js.map +0 -1
- package/components/popover.d.ts +0 -3
- package/components/popover.js +0 -2
- package/components/popover.js.map +0 -1
- package/components/post-block.d.ts +0 -4
- package/components/post-block.js +0 -2
- package/components/post-block.js.map +0 -1
- package/components/progress-tracker.d.ts +0 -3
- package/components/progress-tracker.js +0 -2
- package/components/progress-tracker.js.map +0 -1
- package/components/progress.d.ts +0 -3
- package/components/progress.js +0 -2
- package/components/progress.js.map +0 -1
- package/components/radio-button.d.ts +0 -3
- package/components/radio-button.js +0 -2
- package/components/radio-button.js.map +0 -1
- package/components/select.d.ts +0 -7
- package/components/select.js +0 -2
- package/components/select.js.map +0 -1
- package/components/side-navigation.d.ts +0 -7
- package/components/side-navigation.js +0 -2
- package/components/side-navigation.js.map +0 -1
- package/components/skeleton.d.ts +0 -3
- package/components/skeleton.js +0 -2
- package/components/skeleton.js.map +0 -1
- package/components/slider.d.ts +0 -3
- package/components/slider.js +0 -2
- package/components/slider.js.map +0 -1
- package/components/slideshow.d.ts +0 -7
- package/components/slideshow.js +0 -2
- package/components/slideshow.js.map +0 -1
- package/components/switch.d.ts +0 -3
- package/components/switch.js +0 -2
- package/components/switch.js.map +0 -1
- package/components/table.d.ts +0 -3
- package/components/table.js +0 -2
- package/components/table.js.map +0 -1
- package/components/tabs.d.ts +0 -4
- package/components/tabs.js +0 -2
- package/components/tabs.js.map +0 -1
- package/components/text-field.d.ts +0 -7
- package/components/text-field.js +0 -2
- package/components/text-field.js.map +0 -1
- package/components/text.d.ts +0 -3
- package/components/text.js +0 -2
- package/components/text.js.map +0 -1
- package/components/thumbnail.d.ts +0 -4
- package/components/thumbnail.js +0 -3
- package/components/thumbnail.js.map +0 -1
- package/components/toolbar.d.ts +0 -3
- package/components/toolbar.js +0 -2
- package/components/toolbar.js.map +0 -1
- package/components/tooltip.d.ts +0 -4
- package/components/tooltip.js +0 -2
- package/components/tooltip.js.map +0 -1
- package/components/uploader.d.ts +0 -3
- package/components/uploader.js +0 -2
- package/components/uploader.js.map +0 -1
- package/components/user-block.d.ts +0 -5
- package/components/user-block.js +0 -2
- package/components/user-block.js.map +0 -1
- package/components.d.ts +0 -2
- package/components.js +0 -156
- package/components.js.map +0 -1
package/_internal/761031bf.js
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { b as _objectWithoutProperties, d as _slicedToArray, _ as _objectSpread2, e as _toConsumableArray, c as _extends } from './6340c129.js';
|
|
2
|
-
import { Size, Kind } from '../components.js';
|
|
3
|
-
import React, { useReducer, useEffect, forwardRef, useCallback } from 'react';
|
|
4
|
-
import { g as getRootClassName, c as classnames, h as handleBasicClasses, C as CSS_PREFIX } from './fd867c9d.js';
|
|
5
|
-
import { I as Icon, b as mdiCheckCircle, c as mdiAlertCircle, k as mdiRadioboxMarked, l as mdiRadioboxBlank } from './a521723d.js';
|
|
6
|
-
import 'lodash/kebabCase';
|
|
7
|
-
import { m as mergeRefs } from './853713cd.js';
|
|
8
|
-
import { I as InputHelper } from './b0eb3a30.js';
|
|
9
|
-
import { I as InputLabel } from './12ab39e4.js';
|
|
10
|
-
import { r as reducer, I as INIT_STATE, T as TabProviderContext, u as useTabProviderContextState, a as useTabProviderContext } from './e354228f.js';
|
|
11
|
-
import { u as useRovingTabIndex } from './20976405.js';
|
|
12
|
-
|
|
13
|
-
var DEFAULT_PROPS = {
|
|
14
|
-
isLazy: INIT_STATE.isLazy,
|
|
15
|
-
shouldActivateOnFocus: INIT_STATE.shouldActivateOnFocus
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* This component provides a context in which steps can be defined and linked to their step panel.
|
|
19
|
-
*
|
|
20
|
-
* It does not produce any markup so you can wrap it around any React elements and then split the ProgressTracker and ProgressTrackerPanel
|
|
21
|
-
* components in the react tree.
|
|
22
|
-
*
|
|
23
|
-
* This works exactly as TabProvider so it uses TabProviderContext and tabs state.
|
|
24
|
-
*
|
|
25
|
-
* @param props React component props.
|
|
26
|
-
* @return React element.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
var ProgressTrackerProvider = function ProgressTrackerProvider(props) {
|
|
30
|
-
var children = props.children,
|
|
31
|
-
onChange = props.onChange,
|
|
32
|
-
propState = _objectWithoutProperties(props, ["children", "onChange"]);
|
|
33
|
-
|
|
34
|
-
var _useReducer = useReducer(reducer, INIT_STATE),
|
|
35
|
-
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
36
|
-
state = _useReducer2[0],
|
|
37
|
-
dispatch = _useReducer2[1]; // On prop state change => dispatch update.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
useEffect(function () {
|
|
41
|
-
dispatch({
|
|
42
|
-
type: 'update',
|
|
43
|
-
payload: _objectSpread2({}, propState, {
|
|
44
|
-
activeTabIndex: propState.activeStepIndex || INIT_STATE.activeTabIndex
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
-
[dispatch].concat(_toConsumableArray(Object.values(propState)))); // On active tab index state change => send update to the onChange.
|
|
49
|
-
|
|
50
|
-
useEffect(function () {
|
|
51
|
-
if (state === INIT_STATE || !onChange || propState.activeStepIndex === state.activeTabIndex) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
onChange(state.activeTabIndex);
|
|
56
|
-
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
|
-
[onChange, state.activeTabIndex]);
|
|
58
|
-
return React.createElement(TabProviderContext.Provider, {
|
|
59
|
-
value: [state, dispatch]
|
|
60
|
-
}, children);
|
|
61
|
-
};
|
|
62
|
-
ProgressTrackerProvider.defaultProps = DEFAULT_PROPS;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Defines the props of the component.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Component display name.
|
|
70
|
-
*/
|
|
71
|
-
var COMPONENT_NAME = 'ProgressTracker';
|
|
72
|
-
/**
|
|
73
|
-
* Component default class name and class prefix.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
var CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
77
|
-
/**
|
|
78
|
-
* Component default props.
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
var DEFAULT_PROPS$1 = {};
|
|
82
|
-
/**
|
|
83
|
-
* ProgressTracker component.
|
|
84
|
-
*
|
|
85
|
-
* Implements WAI-ARIA `tablist` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
|
|
86
|
-
*
|
|
87
|
-
* @param props Component props.
|
|
88
|
-
* @param ref Component ref.
|
|
89
|
-
* @return React element.
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
var ProgressTracker = forwardRef(function (props, ref) {
|
|
93
|
-
var _state$ids, _state$ids$tab;
|
|
94
|
-
|
|
95
|
-
var ariaLabel = props['aria-label'],
|
|
96
|
-
children = props.children,
|
|
97
|
-
className = props.className,
|
|
98
|
-
forwardedProps = _objectWithoutProperties(props, ["aria-label", "children", "className"]);
|
|
99
|
-
|
|
100
|
-
var stepListRef = React.useRef(null);
|
|
101
|
-
useRovingTabIndex({
|
|
102
|
-
parentRef: stepListRef,
|
|
103
|
-
elementSelector: '[role="tab"]',
|
|
104
|
-
keepTabIndex: false,
|
|
105
|
-
extraDependencies: [children]
|
|
106
|
-
});
|
|
107
|
-
var state = useTabProviderContextState();
|
|
108
|
-
var numberOfSteps = (state === null || state === void 0 ? void 0 : (_state$ids = state.ids) === null || _state$ids === void 0 ? void 0 : (_state$ids$tab = _state$ids.tab) === null || _state$ids$tab === void 0 ? void 0 : _state$ids$tab.length) || 0;
|
|
109
|
-
var backgroundPosition = numberOfSteps > 0 ? 100 / (numberOfSteps * 2) : 0;
|
|
110
|
-
var trackPosition = numberOfSteps > 0 ? 100 / (numberOfSteps - 1) * ((state === null || state === void 0 ? void 0 : state.activeTabIndex) || 0) / 100 : 0;
|
|
111
|
-
return React.createElement("div", _extends({
|
|
112
|
-
ref: mergeRefs(ref, stepListRef)
|
|
113
|
-
}, forwardedProps, {
|
|
114
|
-
className: classnames(className, handleBasicClasses({
|
|
115
|
-
prefix: CLASSNAME
|
|
116
|
-
}))
|
|
117
|
-
}), React.createElement("div", {
|
|
118
|
-
className: "".concat(CLASSNAME, "__steps"),
|
|
119
|
-
role: "tablist",
|
|
120
|
-
"aria-label": ariaLabel
|
|
121
|
-
}, children), React.createElement("div", {
|
|
122
|
-
className: "".concat(CLASSNAME, "__background-bar"),
|
|
123
|
-
style: {
|
|
124
|
-
left: "".concat(backgroundPosition, "%"),
|
|
125
|
-
right: "".concat(backgroundPosition, "%")
|
|
126
|
-
}
|
|
127
|
-
}), React.createElement("div", {
|
|
128
|
-
className: "".concat(CLASSNAME, "__foreground-bar"),
|
|
129
|
-
style: {
|
|
130
|
-
left: "".concat(backgroundPosition, "%"),
|
|
131
|
-
right: "".concat(backgroundPosition, "%"),
|
|
132
|
-
transform: "scaleX(".concat(trackPosition, ")")
|
|
133
|
-
}
|
|
134
|
-
}));
|
|
135
|
-
});
|
|
136
|
-
ProgressTracker.displayName = COMPONENT_NAME;
|
|
137
|
-
ProgressTracker.className = CLASSNAME;
|
|
138
|
-
ProgressTracker.defaultProps = DEFAULT_PROPS$1;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Defines the props of the component.
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Component display name.
|
|
146
|
-
*/
|
|
147
|
-
var COMPONENT_NAME$1 = 'ProgressTrackerStep';
|
|
148
|
-
/**
|
|
149
|
-
* Component default class name and class prefix.
|
|
150
|
-
*/
|
|
151
|
-
|
|
152
|
-
var CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
|
|
153
|
-
/**
|
|
154
|
-
* Component default props.
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
var DEFAULT_PROPS$2 = {};
|
|
158
|
-
/**
|
|
159
|
-
* ProgressTrackerStep component.
|
|
160
|
-
*
|
|
161
|
-
* Implements WAI-ARIA `tab` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
|
|
162
|
-
*
|
|
163
|
-
* @param props Component props.
|
|
164
|
-
* @param ref Component ref.
|
|
165
|
-
* @return React element.
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
var ProgressTrackerStep = forwardRef(function (props, ref) {
|
|
169
|
-
var className = props.className,
|
|
170
|
-
disabled = props.disabled,
|
|
171
|
-
hasError = props.hasError,
|
|
172
|
-
helper = props.helper,
|
|
173
|
-
id = props.id,
|
|
174
|
-
propIsActive = props.isActive,
|
|
175
|
-
isComplete = props.isComplete,
|
|
176
|
-
_props$isDisabled = props.isDisabled,
|
|
177
|
-
isDisabled = _props$isDisabled === void 0 ? disabled : _props$isDisabled,
|
|
178
|
-
label = props.label,
|
|
179
|
-
onFocus = props.onFocus,
|
|
180
|
-
onKeyPress = props.onKeyPress,
|
|
181
|
-
_props$tabIndex = props.tabIndex,
|
|
182
|
-
tabIndex = _props$tabIndex === void 0 ? -1 : _props$tabIndex,
|
|
183
|
-
forwardedProps = _objectWithoutProperties(props, ["className", "disabled", "hasError", "helper", "id", "isActive", "isComplete", "isDisabled", "label", "onFocus", "onKeyPress", "tabIndex"]);
|
|
184
|
-
|
|
185
|
-
var state = useTabProviderContext('tab', id);
|
|
186
|
-
var isActive = propIsActive || (state === null || state === void 0 ? void 0 : state.isActive);
|
|
187
|
-
var changeToCurrentTab = useCallback(function () {
|
|
188
|
-
if (isDisabled) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
state === null || state === void 0 ? void 0 : state.changeToTab();
|
|
193
|
-
}, [isDisabled, state]);
|
|
194
|
-
var handleFocus = useCallback(function (event) {
|
|
195
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
196
|
-
|
|
197
|
-
if (state === null || state === void 0 ? void 0 : state.shouldActivateOnFocus) {
|
|
198
|
-
changeToCurrentTab();
|
|
199
|
-
}
|
|
200
|
-
}, [changeToCurrentTab, onFocus, state === null || state === void 0 ? void 0 : state.shouldActivateOnFocus]);
|
|
201
|
-
var handleKeyPress = useCallback(function (event) {
|
|
202
|
-
onKeyPress === null || onKeyPress === void 0 ? void 0 : onKeyPress(event);
|
|
203
|
-
|
|
204
|
-
if (event.key !== 'Enter') {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
changeToCurrentTab();
|
|
209
|
-
}, [changeToCurrentTab, onKeyPress]);
|
|
210
|
-
|
|
211
|
-
var getIcon = function getIcon() {
|
|
212
|
-
if (isComplete) {
|
|
213
|
-
return mdiCheckCircle;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (isActive) {
|
|
217
|
-
return hasError ? mdiAlertCircle : mdiRadioboxMarked;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return mdiRadioboxBlank;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
return React.createElement("button", _extends({
|
|
224
|
-
ref: ref
|
|
225
|
-
}, forwardedProps, {
|
|
226
|
-
type: "button",
|
|
227
|
-
id: state === null || state === void 0 ? void 0 : state.tabId,
|
|
228
|
-
className: classnames(className, handleBasicClasses({
|
|
229
|
-
prefix: CLASSNAME$1,
|
|
230
|
-
hasError: hasError,
|
|
231
|
-
isActive: isActive,
|
|
232
|
-
isClickable: state && !isDisabled,
|
|
233
|
-
isComplete: isComplete
|
|
234
|
-
})),
|
|
235
|
-
onClick: changeToCurrentTab,
|
|
236
|
-
onKeyPress: handleKeyPress,
|
|
237
|
-
onFocus: handleFocus,
|
|
238
|
-
role: "tab",
|
|
239
|
-
tabIndex: isActive ? 0 : tabIndex,
|
|
240
|
-
"aria-disabled": isDisabled,
|
|
241
|
-
"aria-selected": isActive,
|
|
242
|
-
"aria-controls": state === null || state === void 0 ? void 0 : state.tabPanelId
|
|
243
|
-
}), React.createElement(Icon, {
|
|
244
|
-
className: "".concat(CLASSNAME$1, "__state"),
|
|
245
|
-
icon: getIcon(),
|
|
246
|
-
size: Size.s
|
|
247
|
-
}), React.createElement(InputLabel, {
|
|
248
|
-
htmlFor: (state === null || state === void 0 ? void 0 : state.tabId) || '',
|
|
249
|
-
className: "".concat(CLASSNAME$1, "__label")
|
|
250
|
-
}, label), helper && React.createElement(InputHelper, {
|
|
251
|
-
kind: hasError ? Kind.error : Kind.info,
|
|
252
|
-
className: "".concat(CLASSNAME$1, "__helper")
|
|
253
|
-
}, helper));
|
|
254
|
-
});
|
|
255
|
-
ProgressTrackerStep.displayName = COMPONENT_NAME$1;
|
|
256
|
-
ProgressTrackerStep.className = CLASSNAME$1;
|
|
257
|
-
ProgressTrackerStep.defaultProps = DEFAULT_PROPS$2;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Defines the props of the component.
|
|
261
|
-
*/
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Component display name.
|
|
265
|
-
*/
|
|
266
|
-
var COMPONENT_NAME$2 = 'ProgressTrackerStepPanel';
|
|
267
|
-
/**
|
|
268
|
-
* Component default class name and class prefix.
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
var CLASSNAME$2 = "".concat(CSS_PREFIX, "-step-panel");
|
|
272
|
-
/**
|
|
273
|
-
* Component default props.
|
|
274
|
-
*/
|
|
275
|
-
|
|
276
|
-
var DEFAULT_PROPS$3 = {};
|
|
277
|
-
/**
|
|
278
|
-
* ProgressTrackerStepPanel component.
|
|
279
|
-
*
|
|
280
|
-
* Implements WAI-ARIA `tabpanel` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
|
|
281
|
-
*
|
|
282
|
-
* @param props Component props.
|
|
283
|
-
* @param ref Component ref.
|
|
284
|
-
* @return React element.
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
|
-
var ProgressTrackerStepPanel = forwardRef(function (props, ref) {
|
|
288
|
-
var children = props.children,
|
|
289
|
-
id = props.id,
|
|
290
|
-
className = props.className,
|
|
291
|
-
propIsActive = props.isActive,
|
|
292
|
-
forwardedProps = _objectWithoutProperties(props, ["children", "id", "className", "isActive"]);
|
|
293
|
-
|
|
294
|
-
var state = useTabProviderContext('tabPanel', id);
|
|
295
|
-
var isActive = propIsActive || (state === null || state === void 0 ? void 0 : state.isActive);
|
|
296
|
-
return React.createElement("div", _extends({
|
|
297
|
-
ref: ref
|
|
298
|
-
}, forwardedProps, {
|
|
299
|
-
id: state === null || state === void 0 ? void 0 : state.tabPanelId,
|
|
300
|
-
className: classnames(className, handleBasicClasses({
|
|
301
|
-
prefix: CLASSNAME$2,
|
|
302
|
-
isActive: isActive
|
|
303
|
-
})),
|
|
304
|
-
role: "tabpanel",
|
|
305
|
-
tabIndex: 0,
|
|
306
|
-
"aria-labelledby": state === null || state === void 0 ? void 0 : state.tabId
|
|
307
|
-
}), (!(state === null || state === void 0 ? void 0 : state.isLazy) || isActive) && children);
|
|
308
|
-
});
|
|
309
|
-
ProgressTrackerStepPanel.displayName = COMPONENT_NAME$2;
|
|
310
|
-
ProgressTrackerStepPanel.className = CLASSNAME$2;
|
|
311
|
-
ProgressTrackerStepPanel.defaultProps = DEFAULT_PROPS$3;
|
|
312
|
-
|
|
313
|
-
export { ProgressTrackerProvider as P, ProgressTracker as a, ProgressTrackerStep as b, ProgressTrackerStepPanel as c };
|
|
314
|
-
//# sourceMappingURL=761031bf.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"761031bf.js","sources":["../../src/components/progress-tracker/ProgressTrackerProvider.tsx","../../src/components/progress-tracker/ProgressTracker.tsx","../../src/components/progress-tracker/ProgressTrackerStep.tsx","../../src/components/progress-tracker/ProgressTrackerStepPanel.tsx"],"sourcesContent":["import React, { ReactNode, useEffect, useReducer } from 'react';\nimport { INIT_STATE, TabProviderContext, reducer } from '../tabs/state';\n\nexport interface ProgressTrackerProviderProps {\n /** Active step index. */\n activeStepIndex?: number;\n /** ProgressTrackerProvider children. */\n children: ReactNode;\n /** Step panel children should not render if the step panel is hidden. */\n isLazy?: boolean;\n /** Activate tabs on focus. */\n shouldActivateOnFocus?: boolean;\n /** Step change callback. */\n onChange?(index: number): void;\n}\n\nconst DEFAULT_PROPS: Partial<ProgressTrackerProviderProps> = {\n isLazy: INIT_STATE.isLazy,\n shouldActivateOnFocus: INIT_STATE.shouldActivateOnFocus,\n};\n\n/**\n * This component provides a context in which steps can be defined and linked to their step panel.\n *\n * It does not produce any markup so you can wrap it around any React elements and then split the ProgressTracker and ProgressTrackerPanel\n * components in the react tree.\n *\n * This works exactly as TabProvider so it uses TabProviderContext and tabs state.\n *\n * @param props React component props.\n * @return React element.\n */\nexport const ProgressTrackerProvider: React.FC<ProgressTrackerProviderProps> = (props) => {\n const { children, onChange, ...propState } = props;\n const [state, dispatch] = useReducer(reducer, INIT_STATE);\n\n // On prop state change => dispatch update.\n useEffect(\n () => {\n dispatch({\n type: 'update',\n payload: {\n ...propState,\n activeTabIndex: propState.activeStepIndex || INIT_STATE.activeTabIndex,\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dispatch, ...Object.values(propState)],\n );\n\n // On active tab index state change => send update to the onChange.\n useEffect(\n () => {\n if (state === INIT_STATE || !onChange || propState.activeStepIndex === state.activeTabIndex) {\n return;\n }\n onChange(state.activeTabIndex);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [onChange, state.activeTabIndex],\n );\n\n return <TabProviderContext.Provider value={[state, dispatch]}>{children}</TabProviderContext.Provider>;\n};\nProgressTrackerProvider.defaultProps = DEFAULT_PROPS;\n","import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Comp, GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { useTabProviderContextState } from '../tabs/state';\n\n/**\n * Defines the props of the component.\n */\nexport interface ProgressTrackerProps extends GenericProps {\n /** ARIA label (purpose of the set of steps). */\n ['aria-label']: string;\n /** Step list. */\n children: ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ProgressTracker';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ProgressTrackerProps> = {};\n\n/**\n * ProgressTracker component.\n *\n * Implements WAI-ARIA `tablist` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ProgressTracker: Comp<ProgressTrackerProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { 'aria-label': ariaLabel, children, className, ...forwardedProps } = props;\n const stepListRef = React.useRef(null);\n useRovingTabIndex({\n parentRef: stepListRef,\n elementSelector: '[role=\"tab\"]',\n keepTabIndex: false,\n extraDependencies: [children],\n });\n\n const state = useTabProviderContextState();\n const numberOfSteps = state?.ids?.tab?.length || 0;\n const backgroundPosition: number = numberOfSteps > 0 ? 100 / (numberOfSteps * 2) : 0;\n const trackPosition: number =\n numberOfSteps > 0 ? ((100 / (numberOfSteps - 1)) * (state?.activeTabIndex || 0)) / 100 : 0;\n\n return (\n <div\n ref={mergeRefs(ref, stepListRef)}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME }))}\n >\n <div className={`${CLASSNAME}__steps`} role=\"tablist\" aria-label={ariaLabel}>\n {children}\n </div>\n\n <div\n className={`${CLASSNAME}__background-bar`}\n style={{ left: `${backgroundPosition}%`, right: `${backgroundPosition}%` }}\n />\n\n <div\n className={`${CLASSNAME}__foreground-bar`}\n style={{\n left: `${backgroundPosition}%`,\n right: `${backgroundPosition}%`,\n transform: `scaleX(${trackPosition})`,\n }}\n />\n </div>\n );\n});\nProgressTracker.displayName = COMPONENT_NAME;\nProgressTracker.className = CLASSNAME;\nProgressTracker.defaultProps = DEFAULT_PROPS;\n","import React, { FocusEventHandler, forwardRef, KeyboardEventHandler, useCallback } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Icon, InputHelper, InputLabel, Kind, Size } from '@lumx/react';\n\nimport { Comp, GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\n\nimport { mdiAlertCircle, mdiCheckCircle, mdiRadioboxBlank, mdiRadioboxMarked } from '@lumx/icons';\nimport { useTabProviderContext } from '../tabs/state';\n\n/**\n * Defines the props of the component.\n */\nexport interface ProgressTrackerStepProps extends GenericProps {\n /** Children are not supported. */\n children?: never;\n /** Whether the step should be in error state or not. */\n hasError?: boolean;\n /** Helper text. */\n helper?: string | null;\n /** Native id property. */\n id?: string;\n /** Whether the current step is active or not. */\n isActive?: boolean;\n /** Whether the current step is completed or not. */\n isComplete?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label text. */\n label?: string | null;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ProgressTrackerStep';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ProgressTrackerStepProps> = {};\n\n/**\n * ProgressTrackerStep component.\n *\n * Implements WAI-ARIA `tab` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ProgressTrackerStep: Comp<ProgressTrackerStepProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const {\n className,\n disabled,\n hasError,\n helper,\n id,\n isActive: propIsActive,\n isComplete,\n isDisabled = disabled,\n label,\n onFocus,\n onKeyPress,\n tabIndex = -1,\n ...forwardedProps\n } = props;\n const state = useTabProviderContext('tab', id);\n const isActive = propIsActive || state?.isActive;\n\n const changeToCurrentTab = useCallback(() => {\n if (isDisabled) {\n return;\n }\n state?.changeToTab();\n }, [isDisabled, state]);\n\n const handleFocus: FocusEventHandler = useCallback(\n (event) => {\n onFocus?.(event);\n if (state?.shouldActivateOnFocus) {\n changeToCurrentTab();\n }\n },\n [changeToCurrentTab, onFocus, state?.shouldActivateOnFocus],\n );\n\n const handleKeyPress: KeyboardEventHandler = useCallback(\n (event) => {\n onKeyPress?.(event);\n if (event.key !== 'Enter') {\n return;\n }\n changeToCurrentTab();\n },\n [changeToCurrentTab, onKeyPress],\n );\n\n const getIcon = (): string => {\n if (isComplete) {\n return mdiCheckCircle;\n }\n\n if (isActive) {\n return hasError ? mdiAlertCircle : mdiRadioboxMarked;\n }\n\n return mdiRadioboxBlank;\n };\n\n return (\n <button\n ref={ref}\n {...forwardedProps}\n type=\"button\"\n id={state?.tabId}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n hasError,\n isActive,\n isClickable: state && !isDisabled,\n isComplete,\n }),\n )}\n onClick={changeToCurrentTab}\n onKeyPress={handleKeyPress}\n onFocus={handleFocus}\n role=\"tab\"\n tabIndex={isActive ? 0 : tabIndex}\n aria-disabled={isDisabled}\n aria-selected={isActive}\n aria-controls={state?.tabPanelId}\n >\n <Icon className={`${CLASSNAME}__state`} icon={getIcon()} size={Size.s} />\n\n <InputLabel htmlFor={state?.tabId || ''} className={`${CLASSNAME}__label`}>\n {label}\n </InputLabel>\n\n {helper && (\n <InputHelper kind={hasError ? Kind.error : Kind.info} className={`${CLASSNAME}__helper`}>\n {helper}\n </InputHelper>\n )}\n </button>\n );\n});\nProgressTrackerStep.displayName = COMPONENT_NAME;\nProgressTrackerStep.className = CLASSNAME;\nProgressTrackerStep.defaultProps = DEFAULT_PROPS;\n","import { useTabProviderContext } from '@lumx/react/components/tabs/state';\nimport { CSS_PREFIX } from '@lumx/react/constants';\nimport { Comp, GenericProps } from '@lumx/react/utils/type';\nimport { handleBasicClasses } from '@lumx/react/utils/className';\n\nimport classNames from 'classnames';\nimport React, { forwardRef } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface ProgressTrackerStepPanelProps extends GenericProps {\n /** Native id property. */\n id?: string;\n /** Whether the step is active or not. */\n isActive?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ProgressTrackerStepPanel';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = `${CSS_PREFIX}-step-panel`;\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ProgressTrackerStepPanelProps> = {};\n\n/**\n * ProgressTrackerStepPanel component.\n *\n * Implements WAI-ARIA `tabpanel` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ProgressTrackerStepPanel: Comp<ProgressTrackerStepPanelProps, HTMLDivElement> = forwardRef(\n (props, ref) => {\n const { children, id, className, isActive: propIsActive, ...forwardedProps } = props;\n\n const state = useTabProviderContext('tabPanel', id);\n const isActive = propIsActive || state?.isActive;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n id={state?.tabPanelId}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, isActive }))}\n role=\"tabpanel\"\n tabIndex={0}\n aria-labelledby={state?.tabId}\n >\n {(!state?.isLazy || isActive) && children}\n </div>\n );\n },\n);\nProgressTrackerStepPanel.displayName = COMPONENT_NAME;\nProgressTrackerStepPanel.className = CLASSNAME;\nProgressTrackerStepPanel.defaultProps = DEFAULT_PROPS;\n"],"names":["DEFAULT_PROPS","isLazy","INIT_STATE","shouldActivateOnFocus","ProgressTrackerProvider","props","children","onChange","propState","useReducer","reducer","state","dispatch","useEffect","type","payload","activeTabIndex","activeStepIndex","Object","values","defaultProps","COMPONENT_NAME","CLASSNAME","getRootClassName","ProgressTracker","forwardRef","ref","ariaLabel","className","forwardedProps","stepListRef","React","useRef","useRovingTabIndex","parentRef","elementSelector","keepTabIndex","extraDependencies","useTabProviderContextState","numberOfSteps","ids","tab","length","backgroundPosition","trackPosition","mergeRefs","classNames","handleBasicClasses","prefix","left","right","transform","displayName","ProgressTrackerStep","disabled","hasError","helper","id","propIsActive","isActive","isComplete","isDisabled","label","onFocus","onKeyPress","tabIndex","useTabProviderContext","changeToCurrentTab","useCallback","changeToTab","handleFocus","event","handleKeyPress","key","getIcon","mdiCheckCircle","mdiAlertCircle","mdiRadioboxMarked","mdiRadioboxBlank","tabId","isClickable","tabPanelId","Size","s","Kind","error","info","CSS_PREFIX","ProgressTrackerStepPanel"],"mappings":";;;;;;;;;;;;AAgBA,IAAMA,aAAoD,GAAG;AACzDC,EAAAA,MAAM,EAAEC,UAAU,CAACD,MADsC;AAEzDE,EAAAA,qBAAqB,EAAED,UAAU,CAACC;AAFuB,CAA7D;AAKA;;;;;;;;;;;;IAWaC,uBAA+D,GAAG,SAAlEA,uBAAkE,CAACC,KAAD,EAAW;AAAA,MAC9EC,QAD8E,GACzCD,KADyC,CAC9EC,QAD8E;AAAA,MACpEC,QADoE,GACzCF,KADyC,CACpEE,QADoE;AAAA,MACvDC,SADuD,4BACzCH,KADyC;;AAAA,oBAE5DI,UAAU,CAACC,OAAD,EAAUR,UAAV,CAFkD;AAAA;AAAA,MAE/ES,KAF+E;AAAA,MAExEC,QAFwE;;;AAKtFC,EAAAA,SAAS,CACL,YAAM;AACFD,IAAAA,QAAQ,CAAC;AACLE,MAAAA,IAAI,EAAE,QADD;AAELC,MAAAA,OAAO,qBACAP,SADA;AAEHQ,QAAAA,cAAc,EAAER,SAAS,CAACS,eAAV,IAA6Bf,UAAU,CAACc;AAFrD;AAFF,KAAD,CAAR;AAOH,GATI;AAAA,GAWJJ,QAXI,4BAWSM,MAAM,CAACC,MAAP,CAAcX,SAAd,CAXT,GAAT,CALsF;;AAoBtFK,EAAAA,SAAS,CACL,YAAM;AACF,Q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
|
package/_internal/76fed69d.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { b as _objectWithoutProperties, c as _extends } from './6340c129.js';
|
|
2
|
-
import { Theme, ColorPalette, Size } from '../components.js';
|
|
3
|
-
import React, { forwardRef } from 'react';
|
|
4
|
-
import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './fd867c9d.js';
|
|
5
|
-
import { I as Icon, h as mdiDragVertical } from './a521723d.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Defines the props of the component.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Component display name.
|
|
13
|
-
*/
|
|
14
|
-
var COMPONENT_NAME = 'DragHandle';
|
|
15
|
-
/**
|
|
16
|
-
* Component default class name and class prefix.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
var CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
20
|
-
/**
|
|
21
|
-
* DragHandle component.
|
|
22
|
-
*
|
|
23
|
-
* @param props Component props.
|
|
24
|
-
* @param ref Component ref.
|
|
25
|
-
* @return React element.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
var DragHandle = forwardRef(function (props, ref) {
|
|
29
|
-
var className = props.className,
|
|
30
|
-
theme = props.theme,
|
|
31
|
-
forwardedProps = _objectWithoutProperties(props, ["className", "theme"]);
|
|
32
|
-
|
|
33
|
-
return React.createElement("div", _extends({
|
|
34
|
-
ref: ref
|
|
35
|
-
}, forwardedProps, {
|
|
36
|
-
className: classnames(className, handleBasicClasses({
|
|
37
|
-
prefix: CLASSNAME,
|
|
38
|
-
theme: theme
|
|
39
|
-
}))
|
|
40
|
-
}), React.createElement(Icon, {
|
|
41
|
-
icon: mdiDragVertical,
|
|
42
|
-
color: theme === Theme.dark ? ColorPalette.light : ColorPalette.dark,
|
|
43
|
-
size: Size.xs
|
|
44
|
-
}));
|
|
45
|
-
});
|
|
46
|
-
DragHandle.displayName = COMPONENT_NAME;
|
|
47
|
-
DragHandle.className = CLASSNAME;
|
|
48
|
-
|
|
49
|
-
export { DragHandle as D };
|
|
50
|
-
//# sourceMappingURL=76fed69d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"76fed69d.js","sources":["../../src/components/drag-handle/DragHandle.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiDragVertical } from '@lumx/icons';\nimport { ColorPalette, Icon, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\n\n/**\n * Defines the props of the component.\n */\nexport interface DragHandleProps extends GenericProps, HasTheme {}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DragHandle';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * DragHandle component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DragHandle: Comp<DragHandleProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { className, theme, ...forwardedProps } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }))}\n >\n <Icon\n icon={mdiDragVertical}\n color={theme === Theme.dark ? ColorPalette.light : ColorPalette.dark}\n size={Size.xs}\n />\n </div>\n );\n});\nDragHandle.displayName = COMPONENT_NAME;\nDragHandle.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DragHandle","forwardRef","props","ref","className","theme","forwardedProps","classNames","handleBasicClasses","prefix","mdiDragVertical","Theme","dark","ColorPalette","light","Size","xs","displayName"],"mappings":";;;;;;AASA;;;;AAKA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,UAAiD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAChFC,SADgF,GACxCF,KADwC,CAChFE,SADgF;AAAA,MACrEC,KADqE,GACxCH,KADwC,CACrEG,KADqE;AAAA,MAC3DC,cAD2D,4BACxCJ,KADwC;;AAGxF,SACI;AACI,IAAA,GAAG,EAAEC;AADT,KAEQG,cAFR;AAGI,IAAA,SAAS,EAAEC,UAAU,CAACH,SAAD,EAAYI,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEX,SAAV;AAAqBO,MAAAA,KAAK,EAALA;AAArB,KAAD,CAA9B;AAHzB,MAKI,oBAAC,IAAD;AACI,IAAA,IAAI,EAAEK,eADV;AAEI,IAAA,KAAK,EAAEL,KAAK,KAAKM,KAAK,CAACC,IAAhB,GAAuBC,YAAY,CAACC,KAApC,GAA4CD,YAAY,CAACD,IAFpE;AAGI,IAAA,IAAI,EAAEG,IAAI,CAACC;AAHf,IALJ,CADJ;AAaH,CAhB0E;AAiB3EhB,UAAU,CAACiB,WAAX,GAAyBpB,cAAzB;AACAG,UAAU,CAACI,SAAX,GAAuBN,SAAvB;;;;"}
|
package/_internal/78ef8e34.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Properties of a component to use to determine it's name.
|
|
6
|
-
* In the order of preference.
|
|
7
|
-
*/
|
|
8
|
-
var NAME_PROPERTIES = ['type', 'type.displayName', 'displayName', 'name', 'type.name', 'props.mdxType', '_reactInternalFiber.elementType.name'];
|
|
9
|
-
/** LumX Component Type. */
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Create a predicate function that checks if a ReactNode is a react element from the given component.
|
|
13
|
-
*
|
|
14
|
-
* @param component React function component or the component name
|
|
15
|
-
* @return predicate returning true if value is instance of the component
|
|
16
|
-
*/
|
|
17
|
-
var isComponent = function isComponent(component) {
|
|
18
|
-
return function (instance) {
|
|
19
|
-
var componentName = typeof component === 'string' ? component : component.displayName;
|
|
20
|
-
return !!get(instance, '$$typeof') && NAME_PROPERTIES.some(function (nameProperty) {
|
|
21
|
-
return get(instance, nameProperty) === componentName;
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Similar to `isComponent` but more precise as it's not based on the component `displayName` but on the component function reference.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
var isComponentType = function isComponentType(type) {
|
|
30
|
-
return function (node) {
|
|
31
|
-
return React.isValidElement(node) && node.type === type;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* JS falsy values.
|
|
36
|
-
* (excluding `NaN` as it can't be distinguished from `number`)
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
export { isComponentType as a, isComponent as i };
|
|
40
|
-
//# sourceMappingURL=78ef8e34.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"78ef8e34.js","sources":["../../src/utils/type.ts"],"sourcesContent":["import get from 'lodash/get';\nimport React, { ReactElement, ReactNode, Ref } from 'react';\nimport { Theme } from '@lumx/react';\n\n/** Get types of the values of a record. */\nexport type ValueOf<T extends Record<any, any>> = T[keyof T];\n\n/**\n * Properties of a component to use to determine it's name.\n * In the order of preference.\n */\nconst NAME_PROPERTIES: string[] = [\n 'type',\n 'type.displayName',\n 'displayName',\n 'name',\n 'type.name',\n 'props.mdxType',\n '_reactInternalFiber.elementType.name',\n];\n\n/** LumX Component Type. */\nexport type Comp<P, T = HTMLElement> = {\n (props: P & { ref?: Ref<T> }): ReactElement | null;\n /** React component type. */\n readonly $$typeof: symbol;\n /** Component default props. */\n defaultProps?: Partial<P>;\n /** Component name. */\n displayName?: string;\n /** Component base class name. */\n className?: string;\n};\n\n/** Union type of all heading elements */\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HasTheme {\n /**\n * Theme adapting the component to light or dark background.\n */\n theme?: Theme;\n}\n\n/**\n * Define a generic props types.\n */\nexport interface GenericProps {\n /**\n * Class name forwarded to the root element of the component.\n */\n className?: string;\n /**\n * Any prop (particularly any supported prop for a HTML element).\n */\n [propName: string]: any;\n}\n\n/**\n * Callback function type alias (use for readability)\n */\nexport type Callback = () => void;\nexport type Predicate<T> = (t: T) => boolean;\n\n/**\n * Create a predicate function that checks if a ReactNode is a react element from the given component.\n *\n * @param component React function component or the component name\n * @return predicate returning true if value is instance of the component\n */\nexport const isComponent = <C>(component: Comp<C, any> | string) => (instance: ReactNode): instance is ReactElement => {\n const componentName = typeof component === 'string' ? component : component.displayName;\n\n return (\n !!get(instance, '$$typeof') &&\n NAME_PROPERTIES.some((nameProperty: string): boolean => get(instance, nameProperty) === componentName)\n );\n};\n\n/**\n * Similar to `isComponent` but more precise as it's not based on the component `displayName` but on the component function reference.\n */\nexport const isComponentType = (type: ReactElement['type']) => (node: ReactNode): node is ReactElement =>\n React.isValidElement(node) && node.type === type;\n\n/**\n * JS falsy values.\n * (excluding `NaN` as it can't be distinguished from `number`)\n */\nexport type Falsy = false | undefined | null | 0 | '';\n"],"names":["NAME_PROPERTIES","isComponent","component","instance","componentName","displayName","get","some","nameProperty","isComponentType","type","node","React","isValidElement"],"mappings":";;;AAOA;;;;AAIA,IAAMA,eAAyB,GAAG,CAC9B,MAD8B,EAE9B,kBAF8B,EAG9B,aAH8B,EAI9B,MAJ8B,EAK9B,WAL8B,EAM9B,eAN8B,EAO9B,sCAP8B,CAAlC;AAUA;;AA2CA;;;;;;IAMaC,WAAW,GAAG,SAAdA,WAAc,CAAIC,SAAJ;AAAA,SAAyC,UAACC,QAAD,EAAmD;AACnH,QAAMC,aAAa,GAAG,OAAOF,SAAP,KAAqB,QAArB,GAAgCA,SAAhC,GAA4CA,SAAS,CAACG,WAA5E;AAEA,WACI,CAAC,CAACC,GAAG,CAACH,QAAD,EAAW,UAAX,CAAL,IACAH,eAAe,CAACO,IAAhB,CAAqB,UAACC,YAAD;AAAA,aAAmCF,GAAG,CAACH,QAAD,EAAWK,YAAX,CAAH,KAAgCJ,aAAnE;AAAA,KAArB,CAFJ;AAIH,GAP0B;AAAA;AAS3B;;;;IAGaK,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD;AAAA,SAAgC,UAACC,IAAD;AAAA,WAC3DC,KAAK,CAACC,cAAN,CAAqBF,IAArB,KAA8BA,IAAI,CAACD,IAAL,KAAcA,IADe;AAAA,GAAhC;AAAA;AAG/B;;;;;;;"}
|
package/_internal/7b906e16.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { l as GenericProps, m as HasTheme, k as Comp } from './eca6d4dc.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Defines the props of the component.
|
|
5
|
-
*/
|
|
6
|
-
interface DividerProps extends GenericProps, HasTheme {
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Divider component.
|
|
10
|
-
*
|
|
11
|
-
* @param props Component props.
|
|
12
|
-
* @param ref Component ref.
|
|
13
|
-
* @return React element.
|
|
14
|
-
*/
|
|
15
|
-
declare const Divider: Comp<DividerProps, HTMLHRElement>;
|
|
16
|
-
|
|
17
|
-
export { DividerProps as D, Divider as a };
|
package/_internal/7be11ddc.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { K as Kind, k as Comp } from './eca6d4dc.js';
|
|
2
|
-
import { a as ButtonProps } from './fd1f4d68.js';
|
|
3
|
-
import { D as DialogProps } from './935ce959.js';
|
|
4
|
-
|
|
5
|
-
interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {
|
|
6
|
-
/** Message variant. */
|
|
7
|
-
kind?: Kind;
|
|
8
|
-
/** Dialog title. */
|
|
9
|
-
title?: string;
|
|
10
|
-
/** Props forwarded to the confirm button */
|
|
11
|
-
confirmProps: ButtonProps & {
|
|
12
|
-
onClick(): void;
|
|
13
|
-
label: string;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Props forwarded to the cancel button.
|
|
17
|
-
* Will not render a cancel button if undefined.
|
|
18
|
-
*/
|
|
19
|
-
cancelProps?: ButtonProps & {
|
|
20
|
-
onClick(): void;
|
|
21
|
-
label: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* AlertDialog component.
|
|
26
|
-
*
|
|
27
|
-
* An alert dialog is a modal dialog that interrupts the user's workflow to
|
|
28
|
-
* communicate an important message and acquire a response.
|
|
29
|
-
*
|
|
30
|
-
* It should not have a complex content.
|
|
31
|
-
* Children of this component should only be strings, paragraphs or links.
|
|
32
|
-
*/
|
|
33
|
-
declare const AlertDialog: Comp<AlertDialogProps, HTMLDivElement>;
|
|
34
|
-
|
|
35
|
-
export { AlertDialogProps as A, AlertDialog as a };
|
package/_internal/7d39705e.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { l as GenericProps, m as HasTheme, C as ColorPalette, k as Comp } from './eca6d4dc.js';
|
|
2
|
-
|
|
3
|
-
interface FlagProps extends GenericProps, HasTheme {
|
|
4
|
-
/** Color of the component. */
|
|
5
|
-
color?: ColorPalette;
|
|
6
|
-
/** Icon to use before the label. */
|
|
7
|
-
icon?: string;
|
|
8
|
-
/** Text label of the flag. */
|
|
9
|
-
label: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Flag component.
|
|
13
|
-
*
|
|
14
|
-
* @param props Component props.
|
|
15
|
-
* @param ref Component ref.
|
|
16
|
-
* @return React element.
|
|
17
|
-
*/
|
|
18
|
-
declare const Flag: Comp<FlagProps, HTMLDivElement>;
|
|
19
|
-
|
|
20
|
-
export { FlagProps as F, Flag as a };
|
package/_internal/7e03266f.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { d as _slicedToArray } from './6340c129.js';
|
|
2
|
-
import { useState, useEffect, useRef } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Returns true if the component is visible taking into account the component's
|
|
6
|
-
* own visibility and the animations delay
|
|
7
|
-
*
|
|
8
|
-
* @param isComponentVisible Whether the component intends to be visible or not.
|
|
9
|
-
* @param transitionDuration time in ms that the transition takes for the specific component.
|
|
10
|
-
* @param onVisibilityChange Callback called when the visibility changes.
|
|
11
|
-
* @return true if the component should be rendered
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
function useDelayedVisibility(isComponentVisible, transitionDuration, onVisibilityChange) {
|
|
15
|
-
// Delay visibility to account for the 400ms of CSS opacity animation.
|
|
16
|
-
var _useState = useState(isComponentVisible),
|
|
17
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
-
isVisible = _useState2[0],
|
|
19
|
-
setVisible = _useState2[1];
|
|
20
|
-
|
|
21
|
-
useEffect(function () {
|
|
22
|
-
if (isComponentVisible) {
|
|
23
|
-
setVisible(true);
|
|
24
|
-
} else {
|
|
25
|
-
setTimeout(function () {
|
|
26
|
-
return setVisible(false);
|
|
27
|
-
}, transitionDuration);
|
|
28
|
-
}
|
|
29
|
-
}, [isComponentVisible, transitionDuration]);
|
|
30
|
-
/**
|
|
31
|
-
* Since we don't want onVisibiltyChange function to trigger itself if when it changes,
|
|
32
|
-
* we store the previous visibility and only trigger when visibility is different
|
|
33
|
-
* than previous value.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
var previousVisibility = useRef(isVisible);
|
|
37
|
-
useEffect(function () {
|
|
38
|
-
if (onVisibilityChange && previousVisibility.current !== isVisible) {
|
|
39
|
-
onVisibilityChange(isVisible);
|
|
40
|
-
previousVisibility.current = isVisible;
|
|
41
|
-
}
|
|
42
|
-
}, [isVisible, onVisibilityChange]);
|
|
43
|
-
return isComponentVisible || isVisible;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { useDelayedVisibility as u };
|
|
47
|
-
//# sourceMappingURL=7e03266f.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"7e03266f.js","sources":["../../src/hooks/useDelayedVisibility.tsx"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\n\n/**\n * Returns true if the component is visible taking into account the component's\n * own visibility and the animations delay\n *\n * @param isComponentVisible Whether the component intends to be visible or not.\n * @param transitionDuration time in ms that the transition takes for the specific component.\n * @param onVisibilityChange Callback called when the visibility changes.\n * @return true if the component should be rendered\n */\nexport function useDelayedVisibility(\n isComponentVisible: boolean,\n transitionDuration: number,\n onVisibilityChange?: (isVisible: boolean) => void,\n): boolean {\n // Delay visibility to account for the 400ms of CSS opacity animation.\n const [isVisible, setVisible] = useState(isComponentVisible);\n\n useEffect(() => {\n if (isComponentVisible) {\n setVisible(true);\n } else {\n setTimeout(() => setVisible(false), transitionDuration);\n }\n }, [isComponentVisible, transitionDuration]);\n\n /**\n * Since we don't want onVisibiltyChange function to trigger itself if when it changes,\n * we store the previous visibility and only trigger when visibility is different\n * than previous value.\n */\n\n const previousVisibility = useRef(isVisible);\n\n useEffect(() => {\n if (onVisibilityChange && previousVisibility.current !== isVisible) {\n onVisibilityChange(isVisible);\n previousVisibility.current = isVisible;\n }\n }, [isVisible, onVisibilityChange]);\n\n return isComponentVisible || isVisible;\n}\n"],"names":["useDelayedVisibility","isComponentVisible","transitionDuration","onVisibilityChange","useState","isVisible","setVisible","useEffect","setTimeout","previousVisibility","useRef","current"],"mappings":";;;AAEA;;;;;;;;;;AASO,SAASA,oBAAT,CACHC,kBADG,EAEHC,kBAFG,EAGHC,kBAHG,EAII;AACP;AADO,kBAEyBC,QAAQ,CAACH,kBAAD,CAFjC;AAAA;AAAA,MAEAI,SAFA;AAAA,MAEWC,UAFX;;AAIPC,EAAAA,SAAS,CAAC,YAAM;AACZ,QAAIN,kBAAJ,EAAwB;AACpBK,MAAAA,UAAU,CAAC,IAAD,CAAV;AACH,KAFD,MAEO;AACHE,MAAAA,UAAU,CAAC;AAAA,eAAMF,UAAU,CAAC,KAAD,CAAhB;AAAA,OAAD,EAA0BJ,kBAA1B,CAAV;AACH;AACJ,GANQ,EAMN,CAACD,kBAAD,EAAqBC,kBAArB,CANM,CAAT;AAQA;;;;;;AAMA,MAAMO,kBAAkB,GAAGC,MAAM,CAACL,SAAD,CAAjC;AAEAE,EAAAA,SAAS,CAAC,YAAM;AACZ,QAAIJ,kBAAkB,IAAIM,kBAAkB,CAACE,OAAnB,KAA+BN,SAAzD,EAAoE;AAChEF,MAAAA,kBAAkB,CAACE,SAAD,CAAlB;AACAI,MAAAA,kBAAkB,CAACE,OAAnB,GAA6BN,SAA7B;AACH;AACJ,GALQ,EAKN,CAACA,SAAD,EAAYF,kBAAZ,CALM,CAAT;AAOA,SAAOF,kBAAkB,IAAII,SAA7B;AACH;;;;"}
|