@mw-kit/mw-ui 1.10.2 → 1.10.4
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 +11 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.js +166 -99
- package/dist/index.mjs +131 -64
- 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,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { FloatingPortalProps } from '@floating-ui/react';
|
|
2
3
|
import type { ReactVirtualizerOptions } from '@tanstack/react-virtual';
|
|
4
|
+
import type { Property } from 'csstype';
|
|
3
5
|
export type SelectOptionsLoader<Option> = (search: string, page: number, cursor: Option | null) => Promise<{
|
|
4
6
|
options: Option[];
|
|
5
7
|
last: boolean;
|
|
@@ -24,6 +26,7 @@ export type SelectApplyRule<Option, Id extends string = string> = {
|
|
|
24
26
|
Component?: SelectApplyRuleComponent<Option>;
|
|
25
27
|
};
|
|
26
28
|
export type SelectApplyRules<T> = readonly SelectApplyRule<T, string>[];
|
|
29
|
+
export type SelectPlacement = 'bottom' | 'top';
|
|
27
30
|
export type SelectOptionComponent<Option> = React.FunctionComponent<{
|
|
28
31
|
option: Option;
|
|
29
32
|
isActive: boolean;
|
|
@@ -45,6 +48,14 @@ export type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
45
48
|
viewMode?: boolean;
|
|
46
49
|
borderless?: boolean;
|
|
47
50
|
paddingless?: boolean;
|
|
51
|
+
zIndex?: Property.ZIndex;
|
|
52
|
+
portalRoot?: FloatingPortalProps['root'];
|
|
53
|
+
placement?: SelectPlacement;
|
|
54
|
+
/**
|
|
55
|
+
* Defines the element used as the visual boundary when resolving the automatic placement.
|
|
56
|
+
* The viewport is used by default.
|
|
57
|
+
*/
|
|
58
|
+
boundRef?: HTMLElement;
|
|
48
59
|
/**
|
|
49
60
|
* The number of items to render above and below the visible area.
|
|
50
61
|
* The default is 2.
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,9 @@ import react__default, { TextareaHTMLAttributes } from 'react';
|
|
|
5
5
|
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
|
+
import { FloatingPortalProps } from '@floating-ui/react';
|
|
8
9
|
import { ReactVirtualizerOptions } from '@tanstack/react-virtual';
|
|
10
|
+
import { Property } from 'csstype';
|
|
9
11
|
import SignatureCanvas, { SignatureCanvasProps } from 'react-signature-canvas';
|
|
10
12
|
|
|
11
13
|
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 +3176,7 @@ type SelectApplyRule<Option, Id extends string = string> = {
|
|
|
3174
3176
|
Component?: SelectApplyRuleComponent<Option>;
|
|
3175
3177
|
};
|
|
3176
3178
|
type SelectApplyRules<T> = readonly SelectApplyRule<T, string>[];
|
|
3179
|
+
type SelectPlacement = 'bottom' | 'top';
|
|
3177
3180
|
type SelectOptionComponent<Option> = react__default.FunctionComponent<{
|
|
3178
3181
|
option: Option;
|
|
3179
3182
|
isActive: boolean;
|
|
@@ -3195,6 +3198,14 @@ type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
3195
3198
|
viewMode?: boolean;
|
|
3196
3199
|
borderless?: boolean;
|
|
3197
3200
|
paddingless?: boolean;
|
|
3201
|
+
zIndex?: Property.ZIndex;
|
|
3202
|
+
portalRoot?: FloatingPortalProps['root'];
|
|
3203
|
+
placement?: SelectPlacement;
|
|
3204
|
+
/**
|
|
3205
|
+
* Defines the element used as the visual boundary when resolving the automatic placement.
|
|
3206
|
+
* The viewport is used by default.
|
|
3207
|
+
*/
|
|
3208
|
+
boundRef?: HTMLElement;
|
|
3198
3209
|
/**
|
|
3199
3210
|
* The number of items to render above and below the visible area.
|
|
3200
3211
|
* 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,10 @@ var useMultiSelect = ({
|
|
|
19989
20040
|
viewMode,
|
|
19990
20041
|
borderless,
|
|
19991
20042
|
paddingless,
|
|
20043
|
+
zIndex,
|
|
20044
|
+
portalRoot,
|
|
20045
|
+
placement,
|
|
20046
|
+
boundRef,
|
|
19992
20047
|
overscan,
|
|
19993
20048
|
estimateSize,
|
|
19994
20049
|
height,
|
|
@@ -19998,9 +20053,9 @@ var useMultiSelect = ({
|
|
|
19998
20053
|
applyRules,
|
|
19999
20054
|
...buttonProps
|
|
20000
20055
|
}) => {
|
|
20001
|
-
const closedLabel = (0,
|
|
20056
|
+
const closedLabel = (0, import_react79.useMemo)(() => {
|
|
20002
20057
|
if (value.length < 1) {
|
|
20003
|
-
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime364.jsx)(
|
|
20058
|
+
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime364.jsx)(import_react79.default.Fragment, { children: "\xA0" }) : placeholder;
|
|
20004
20059
|
}
|
|
20005
20060
|
return `H\xE1 ${value.length} op\xE7\xF5es selecionadas`;
|
|
20006
20061
|
}, [placeholder, value.length, viewMode]);
|
|
@@ -20015,7 +20070,7 @@ var useMultiSelect = ({
|
|
|
20015
20070
|
var multi_default = useMultiSelect;
|
|
20016
20071
|
|
|
20017
20072
|
// src/components/Select/instances/single/index.tsx
|
|
20018
|
-
var
|
|
20073
|
+
var import_react80 = __toESM(require("react"));
|
|
20019
20074
|
var import_jsx_runtime365 = require("react/jsx-runtime");
|
|
20020
20075
|
var SelectSingleOptions = ({
|
|
20021
20076
|
loader: loader2,
|
|
@@ -20076,11 +20131,11 @@ var SelectSingleOptions = ({
|
|
|
20076
20131
|
onSelect: onToggleByIndex,
|
|
20077
20132
|
scrollToIndex: rowVirtualizer.scrollToIndex
|
|
20078
20133
|
});
|
|
20079
|
-
const getIsSelected = (0,
|
|
20134
|
+
const getIsSelected = (0, import_react80.useCallback)(
|
|
20080
20135
|
(key) => selectedKey === key,
|
|
20081
20136
|
[selectedKey]
|
|
20082
20137
|
);
|
|
20083
|
-
return /* @__PURE__ */ (0, import_jsx_runtime365.jsxs)(
|
|
20138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime365.jsxs)(import_react80.default.Fragment, { children: [
|
|
20084
20139
|
/* @__PURE__ */ (0, import_jsx_runtime365.jsx)(
|
|
20085
20140
|
Search_default2,
|
|
20086
20141
|
{
|
|
@@ -20128,6 +20183,10 @@ var useSingleSelect = ({
|
|
|
20128
20183
|
viewMode,
|
|
20129
20184
|
borderless,
|
|
20130
20185
|
paddingless,
|
|
20186
|
+
zIndex,
|
|
20187
|
+
portalRoot,
|
|
20188
|
+
placement,
|
|
20189
|
+
boundRef,
|
|
20131
20190
|
overscan,
|
|
20132
20191
|
estimateSize,
|
|
20133
20192
|
height,
|
|
@@ -20137,9 +20196,9 @@ var useSingleSelect = ({
|
|
|
20137
20196
|
...buttonProps
|
|
20138
20197
|
}) => {
|
|
20139
20198
|
const ClosedValueComponent = ValueComponent || OptionComponent;
|
|
20140
|
-
const closedLabel = (0,
|
|
20199
|
+
const closedLabel = (0, import_react80.useMemo)(() => {
|
|
20141
20200
|
if (!value) {
|
|
20142
|
-
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime365.jsx)(
|
|
20201
|
+
return viewMode ? /* @__PURE__ */ (0, import_jsx_runtime365.jsx)(import_react80.default.Fragment, { children: "\xA0" }) : placeholder;
|
|
20143
20202
|
}
|
|
20144
20203
|
return /* @__PURE__ */ (0, import_jsx_runtime365.jsx)(
|
|
20145
20204
|
ClosedValueComponent,
|
|
@@ -20170,8 +20229,6 @@ var instances_default = useSelect2;
|
|
|
20170
20229
|
// src/components/Select/styles.ts
|
|
20171
20230
|
var import_styled_components77 = __toESM(require("styled-components"));
|
|
20172
20231
|
var FloatingWrapper = import_styled_components77.default.div`
|
|
20173
|
-
z-index: 1000;
|
|
20174
|
-
|
|
20175
20232
|
&,
|
|
20176
20233
|
& > div {
|
|
20177
20234
|
height: var(--height);
|
|
@@ -20337,10 +20394,12 @@ var OptionContainer = import_styled_components77.default.div`
|
|
|
20337
20394
|
|
|
20338
20395
|
// src/components/Select/index.tsx
|
|
20339
20396
|
var import_jsx_runtime366 = require("react/jsx-runtime");
|
|
20340
|
-
var Select2 =
|
|
20397
|
+
var Select2 = import_react81.default.forwardRef(
|
|
20341
20398
|
(props, ref) => {
|
|
20342
|
-
const [open, setOpen] = (0,
|
|
20343
|
-
const
|
|
20399
|
+
const [open, setOpen] = (0, import_react81.useState)(false);
|
|
20400
|
+
const [triggerRef, setTriggerRef] = (0, import_react81.useState)(null);
|
|
20401
|
+
const { placement, syncPlacement } = useInitialPlacement_default(props, triggerRef);
|
|
20402
|
+
const id = props.id || (0, import_react81.useId)();
|
|
20344
20403
|
const { isRequired, isInvalid: isInvalid2, isViewMode, isDisabled } = Form_default.useContext(
|
|
20345
20404
|
props.name
|
|
20346
20405
|
);
|
|
@@ -20350,14 +20409,15 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20350
20409
|
const viewMode = isViewMode() || props.viewMode;
|
|
20351
20410
|
const { floating, transition, interactions } = useFloatingMenu_default({
|
|
20352
20411
|
open,
|
|
20353
|
-
onOpenChange: setOpen
|
|
20412
|
+
onOpenChange: setOpen,
|
|
20413
|
+
placement
|
|
20354
20414
|
});
|
|
20355
|
-
const height = (0,
|
|
20415
|
+
const height = (0, import_react81.useMemo)(() => {
|
|
20356
20416
|
if (transition.status !== "open") return 0;
|
|
20357
20417
|
if (props.height !== void 0) return props.height;
|
|
20358
20418
|
return props.type === "single-select" ? 240 : 260;
|
|
20359
20419
|
}, [transition.status !== "open", props.type, props.height]);
|
|
20360
|
-
const menuId = (0,
|
|
20420
|
+
const menuId = (0, import_react81.useId)();
|
|
20361
20421
|
const onTriggerKeyDown = (event) => {
|
|
20362
20422
|
if (!open && ["ArrowDown", "ArrowUp", "Enter", " "].includes(event.key)) {
|
|
20363
20423
|
event.preventDefault();
|
|
@@ -20366,7 +20426,20 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20366
20426
|
};
|
|
20367
20427
|
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20368
20428
|
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20369
|
-
|
|
20429
|
+
const setRef = (0, import_react81.useCallback)(
|
|
20430
|
+
(node) => {
|
|
20431
|
+
floating.refs.setReference(node);
|
|
20432
|
+
setTriggerRef(node);
|
|
20433
|
+
syncPlacement(node);
|
|
20434
|
+
if (typeof ref === "function") {
|
|
20435
|
+
ref(node);
|
|
20436
|
+
} else if (ref) {
|
|
20437
|
+
ref.current = node;
|
|
20438
|
+
}
|
|
20439
|
+
},
|
|
20440
|
+
[floating.refs.setReference, ref, syncPlacement]
|
|
20441
|
+
);
|
|
20442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime366.jsxs)(import_react81.default.Fragment, { children: [
|
|
20370
20443
|
props.label !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(Label11, { htmlFor: id, $viewMode: viewMode, children: props.label }),
|
|
20371
20444
|
/* @__PURE__ */ (0, import_jsx_runtime366.jsxs)(
|
|
20372
20445
|
Trigger,
|
|
@@ -20399,14 +20472,7 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20399
20472
|
buttonProps.onKeyDown?.(event);
|
|
20400
20473
|
}
|
|
20401
20474
|
}),
|
|
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
|
-
},
|
|
20475
|
+
ref: setRef,
|
|
20410
20476
|
children: [
|
|
20411
20477
|
/* @__PURE__ */ (0, import_jsx_runtime366.jsx)(TriggerValue, { children: placeholder }),
|
|
20412
20478
|
!viewMode && /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
@@ -20431,13 +20497,14 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20431
20497
|
]
|
|
20432
20498
|
}
|
|
20433
20499
|
),
|
|
20434
|
-
transition.isMounted ? /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
20500
|
+
transition.isMounted ? /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(import_react82.FloatingPortal, { root: props.portalRoot, children: /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
20435
20501
|
FloatingWrapper,
|
|
20436
20502
|
{
|
|
20437
20503
|
ref: floating.refs.setFloating,
|
|
20438
20504
|
style: {
|
|
20439
20505
|
...floating.floatingStyles,
|
|
20440
|
-
"--height": `${height}px
|
|
20506
|
+
"--height": `${height}px`,
|
|
20507
|
+
zIndex: props.zIndex !== void 0 ? props.zIndex : 1e3
|
|
20441
20508
|
},
|
|
20442
20509
|
...interactions.getFloatingProps(),
|
|
20443
20510
|
children: /* @__PURE__ */ (0, import_jsx_runtime366.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(
|
|
@@ -20458,7 +20525,7 @@ var Select_default3 = Object.assign(Select2, {
|
|
|
20458
20525
|
});
|
|
20459
20526
|
|
|
20460
20527
|
// src/components/Signature/index.tsx
|
|
20461
|
-
var
|
|
20528
|
+
var import_react83 = require("react");
|
|
20462
20529
|
var import_react_signature_canvas = __toESM(require("react-signature-canvas"));
|
|
20463
20530
|
|
|
20464
20531
|
// src/components/Signature/styles.ts
|
|
@@ -20564,12 +20631,12 @@ var SignatureInput = ({
|
|
|
20564
20631
|
onEnd = voidFn,
|
|
20565
20632
|
...props
|
|
20566
20633
|
}) => {
|
|
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,
|
|
20634
|
+
const [name, setName] = (0, import_react83.useState)("");
|
|
20635
|
+
const [font, setFont] = (0, import_react83.useState)(FONTS[0]);
|
|
20636
|
+
const [showPlaceholder, setShowPlaceholder] = (0, import_react83.useState)(true);
|
|
20637
|
+
const [loading, setLoading] = (0, import_react83.useState)(false);
|
|
20638
|
+
const [ref, setRef] = (0, import_react83.useState)(null);
|
|
20639
|
+
(0, import_react83.useEffect)(() => {
|
|
20573
20640
|
if (!ref) return;
|
|
20574
20641
|
const refreshValue = () => {
|
|
20575
20642
|
if (ref.isEmpty() && !value) return;
|
|
@@ -20582,7 +20649,7 @@ var SignatureInput = ({
|
|
|
20582
20649
|
window.addEventListener("resize", refreshValue);
|
|
20583
20650
|
return () => window.removeEventListener("resize", refreshValue);
|
|
20584
20651
|
}, [ref, value]);
|
|
20585
|
-
const setByText = (0,
|
|
20652
|
+
const setByText = (0, import_react83.useCallback)(
|
|
20586
20653
|
async (name2, font2) => {
|
|
20587
20654
|
if (!ref) return;
|
|
20588
20655
|
const trimmed = name2.trim();
|
|
@@ -20611,14 +20678,14 @@ var SignatureInput = ({
|
|
|
20611
20678
|
},
|
|
20612
20679
|
[ref]
|
|
20613
20680
|
);
|
|
20614
|
-
const onBeginHandler = (0,
|
|
20681
|
+
const onBeginHandler = (0, import_react83.useCallback)(
|
|
20615
20682
|
(event) => {
|
|
20616
20683
|
onBegin(event, ref);
|
|
20617
20684
|
setShowPlaceholder(false);
|
|
20618
20685
|
},
|
|
20619
20686
|
[ref, onBegin]
|
|
20620
20687
|
);
|
|
20621
|
-
const onEndHandler = (0,
|
|
20688
|
+
const onEndHandler = (0, import_react83.useCallback)(
|
|
20622
20689
|
(event) => {
|
|
20623
20690
|
onEnd(event, ref);
|
|
20624
20691
|
if (!ref || ref.isEmpty()) return;
|
|
@@ -20626,17 +20693,17 @@ var SignatureInput = ({
|
|
|
20626
20693
|
},
|
|
20627
20694
|
[ref, onEnd]
|
|
20628
20695
|
);
|
|
20629
|
-
const onApplyHandler = (0,
|
|
20696
|
+
const onApplyHandler = (0, import_react83.useCallback)(() => {
|
|
20630
20697
|
setByText(name, font);
|
|
20631
20698
|
}, [name, font, setByText]);
|
|
20632
|
-
const onClearHandler = (0,
|
|
20699
|
+
const onClearHandler = (0, import_react83.useCallback)(() => {
|
|
20633
20700
|
if (!ref) return;
|
|
20634
20701
|
setShowPlaceholder(true);
|
|
20635
20702
|
setName("");
|
|
20636
20703
|
ref.clear();
|
|
20637
20704
|
setValue("");
|
|
20638
20705
|
}, [ref]);
|
|
20639
|
-
const empty = (0,
|
|
20706
|
+
const empty = (0, import_react83.useMemo)(() => !value && (!ref || ref.isEmpty()), [ref, value]);
|
|
20640
20707
|
return /* @__PURE__ */ (0, import_jsx_runtime367.jsxs)(Container26, { children: [
|
|
20641
20708
|
/* @__PURE__ */ (0, import_jsx_runtime367.jsx)(
|
|
20642
20709
|
Input_default,
|
|
@@ -20720,13 +20787,13 @@ var SignatureInput = ({
|
|
|
20720
20787
|
var Signature_default = SignatureInput;
|
|
20721
20788
|
|
|
20722
20789
|
// src/components/Tabs/index.tsx
|
|
20723
|
-
var
|
|
20790
|
+
var import_react89 = __toESM(require("react"));
|
|
20724
20791
|
|
|
20725
20792
|
// src/components/Tabs/components/ScrollButtons/index.tsx
|
|
20726
|
-
var
|
|
20793
|
+
var import_react85 = __toESM(require("react"));
|
|
20727
20794
|
|
|
20728
20795
|
// src/components/Tabs/components/ScrollButton/index.tsx
|
|
20729
|
-
var
|
|
20796
|
+
var import_react84 = require("react");
|
|
20730
20797
|
|
|
20731
20798
|
// src/components/Tabs/components/ScrollButton/styled.ts
|
|
20732
20799
|
var import_styled_components79 = __toESM(require("styled-components"));
|
|
@@ -20757,7 +20824,7 @@ var import_jsx_runtime368 = require("react/jsx-runtime");
|
|
|
20757
20824
|
var ScrollButton = (props) => {
|
|
20758
20825
|
const { mode, visible, scrollRef } = props;
|
|
20759
20826
|
const icon = `chevron_${mode}`;
|
|
20760
|
-
const onClick = (0,
|
|
20827
|
+
const onClick = (0, import_react84.useCallback)(() => {
|
|
20761
20828
|
if (!scrollRef) return;
|
|
20762
20829
|
scrollRef.scrollBy({
|
|
20763
20830
|
left: mode === "left" ? -(scrollRef.scrollWidth + 1) : scrollRef.scrollWidth,
|
|
@@ -20810,10 +20877,10 @@ var Container28 = import_styled_components80.default.div`
|
|
|
20810
20877
|
var import_jsx_runtime369 = require("react/jsx-runtime");
|
|
20811
20878
|
var ScrollButtons = (props) => {
|
|
20812
20879
|
const { activeTabIndex, tabsLength } = props;
|
|
20813
|
-
const [ref, setRef] = (0,
|
|
20814
|
-
const [showLeftArrow, setShowLeftArrow] = (0,
|
|
20815
|
-
const [showRightArrow, setShowRightArrow] = (0,
|
|
20816
|
-
const checkScrollPosition = (0,
|
|
20880
|
+
const [ref, setRef] = (0, import_react85.useState)(null);
|
|
20881
|
+
const [showLeftArrow, setShowLeftArrow] = (0, import_react85.useState)(false);
|
|
20882
|
+
const [showRightArrow, setShowRightArrow] = (0, import_react85.useState)(false);
|
|
20883
|
+
const checkScrollPosition = (0, import_react85.useCallback)(() => {
|
|
20817
20884
|
if (!ref) return;
|
|
20818
20885
|
if (ref.scrollWidth > ref.offsetWidth) {
|
|
20819
20886
|
const { scrollLeft, scrollWidth, clientWidth } = ref;
|
|
@@ -20824,12 +20891,12 @@ var ScrollButtons = (props) => {
|
|
|
20824
20891
|
setShowRightArrow(false);
|
|
20825
20892
|
}
|
|
20826
20893
|
}, [ref]);
|
|
20827
|
-
(0,
|
|
20894
|
+
(0, import_react85.useEffect)(() => {
|
|
20828
20895
|
checkScrollPosition();
|
|
20829
20896
|
window.addEventListener("resize", checkScrollPosition);
|
|
20830
20897
|
return () => window.removeEventListener("resize", checkScrollPosition);
|
|
20831
20898
|
}, [checkScrollPosition, tabsLength]);
|
|
20832
|
-
(0,
|
|
20899
|
+
(0, import_react85.useEffect)(() => {
|
|
20833
20900
|
if (!ref) return;
|
|
20834
20901
|
if (ref.scrollWidth <= ref.offsetWidth) return;
|
|
20835
20902
|
const element = ref.children[activeTabIndex];
|
|
@@ -20839,7 +20906,7 @@ var ScrollButtons = (props) => {
|
|
|
20839
20906
|
inline: "nearest"
|
|
20840
20907
|
});
|
|
20841
20908
|
}, [activeTabIndex, ref]);
|
|
20842
|
-
return /* @__PURE__ */ (0, import_jsx_runtime369.jsxs)(
|
|
20909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime369.jsxs)(import_react85.default.Fragment, { children: [
|
|
20843
20910
|
/* @__PURE__ */ (0, import_jsx_runtime369.jsx)(ScrollButton_default, { scrollRef: ref, mode: "left", visible: showLeftArrow }),
|
|
20844
20911
|
/* @__PURE__ */ (0, import_jsx_runtime369.jsx)(
|
|
20845
20912
|
Container28,
|
|
@@ -20862,7 +20929,7 @@ var ScrollButtons = (props) => {
|
|
|
20862
20929
|
var ScrollButtons_default = ScrollButtons;
|
|
20863
20930
|
|
|
20864
20931
|
// src/components/Tabs/components/TabItem/index.tsx
|
|
20865
|
-
var
|
|
20932
|
+
var import_react88 = __toESM(require("react"));
|
|
20866
20933
|
|
|
20867
20934
|
// src/components/Tabs/functions.ts
|
|
20868
20935
|
var sortTabs = (tabs, sorted = []) => {
|
|
@@ -20910,7 +20977,7 @@ var buildComponent = (component, provider) => {
|
|
|
20910
20977
|
};
|
|
20911
20978
|
|
|
20912
20979
|
// src/components/Tabs/components/TabItem/components/Close/index.tsx
|
|
20913
|
-
var
|
|
20980
|
+
var import_react86 = require("react");
|
|
20914
20981
|
|
|
20915
20982
|
// src/components/Tabs/components/TabItem/components/Close/styles.ts
|
|
20916
20983
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
@@ -20948,7 +21015,7 @@ var Close2 = (props) => {
|
|
|
20948
21015
|
options: [options, setOptions]
|
|
20949
21016
|
} = props;
|
|
20950
21017
|
const onClose = props.onClose || (() => true);
|
|
20951
|
-
const onClickClose = (0,
|
|
21018
|
+
const onClickClose = (0, import_react86.useCallback)(
|
|
20952
21019
|
async (event) => {
|
|
20953
21020
|
if (options.length === 1) return;
|
|
20954
21021
|
const newOptions = [...options];
|
|
@@ -20977,7 +21044,7 @@ var Close2 = (props) => {
|
|
|
20977
21044
|
var Close_default = Close2;
|
|
20978
21045
|
|
|
20979
21046
|
// src/components/Tabs/components/TabItem/components/LabelItem/index.tsx
|
|
20980
|
-
var
|
|
21047
|
+
var import_react87 = require("react");
|
|
20981
21048
|
|
|
20982
21049
|
// src/components/Tabs/components/TabItem/components/LabelItem/styled.ts
|
|
20983
21050
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
@@ -21035,7 +21102,7 @@ var StyledTab = import_styled_components82.default.div`
|
|
|
21035
21102
|
var import_jsx_runtime371 = require("react/jsx-runtime");
|
|
21036
21103
|
var LabelItem = (props) => {
|
|
21037
21104
|
const { children, onClick, primary, hasSiblings, internal } = props;
|
|
21038
|
-
const [ref, setRef] = (0,
|
|
21105
|
+
const [ref, setRef] = (0, import_react87.useState)(null);
|
|
21039
21106
|
return /* @__PURE__ */ (0, import_jsx_runtime371.jsx)(
|
|
21040
21107
|
StyledTab,
|
|
21041
21108
|
{
|
|
@@ -21091,7 +21158,7 @@ var Container29 = import_styled_components83.default.div`
|
|
|
21091
21158
|
|
|
21092
21159
|
// src/components/Tabs/components/TabItem/index.tsx
|
|
21093
21160
|
var import_jsx_runtime372 = require("react/jsx-runtime");
|
|
21094
|
-
var VoidClose = () => /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(
|
|
21161
|
+
var VoidClose = () => /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(import_react88.default.Fragment, {});
|
|
21095
21162
|
var TabItem = (props) => {
|
|
21096
21163
|
const {
|
|
21097
21164
|
active: [active, setActive],
|
|
@@ -21101,7 +21168,7 @@ var TabItem = (props) => {
|
|
|
21101
21168
|
alwaysOpen
|
|
21102
21169
|
} = props;
|
|
21103
21170
|
const CloseComponent = alwaysOpen || tabs.length < 2 ? VoidClose : Close_default;
|
|
21104
|
-
return /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(
|
|
21171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime372.jsx)(import_react88.default.Fragment, { children: sortedTabs.map(({ index, ...tab }) => {
|
|
21105
21172
|
const isActive = index === active;
|
|
21106
21173
|
const hasSiblings = hasChildren(tabs, tab.group);
|
|
21107
21174
|
const canClose = !props.internal && (!tab.primary || !hasSiblings);
|
|
@@ -21197,11 +21264,11 @@ var Tabs = import_styled_components84.default.div`
|
|
|
21197
21264
|
|
|
21198
21265
|
// src/components/Tabs/index.tsx
|
|
21199
21266
|
var import_jsx_runtime373 = require("react/jsx-runtime");
|
|
21200
|
-
var VoidProvider = (props) => /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(
|
|
21267
|
+
var VoidProvider = (props) => /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(import_react89.default.Fragment, { children: props.children });
|
|
21201
21268
|
var Component4 = (props) => {
|
|
21202
21269
|
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,
|
|
21270
|
+
const [options, setOptions] = typeof props.options[1] === "function" ? props.options : (0, import_react89.useState)(props.options);
|
|
21271
|
+
const [active, setActive] = Array.isArray(props.active) ? props.active : (0, import_react89.useState)(props.active);
|
|
21205
21272
|
const sortedTabs = sortTabs(options.map((tab, index) => ({ ...tab, index })));
|
|
21206
21273
|
const activeTabIndex = sortedTabs.findIndex((tab) => tab.index === active);
|
|
21207
21274
|
const divProps = filterObject(props, [
|
|
@@ -21215,7 +21282,7 @@ var Component4 = (props) => {
|
|
|
21215
21282
|
"delimiter",
|
|
21216
21283
|
"spacing"
|
|
21217
21284
|
]);
|
|
21218
|
-
return /* @__PURE__ */ (0, import_jsx_runtime373.jsxs)(
|
|
21285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime373.jsxs)(import_react89.default.Fragment, { children: [
|
|
21219
21286
|
/* @__PURE__ */ (0, import_jsx_runtime373.jsx)(
|
|
21220
21287
|
Tabs,
|
|
21221
21288
|
{
|
|
@@ -21248,7 +21315,7 @@ var Component4 = (props) => {
|
|
|
21248
21315
|
),
|
|
21249
21316
|
options.map((tab, index) => {
|
|
21250
21317
|
if (tab.component === void 0) {
|
|
21251
|
-
return /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(
|
|
21318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime373.jsx)(import_react89.default.Fragment, {}, index);
|
|
21252
21319
|
}
|
|
21253
21320
|
const Component5 = components[tab.component];
|
|
21254
21321
|
const Provider7 = Component5.provider || VoidProvider;
|
|
@@ -21426,7 +21493,7 @@ var Toast = ({
|
|
|
21426
21493
|
var Toast_default = Toast;
|
|
21427
21494
|
|
|
21428
21495
|
// src/components/Zoom/index.tsx
|
|
21429
|
-
var
|
|
21496
|
+
var import_react90 = __toESM(require("react"));
|
|
21430
21497
|
|
|
21431
21498
|
// src/components/Zoom/styles.ts
|
|
21432
21499
|
var import_styled_components87 = __toESM(require("styled-components"));
|
|
@@ -21501,8 +21568,8 @@ var ModalContent = import_styled_components87.default.div`
|
|
|
21501
21568
|
var import_jsx_runtime376 = require("react/jsx-runtime");
|
|
21502
21569
|
var Zoom = (props) => {
|
|
21503
21570
|
const { src, width, height, ...imgProps } = props;
|
|
21504
|
-
const [modalOpened, setModalOpened] = (0,
|
|
21505
|
-
return /* @__PURE__ */ (0, import_jsx_runtime376.jsxs)(
|
|
21571
|
+
const [modalOpened, setModalOpened] = (0, import_react90.useState)(false);
|
|
21572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime376.jsxs)(import_react90.default.Fragment, { children: [
|
|
21506
21573
|
/* @__PURE__ */ (0, import_jsx_runtime376.jsxs)(
|
|
21507
21574
|
Container32,
|
|
21508
21575
|
{
|
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,10 @@ var useMultiSelect = ({
|
|
|
19950
20001
|
viewMode,
|
|
19951
20002
|
borderless,
|
|
19952
20003
|
paddingless,
|
|
20004
|
+
zIndex,
|
|
20005
|
+
portalRoot,
|
|
20006
|
+
placement,
|
|
20007
|
+
boundRef,
|
|
19953
20008
|
overscan,
|
|
19954
20009
|
estimateSize,
|
|
19955
20010
|
height,
|
|
@@ -19976,7 +20031,7 @@ var useMultiSelect = ({
|
|
|
19976
20031
|
var multi_default = useMultiSelect;
|
|
19977
20032
|
|
|
19978
20033
|
// src/components/Select/instances/single/index.tsx
|
|
19979
|
-
import React347, { useCallback as
|
|
20034
|
+
import React347, { useCallback as useCallback11, useMemo as useMemo12 } from "react";
|
|
19980
20035
|
import { jsx as jsx365, jsxs as jsxs187 } from "react/jsx-runtime";
|
|
19981
20036
|
var SelectSingleOptions = ({
|
|
19982
20037
|
loader: loader2,
|
|
@@ -20037,7 +20092,7 @@ var SelectSingleOptions = ({
|
|
|
20037
20092
|
onSelect: onToggleByIndex,
|
|
20038
20093
|
scrollToIndex: rowVirtualizer.scrollToIndex
|
|
20039
20094
|
});
|
|
20040
|
-
const getIsSelected =
|
|
20095
|
+
const getIsSelected = useCallback11(
|
|
20041
20096
|
(key) => selectedKey === key,
|
|
20042
20097
|
[selectedKey]
|
|
20043
20098
|
);
|
|
@@ -20089,6 +20144,10 @@ var useSingleSelect = ({
|
|
|
20089
20144
|
viewMode,
|
|
20090
20145
|
borderless,
|
|
20091
20146
|
paddingless,
|
|
20147
|
+
zIndex,
|
|
20148
|
+
portalRoot,
|
|
20149
|
+
placement,
|
|
20150
|
+
boundRef,
|
|
20092
20151
|
overscan,
|
|
20093
20152
|
estimateSize,
|
|
20094
20153
|
height,
|
|
@@ -20131,8 +20190,6 @@ var instances_default = useSelect2;
|
|
|
20131
20190
|
// src/components/Select/styles.ts
|
|
20132
20191
|
import styled74, { css as css49 } from "styled-components";
|
|
20133
20192
|
var FloatingWrapper = styled74.div`
|
|
20134
|
-
z-index: 1000;
|
|
20135
|
-
|
|
20136
20193
|
&,
|
|
20137
20194
|
& > div {
|
|
20138
20195
|
height: var(--height);
|
|
@@ -20300,7 +20357,9 @@ var OptionContainer = styled74.div`
|
|
|
20300
20357
|
import { jsx as jsx366, jsxs as jsxs188 } from "react/jsx-runtime";
|
|
20301
20358
|
var Select2 = React348.forwardRef(
|
|
20302
20359
|
(props, ref) => {
|
|
20303
|
-
const [open, setOpen] =
|
|
20360
|
+
const [open, setOpen] = useState31(false);
|
|
20361
|
+
const [triggerRef, setTriggerRef] = useState31(null);
|
|
20362
|
+
const { placement, syncPlacement } = useInitialPlacement_default(props, triggerRef);
|
|
20304
20363
|
const id = props.id || useId();
|
|
20305
20364
|
const { isRequired, isInvalid: isInvalid2, isViewMode, isDisabled } = Form_default.useContext(
|
|
20306
20365
|
props.name
|
|
@@ -20311,7 +20370,8 @@ var Select2 = React348.forwardRef(
|
|
|
20311
20370
|
const viewMode = isViewMode() || props.viewMode;
|
|
20312
20371
|
const { floating, transition, interactions } = useFloatingMenu_default({
|
|
20313
20372
|
open,
|
|
20314
|
-
onOpenChange: setOpen
|
|
20373
|
+
onOpenChange: setOpen,
|
|
20374
|
+
placement
|
|
20315
20375
|
});
|
|
20316
20376
|
const height = useMemo13(() => {
|
|
20317
20377
|
if (transition.status !== "open") return 0;
|
|
@@ -20327,6 +20387,19 @@ var Select2 = React348.forwardRef(
|
|
|
20327
20387
|
};
|
|
20328
20388
|
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20329
20389
|
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20390
|
+
const setRef = useCallback12(
|
|
20391
|
+
(node) => {
|
|
20392
|
+
floating.refs.setReference(node);
|
|
20393
|
+
setTriggerRef(node);
|
|
20394
|
+
syncPlacement(node);
|
|
20395
|
+
if (typeof ref === "function") {
|
|
20396
|
+
ref(node);
|
|
20397
|
+
} else if (ref) {
|
|
20398
|
+
ref.current = node;
|
|
20399
|
+
}
|
|
20400
|
+
},
|
|
20401
|
+
[floating.refs.setReference, ref, syncPlacement]
|
|
20402
|
+
);
|
|
20330
20403
|
return /* @__PURE__ */ jsxs188(React348.Fragment, { children: [
|
|
20331
20404
|
props.label !== void 0 && /* @__PURE__ */ jsx366(Label11, { htmlFor: id, $viewMode: viewMode, children: props.label }),
|
|
20332
20405
|
/* @__PURE__ */ jsxs188(
|
|
@@ -20360,14 +20433,7 @@ var Select2 = React348.forwardRef(
|
|
|
20360
20433
|
buttonProps.onKeyDown?.(event);
|
|
20361
20434
|
}
|
|
20362
20435
|
}),
|
|
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
|
-
},
|
|
20436
|
+
ref: setRef,
|
|
20371
20437
|
children: [
|
|
20372
20438
|
/* @__PURE__ */ jsx366(TriggerValue, { children: placeholder }),
|
|
20373
20439
|
!viewMode && /* @__PURE__ */ jsx366(
|
|
@@ -20392,13 +20458,14 @@ var Select2 = React348.forwardRef(
|
|
|
20392
20458
|
]
|
|
20393
20459
|
}
|
|
20394
20460
|
),
|
|
20395
|
-
transition.isMounted ? /* @__PURE__ */ jsx366(FloatingPortal2, { children: /* @__PURE__ */ jsx366(
|
|
20461
|
+
transition.isMounted ? /* @__PURE__ */ jsx366(FloatingPortal2, { root: props.portalRoot, children: /* @__PURE__ */ jsx366(
|
|
20396
20462
|
FloatingWrapper,
|
|
20397
20463
|
{
|
|
20398
20464
|
ref: floating.refs.setFloating,
|
|
20399
20465
|
style: {
|
|
20400
20466
|
...floating.floatingStyles,
|
|
20401
|
-
"--height": `${height}px
|
|
20467
|
+
"--height": `${height}px`,
|
|
20468
|
+
zIndex: props.zIndex !== void 0 ? props.zIndex : 1e3
|
|
20402
20469
|
},
|
|
20403
20470
|
...interactions.getFloatingProps(),
|
|
20404
20471
|
children: /* @__PURE__ */ jsx366("div", { children: /* @__PURE__ */ jsx366(
|
|
@@ -20419,7 +20486,7 @@ var Select_default3 = Object.assign(Select2, {
|
|
|
20419
20486
|
});
|
|
20420
20487
|
|
|
20421
20488
|
// src/components/Signature/index.tsx
|
|
20422
|
-
import { useCallback as
|
|
20489
|
+
import { useCallback as useCallback13, useEffect as useEffect26, useMemo as useMemo14, useState as useState32 } from "react";
|
|
20423
20490
|
import SignatureCanvas from "react-signature-canvas";
|
|
20424
20491
|
|
|
20425
20492
|
// src/components/Signature/styles.ts
|
|
@@ -20525,12 +20592,12 @@ var SignatureInput = ({
|
|
|
20525
20592
|
onEnd = voidFn,
|
|
20526
20593
|
...props
|
|
20527
20594
|
}) => {
|
|
20528
|
-
const [name, setName] =
|
|
20529
|
-
const [font, setFont] =
|
|
20530
|
-
const [showPlaceholder, setShowPlaceholder] =
|
|
20531
|
-
const [loading, setLoading] =
|
|
20532
|
-
const [ref, setRef] =
|
|
20533
|
-
|
|
20595
|
+
const [name, setName] = useState32("");
|
|
20596
|
+
const [font, setFont] = useState32(FONTS[0]);
|
|
20597
|
+
const [showPlaceholder, setShowPlaceholder] = useState32(true);
|
|
20598
|
+
const [loading, setLoading] = useState32(false);
|
|
20599
|
+
const [ref, setRef] = useState32(null);
|
|
20600
|
+
useEffect26(() => {
|
|
20534
20601
|
if (!ref) return;
|
|
20535
20602
|
const refreshValue = () => {
|
|
20536
20603
|
if (ref.isEmpty() && !value) return;
|
|
@@ -20543,7 +20610,7 @@ var SignatureInput = ({
|
|
|
20543
20610
|
window.addEventListener("resize", refreshValue);
|
|
20544
20611
|
return () => window.removeEventListener("resize", refreshValue);
|
|
20545
20612
|
}, [ref, value]);
|
|
20546
|
-
const setByText =
|
|
20613
|
+
const setByText = useCallback13(
|
|
20547
20614
|
async (name2, font2) => {
|
|
20548
20615
|
if (!ref) return;
|
|
20549
20616
|
const trimmed = name2.trim();
|
|
@@ -20572,14 +20639,14 @@ var SignatureInput = ({
|
|
|
20572
20639
|
},
|
|
20573
20640
|
[ref]
|
|
20574
20641
|
);
|
|
20575
|
-
const onBeginHandler =
|
|
20642
|
+
const onBeginHandler = useCallback13(
|
|
20576
20643
|
(event) => {
|
|
20577
20644
|
onBegin(event, ref);
|
|
20578
20645
|
setShowPlaceholder(false);
|
|
20579
20646
|
},
|
|
20580
20647
|
[ref, onBegin]
|
|
20581
20648
|
);
|
|
20582
|
-
const onEndHandler =
|
|
20649
|
+
const onEndHandler = useCallback13(
|
|
20583
20650
|
(event) => {
|
|
20584
20651
|
onEnd(event, ref);
|
|
20585
20652
|
if (!ref || ref.isEmpty()) return;
|
|
@@ -20587,10 +20654,10 @@ var SignatureInput = ({
|
|
|
20587
20654
|
},
|
|
20588
20655
|
[ref, onEnd]
|
|
20589
20656
|
);
|
|
20590
|
-
const onApplyHandler =
|
|
20657
|
+
const onApplyHandler = useCallback13(() => {
|
|
20591
20658
|
setByText(name, font);
|
|
20592
20659
|
}, [name, font, setByText]);
|
|
20593
|
-
const onClearHandler =
|
|
20660
|
+
const onClearHandler = useCallback13(() => {
|
|
20594
20661
|
if (!ref) return;
|
|
20595
20662
|
setShowPlaceholder(true);
|
|
20596
20663
|
setName("");
|
|
@@ -20681,13 +20748,13 @@ var SignatureInput = ({
|
|
|
20681
20748
|
var Signature_default = SignatureInput;
|
|
20682
20749
|
|
|
20683
20750
|
// src/components/Tabs/index.tsx
|
|
20684
|
-
import React353, { useState as
|
|
20751
|
+
import React353, { useState as useState35 } from "react";
|
|
20685
20752
|
|
|
20686
20753
|
// src/components/Tabs/components/ScrollButtons/index.tsx
|
|
20687
|
-
import React349, { useCallback as
|
|
20754
|
+
import React349, { useCallback as useCallback15, useEffect as useEffect27, useState as useState33 } from "react";
|
|
20688
20755
|
|
|
20689
20756
|
// src/components/Tabs/components/ScrollButton/index.tsx
|
|
20690
|
-
import { useCallback as
|
|
20757
|
+
import { useCallback as useCallback14 } from "react";
|
|
20691
20758
|
|
|
20692
20759
|
// src/components/Tabs/components/ScrollButton/styled.ts
|
|
20693
20760
|
import styled76 from "styled-components";
|
|
@@ -20718,7 +20785,7 @@ import { jsx as jsx368 } from "react/jsx-runtime";
|
|
|
20718
20785
|
var ScrollButton = (props) => {
|
|
20719
20786
|
const { mode, visible, scrollRef } = props;
|
|
20720
20787
|
const icon = `chevron_${mode}`;
|
|
20721
|
-
const onClick =
|
|
20788
|
+
const onClick = useCallback14(() => {
|
|
20722
20789
|
if (!scrollRef) return;
|
|
20723
20790
|
scrollRef.scrollBy({
|
|
20724
20791
|
left: mode === "left" ? -(scrollRef.scrollWidth + 1) : scrollRef.scrollWidth,
|
|
@@ -20771,10 +20838,10 @@ var Container28 = styled77.div`
|
|
|
20771
20838
|
import { jsx as jsx369, jsxs as jsxs190 } from "react/jsx-runtime";
|
|
20772
20839
|
var ScrollButtons = (props) => {
|
|
20773
20840
|
const { activeTabIndex, tabsLength } = props;
|
|
20774
|
-
const [ref, setRef] =
|
|
20775
|
-
const [showLeftArrow, setShowLeftArrow] =
|
|
20776
|
-
const [showRightArrow, setShowRightArrow] =
|
|
20777
|
-
const checkScrollPosition =
|
|
20841
|
+
const [ref, setRef] = useState33(null);
|
|
20842
|
+
const [showLeftArrow, setShowLeftArrow] = useState33(false);
|
|
20843
|
+
const [showRightArrow, setShowRightArrow] = useState33(false);
|
|
20844
|
+
const checkScrollPosition = useCallback15(() => {
|
|
20778
20845
|
if (!ref) return;
|
|
20779
20846
|
if (ref.scrollWidth > ref.offsetWidth) {
|
|
20780
20847
|
const { scrollLeft, scrollWidth, clientWidth } = ref;
|
|
@@ -20785,12 +20852,12 @@ var ScrollButtons = (props) => {
|
|
|
20785
20852
|
setShowRightArrow(false);
|
|
20786
20853
|
}
|
|
20787
20854
|
}, [ref]);
|
|
20788
|
-
|
|
20855
|
+
useEffect27(() => {
|
|
20789
20856
|
checkScrollPosition();
|
|
20790
20857
|
window.addEventListener("resize", checkScrollPosition);
|
|
20791
20858
|
return () => window.removeEventListener("resize", checkScrollPosition);
|
|
20792
20859
|
}, [checkScrollPosition, tabsLength]);
|
|
20793
|
-
|
|
20860
|
+
useEffect27(() => {
|
|
20794
20861
|
if (!ref) return;
|
|
20795
20862
|
if (ref.scrollWidth <= ref.offsetWidth) return;
|
|
20796
20863
|
const element = ref.children[activeTabIndex];
|
|
@@ -20871,7 +20938,7 @@ var buildComponent = (component, provider) => {
|
|
|
20871
20938
|
};
|
|
20872
20939
|
|
|
20873
20940
|
// src/components/Tabs/components/TabItem/components/Close/index.tsx
|
|
20874
|
-
import { useCallback as
|
|
20941
|
+
import { useCallback as useCallback16 } from "react";
|
|
20875
20942
|
|
|
20876
20943
|
// src/components/Tabs/components/TabItem/components/Close/styles.ts
|
|
20877
20944
|
import styled78 from "styled-components";
|
|
@@ -20909,7 +20976,7 @@ var Close2 = (props) => {
|
|
|
20909
20976
|
options: [options, setOptions]
|
|
20910
20977
|
} = props;
|
|
20911
20978
|
const onClose = props.onClose || (() => true);
|
|
20912
|
-
const onClickClose =
|
|
20979
|
+
const onClickClose = useCallback16(
|
|
20913
20980
|
async (event) => {
|
|
20914
20981
|
if (options.length === 1) return;
|
|
20915
20982
|
const newOptions = [...options];
|
|
@@ -20938,7 +21005,7 @@ var Close2 = (props) => {
|
|
|
20938
21005
|
var Close_default = Close2;
|
|
20939
21006
|
|
|
20940
21007
|
// src/components/Tabs/components/TabItem/components/LabelItem/index.tsx
|
|
20941
|
-
import { useState as
|
|
21008
|
+
import { useState as useState34 } from "react";
|
|
20942
21009
|
|
|
20943
21010
|
// src/components/Tabs/components/TabItem/components/LabelItem/styled.ts
|
|
20944
21011
|
import styled79, { css as css51 } from "styled-components";
|
|
@@ -20996,7 +21063,7 @@ var StyledTab = styled79.div`
|
|
|
20996
21063
|
import { jsx as jsx371 } from "react/jsx-runtime";
|
|
20997
21064
|
var LabelItem = (props) => {
|
|
20998
21065
|
const { children, onClick, primary, hasSiblings, internal } = props;
|
|
20999
|
-
const [ref, setRef] =
|
|
21066
|
+
const [ref, setRef] = useState34(null);
|
|
21000
21067
|
return /* @__PURE__ */ jsx371(
|
|
21001
21068
|
StyledTab,
|
|
21002
21069
|
{
|
|
@@ -21161,8 +21228,8 @@ import { jsx as jsx373, jsxs as jsxs192 } from "react/jsx-runtime";
|
|
|
21161
21228
|
var VoidProvider = (props) => /* @__PURE__ */ jsx373(React353.Fragment, { children: props.children });
|
|
21162
21229
|
var Component4 = (props) => {
|
|
21163
21230
|
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 :
|
|
21231
|
+
const [options, setOptions] = typeof props.options[1] === "function" ? props.options : useState35(props.options);
|
|
21232
|
+
const [active, setActive] = Array.isArray(props.active) ? props.active : useState35(props.active);
|
|
21166
21233
|
const sortedTabs = sortTabs(options.map((tab, index) => ({ ...tab, index })));
|
|
21167
21234
|
const activeTabIndex = sortedTabs.findIndex((tab) => tab.index === active);
|
|
21168
21235
|
const divProps = filterObject(props, [
|
|
@@ -21387,7 +21454,7 @@ var Toast = ({
|
|
|
21387
21454
|
var Toast_default = Toast;
|
|
21388
21455
|
|
|
21389
21456
|
// src/components/Zoom/index.tsx
|
|
21390
|
-
import React354, { useState as
|
|
21457
|
+
import React354, { useState as useState36 } from "react";
|
|
21391
21458
|
|
|
21392
21459
|
// src/components/Zoom/styles.ts
|
|
21393
21460
|
import styled84 from "styled-components";
|
|
@@ -21462,7 +21529,7 @@ var ModalContent = styled84.div`
|
|
|
21462
21529
|
import { jsx as jsx376, jsxs as jsxs194 } from "react/jsx-runtime";
|
|
21463
21530
|
var Zoom = (props) => {
|
|
21464
21531
|
const { src, width, height, ...imgProps } = props;
|
|
21465
|
-
const [modalOpened, setModalOpened] =
|
|
21532
|
+
const [modalOpened, setModalOpened] = useState36(false);
|
|
21466
21533
|
return /* @__PURE__ */ jsxs194(React354.Fragment, { children: [
|
|
21467
21534
|
/* @__PURE__ */ jsxs194(
|
|
21468
21535
|
Container32,
|