@jobber/components 6.82.6 → 6.83.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.
@@ -2,6 +2,7 @@ import React from "react";
2
2
  interface FormFieldPostFixProps {
3
3
  readonly variation: "select" | "spinner";
4
4
  readonly visible?: boolean;
5
+ readonly className?: string;
5
6
  }
6
- export declare function FormFieldPostFix({ variation, visible, }: FormFieldPostFixProps): React.JSX.Element | null;
7
+ export declare function FormFieldPostFix({ variation, visible, className, }: FormFieldPostFixProps): React.JSX.Element | null;
7
8
  export {};
@@ -252,10 +252,10 @@ function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEn
252
252
  React.createElement("div", { className: styles$1.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
253
253
  }
254
254
 
255
- function FormFieldPostFix({ variation, visible = true, }) {
255
+ function FormFieldPostFix({ variation, visible = true, className, }) {
256
256
  if (!visible)
257
257
  return null;
258
- return (React.createElement("span", { className: styles$1.postfix }, variation === "select" ? (React.createElement(Icon.Icon, { name: "arrowDown" })) : (React.createElement(Spinner.Spinner, { size: "small" }))));
258
+ return (React.createElement("span", { className: classnames(styles$1.postfix, className) }, variation === "select" ? (React.createElement(Icon.Icon, { name: "arrowDown" })) : (React.createElement(Spinner.Spinner, { size: "small" }))));
259
259
  }
260
260
 
261
261
  /**
@@ -250,10 +250,10 @@ function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEn
250
250
  React__default.createElement("div", { className: styles$1.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
251
251
  }
252
252
 
253
- function FormFieldPostFix({ variation, visible = true, }) {
253
+ function FormFieldPostFix({ variation, visible = true, className, }) {
254
254
  if (!visible)
255
255
  return null;
256
- return (React__default.createElement("span", { className: styles$1.postfix }, variation === "select" ? (React__default.createElement(Icon, { name: "arrowDown" })) : (React__default.createElement(Spinner, { size: "small" }))));
256
+ return (React__default.createElement("span", { className: classnames(styles$1.postfix, className) }, variation === "select" ? (React__default.createElement(Icon, { name: "arrowDown" })) : (React__default.createElement(Spinner, { size: "small" }))));
257
257
  }
258
258
 
259
259
  /**
@@ -4,8 +4,8 @@ var React = require('react');
4
4
  var tslib_es6 = require('../tslib.es6-cjs.js');
5
5
  var debounce = require('../debounce-cjs.js');
6
6
  var FormField = require('../FormField-cjs.js');
7
- require('@jobber/design');
8
7
  require('classnames');
8
+ require('@jobber/design');
9
9
  require('react-hook-form');
10
10
  require('../Button-cjs.js');
11
11
  var omit = require('../omit-cjs.js');
@@ -2,8 +2,8 @@ import React__default, { useState, useCallback, useEffect, useRef, useId } from
2
2
  import { _ as __rest } from '../tslib.es6-es.js';
3
3
  import { a as debounce } from '../debounce-es.js';
4
4
  import { j as useFormFieldWrapperStyles, f as FormFieldWrapper, k as FormField } from '../FormField-es.js';
5
- import '@jobber/design';
6
5
  import 'classnames';
6
+ import '@jobber/design';
7
7
  import 'react-hook-form';
8
8
  import '../Button-es.js';
9
9
  import { o as omit } from '../omit-es.js';
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import type { ReactNode } from "react";
3
+ export interface OptionGroupProps {
4
+ readonly children?: ReactNode;
5
+ readonly label: string;
6
+ readonly disabled?: boolean;
7
+ /**
8
+ * Use at your own risk: Custom classnames for specific elements. This should only be used as a
9
+ * last resort. Using this may result in unexpected side effects.
10
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
11
+ *
12
+ * Additional details: The provided class names are applied to the root `<optgroup>` element.
13
+ * Only effective when `Select` version={2} is used with `UNSAFE_experimentalStyles`.
14
+ */
15
+ readonly UNSAFE_className?: string;
16
+ /**
17
+ * Use at your own risk: Custom style for specific elements. This should only be used as a
18
+ * last resort. Using this may result in unexpected side effects.
19
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
20
+ *
21
+ * Additional details: Styles are applied directly to the root `<optgroup>` element via
22
+ * `UNSAFE_style.container`. Only effective when `Select` version={2} is used with
23
+ * `UNSAFE_experimentalStyles`.
24
+ */
25
+ readonly UNSAFE_style?: {
26
+ container?: React.CSSProperties;
27
+ };
28
+ }
29
+ export declare function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }: OptionGroupProps): React.JSX.Element;
@@ -14,4 +14,11 @@ export interface SelectRebuiltProps extends Omit<SelectLegacyProps, "defaultValu
14
14
  onChange?(newValue?: string | number): void;
