@veritone-ce/design-system 2.6.1-alpha.1 → 2.6.1-alpha.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.
@@ -180,6 +180,7 @@ function ControlledSelect({
180
180
  matchAnchorWidth: true,
181
181
  onDismiss: () => {
182
182
  setOpen(false);
183
+ props.onBlur?.();
183
184
  },
184
185
  options: filteredOptions.map((option) => ({
185
186
  label: option.label,
@@ -1,8 +1,6 @@
1
1
  'use strict';
2
2
  'use strict';
3
3
 
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
4
  var jsxRuntime = require('react/jsx-runtime');
7
5
  var ReactMarkdown = require('react-markdown');
8
6
  var styles_module = require('./styles.module.scss.js');
@@ -245,4 +243,4 @@ function Markdown({
245
243
  );
246
244
  }
247
245
 
248
- exports.default = Markdown;
246
+ exports.Markdown = Markdown;
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  'use strict';
3
4
 
4
5
  var jsxRuntime = require('react/jsx-runtime');
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+ 'use client';
3
+ 'use strict';
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var reactHookForm = require('react-hook-form');
7
+ var shared = require('./shared.js');
8
+ var index$1 = require('../../../Checkbox/index.js');
9
+ var index = require('../../../FormControl/index.js');
10
+
11
+ function FormCheckbox(props) {
12
+ const { controllerProps, formControlProps, inputProps } = shared.extractControllerProps(props);
13
+ const { label, ...restFormControlProps } = formControlProps;
14
+ const { field, fieldState } = reactHookForm.useController(controllerProps);
15
+ const errorMessage = shared.useFormErrorMessage(fieldState.error);
16
+ return /* @__PURE__ */ jsxRuntime.jsx(
17
+ index.default,
18
+ {
19
+ disabled: field.disabled,
20
+ ...restFormControlProps,
21
+ error: errorMessage,
22
+ children: /* @__PURE__ */ jsxRuntime.jsx(
23
+ index$1.default,
24
+ {
25
+ ...inputProps,
26
+ ...field,
27
+ label,
28
+ checked: field.value ?? false
29
+ }
30
+ )
31
+ }
32
+ );
33
+ }
34
+
35
+ exports.FormCheckbox = FormCheckbox;
@@ -2,14 +2,18 @@
2
2
  'use strict';
3
3
 
4
4
  var button = require('./button.js');
5
+ var checkbox = require('./checkbox.js');
5
6
  var input = require('./input.js');
7
+ var select = require('./select.js');
6
8
  var shared = require('./shared.js');
7
9
  var textarea = require('./textarea.js');
8
10
 
9
11
 
10
12
 
11
13
  exports.FormSubmitButton = button.FormSubmitButton;
14
+ exports.FormCheckbox = checkbox.FormCheckbox;
12
15
  exports.FormInput = input.FormInput;
16
+ exports.FormSelect = select.FormSelect;
13
17
  exports.extractControllerProps = shared.extractControllerProps;
14
18
  exports.useFormErrorMessage = shared.useFormErrorMessage;
15
19
  exports.FormTextarea = textarea.FormTextarea;
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  'use strict';
3
4
 
4
5
  var jsxRuntime = require('react/jsx-runtime');
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+ 'use client';
3
+ 'use strict';
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var reactHookForm = require('react-hook-form');
7
+ var shared = require('./shared.js');
8
+ require('../../../Select/controlled.js');
9
+ var uncontrolled = require('../../../Select/uncontrolled.js');
10
+ require('react');
11
+ var index = require('../../../FormControl/index.js');
12
+
13
+ function FormSelect(props) {
14
+ const { controllerProps, formControlProps, inputProps } = shared.extractControllerProps(props);
15
+ const { field, fieldState } = reactHookForm.useController(controllerProps);
16
+ const { onChange, ref: _ref, ...restFieldProps } = field;
17
+ const errorMessage = shared.useFormErrorMessage(fieldState.error);
18
+ return /* @__PURE__ */ jsxRuntime.jsx(
19
+ index.default,
20
+ {
21
+ disabled: field.disabled,
22
+ ...formControlProps,
23
+ error: errorMessage,
24
+ children: /* @__PURE__ */ jsxRuntime.jsx(
25
+ uncontrolled.default,
26
+ {
27
+ ...inputProps,
28
+ ...restFieldProps,
29
+ value: field.value,
30
+ onChange: (e, newValue) => {
31
+ console.log(newValue);
32
+ onChange({
33
+ ...e,
34
+ target: {
35
+ ...e.target,
36
+ value: newValue
37
+ }
38
+ });
39
+ }
40
+ }
41
+ )
42
+ }
43
+ );
44
+ }
45
+
46
+ exports.FormSelect = FormSelect;
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  'use strict';
3
4
 
4
5
  var React = require('react');
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  'use strict';
3
4
 
4
5
  var jsxRuntime = require('react/jsx-runtime');
@@ -176,6 +176,7 @@ function ControlledSelect({
176
176
  matchAnchorWidth: true,
177
177
  onDismiss: () => {
178
178
  setOpen(false);
179
+ props.onBlur?.();
179
180
  },
180
181
  options: filteredOptions.map((option) => ({
181
182
  label: option.label,
@@ -241,4 +241,4 @@ function Markdown({
241
241
  );
242
242
  }
243
243
 
244
- export { Markdown as default };
244
+ export { Markdown };
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
  import { useFormState } from 'react-hook-form';
4
5
  import { SuccessIcon } from '../../../Icon/internal.js';
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+ 'use client';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { useController } from 'react-hook-form';
5
+ import { extractControllerProps, useFormErrorMessage } from './shared.js';
6
+ import Checkbox from '../../../Checkbox/index.js';
7
+ import FormControl from '../../../FormControl/index.js';
8
+
9
+ function FormCheckbox(props) {
10
+ const { controllerProps, formControlProps, inputProps } = extractControllerProps(props);
11
+ const { label, ...restFormControlProps } = formControlProps;
12
+ const { field, fieldState } = useController(controllerProps);
13
+ const errorMessage = useFormErrorMessage(fieldState.error);
14
+ return /* @__PURE__ */ jsx(
15
+ FormControl,
16
+ {
17
+ disabled: field.disabled,
18
+ ...restFormControlProps,
19
+ error: errorMessage,
20
+ children: /* @__PURE__ */ jsx(
21
+ Checkbox,
22
+ {
23
+ ...inputProps,
24
+ ...field,
25
+ label,
26
+ checked: field.value ?? false
27
+ }
28
+ )
29
+ }
30
+ );
31
+ }
32
+
33
+ export { FormCheckbox };
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
  export { FormSubmitButton } from './button.js';
3
+ export { FormCheckbox } from './checkbox.js';
3
4
  export { FormInput } from './input.js';
5
+ export { FormSelect } from './select.js';
4
6
  export { extractControllerProps, useFormErrorMessage } from './shared.js';
5
7
  export { FormTextarea } from './textarea.js';
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
  import { useController } from 'react-hook-form';
4
5
  import { extractControllerProps, useFormErrorMessage } from './shared.js';
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+ 'use client';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { useController } from 'react-hook-form';
5
+ import { extractControllerProps, useFormErrorMessage } from './shared.js';
6
+ import '../../../Select/controlled.js';
7
+ import Select from '../../../Select/uncontrolled.js';
8
+ import 'react';
9
+ import FormControl from '../../../FormControl/index.js';
10
+
11
+ function FormSelect(props) {
12
+ const { controllerProps, formControlProps, inputProps } = extractControllerProps(props);
13
+ const { field, fieldState } = useController(controllerProps);
14
+ const { onChange, ref: _ref, ...restFieldProps } = field;
15
+ const errorMessage = useFormErrorMessage(fieldState.error);
16
+ return /* @__PURE__ */ jsx(
17
+ FormControl,
18
+ {
19
+ disabled: field.disabled,
20
+ ...formControlProps,
21
+ error: errorMessage,
22
+ children: /* @__PURE__ */ jsx(
23
+ Select,
24
+ {
25
+ ...inputProps,
26
+ ...restFieldProps,
27
+ value: field.value,
28
+ onChange: (e, newValue) => {
29
+ console.log(newValue);
30
+ onChange({
31
+ ...e,
32
+ target: {
33
+ ...e.target,
34
+ value: newValue
35
+ }
36
+ });
37
+ }
38
+ }
39
+ )
40
+ }
41
+ );
42
+ }
43
+
44
+ export { FormSelect };
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  import { useMemo } from 'react';
3
4
 
4
5
  function useFormErrorMessage(error) {
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ 'use client';
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
  import { useController } from 'react-hook-form';
4
5
  import { extractControllerProps, useFormErrorMessage } from './shared.js';
@@ -9,6 +9,7 @@ export type ControlledSelectProps<OptionValue, Multiple extends boolean | undefi
9
9
  */
10
10
  multiple: Multiple;
11
11
  onChange(event: React.SyntheticEvent<HTMLElement>, newValue: Multiple extends true ? SelectMultiValue<OptionValue> : SelectSingleValue<OptionValue>): void;
12
+ onBlur?(): void;
12
13
  onInputChange(event: React.SyntheticEvent<HTMLElement>, newValue: string): void;
13
14
  'data-pendo'?: string;
14
15
  tight?: boolean;
@@ -6,6 +6,7 @@ export type SelectProps<OptionValue, Multiple extends boolean | undefined> = Com
6
6
  value?: Multiple extends true ? SelectMultiValue<OptionValue> : SelectSingleValue<OptionValue>;
7
7
  inputValue?: string;
8
8
  onChange?(event: React.SyntheticEvent<HTMLElement>, newValue: Multiple extends true ? SelectMultiValue<OptionValue> : SelectSingleValue<OptionValue>): void;
9
+ onBlur?(): void;
9
10
  onInputChange?(event: React.SyntheticEvent<HTMLElement>, newValue: string, tight?: boolean): void;
10
11
  tight?: boolean;
11
12
  };
@@ -23,5 +23,5 @@ export type MarkdownProps = Options & {
23
23
  [key in keyof DefaultComponentsType]?: string;
24
24
  };
25
25
  };
26
- export default function Markdown({ components, headerIncrement, paragraphIncrement, style, className, styles: componentStyles, classNames: componentClassNames, ...props }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function Markdown({ components, headerIncrement, paragraphIncrement, style, className, styles: componentStyles, classNames: componentClassNames, ...props }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
27
27
  export {};
@@ -0,0 +1,5 @@
1
+ import { FieldValues, UseControllerProps } from 'react-hook-form';
2
+ import type { FormControlProps } from '../../../FormControl/index.js';
3
+ import { CheckboxProps } from '../../../Checkbox/index.js';
4
+ export type FormCheckboxProps<FormValues extends FieldValues> = UseControllerProps<FormValues> & FormControlProps & Omit<CheckboxProps, 'checked'>;
5
+ export declare function FormCheckbox<FormValues extends FieldValues>(props: FormCheckboxProps<FormValues>): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,6 @@
1
1
  export * from './button.js';
2
+ export * from './checkbox.js';
2
3
  export * from './input.js';
4
+ export * from './select.js';
3
5
  export * from './shared.js';
4
6
  export * from './textarea.js';
@@ -0,0 +1,5 @@
1
+ import { FieldValues, UseControllerProps } from 'react-hook-form';
2
+ import type { FormControlProps } from '../../../FormControl/index.js';
3
+ import { SelectProps } from '../../../Select/index.js';
4
+ export type FormSelectProps<FormValues extends FieldValues, OptionValue, Multiple extends boolean | undefined> = UseControllerProps<FormValues> & FormControlProps & SelectProps<OptionValue, Multiple>;
5
+ export declare function FormSelect<FormValues extends FieldValues, OptionValue, Multiple extends boolean | undefined>(props: FormSelectProps<FormValues, OptionValue, Multiple>): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritone-ce/design-system",
3
- "version": "2.6.1-alpha.1",
3
+ "version": "2.6.1-alpha.2",
4
4
  "private": false,
5
5
  "description": "Design System for Veritone CE",
6
6
  "keywords": [