@veritone-ce/design-system 2.0.0-next.0 → 2.0.0-next.2
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/esm-next/Alert/index.js +1 -1
- package/dist/esm-next/Alert/styles.module.scss.js +1 -1
- package/dist/esm-next/Button/index.js +1 -1
- package/dist/esm-next/Button/styles.module.scss.js +1 -1
- package/dist/esm-next/Checkbox/index.js +1 -1
- package/dist/esm-next/Checkbox/styles.module.scss.js +1 -1
- package/dist/esm-next/CircularProgress/index.js +1 -1
- package/dist/esm-next/CircularProgress/styles.module.scss.js +1 -1
- package/dist/esm-next/Dialog/factory.js +13 -0
- package/dist/esm-next/Dialog/styles.module.scss.js +1 -1
- package/dist/esm-next/Icon/factory.js +3 -3
- package/dist/esm-next/Icon/wrappers.js +1 -1
- package/dist/esm-next/IconButton/index.js +1 -1
- package/dist/esm-next/IconButton/styles.module.scss.js +1 -1
- package/dist/esm-next/Input/index.js +1 -1
- package/dist/esm-next/Input/styles.module.scss.js +1 -1
- package/dist/esm-next/Menu/controlled.js +138 -0
- package/dist/esm-next/Menu/factory.js +11 -0
- package/dist/esm-next/Menu/styles.module.scss.js +1 -1
- package/dist/esm-next/RadioButton/index.js +1 -1
- package/dist/esm-next/RadioButton/styles.module.scss.js +1 -1
- package/dist/esm-next/Select/controlled.js +86 -78
- package/dist/esm-next/Select/factory.js +19 -0
- package/dist/esm-next/Select/styles.module.scss.js +1 -1
- package/dist/esm-next/Select/uncontrolled.js +54 -0
- package/dist/esm-next/Textarea/index.js +1 -1
- package/dist/esm-next/Textarea/styles.module.scss.js +1 -1
- package/dist/esm-next/Tooltip/index.js +1 -1
- package/dist/esm-next/Tooltip/styles.module.scss.js +1 -1
- package/dist/esm-next/Typography/index.js +1 -1
- package/dist/esm-next/Typography/variants.module.scss.js +1 -1
- package/dist/esm-next/index.js +12 -8
- package/dist/esm-next/styles/css-vars.js +8 -8
- package/dist/esm-next/styles/provider.client.js +23 -0
- package/dist/esm-next/styles/provider.css-vars.js +25 -0
- package/dist/esm-next/styles/scss/_index.scss +1 -2
- package/dist/esm-next/styles/scss/baseline.scss +1 -1
- package/dist/esm-next/styles/scss/theme.generated.scss +188 -0
- package/dist/esm-next/styles.css +13 -13
- package/dist/types/src-next/Dialog/components.d.ts +27 -0
- package/dist/types/src-next/Dialog/factory.d.ts +13 -0
- package/dist/types/src-next/Dialog/index.d.ts +3 -27
- package/dist/types/src-next/Icon/factory.d.ts +1 -0
- package/dist/types/src-next/Menu/controlled.d.ts +33 -0
- package/dist/types/src-next/Menu/factory.d.ts +7 -0
- package/dist/types/src-next/Menu/index.d.ts +3 -20
- package/dist/types/src-next/Select/controlled.d.ts +6 -21
- package/dist/types/src-next/Select/factory.d.ts +11 -0
- package/dist/types/src-next/Select/index.d.ts +5 -17
- package/dist/types/src-next/Select/types.d.ts +25 -0
- package/dist/types/src-next/Select/uncontrolled.d.ts +12 -0
- package/dist/types/src-next/popover/types.d.ts +3 -0
- package/dist/types/src-next/styles/index.d.ts +4 -5
- package/dist/types/src-next/styles/provider.client.d.ts +8 -0
- package/dist/types/src-next/styles/provider.css-vars.d.ts +10 -0
- package/package.json +9 -6
- package/dist/esm-next/Menu/index.js +0 -64
- package/dist/esm-next/Select/index.js +0 -40
- package/dist/esm-next/styles/ThemeProvider.js +0 -28
- package/dist/esm-next/styles/scss/functions.scss +0 -3
- package/dist/esm-next/styles/scss/mixins.scss +0 -7
- package/dist/esm-next/utils/controlled.js +0 -17
- package/dist/types/src-next/styles/ThemeProvider.d.ts +0 -7
- package/dist/esm-next/Dialog/{index.js → components.js} +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
'use client';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
5
|
-
import '@mui/system';
|
|
6
5
|
import { cx } from '../styles/cx.js';
|
|
7
6
|
import { defaultThemeCssVariableUsages } from '../styles/defaultTheme.js';
|
|
7
|
+
import '@mui/system';
|
|
8
8
|
import '../styles/styled.js';
|
|
9
9
|
import Button from '../Button/index.js';
|
|
10
10
|
import IconButton from '../IconButton/index.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"alert":"
|
|
1
|
+
var modules_efc4e723 = {"alert":"vt_ce_Alert_alert__34ce19c5","alert-stripe":"vt_ce_Alert_alertStripe__34ce19c5","alert-icon":"vt_ce_Alert_alertIcon__34ce19c5","alert-content":"vt_ce_Alert_alertContent__34ce19c5","alert-label":"vt_ce_Alert_alertLabel__34ce19c5","alert-text":"vt_ce_Alert_alertText__34ce19c5","spacer":"vt_ce_Alert_spacer__34ce19c5","alert-action":"vt_ce_Alert_alertAction__34ce19c5","alert-close":"vt_ce_Alert_alertClose__34ce19c5"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import React__default, { forwardRef } from 'react';
|
|
4
4
|
import CircularProgress from '../CircularProgress/index.js';
|
|
5
5
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
6
|
-
import '@mui/system';
|
|
7
6
|
import { cx } from '../styles/cx.js';
|
|
8
7
|
import '../styles/defaultTheme.js';
|
|
8
|
+
import '@mui/system';
|
|
9
9
|
import '../styles/styled.js';
|
|
10
10
|
|
|
11
11
|
const Button = forwardRef((props, ref) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"button":"
|
|
1
|
+
var modules_efc4e723 = {"button":"vt_ce_Button_button__259ca507","primary":"vt_ce_Button_primary__259ca507","secondary":"vt_ce_Button_secondary__259ca507","tertiary":"vt_ce_Button_tertiary__259ca507","inner-container":"vt_ce_Button_innerContainer__259ca507","loading-container":"vt_ce_Button_loadingContainer__259ca507","button-icon":"vt_ce_Button_buttonIcon__259ca507"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import React__default, { forwardRef, useRef, useId } from 'react';
|
|
4
4
|
import { useForkRef } from '@mui/material';
|
|
5
5
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
6
|
-
import '@mui/system';
|
|
7
6
|
import { cx } from '../styles/cx.js';
|
|
8
7
|
import '../styles/defaultTheme.js';
|
|
8
|
+
import '@mui/system';
|
|
9
9
|
import '../styles/styled.js';
|
|
10
10
|
|
|
11
11
|
const Checkbox = forwardRef(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"checkbox":"
|
|
1
|
+
var modules_efc4e723 = {"checkbox":"vt_ce_Checkbox_checkbox__504048e5","checkbox-svg-path":"vt_ce_Checkbox_checkboxSvgPath__504048e5","passthrough-label-container":"vt_ce_Checkbox_passthroughLabelContainer__504048e5","invisible-checkbox":"vt_ce_Checkbox_invisibleCheckbox__504048e5","visible-label":"vt_ce_Checkbox_visibleLabel__504048e5","icon-container":"vt_ce_Checkbox_iconContainer__504048e5"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import { createTheme, ThemeProvider, CircularProgress as CircularProgress$1 } from '@mui/material';
|
|
3
3
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
4
|
-
import '@mui/system';
|
|
5
4
|
import { cx } from '../styles/cx.js';
|
|
6
5
|
import '../styles/defaultTheme.js';
|
|
7
6
|
import 'react';
|
|
7
|
+
import '@mui/system';
|
|
8
8
|
import '../styles/styled.js';
|
|
9
9
|
|
|
10
10
|
const muiDefaultTheme = createTheme();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import Dialog from './components.js';
|
|
4
|
+
|
|
5
|
+
function createDialogComponent({ portalEl }) {
|
|
6
|
+
return forwardRef(
|
|
7
|
+
function ScopedDialog(props, ref) {
|
|
8
|
+
return /* @__PURE__ */ React__default.createElement(Dialog, { portalEl, ref, ...props });
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { createDialogComponent };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"dialog-overlay":"
|
|
1
|
+
var modules_efc4e723 = {"dialog-overlay":"vt_ce_Dialog_dialogOverlay__4b764cfb","dialog":"vt_ce_Dialog_dialog__4b764cfb","dialog-heading":"vt_ce_Dialog_dialogHeading__4b764cfb","dialog-content":"vt_ce_Dialog_dialogContent__4b764cfb","dialog-typography":"vt_ce_Dialog_dialogTypography__4b764cfb","dialog-actions":"vt_ce_Dialog_dialogActions__4b764cfb"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -3,10 +3,10 @@ import React__default, { forwardRef } from 'react';
|
|
|
3
3
|
import { BrokenImageOutlined } from '@mui/icons-material';
|
|
4
4
|
import { adaptMuiSvgIcon } from './wrappers.js';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const DefaultIconFallback = adaptMuiSvgIcon(BrokenImageOutlined);
|
|
7
7
|
function createIconComponent({
|
|
8
8
|
iconMap = {},
|
|
9
|
-
fallback =
|
|
9
|
+
fallback = DefaultIconFallback
|
|
10
10
|
}) {
|
|
11
11
|
return forwardRef(function Icon({ name, ...genericProps }, ref) {
|
|
12
12
|
const ResolvedIcon = React__default.useMemo(() => iconMap[name] ?? fallback, [name]);
|
|
@@ -14,4 +14,4 @@ function createIconComponent({
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export { createIconComponent };
|
|
17
|
+
export { DefaultIconFallback, createIconComponent };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
4
|
-
import '@mui/system';
|
|
5
4
|
import { cx } from '../styles/cx.js';
|
|
6
5
|
import '../styles/defaultTheme.js';
|
|
6
|
+
import '@mui/system';
|
|
7
7
|
import '../styles/styled.js';
|
|
8
8
|
|
|
9
9
|
function adaptMuiSvgIcon(MuiIcon) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import React__default, { forwardRef } from 'react';
|
|
4
4
|
import CircularProgress from '../CircularProgress/index.js';
|
|
5
5
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
6
|
-
import '@mui/system';
|
|
7
6
|
import { cx } from '../styles/cx.js';
|
|
8
7
|
import '../styles/defaultTheme.js';
|
|
8
|
+
import '@mui/system';
|
|
9
9
|
import '../styles/styled.js';
|
|
10
10
|
|
|
11
11
|
const IconButton = forwardRef(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"button":"
|
|
1
|
+
var modules_efc4e723 = {"button":"vt_ce_IconButton_button__cb009384","inner-icon":"vt_ce_IconButton_innerIcon__cb009384","loading-container":"vt_ce_IconButton_loadingContainer__cb009384"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
'use client';
|
|
3
3
|
import React__default, { forwardRef } from 'react';
|
|
4
4
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
5
|
-
import '@mui/system';
|
|
6
5
|
import { cx } from '../styles/cx.js';
|
|
7
6
|
import '../styles/defaultTheme.js';
|
|
7
|
+
import '@mui/system';
|
|
8
8
|
import '../styles/styled.js';
|
|
9
9
|
|
|
10
10
|
const Input = forwardRef((props, ref) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"input":"
|
|
1
|
+
var modules_efc4e723 = {"input":"vt_ce_Input_input__4620481b","label":"vt_ce_Input_label__4620481b","inner-input-container":"vt_ce_Input_innerInputContainer__4620481b","inner-input":"vt_ce_Input_innerInput__4620481b","input-icon":"vt_ce_Input_inputIcon__4620481b","help-label":"vt_ce_Input_helpLabel__4620481b","error-label":"vt_ce_Input_errorLabel__4620481b"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
'use client';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { cx } from '../styles/cx.js';
|
|
5
|
+
import '../styles/defaultTheme.js';
|
|
6
|
+
import '@mui/system';
|
|
7
|
+
import '../styles/styled.js';
|
|
8
|
+
import { useListItem, useMergeRefs, useFloating, offset, flip, shift, size, autoUpdate, useRole, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingList, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
|
|
9
|
+
import modules_efc4e723 from './styles.module.scss.js';
|
|
10
|
+
import { resolvePopoverAnchor } from '../popover/utils.js';
|
|
11
|
+
|
|
12
|
+
function Menu({
|
|
13
|
+
open: isOpen,
|
|
14
|
+
role: assumeRole = "menu",
|
|
15
|
+
placement = "bottom-start",
|
|
16
|
+
strategy = "absolute",
|
|
17
|
+
enableTypeahead = true,
|
|
18
|
+
matchAnchorWidth = false,
|
|
19
|
+
options,
|
|
20
|
+
dismissEnabled = true,
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
const anchor = resolvePopoverAnchor(props.anchor);
|
|
25
|
+
const [activeIndex, setActiveIndex] = React__default.useState(null);
|
|
26
|
+
const elementsRef = React__default.useRef([]);
|
|
27
|
+
const labelsRef = React__default.useRef([]);
|
|
28
|
+
const { floatingStyles, refs, context } = useFloating({
|
|
29
|
+
open: isOpen,
|
|
30
|
+
onOpenChange(newOpen) {
|
|
31
|
+
if (!newOpen && dismissEnabled) {
|
|
32
|
+
props.onDismiss?.();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
elements: {
|
|
36
|
+
reference: anchor
|
|
37
|
+
},
|
|
38
|
+
placement,
|
|
39
|
+
strategy,
|
|
40
|
+
middleware: [
|
|
41
|
+
offset({
|
|
42
|
+
mainAxis: 4,
|
|
43
|
+
alignmentAxis: 0
|
|
44
|
+
}),
|
|
45
|
+
flip(),
|
|
46
|
+
shift(),
|
|
47
|
+
size({
|
|
48
|
+
apply({ rects, elements }) {
|
|
49
|
+
if (matchAnchorWidth) {
|
|
50
|
+
Object.assign(elements.floating.style, {
|
|
51
|
+
width: `${rects.reference.width}px`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
],
|
|
57
|
+
whileElementsMounted: autoUpdate
|
|
58
|
+
});
|
|
59
|
+
const role = useRole(context, { role: assumeRole });
|
|
60
|
+
const dismiss = useDismiss(context, {
|
|
61
|
+
enabled: dismissEnabled,
|
|
62
|
+
bubbles: false
|
|
63
|
+
});
|
|
64
|
+
const listNavigation = useListNavigation(context, {
|
|
65
|
+
listRef: elementsRef,
|
|
66
|
+
activeIndex,
|
|
67
|
+
nested: false,
|
|
68
|
+
onNavigate: setActiveIndex
|
|
69
|
+
});
|
|
70
|
+
const typeahead = useTypeahead(context, {
|
|
71
|
+
enabled: enableTypeahead,
|
|
72
|
+
listRef: labelsRef,
|
|
73
|
+
onMatch: isOpen ? setActiveIndex : void 0,
|
|
74
|
+
activeIndex
|
|
75
|
+
});
|
|
76
|
+
const { getFloatingProps, getItemProps } = useInteractions([
|
|
77
|
+
role,
|
|
78
|
+
dismiss,
|
|
79
|
+
listNavigation,
|
|
80
|
+
typeahead
|
|
81
|
+
]);
|
|
82
|
+
return /* @__PURE__ */ React__default.createElement(FloatingList, { elementsRef, labelsRef }, isOpen && /* @__PURE__ */ React__default.createElement(FloatingPortal, { root: props.portalEl }, /* @__PURE__ */ React__default.createElement(
|
|
83
|
+
FloatingFocusManager,
|
|
84
|
+
{
|
|
85
|
+
context,
|
|
86
|
+
modal: false,
|
|
87
|
+
order: ["reference", "content"]
|
|
88
|
+
},
|
|
89
|
+
/* @__PURE__ */ React__default.createElement(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
ref: refs.setFloating,
|
|
93
|
+
tabIndex: 0,
|
|
94
|
+
"aria-labelledby": anchor?.id || props.anchorId,
|
|
95
|
+
style: {
|
|
96
|
+
...floatingStyles,
|
|
97
|
+
...props.style
|
|
98
|
+
},
|
|
99
|
+
...getFloatingProps(),
|
|
100
|
+
className: cx(modules_efc4e723["menu"], className)
|
|
101
|
+
},
|
|
102
|
+
options.map((option, i) => /* @__PURE__ */ React__default.createElement(
|
|
103
|
+
MenuItem,
|
|
104
|
+
{
|
|
105
|
+
key: i,
|
|
106
|
+
role: "menuitem",
|
|
107
|
+
isActive: i === activeIndex,
|
|
108
|
+
...getItemProps({
|
|
109
|
+
onClick(event) {
|
|
110
|
+
option.onSelect(event);
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
label: option.label,
|
|
114
|
+
icon: option.icon
|
|
115
|
+
}
|
|
116
|
+
))
|
|
117
|
+
)
|
|
118
|
+
)));
|
|
119
|
+
}
|
|
120
|
+
const MenuItem = React__default.forwardRef(({ label, disabled, isActive, ...props }, forwardedRef) => {
|
|
121
|
+
const item = useListItem({ label: disabled ? null : label });
|
|
122
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
123
|
+
"button",
|
|
124
|
+
{
|
|
125
|
+
...props,
|
|
126
|
+
ref: useMergeRefs([item.ref, forwardedRef]),
|
|
127
|
+
type: "button",
|
|
128
|
+
role: "menuitem",
|
|
129
|
+
className: modules_efc4e723["option"],
|
|
130
|
+
tabIndex: isActive ? 0 : -1,
|
|
131
|
+
disabled
|
|
132
|
+
},
|
|
133
|
+
props.icon && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["option-icon"] }, props.icon),
|
|
134
|
+
/* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["option-label"] }, label)
|
|
135
|
+
);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export { MenuItem, Menu as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import Menu from './controlled.js';
|
|
4
|
+
|
|
5
|
+
function createMenuComponent({ portalEl }) {
|
|
6
|
+
return function ScopedMenu(props) {
|
|
7
|
+
return /* @__PURE__ */ React__default.createElement(Menu, { portalEl, ...props });
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { createMenuComponent };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"menu":"
|
|
1
|
+
var modules_efc4e723 = {"menu":"vt_ce_Menu_menu__bd4e93dd","option":"vt_ce_Menu_option__bd4e93dd","option-icon":"vt_ce_Menu_optionIcon__bd4e93dd","option-label":"vt_ce_Menu_optionLabel__bd4e93dd"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import React__default, { forwardRef, useRef, useId } from 'react';
|
|
4
4
|
import { useForkRef } from '@mui/material';
|
|
5
5
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
6
|
-
import '@mui/system';
|
|
7
6
|
import { cx } from '../styles/cx.js';
|
|
8
7
|
import '../styles/defaultTheme.js';
|
|
8
|
+
import '@mui/system';
|
|
9
9
|
import '../styles/styled.js';
|
|
10
10
|
|
|
11
11
|
const RadioButton = forwardRef(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"radio":"
|
|
1
|
+
var modules_efc4e723 = {"radio":"vt_ce_RadioButton_radio__16b9e3d4","radio-circle-outer":"vt_ce_RadioButton_radioCircleOuter__16b9e3d4","radio-circle-inner":"vt_ce_RadioButton_radioCircleInner__16b9e3d4","passthrough-label-container":"vt_ce_RadioButton_passthroughLabelContainer__16b9e3d4","invisible-radio":"vt_ce_RadioButton_invisibleRadio__16b9e3d4","visible-label":"vt_ce_RadioButton_visibleLabel__16b9e3d4","icon-container":"vt_ce_RadioButton_iconContainer__16b9e3d4"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -1,102 +1,110 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
'use client';
|
|
3
|
-
import React__default, {
|
|
4
|
-
import '@mui/system';
|
|
3
|
+
import React__default, { useId, useRef, useState } from 'react';
|
|
5
4
|
import { cx } from '../styles/cx.js';
|
|
6
5
|
import '../styles/defaultTheme.js';
|
|
6
|
+
import '@mui/system';
|
|
7
7
|
import '../styles/styled.js';
|
|
8
8
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
9
9
|
import { ArrowDropDown, Close } from '@mui/icons-material';
|
|
10
|
-
import Menu from '../Menu/
|
|
10
|
+
import Menu from '../Menu/controlled.js';
|
|
11
11
|
import { adaptMuiSvgIcon } from '../Icon/wrappers.js';
|
|
12
12
|
import '../Icon/factory.js';
|
|
13
13
|
|
|
14
14
|
const DefaultEndIcon = adaptMuiSvgIcon(ArrowDropDown);
|
|
15
15
|
const DefaultUnsetIcon = adaptMuiSvgIcon(Close);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
33
|
-
|
|
16
|
+
function ControlledSelect({
|
|
17
|
+
ref,
|
|
18
|
+
endIcon = /* @__PURE__ */ React__default.createElement(DefaultEndIcon, null),
|
|
19
|
+
placeholder = "Select...",
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const anchorId = useId();
|
|
23
|
+
const anchorRef = useRef(null);
|
|
24
|
+
const [activeAnchor, setActiveAnchor] = useState(null);
|
|
25
|
+
const open = Boolean(activeAnchor);
|
|
26
|
+
const unsetIcon = /* @__PURE__ */ React__default.createElement(DefaultUnsetIcon, null);
|
|
27
|
+
const selectedOption = props.options.find(
|
|
28
|
+
(option) => option.value === props.value
|
|
29
|
+
);
|
|
30
|
+
let filteredOptions = props.options;
|
|
31
|
+
if (props.filterOptions) {
|
|
32
|
+
filteredOptions = props.filterOptions(filteredOptions);
|
|
33
|
+
}
|
|
34
|
+
filteredOptions = filteredOptions.filter(
|
|
35
|
+
(option) => option.label.toLowerCase().includes(props.inputValue.toLowerCase())
|
|
36
|
+
);
|
|
37
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
id: anchorId,
|
|
41
|
+
ref: anchorRef,
|
|
42
|
+
className: cx(modules_efc4e723["select"], props.className),
|
|
43
|
+
style: props.style,
|
|
44
|
+
onClick: () => setActiveAnchor(anchorRef.current)
|
|
45
|
+
},
|
|
46
|
+
/* @__PURE__ */ React__default.createElement("label", { className: modules_efc4e723["label"] }, props.label),
|
|
47
|
+
/* @__PURE__ */ React__default.createElement(
|
|
34
48
|
"span",
|
|
35
49
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
className:
|
|
39
|
-
style: props.style,
|
|
40
|
-
onClick: () => setActiveAnchor(anchorRef.current)
|
|
50
|
+
"data-disabled": props.disabled ?? false,
|
|
51
|
+
"data-error": props.error !== void 0,
|
|
52
|
+
className: modules_efc4e723["inner-input-container"]
|
|
41
53
|
},
|
|
42
|
-
/* @__PURE__ */ React__default.createElement("
|
|
54
|
+
props.startIcon && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["select-icon"] }, props.startIcon),
|
|
43
55
|
/* @__PURE__ */ React__default.createElement(
|
|
56
|
+
"input",
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
type: "text",
|
|
60
|
+
placeholder,
|
|
61
|
+
value: selectedOption?.label ?? props.inputValue,
|
|
62
|
+
disabled: props.disabled,
|
|
63
|
+
onChange: (e) => props.onInputChange(e, e.target.value),
|
|
64
|
+
className: modules_efc4e723["inner-input"]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
selectedOption && /* @__PURE__ */ React__default.createElement(
|
|
44
68
|
"span",
|
|
45
69
|
{
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
props.startIcon && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["select-icon"] }, props.startIcon),
|
|
51
|
-
/* @__PURE__ */ React__default.createElement(
|
|
52
|
-
"input",
|
|
53
|
-
{
|
|
54
|
-
ref,
|
|
55
|
-
type: "text",
|
|
56
|
-
placeholder,
|
|
57
|
-
value: selectedOption?.label ?? props.inputValue,
|
|
58
|
-
disabled: props.disabled,
|
|
59
|
-
onChange: (e) => props.onInputChange(e.target.value),
|
|
60
|
-
className: modules_efc4e723["inner-input"]
|
|
70
|
+
className: modules_efc4e723["select-icon"],
|
|
71
|
+
onClick: (e) => {
|
|
72
|
+
props.onChange?.(e, null);
|
|
73
|
+
props.onInputChange(e, "");
|
|
61
74
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"span",
|
|
65
|
-
{
|
|
66
|
-
className: modules_efc4e723["select-icon"],
|
|
67
|
-
onClick: () => {
|
|
68
|
-
props.onChange?.("");
|
|
69
|
-
props.onInputChange("");
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
unsetIcon
|
|
73
|
-
),
|
|
74
|
-
endIcon && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["select-icon"] }, endIcon)
|
|
75
|
+
},
|
|
76
|
+
unsetIcon
|
|
75
77
|
),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
endIcon && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["select-icon"] }, endIcon)
|
|
79
|
+
),
|
|
80
|
+
props.helpLabel && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["help-label"] }, props.helpLabel),
|
|
81
|
+
props.error && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["error-label"] }, /* @__PURE__ */ React__default.createElement(IndicatorCircle, null), /* @__PURE__ */ React__default.createElement("span", null, props.error))
|
|
82
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
83
|
+
Menu,
|
|
84
|
+
{
|
|
85
|
+
role: "select",
|
|
86
|
+
anchorId,
|
|
87
|
+
anchor: activeAnchor,
|
|
88
|
+
portalEl: props.portalEl,
|
|
89
|
+
strategy: props.dropdownStrategy,
|
|
90
|
+
enableTypeahead: false,
|
|
91
|
+
matchAnchorWidth: true,
|
|
92
|
+
open,
|
|
93
|
+
onDismiss: () => {
|
|
94
|
+
setActiveAnchor(null);
|
|
95
|
+
},
|
|
96
|
+
options: filteredOptions.map((option) => ({
|
|
97
|
+
label: option.label,
|
|
98
|
+
icon: option.icon,
|
|
99
|
+
onSelect(e) {
|
|
100
|
+
props.onChange(e, option.value);
|
|
101
|
+
props.onInputChange(e, option.label);
|
|
85
102
|
setActiveAnchor(null);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
props.onChange(option.value);
|
|
92
|
-
props.onInputChange(option.label);
|
|
93
|
-
setActiveAnchor(null);
|
|
94
|
-
}
|
|
95
|
-
}))
|
|
96
|
-
}
|
|
97
|
-
));
|
|
98
|
-
}
|
|
99
|
-
);
|
|
103
|
+
}
|
|
104
|
+
}))
|
|
105
|
+
}
|
|
106
|
+
));
|
|
107
|
+
}
|
|
100
108
|
const IndicatorCircle = () => /* @__PURE__ */ React__default.createElement(
|
|
101
109
|
"svg",
|
|
102
110
|
{
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import Select from './uncontrolled.js';
|
|
4
|
+
import ControlledSelect from './controlled.js';
|
|
5
|
+
|
|
6
|
+
function createSelectComponent({ portalEl }) {
|
|
7
|
+
return forwardRef(function ScopedSelect(props, ref) {
|
|
8
|
+
return /* @__PURE__ */ React__default.createElement(Select, { portalEl, ref, ...props });
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function createControlledSelectComponent({
|
|
12
|
+
portalEl
|
|
13
|
+
}) {
|
|
14
|
+
return forwardRef(function ScopedControlledSelect(props, ref) {
|
|
15
|
+
return /* @__PURE__ */ React__default.createElement(ControlledSelect, { portalEl, ref, ...props });
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { createControlledSelectComponent, createSelectComponent };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"select":"
|
|
1
|
+
var modules_efc4e723 = {"select":"vt_ce_Select_select__b9f77002","label":"vt_ce_Select_label__b9f77002","inner-input-container":"vt_ce_Select_innerInputContainer__b9f77002","inner-input":"vt_ce_Select_innerInput__b9f77002","select-icon":"vt_ce_Select_selectIcon__b9f77002","help-label":"vt_ce_Select_helpLabel__b9f77002","error-label":"vt_ce_Select_errorLabel__b9f77002"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
'use client';
|
|
3
|
+
import React__default, { useState } from 'react';
|
|
4
|
+
import ControlledSelect from './controlled.js';
|
|
5
|
+
|
|
6
|
+
function Select({
|
|
7
|
+
ref,
|
|
8
|
+
defaultValue = null,
|
|
9
|
+
value: propsValue,
|
|
10
|
+
inputValue: propsInputValue,
|
|
11
|
+
onChange: propsOnChange,
|
|
12
|
+
onInputChange: propsOnInputChange,
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
16
|
+
const [value, onChange] = propsValue !== void 0 ? [
|
|
17
|
+
propsValue,
|
|
18
|
+
(e, newValue) => {
|
|
19
|
+
propsOnChange?.(e, newValue);
|
|
20
|
+
}
|
|
21
|
+
] : [
|
|
22
|
+
uncontrolled,
|
|
23
|
+
(e, newValue) => {
|
|
24
|
+
setUncontrolled(newValue);
|
|
25
|
+
propsOnChange?.(e, newValue);
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
const [uncontrolledInputValue, setUncontrolledInputValue] = useState("");
|
|
29
|
+
const [inputValue, onInputChange] = propsInputValue !== void 0 ? [
|
|
30
|
+
propsInputValue,
|
|
31
|
+
(e, newValue) => {
|
|
32
|
+
propsOnInputChange?.(e, newValue);
|
|
33
|
+
}
|
|
34
|
+
] : [
|
|
35
|
+
uncontrolledInputValue,
|
|
36
|
+
(e, newValue) => {
|
|
37
|
+
setUncontrolledInputValue(newValue);
|
|
38
|
+
propsOnInputChange?.(e, newValue);
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
42
|
+
ControlledSelect,
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
...props,
|
|
46
|
+
value,
|
|
47
|
+
onChange,
|
|
48
|
+
inputValue,
|
|
49
|
+
onInputChange
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { Select as default };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
'use client';
|
|
3
3
|
import React__default, { forwardRef } from 'react';
|
|
4
4
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
5
|
-
import '@mui/system';
|
|
6
5
|
import { cx } from '../styles/cx.js';
|
|
7
6
|
import '../styles/defaultTheme.js';
|
|
7
|
+
import '@mui/system';
|
|
8
8
|
import '../styles/styled.js';
|
|
9
9
|
|
|
10
10
|
const Textarea = forwardRef(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"textarea":"
|
|
1
|
+
var modules_efc4e723 = {"textarea":"vt_ce_Textarea_textarea__c4cfba0d","label":"vt_ce_Textarea_label__c4cfba0d","inner-textarea-container":"vt_ce_Textarea_innerTextareaContainer__c4cfba0d","inner-textarea":"vt_ce_Textarea_innerTextarea__c4cfba0d","help-label":"vt_ce_Textarea_helpLabel__c4cfba0d","error-label":"vt_ce_Textarea_errorLabel__c4cfba0d"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { useFloating, shift, flip, arrow, useRole, useHover, safePolygon, useFocus, useDismiss, useInteractions, FloatingArrow } from '@floating-ui/react';
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import modules_efc4e723 from './styles.module.scss.js';
|
|
6
|
-
import '@mui/system';
|
|
7
6
|
import { defaultThemeCssVariableUsages } from '../styles/defaultTheme.js';
|
|
7
|
+
import '@mui/system';
|
|
8
8
|
import '../styles/styled.js';
|
|
9
9
|
|
|
10
10
|
function Tooltip(props) {
|