15
15
  version: 2;
16
16
  error?: string;
17
+ /**
18
+ * Opt-in to the customizable select UI (Chromium 123+).
19
+ * When true, the component will apply the custom select styles
20
+ * Defaults to false for native behavior.
21
+ * Only supported by Select version={2}.
22
+ */
23
+ readonly UNSAFE_experimentalStyles?: boolean;
17
24
  }
@@ -3,7 +3,7 @@
3
3
  var React = require('react');
4
4
  var omit = require('../omit-cjs.js');
5
5
  var FormField = require('../FormField-cjs.js');
6
- require('classnames');
6
+ var classnames = require('classnames');
7
7
  require('../tslib.es6-cjs.js');
8
8
  require('react-hook-form');
9
9
  require('framer-motion');
@@ -67,6 +67,8 @@ function useSelectFormField({ id, name, disabled, autofocus, description, inline
67
67
  return { fieldProps, descriptionIdentifier };
68
68
  }
69
69
 
70
+ var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
71
+
70
72
  function SelectRebuilt(props) {
71
73
  var _a, _b;
72
74
  const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : React.useRef(null);
@@ -97,8 +99,8 @@ function SelectRebuilt(props) {
97
99
  handleFocus }));
98
100
  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: (_b = props.error) !== null && _b !== void 0 ? _b : "", 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", maxLength: props.maxLength },
99
101
  React.createElement(React.Fragment, null,
100
- React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
101
- React.createElement(FormField.FormFieldPostFix, { variation: "select" }))));
102
+ React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }), props.children),
103
+ React.createElement(FormField.FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
102
104
  }
103
105
  function useSelectId(props) {
104
106
  const generatedId = React.useId();
@@ -109,6 +111,10 @@ function SelectOption({ children, disabled, value }) {
109
111
  return (React.createElement("option", { disabled: disabled, value: value }, children));
110
112
  }
111
113
 
114
+ function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
115
+ 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));
116
+ }
117
+
112
118
  function isNewSelectProps(props) {
113
119
  return props.version === 2;
114
120
  }
@@ -120,6 +126,8 @@ function Select(props) {
120
126
  return React.createElement(Select$1, Object.assign({}, props));
121
127
  }
122
128
  }
129
+ Select.Option = SelectOption;
130
+ Select.OptionGroup = OptionGroup;
123
131
 
124
132
  exports.Option = SelectOption;
125
133
  exports.Select = Select;
@@ -3,4 +3,8 @@ import { type SelectLegacyProps, type SelectRebuiltProps } from "./Select.types"
3
3
  export { Option } from "./Option";
4
4
  export type SelectShimProps = SelectLegacyProps | SelectRebuiltProps;
5
5
  export declare function Select(props: SelectShimProps): React.JSX.Element;
6
+ export declare namespace Select {
7
+ var Option: typeof import("./Option").Option;
8
+ var OptionGroup: typeof import("./OptionGroup").OptionGroup;
9
+ }
6
10
  export type { SelectRebuiltProps, SelectLegacyProps };
@@ -1,7 +1,7 @@
1
1
  import React__default, { useRef, useId } from 'react';
2
2
  import { o as omit } from '../omit-es.js';
3
3
  import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix } from '../FormField-es.js';
4
- import 'classnames';
4
+ import classnames from 'classnames';
5
5
  import '../tslib.es6-es.js';
6
6
  import 'react-hook-form';
7
7
  import 'framer-motion';
@@ -65,6 +65,8 @@ function useSelectFormField({ id, name, disabled, autofocus, description, inline
65
65
  return { fieldProps, descriptionIdentifier };
66
66
  }
67
67
 
68
+ var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
69
+
68
70
  function SelectRebuilt(props) {
69
71
  var _a, _b;
70
72
  const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : useRef(null);
@@ -95,8 +97,8 @@ function SelectRebuilt(props) {
95
97
  handleFocus }));
96
98
  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: (_b = props.error) !== null && _b !== void 0 ? _b : "", 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", maxLength: props.maxLength },
97
99
  React__default.createElement(React__default.Fragment, null,
98
- React__default.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
99
- React__default.createElement(FormFieldPostFix, { variation: "select" }))));
100
+ React__default.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }), props.children),
101
+ React__default.createElement(FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
100
102
  }
