@jobber/components 6.40.2 → 6.41.0

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.
@@ -14,7 +14,16 @@ require('../isSymbol-cjs.js');
14
14
  require('../Glimmer-cjs.js');
15
15
  require('../tslib.es6-cjs.js');
16
16
  require('../Content-cjs.js');
17
- require('../Option-cjs.js');
17
+ require('../Select/index.cjs');
18
+ require('../omit-cjs.js');
19
+ require('../_baseGet-cjs.js');
20
+ require('../isTypedArray-cjs.js');
21
+ require('../identity-cjs.js');
22
+ require('../_getTag-cjs.js');
23
+ require('../keysIn-cjs.js');
24
+ require('../_baseAssignValue-cjs.js');
25
+ require('../_baseFlatten-cjs.js');
26
+ require('../_setToString-cjs.js');
18
27
  require('../FormField-cjs.js');
19
28
  require('framer-motion');
20
29
  require('@jobber/design');
@@ -12,7 +12,16 @@ import '../isSymbol-es.js';
12
12
  import '../Glimmer-es.js';
13
13
  import '../tslib.es6-es.js';
14
14
  import '../Content-es.js';
15
- import '../Option-es.js';
15
+ import '../Select/index.mjs';
16
+ import '../omit-es.js';
17
+ import '../_baseGet-es.js';
18
+ import '../isTypedArray-es.js';
19
+ import '../identity-es.js';
20
+ import '../_getTag-es.js';
21
+ import '../keysIn-es.js';
22
+ import '../_baseAssignValue-es.js';
23
+ import '../_baseFlatten-es.js';
24
+ import '../_setToString-es.js';
16
25
  import '../FormField-es.js';
17
26
  import 'framer-motion';
18
27
  import '@jobber/design';
@@ -6,7 +6,7 @@ var React = require('react');
6
6
  var useResizeObserver = require('./useResizeObserver-cjs.js');
7
7
  var Glimmer = require('./Glimmer-cjs.js');
8
8
  var tslib_es6 = require('./tslib.es6-cjs.js');
9
- var Option = require('./Option-cjs.js');
9
+ var Select_index = require('./Select/index.cjs');
10
10
  var Button = require('./Button-cjs.js');
11
11
  var Text = require('./Text-cjs.js');
12
12
 
@@ -110,9 +110,9 @@ function Pagination({ table, itemsPerPage, totalItems, loading, onPageChange, })
110
110
  React.createElement("div", { className: styles$2.paginationInfo }, `Showing ${firstPosition}-${secondPosition} of ${totalRows} items`),
