@mw-kit/mw-ui 1.10.2 → 1.10.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/dist/components/Select/hooks/index.d.ts +1 -0
- package/dist/components/Select/hooks/useFloatingMenu/index.d.ts +3 -1
- package/dist/components/Select/hooks/useInitialPlacement/index.d.ts +6 -0
- package/dist/components/Select/types.d.ts +9 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.js +164 -99
- package/dist/index.mjs +128 -63
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as useAsyncOptions } from './useAsyncOptions';
|
|
2
2
|
export { default as useFloatingMenu } from './useFloatingMenu';
|
|
3
|
+
export { default as useInitialPlacement } from './useInitialPlacement';
|
|
3
4
|
export { default as useListNavigation } from './useListNavigation';
|
|
4
5
|
export { default as useRuleIndex } from './useRuleIndex';
|
|
5
6
|
export { default as useVirtualizedOptions } from './useVirtualizedOptions';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { SelectPlacement } from '../../types';
|
|
1
2
|
type UseFloatingMenuParams = {
|
|
2
3
|
open: boolean;
|
|
3
4
|
onOpenChange: (open: boolean) => void;
|
|
5
|
+
placement?: SelectPlacement;
|
|
4
6
|
};
|
|
5
|
-
declare const useFloatingMenu: ({ open, onOpenChange }: UseFloatingMenuParams) => {
|
|
7
|
+
declare const useFloatingMenu: ({ open, onOpenChange, placement, }: UseFloatingMenuParams) => {
|
|
6
8
|
floating: {
|
|
7
9
|
placement: import("@floating-ui/utils").Placement;
|
|
8
10
|
strategy: import("@floating-ui/utils").Strategy;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SelectPlacement, SelectProps } from '../../types';
|
|
2
|
+
declare const useInitialPlacement: (props: SelectProps<unknown>, referenceNode: HTMLButtonElement | null) => {
|
|
3
|
+
placement: SelectPlacement;
|
|
4
|
+
syncPlacement: (node: HTMLButtonElement | null) => void;
|
|
5
|
+
};
|
|
6
|
+
export default useInitialPlacement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ReactVirtualizerOptions } from '@tanstack/react-virtual';
|
|
3
|
+
import type { Property } from 'csstype';
|
|
3
4
|
export type SelectOptionsLoader<Option> = (search: string, page: number, cursor: Option | null) => Promise<{
|
|
4
5
|
options: Option[];
|
|
5
6
|
last: boolean;
|
|
@@ -24,6 +25,7 @@ export type SelectApplyRule<Option, Id extends string = string> = {
|
|
|
24
25
|
Component?: SelectApplyRuleComponent<Option>;
|
|
25
26
|
};
|
|
26
27
|
export type SelectApplyRules<T> = readonly SelectApplyRule<T, string>[];
|
|
28
|
+
export type SelectPlacement = 'bottom' | 'top';
|
|
27
29
|
export type SelectOptionComponent<Option> = React.FunctionComponent<{
|
|
28
30
|
option: Option;
|
|
29
31
|
isActive: boolean;
|
|
@@ -45,6 +47,13 @@ export type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
45
47
|
viewMode?: boolean;
|
|
46
48
|
borderless?: boolean;
|
|
47
49
|
paddingless?: boolean;
|
|
50
|
+
zIndex?: Property.ZIndex;
|
|
51
|
+
placement?: SelectPlacement;
|
|
52
|
+
/**
|
|
53
|
+
* Defines the element used as the visual boundary when resolving the automatic placement.
|
|
54
|
+
* The viewport is used by default.
|
|
55
|
+
*/
|
|
56
|
+
boundRef?: HTMLElement;
|
|
48
57
|
/**
|
|
49
58
|
* The number of items to render above and below the visible area.
|
|
50
59
|
* The default is 2.
|
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
6
6
|
import * as _fortawesome_fontawesome_common_types from '@fortawesome/fontawesome-common-types';
|
|
7
7
|
import * as styled_components_dist_types from 'styled-components/dist/types';
|
|
8
8
|
import { ReactVirtualizerOptions } from '@tanstack/react-virtual';
|
|
9
|
+
import { Property } from 'csstype';
|
|
9
10
|
import SignatureCanvas, { SignatureCanvasProps } from 'react-signature-canvas';
|
|
10
11
|
|
|
11
12
|
type TransitionFunction = 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | 'step-start' | 'step-end' | `cubic-bezier(${number}, ${number}, ${number}, ${number})` | `frames(${number})` | `steps(${number})` | `steps(${number}, ${'jump-start' | 'jump-end' | 'jump-none' | 'jump-both' | 'start' | 'end'})`;
|
|
@@ -3174,6 +3175,7 @@ type SelectApplyRule<Option, Id extends string = string> = {
|
|
|
3174
3175
|
Component?: SelectApplyRuleComponent<Option>;
|
|
3175
3176
|
};
|
|
3176
3177
|
type SelectApplyRules<T> = readonly SelectApplyRule<T, string>[];
|
|
3178
|
+
type SelectPlacement = 'bottom' | 'top';
|
|
3177
3179
|
type SelectOptionComponent<Option> = react__default.FunctionComponent<{
|
|
3178
3180
|
option: Option;
|
|
3179
3181
|
isActive: boolean;
|
|
@@ -3195,6 +3197,13 @@ type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
3195
3197
|
viewMode?: boolean;
|
|
3196
3198
|
borderless?: boolean;
|
|
3197
3199
|
paddingless?: boolean;
|
|
3200
|
+
zIndex?: Property.ZIndex;
|
|
3201
|
+
placement?: SelectPlacement;
|
|
3202
|
+
/**
|
|
3203
|
+
* Defines the element used as the visual boundary when resolving the automatic placement.
|
|
3204
|
+
* The viewport is used by default.
|
|
3205
|
+
*/
|
|
3206
|
+
boundRef?: HTMLElement;
|
|
3198
3207
|
/**
|
|
3199
3208
|
* The number of items to render above and below the visible area.
|
|
3200
3209
|
* The default is 2.
|
package/dist/index.js
CHANGED
|
@@ -18974,8 +18974,8 @@ var ProgressBar = ({ type, value, ...props }) => {
|
|
|
18974
18974
|
var ProgressBar_default = ProgressBar;
|
|
18975
18975
|
|
|
18976
18976
|
// src/components/Select/index.tsx
|
|
18977
|
-
var
|
|
18978
|
-
var
|
|
18977
|
+
var import_react81 = __toESM(require("react"));
|
|
18978
|
+
var import_react82 = require("@floating-ui/react");
|
|
18979
18979
|
|
|
18980
18980
|
// src/components/Select/hooks/useAsyncOptions/index.ts
|
|
18981
18981
|
var import_react70 = require("react");
|
|
@@ -19049,11 +19049,15 @@ var useAsyncOptions_default = useAsyncOptions;
|
|
|
19049
19049
|
|
|
19050
19050
|
// src/components/Select/hooks/useFloatingMenu/index.ts
|
|
19051
19051
|
var import_react71 = require("@floating-ui/react");
|
|
19052
|
-
var useFloatingMenu = ({
|
|
19052
|
+
var useFloatingMenu = ({
|
|
19053
|
+
open,
|
|
19054
|
+
onOpenChange,
|
|
19055
|
+
placement = "bottom"
|
|
19056
|
+
}) => {
|
|
19053
19057
|
const floating = (0, import_react71.useFloating)({
|
|
19054
19058
|
open,
|
|
19055
19059
|
onOpenChange,
|
|
19056
|
-
placement:
|
|
19060
|
+
placement: `${placement}-start`,
|
|
19057
19061
|
whileElementsMounted: import_react71.autoUpdate,
|
|
19058
19062
|
middleware: [
|
|
19059
19063
|
(0, import_react71.flip)(),
|
|
@@ -19082,12 +19086,59 @@ var useFloatingMenu = ({ open, onOpenChange }) => {
|
|
|
19082
19086
|
};
|
|
19083
19087
|
var useFloatingMenu_default = useFloatingMenu;
|
|
19084
19088
|
|
|
19085
|
-
// src/components/Select/hooks/
|
|
19089
|
+
// src/components/Select/hooks/useInitialPlacement/index.ts
|
|
19086
19090
|
var import_react72 = require("react");
|
|
19091
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react72.useLayoutEffect : import_react72.useEffect;
|
|
19092
|
+
var resolveSelectPlacement = (triggerRect, context) => {
|
|
19093
|
+
const midpoint = context.top + context.height / 2;
|
|
19094
|
+
return triggerRect.top >= midpoint ? "top" : "bottom";
|
|
19095
|
+
};
|
|
19096
|
+
var useInitialPlacement = (props, referenceNode) => {
|
|
19097
|
+
const [placement, setPlacement] = (0, import_react72.useState)(
|
|
19098
|
+
props.placement ?? "bottom"
|
|
19099
|
+
);
|
|
19100
|
+
const syncPlacement = (0, import_react72.useCallback)(
|
|
19101
|
+
(node) => {
|
|
19102
|
+
if (props.placement !== void 0) {
|
|
19103
|
+
setPlacement(props.placement);
|
|
19104
|
+
return;
|
|
19105
|
+
}
|
|
19106
|
+
if (!node) return;
|
|
19107
|
+
const context = props.boundRef ? props.boundRef.getBoundingClientRect() : {
|
|
19108
|
+
top: 0,
|
|
19109
|
+
height: window.innerHeight
|
|
19110
|
+
};
|
|
19111
|
+
const nextPlacement = resolveSelectPlacement(
|
|
19112
|
+
node.getBoundingClientRect(),
|
|
19113
|
+
context
|
|
19114
|
+
);
|
|
19115
|
+
setPlacement(nextPlacement);
|
|
19116
|
+
},
|
|
19117
|
+
[props.boundRef, props.placement]
|
|
19118
|
+
);
|
|
19119
|
+
useIsomorphicLayoutEffect(() => {
|
|
19120
|
+
syncPlacement(referenceNode);
|
|
19121
|
+
if (props.placement !== void 0 || !referenceNode) return;
|
|
19122
|
+
const onUpdate = () => {
|
|
19123
|
+
syncPlacement(referenceNode);
|
|
19124
|
+
};
|
|
19125
|
+
window.addEventListener("scroll", onUpdate, true);
|
|
19126
|
+
window.addEventListener("resize", onUpdate);
|
|
19127
|
+
return () => {
|
|
19128
|
+
window.removeEventListener("scroll", onUpdate, true);
|
|
19129
|
+
window.removeEventListener("resize", onUpdate);
|
|
19130
|
+
};
|
|
19131
|
+
}, [referenceNode, syncPlacement, props.placement]);
|
|
19132
|
+
return { placement, syncPlacement };
|
|
19133
|
+
};
|
|
19134
|
+
var useInitialPlacement_default = useInitialPlacement;
|
|
19135
|
+
|
|
19136
|
+
// src/components/Select/hooks/useListNavigation/index.ts
|
|
19137
|
+
var import_react73 = require("react");
|
|
19087
19138
|
var INVALID_INDEX = -1;
|
|
19088
19139
|
var useActiveIndex = (itemCount, scrollToIndex) => {
|
|
19089
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
19090
|
-
(0,
|
|
19140
|
+
const [activeIndex, setActiveIndex] = (0, import_react73.useState)(INVALID_INDEX);
|
|
19141
|
+
(0, import_react73.useEffect)(() => {
|
|
19091
19142
|
setActiveIndex((current) => {
|
|
19092
19143
|
if (current >= itemCount) return INVALID_INDEX;
|
|
19093
19144
|
return current;
|
|
@@ -19107,19 +19158,19 @@ var useListNavigation = ({
|
|
|
19107
19158
|
scrollToIndex
|
|
19108
19159
|
}) => {
|
|
19109
19160
|
const [activeIndex, setActiveIndex] = useActiveIndex(itemCount, scrollToIndex);
|
|
19110
|
-
const firstEnabledIndex = (0,
|
|
19161
|
+
const firstEnabledIndex = (0, import_react73.useMemo)(() => {
|
|
19111
19162
|
for (let index = 0; index < itemCount; index += 1) {
|
|
19112
19163
|
if (!isItemDisabled(index)) return index;
|
|
19113
19164
|
}
|
|
19114
19165
|
return INVALID_INDEX;
|
|
19115
19166
|
}, [isItemDisabled, itemCount]);
|
|
19116
|
-
const lastEnabledIndex = (0,
|
|
19167
|
+
const lastEnabledIndex = (0, import_react73.useMemo)(() => {
|
|
19117
19168
|
for (let index = itemCount - 1; index >= 0; index -= 1) {
|
|
19118
19169
|
if (!isItemDisabled(index)) return index;
|
|
19119
19170
|
}
|
|
19120
19171
|
return INVALID_INDEX;
|
|
19121
19172
|
}, [isItemDisabled, itemCount]);
|
|
19122
|
-
const findNextEnabled = (0,
|
|
19173
|
+
const findNextEnabled = (0, import_react73.useCallback)(
|
|
19123
19174
|
(from, direction) => {
|
|
19124
19175
|
let index = from;
|
|
19125
19176
|
while (index >= 0 && index < itemCount) {
|
|
@@ -19130,7 +19181,7 @@ var useListNavigation = ({
|
|
|
19130
19181
|
},
|
|
19131
19182
|
[isItemDisabled, itemCount]
|
|
19132
19183
|
);
|
|
19133
|
-
const onKeyDown = (0,
|
|
19184
|
+
const onKeyDown = (0, import_react73.useCallback)(
|
|
19134
19185
|
(event) => {
|
|
19135
19186
|
if (event.key === "ArrowDown") {
|
|
19136
19187
|
event.preventDefault();
|
|
@@ -19183,13 +19234,13 @@ var useListNavigation = ({
|
|
|
19183
19234
|
var useListNavigation_default = useListNavigation;
|
|
19184
19235
|
|
|
19185
19236
|
// src/components/Select/hooks/useRuleIndex/index.ts
|
|
19186
|
-
var
|
|
19237
|
+
var import_react74 = require("react");
|
|
19187
19238
|
var useRuleIndex = ({
|
|
19188
19239
|
options,
|
|
19189
19240
|
getKey,
|
|
19190
19241
|
rules
|
|
19191
19242
|
}) => {
|
|
19192
|
-
const failedRuleByKey = (0,
|
|
19243
|
+
const failedRuleByKey = (0, import_react74.useMemo)(() => {
|
|
19193
19244
|
const failedRuleByKey2 = /* @__PURE__ */ new Map();
|
|
19194
19245
|
options.forEach((option) => {
|
|
19195
19246
|
const key = getKey(option);
|
|
@@ -19200,7 +19251,7 @@ var useRuleIndex = ({
|
|
|
19200
19251
|
});
|
|
19201
19252
|
return failedRuleByKey2;
|
|
19202
19253
|
}, [getKey, options, rules]);
|
|
19203
|
-
const getFailedRuleByKey = (0,
|
|
19254
|
+
const getFailedRuleByKey = (0, import_react74.useCallback)(
|
|
19204
19255
|
(key) => {
|
|
19205
19256
|
return failedRuleByKey.get(key);
|
|
19206
19257
|
},
|
|
@@ -19214,11 +19265,11 @@ var useRuleIndex = ({
|
|
|
19214
19265
|
var useRuleIndex_default = useRuleIndex;
|
|
19215
19266
|
|
|
19216
19267
|
// src/components/Select/hooks/useVirtualizedOptions/index.ts
|
|
19217
|
-
var
|
|
19268
|
+
var import_react75 = require("react");
|
|
19218
19269
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
19219
19270
|
var useVirtualizedOptions = (params) => {
|
|
19220
19271
|
const { optionsLength, loading, onPaginate, overscan = 2 } = params;
|
|
19221
|
-
const estimateSize = (0,
|
|
19272
|
+
const estimateSize = (0, import_react75.useMemo)(() => {
|
|
19222
19273
|
const estimateSize2 = params.estimateSize;
|
|
19223
19274
|
if (estimateSize2 === void 0) {
|
|
19224
19275
|
return () => 46;
|
|
@@ -19228,8 +19279,8 @@ var useVirtualizedOptions = (params) => {
|
|
|
19228
19279
|
}
|
|
19229
19280
|
return () => estimateSize2;
|
|
19230
19281
|
}, [params.estimateSize]);
|
|
19231
|
-
const listRef = (0,
|
|
19232
|
-
const searchRef = (0,
|
|
19282
|
+
const listRef = (0, import_react75.useRef)(null);
|
|
19283
|
+
const searchRef = (0, import_react75.useRef)(null);
|
|
19233
19284
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
19234
19285
|
count: optionsLength,
|
|
19235
19286
|
getScrollElement: () => listRef.current,
|
|
@@ -19237,14 +19288,14 @@ var useVirtualizedOptions = (params) => {
|
|
|
19237
19288
|
overscan
|
|
19238
19289
|
});
|
|
19239
19290
|
const virtualItems = rowVirtualizer.getVirtualItems();
|
|
19240
|
-
(0,
|
|
19291
|
+
(0, import_react75.useEffect)(() => {
|
|
19241
19292
|
searchRef.current?.focus();
|
|
19242
19293
|
}, [searchRef.current]);
|
|
19243
|
-
const endIndex = (0,
|
|
19294
|
+
const endIndex = (0, import_react75.useMemo)(
|
|
19244
19295
|
() => virtualItems[virtualItems.length - 1]?.index ?? 0,
|
|
19245
19296
|
[virtualItems]
|
|
19246
19297
|
);
|
|
19247
|
-
(0,
|
|
19298
|
+
(0, import_react75.useEffect)(() => {
|
|
19248
19299
|
if (loading || optionsLength < 1) return;
|
|
19249
19300
|
if (endIndex >= optionsLength - 1 - overscan) {
|
|
19250
19301
|
onPaginate();
|
|
@@ -19260,10 +19311,10 @@ var useVirtualizedOptions = (params) => {
|
|
|
19260
19311
|
var useVirtualizedOptions_default = useVirtualizedOptions;
|
|
19261
19312
|
|
|
19262
19313
|
// src/components/Select/instances/multi/index.tsx
|
|
19263
|
-
var
|
|
19314
|
+
var import_react79 = __toESM(require("react"));
|
|
19264
19315
|
|
|
19265
19316
|
// src/components/Select/components/Apply/index.tsx
|
|
19266
|
-
var
|
|
19317
|
+
var import_react76 = require("react");
|
|
19267
19318
|
|
|
19268
19319
|
// src/components/Select/components/Apply/styles.ts
|
|
19269
19320
|
var import_styled_components73 = __toESM(require("styled-components"));
|
|
@@ -19306,8 +19357,8 @@ var Apply = ({
|
|
|
19306
19357
|
onClose,
|
|
19307
19358
|
draft
|
|
19308
19359
|
}) => {
|
|
19309
|
-
const value = (0,
|
|
19310
|
-
const failedApplyRule = (0,
|
|
19360
|
+
const value = (0, import_react76.useMemo)(() => Array.from(draft.values()), [draft]);
|
|
19361
|
+
const failedApplyRule = (0, import_react76.useMemo)(() => {
|
|
19311
19362
|
const rule = applyRules.find((rule2) => !rule2.allow(value));
|
|
19312
19363
|
return rule;
|
|
19313
19364
|
}, [value, applyRules]);
|
|
@@ -19350,7 +19401,7 @@ var Apply = ({
|
|
|
19350
19401
|
var Apply_default = Apply;
|
|
19351
19402
|
|
|
19352
19403
|
// src/components/Select/components/Scroll/index.tsx
|
|
19353
|
-
var
|
|
19404
|
+
var import_react77 = __toESM(require("react"));
|
|
19354
19405
|
|
|
19355
19406
|
// src/components/Select/components/Scroll/styles.ts
|
|
19356
19407
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
@@ -19478,7 +19529,7 @@ var OptionRow = import_styled_components74.default.div`
|
|
|
19478
19529
|
|
|
19479
19530
|
// src/components/Select/components/Scroll/index.tsx
|
|
19480
19531
|
var import_jsx_runtime362 = require("react/jsx-runtime");
|
|
19481
|
-
var Scroll =
|
|
19532
|
+
var Scroll = import_react77.default.forwardRef(
|
|
19482
19533
|
({
|
|
19483
19534
|
menuId,
|
|
19484
19535
|
loading,
|
|
@@ -19568,7 +19619,7 @@ var Scroll = import_react76.default.forwardRef(
|
|
|
19568
19619
|
var Scroll_default = Scroll;
|
|
19569
19620
|
|
|
19570
19621
|
// src/components/Select/components/Search/index.tsx
|
|
19571
|
-
var
|
|
19622
|
+
var import_react78 = __toESM(require("react"));
|
|
19572
19623
|
|
|
19573
19624
|
// src/components/Select/components/Search/styles.ts
|
|
19574
19625
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
@@ -19614,9 +19665,9 @@ var SearchContainer = import_styled_components75.default.div`
|
|
|
19614
19665
|
|
|
19615
19666
|
// src/components/Select/components/Search/index.tsx
|
|
19616
19667
|
var import_jsx_runtime363 = require("react/jsx-runtime");
|
|
19617
|
-
var Search =
|
|
19668
|
+
var Search = import_react78.default.forwardRef(
|
|
19618
19669
|
({ menuId, onKeyDown, value: [value, setValue], activeIndex }, ref) => {
|
|
19619
|
-
const [inputRef, setInputRef] = (0,
|
|
19670
|
+
const [inputRef, setInputRef] = (0, import_react78.useState)(null);
|
|
19620
19671
|
return /* @__PURE__ */ (0, import_jsx_runtime363.jsxs)(SearchContainer, { children: [
|
|
19621
19672
|
/* @__PURE__ */ (0, import_jsx_runtime363.jsx)(
|
|
19622
19673
|
"input",
|
|
@@ -19773,7 +19824,7 @@ var useDraftOptions = (draft, finder) => {
|
|
|
19773
19824
|
debounced: [search]
|
|
19774
19825
|
} = useDebouncedState_default("", () => {
|
|
19775
19826
|
}, SEARCH_DEBOUNCE_MS);
|
|
19776
|
-
const options = (0,
|
|
19827
|
+
const options = (0, import_react79.useMemo)(() => {
|
|
19777
19828
|
const options2 = Array.from(draft.values());
|
|
19778
19829
|
if (!search) return options2;
|
|
19779
19830
|
return finder(search, options2);
|
|
@@ -19786,7 +19837,7 @@ var useDraftOptions = (draft, finder) => {
|
|
|
19786
19837
|
};
|
|
19787
19838
|
};
|
|
19788
19839
|
var useDraft = (value, getKey) => {
|
|
19789
|
-
const [draft, setDraft] = (0,
|
|
19840
|
+
const [draft, setDraft] = (0, import_react79.useState)(() => ({
|
|
19790
19841
|
options: buildMap(value, getKey),
|
|
19791
19842
|
on: false
|
|
19792
19843
|
}));
|
|
@@ -19898,8 +19949,8 @@ var SelectMultiOptions = ({
|
|
|
19898
19949
|
const onUnselectAll = () => {
|
|
19899
19950
|
setDraft(/* @__PURE__ */ new Map([]));
|
|
19900
19951
|
};
|
|
19901
|
-
const getIsSelected = (0,
|
|
19902
|
-
return /* @__PURE__ */ (0, import_jsx_runtime364.jsxs)(
|
|
19952
|
+
const getIsSelected = (0, import_react79.useCallback)((key) => draft.has(key), [draft]);
|
|
19953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime364.jsxs)(import_react79.default.Fragment, { children: [
|
|
19903
19954
|
/* @__PURE__ */ (0, import_jsx_runtime364.jsxs)(Header14, { children: [
|
|
19904
19955
|
/* @__PURE__ */ (0, import_jsx_runtime364.jsxs)(
|
|
19905
19956
|
DraftSwitch,
|
|
@@ -19989,6 +20040,9 @@ var useMultiSelect = ({
|
|
|
19989
20040
|
viewMode,
|
|
19990
20041
|
borderless,
|
|
19991
20042
|
paddingless,
|
|
20043
|
+
zIndex,
|
|
20044
|
+
placement,
|
|
20045
|
+
boundRef,
|
|
19992
20046
|
overscan,
|
|
19993
20047
|
estimateSize,
|
|
19994
20048
|
height,
|
|
@@ -19998,9 +20052,9 @@ var useMultiSelect = ({
|
|
|
19998
20052
|
applyRules,
|
|
19999
20053
|
...buttonProps
|
|
20000
20054
|
}) => {
|
|
20001
|
-
const closedLabel = (0,
|
|
20055
|
+
const closedLabel = (0, import_react79.useMemo)(() => {
|
|
20002
20056
|
if (value.length < 1) {
|
|
20003
|
-
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime364.jsx)(
|
|
20057
|
+
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime364.jsx)(import_react79.default.Fragment, { children: "\xA0" }) : placeholder;
|
|
20004
20058
|
}
|
|
20005
20059
|
return `H\xE1 ${value.length} op\xE7\xF5es selecionadas`;
|
|
20006
20060
|
}, [placeholder, value.length, viewMode]);
|
|
@@ -20015,7 +20069,7 @@ var useMultiSelect = ({
|
|
|
20015
20069
|
var multi_default = useMultiSelect;
|
|
20016
20070
|
|
|
20017
20071
|
// src/components/Select/instances/single/index.tsx
|
|
20018
|
-
var
|
|
20072
|
+
var import_react80 = __toESM(require("react"));
|
|
20019
20073
|
var import_jsx_runtime365 = require("react/jsx-runtime");
|
|
20020
20074
|
var SelectSingleOptions = ({
|
|
20021
20075
|
loader: loader2,
|
|
@@ -20076,11 +20130,11 @@ var SelectSingleOptions = ({
|
|
|
20076
20130
|
onSelect: onToggleByIndex,
|
|
20077
20131
|
scrollToIndex: rowVirtualizer.scrollToIndex
|
|
20078
20132
|
});
|
|
20079
|
-
const getIsSelected = (0,
|
|
20133
|
+
const getIsSelected = (0, import_react80.useCallback)(
|
|
20080
20134
|
(key) => selectedKey === key,
|
|
20081
20135
|
[selectedKey]
|
|
20082
20136
|
);
|
|
20083
|
-
return /* @__PURE__ */ (0, import_jsx_runtime365.jsxs)(
|
|
20137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime365.jsxs)(import_react80.default.Fragment, { children: [
|
|
20084
20138
|
/* @__PURE__ */ (0, import_jsx_runtime365.jsx)(
|
|
20085
20139
|
Search_default2,
|
|
20086
20140
|
{
|
|
@@ -20128,6 +20182,9 @@ var useSingleSelect = ({
|
|
|
20128
20182
|
viewMode,
|
|
20129
20183
|
borderless,
|
|
20130
20184
|
paddingless,
|
|
20185
|
+
zIndex,
|
|
20186
|
+
placement,
|
|
20187
|
+
boundRef,
|
|
20131
20188
|
overscan,
|
|
20132
20189
|
estimateSize,
|
|
20133
20190
|
height,
|
|
@@ -20137,9 +20194,9 @@ var useSingleSelect = ({
|
|
|
20137
20194
|
...buttonProps
|
|
20138
20195
|
}) => {
|
|
20139
20196
|
const ClosedValueComponent = ValueComponent || OptionComponent;
|
|
20140
|
-
const closedLabel = (0,
|
|
20197
|
+
const closedLabel = (0, import_react80.useMemo)(() => {
|
|
20141
20198
|
if (!value) {
|
|
20142
|
-
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime365.jsx)(
|
|
20199
|
+
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime365.jsx)(import_react80.default.Fragment, { children: "\xA0" }) : placeholder;
|
|
20143
20200
|
}
|
|
20144
20201
|
return /* @__PURE__ */ (0, import_jsx_runtime365.jsx)(
|
|
20145
20202
|
ClosedValueComponent,
|
|
@@ -20170,8 +20227,6 @@ var instances_default = useSelect2;
|
|
|
20170
20227
|
// src/components/Select/styles.ts
|
|
20171
20228
|
var import_styled_components77 = __toESM(require("styled-components"));
|
|
20172
20229
|
var FloatingWrapper = import_styled_components77.default.div`
|
|
20173
|
-
z-index: 1000;
|
|
20174
|
-
|
|
20175
20230
|
&,
|
|
20176
20231
|
& > div {
|
|
20177
20232
|
height: var(--height);
|
|
@@ -20337,10 +20392,12 @@ var OptionContainer = import_styled_components77.default.div`
|
|
|
20337
20392
|
|
|
20338
20393
|
// src/components/Select/index.tsx
|
|
20339
20394
|
var import_jsx_runtime366 = require("react/jsx-runtime");
|
|
20340
|
-
var Select2 =
|
|
20395
|
+
var Select2 = import_react81.default.forwardRef(
|
|
20341
20396
|
(props, ref) => {
|
|
20342
|
-
const [open, setOpen] = (0,
|
|
20343
|
-
const
|
|
20397
|
+
const [open, setOpen] = (0, import_react81.useState)(false);
|
|
20398
|
+
const [triggerRef, setTriggerRef] = (0, import_react81.useState)(null);
|
|
20399
|
+
const { placement, syncPlacement } = useInitialPlacement_default(props, triggerRef);
|
|
20400
|
+
const id = props.id || (0, import_react81.useId)();
|
|
20344
20401
|
const { isRequired, isInvalid: isInvalid2, isViewMode, isDisabled } = Form_default.useContext(
|
|
20345
20402
|
props.name
|
|
20346
20403
|
);
|
|
@@ -20350,14 +20407,15 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20350
20407
|
const viewMode = isViewMode() || props.viewMode;
|
|
20351
20408
|
const { floating, transition, interactions } = useFloatingMenu_default({
|
|
20352
20409
|
open,
|
|
20353
|
-
onOpenChange: setOpen
|
|
20410
|
+
onOpenChange: setOpen,
|
|
20411
|
+
placement
|
|
20354
20412
|
});
|
|
20355
|
-
const height = (0,
|
|
20413
|
+
const height = (0, import_react81.useMemo)(() => {
|
|
20356
20414
|
if (transition.status !== "open") return 0;
|
|
20357
20415
|
if (props.height !== void 0) return props.height;
|
|
20358
20416
|
return props.type === "single-select" ? 240 : 260;
|
|
20359
20417
|
}, [transition.status !== "open", props.type, props.height]);
|
|
20360
|
-
const menuId = (0,
|
|
20418
|
+
const menuId = (0, import_react81.useId)();
|
|
20361
20419
|
const onTriggerKeyDown = (event) => {
|
|
20362
20420
|
if (!open && ["ArrowDown", "ArrowUp", "Enter", " "].includes(event.key)) {
|
|
20363
20421
|
event.preventDefault();
|
|
@@ -20366,7 +20424,20 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20366
20424
|
};
|
|
20367
20425
|
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20368
20426
|
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20369
|
-
|
|
20427
|
+
const setRef = (0, import_react81.useCallback)(
|
|
20428
|
+
(node) => {
|
|
20429
|
+
floating.refs.setReference(node);
|
|
20430
|
+
setTriggerRef(node);
|
|
20431
|
+
syncPlacement(node);
|
|
20432
|
+
if (typeof ref === "function") {
|
|
20433
|
+
ref(node);
|
|
20434
|
+
} else if (ref) {
|
|
20435
|
+
ref.current = node;
|
|
20436
|
+
}
|
|
20437
|
+
},
|
|
20438
|
+
[floating.refs.setReference, ref, syncPlacement]
|
|
20439
|
+
);
|
|
20440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime366.jsxs)(import_react81.default.Fragment, { children: [
|
|
20370
20441
|
props.label !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(Label11, { htmlFor: id, $viewMode: viewMode, children: props.label }),
|
|
20371
20442
|
/* @__PURE__ */ (0, import_jsx_runtime366.jsxs)(
|
|
20372
20443
|
Trigger,
|
|
@@ -20399,14 +20470,7 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20399
20470
|
buttonProps.onKeyDown?.(event);
|
|
20400
20471
|
}
|
|
20401
20472
|
}),
|
|
20402
|
-
ref:
|
|
20403
|
-
floating.refs.setReference(node);
|
|
20404
|
-
if (typeof ref === "function") {
|
|
20405
|
-
ref(node);
|
|
20406
|
-
} else if (ref) {
|
|
20407
|
-
ref.current = node;
|
|
20408
|
-
}
|
|
20409
|
-
},
|
|
20473
|
+
ref: setRef,
|
|
20410
20474
|
children: [
|
|
20411
20475
|
/* @__PURE__ */ (0, import_jsx_runtime366.jsx)(TriggerValue, { children: placeholder }),
|
|
20412
20476
|
!viewMode && /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
@@ -20431,13 +20495,14 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20431
20495
|
]
|
|
20432
20496
|
}
|
|
20433
20497
|
),
|
|
20434
|
-
transition.isMounted ? /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
20498
|
+
transition.isMounted ? /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(import_react82.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
20435
20499
|
FloatingWrapper,
|
|
20436
20500
|
{
|
|
20437
20501
|
ref: floating.refs.setFloating,
|
|
20438
20502
|
style: {
|
|
20439
20503
|
...floating.floatingStyles,
|
|
20440
|
-
"--height": `${height}px
|
|
20504
|
+
"--height": `${height}px`,
|
|
20505
|
+
zIndex: props.zIndex !== void 0 ? props.zIndex : 1e3
|
|
20441
20506
|
},
|
|
20442
20507
|
...interactions.getFloatingProps(),
|
|
20443
20508
|
children: /* @__PURE__ */ (0, import_jsx_runtime366.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
@@ -20458,7 +20523,7 @@ var Select_default3 = Object.assign(Select2, {
|
|
|
20458
20523
|
});
|
|
20459
20524
|
|
|
20460
20525
|
// src/components/Signature/index.tsx
|
|
20461
|
-
var
|
|
20526
|
+
var import_react83 = require("react");
|
|
20462
20527
|
var import_react_signature_canvas = __toESM(require("react-signature-canvas"));
|
|
20463
20528
|
|
|
20464
20529
|
// src/components/Signature/styles.ts
|
|
@@ -20564,12 +20629,12 @@ var SignatureInput = ({
|
|
|
20564
20629
|
onEnd = voidFn,
|
|
20565
20630
|
...props
|
|
20566
20631
|
}) => {
|
|
20567
|
-
const [name, setName] = (0,
|
|
20568
|
-
const [font, setFont] = (0,
|
|
20569
|
-
const [showPlaceholder, setShowPlaceholder] = (0,
|
|
20570
|
-
const [loading, setLoading] = (0,
|
|
20571
|
-
const [ref, setRef] = (0,
|
|
20572
|
-
(0,
|
|
20632
|
+
const [name, setName] = (0, import_react83.useState)("");
|
|
20633
|
+
const [font, setFont] = (0, import_react83.useState)(FONTS[0]);
|
|
20634
|
+
const [showPlaceholder, setShowPlaceholder] = (0, import_react83.useState)(true);
|
|
20635
|
+
const [loading, setLoading] = (0, import_react83.useState)(false);
|
|
20636
|
+
const [ref, setRef] = (0, import_react83.useState)(null);
|
|
20637
|
+
(0, import_react83.useEffect)(() => {
|
|
20573
20638
|
if (!ref) return;
|
|
20574
20639
|
const refreshValue = () => {
|
|
20575
20640
|
if (ref.isEmpty() && !value) return;
|
|
@@ -20582,7 +20647,7 @@ var SignatureInput = ({
|
|
|
20582
20647
|
window.addEventListener("resize", refreshValue);
|
|
20583
20648
|
return () => window.removeEventListener("resize", refreshValue);
|
|
20584
20649
|
}, [ref, value]);
|
|
20585
|
-
const setByText = (0,
|
|
20650
|
+
const setByText = (0, import_react83.useCallback)(
|
|
20586
20651
|
async (name2, font2) => {
|
|
20587
20652
|
if (!ref) return;
|
|
20588
20653
|
const trimmed = name2.trim();
|
|
@@ -20611,14 +20676,14 @@ var SignatureInput = ({
|
|
|
20611
20676
|
},
|
|
20612
20677
|
[ref]
|
|
20613
20678
|
);
|
|
20614
|
-
const onBeginHandler = (0,
|
|
20679
|
+
const onBeginHandler = (0, import_react83.useCallback)(
|
|
20615
20680
|
(event) => {
|
|
20616
20681
|
onBegin(event, ref);
|
|
20617
20682
|
setShowPlaceholder(false);
|
|
20618
20683
|
},
|
|
20619
20684
|
[ref, onBegin]
|
|
20620
20685
|
);
|
|
20621
|
-
const onEndHandler = (0,
|
|
20686
|
+
const onEndHandler = (0, import_react83.useCallback)(
|
|
20622
20687
|
(event) => {
|
|
20623
20688
|
onEnd(event, ref);
|
|
20624
20689
|
if (!ref || ref.isEmpty()) return;
|
|
@@ -20626,17 +20691,17 @@ var SignatureInput = ({
|
|
|
20626
20691
|
},
|
|
20627
20692
|
[ref, onEnd]
|
|
20628
20693
|
);
|
|
20629
|
-
const onApplyHandler = (0,
|
|
20694
|
+
const onApplyHandler = (0, import_react83.useCallback)(() => {
|
|
20630
20695
|
setByText(name, font);
|
|
20631
20696
|
}, [name, font, setByText]);
|
|
20632
|
-
const onClearHandler = (0,
|
|
20697
|
+
const onClearHandler = (0, import_react83.useCallback)(() => {
|
|
20633
20698
|
if (!ref) return;
|
|
20634
20699
|
setShowPlaceholder(true);
|
|
20635
20700
|
setName("");
|
|
20636
20701
|
ref.clear();
|
|
20637
20702
|
setValue("");
|
|
20638
20703
|
}, [ref]);
|
|
20639
|
-
const empty = (0,
|
|
20704
|
+
const empty = (0, import_react83.useMemo)(() => !value && (!ref || ref.isEmpty()), [ref, value]);
|
|
20640
20705
|
return /* @__PURE__ */ (0, import_jsx_runtime367.jsxs)(Container26, { children: [
|
|
20641
20706
|
/* @__PURE__ */ (0, import_jsx_runtime367.jsx)(
|
|
20642
20707
|
Input_default,
|
|
@@ -20720,13 +20785,13 @@ var SignatureInput = ({
|
|
|
20720
20785
|
var Signature_default = SignatureInput;
|
|
20721
20786
|
|
|
20722
20787
|
// src/components/Tabs/index.tsx
|
|
20723
|
-
var
|
|
20788
|
+
var import_react89 = __toESM(require("react"));
|
|
20724
20789
|
|
|
20725
20790
|
// src/components/Tabs/components/ScrollButtons/index.tsx
|
|
20726
|
-
var
|
|
20791
|
+
var import_react85 = __toESM(require("react"));
|
|
20727
20792
|
|
|
20728
20793
|
// src/components/Tabs/components/ScrollButton/index.tsx
|
|
20729
|
-
var
|
|
20794
|
+
var import_react84 = require("react");
|
|
20730
20795
|
|
|
20731
20796
|
// src/components/Tabs/components/ScrollButton/styled.ts
|
|
20732
20797
|
var import_styled_components79 = __toESM(require("styled-components"));
|
|
@@ -20757,7 +20822,7 @@ var import_jsx_runtime368 = require("react/jsx-runtime");
|
|
|
20757
20822
|
var ScrollButton = (props) => {
|
|
20758
20823
|
const { mode, visible, scrollRef } = props;
|
|
20759
20824
|
const icon = `chevron_${mode}`;
|
|
20760
|
-
const onClick = (0,
|
|
20825
|
+
const onClick = (0, import_react84.useCallback)(() => {
|
|
20761
20826
|
if (!scrollRef) return;
|
|
20762
20827
|
scrollRef.scrollBy({
|
|
20763
20828
|
left: mode === "left" ? -(scrollRef.scrollWidth + 1) : scrollRef.scrollWidth,
|
|
@@ -20810,10 +20875,10 @@ var Container28 = import_styled_components80.default.div`
|
|
|
20810
20875
|
var import_jsx_runtime369 = require("react/jsx-runtime");
|
|
20811
20876
|
var ScrollButtons = (props) => {
|
|
20812
20877
|
const { activeTabIndex, tabsLength } = props;
|
|
20813
|
-
const [ref, setRef] = (0,
|
|
20814
|
-
const [showLeftArrow, setShowLeftArrow] = (0,
|
|
20815
|
-
const [showRightArrow, setShowRightArrow] = (0,
|
|
20816
|
-
const checkScrollPosition = (0,
|
|
20878
|
+
const [ref, setRef] = (0, import_react85.useState)(null);
|
|
20879
|
+
const [showLeftArrow, setShowLeftArrow] = (0, import_react85.useState)(false);
|
|
20880
|
+
const [showRightArrow, setShowRightArrow] = (0, import_react85.useState)(false);
|
|
20881
|
+
const checkScrollPosition = (0, import_react85.useCallback)(() => {
|
|
20817
20882
|
if (!ref) return;
|
|
20818
20883
|
if (ref.scrollWidth > ref.offsetWidth) {
|
|
20819
20884
|
const { scrollLeft, scrollWidth, clientWidth } = ref;
|
|
@@ -20824,12 +20889,12 @@ var ScrollButtons = (props) => {
|
|
|
20824
20889
|
setShowRightArrow(false);
|
|
20825
20890
|
}
|
|
20826
20891
|
}, [ref]);
|
|
20827
|
-
(0,
|
|
20892
|
+
(0, import_react85.useEffect)(() => {
|
|
20828
20893
|
checkScrollPosition();
|
|
20829
20894
|
window.addEventListener("resize", checkScrollPosition);
|
|
20830
20895
|
return () => window.removeEventListener("resize", checkScrollPosition);
|
|
20831
20896
|
}, [checkScrollPosition, tabsLength]);
|
|
20832
|
-
(0,
|
|
20897
|
+
(0, import_react85.useEffect)(() => {
|
|
20833
20898
|
if (!ref) return;
|
|
20834
20899
|
if (ref.scrollWidth <= ref.offsetWidth) return;
|
|
20835
20900
|
const element = ref.children[activeTabIndex];
|
|
@@ -20839,7 +20904,7 @@ var ScrollButtons = (props) => {
|
|
|
20839
20904
|
inline: "nearest"
|
|
20840
20905
|
});
|
|
20841
20906
|
}, [activeTabIndex, ref]);
|
|
20842
|
-
return /* @__PURE__ */ (0, import_jsx_runtime369.jsxs)(
|
|
20907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime369.jsxs)(import_react85.default.Fragment, { children: [
|
|
20843
20908
|
/* @__PURE__ */ (0, import_jsx_runtime369.jsx)(ScrollButton_default, { scrollRef: ref, mode: "left", visible: showLeftArrow }),
|
|
20844
20909
|
/* @__PURE__ */ (0, import_jsx_runtime369.jsx)(
|
|
20845
20910
|
Container28,
|
|
@@ -20862,7 +20927,7 @@ var ScrollButtons = (props) => {
|
|
|
20862
20927
|
var ScrollButtons_default = ScrollButtons;
|
|
20863
20928
|
|
|
20864
20929
|
// src/components/Tabs/components/TabItem/index.tsx
|
|
20865
|
-
var
|
|
20930
|
+
var import_react88 = __toESM(require("react"));
|
|
20866
20931
|
|
|
20867
20932
|
// src/components/Tabs/functions.ts
|
|
20868
20933
|
var sortTabs = (tabs, sorted = []) => {
|
|
@@ -20910,7 +20975,7 @@ var buildComponent = (component, provider) => {
|
|
|
20910
20975
|
};
|
|
20911
20976
|
|
|
20912
20977
|
// src/components/Tabs/components/TabItem/components/Close/index.tsx
|
|
20913
|
-
var
|
|
20978
|
+
var import_react86 = require("react");
|
|
20914
20979
|
|
|
20915
20980
|
// src/components/Tabs/components/TabItem/components/Close/styles.ts
|
|
20916
20981
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
@@ -20948,7 +21013,7 @@ var Close2 = (props) => {
|
|
|
20948
21013
|
options: [options, setOptions]
|
|
20949
21014
|
} = props;
|
|
20950
21015
|
const onClose = props.onClose || (() => true);
|
|
20951
|
-
const onClickClose = (0,
|
|
21016
|
+
const onClickClose = (0, import_react86.useCallback)(
|
|
20952
21017
|
async (event) => {
|
|
20953
21018
|
if (options.length === 1) return;
|
|
20954
21019
|
const newOptions = [...options];
|
|
@@ -20977,7 +21042,7 @@ var Close2 = (props) => {
|
|
|
20977
21042
|
var Close_default = Close2;
|
|
20978
21043
|
|
|
20979
21044
|
// src/components/Tabs/components/TabItem/components/LabelItem/index.tsx
|
|
20980
|
-
var
|
|
21045
|
+
var import_react87 = require("react");
|
|
20981
21046
|
|
|
20982
21047
|
// src/components/Tabs/components/TabItem/components/LabelItem/styled.ts
|
|
20983
21048
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
@@ -21035,7 +21100,7 @@ var StyledTab = import_styled_components82.default.div`
|
|
|
21035
21100
|
var import_jsx_runtime371 = require("react/jsx-runtime");
|
|
21036
21101
|
var LabelItem = (props) => {
|
|
21037
21102
|
const { children, onClick, primary, hasSiblings, internal } = props;
|
|
21038
|
-
const [ref, setRef] = (0,
|
|
21103
|
+
const [ref, setRef] = (0, import_react87.useState)(null);
|
|
21039
21104
|
return /* @__PURE__ */ (0, import_jsx_runtime371.jsx)(
|
|
21040
21105
|
StyledTab,
|
|
21041
21106
|
{
|
|
@@ -21091,7 +21156,7 @@ var Container29 = import_styled_components83.default.div`
|
|
|
21091
21156
|
|
|
21092
21157
|
// src/components/Tabs/components/TabItem/index.tsx
|
|
21093
21158
|
var import_jsx_runtime372 = require("react/jsx-runtime");
|
|
21094
|
-
var VoidClose = () => /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(
|
|
21159
|
+
var VoidClose = () => /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(import_react88.default.Fragment, {});
|
|
21095
21160
|
var TabItem = (props) => {
|
|
21096
21161
|
const {
|
|
21097
21162
|
active: [active, setActive],
|
|
@@ -21101,7 +21166,7 @@ var TabItem = (props) => {
|
|
|
21101
21166
|
alwaysOpen
|
|
21102
21167
|
} = props;
|
|
21103
21168
|
const CloseComponent = alwaysOpen || tabs.length < 2 ? VoidClose : Close_default;
|
|
21104
|
-
return /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(
|
|
21169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(import_react88.default.Fragment, { children: sortedTabs.map(({ index, ...tab }) => {
|
|
21105
21170
|
const isActive = index === active;
|
|
21106
21171
|
const hasSiblings = hasChildren(tabs, tab.group);
|
|
21107
21172
|
const canClose = !props.internal && (!tab.primary || !hasSiblings);
|
|
@@ -21197,11 +21262,11 @@ var Tabs = import_styled_components84.default.div`
|
|
|
21197
21262
|
|
|
21198
21263
|
// src/components/Tabs/index.tsx
|
|
21199
21264
|
var import_jsx_runtime373 = require("react/jsx-runtime");
|
|
21200
|
-
var VoidProvider = (props) => /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(
|
|
21265
|
+
var VoidProvider = (props) => /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(import_react89.default.Fragment, { children: props.children });
|
|
21201
21266
|
var Component4 = (props) => {
|
|
21202
21267
|
const components = props.components || {};
|
|
21203
|
-
const [options, setOptions] = typeof props.options[1] === "function" ? props.options : (0,
|
|
21204
|
-
const [active, setActive] = Array.isArray(props.active) ? props.active : (0,
|
|
21268
|
+
const [options, setOptions] = typeof props.options[1] === "function" ? props.options : (0, import_react89.useState)(props.options);
|
|
21269
|
+
const [active, setActive] = Array.isArray(props.active) ? props.active : (0, import_react89.useState)(props.active);
|
|
21205
21270
|
const sortedTabs = sortTabs(options.map((tab, index) => ({ ...tab, index })));
|
|
21206
21271
|
const activeTabIndex = sortedTabs.findIndex((tab) => tab.index === active);
|
|
21207
21272
|
const divProps = filterObject(props, [
|
|
@@ -21215,7 +21280,7 @@ var Component4 = (props) => {
|
|
|
21215
21280
|
"delimiter",
|
|
21216
21281
|
"spacing"
|
|
21217
21282
|
]);
|
|
21218
|
-
return /* @__PURE__ */ (0, import_jsx_runtime373.jsxs)(
|
|
21283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime373.jsxs)(import_react89.default.Fragment, { children: [
|
|
21219
21284
|
/* @__PURE__ */ (0, import_jsx_runtime373.jsx)(
|
|
21220
21285
|
Tabs,
|
|
21221
21286
|
{
|
|
@@ -21248,7 +21313,7 @@ var Component4 = (props) => {
|
|
|
21248
21313
|
),
|
|
21249
21314
|
options.map((tab, index) => {
|
|
21250
21315
|
if (tab.component === void 0) {
|
|
21251
|
-
return /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(
|
|
21316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(import_react89.default.Fragment, {}, index);
|
|
21252
21317
|
}
|
|
21253
21318
|
const Component5 = components[tab.component];
|
|
21254
21319
|
const Provider7 = Component5.provider || VoidProvider;
|
|
@@ -21426,7 +21491,7 @@ var Toast = ({
|
|
|
21426
21491
|
var Toast_default = Toast;
|
|
21427
21492
|
|
|
21428
21493
|
// src/components/Zoom/index.tsx
|
|
21429
|
-
var
|
|
21494
|
+
var import_react90 = __toESM(require("react"));
|
|
21430
21495
|
|
|
21431
21496
|
// src/components/Zoom/styles.ts
|
|
21432
21497
|
var import_styled_components87 = __toESM(require("styled-components"));
|
|
@@ -21501,8 +21566,8 @@ var ModalContent = import_styled_components87.default.div`
|
|
|
21501
21566
|
var import_jsx_runtime376 = require("react/jsx-runtime");
|
|
21502
21567
|
var Zoom = (props) => {
|
|
21503
21568
|
const { src, width, height, ...imgProps } = props;
|
|
21504
|
-
const [modalOpened, setModalOpened] = (0,
|
|
21505
|
-
return /* @__PURE__ */ (0, import_jsx_runtime376.jsxs)(
|
|
21569
|
+
const [modalOpened, setModalOpened] = (0, import_react90.useState)(false);
|
|
21570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime376.jsxs)(import_react90.default.Fragment, { children: [
|
|
21506
21571
|
/* @__PURE__ */ (0, import_jsx_runtime376.jsxs)(
|
|
21507
21572
|
Container32,
|
|
21508
21573
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -18927,7 +18927,7 @@ var ProgressBar = ({ type, value, ...props }) => {
|
|
|
18927
18927
|
var ProgressBar_default = ProgressBar;
|
|
18928
18928
|
|
|
18929
18929
|
// src/components/Select/index.tsx
|
|
18930
|
-
import React348, { useId, useMemo as useMemo13, useState as
|
|
18930
|
+
import React348, { useCallback as useCallback12, useId, useMemo as useMemo13, useState as useState31 } from "react";
|
|
18931
18931
|
import { FloatingPortal as FloatingPortal2 } from "@floating-ui/react";
|
|
18932
18932
|
|
|
18933
18933
|
// src/components/Select/hooks/useAsyncOptions/index.ts
|
|
@@ -19010,11 +19010,15 @@ import {
|
|
|
19010
19010
|
useInteractions as useInteractions2,
|
|
19011
19011
|
useTransitionStatus
|
|
19012
19012
|
} from "@floating-ui/react";
|
|
19013
|
-
var useFloatingMenu = ({
|
|
19013
|
+
var useFloatingMenu = ({
|
|
19014
|
+
open,
|
|
19015
|
+
onOpenChange,
|
|
19016
|
+
placement = "bottom"
|
|
19017
|
+
}) => {
|
|
19014
19018
|
const floating = useFloating2({
|
|
19015
19019
|
open,
|
|
19016
19020
|
onOpenChange,
|
|
19017
|
-
placement:
|
|
19021
|
+
placement: `${placement}-start`,
|
|
19018
19022
|
whileElementsMounted: autoUpdate2,
|
|
19019
19023
|
middleware: [
|
|
19020
19024
|
flip2(),
|
|
@@ -19043,12 +19047,59 @@ var useFloatingMenu = ({ open, onOpenChange }) => {
|
|
|
19043
19047
|
};
|
|
19044
19048
|
var useFloatingMenu_default = useFloatingMenu;
|
|
19045
19049
|
|
|
19050
|
+
// src/components/Select/hooks/useInitialPlacement/index.ts
|
|
19051
|
+
import { useCallback as useCallback7, useEffect as useEffect23, useLayoutEffect, useState as useState27 } from "react";
|
|
19052
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect23;
|
|
19053
|
+
var resolveSelectPlacement = (triggerRect, context) => {
|
|
19054
|
+
const midpoint = context.top + context.height / 2;
|
|
19055
|
+
return triggerRect.top >= midpoint ? "top" : "bottom";
|
|
19056
|
+
};
|
|
19057
|
+
var useInitialPlacement = (props, referenceNode) => {
|
|
19058
|
+
const [placement, setPlacement] = useState27(
|
|
19059
|
+
props.placement ?? "bottom"
|
|
19060
|
+
);
|
|
19061
|
+
const syncPlacement = useCallback7(
|
|
19062
|
+
(node) => {
|
|
19063
|
+
if (props.placement !== void 0) {
|
|
19064
|
+
setPlacement(props.placement);
|
|
19065
|
+
return;
|
|
19066
|
+
}
|
|
19067
|
+
if (!node) return;
|
|
19068
|
+
const context = props.boundRef ? props.boundRef.getBoundingClientRect() : {
|
|
19069
|
+
top: 0,
|
|
19070
|
+
height: window.innerHeight
|
|
19071
|
+
};
|
|
19072
|
+
const nextPlacement = resolveSelectPlacement(
|
|
19073
|
+
node.getBoundingClientRect(),
|
|
19074
|
+
context
|
|
19075
|
+
);
|
|
19076
|
+
setPlacement(nextPlacement);
|
|
19077
|
+
},
|
|
19078
|
+
[props.boundRef, props.placement]
|
|
19079
|
+
);
|
|
19080
|
+
useIsomorphicLayoutEffect(() => {
|
|
19081
|
+
syncPlacement(referenceNode);
|
|
19082
|
+
if (props.placement !== void 0 || !referenceNode) return;
|
|
19083
|
+
const onUpdate = () => {
|
|
19084
|
+
syncPlacement(referenceNode);
|
|
19085
|
+
};
|
|
19086
|
+
window.addEventListener("scroll", onUpdate, true);
|
|
19087
|
+
window.addEventListener("resize", onUpdate);
|
|
19088
|
+
return () => {
|
|
19089
|
+
window.removeEventListener("scroll", onUpdate, true);
|
|
19090
|
+
window.removeEventListener("resize", onUpdate);
|
|
19091
|
+
};
|
|
19092
|
+
}, [referenceNode, syncPlacement, props.placement]);
|
|
19093
|
+
return { placement, syncPlacement };
|
|
19094
|
+
};
|
|
19095
|
+
var useInitialPlacement_default = useInitialPlacement;
|
|
19096
|
+
|
|
19046
19097
|
// src/components/Select/hooks/useListNavigation/index.ts
|
|
19047
|
-
import { useCallback as
|
|
19098
|
+
import { useCallback as useCallback8, useEffect as useEffect24, useMemo as useMemo7, useState as useState28 } from "react";
|
|
19048
19099
|
var INVALID_INDEX = -1;
|
|
19049
19100
|
var useActiveIndex = (itemCount, scrollToIndex) => {
|
|
19050
|
-
const [activeIndex, setActiveIndex] =
|
|
19051
|
-
|
|
19101
|
+
const [activeIndex, setActiveIndex] = useState28(INVALID_INDEX);
|
|
19102
|
+
useEffect24(() => {
|
|
19052
19103
|
setActiveIndex((current) => {
|
|
19053
19104
|
if (current >= itemCount) return INVALID_INDEX;
|
|
19054
19105
|
return current;
|
|
@@ -19080,7 +19131,7 @@ var useListNavigation = ({
|
|
|
19080
19131
|
}
|
|
19081
19132
|
return INVALID_INDEX;
|
|
19082
19133
|
}, [isItemDisabled, itemCount]);
|
|
19083
|
-
const findNextEnabled =
|
|
19134
|
+
const findNextEnabled = useCallback8(
|
|
19084
19135
|
(from, direction) => {
|
|
19085
19136
|
let index = from;
|
|
19086
19137
|
while (index >= 0 && index < itemCount) {
|
|
@@ -19091,7 +19142,7 @@ var useListNavigation = ({
|
|
|
19091
19142
|
},
|
|
19092
19143
|
[isItemDisabled, itemCount]
|
|
19093
19144
|
);
|
|
19094
|
-
const onKeyDown =
|
|
19145
|
+
const onKeyDown = useCallback8(
|
|
19095
19146
|
(event) => {
|
|
19096
19147
|
if (event.key === "ArrowDown") {
|
|
19097
19148
|
event.preventDefault();
|
|
@@ -19144,7 +19195,7 @@ var useListNavigation = ({
|
|
|
19144
19195
|
var useListNavigation_default = useListNavigation;
|
|
19145
19196
|
|
|
19146
19197
|
// src/components/Select/hooks/useRuleIndex/index.ts
|
|
19147
|
-
import { useCallback as
|
|
19198
|
+
import { useCallback as useCallback9, useMemo as useMemo8 } from "react";
|
|
19148
19199
|
var useRuleIndex = ({
|
|
19149
19200
|
options,
|
|
19150
19201
|
getKey,
|
|
@@ -19161,7 +19212,7 @@ var useRuleIndex = ({
|
|
|
19161
19212
|
});
|
|
19162
19213
|
return failedRuleByKey2;
|
|
19163
19214
|
}, [getKey, options, rules]);
|
|
19164
|
-
const getFailedRuleByKey =
|
|
19215
|
+
const getFailedRuleByKey = useCallback9(
|
|
19165
19216
|
(key) => {
|
|
19166
19217
|
return failedRuleByKey.get(key);
|
|
19167
19218
|
},
|
|
@@ -19175,7 +19226,7 @@ var useRuleIndex = ({
|
|
|
19175
19226
|
var useRuleIndex_default = useRuleIndex;
|
|
19176
19227
|
|
|
19177
19228
|
// src/components/Select/hooks/useVirtualizedOptions/index.ts
|
|
19178
|
-
import { useEffect as
|
|
19229
|
+
import { useEffect as useEffect25, useMemo as useMemo9, useRef as useRef4 } from "react";
|
|
19179
19230
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
19180
19231
|
var useVirtualizedOptions = (params) => {
|
|
19181
19232
|
const { optionsLength, loading, onPaginate, overscan = 2 } = params;
|
|
@@ -19198,14 +19249,14 @@ var useVirtualizedOptions = (params) => {
|
|
|
19198
19249
|
overscan
|
|
19199
19250
|
});
|
|
19200
19251
|
const virtualItems = rowVirtualizer.getVirtualItems();
|
|
19201
|
-
|
|
19252
|
+
useEffect25(() => {
|
|
19202
19253
|
searchRef.current?.focus();
|
|
19203
19254
|
}, [searchRef.current]);
|
|
19204
19255
|
const endIndex = useMemo9(
|
|
19205
19256
|
() => virtualItems[virtualItems.length - 1]?.index ?? 0,
|
|
19206
19257
|
[virtualItems]
|
|
19207
19258
|
);
|
|
19208
|
-
|
|
19259
|
+
useEffect25(() => {
|
|
19209
19260
|
if (loading || optionsLength < 1) return;
|
|
19210
19261
|
if (endIndex >= optionsLength - 1 - overscan) {
|
|
19211
19262
|
onPaginate();
|
|
@@ -19221,7 +19272,7 @@ var useVirtualizedOptions = (params) => {
|
|
|
19221
19272
|
var useVirtualizedOptions_default = useVirtualizedOptions;
|
|
19222
19273
|
|
|
19223
19274
|
// src/components/Select/instances/multi/index.tsx
|
|
19224
|
-
import React346, { useCallback as
|
|
19275
|
+
import React346, { useCallback as useCallback10, useMemo as useMemo11, useState as useState30 } from "react";
|
|
19225
19276
|
|
|
19226
19277
|
// src/components/Select/components/Apply/index.tsx
|
|
19227
19278
|
import { useMemo as useMemo10 } from "react";
|
|
@@ -19529,7 +19580,7 @@ var Scroll = React344.forwardRef(
|
|
|
19529
19580
|
var Scroll_default = Scroll;
|
|
19530
19581
|
|
|
19531
19582
|
// src/components/Select/components/Search/index.tsx
|
|
19532
|
-
import React345, { useState as
|
|
19583
|
+
import React345, { useState as useState29 } from "react";
|
|
19533
19584
|
|
|
19534
19585
|
// src/components/Select/components/Search/styles.ts
|
|
19535
19586
|
import styled72 from "styled-components";
|
|
@@ -19577,7 +19628,7 @@ var SearchContainer = styled72.div`
|
|
|
19577
19628
|
import { jsx as jsx363, jsxs as jsxs185 } from "react/jsx-runtime";
|
|
19578
19629
|
var Search = React345.forwardRef(
|
|
19579
19630
|
({ menuId, onKeyDown, value: [value, setValue], activeIndex }, ref) => {
|
|
19580
|
-
const [inputRef, setInputRef] =
|
|
19631
|
+
const [inputRef, setInputRef] = useState29(null);
|
|
19581
19632
|
return /* @__PURE__ */ jsxs185(SearchContainer, { children: [
|
|
19582
19633
|
/* @__PURE__ */ jsx363(
|
|
19583
19634
|
"input",
|
|
@@ -19747,7 +19798,7 @@ var useDraftOptions = (draft, finder) => {
|
|
|
19747
19798
|
};
|
|
19748
19799
|
};
|
|
19749
19800
|
var useDraft = (value, getKey) => {
|
|
19750
|
-
const [draft, setDraft] =
|
|
19801
|
+
const [draft, setDraft] = useState30(() => ({
|
|
19751
19802
|
options: buildMap(value, getKey),
|
|
19752
19803
|
on: false
|
|
19753
19804
|
}));
|
|
@@ -19859,7 +19910,7 @@ var SelectMultiOptions = ({
|
|
|
19859
19910
|
const onUnselectAll = () => {
|
|
19860
19911
|
setDraft(/* @__PURE__ */ new Map([]));
|
|
19861
19912
|
};
|
|
19862
|
-
const getIsSelected =
|
|
19913
|
+
const getIsSelected = useCallback10((key) => draft.has(key), [draft]);
|
|
19863
19914
|
return /* @__PURE__ */ jsxs186(React346.Fragment, { children: [
|
|
19864
19915
|
/* @__PURE__ */ jsxs186(Header14, { children: [
|
|
19865
19916
|
/* @__PURE__ */ jsxs186(
|
|
@@ -19950,6 +20001,9 @@ var useMultiSelect = ({
|
|
|
19950
20001
|
viewMode,
|
|
19951
20002
|
borderless,
|
|
19952
20003
|
paddingless,
|
|
20004
|
+
zIndex,
|
|
20005
|
+
placement,
|
|
20006
|
+
boundRef,
|
|
19953
20007
|
overscan,
|
|
19954
20008
|
estimateSize,
|
|
19955
20009
|
height,
|
|
@@ -19976,7 +20030,7 @@ var useMultiSelect = ({
|
|
|
19976
20030
|
var multi_default = useMultiSelect;
|
|
19977
20031
|
|
|
19978
20032
|
// src/components/Select/instances/single/index.tsx
|
|
19979
|
-
import React347, { useCallback as
|
|
20033
|
+
import React347, { useCallback as useCallback11, useMemo as useMemo12 } from "react";
|
|
19980
20034
|
import { jsx as jsx365, jsxs as jsxs187 } from "react/jsx-runtime";
|
|
19981
20035
|
var SelectSingleOptions = ({
|
|
19982
20036
|
loader: loader2,
|
|
@@ -20037,7 +20091,7 @@ var SelectSingleOptions = ({
|
|
|
20037
20091
|
onSelect: onToggleByIndex,
|
|
20038
20092
|
scrollToIndex: rowVirtualizer.scrollToIndex
|
|
20039
20093
|
});
|
|
20040
|
-
const getIsSelected =
|
|
20094
|
+
const getIsSelected = useCallback11(
|
|
20041
20095
|
(key) => selectedKey === key,
|
|
20042
20096
|
[selectedKey]
|
|
20043
20097
|
);
|
|
@@ -20089,6 +20143,9 @@ var useSingleSelect = ({
|
|
|
20089
20143
|
viewMode,
|
|
20090
20144
|
borderless,
|
|
20091
20145
|
paddingless,
|
|
20146
|
+
zIndex,
|
|
20147
|
+
placement,
|
|
20148
|
+
boundRef,
|
|
20092
20149
|
overscan,
|
|
20093
20150
|
estimateSize,
|
|
20094
20151
|
height,
|
|
@@ -20131,8 +20188,6 @@ var instances_default = useSelect2;
|
|
|
20131
20188
|
// src/components/Select/styles.ts
|
|
20132
20189
|
import styled74, { css as css49 } from "styled-components";
|
|
20133
20190
|
var FloatingWrapper = styled74.div`
|
|
20134
|
-
z-index: 1000;
|
|
20135
|
-
|
|
20136
20191
|
&,
|
|
20137
20192
|
& > div {
|
|
20138
20193
|
height: var(--height);
|
|
@@ -20300,7 +20355,9 @@ var OptionContainer = styled74.div`
|
|
|
20300
20355
|
import { jsx as jsx366, jsxs as jsxs188 } from "react/jsx-runtime";
|
|
20301
20356
|
var Select2 = React348.forwardRef(
|
|
20302
20357
|
(props, ref) => {
|
|
20303
|
-
const [open, setOpen] =
|
|
20358
|
+
const [open, setOpen] = useState31(false);
|
|
20359
|
+
const [triggerRef, setTriggerRef] = useState31(null);
|
|
20360
|
+
const { placement, syncPlacement } = useInitialPlacement_default(props, triggerRef);
|
|
20304
20361
|
const id = props.id || useId();
|
|
20305
20362
|
const { isRequired, isInvalid: isInvalid2, isViewMode, isDisabled } = Form_default.useContext(
|
|
20306
20363
|
props.name
|
|
@@ -20311,7 +20368,8 @@ var Select2 = React348.forwardRef(
|
|
|
20311
20368
|
const viewMode = isViewMode() || props.viewMode;
|
|
20312
20369
|
const { floating, transition, interactions } = useFloatingMenu_default({
|
|
20313
20370
|
open,
|
|
20314
|
-
onOpenChange: setOpen
|
|
20371
|
+
onOpenChange: setOpen,
|
|
20372
|
+
placement
|
|
20315
20373
|
});
|
|
20316
20374
|
const height = useMemo13(() => {
|
|
20317
20375
|
if (transition.status !== "open") return 0;
|
|
@@ -20327,6 +20385,19 @@ var Select2 = React348.forwardRef(
|
|
|
20327
20385
|
};
|
|
20328
20386
|
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20329
20387
|
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20388
|
+
const setRef = useCallback12(
|
|
20389
|
+
(node) => {
|
|
20390
|
+
floating.refs.setReference(node);
|
|
20391
|
+
setTriggerRef(node);
|
|
20392
|
+
syncPlacement(node);
|
|
20393
|
+
if (typeof ref === "function") {
|
|
20394
|
+
ref(node);
|
|
20395
|
+
} else if (ref) {
|
|
20396
|
+
ref.current = node;
|
|
20397
|
+
}
|
|
20398
|
+
},
|
|
20399
|
+
[floating.refs.setReference, ref, syncPlacement]
|
|
20400
|
+
);
|
|
20330
20401
|
return /* @__PURE__ */ jsxs188(React348.Fragment, { children: [
|
|
20331
20402
|
props.label !== void 0 && /* @__PURE__ */ jsx366(Label11, { htmlFor: id, $viewMode: viewMode, children: props.label }),
|
|
20332
20403
|
/* @__PURE__ */ jsxs188(
|
|
@@ -20360,14 +20431,7 @@ var Select2 = React348.forwardRef(
|
|
|
20360
20431
|
buttonProps.onKeyDown?.(event);
|
|
20361
20432
|
}
|
|
20362
20433
|
}),
|
|
20363
|
-
ref:
|
|
20364
|
-
floating.refs.setReference(node);
|
|
20365
|
-
if (typeof ref === "function") {
|
|
20366
|
-
ref(node);
|
|
20367
|
-
} else if (ref) {
|
|
20368
|
-
ref.current = node;
|
|
20369
|
-
}
|
|
20370
|
-
},
|
|
20434
|
+
ref: setRef,
|
|
20371
20435
|
children: [
|
|
20372
20436
|
/* @__PURE__ */ jsx366(TriggerValue, { children: placeholder }),
|
|
20373
20437
|
!viewMode && /* @__PURE__ */ jsx366(
|
|
@@ -20398,7 +20462,8 @@ var Select2 = React348.forwardRef(
|
|
|
20398
20462
|
ref: floating.refs.setFloating,
|
|
20399
20463
|
style: {
|
|
20400
20464
|
...floating.floatingStyles,
|
|
20401
|
-
"--height": `${height}px
|
|
20465
|
+
"--height": `${height}px`,
|
|
20466
|
+
zIndex: props.zIndex !== void 0 ? props.zIndex : 1e3
|
|
20402
20467
|
},
|
|
20403
20468
|
...interactions.getFloatingProps(),
|
|
20404
20469
|
children: /* @__PURE__ */ jsx366("div", { children: /* @__PURE__ */ jsx366(
|
|
@@ -20419,7 +20484,7 @@ var Select_default3 = Object.assign(Select2, {
|
|
|
20419
20484
|
});
|
|
20420
20485
|
|
|
20421
20486
|
// src/components/Signature/index.tsx
|
|
20422
|
-
import { useCallback as
|
|
20487
|
+
import { useCallback as useCallback13, useEffect as useEffect26, useMemo as useMemo14, useState as useState32 } from "react";
|
|
20423
20488
|
import SignatureCanvas from "react-signature-canvas";
|
|
20424
20489
|
|
|
20425
20490
|
// src/components/Signature/styles.ts
|
|
@@ -20525,12 +20590,12 @@ var SignatureInput = ({
|
|
|
20525
20590
|
onEnd = voidFn,
|
|
20526
20591
|
...props
|
|
20527
20592
|
}) => {
|
|
20528
|
-
const [name, setName] =
|
|
20529
|
-
const [font, setFont] =
|
|
20530
|
-
const [showPlaceholder, setShowPlaceholder] =
|
|
20531
|
-
const [loading, setLoading] =
|
|
20532
|
-
const [ref, setRef] =
|
|
20533
|
-
|
|
20593
|
+
const [name, setName] = useState32("");
|
|
20594
|
+
const [font, setFont] = useState32(FONTS[0]);
|
|
20595
|
+
const [showPlaceholder, setShowPlaceholder] = useState32(true);
|
|
20596
|
+
const [loading, setLoading] = useState32(false);
|
|
20597
|
+
const [ref, setRef] = useState32(null);
|
|
20598
|
+
useEffect26(() => {
|
|
20534
20599
|
if (!ref) return;
|
|
20535
20600
|
const refreshValue = () => {
|
|
20536
20601
|
if (ref.isEmpty() && !value) return;
|
|
@@ -20543,7 +20608,7 @@ var SignatureInput = ({
|
|
|
20543
20608
|
window.addEventListener("resize", refreshValue);
|
|
20544
20609
|
return () => window.removeEventListener("resize", refreshValue);
|
|
20545
20610
|
}, [ref, value]);
|
|
20546
|
-
const setByText =
|
|
20611
|
+
const setByText = useCallback13(
|
|
20547
20612
|
async (name2, font2) => {
|
|
20548
20613
|
if (!ref) return;
|
|
20549
20614
|
const trimmed = name2.trim();
|
|
@@ -20572,14 +20637,14 @@ var SignatureInput = ({
|
|
|
20572
20637
|
},
|
|
20573
20638
|
[ref]
|
|
20574
20639
|
);
|
|
20575
|
-
const onBeginHandler =
|
|
20640
|
+
const onBeginHandler = useCallback13(
|
|
20576
20641
|
(event) => {
|
|
20577
20642
|
onBegin(event, ref);
|
|
20578
20643
|
setShowPlaceholder(false);
|
|
20579
20644
|
},
|
|
20580
20645
|
[ref, onBegin]
|
|
20581
20646
|
);
|
|
20582
|
-
const onEndHandler =
|
|
20647
|
+
const onEndHandler = useCallback13(
|
|
20583
20648
|
(event) => {
|
|
20584
20649
|
onEnd(event, ref);
|
|
20585
20650
|
if (!ref || ref.isEmpty()) return;
|
|
@@ -20587,10 +20652,10 @@ var SignatureInput = ({
|
|
|
20587
20652
|
},
|
|
20588
20653
|
[ref, onEnd]
|
|
20589
20654
|
);
|
|
20590
|
-
const onApplyHandler =
|
|
20655
|
+
const onApplyHandler = useCallback13(() => {
|
|
20591
20656
|
setByText(name, font);
|
|
20592
20657
|
}, [name, font, setByText]);
|
|
20593
|
-
const onClearHandler =
|
|
20658
|
+
const onClearHandler = useCallback13(() => {
|
|
20594
20659
|
if (!ref) return;
|
|
20595
20660
|
setShowPlaceholder(true);
|
|
20596
20661
|
setName("");
|
|
@@ -20681,13 +20746,13 @@ var SignatureInput = ({
|
|
|
20681
20746
|
var Signature_default = SignatureInput;
|
|
20682
20747
|
|
|
20683
20748
|
// src/components/Tabs/index.tsx
|
|
20684
|
-
import React353, { useState as
|
|
20749
|
+
import React353, { useState as useState35 } from "react";
|
|
20685
20750
|
|
|
20686
20751
|
// src/components/Tabs/components/ScrollButtons/index.tsx
|
|
20687
|
-
import React349, { useCallback as
|
|
20752
|
+
import React349, { useCallback as useCallback15, useEffect as useEffect27, useState as useState33 } from "react";
|
|
20688
20753
|
|
|
20689
20754
|
// src/components/Tabs/components/ScrollButton/index.tsx
|
|
20690
|
-
import { useCallback as
|
|
20755
|
+
import { useCallback as useCallback14 } from "react";
|
|
20691
20756
|
|
|
20692
20757
|
// src/components/Tabs/components/ScrollButton/styled.ts
|
|
20693
20758
|
import styled76 from "styled-components";
|
|
@@ -20718,7 +20783,7 @@ import { jsx as jsx368 } from "react/jsx-runtime";
|
|
|
20718
20783
|
var ScrollButton = (props) => {
|
|
20719
20784
|
const { mode, visible, scrollRef } = props;
|
|
20720
20785
|
const icon = `chevron_${mode}`;
|
|
20721
|
-
const onClick =
|
|
20786
|
+
const onClick = useCallback14(() => {
|
|
20722
20787
|
if (!scrollRef) return;
|
|
20723
20788
|
scrollRef.scrollBy({
|
|
20724
20789
|
left: mode === "left" ? -(scrollRef.scrollWidth + 1) : scrollRef.scrollWidth,
|
|
@@ -20771,10 +20836,10 @@ var Container28 = styled77.div`
|
|
|
20771
20836
|
import { jsx as jsx369, jsxs as jsxs190 } from "react/jsx-runtime";
|
|
20772
20837
|
var ScrollButtons = (props) => {
|
|
20773
20838
|
const { activeTabIndex, tabsLength } = props;
|
|
20774
|
-
const [ref, setRef] =
|
|
20775
|
-
const [showLeftArrow, setShowLeftArrow] =
|
|
20776
|
-
const [showRightArrow, setShowRightArrow] =
|
|
20777
|
-
const checkScrollPosition =
|
|
20839
|
+
const [ref, setRef] = useState33(null);
|
|
20840
|
+
const [showLeftArrow, setShowLeftArrow] = useState33(false);
|
|
20841
|
+
const [showRightArrow, setShowRightArrow] = useState33(false);
|
|
20842
|
+
const checkScrollPosition = useCallback15(() => {
|
|
20778
20843
|
if (!ref) return;
|
|
20779
20844
|
if (ref.scrollWidth > ref.offsetWidth) {
|
|
20780
20845
|
const { scrollLeft, scrollWidth, clientWidth } = ref;
|
|
@@ -20785,12 +20850,12 @@ var ScrollButtons = (props) => {
|
|
|
20785
20850
|
setShowRightArrow(false);
|
|
20786
20851
|
}
|
|
20787
20852
|
}, [ref]);
|
|
20788
|
-
|
|
20853
|
+
useEffect27(() => {
|
|
20789
20854
|
checkScrollPosition();
|
|
20790
20855
|
window.addEventListener("resize", checkScrollPosition);
|
|
20791
20856
|
return () => window.removeEventListener("resize", checkScrollPosition);
|
|
20792
20857
|
}, [checkScrollPosition, tabsLength]);
|
|
20793
|
-
|
|
20858
|
+
useEffect27(() => {
|
|
20794
20859
|
if (!ref) return;
|
|
20795
20860
|
if (ref.scrollWidth <= ref.offsetWidth) return;
|
|
20796
20861
|
const element = ref.children[activeTabIndex];
|
|
@@ -20871,7 +20936,7 @@ var buildComponent = (component, provider) => {
|
|
|
20871
20936
|
};
|
|
20872
20937
|
|
|
20873
20938
|
// src/components/Tabs/components/TabItem/components/Close/index.tsx
|
|
20874
|
-
import { useCallback as
|
|
20939
|
+
import { useCallback as useCallback16 } from "react";
|
|
20875
20940
|
|
|
20876
20941
|
// src/components/Tabs/components/TabItem/components/Close/styles.ts
|
|
20877
20942
|
import styled78 from "styled-components";
|
|
@@ -20909,7 +20974,7 @@ var Close2 = (props) => {
|
|
|
20909
20974
|
options: [options, setOptions]
|
|
20910
20975
|
} = props;
|
|
20911
20976
|
const onClose = props.onClose || (() => true);
|
|
20912
|
-
const onClickClose =
|
|
20977
|
+
const onClickClose = useCallback16(
|
|
20913
20978
|
async (event) => {
|
|
20914
20979
|
if (options.length === 1) return;
|
|
20915
20980
|
const newOptions = [...options];
|
|
@@ -20938,7 +21003,7 @@ var Close2 = (props) => {
|
|
|
20938
21003
|
var Close_default = Close2;
|
|
20939
21004
|
|
|
20940
21005
|
// src/components/Tabs/components/TabItem/components/LabelItem/index.tsx
|
|
20941
|
-
import { useState as
|
|
21006
|
+
import { useState as useState34 } from "react";
|
|
20942
21007
|
|
|
20943
21008
|
// src/components/Tabs/components/TabItem/components/LabelItem/styled.ts
|
|
20944
21009
|
import styled79, { css as css51 } from "styled-components";
|
|
@@ -20996,7 +21061,7 @@ var StyledTab = styled79.div`
|
|
|
20996
21061
|
import { jsx as jsx371 } from "react/jsx-runtime";
|
|
20997
21062
|
var LabelItem = (props) => {
|
|
20998
21063
|
const { children, onClick, primary, hasSiblings, internal } = props;
|
|
20999
|
-
const [ref, setRef] =
|
|
21064
|
+
const [ref, setRef] = useState34(null);
|
|
21000
21065
|
return /* @__PURE__ */ jsx371(
|
|
21001
21066
|
StyledTab,
|
|
21002
21067
|
{
|
|
@@ -21161,8 +21226,8 @@ import { jsx as jsx373, jsxs as jsxs192 } from "react/jsx-runtime";
|
|
|
21161
21226
|
var VoidProvider = (props) => /* @__PURE__ */ jsx373(React353.Fragment, { children: props.children });
|
|
21162
21227
|
var Component4 = (props) => {
|
|
21163
21228
|
const components = props.components || {};
|
|
21164
|
-
const [options, setOptions] = typeof props.options[1] === "function" ? props.options :
|
|
21165
|
-
const [active, setActive] = Array.isArray(props.active) ? props.active :
|
|
21229
|
+
const [options, setOptions] = typeof props.options[1] === "function" ? props.options : useState35(props.options);
|
|
21230
|
+
const [active, setActive] = Array.isArray(props.active) ? props.active : useState35(props.active);
|
|
21166
21231
|
const sortedTabs = sortTabs(options.map((tab, index) => ({ ...tab, index })));
|
|
21167
21232
|
const activeTabIndex = sortedTabs.findIndex((tab) => tab.index === active);
|
|
21168
21233
|
const divProps = filterObject(props, [
|
|
@@ -21387,7 +21452,7 @@ var Toast = ({
|
|
|
21387
21452
|
var Toast_default = Toast;
|
|
21388
21453
|
|
|
21389
21454
|
// src/components/Zoom/index.tsx
|
|
21390
|
-
import React354, { useState as
|
|
21455
|
+
import React354, { useState as useState36 } from "react";
|
|
21391
21456
|
|
|
21392
21457
|
// src/components/Zoom/styles.ts
|
|
21393
21458
|
import styled84 from "styled-components";
|
|
@@ -21462,7 +21527,7 @@ var ModalContent = styled84.div`
|
|
|
21462
21527
|
import { jsx as jsx376, jsxs as jsxs194 } from "react/jsx-runtime";
|
|
21463
21528
|
var Zoom = (props) => {
|
|
21464
21529
|
const { src, width, height, ...imgProps } = props;
|
|
21465
|
-
const [modalOpened, setModalOpened] =
|
|
21530
|
+
const [modalOpened, setModalOpened] = useState36(false);
|
|
21466
21531
|
return /* @__PURE__ */ jsxs194(React354.Fragment, { children: [
|
|
21467
21532
|
/* @__PURE__ */ jsxs194(
|
|
21468
21533
|
Container32,
|