@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.
Files changed (64) hide show
  1. package/dist/esm-next/Alert/index.js +1 -1
  2. package/dist/esm-next/Alert/styles.module.scss.js +1 -1
  3. package/dist/esm-next/Button/index.js +1 -1
  4. package/dist/esm-next/Button/styles.module.scss.js +1 -1
  5. package/dist/esm-next/Checkbox/index.js +1 -1
  6. package/dist/esm-next/Checkbox/styles.module.scss.js +1 -1
  7. package/dist/esm-next/CircularProgress/index.js +1 -1
  8. package/dist/esm-next/CircularProgress/styles.module.scss.js +1 -1
  9. package/dist/esm-next/Dialog/factory.js +13 -0
  10. package/dist/esm-next/Dialog/styles.module.scss.js +1 -1
  11. package/dist/esm-next/Icon/factory.js +3 -3
  12. package/dist/esm-next/Icon/wrappers.js +1 -1
  13. package/dist/esm-next/IconButton/index.js +1 -1
  14. package/dist/esm-next/IconButton/styles.module.scss.js +1 -1
  15. package/dist/esm-next/Input/index.js +1 -1
  16. package/dist/esm-next/Input/styles.module.scss.js +1 -1
  17. package/dist/esm-next/Menu/controlled.js +138 -0
  18. package/dist/esm-next/Menu/factory.js +11 -0
  19. package/dist/esm-next/Menu/styles.module.scss.js +1 -1
  20. package/dist/esm-next/RadioButton/index.js +1 -1
  21. package/dist/esm-next/RadioButton/styles.module.scss.js +1 -1
  22. package/dist/esm-next/Select/controlled.js +86 -78
  23. package/dist/esm-next/Select/factory.js +19 -0
  24. package/dist/esm-next/Select/styles.module.scss.js +1 -1
  25. package/dist/esm-next/Select/uncontrolled.js +54 -0
  26. package/dist/esm-next/Textarea/index.js +1 -1
  27. package/dist/esm-next/Textarea/styles.module.scss.js +1 -1
  28. package/dist/esm-next/Tooltip/index.js +1 -1
  29. package/dist/esm-next/Tooltip/styles.module.scss.js +1 -1
  30. package/dist/esm-next/Typography/index.js +1 -1
  31. package/dist/esm-next/Typography/variants.module.scss.js +1 -1
  32. package/dist/esm-next/index.js +12 -8
  33. package/dist/esm-next/styles/css-vars.js +8 -8
  34. package/dist/esm-next/styles/provider.client.js +23 -0
  35. package/dist/esm-next/styles/provider.css-vars.js +25 -0
  36. package/dist/esm-next/styles/scss/_index.scss +1 -2
  37. package/dist/esm-next/styles/scss/baseline.scss +1 -1
  38. package/dist/esm-next/styles/scss/theme.generated.scss +188 -0
  39. package/dist/esm-next/styles.css +13 -13
  40. package/dist/types/src-next/Dialog/components.d.ts +27 -0
  41. package/dist/types/src-next/Dialog/factory.d.ts +13 -0
  42. package/dist/types/src-next/Dialog/index.d.ts +3 -27
  43. package/dist/types/src-next/Icon/factory.d.ts +1 -0
  44. package/dist/types/src-next/Menu/controlled.d.ts +33 -0
  45. package/dist/types/src-next/Menu/factory.d.ts +7 -0
  46. package/dist/types/src-next/Menu/index.d.ts +3 -20
  47. package/dist/types/src-next/Select/controlled.d.ts +6 -21
  48. package/dist/types/src-next/Select/factory.d.ts +11 -0
  49. package/dist/types/src-next/Select/index.d.ts +5 -17
  50. package/dist/types/src-next/Select/types.d.ts +25 -0
  51. package/dist/types/src-next/Select/uncontrolled.d.ts +12 -0
  52. package/dist/types/src-next/popover/types.d.ts +3 -0
  53. package/dist/types/src-next/styles/index.d.ts +4 -5
  54. package/dist/types/src-next/styles/provider.client.d.ts +8 -0
  55. package/dist/types/src-next/styles/provider.css-vars.d.ts +10 -0
  56. package/package.json +9 -6
  57. package/dist/esm-next/Menu/index.js +0 -64
  58. package/dist/esm-next/Select/index.js +0 -40
  59. package/dist/esm-next/styles/ThemeProvider.js +0 -28
  60. package/dist/esm-next/styles/scss/functions.scss +0 -3
  61. package/dist/esm-next/styles/scss/mixins.scss +0 -7
  62. package/dist/esm-next/utils/controlled.js +0 -17
  63. package/dist/types/src-next/styles/ThemeProvider.d.ts +0 -7
  64. 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":"vt_ce_Alert_alert__2e7da7e9","alert-stripe":"vt_ce_Alert_alertStripe__2e7da7e9","alert-icon":"vt_ce_Alert_alertIcon__2e7da7e9","alert-content":"vt_ce_Alert_alertContent__2e7da7e9","alert-label":"vt_ce_Alert_alertLabel__2e7da7e9","alert-text":"vt_ce_Alert_alertText__2e7da7e9","spacer":"vt_ce_Alert_spacer__2e7da7e9","alert-action":"vt_ce_Alert_alertAction__2e7da7e9","alert-close":"vt_ce_Alert_alertClose__2e7da7e9"};
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":"vt_ce_Button_button__582c594f","primary":"vt_ce_Button_primary__582c594f","secondary":"vt_ce_Button_secondary__582c594f","tertiary":"vt_ce_Button_tertiary__582c594f","inner-container":"vt_ce_Button_innerContainer__582c594f","loading-container":"vt_ce_Button_loadingContainer__582c594f","button-icon":"vt_ce_Button_buttonIcon__582c594f"};
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":"vt_ce_Checkbox_checkbox__54a9c9d4","checkbox-svg-path":"vt_ce_Checkbox_checkboxSvgPath__54a9c9d4","passthrough-label-container":"vt_ce_Checkbox_passthroughLabelContainer__54a9c9d4","invisible-checkbox":"vt_ce_Checkbox_invisibleCheckbox__54a9c9d4","visible-label":"vt_ce_Checkbox_visibleLabel__54a9c9d4","icon-container":"vt_ce_Checkbox_iconContainer__54a9c9d4"};
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();
@@ -1,3 +1,3 @@
1
- var modules_efc4e723 = {"container":"vt_ce_CircularProgress_container__784b3b1b"};
1
+ var modules_efc4e723 = {"container":"vt_ce_CircularProgress_container__ea033e1c"};
2
2
 