111
111
  React.createElement("div", { className: styles$2.paginationNav },
112
112
  React.createElement("div", { className: styles$2.paginationSelect },
113
- React.createElement(Option.Select, { value: table.getState().pagination.pageSize, onChange: value => {
113
+ React.createElement(Select_index.Select, { value: table.getState().pagination.pageSize, onChange: value => {
114
114
  table.setPageSize(Number(value));
115
- }, size: "small" }, itemsPerPageOptions.map(numOfPages => (React.createElement(Option.SelectOption, { key: numOfPages, value: numOfPages }, numOfPages)))),
115
+ }, size: "small" }, itemsPerPageOptions.map(numOfPages => (React.createElement(Select_index.Option, { key: numOfPages, value: numOfPages }, numOfPages)))),
116
116
  React.createElement("span", { className: styles$2.paginationSelectLabel }, "per page")),
117
117
  React.createElement("div", { className: styles$2.paginationButtons },
118
118
  React.createElement(Button.Button, { type: "secondary", variation: "subtle", icon: "arrowLeft", ariaLabel: "arrowLeft", onClick: () => {
@@ -4,7 +4,7 @@ import React__default, { useCallback, useMemo } from 'react';
4
4
  import { u as useResizeObserver } from './useResizeObserver-es.js';
5
5
  import { G as Glimmer } from './Glimmer-es.js';
6
6
  import { _ as __rest } from './tslib.es6-es.js';
7
- import { S as Select, a as SelectOption } from './Option-es.js';
7
+ import { Select, Option as SelectOption } from './Select/index.mjs';
8
8
  import { B as Button } from './Button-es.js';
9
9
  import { T as Text } from './Text-es.js';
10
10
 
@@ -6,7 +6,19 @@ require('react');
6
6
  require('../Text-cjs.js');
7
7
  require('../Typography-cjs.js');
8
8
  require('classnames');
9
- require('../Option-cjs.js');
9
+ require('../Select/index.cjs');
10
+ require('../omit-cjs.js');
11
+ require('../_commonjsHelpers-cjs.js');
12
+ require('../_baseGet-cjs.js');
13
+ require('../isTypedArray-cjs.js');
14
+ require('../isObjectLike-cjs.js');
15
+ require('../identity-cjs.js');
16
+ require('../_getTag-cjs.js');
17
+ require('../isSymbol-cjs.js');
18
+ require('../keysIn-cjs.js');
19
+ require('../_baseAssignValue-cjs.js');
20
+ require('../_baseFlatten-cjs.js');
21
+ require('../_setToString-cjs.js');
10
22
  require('../FormField-cjs.js');
11
23
  require('framer-motion');
12
24
  require('@jobber/design');
@@ -4,7 +4,19 @@ import 'react';
4
4
  import '../Text-es.js';
5
5
  import '../Typography-es.js';
6
6
  import 'classnames';
7
- import '../Option-es.js';
7
+ import '../Select/index.mjs';
8
+ import '../omit-es.js';
9
+ import '../_commonjsHelpers-es.js';
10
+ import '../_baseGet-es.js';
11
+ import '../isTypedArray-es.js';
12
+ import '../isObjectLike-es.js';
13
+ import '../identity-es.js';
14
+ import '../_getTag-es.js';
15
+ import '../isSymbol-es.js';
16
+ import '../keysIn-es.js';
17
+ import '../_baseAssignValue-es.js';
18
+ import '../_baseFlatten-es.js';
19
+ import '../_setToString-es.js';
8
20
  import '../FormField-es.js';
9
21
  import 'framer-motion';
10
22
  import '@jobber/design';
@@ -4,7 +4,7 @@ var React = require('react');
4
4
  var DayOfMonthSelect = require('./DayOfMonthSelect-cjs.js');
5
5
  var Text = require('./Text-cjs.js');
6
6
  require('classnames');
7
- var Option = require('./Option-cjs.js');
7
+ var Select_index = require('./Select/index.cjs');
8
8
  var InputNumber = require('./InputNumber-cjs.js');
9
9
  var InputGroup = require('./InputGroup-cjs.js');
10
10
  var Content = require('./Content-cjs.js');
@@ -52,11 +52,11 @@ function RecurringSelect({ value, disabled = false, onChange, }) {
52
52
  React.createElement("div", { className: styles.fullWidthWrapper },
53
53
  React.createElement(InputGroup.InputGroup, { flowDirection: "horizontal" },
54
54
  React.createElement(InputNumber.InputNumber, { disabled: disabled, name: "schedule-recurrence-interval", value: value.interval, min: 1, maxLength: 3, onChange: onChangeInterval }),
55
- React.createElement(Option.Select, { disabled: disabled, value: value.type, onChange: onChangeType, name: "schedule-recurrence-type" },
56
- React.createElement(Option.SelectOption, { value: DayOfMonthSelect.DurationPeriod.Day }, "Day(s)"),
57
- React.createElement(Option.SelectOption, { value: DayOfMonthSelect.DurationPeriod.Week }, "Week(s)"),
58
- React.createElement(Option.SelectOption, { value: monthlySelectOptionValue }, "Month(s)"),
59
- React.createElement(Option.SelectOption, { value: DayOfMonthSelect.DurationPeriod.Year }, "Year(s)")))),
55
+ React.createElement(Select_index.Select, { disabled: disabled, value: value.type, onChange: onChangeType, name: "schedule-recurrence-type" },
56
+ React.createElement(Select_index.Option, { value: DayOfMonthSelect.DurationPeriod.Day }, "Day(s)"),
57
+ React.createElement(Select_index.Option, { value: DayOfMonthSelect.DurationPeriod.Week }, "Week(s)"),
58
+ React.createElement(Select_index.Option, { value: monthlySelectOptionValue }, "Month(s)"),
59
+ React.createElement(Select_index.Option, { value: DayOfMonthSelect.DurationPeriod.Year }, "Year(s)")))),
60
60
  hasExtraFrequencyDescriptor && (React.createElement(Text.Text, { variation: disabledTextVariation }, "on"))),
61
61
  DayOfMonthSelect.isMonthly(value) && (React.createElement(DayOfMonthSelect.MonthlySelect, { disabled: disabled, onChange: onChangeType, selectedMonthOption: value.type })),
62
62
  React.createElement(CurrentRecurrenceComponent, { disabled: disabled, recurrenceRule: value, onChange: onChange })));
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import { D as DurationPeriod, c as DayOfMonthSelect, b as MonthlyDayOfWeekSelect, a as WeeklySelect, i as isMonthly, M as MonthlySelect, t as typeInitialStateMap } from './DayOfMonthSelect-es.js';
3
3
  import { T as Text } from './Text-es.js';
4
4
  import 'classnames';
5
- import { S as Select, a as SelectOption } from './Option-es.js';
5
+ import { Select, Option as SelectOption } from './Select/index.mjs';
6
6
  import { I as InputNumber } from './InputNumber-es.js';
7
7
  import { I as InputGroup } from './InputGroup-es.js';
8
8
  import { C as Content } from './Content-es.js';
@@ -1,10 +1,2 @@
1
- import { FormFieldProps } from "../FormField";
2
- /**
3
- * The following is the same as:
4
- * type BaseProps = Omit<FormFieldProps, "type" | "children">;
5
- * Unfortunately Docz doesn't currently support Omit so it has been reduced to
6
- * its component parts.
7
- */
8
- type SelectProps = Pick<FormFieldProps, Exclude<keyof FormFieldProps, "type" | "rows" | "keyboard" | "actionsRef" | "clearable" | "pattern">>;
9
- export declare function Select(props: SelectProps): JSX.Element;
10
- export {};
1
+ import { SelectLegacyProps } from "./Select.types";
2
+ export declare function Select(props: SelectLegacyProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SelectRebuiltProps } from "./Select.types";
2
+ export declare function SelectRebuilt(props: SelectRebuiltProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { CommonFormFieldProps, FormFieldProps } from "../FormField";
2
+ export interface SelectLegacyProps extends Pick<CommonFormFieldProps, "id" | "align" | "description" | "disabled" | "invalid" | "inline" | "name" | "onValidation" | "placeholder" | "size" | "value" | "onChange">, Pick<FormFieldProps, "autofocus" | "onEnter" | "onBlur" | "onFocus" | "inputRef" | "wrapperRef" | "validations" | "children" | "prefix" | "suffix" | "defaultValue" | "version"> {
3
+ }
4
+ /**
5
+ * Rebuilt version of the Select component without React Hook Form dependency.
6
+ */
7
+ export interface SelectRebuiltProps extends Omit<SelectLegacyProps, "defaultValue" | "version" | "onChange" | "value" | "validations" | "onValidation"> {
8
+ defaultValue?: never;
9
+ readonly value?: string | number;
10
+ onChange?(newValue?: string | number): void;
11
+ version: 2;
12
+ }
@@ -0,0 +1,16 @@
1
+ import { ChangeEvent } from "react";
2
+ interface UseSelectActionsProps {
3
+ readonly onChange?: (newValue: string | number, event?: ChangeEvent<HTMLSelectElement>) => void;
4
+ readonly onBlur?: () => void;
5
+ readonly onFocus?: () => void;
6
+ }
7
+ /**
8
+ * Hook with actions on the Select component.
9
+ */
10
+ export declare function useSelectActions({ onChange, onBlur, onFocus, }: UseSelectActionsProps): {
11
+ handleChange: (event: ChangeEvent<HTMLSelectElement>) => void;
12
+ handleBlur: () => void;
13
+ handleFocus: () => void;
14
+ handleClear: () => void;
15
+ };
16
+ export {};
@@ -0,0 +1,34 @@
1
+ import { ChangeEvent } from "react";
2
+ export interface UseSelectFormFieldProps {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly disabled?: boolean;
6
+ readonly autofocus?: boolean;
7
+ readonly description?: string;
8
+ readonly inline?: boolean;
9
+ readonly error?: string;
10
+ readonly invalid?: boolean;
11
+ readonly value?: string | number;
12
+ readonly handleChange: (event: ChangeEvent<HTMLSelectElement>) => void;
13
+ readonly handleBlur: () => void;
14
+ readonly handleFocus: () => void;
15
+ }
16
+ export interface UseSelectFormFieldReturn {
17
+ readonly fieldProps: {
18
+ readonly id: string;
19
+ readonly name: string;
20
+ readonly disabled?: boolean;
21
+ readonly autoFocus?: boolean;
22
+ readonly onChange: (event: ChangeEvent<HTMLSelectElement>) => void;
23
+ readonly onBlur: () => void;
24
+ readonly onFocus: () => void;
25
+ readonly value?: string | number;
26
+ readonly "aria-describedby"?: string;
27
+ };
28
+ readonly descriptionIdentifier: string;
29
+ }
30
+ /**
31
+ * Hook for managing the props of a Select component.
32
+ * Extracted from FormField's useAtlantisFormField.
33
+ */
34
+ export declare function useSelectFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, }: UseSelectFormFieldProps): UseSelectFormFieldReturn;
@@ -1,23 +1,130 @@
1
1
  'use strict';
