@monolith-forensics/monolith-ui 1.1.30 → 1.1.31
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/Button/Button.js +11 -16
- package/dist/Button/index.js +1 -8
- package/dist/Calendar/Calendar.js +38 -66
- package/dist/Calendar/CalendarStyles.js +19 -25
- package/dist/Calendar/calendarHelpers.js +34 -46
- package/dist/Calendar/index.js +1 -8
- package/dist/CheckBox/CheckBox.js +9 -14
- package/dist/CheckBox/index.js +1 -8
- package/dist/DateInput/DateInput.js +46 -51
- package/dist/DateInput/index.js +1 -8
- package/dist/DropDownMenu/DropDownMenu.js +27 -32
- package/dist/DropDownMenu/index.js +1 -8
- package/dist/Error/Error.js +10 -15
- package/dist/Error/index.js +1 -8
- package/dist/FieldLabel/FieldLabel.js +8 -37
- package/dist/FieldLabel/index.js +1 -8
- package/dist/FileInputField/FileInputField.js +11 -16
- package/dist/FileInputField/index.js +1 -8
- package/dist/Flyout/Flyout.js +12 -17
- package/dist/Flyout/FlyoutHeader.js +3 -8
- package/dist/Flyout/FlyoutTitle.js +3 -8
- package/dist/Flyout/index.js +3 -12
- package/dist/FormSection/FormSection.js +8 -13
- package/dist/FormSection/index.js +1 -8
- package/dist/Grid/Grid.js +5 -10
- package/dist/Grid/index.js +1 -8
- package/dist/IconButton/IconButton.js +4 -9
- package/dist/IconButton/index.js +1 -8
- package/dist/Input/Input.js +6 -11
- package/dist/Input/index.js +1 -8
- package/dist/Modal/Modal.js +14 -19
- package/dist/Modal/index.js +1 -8
- package/dist/MonolithUIProvider/GlobalStyle.js +3 -5
- package/dist/MonolithUIProvider/MonolithUIProvider.js +13 -19
- package/dist/MonolithUIProvider/index.js +3 -12
- package/dist/MonolithUIProvider/useMonolithUITheme.js +4 -6
- package/dist/Pill/Pill.js +9 -14
- package/dist/Pill/index.js +1 -8
- package/dist/SelectBox/SelectBox.js +44 -50
- package/dist/SelectBox/index.js +1 -8
- package/dist/Switch/Switch.js +9 -37
- package/dist/Switch/index.js +1 -8
- package/dist/Table/Table.js +68 -76
- package/dist/Table/index.js +2 -10
- package/dist/TagBox/TagBox.js +40 -45
- package/dist/TagBox/TagBoxStyles.js +11 -17
- package/dist/TagBox/index.js +1 -8
- package/dist/TextArea/TextArea.js +4 -9
- package/dist/TextArea/index.js +1 -8
- package/dist/TextAreaInput/TextAreaInput.js +5 -7
- package/dist/TextAreaInput/index.js +1 -8
- package/dist/TextInput/TextInput.js +7 -12
- package/dist/TextInput/index.js +1 -8
- package/dist/Tooltip/Tooltip.js +6 -34
- package/dist/Tooltip/index.js +1 -8
- package/dist/core/ArrowButton.js +8 -13
- package/dist/core/ClearButton.js +8 -13
- package/dist/core/StyledContent.js +3 -8
- package/dist/core/StyledFloatContainer.js +3 -8
- package/dist/core/Types/Size.js +1 -2
- package/dist/core/Types/Variant.js +1 -2
- package/dist/core/index.js +4 -14
- package/dist/index.js +26 -59
- package/dist/theme/index.js +4 -9
- package/dist/theme/typography.js +1 -3
- package/dist/theme/variants.js +8 -14
- package/package.json +1 -1
- package/dist/Button/Button.d.ts +0 -19
- package/dist/Button/index.d.ts +0 -2
- package/dist/Calendar/Calendar.d.ts +0 -15
- package/dist/Calendar/CalendarStyles.d.ts +0 -36
- package/dist/Calendar/calendarHelpers.d.ts +0 -53
- package/dist/Calendar/index.d.ts +0 -1
- package/dist/CheckBox/CheckBox.d.ts +0 -13
- package/dist/CheckBox/index.d.ts +0 -1
- package/dist/DateInput/DateInput.d.ts +0 -24
- package/dist/DateInput/index.d.ts +0 -1
- package/dist/DropDownMenu/DropDownMenu.d.ts +0 -36
- package/dist/DropDownMenu/index.d.ts +0 -1
- package/dist/Error/Error.d.ts +0 -4
- package/dist/Error/index.d.ts +0 -1
- package/dist/FieldLabel/FieldLabel.d.ts +0 -19
- package/dist/FieldLabel/index.d.ts +0 -1
- package/dist/FileInputField/FileInputField.d.ts +0 -19
- package/dist/FileInputField/index.d.ts +0 -1
- package/dist/Flyout/Flyout.d.ts +0 -11
- package/dist/Flyout/FlyoutHeader.d.ts +0 -5
- package/dist/Flyout/FlyoutTitle.d.ts +0 -2
- package/dist/Flyout/index.d.ts +0 -3
- package/dist/FormSection/FormSection.d.ts +0 -9
- package/dist/FormSection/index.d.ts +0 -1
- package/dist/Grid/Grid.d.ts +0 -8
- package/dist/Grid/index.d.ts +0 -1
- package/dist/IconButton/IconButton.d.ts +0 -5
- package/dist/IconButton/index.d.ts +0 -1
- package/dist/Input/Input.d.ts +0 -21
- package/dist/Input/index.d.ts +0 -1
- package/dist/Modal/Modal.d.ts +0 -14
- package/dist/Modal/index.d.ts +0 -1
- package/dist/MonolithUIProvider/GlobalStyle.d.ts +0 -4
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +0 -10
- package/dist/MonolithUIProvider/index.d.ts +0 -3
- package/dist/MonolithUIProvider/useMonolithUITheme.d.ts +0 -2
- package/dist/Pill/Pill.d.ts +0 -11
- package/dist/Pill/index.d.ts +0 -1
- package/dist/SelectBox/SelectBox.d.ts +0 -45
- package/dist/SelectBox/index.d.ts +0 -1
- package/dist/Switch/Switch.d.ts +0 -18
- package/dist/Switch/index.d.ts +0 -1
- package/dist/Table/Table.d.ts +0 -91
- package/dist/Table/index.d.ts +0 -2
- package/dist/TagBox/TagBox.d.ts +0 -39
- package/dist/TagBox/TagBoxStyles.d.ts +0 -11
- package/dist/TagBox/index.d.ts +0 -1
- package/dist/TextArea/TextArea.d.ts +0 -16
- package/dist/TextArea/index.d.ts +0 -1
- package/dist/TextAreaInput/TextAreaInput.d.ts +0 -19
- package/dist/TextAreaInput/index.d.ts +0 -1
- package/dist/TextInput/TextInput.d.ts +0 -13
- package/dist/TextInput/index.d.ts +0 -1
- package/dist/Tooltip/Tooltip.d.ts +0 -12
- package/dist/Tooltip/index.d.ts +0 -1
- package/dist/core/ArrowButton.d.ts +0 -6
- package/dist/core/ClearButton.d.ts +0 -6
- package/dist/core/MonolithThemeProvider.d.ts +0 -4
- package/dist/core/MonolithThemeProvider.js +0 -20
- package/dist/core/StyledContent.d.ts +0 -7
- package/dist/core/StyledFloatContainer.d.ts +0 -2
- package/dist/core/Types/Size.d.ts +0 -2
- package/dist/core/Types/Variant.d.ts +0 -2
- package/dist/core/index.d.ts +0 -6
- package/dist/index.d.ts +0 -26
- package/dist/theme/index.d.ts +0 -168
- package/dist/theme/typography.d.ts +0 -45
- package/dist/theme/variants.d.ts +0 -172
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
2
|
var t = {};
|
|
4
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -10,19 +9,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
9
|
}
|
|
11
10
|
return t;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const react_2 = require("react");
|
|
22
|
-
const __1 = require("..");
|
|
23
|
-
const use_debounce_1 = require("use-debounce");
|
|
24
|
-
const core_1 = require("../core");
|
|
25
|
-
exports.StyledInputContainer = styled_components_1.default.div `
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import styled from "styled-components";
|
|
14
|
+
import { useFloating, flip, offset, FloatingPortal, } from "@floating-ui/react";
|
|
15
|
+
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
16
|
+
import { Input, FieldLabel, Tooltip } from "..";
|
|
17
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
18
|
+
import { StyledContent, StyledFloatContainer, ArrowButton, ClearButton, } from "../core";
|
|
19
|
+
export const StyledInputContainer = styled.div `
|
|
26
20
|
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
27
21
|
|
|
28
22
|
position: relative;
|
|
@@ -43,16 +37,16 @@ exports.StyledInputContainer = styled_components_1.default.div `
|
|
|
43
37
|
return `${width}px`;
|
|
44
38
|
}};
|
|
45
39
|
`;
|
|
46
|
-
const StyledInnerItemContainer =
|
|
40
|
+
const StyledInnerItemContainer = styled.div `
|
|
47
41
|
overflow-y: auto;
|
|
48
42
|
|
|
49
43
|
&[data-scroll-active="true"] {
|
|
50
44
|
padding-right: 5px;
|
|
51
45
|
}
|
|
52
46
|
`;
|
|
53
|
-
const GroupTitle = (
|
|
47
|
+
const GroupTitle = styled((_a) => {
|
|
54
48
|
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
55
|
-
return ((
|
|
49
|
+
return (_jsxs("div", Object.assign({ className: className }, props, { children: [_jsx("div", { className: "group-line" }), _jsx("div", { className: "group-label", children: children }), _jsx("div", { className: "group-line" })] })));
|
|
56
50
|
}) `
|
|
57
51
|
display: flex;
|
|
58
52
|
flex-direction: row;
|
|
@@ -101,8 +95,8 @@ const GroupTitle = (0, styled_components_1.default)((_a) => {
|
|
|
101
95
|
width: 100%;
|
|
102
96
|
}
|
|
103
97
|
`;
|
|
104
|
-
const ActionMenu =
|
|
105
|
-
const StyledItem =
|
|
98
|
+
const ActionMenu = styled.div ``;
|
|
99
|
+
const StyledItem = styled.div `
|
|
106
100
|
color: ${(props) => props.theme.palette.text.primary};
|
|
107
101
|
border-radius: 3px;
|
|
108
102
|
display: flex;
|
|
@@ -156,18 +150,18 @@ const StyledItem = styled_components_1.default.div `
|
|
|
156
150
|
color: ${(props) => props.theme.palette.text.primary};
|
|
157
151
|
}
|
|
158
152
|
`;
|
|
159
|
-
const SelectBox = (
|
|
153
|
+
const SelectBox = styled(({ className, data = [], placeholder = "Select...", arrow = true, onChange, onSearch, searchFn, onScroll, loading, defaultValue, onItemAdded, size = "sm", variant = "outlined", width = "100%", allowCustomValue = false, searchable = false, clearable = false, label, description, required = false, error, openOnFocus = true, renderOption, actionComponent, focused, grouped, TooltipContent, DropDownProps = {}, }) => {
|
|
160
154
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
161
155
|
const isObjectArray = (_a = Object.keys((data === null || data === void 0 ? void 0 : data[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
|
|
162
|
-
const [isOpen, setIsOpen] =
|
|
163
|
-
const [selected, setSelected] =
|
|
164
|
-
const [searchValue, setSearchValue] =
|
|
165
|
-
const [customItems, setCustomItems] =
|
|
166
|
-
const [placement, setPlacement] =
|
|
167
|
-
const [dropDownHeight, setDropDownHeight] =
|
|
168
|
-
const inputRef =
|
|
169
|
-
const containerRef =
|
|
170
|
-
const scrollContainerRef =
|
|
156
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
157
|
+
const [selected, setSelected] = useState(null);
|
|
158
|
+
const [searchValue, setSearchValue] = useState("");
|
|
159
|
+
const [customItems, setCustomItems] = useState([]);
|
|
160
|
+
const [placement, setPlacement] = useState("bottom-start");
|
|
161
|
+
const [dropDownHeight, setDropDownHeight] = useState(null);
|
|
162
|
+
const inputRef = useRef(null);
|
|
163
|
+
const containerRef = useRef(null);
|
|
164
|
+
const scrollContainerRef = useRef(null);
|
|
171
165
|
const filteredItems = data
|
|
172
166
|
.concat(customItems) // Add custom items to the list
|
|
173
167
|
.filter((item) => {
|
|
@@ -205,13 +199,13 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
205
199
|
}))
|
|
206
200
|
.sort((a, b) => a.label.localeCompare(b.label))
|
|
207
201
|
: [];
|
|
208
|
-
const { refs, floatingStyles, update } =
|
|
202
|
+
const { refs, floatingStyles, update } = useFloating({
|
|
209
203
|
open: isOpen,
|
|
210
204
|
onOpenChange: setIsOpen,
|
|
211
205
|
placement,
|
|
212
206
|
strategy: "absolute",
|
|
213
207
|
// Handle collisions with the viewport
|
|
214
|
-
middleware: [
|
|
208
|
+
middleware: [flip(), offset(5)],
|
|
215
209
|
});
|
|
216
210
|
const toggleOpen = () => {
|
|
217
211
|
setIsOpen((prev) => {
|
|
@@ -240,11 +234,11 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
240
234
|
handleChangeSelection(item);
|
|
241
235
|
setIsOpen(false);
|
|
242
236
|
};
|
|
243
|
-
const handleChangeSelection =
|
|
237
|
+
const handleChangeSelection = useCallback((option) => {
|
|
244
238
|
setSelected(option);
|
|
245
239
|
onChange === null || onChange === void 0 ? void 0 : onChange((option === null || option === void 0 ? void 0 : option.value) || option, option);
|
|
246
240
|
}, [onChange]);
|
|
247
|
-
const handleAddItem =
|
|
241
|
+
const handleAddItem = useCallback((newItem) => {
|
|
248
242
|
const isNewItem = data.every((item) => item.label.toLowerCase() !==
|
|
249
243
|
newItem.toLowerCase());
|
|
250
244
|
if (isNewItem) {
|
|
@@ -351,14 +345,14 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
351
345
|
update();
|
|
352
346
|
}
|
|
353
347
|
};
|
|
354
|
-
const debouncedHandleOnChange =
|
|
348
|
+
const debouncedHandleOnChange = useDebouncedCallback(handleOnChange, 300);
|
|
355
349
|
const handleFocus = () => {
|
|
356
350
|
if (openOnFocus) {
|
|
357
351
|
setIsOpen(true);
|
|
358
352
|
}
|
|
359
353
|
};
|
|
360
354
|
// Close on outside click
|
|
361
|
-
|
|
355
|
+
useEffect(() => {
|
|
362
356
|
const close = (e) => {
|
|
363
357
|
var _a, _b;
|
|
364
358
|
const target = e.target;
|
|
@@ -376,7 +370,7 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
376
370
|
return () => document.removeEventListener("click", close);
|
|
377
371
|
}, [refs.floating, refs.reference]);
|
|
378
372
|
// Handle default value
|
|
379
|
-
|
|
373
|
+
useEffect(() => {
|
|
380
374
|
if (defaultValue) {
|
|
381
375
|
const isOption = defaultValue.value !== undefined;
|
|
382
376
|
const searchPattern = isOption
|
|
@@ -388,7 +382,7 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
388
382
|
}
|
|
389
383
|
}, [data, defaultValue, isObjectArray]);
|
|
390
384
|
// handle input value change
|
|
391
|
-
|
|
385
|
+
useEffect(() => {
|
|
392
386
|
if (inputRef.current) {
|
|
393
387
|
if (!selected) {
|
|
394
388
|
inputRef.current.value = "";
|
|
@@ -401,7 +395,7 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
401
395
|
}
|
|
402
396
|
}, [selected]);
|
|
403
397
|
// handle scroll item into view
|
|
404
|
-
|
|
398
|
+
useEffect(() => {
|
|
405
399
|
var _a, _b;
|
|
406
400
|
const item = (_b = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector) === null || _b === void 0 ? void 0 : _b.call(_a, ".mfFloatingItem[data-selected=true]");
|
|
407
401
|
if (item) {
|
|
@@ -409,7 +403,7 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
409
403
|
}
|
|
410
404
|
}, [selected]);
|
|
411
405
|
// make calls to onSearch callback
|
|
412
|
-
|
|
406
|
+
useEffect(() => {
|
|
413
407
|
if (searchable) {
|
|
414
408
|
update();
|
|
415
409
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchValue);
|
|
@@ -426,7 +420,7 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
426
420
|
// get height between top of the floating container and the top of the viewport
|
|
427
421
|
const topHeight = (((_g = referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.getBoundingClientRect()) === null || _g === void 0 ? void 0 : _g.top) -
|
|
428
422
|
10);
|
|
429
|
-
|
|
423
|
+
useEffect(() => {
|
|
430
424
|
if (bottomHeight < 250) {
|
|
431
425
|
setPlacement("top-start");
|
|
432
426
|
setDropDownHeight(topHeight);
|
|
@@ -440,38 +434,38 @@ const SelectBox = (0, styled_components_1.default)(({ className, data = [], plac
|
|
|
440
434
|
setDropDownHeight(bottomHeight);
|
|
441
435
|
};
|
|
442
436
|
}, [topHeight, bottomHeight, isOpen]);
|
|
443
|
-
return ((
|
|
437
|
+
return (_jsxs("div", { className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { ref: refs.setReference, onMouseDown: () => setIsOpen(true), width: width, onKeyDown: handleKeyDown, "data-open": isOpen, children: [_jsx(Input, { ref: inputRef, onChange: debouncedHandleOnChange, onFocus: handleFocus, autoFocus: focused, placeholder: placeholder, size: size, readOnly: !searchable, "data-button-right": arrow || clearable }), clearable && (selected || !!((_h = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _h === void 0 ? void 0 : _h.value)) ? (_jsx(ClearButton, { className: "input-btn", onClick: handleClear })) : arrow ? (_jsx(ArrowButton, { onClick: (e) => {
|
|
444
438
|
e.preventDefault();
|
|
445
439
|
// e.stopPropagation();
|
|
446
440
|
}, onMouseDown: (e) => {
|
|
447
441
|
e.preventDefault();
|
|
448
442
|
e.stopPropagation();
|
|
449
443
|
toggleOpen();
|
|
450
|
-
} })) : null] }), isOpen && ((
|
|
444
|
+
} })) : null] }), isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(StyledFloatContainer, { ref: (ref) => {
|
|
451
445
|
containerRef.current = ref;
|
|
452
446
|
refs.setFloating(ref);
|
|
453
|
-
}, style: floatingStyles, className: "mfFloating", children: (
|
|
447
|
+
}, style: floatingStyles, className: "mfFloating", children: _jsxs(StyledContent, Object.assign({ className: "mfFloatingContent", style: {
|
|
454
448
|
width: contentWidth,
|
|
455
449
|
maxWidth: contentWidth,
|
|
456
450
|
maxHeight: DropDownProps.autoHeight
|
|
457
451
|
? (dropDownHeight || 250) - 10
|
|
458
452
|
: "",
|
|
459
|
-
}, variant: variant, "data-empty": filteredItems.length === 0 }, DropDownProps, { children: [actionComponent && (
|
|
460
|
-
? groups.map((group, index) => ((
|
|
461
|
-
return ((
|
|
453
|
+
}, variant: variant, "data-empty": filteredItems.length === 0 }, DropDownProps, { children: [actionComponent && _jsx(ActionMenu, { children: actionComponent }), _jsxs(StyledInnerItemContainer, { ref: scrollContainerRef, "data-scroll-active": scrollActive, onScroll: onScroll, children: [loading && _jsx("div", { children: "Loading..." }), !loading && grouped
|
|
454
|
+
? groups.map((group, index) => (_jsxs("div", { children: [_jsx(GroupTitle, { size: size, children: group.label }), group.items.map((item, index) => {
|
|
455
|
+
return (_jsx(Tooltip, { content: TooltipContent ? (_jsx(TooltipContent, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": isObjectArray
|
|
462
456
|
? (selected === null || selected === void 0 ? void 0 : selected.value) ===
|
|
463
457
|
item.value
|
|
464
|
-
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || ((
|
|
458
|
+
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }, index));
|
|
465
459
|
})] }, group.label)))
|
|
466
460
|
: filteredItems.map((item, index) => {
|
|
467
|
-
return ((
|
|
461
|
+
return (_jsx(Tooltip, { content: TooltipContent ? (_jsx(TooltipContent, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": isObjectArray
|
|
468
462
|
? (selected === null || selected === void 0 ? void 0 : selected.value) ===
|
|
469
463
|
(item === null || item === void 0 ? void 0 : item.value)
|
|
470
|
-
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || ((
|
|
464
|
+
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }, index));
|
|
471
465
|
})] })] })) }) }))] }));
|
|
472
466
|
}) `
|
|
473
467
|
position: relative;
|
|
474
468
|
cursor: pointer;
|
|
475
469
|
width: 100%;
|
|
476
470
|
`;
|
|
477
|
-
|
|
471
|
+
export default SelectBox;
|
package/dist/SelectBox/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var SelectBox_1 = require("./SelectBox");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(SelectBox_1).default; } });
|
|
1
|
+
export { default } from "./SelectBox";
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
2
|
var t = {};
|
|
27
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -33,15 +9,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
33
9
|
}
|
|
34
10
|
return t;
|
|
35
11
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
-
const RadixSwitch = __importStar(require("@radix-ui/react-switch"));
|
|
43
|
-
const __1 = require("..");
|
|
44
|
-
const StyledRoot = (0, styled_components_1.default)(RadixSwitch.Root) `
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import styled from "styled-components";
|
|
14
|
+
import * as RadixSwitch from "@radix-ui/react-switch";
|
|
15
|
+
import { FieldLabel } from "..";
|
|
16
|
+
const StyledRoot = styled(RadixSwitch.Root) `
|
|
45
17
|
all: unset;
|
|
46
18
|
cursor: pointer;
|
|
47
19
|
|
|
@@ -98,7 +70,7 @@ const StyledRoot = (0, styled_components_1.default)(RadixSwitch.Root) `
|
|
|
98
70
|
opacity: 0.5;
|
|
99
71
|
}
|
|
100
72
|
`;
|
|
101
|
-
const StyledThumb = (
|
|
73
|
+
const StyledThumb = styled(RadixSwitch.Thumb) `
|
|
102
74
|
display: block;
|
|
103
75
|
width: ${({ size }) => size === "xs"
|
|
104
76
|
? "9px"
|
|
@@ -145,13 +117,13 @@ const StyledThumb = (0, styled_components_1.default)(RadixSwitch.Thumb) `
|
|
|
145
117
|
: "translateX(17px)"};
|
|
146
118
|
}
|
|
147
119
|
`;
|
|
148
|
-
const Switch = (
|
|
120
|
+
const Switch = styled((_a) => {
|
|
149
121
|
var { className, onChange, size = "xs", label, labelPosition = "right", description, error, required, disabled = false, defaultValue, value, style = {} } = _a, other = __rest(_a, ["className", "onChange", "size", "label", "labelPosition", "description", "error", "required", "disabled", "defaultValue", "value", "style"]);
|
|
150
|
-
return ((
|
|
122
|
+
return (_jsxs("div", { className: className, children: [label && labelPosition === "left" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsx(StyledRoot, Object.assign({ size: size, className: "SwitchRoot", onCheckedChange: onChange, defaultChecked: defaultValue, checked: value, disabled: disabled, style: style }, other, { children: _jsx(StyledThumb, { size: size, className: "SwitchThumb" }) })), label && labelPosition === "right" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label }))] }));
|
|
151
123
|
}) `
|
|
152
124
|
display: flex;
|
|
153
125
|
flex-direction: row;
|
|
154
126
|
align-items: center;
|
|
155
127
|
gap: 10px;
|
|
156
128
|
`;
|
|
157
|
-
|
|
129
|
+
export default Switch;
|
package/dist/Switch/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var Switch_1 = require("./Switch");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Switch_1).default; } });
|
|
1
|
+
export { default } from "./Switch";
|