3
3
  export { modules_efc4e723 as default };
@@ -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":"vt_ce_Dialog_dialogOverlay__3f485107","dialog":"vt_ce_Dialog_dialog__3f485107","dialog-heading":"vt_ce_Dialog_dialogHeading__3f485107","dialog-content":"vt_ce_Dialog_dialogContent__3f485107","dialog-typography":"vt_ce_Dialog_dialogTypography__3f485107","dialog-actions":"vt_ce_Dialog_dialogActions__3f485107"};
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 DefaultFallback = adaptMuiSvgIcon(BrokenImageOutlined);
6
+ const DefaultIconFallback = adaptMuiSvgIcon(BrokenImageOutlined);
7
7
  function createIconComponent({
8
8
  iconMap = {},
9
- fallback = DefaultFallback
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":"vt_ce_IconButton_button__b21b4335","inner-icon":"vt_ce_IconButton_innerIcon__b21b4335","loading-container":"vt_ce_IconButton_loadingContainer__b21b4335"};
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":"vt_ce_Input_input__a0b6a844","label":"vt_ce_Input_label__a0b6a844","inner-input-container":"vt_ce_Input_innerInputContainer__a0b6a844","inner-input":"vt_ce_Input_innerInput__a0b6a844","input-icon":"vt_ce_Input_inputIcon__a0b6a844","help-label":"vt_ce_Input_helpLabel__a0b6a844","error-label":"vt_ce_Input_errorLabel__a0b6a844"};
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":"vt_ce_Menu_menu__d4a8c606","option":"vt_ce_Menu_option__d4a8c606","option-icon":"vt_ce_Menu_optionIcon__d4a8c606"};
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":"vt_ce_RadioButton_radio__c46ae03e","radio-circle-outer":"vt_ce_RadioButton_radioCircleOuter__c46ae03e","radio-circle-inner":"vt_ce_RadioButton_radioCircleInner__c46ae03e","passthrough-label-container":"vt_ce_RadioButton_passthroughLabelContainer__c46ae03e","invisible-radio":"vt_ce_RadioButton_invisibleRadio__c46ae03e","visible-label":"vt_ce_RadioButton_visibleLabel__c46ae03e","icon-container":"vt_ce_RadioButton_iconContainer__c46ae03e"};
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, { forwardRef, useId, useRef, useState } from 'react';
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/index.js';
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
- const ControlledSelect = forwardRef(
17
- ({ endIcon = /* @__PURE__ */ React__default.createElement(DefaultEndIcon, null), placeholder = "Select...", ...props }, ref) => {
18
- const anchorId = useId();
19
- const anchorRef = useRef(null);
20
- const [activeAnchor, setActiveAnchor] = useState(null);
21
- const open = Boolean(activeAnchor);
22
- const unsetIcon = /* @__PURE__ */ React__default.createElement(DefaultUnsetIcon, null);
23
- const selectedOption = props.options.find(
24
- (option) => option.value === props.value
25
- );
26
- let filteredOptions = props.options;
27
- if (props.filterOptions) {
28
- filteredOptions = props.filterOptions(filteredOptions);
29
- }
30
- filteredOptions = filteredOptions.filter(
31
- (option) => option.label.toLowerCase().includes(props.inputValue.toLowerCase())
32
- );
33
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
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
- id: anchorId,
37
- ref: anchorRef,
38
- className: cx(modules_efc4e723["select"], props.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("label", { className: modules_efc4e723["label"] }, props.label),
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
- "data-disabled": props.disabled ?? false,
47
- "data-error": props.error !== void 0,
48
- className: modules_efc4e723["inner-input-container"]
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
- selectedOption && /* @__PURE__ */ React__default.createElement(
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
- props.helpLabel && /* @__PURE__ */ React__default.createElement("span", { className: modules_efc4e723["help-label"] }, props.helpLabel),
77
- 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))
78
- ), /* @__PURE__ */ React__default.createElement(
79
- Menu,
80
- {
81
- anchorId,
82
- anchor: activeAnchor,
83
- open,
84
- onDismiss: () => {
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
- options: filteredOptions.map((option) => ({
88
- label: option.label,
89
- icon: option.icon,
90
- onSelect() {
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":"vt_ce_Select_select__f0a62729","label":"vt_ce_Select_label__f0a62729","inner-input-container":"vt_ce_Select_innerInputContainer__f0a62729","inner-input":"vt_ce_Select_innerInput__f0a62729","select-icon":"vt_ce_Select_selectIcon__f0a62729","help-label":"vt_ce_Select_helpLabel__f0a62729","error-label":"vt_ce_Select_errorLabel__f0a62729"};
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":"vt_ce_Textarea_textarea__904749ad","label":"vt_ce_Textarea_label__904749ad","inner-textarea-container":"vt_ce_Textarea_innerTextareaContainer__904749ad","inner-textarea":"vt_ce_Textarea_innerTextarea__904749ad","help-label":"vt_ce_Textarea_helpLabel__904749ad","error-label":"vt_ce_Textarea_errorLabel__904749ad"};
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) {