2
2
 
3
- var Option = require('../Option-cjs.js');
4
- require('react');
5
- require('../FormField-cjs.js');
3
+ var React = require('react');
4
+ var omit = require('../omit-cjs.js');
5
+ var FormField = require('../FormField-cjs.js');
6
+ require('classnames');
7
+ require('../tslib.es6-cjs.js');
8
+ require('react-hook-form');
6
9
  require('framer-motion');
7
10
  require('@jobber/design');
8
- require('classnames');
9
11
  require('../Button-cjs.js');
10
- require('react-router-dom');
11
- require('../tslib.es6-cjs.js');
12
+ require('../_commonjsHelpers-cjs.js');
13
+ require('../_baseGet-cjs.js');
14
+ require('../isTypedArray-cjs.js');
15
+ require('../isObjectLike-cjs.js');
16
+ require('../identity-cjs.js');
17
+ require('../_getTag-cjs.js');
18
+ require('../isSymbol-cjs.js');
19
+ require('../keysIn-cjs.js');
20
+ require('../_baseAssignValue-cjs.js');
21
+ require('../_baseFlatten-cjs.js');
22
+ require('../_setToString-cjs.js');
12
23
  require('../Icon-cjs.js');
13
- require('../Typography-cjs.js');
14
24
  require('../Text-cjs.js');
