@jobber/components 7.5.0 → 7.6.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.
- package/dist/Autocomplete/index.cjs +6 -5
- package/dist/Autocomplete/index.mjs +3 -2
- package/dist/DataList/components/DataListSearch/index.cjs +1 -0
- package/dist/DataList/components/DataListSearch/index.mjs +1 -0
- package/dist/DataList/index.cjs +1 -0
- package/dist/DataList/index.mjs +1 -0
- package/dist/DataTable/index.cjs +2 -14
- package/dist/DataTable/index.mjs +2 -14
- package/dist/DataTable-cjs.js +3 -3
- package/dist/DataTable-es.js +1 -1
- package/dist/FormField/index.cjs +14 -13
- package/dist/FormField/index.mjs +5 -4
- package/dist/FormField-cjs.js +8 -281
- package/dist/FormField-es.js +3 -263
- package/dist/InputDate/index.cjs +1 -0
- package/dist/InputDate/index.mjs +2 -1
- package/dist/InputEmail/index.cjs +7 -6
- package/dist/InputEmail/index.mjs +4 -3
- package/dist/InputNumber/index.cjs +1 -0
- package/dist/InputNumber/index.mjs +2 -1
- package/dist/InputPassword/index.cjs +1 -0
- package/dist/InputPassword/index.mjs +1 -0
- package/dist/InputPassword-es.js +1 -1
- package/dist/InputPhoneNumber/index.cjs +6 -5
- package/dist/InputPhoneNumber/index.mjs +2 -1
- package/dist/InputText/index.cjs +8 -7
- package/dist/InputText/index.mjs +4 -3
- package/dist/InputTime/index.cjs +5 -4
- package/dist/InputTime/index.mjs +2 -1
- package/dist/RecurringSelect/index.cjs +3 -14
- package/dist/RecurringSelect/index.mjs +3 -14
- package/dist/RecurringSelect-cjs.js +6 -6
- package/dist/RecurringSelect-es.js +1 -1
- package/dist/Select/Select.d.ts +6 -2
- package/dist/Select/Select.types.d.ts +2 -16
- package/dist/Select/index.cjs +11 -103
- package/dist/Select/index.d.ts +2 -9
- package/dist/Select/index.mjs +9 -105
- package/dist/Select-cjs.js +78 -0
- package/dist/Select-es.js +75 -0
- package/dist/docs/Select/Select.md +69 -33
- package/dist/docs/usage-guidelines/usage-guidelines.md +10 -13
- package/dist/index.cjs +14 -13
- package/dist/index.mjs +3 -2
- package/dist/mergeRefs-cjs.js +279 -0
- package/dist/mergeRefs-es.js +265 -0
- package/package.json +2 -2
- package/dist/Select/Select.rebuilt.d.ts +0 -3
|
@@ -6,20 +6,8 @@ require('react');
|
|
|
6
6
|
require('../Text-cjs.js');
|
|
7
7
|
require('../Typography-cjs.js');
|
|
8
8
|
require('classnames');
|
|
9
|
-
require('../Select
|
|
10
|
-
require('../
|
|
11
|
-
require('../_commonjsHelpers-cjs.js');
|
|
12
|
-
require('../_getAllKeys-cjs.js');
|
|
13
|
-
require('../isTypedArray-cjs.js');
|
|
14
|
-
require('../isObjectLike-cjs.js');
|
|
15
|
-
require('../isSymbol-cjs.js');
|
|
16
|
-
require('../identity-cjs.js');
|
|
17
|
-
require('../_getTag-cjs.js');
|
|
18
|
-
require('../keysIn-cjs.js');
|
|
19
|
-
require('../_baseAssignValue-cjs.js');
|
|
20
|
-
require('../_baseFlatten-cjs.js');
|
|
21
|
-
require('../_setToString-cjs.js');
|
|
22
|
-
require('../FormField-cjs.js');
|
|
9
|
+
require('../Select-cjs.js');
|
|
10
|
+
require('../mergeRefs-cjs.js');
|
|
23
11
|
require('@jobber/hooks');
|
|
24
12
|
require('framer-motion');
|
|
25
13
|
require('@jobber/design');
|
|
@@ -35,6 +23,7 @@ require('../filterDataAttributes-cjs.js');
|
|
|
35
23
|
require('../InputNumber/index.cjs');
|
|
36
24
|
require('../Text-cjs2.js');
|
|
37
25
|
require('../clsx-cjs.js');
|
|
26
|
+
require('../FormField-cjs.js');
|
|
38
27
|
require('../InputGroup-cjs.js');
|
|
39
28
|
require('../Content-cjs.js');
|
|
40
29
|
require('../RadioGroup-cjs.js');
|
|
@@ -4,20 +4,8 @@ import 'react';
|
|
|
4
4
|
import '../Text-es.js';
|
|
5
5
|
import '../Typography-es.js';
|
|
6
6
|
import 'classnames';
|
|
7
|
-
import '../Select
|
|
8
|
-
import '../
|
|
9
|
-
import '../_commonjsHelpers-es.js';
|
|
10
|
-
import '../_getAllKeys-es.js';
|
|
11
|
-
import '../isTypedArray-es.js';
|
|
12
|
-
import '../isObjectLike-es.js';
|
|
13
|
-
import '../isSymbol-es.js';
|
|
14
|
-
import '../identity-es.js';
|
|
15
|
-
import '../_getTag-es.js';
|
|
16
|
-
import '../keysIn-es.js';
|
|
17
|
-
import '../_baseAssignValue-es.js';
|
|
18
|
-
import '../_baseFlatten-es.js';
|
|
19
|
-
import '../_setToString-es.js';
|
|
20
|
-
import '../FormField-es.js';
|
|
7
|
+
import '../Select-es.js';
|
|
8
|
+
import '../mergeRefs-es.js';
|
|
21
9
|
import '@jobber/hooks';
|
|
22
10
|
import 'framer-motion';
|
|
23
11
|
import '@jobber/design';
|
|
@@ -33,6 +21,7 @@ import '../filterDataAttributes-es.js';
|
|
|
33
21
|
import '../InputNumber/index.mjs';
|
|
34
22
|
import '../Text-es2.js';
|
|
35
23
|
import '../clsx-es.js';
|
|
24
|
+
import '../FormField-es.js';
|
|
36
25
|
import '../InputGroup-es.js';
|
|
37
26
|
import '../Content-es.js';
|
|
38
27
|
import '../RadioGroup-es.js';
|
|
@@ -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
|
|
7
|
+
var Select = require('./Select-cjs.js');
|
|
8
8
|
var InputNumber_index = require('./InputNumber/index.cjs');
|
|
9
9
|
var InputGroup = require('./InputGroup-cjs.js');
|
|
10
10
|
var Content = require('./Content-cjs.js');
|
|
@@ -55,11 +55,11 @@ function RecurringSelect({ value, disabled = false, onChange, }) {
|
|
|
55
55
|
React.createElement("div", { className: styles.fullWidthWrapper },
|
|
56
56
|
React.createElement(InputGroup.InputGroup, { flowDirection: "horizontal" },
|
|
57
57
|
React.createElement(InputNumber_index.InputNumber, { disabled: disabled, name: "schedule-recurrence-interval", value: value.interval, min: 1, maxLength: 3, onChange: onChangeInterval }),
|
|
58
|
-
React.createElement(
|
|
59
|
-
React.createElement(
|
|
60
|
-
React.createElement(
|
|
61
|
-
React.createElement(
|
|
62
|
-
React.createElement(
|
|
58
|
+
React.createElement(Select.Select, { disabled: disabled, value: value.type, onChange: onChangeType, name: "schedule-recurrence-type" },
|
|
59
|
+
React.createElement(Select.SelectOption, { value: DayOfMonthSelect.DurationPeriod.Day }, "Day(s)"),
|
|
60
|
+
React.createElement(Select.SelectOption, { value: DayOfMonthSelect.DurationPeriod.Week }, "Week(s)"),
|
|
61
|
+
React.createElement(Select.SelectOption, { value: monthlySelectOptionValue }, "Month(s)"),
|
|
62
|
+
React.createElement(Select.SelectOption, { value: DayOfMonthSelect.DurationPeriod.Year }, "Year(s)")))),
|
|
63
63
|
hasExtraFrequencyDescriptor && (React.createElement(Text.Text, { variation: disabledTextVariation }, "on"))),
|
|
64
64
|
DayOfMonthSelect.isMonthly(value) && (React.createElement(DayOfMonthSelect.MonthlySelect, { disabled: disabled, onChange: onChangeType, selectedMonthOption: value.type })),
|
|
65
65
|
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 { Select,
|
|
5
|
+
import { a as Select, S as SelectOption } from './Select-es.js';
|
|
6
6
|
import { InputNumber } from './InputNumber/index.mjs';
|
|
7
7
|
import { I as InputGroup } from './InputGroup-es.js';
|
|
8
8
|
import { C as Content } from './Content-es.js';
|
package/dist/Select/Select.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
export declare function Select(props:
|
|
2
|
+
import type { SelectProps } from "./Select.types";
|
|
3
|
+
export declare function Select(props: SelectProps): React.JSX.Element;
|
|
4
|
+
export declare namespace Select {
|
|
5
|
+
var Option: typeof import("./Option").Option;
|
|
6
|
+
var OptionGroup: typeof import("./OptionGroup").OptionGroup;
|
|
7
|
+
}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import type { Ref } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FormFieldProps } from "../FormField";
|
|
3
3
|
import type { FocusEvents, HTMLInputBaseProps, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
|
-
|
|
5
|
-
* @deprecated Use the v2 Select component instead (version={2}).
|
|
6
|
-
*/
|
|
7
|
-
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"> {
|
|
8
|
-
/**
|
|
9
|
-
* Changes the width to roughly the same size as the maximum character length
|
|
10
|
-
*/
|
|
11
|
-
readonly maxLength?: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Rebuilt version of the Select component without React Hook Form dependency.
|
|
15
|
-
*/
|
|
16
|
-
export interface SelectRebuiltProps extends Omit<HTMLInputBaseProps, "readOnly" | "maxLength">, FocusEvents<HTMLSelectElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix" | "align" | "showMiniLabel">, Pick<SelectLegacyProps, "prefix" | "suffix" | "align" | "children"> {
|
|
17
|
-
defaultValue?: never;
|
|
4
|
+
export interface SelectProps extends Omit<HTMLInputBaseProps, "readOnly" | "maxLength">, FocusEvents<HTMLSelectElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix" | "align" | "showMiniLabel" | "version">, Pick<FormFieldProps, "prefix" | "suffix" | "align" | "children"> {
|
|
18
5
|
readonly value?: string | number;
|
|
19
6
|
onChange?(newValue?: string | number): void;
|
|
20
7
|
readonly inputRef?: Ref<HTMLSelectElement>;
|
|
@@ -26,7 +13,6 @@ export interface SelectRebuiltProps extends Omit<HTMLInputBaseProps, "readOnly"
|
|
|
26
13
|
* Opt-in to the customizable select UI (Chromium 123+).
|
|
27
14
|
* When true, the component will apply the custom select styles
|
|
28
15
|
* Defaults to false for native behavior.
|
|
29
|
-
* Only supported by Select version={2}.
|
|
30
16
|
*/
|
|
31
17
|
readonly UNSAFE_experimentalStyles?: boolean;
|
|
32
18
|
}
|
package/dist/Select/index.cjs
CHANGED
|
@@ -1,117 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require('../tslib.es6-cjs.js');
|
|
8
|
-
require('react-hook-form');
|
|
3
|
+
var Select = require('../Select-cjs.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('classnames');
|
|
6
|
+
require('../mergeRefs-cjs.js');
|
|
9
7
|
require('@jobber/hooks');
|
|
10
8
|
require('framer-motion');
|
|
11
9
|
require('@jobber/design');
|
|
12
10
|
require('../Button-cjs.js');
|
|
13
|
-
|
|
14
|
-
require('
|
|
15
|
-
require('../_getAllKeys-cjs.js');
|
|
16
|
-
require('../isTypedArray-cjs.js');
|
|
17
|
-
require('../isObjectLike-cjs.js');
|
|
18
|
-
require('../isSymbol-cjs.js');
|
|
19
|
-
require('../identity-cjs.js');
|
|
20
|
-
require('../_getTag-cjs.js');
|
|
21
|
-
require('../keysIn-cjs.js');
|
|
22
|
-
require('../_baseAssignValue-cjs.js');
|
|
23
|
-
require('../_baseFlatten-cjs.js');
|
|
24
|
-
require('../_setToString-cjs.js');
|
|
11
|
+
require('../tslib.es6-cjs.js');
|
|
12
|
+
require('react-router-dom');
|
|
25
13
|
require('../Icon-cjs.js');
|
|
26
|
-
require('../Text-cjs.js');
|
|
27
14
|
require('../Typography-cjs.js');
|
|
15
|
+
require('../Text-cjs.js');
|
|
28
16
|
require('../useFormFieldFocus-cjs.js');
|
|
29
17
|
require('../InputValidation-cjs.js');
|
|
30
18
|
require('../Spinner-cjs.js');
|
|
31
|
-
require('react-
|
|
32
|
-
|
|
33
|
-
// eslint-disable-next-line import/no-deprecated
|
|
34
|
-
function Select$1(props) {
|
|
35
|
-
const formFieldProps = omit.omit(Object.assign({}, props), ["version"]);
|
|
36
|
-
return React.createElement(FormField.FormField, Object.assign({ type: "select" }, formFieldProps));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Hook with actions on the Select component.
|
|
41
|
-
*/
|
|
42
|
-
function useSelectActions({ onChange, onBlur, onFocus, }) {
|
|
43
|
-
function handleChange(event) {
|
|
44
|
-
const newValue = event.currentTarget.value;
|
|
45
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
|
|
46
|
-
}
|
|
47
|
-
function handleBlur(event) {
|
|
48
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
49
|
-
}
|
|
50
|
-
function handleFocus(event) {
|
|
51
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
handleChange,
|
|
55
|
-
handleBlur,
|
|
56
|
-
handleFocus,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
|
|
61
|
-
|
|
62
|
-
function SelectRebuilt(props) {
|
|
63
|
-
var _a;
|
|
64
|
-
const { mergedRef, wrapperRef } = useSelectRefs(props.inputRef);
|
|
65
|
-
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
66
|
-
const generatedId = React.useId();
|
|
67
|
-
const id = props.id || generatedId;
|
|
68
|
-
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
69
|
-
const { name } = FormField.useAtlantisFormFieldName({
|
|
70
|
-
nameProp: props.name,
|
|
71
|
-
id: id,
|
|
72
|
-
});
|
|
73
|
-
const { handleChange, handleBlur, handleFocus } = useSelectActions({
|
|
74
|
-
onChange: props.onChange,
|
|
75
|
-
onBlur: props.onBlur,
|
|
76
|
-
onFocus: props.onFocus,
|
|
77
|
-
});
|
|
78
|
-
const descriptionVisible = props.description && !props.inline;
|
|
79
|
-
const isInvalid = Boolean(props.error || props.invalid);
|
|
80
|
-
return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never" },
|
|
81
|
-
React.createElement(React.Fragment, null,
|
|
82
|
-
React.createElement("select", Object.assign({ id: id, name: name, disabled: props.disabled, autoFocus: props.autoFocus, required: props.required, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value: props.value, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
83
|
-
? descriptionIdentifier
|
|
84
|
-
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], ref: mergedRef, className: classnames(FormField.formFieldStyles.input, props.UNSAFE_experimentalStyles && styles.select) }, dataAttrs), props.children),
|
|
85
|
-
React.createElement(FormField.FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
|
|
86
|
-
}
|
|
87
|
-
function useSelectRefs(inputRef) {
|
|
88
|
-
const internalRef = React.useRef(null);
|
|
89
|
-
const mergedRef = FormField.mergeRefs([internalRef, inputRef]);
|
|
90
|
-
const wrapperRef = React.useRef(null);
|
|
91
|
-
return { mergedRef, wrapperRef };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function SelectOption({ children, disabled, value }) {
|
|
95
|
-
return (React.createElement("option", { disabled: disabled, value: value }, children));
|
|
96
|
-
}
|
|
19
|
+
require('react-hook-form');
|
|
20
|
+
require('../filterDataAttributes-cjs.js');
|
|
97
21
|
|
|
98
|
-
function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
|
|
99
|
-
return (React.createElement("optgroup", { label: label, disabled: disabled, className: UNSAFE_className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container }, children));
|
|
100
|
-
}
|
|
101
22
|
|
|
102
|
-
function isNewSelectProps(props) {
|
|
103
|
-
return props.version === 2;
|
|
104
|
-
}
|
|
105
|
-
function Select(props) {
|
|
106
|
-
if (isNewSelectProps(props)) {
|
|
107
|
-
return React.createElement(SelectRebuilt, Object.assign({}, props));
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return React.createElement(Select$1, Object.assign({}, props));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
Select.Option = SelectOption;
|
|
114
|
-
Select.OptionGroup = OptionGroup;
|
|
115
23
|
|
|
116
|
-
exports.Option = SelectOption;
|
|
117
|
-
exports.Select = Select;
|
|
24
|
+
exports.Option = Select.SelectOption;
|
|
25
|
+
exports.Select = Select.Select;
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type SelectLegacyProps, type SelectRebuiltProps } from "./Select.types";
|
|
3
1
|
export { Option } from "./Option";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export declare namespace Select {
|
|
7
|
-
var Option: typeof import("./Option").Option;
|
|
8
|
-
var OptionGroup: typeof import("./OptionGroup").OptionGroup;
|
|
9
|
-
}
|
|
10
|
-
export type { SelectRebuiltProps, SelectLegacyProps };
|
|
2
|
+
export { Select } from "./Select";
|
|
3
|
+
export type { SelectProps } from "./Select.types";
|
package/dist/Select/index.mjs
CHANGED
|
@@ -1,114 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import '../tslib.es6-es.js';
|
|
6
|
-
import 'react-hook-form';
|
|
1
|
+
export { S as Option, a as Select } from '../Select-es.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import '../mergeRefs-es.js';
|
|
7
5
|
import '@jobber/hooks';
|
|
8
6
|
import 'framer-motion';
|
|
9
7
|
import '@jobber/design';
|
|
10
8
|
import '../Button-es.js';
|
|
11
|
-
import
|
|
12
|
-
import '
|
|
13
|
-
import '../_getAllKeys-es.js';
|
|
14
|
-
import '../isTypedArray-es.js';
|
|
15
|
-
import '../isObjectLike-es.js';
|
|
16
|
-
import '../isSymbol-es.js';
|
|
17
|
-
import '../identity-es.js';
|
|
18
|
-
import '../_getTag-es.js';
|
|
19
|
-
import '../keysIn-es.js';
|
|
20
|
-
import '../_baseAssignValue-es.js';
|
|
21
|
-
import '../_baseFlatten-es.js';
|
|
22
|
-
import '../_setToString-es.js';
|
|
9
|
+
import '../tslib.es6-es.js';
|
|
10
|
+
import 'react-router-dom';
|
|
23
11
|
import '../Icon-es.js';
|
|
24
|
-
import '../Text-es.js';
|
|
25
12
|
import '../Typography-es.js';
|
|
13
|
+
import '../Text-es.js';
|
|
26
14
|
import '../useFormFieldFocus-es.js';
|
|
27
15
|
import '../InputValidation-es.js';
|
|
28
16
|
import '../Spinner-es.js';
|
|
29
|
-
import 'react-
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line import/no-deprecated
|
|
32
|
-
function Select$1(props) {
|
|
33
|
-
const formFieldProps = omit(Object.assign({}, props), ["version"]);
|
|
34
|
-
return React__default.createElement(FormField, Object.assign({ type: "select" }, formFieldProps));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Hook with actions on the Select component.
|
|
39
|
-
*/
|
|
40
|
-
function useSelectActions({ onChange, onBlur, onFocus, }) {
|
|
41
|
-
function handleChange(event) {
|
|
42
|
-
const newValue = event.currentTarget.value;
|
|
43
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
|
|
44
|
-
}
|
|
45
|
-
function handleBlur(event) {
|
|
46
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
47
|
-
}
|
|
48
|
-
function handleFocus(event) {
|
|
49
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
handleChange,
|
|
53
|
-
handleBlur,
|
|
54
|
-
handleFocus,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
|
|
59
|
-
|
|
60
|
-
function SelectRebuilt(props) {
|
|
61
|
-
var _a;
|
|
62
|
-
const { mergedRef, wrapperRef } = useSelectRefs(props.inputRef);
|
|
63
|
-
const dataAttrs = filterDataAttributes(props);
|
|
64
|
-
const generatedId = useId();
|
|
65
|
-
const id = props.id || generatedId;
|
|
66
|
-
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
67
|
-
const { name } = useAtlantisFormFieldName({
|
|
68
|
-
nameProp: props.name,
|
|
69
|
-
id: id,
|
|
70
|
-
});
|
|
71
|
-
const { handleChange, handleBlur, handleFocus } = useSelectActions({
|
|
72
|
-
onChange: props.onChange,
|
|
73
|
-
onBlur: props.onBlur,
|
|
74
|
-
onFocus: props.onFocus,
|
|
75
|
-
});
|
|
76
|
-
const descriptionVisible = props.description && !props.inline;
|
|
77
|
-
const isInvalid = Boolean(props.error || props.invalid);
|
|
78
|
-
return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never" },
|
|
79
|
-
React__default.createElement(React__default.Fragment, null,
|
|
80
|
-
React__default.createElement("select", Object.assign({ id: id, name: name, disabled: props.disabled, autoFocus: props.autoFocus, required: props.required, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value: props.value, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
81
|
-
? descriptionIdentifier
|
|
82
|
-
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], ref: mergedRef, className: classnames(formFieldStyles.input, props.UNSAFE_experimentalStyles && styles.select) }, dataAttrs), props.children),
|
|
83
|
-
React__default.createElement(FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
|
|
84
|
-
}
|
|
85
|
-
function useSelectRefs(inputRef) {
|
|
86
|
-
const internalRef = useRef(null);
|
|
87
|
-
const mergedRef = mergeRefs([internalRef, inputRef]);
|
|
88
|
-
const wrapperRef = useRef(null);
|
|
89
|
-
return { mergedRef, wrapperRef };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function SelectOption({ children, disabled, value }) {
|
|
93
|
-
return (React__default.createElement("option", { disabled: disabled, value: value }, children));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
|
|
97
|
-
return (React__default.createElement("optgroup", { label: label, disabled: disabled, className: UNSAFE_className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container }, children));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function isNewSelectProps(props) {
|
|
101
|
-
return props.version === 2;
|
|
102
|
-
}
|
|
103
|
-
function Select(props) {
|
|
104
|
-
if (isNewSelectProps(props)) {
|
|
105
|
-
return React__default.createElement(SelectRebuilt, Object.assign({}, props));
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
return React__default.createElement(Select$1, Object.assign({}, props));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
Select.Option = SelectOption;
|
|
112
|
-
Select.OptionGroup = OptionGroup;
|
|
113
|
-
|
|
114
|
-
export { SelectOption as Option, Select };
|
|
17
|
+
import 'react-hook-form';
|
|
18
|
+
import '../filterDataAttributes-es.js';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
var mergeRefs = require('./mergeRefs-cjs.js');
|
|
6
|
+
require('./tslib.es6-cjs.js');
|
|
7
|
+
require('react-hook-form');
|
|
8
|
+
require('./Button-cjs.js');
|
|
9
|
+
require('@jobber/design');
|
|
10
|
+
var filterDataAttributes = require('./filterDataAttributes-cjs.js');
|
|
11
|
+
|
|
12
|
+
function SelectOption({ children, disabled, value }) {
|
|
13
|
+
return (React.createElement("option", { disabled: disabled, value: value }, children));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hook with actions on the Select component.
|
|
18
|
+
*/
|
|
19
|
+
function useSelectActions({ onChange, onBlur, onFocus, }) {
|
|
20
|
+
function handleChange(event) {
|
|
21
|
+
const newValue = event.currentTarget.value;
|
|
22
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
|
|
23
|
+
}
|
|
24
|
+
function handleBlur(event) {
|
|
25
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
26
|
+
}
|
|
27
|
+
function handleFocus(event) {
|
|
28
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
handleChange,
|
|
32
|
+
handleBlur,
|
|
33
|
+
handleFocus,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
|
|
38
|
+
|
|
39
|
+
function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
|
|
40
|
+
return (React.createElement("optgroup", { label: label, disabled: disabled, className: UNSAFE_className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container }, children));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function Select(props) {
|
|
44
|
+
var _a;
|
|
45
|
+
const { mergedRef, wrapperRef } = useSelectRefs(props.inputRef);
|
|
46
|
+
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
47
|
+
const generatedId = React.useId();
|
|
48
|
+
const id = props.id || generatedId;
|
|
49
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
50
|
+
const { name } = mergeRefs.useAtlantisFormFieldName({
|
|
51
|
+
nameProp: props.name,
|
|
52
|
+
id: id,
|
|
53
|
+
});
|
|
54
|
+
const { handleChange, handleBlur, handleFocus } = useSelectActions({
|
|
55
|
+
onChange: props.onChange,
|
|
56
|
+
onBlur: props.onBlur,
|
|
57
|
+
onFocus: props.onFocus,
|
|
58
|
+
});
|
|
59
|
+
const descriptionVisible = props.description && !props.inline;
|
|
60
|
+
const isInvalid = Boolean(props.error || props.invalid);
|
|
61
|
+
return (React.createElement(mergeRefs.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never" },
|
|
62
|
+
React.createElement(React.Fragment, null,
|
|
63
|
+
React.createElement("select", Object.assign({ id: id, name: name, disabled: props.disabled, autoFocus: props.autoFocus, required: props.required, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value: props.value, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
64
|
+
? descriptionIdentifier
|
|
65
|
+
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], ref: mergedRef, className: classnames(mergeRefs.formFieldStyles.input, props.UNSAFE_experimentalStyles && styles.select) }, dataAttrs), props.children),
|
|
66
|
+
React.createElement(mergeRefs.FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
|
|
67
|
+
}
|
|
68
|
+
function useSelectRefs(inputRef) {
|
|
69
|
+
const internalRef = React.useRef(null);
|
|
70
|
+
const mergedRef = mergeRefs.mergeRefs([internalRef, inputRef]);
|
|
71
|
+
const wrapperRef = React.useRef(null);
|
|
72
|
+
return { mergedRef, wrapperRef };
|
|
73
|
+
}
|
|
74
|
+
Select.Option = SelectOption;
|
|
75
|
+
Select.OptionGroup = OptionGroup;
|
|
76
|
+
|
|
77
|
+
exports.Select = Select;
|
|
78
|
+
exports.SelectOption = SelectOption;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React__default, { useId, useRef } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { u as useAtlantisFormFieldName, c as FormFieldWrapper, h as formFieldStyles, i as FormFieldPostFix, m as mergeRefs } from './mergeRefs-es.js';
|
|
4
|
+
import './tslib.es6-es.js';
|
|
5
|
+
import 'react-hook-form';
|
|
6
|
+
import './Button-es.js';
|
|
7
|
+
import '@jobber/design';
|
|
8
|
+
import { f as filterDataAttributes } from './filterDataAttributes-es.js';
|
|
9
|
+
|
|
10
|
+
function SelectOption({ children, disabled, value }) {
|
|
11
|
+
return (React__default.createElement("option", { disabled: disabled, value: value }, children));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Hook with actions on the Select component.
|
|
16
|
+
*/
|
|
17
|
+
function useSelectActions({ onChange, onBlur, onFocus, }) {
|
|
18
|
+
function handleChange(event) {
|
|
19
|
+
const newValue = event.currentTarget.value;
|
|
20
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
|
|
21
|
+
}
|
|
22
|
+
function handleBlur(event) {
|
|
23
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
24
|
+
}
|
|
25
|
+
function handleFocus(event) {
|
|
26
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
handleChange,
|
|
30
|
+
handleBlur,
|
|
31
|
+
handleFocus,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
|
|
36
|
+
|
|
37
|
+
function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
|
|
38
|
+
return (React__default.createElement("optgroup", { label: label, disabled: disabled, className: UNSAFE_className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container }, children));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function Select(props) {
|
|
42
|
+
var _a;
|
|
43
|
+
const { mergedRef, wrapperRef } = useSelectRefs(props.inputRef);
|
|
44
|
+
const dataAttrs = filterDataAttributes(props);
|
|
45
|
+
const generatedId = useId();
|
|
46
|
+
const id = props.id || generatedId;
|
|
47
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
48
|
+
const { name } = useAtlantisFormFieldName({
|
|
49
|
+
nameProp: props.name,
|
|
50
|
+
id: id,
|
|
51
|
+
});
|
|
52
|
+
const { handleChange, handleBlur, handleFocus } = useSelectActions({
|
|
53
|
+
onChange: props.onChange,
|
|
54
|
+
onBlur: props.onBlur,
|
|
55
|
+
onFocus: props.onFocus,
|
|
56
|
+
});
|
|
57
|
+
const descriptionVisible = props.description && !props.inline;
|
|
58
|
+
const isInvalid = Boolean(props.error || props.invalid);
|
|
59
|
+
return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never" },
|
|
60
|
+
React__default.createElement(React__default.Fragment, null,
|
|
61
|
+
React__default.createElement("select", Object.assign({ id: id, name: name, disabled: props.disabled, autoFocus: props.autoFocus, required: props.required, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value: props.value, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
62
|
+
? descriptionIdentifier
|
|
63
|
+
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], ref: mergedRef, className: classnames(formFieldStyles.input, props.UNSAFE_experimentalStyles && styles.select) }, dataAttrs), props.children),
|
|
64
|
+
React__default.createElement(FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
|
|
65
|
+
}
|
|
66
|
+
function useSelectRefs(inputRef) {
|
|
67
|
+
const internalRef = useRef(null);
|
|
68
|
+
const mergedRef = mergeRefs([internalRef, inputRef]);
|
|
69
|
+
const wrapperRef = useRef(null);
|
|
70
|
+
return { mergedRef, wrapperRef };
|
|
71
|
+
}
|
|
72
|
+
Select.Option = SelectOption;
|
|
73
|
+
Select.OptionGroup = OptionGroup;
|
|
74
|
+
|
|
75
|
+
export { SelectOption as S, Select as a };
|