101
103
  function useSelectId(props) {
102
104
  const generatedId = useId();
@@ -107,6 +109,10 @@ function SelectOption({ children, disabled, value }) {
107
109
  return (React__default.createElement("option", { disabled: disabled, value: value }, children));
108
110
  }
109
111
 
112
+ function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
113
+ 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));
114
+ }
115
+
110
116
  function isNewSelectProps(props) {
111
117
  return props.version === 2;
112
118
  }
@@ -118,5 +124,7 @@ function Select(props) {
118
124
  return React__default.createElement(Select$1, Object.assign({}, props));
119
125
  }
120
126
  }
127
+ Select.Option = SelectOption;
128
+ Select.OptionGroup = OptionGroup;
121
129
 
122
130
  export { SelectOption as Option, Select };
package/dist/styles.css CHANGED
@@ -6024,6 +6024,174 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
6024
6024
  }
6025
6025
  }
6026
6026
 
6027
+ /* stylelint-disable selector-pseudo-class-no-unknown */
6028
+ /* stylelint-disable selector-pseudo-element-no-unknown */
6029
+ /**
6030
+ * Chrome 123+ customizable select styling for option groups
6031
+ * Based on: https://developer.chrome.com/blog/a-customizable-select
6032
+ *
6033
+ * IMPORTANT: All custom styling is gated behind a feature query so that
6034
+ * unsupported browsers fall back to the native select without any layout
6035
+ * regressions in our FormField wrapper.
6036
+ */
6037
+ @supports ((-webkit-appearance: base-select) or (appearance: base-select)) {
6038
+ /* opt into customizing select */
6039
+ .-hmXAsAfH9U-,
6040
+ .-hmXAsAfH9U-::picker(select) {
6041
+ -webkit-appearance: base-select;
6042
+ appearance: base-select;
6043
+
6044
+ /* Dropdown styling */
6045
+ }
6046
+ .-hmXAsAfH9U-::picker(select), .-hmXAsAfH9U-::picker(select)::picker(select) {
6047
+ box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
6048
+ box-shadow: var(--shadow-base);
6049
+ margin-top: 8px;
6050
+ margin-top: var(--space-small);
6051
+ padding: 0;
6052
+ border: 1px solid hsl(200, 13%, 87%);
6053
+ border: var(--border-base) solid var(--color-border);
6054
+ border-radius: 8px;
6055
+ border-radius: var(--radius-base);
6056
+ background: rgba(255, 255, 255, 1);
6057
+ background: var(--color-surface);
6058
+ }
6059
+
6060
+ /* enable transitions in the drop down */
6061
+ .-hmXAsAfH9U-::picker(select) {
6062
+ transition:
6063
+ opacity 200ms ease,
6064
+ display 200ms allow-discrete,
6065
+ overlay 200ms allow-discrete,
6066
+ -webkit-transform 200ms ease-out;
6067
+ transition:
6068
+ opacity var(--timing-base) ease,
6069
+ display var(--timing-base) allow-discrete,
6070
+ overlay var(--timing-base) allow-discrete,
6071
+ -webkit-transform var(--timing-base) ease-out;
6072
+ transition:
6073
+ opacity 200ms ease,
6074
+ transform 200ms ease-out,
6075
+ display 200ms allow-discrete,
6076
+ overlay 200ms allow-discrete;
6077
+ transition:
6078
+ opacity var(--timing-base) ease,
6079
+ transform var(--timing-base) ease-out,
6080
+ display var(--timing-base) allow-discrete,
6081
+ overlay var(--timing-base) allow-discrete;
6082
+ transition:
6083
+ opacity 200ms ease,
6084
+ transform 200ms ease-out,
6085
+ display 200ms allow-discrete,
6086
+ overlay 200ms allow-discrete,
6087
+ -webkit-transform 200ms ease-out;
6088
+ transition:
6089
+ opacity var(--timing-base) ease,
6090
+ transform var(--timing-base) ease-out,
6091
+ display var(--timing-base) allow-discrete,
6092
+ overlay var(--timing-base) allow-discrete,
6093
+ -webkit-transform var(--timing-base) ease-out;
6094
+ }
6095
+
6096
+ .-hmXAsAfH9U-::picker-icon {
6097
+ display: none;
6098
+ }
6099
+
6100
+ .-hmXAsAfH9U-:not(:open)::picker(select) {
6101
+ opacity: 0;
6102
+ -webkit-transform: scale(0.95);
6103
+ transform: scale(0.95);
6104
+ }
6105
+
6106
+ .-hmXAsAfH9U-:open::picker(select) {
6107
+ opacity: 1;
6108
+ -webkit-transform: translateY(0) scale(1);
6109
+ transform: translateY(0) scale(1);
6110
+ }
6111
+ .-hmXAsAfH9U- {
6112
+
6113
+ /* options */
6114
+ option {
6115
+ padding: 4px 0;
6116
+ padding: var(--space-smaller) 0;
6117
+ color: hsl(198, 35%, 21%);
6118
+ color: var(--color-text);
6119
+ text-indent: 8px;
6120
+ text-indent: var(--space-small);
6121
+ cursor: pointer;
6122
+ }
6123
+
6124
+ option:hover,
6125
+ option:focus,
6126
+ option:focus-visible,
6127
+ option:checked {
6128
+ background-color: hsl(53, 21%, 93%);
6129
+ background-color: var(--color-surface--hover);
6130
+ }
6131
+
6132
+ /* optgroup headers */
6133
+ optgroup {
6134
+ padding: 8px 0 0 0;
6135
+ padding: var(--space-small) 0 0 0;
6136
+ color: hsl(197, 90%, 12%);
6137
+ color: var(--color-heading);
6138
+ font-size: 14px;
6139
+ font-size: var(--typography--fontSize-base);
6140
+ font-style: normal;
6141
+ font-weight: 700;
6142
+ text-indent: 8px;
6143
+ text-indent: var(--space-small);
6144
+ background-color: transparent;
6145
+ }
6146
+
6147
+ /* Divider directly under the group label */
6148
+ optgroup option:first-child {
6149
+ border-top: 1px solid hsl(200, 13%, 87%);
6150
+ border-top: var(--border-base) solid var(--color-border);
6151
+ }
6152
+
6153
+ /* Disabled groups and their options */
6154
+ optgroup[disabled] {
6155
+ color: hsl(0, 0%, 72%);
6156
+ color: var(--color-disabled);
6157
+ }
6158
+ optgroup[disabled] option,
6159
+ option[disabled] {
6160
+ color: hsl(0, 0%, 72%);
6161
+ color: var(--color-disabled);
6162
+ cursor: default;
6163
+ }
6164
+
6165
+ optgroup[disabled] option:focus,
6166
+ optgroup[disabled] option:focus-visible,
6167
+ optgroup[disabled] option:checked,
6168
+ optgroup[disabled] option:hover,
6169
+ option[disabled]:focus,
6170
+ option[disabled]:focus-visible,
6171
+ option[disabled]:checked,
6172
+ option[disabled]:hover {
6173
+ background-color: transparent;
6174
+ }
6175
+
6176
+ /* Animate the chevron rotation for the provided postfix class */
6177
+ }
6178
+ .-hmXAsAfH9U- + ._5ST4c1fXDYU- svg {
6179
+ transition: -webkit-transform 100ms;
6180
+ transition: -webkit-transform var(--timing-quick);
6181
+ transition: transform 100ms;
6182
+ transition: transform var(--timing-quick);
6183
+ transition: transform 100ms, -webkit-transform 100ms;
6184
+ transition: transform var(--timing-quick), -webkit-transform var(--timing-quick);
6185
+ -webkit-transform-origin: 50% 50%;
6186
+ transform-origin: 50% 50%;
6187
+ }
6188
+ /* Rotate the postfix chevron when the select is open */
6189
+ .-hmXAsAfH9U-:open + ._5ST4c1fXDYU- svg {
6190
+ -webkit-transform: rotate(180deg);
6191
+ transform: rotate(180deg);
6192
+ }
6193
+ }
6194
+
6027
6195
  .wMM6V80Rt-w- {
6028
6196
  padding: 16px;
6029
6197
  padding: var(--space-base);
@@ -166,6 +166,8 @@
166
166
  "SegmentedControlContext.Provider",
167
167
  "SegmentedControlProvider",
168
168
  "Select",
169
+ "Select.Option",
170
+ "Select.OptionGroup",
169
171
  "SideDrawer",
170
172
  "SideDrawer.Actions",
171
173
  "SideDrawer.BackButton",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.82.6",
3
+ "version": "6.83.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -547,5 +547,5 @@
547
547
  "> 1%",
548
548
  "IE 10"
549
549
  ],
550
- "gitHead": "d42f49fcff1b4ff5e5b5a6ce9ef3e16cdaeab281"
550
+ "gitHead": "199760ca563702adca0a1e359c2a7b67406c39df"
551
551
  }