25
+ require('../Typography-cjs.js');
15
26
  require('../useFormFieldFocus-cjs.js');
16
27
  require('../InputValidation-cjs.js');
17
28
  require('../Spinner-cjs.js');
18
- require('react-hook-form');
29
+ require('react-router-dom');
30
+
31
+ function Select$1(props) {
32
+ const formFieldProps = omit.omit(Object.assign({}, props), ["version"]);
33
+ return React.createElement(FormField.FormField, Object.assign({ type: "select" }, formFieldProps));
34
+ }
35
+
36
+ /**
37
+ * Hook with actions on the Select component.
38
+ */
39
+ function useSelectActions({ onChange, onBlur, onFocus, }) {
40
+ function handleChange(event) {
41
+ const newValue = event.currentTarget.value;
42
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
43
+ }
44
+ function handleBlur() {
45
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur();
46
+ }
47
+ function handleFocus() {
48
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus();
49
+ }
50
+ // Noop for SelectRebuilt since onClear is a required prop for FormFieldWrapper
51
+ // but Select is not clearable.
52
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
53
+ function handleClear() { }
54
+ return {
55
+ handleChange,
56
+ handleBlur,
57
+ handleFocus,
58
+ handleClear,
59
+ };
60
+ }
61
+
62
+ /**
63
+ * Hook for managing the props of a Select component.
64
+ * Extracted from FormField's useAtlantisFormField.
65
+ */
66
+ function useSelectFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, }) {
67
+ const descriptionIdentifier = `descriptionUUID--${id}`;
68
+ const fieldProps = Object.assign({ id,
69
+ name,
70
+ disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value }, (description &&
71
+ !inline && { "aria-describedby": descriptionIdentifier }));
72
+ return { fieldProps, descriptionIdentifier };
73
+ }
74
+
75
+ function SelectRebuilt(props) {
76
+ var _a;
77
+ const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : React.useRef(null);
78
+ const wrapperRef = React.useRef(null);
79
+ const { inputStyle } = FormField.useFormFieldWrapperStyles(Object.assign({}, omit.omit(props, ["version"])));
80
+ const id = useSelectId(props);
81
+ const { name } = FormField.useAtlantisFormFieldName({
82
+ nameProp: props.name,
83
+ id: id,
84
+ });
85
+ const { handleChange, handleBlur, handleFocus, handleClear } = useSelectActions({
86
+ onChange: props.onChange,
87
+ onBlur: props.onBlur,
88
+ onFocus: props.onFocus,
89
+ });
90
+ const inputProps = omit.omit(props, [
91
+ "onChange",
92
+ "onBlur",
93
+ "onFocus",
94
+ "size",
95
+ "placeholder",
96
+ "version",
97
+ ]);
98
+ const { fieldProps, descriptionIdentifier } = useSelectFormField(Object.assign(Object.assign({}, inputProps), { id,
99
+ name,
100
+ handleChange,
101
+ handleBlur,
102
+ handleFocus }));
103
+ return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, onClear: handleClear, clearable: "never" },
104
+ React.createElement(React.Fragment, null,
105
+ React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
106
+ React.createElement(FormField.FormFieldPostFix, { variation: "select" }))));
107
+ }
108
+ function useSelectId(props) {
109
+ const generatedId = React.useId();
110
+ return props.id || generatedId;
111
+ }
19
112
 
