@jobber/components-native 0.107.0 → 0.107.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.107.0",
3
+ "version": "0.107.2",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -73,7 +73,7 @@
73
73
  "devDependencies": {
74
74
  "@babel/runtime": "^7.29.2",
75
75
  "@gorhom/bottom-sheet": "^5.2.8",
76
- "@jobber/design": "0.105.0",
76
+ "@jobber/design": "0.106.1",
77
77
  "@jobber/hooks": "2.21.0",
78
78
  "@react-native-community/datetimepicker": "^8.4.5",
79
79
  "@react-native/babel-preset": "^0.82.1",
@@ -124,5 +124,5 @@
124
124
  "react-native-screens": ">=4.18.0",
125
125
  "react-native-svg": ">=12.0.0"
126
126
  },
127
- "gitHead": "5e02a8ecc5f282d152c92e18dde04a27d401ecf5"
127
+ "gitHead": "3f6678b1792101e43e544ec51cfa17d883362460"
128
128
  }
@@ -1,219 +0,0 @@
1
- # Select
2
-
3
- A Select is used to present a defined list of options to choose from.
4
-
5
- ## Design & usage guidelines
6
-
7
- Nested within the Select component, Option defines the options that can be
8
- selected. For grouping options with section headers, use Select.OptionGroup.
9
-
10
- #### Custom grouped menu and browser support
11
-
12
- To enable the enhanced grouped menu styling (bold section headers, edge‑to‑edge
13
- dividers and hover backgrounds), set the `UNSAFE_experimentalStyles` prop on
14
- `Select`.
15
-
16
- * When `UNSAFE_experimentalStyles` is true and the browser supports
17
- `appearance: base-select` (Chromium 123+), the select renders with the
18
- customizable grouped menu.
19
- * In unsupported browsers, or when `UNSAFE_experimentalStyles` is not provided,
20
- the select remains native while still rendering the same `OptionGroup`
21
- structure.
22
-
23
- ## States
24
-
25
- ### Invalid
26
-
27
- ```tsx
28
- import React, { useState } from "react";
29
- import { Option, Select } from "@jobber/components/Select";
30
-
31
- export function SelectInvalidExample() {
32
- const [value, setValue] = useState<string | number | undefined>("");
33
-
34
- return (
35
- <Select invalid={true} value={value} onChange={setValue}>
36
- <Option value="sad">Tony</Option>
37
- <Option value="old">Steve</Option>
38
- </Select>
39
- );
40
- }
41
- ```
42
-
43
- ### Disabled
44
-
45
- ```tsx
46
- import React, { useState } from "react";
47
- import { Option, Select } from "@jobber/components/Select";
48
-
49
- export function SelectDisabledExample() {
50
- const [value, setValue] = useState<string | number | undefined>("");
51
-
52
- return (
53
- <Select disabled={true} value={value} onChange={setValue}>
54
- <Option value="sad">Tony</Option>
55
- <Option value="old">Steve</Option>
56
- </Select>
57
- );
58
- }
59
- ```
60
-
61
- ## Option Grouping
62
-
63
- Use `Select.OptionGroup` to organize options with section headers for better
64
- user experience and visual hierarchy. The `label` prop is required as it
65
- provides the section header text.
66
-
67
- ### Basic Option Groups
68
-
69
- ```tsx
70
- import React, { useState } from "react";
71
- import { Select } from "@jobber/components/Select";
72
-
73
- export function SelectCustomOptionGroupsExample() {
74
- const [value, setValue] = useState<string | number | undefined>("");
75
-
76
- return (
77
- <Select
78
- placeholder="Select an option"
79
- UNSAFE_experimentalStyles={true}
80
- value={value}
81
- onChange={setValue}
82
- >
83
- <Select.OptionGroup label="Team A">
84
- <Select.Option value="alice">Alice</Select.Option>
85
- <Select.Option value="bob">Bob</Select.Option>
86
- <Select.Option value="charlie">Charlie</Select.Option>
87
- </Select.OptionGroup>
88
- <Select.OptionGroup label="Team B">
89
- <Select.Option value="diana">Diana</Select.Option>
90
- <Select.Option value="evan">Evan</Select.Option>
91
- <Select.Option value="frank">Frank</Select.Option>
92
- </Select.OptionGroup>
93
- <Select.OptionGroup label="Team C">
94
- <Select.Option value="grace">Grace</Select.Option>
95
- <Select.Option value="hector">Hector</Select.Option>
96
- <Select.Option value="isabel">Isabel</Select.Option>
97
- </Select.OptionGroup>
98
- </Select>
99
- );
100
- }
101
- ```
102
-
103
- ### Disabled Option Groups
104
-
105
- ```tsx
106
- import React, { useState } from "react";
107
- import { Select } from "@jobber/components/Select";
108
-
109
- export function SelectCustomOptionGroupDisabledExample() {
110
- const [value, setValue] = useState<string | number | undefined>("");
111
-
112
- return (
113
- <Select
114
- UNSAFE_experimentalStyles
115
- placeholder="Select an option"
116
- value={value}
117
- onChange={setValue}
118
- >
119
- <Select.OptionGroup label="Available Items">
120
- <Select.Option value="option1">Option 1</Select.Option>
121
- <Select.Option value="option2">Option 2</Select.Option>
122
- </Select.OptionGroup>
123
- <Select.OptionGroup label="Unavailable Items" disabled>
124
- <Select.Option value="option3">Option 3</Select.Option>
125
- <Select.Option value="option4">Option 4</Select.Option>
126
- </Select.OptionGroup>
127
- <Select.OptionGroup label="More Items">
128
- <Select.Option value="option5">Option 5</Select.Option>
129
- <Select.Option value="option6">Option 6</Select.Option>
130
- </Select.OptionGroup>
131
- </Select>
132
- );
133
- }
134
- ```
135
-
136
-
137
- ## Configuration
138
-
139
- ### Custom (Chromium) vs native
140
-
141
- Select is native by default. Opt into the customizable Chrome UI with
142
- `UNSAFE_experimentalStyles`. This enhances grouped menus in Chromium 123+ when
143
- the browser supports `appearance: base-select`.
144
-
145
- #### Alignment limitation (custom UI)
146
-
147
- When using `UNSAFE_experimentalStyles`, the closed control (what you see as the
148
- displayed value) is still rendered by the browser's picker. As a result,
149
- right/center alignment of the displayed value is not configurable in Chromium's
150
- customizable select.
151
-
152
- * Need right/center alignment? Use the native Select (omit
153
- `UNSAFE_experimentalStyles`).
154
- * You can still style the grouped dropdown (optgroup/option) in the custom UI,
155
- but the closed value alignment will remain default.
156
-
157
- ## Component customization
158
-
159
- ### Composable usage
160
-
161
- Select supports composition via subcomponents:
162
-
163
- * `Select.Option`: item in the list. Provide `value` and children as the label.
164
- * `Select.OptionGroup`: group options under a `label`. Use with
165
- `UNSAFE_experimentalStyles` to opt into the customizable grouped menu in
166
- Chromium.
167
-
168
- #### Customization links
169
-
170
- * See
171
- ["A customizable select"](https://developer.chrome.com/blog/a-customizable-select)
172
- article for what the Chrome UI exposes: `::picker(select)`, option/optgroup
173
- styling, and transitions.
174
-
175
- ## UNSAFE\_ props (advanced usage)
176
-
177
- General guidance on `UNSAFE_` props can be found in
178
- [Customizing components](../customizing-components/customizing-components.md).
179
-
180
- Select subcomponents allow `UNSAFE_className` and `UNSAFE_style` to target the
181
- native elements:
182
-
183
- * `Select.OptionGroup` maps to `<optgroup>`
184
- * `Select.Option` maps to `<option>`
185
-
186
- Note that native `<select>` UX differs per browser. Use `UNSAFE_` props with
187
- caution and test across environments. In the custom UI (Chromium), only the
188
- dropdown content is stylable; the closed value alignment is not.
189
-
190
-
191
- ## Props
192
-
193
- ### Mobile
194
-
195
- #### Option
196
-
197
- | Prop | Type | Required | Default | Description |
198
- |------|------|----------|---------|-------------|
199
- | `children` | `string` | Yes | — | Text that shows up as the option |
200
- | `value` | `string` | Yes | — | The value that gets returned when an option is selected |
201
-
202
- #### Select
203
-
204
- | Prop | Type | Required | Default | Description |
205
- |------|------|----------|---------|-------------|
206
- | `children` | `ReactElement<SelectOption, string | JSXElementConstructor<any>>[]` | Yes | — | The options to select from |
207
- | `accessibilityHint` | `string` | No | — | Helps users understand what will happen when they perform an action |
208
- | `accessibilityLabel` | `string` | No | — | VoiceOver will read this string when a user selects the element |
209
- | `assistiveText` | `string` | No | — | Help text shown below the control. |
210
- | `defaultValue` | `string` | No | — | Default value for when the component is uncontrolled |
211
- | `disabled` | `boolean` | No | — | Disables input selection |
212
- | `invalid` | `boolean` | No | — | Indicates the current selection is invalid |
213
- | `label` | `string` | No | — | Label text shown above the selection. |
214
- | `name` | `string` | No | — | Name of the input. |
215
- | `onChange` | `(newValue?: string) => void` | No | — | Callback that provides the new value when the selection changes |
216
- | `placeholder` | `string` | No | — | Adds a first option to let users select a "no value". Placeholder item selected by default until a selection is made. |
217
- | `testID` | `string` | No | — | Used to locate this view in end-to-end tests. |
218
- | `validations` | `RegisterOptions` | No | — | The validations that will mark this component as invalid |
219
- | `value` | `string` | No | — | Current value of the component |