113
+ function SelectOption({ children, disabled, value }) {
114
+ return (React.createElement("option", { disabled: disabled, value: value }, children));
115
+ }
20
116
 
117
+ function isNewSelectProps(props) {
118
+ return props.version === 2;
119
+ }
120
+ function Select(props) {
121
+ if (isNewSelectProps(props)) {
122
+ return React.createElement(SelectRebuilt, Object.assign({}, props));
123
+ }
124
+ else {
125
+ return React.createElement(Select$1, Object.assign({}, props));
126
+ }
127
+ }
21
128
 
22
- exports.Option = Option.SelectOption;
23
- exports.Select = Option.Select;
129
+ exports.Option = SelectOption;
130
+ exports.Select = Select;
@@ -1,2 +1,5 @@
1
- export { Select } from "./Select";
1
+ import { SelectLegacyProps, SelectRebuiltProps } from "./Select.types";
2
2
  export { Option } from "./Option";
3
+ export type SelectShimProps = SelectLegacyProps | SelectRebuiltProps;
4
+ export declare function Select(props: SelectShimProps): JSX.Element;
5
+ export { SelectRebuiltProps, SelectLegacyProps };
@@ -1,16 +1,127 @@
1
- export { a as Option, S as Select } from '../Option-es.js';
2
- import 'react';
3
- import '../FormField-es.js';
1
+ import React__default, { useRef, useId } from 'react';
2
+ import { o as omit } from '../omit-es.js';
3
+ import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix } from '../FormField-es.js';
4
+ import 'classnames';
5
+ import '../tslib.es6-es.js';
6
+ import 'react-hook-form';
4
7
  import 'framer-motion';
5
8
  import '@jobber/design';
6
- import 'classnames';
7
9
  import '../Button-es.js';
8
- import 'react-router-dom';
9
- import '../tslib.es6-es.js';
10
+ import '../_commonjsHelpers-es.js';
11
+ import '../_baseGet-es.js';
12
+ import '../isTypedArray-es.js';
13
+ import '../isObjectLike-es.js';
14
+ import '../identity-es.js';
15
+ import '../_getTag-es.js';
16
+ import '../isSymbol-es.js';
17
+ import '../keysIn-es.js';
18
+ import '../_baseAssignValue-es.js';
19
+ import '../_baseFlatten-es.js';
20
+ import '../_setToString-es.js';
10
21
  import '../Icon-es.js';
11
- import '../Typography-es.js';
12
22
  import '../Text-es.js';
23
+ import '../Typography-es.js';
13
24
  import '../useFormFieldFocus-es.js';
14
25
  import '../InputValidation-es.js';
15
26
  import '../Spinner-es.js';
16
- import 'react-hook-form';
27
+ import 'react-router-dom';
28
+
29
+ function Select$1(props) {
30
+ const formFieldProps = omit(Object.assign({}, props), ["version"]);
31
+ return React__default.createElement(FormField, Object.assign({ type: "select" }, formFieldProps));
32
+ }
33
+
34
+ /**
35
+ * Hook with actions on the Select component.
36
+ */
37
+ function useSelectActions({ onChange, onBlur, onFocus, }) {
38
+ function handleChange(event) {
39
+ const newValue = event.currentTarget.value;
40
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
41
+ }
42
+ function handleBlur() {
43
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur();
44
+ }
45
+ function handleFocus() {
46
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus();
47
+ }
48
+ // Noop for SelectRebuilt since onClear is a required prop for FormFieldWrapper
49
+ // but Select is not clearable.
50
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
51
+ function handleClear() { }
52
+ return {
53
+ handleChange,
54
+ handleBlur,
55
+ handleFocus,
56
+ handleClear,
57
+ };
58
+ }
59
+
60
+ /**
61
+ * Hook for managing the props of a Select component.
62
+ * Extracted from FormField's useAtlantisFormField.
63
+ */
64
+ function useSelectFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, }) {
65
+ const descriptionIdentifier = `descriptionUUID--${id}`;
66
+ const fieldProps = Object.assign({ id,
67
+ name,
68
+ disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value }, (description &&
69
+ !inline && { "aria-describedby": descriptionIdentifier }));
70
+ return { fieldProps, descriptionIdentifier };
71
+ }
72
+
73
+ function SelectRebuilt(props) {
74
+ var _a;
75
+ const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : useRef(null);
76
+ const wrapperRef = useRef(null);
77
+ const { inputStyle } = useFormFieldWrapperStyles(Object.assign({}, omit(props, ["version"])));
78
+ const id = useSelectId(props);
79
+ const { name } = useAtlantisFormFieldName({
80
+ nameProp: props.name,
81
+ id: id,
82
+ });
83
+ const { handleChange, handleBlur, handleFocus, handleClear } = useSelectActions({
84
+ onChange: props.onChange,
85
+ onBlur: props.onBlur,
86
+ onFocus: props.onFocus,
87
+ });
88
+ const inputProps = omit(props, [
89
+ "onChange",
90
+ "onBlur",
91
+ "onFocus",
92
+ "size",
93
+ "placeholder",
94
+ "version",
95
+ ]);
96
+ const { fieldProps, descriptionIdentifier } = useSelectFormField(Object.assign(Object.assign({}, inputProps), { id,
97
+ name,
98
+ handleChange,
99
+ handleBlur,
100
+ handleFocus }));
101
+ return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, onClear: handleClear, clearable: "never" },
102
+ React__default.createElement(React__default.Fragment, null,
103
+ React__default.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
104
+ React__default.createElement(FormFieldPostFix, { variation: "select" }))));
105
+ }
106
+ function useSelectId(props) {
107
+ const generatedId = useId();
108
+ return props.id || generatedId;
109
+ }
110
+
111
+ function SelectOption({ children, disabled, value }) {
112
+ return (React__default.createElement("option", { disabled: disabled, value: value }, children));
113
+ }
114
+
115
+ function isNewSelectProps(props) {
116
+ return props.version === 2;
117
+ }
118
+ function Select(props) {
119
+ if (isNewSelectProps(props)) {
120
+ return React__default.createElement(SelectRebuilt, Object.assign({}, props));
121
+ }
122
+ else {
123
+ return React__default.createElement(Select$1, Object.assign({}, props));
124
+ }
125
+ }
126
+
127
+ export { SelectOption as Option, Select };
package/dist/index.cjs CHANGED
@@ -84,7 +84,7 @@ var RadioGroup = require('./RadioGroup-cjs.js');
84
84
  var RecurringSelect = require('./RecurringSelect-cjs.js');
85
85
  var DayOfMonthSelect = require('./DayOfMonthSelect-cjs.js');
86
86
  var ResponsiveSwitcher = require('./ResponsiveSwitcher-cjs.js');
87
- var Option = require('./Option-cjs.js');
87
+ var Select_index = require('./Select/index.cjs');
88
88
  var SegmentedControl = require('./SegmentedControl-cjs.js');
89
89
  var SideDrawer = require('./SideDrawer-cjs.js');
90
90
  var SideKick = require('./SideKick-cjs.js');
@@ -308,8 +308,8 @@ Object.defineProperty(exports, "WeekDay", {
308
308
  get: function () { return DayOfMonthSelect.WeekDay; }
309
309
  });
310
310
  exports.ResponsiveSwitcher = ResponsiveSwitcher.ResponsiveSwitcher;
311
- exports.Option = Option.SelectOption;
312
- exports.Select = Option.Select;
311
+ exports.Option = Select_index.Option;
312
+ exports.Select = Select_index.Select;
313
313
  exports.SegmentedControl = SegmentedControl.SegmentedControl;
314
314
  exports.SegmentedControlContext = SegmentedControl.SegmentedControlContext;
315
315
  exports.SegmentedControlProvider = SegmentedControl.SegmentedControlProvider;
package/dist/index.mjs CHANGED
@@ -82,7 +82,7 @@ export { R as RadioGroup, a as RadioOption } from './RadioGroup-es.js';
82
82
  export { R as RecurringSelect } from './RecurringSelect-es.js';
83
83
  export { D as DurationPeriod, W as WeekDay } from './DayOfMonthSelect-es.js';
84
84
  export { R as ResponsiveSwitcher } from './ResponsiveSwitcher-es.js';
85
- export { a as Option, S as Select } from './Option-es.js';
85
+ export { Option, Select } from './Select/index.mjs';
86
86
  export { S as SegmentedControl, a as SegmentedControlContext, b as SegmentedControlProvider, u as useSegmentedControl } from './SegmentedControl-es.js';
87
87
  export { S as SideDrawer } from './SideDrawer-es.js';
88
88
  export { S as SideKick } from './SideKick-es.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.40.2",
3
+ "version": "6.41.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -534,5 +534,5 @@
534
534
  "> 1%",
535
535
  "IE 10"
536
536
  ],
537
- "gitHead": "a6c2f81e84c7e7a662beb3484d8f7cc46a77c331"
537
+ "gitHead": "925c94b58b51dba6d99cfbfe779bb7d0651a2f1c"
538
538
  }
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var FormField = require('./FormField-cjs.js');
5
- require('classnames');
6
- require('./tslib.es6-cjs.js');
7
- require('react-hook-form');
8
- require('framer-motion');
9
- require('@jobber/design');
10
- require('./Button-cjs.js');
11
-
12
- function Select(props) {
13
- return React.createElement(FormField.FormField, Object.assign({ type: "select" }, props));
14
- }
15
-
16
- function SelectOption({ children, disabled, value }) {
17
- return (React.createElement("option", { disabled: disabled, value: value }, children));
18
- }
19
-
20
- exports.Select = Select;
21
- exports.SelectOption = SelectOption;
package/dist/Option-es.js DELETED
@@ -1,18 +0,0 @@
1
- import React__default from 'react';
2
- import { k as FormField } from './FormField-es.js';
3
- import 'classnames';
4
- import './tslib.es6-es.js';
5
- import 'react-hook-form';
6
- import 'framer-motion';
7
- import '@jobber/design';
8
- import './Button-es.js';
9
-
10
- function Select(props) {
11
- return React__default.createElement(FormField, Object.assign({ type: "select" }, props));
12
- }
13
-
14
- function SelectOption({ children, disabled, value }) {
15
- return (React__default.createElement("option", { disabled: disabled, value: value }, children));
16
- }
17
-
18
- export { Select as S, SelectOption as a };