@ankhorage/zora 0.0.4 → 0.1.1
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/CHANGELOG.md +12 -0
- package/README.md +335 -4
- package/dist/components/card/types.d.ts +1 -1
- package/dist/components/card/types.d.ts.map +1 -1
- package/dist/components/icon-button/IconButton.d.ts +4 -0
- package/dist/components/icon-button/IconButton.d.ts.map +1 -0
- package/dist/components/icon-button/IconButton.js +8 -0
- package/dist/components/icon-button/IconButton.js.map +1 -0
- package/dist/components/icon-button/index.d.ts +3 -0
- package/dist/components/icon-button/index.d.ts.map +1 -0
- package/dist/components/icon-button/index.js +3 -0
- package/dist/components/icon-button/index.js.map +1 -0
- package/dist/components/icon-button/types.d.ts +14 -0
- package/dist/components/icon-button/types.d.ts.map +1 -0
- package/dist/components/icon-button/types.js +2 -0
- package/dist/components/icon-button/types.js.map +1 -0
- package/dist/components/select/Select.d.ts +4 -0
- package/dist/components/select/Select.d.ts.map +1 -0
- package/dist/components/select/Select.js +18 -0
- package/dist/components/select/Select.js.map +1 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/select/index.d.ts.map +1 -0
- package/dist/components/select/index.js +3 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/select/types.d.ts +14 -0
- package/dist/components/select/types.d.ts.map +1 -0
- package/dist/components/select/types.js +2 -0
- package/dist/components/select/types.js.map +1 -0
- package/dist/components/tabs/Tabs.d.ts +4 -0
- package/dist/components/tabs/Tabs.d.ts.map +1 -0
- package/dist/components/tabs/Tabs.js +37 -0
- package/dist/components/tabs/Tabs.js.map +1 -0
- package/dist/components/tabs/index.d.ts +3 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/index.js +3 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs/types.d.ts +22 -0
- package/dist/components/tabs/types.d.ts.map +1 -0
- package/dist/components/tabs/types.js +2 -0
- package/dist/components/tabs/types.js.map +1 -0
- package/dist/components/toolbar/Toolbar.d.ts +4 -0
- package/dist/components/toolbar/Toolbar.d.ts.map +1 -0
- package/dist/components/toolbar/Toolbar.js +20 -0
- package/dist/components/toolbar/Toolbar.js.map +1 -0
- package/dist/components/toolbar/ToolbarAction.d.ts +4 -0
- package/dist/components/toolbar/ToolbarAction.d.ts.map +1 -0
- package/dist/components/toolbar/ToolbarAction.js +6 -0
- package/dist/components/toolbar/ToolbarAction.js.map +1 -0
- package/dist/components/toolbar/index.d.ts +4 -0
- package/dist/components/toolbar/index.d.ts.map +1 -0
- package/dist/components/toolbar/index.js +4 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/components/toolbar/types.d.ts +19 -0
- package/dist/components/toolbar/types.d.ts.map +1 -0
- package/dist/components/toolbar/types.js +2 -0
- package/dist/components/toolbar/types.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/patterns/collection-editor/CollectionEditor.d.ts +4 -0
- package/dist/patterns/collection-editor/CollectionEditor.d.ts.map +1 -0
- package/dist/patterns/collection-editor/CollectionEditor.js +41 -0
- package/dist/patterns/collection-editor/CollectionEditor.js.map +1 -0
- package/dist/patterns/collection-editor/index.d.ts +3 -0
- package/dist/patterns/collection-editor/index.d.ts.map +1 -0
- package/dist/patterns/collection-editor/index.js +3 -0
- package/dist/patterns/collection-editor/index.js.map +1 -0
- package/dist/patterns/collection-editor/types.d.ts +24 -0
- package/dist/patterns/collection-editor/types.d.ts.map +1 -0
- package/dist/patterns/collection-editor/types.js +2 -0
- package/dist/patterns/collection-editor/types.js.map +1 -0
- package/dist/patterns/disclosure-section/DisclosureSection.d.ts +4 -0
- package/dist/patterns/disclosure-section/DisclosureSection.d.ts.map +1 -0
- package/dist/patterns/disclosure-section/DisclosureSection.js +27 -0
- package/dist/patterns/disclosure-section/DisclosureSection.js.map +1 -0
- package/dist/patterns/disclosure-section/index.d.ts +3 -0
- package/dist/patterns/disclosure-section/index.d.ts.map +1 -0
- package/dist/patterns/disclosure-section/index.js +3 -0
- package/dist/patterns/disclosure-section/index.js.map +1 -0
- package/dist/patterns/disclosure-section/types.d.ts +15 -0
- package/dist/patterns/disclosure-section/types.d.ts.map +1 -0
- package/dist/patterns/disclosure-section/types.js +2 -0
- package/dist/patterns/disclosure-section/types.js.map +1 -0
- package/dist/patterns/inspector-field/InspectorField.d.ts +4 -0
- package/dist/patterns/inspector-field/InspectorField.d.ts.map +1 -0
- package/dist/patterns/inspector-field/InspectorField.js +12 -0
- package/dist/patterns/inspector-field/InspectorField.js.map +1 -0
- package/dist/patterns/inspector-field/index.d.ts +3 -0
- package/dist/patterns/inspector-field/index.d.ts.map +1 -0
- package/dist/patterns/inspector-field/index.js +3 -0
- package/dist/patterns/inspector-field/index.js.map +1 -0
- package/dist/patterns/inspector-field/types.d.ts +15 -0
- package/dist/patterns/inspector-field/types.d.ts.map +1 -0
- package/dist/patterns/inspector-field/types.js +2 -0
- package/dist/patterns/inspector-field/types.js.map +1 -0
- package/dist/patterns/responsive-panel/ResponsivePanel.d.ts +4 -0
- package/dist/patterns/responsive-panel/ResponsivePanel.d.ts.map +1 -0
- package/dist/patterns/responsive-panel/ResponsivePanel.js +25 -0
- package/dist/patterns/responsive-panel/ResponsivePanel.js.map +1 -0
- package/dist/patterns/responsive-panel/index.d.ts +3 -0
- package/dist/patterns/responsive-panel/index.d.ts.map +1 -0
- package/dist/patterns/responsive-panel/index.js +3 -0
- package/dist/patterns/responsive-panel/index.js.map +1 -0
- package/dist/patterns/responsive-panel/types.d.ts +19 -0
- package/dist/patterns/responsive-panel/types.d.ts.map +1 -0
- package/dist/patterns/responsive-panel/types.js +2 -0
- package/dist/patterns/responsive-panel/types.js.map +1 -0
- package/dist/patterns/switch-field/SwitchField.d.ts +4 -0
- package/dist/patterns/switch-field/SwitchField.d.ts.map +1 -0
- package/dist/patterns/switch-field/SwitchField.js +7 -0
- package/dist/patterns/switch-field/SwitchField.js.map +1 -0
- package/dist/patterns/switch-field/index.d.ts +3 -0
- package/dist/patterns/switch-field/index.d.ts.map +1 -0
- package/dist/patterns/switch-field/index.js +3 -0
- package/dist/patterns/switch-field/index.js.map +1 -0
- package/dist/patterns/switch-field/types.d.ts +10 -0
- package/dist/patterns/switch-field/types.d.ts.map +1 -0
- package/dist/patterns/switch-field/types.js +2 -0
- package/dist/patterns/switch-field/types.js.map +1 -0
- package/dist/patterns/tile-grid/PaletteItem.d.ts +4 -0
- package/dist/patterns/tile-grid/PaletteItem.d.ts.map +1 -0
- package/dist/patterns/tile-grid/PaletteItem.js +24 -0
- package/dist/patterns/tile-grid/PaletteItem.js.map +1 -0
- package/dist/patterns/tile-grid/TileGrid.d.ts +4 -0
- package/dist/patterns/tile-grid/TileGrid.d.ts.map +1 -0
- package/dist/patterns/tile-grid/TileGrid.js +26 -0
- package/dist/patterns/tile-grid/TileGrid.js.map +1 -0
- package/dist/patterns/tile-grid/index.d.ts +4 -0
- package/dist/patterns/tile-grid/index.d.ts.map +1 -0
- package/dist/patterns/tile-grid/index.js +4 -0
- package/dist/patterns/tile-grid/index.js.map +1 -0
- package/dist/patterns/tile-grid/types.d.ts +19 -0
- package/dist/patterns/tile-grid/types.d.ts.map +1 -0
- package/dist/patterns/tile-grid/types.js +2 -0
- package/dist/patterns/tile-grid/types.js.map +1 -0
- package/dist/patterns/tree-view/TreeItem.d.ts +14 -0
- package/dist/patterns/tree-view/TreeItem.d.ts.map +1 -0
- package/dist/patterns/tree-view/TreeItem.js +31 -0
- package/dist/patterns/tree-view/TreeItem.js.map +1 -0
- package/dist/patterns/tree-view/TreeView.d.ts +4 -0
- package/dist/patterns/tree-view/TreeView.d.ts.map +1 -0
- package/dist/patterns/tree-view/TreeView.js +20 -0
- package/dist/patterns/tree-view/TreeView.js.map +1 -0
- package/dist/patterns/tree-view/index.d.ts +4 -0
- package/dist/patterns/tree-view/index.d.ts.map +1 -0
- package/dist/patterns/tree-view/index.js +4 -0
- package/dist/patterns/tree-view/index.js.map +1 -0
- package/dist/patterns/tree-view/types.d.ts +29 -0
- package/dist/patterns/tree-view/types.d.ts.map +1 -0
- package/dist/patterns/tree-view/types.js +2 -0
- package/dist/patterns/tree-view/types.js.map +1 -0
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated the example app
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Add Studio-unblocking reusable UI elements including IconButton, Tabs, Toolbar, Select, disclosure sections, responsive panels, inspector fields, tree views, tile grids, and collection editor shells.
|
|
14
|
+
|
|
3
15
|
## 0.0.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -95,6 +95,34 @@ Surface, and `testID`.
|
|
|
95
95
|
|
|
96
96
|
</details>
|
|
97
97
|
|
|
98
|
+
### `IconButton`
|
|
99
|
+
|
|
100
|
+
Compact icon-only button for toolbars, rows, and actions.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
<IconButton icon={{ name: 'trash-outline' }} label="Delete" tone="danger" />
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
<details>
|
|
107
|
+
<summary>Props</summary>
|
|
108
|
+
|
|
109
|
+
ZORA props:
|
|
110
|
+
|
|
111
|
+
| Prop | Type | Default | Notes |
|
|
112
|
+
| --- | --- | --- | --- |
|
|
113
|
+
| `icon` | `ButtonIconSpec` | - | Required icon to render. |
|
|
114
|
+
| `label` | `string` | - | Required for `accessibilityLabel`. |
|
|
115
|
+
| `tone` | `ZoraTone` | `'neutral'` | Button tone. |
|
|
116
|
+
| `emphasis` | `ZoraEmphasis` | `'ghost'` | Button emphasis. |
|
|
117
|
+
| `size` | `ZoraControlSize` | `'m'` | Button size. |
|
|
118
|
+
|
|
119
|
+
Inherited props:
|
|
120
|
+
|
|
121
|
+
Inherits behavior from Surface `IconButton` including `disabled`, `loading`,
|
|
122
|
+
`onPress`, and `testID`.
|
|
123
|
+
|
|
124
|
+
</details>
|
|
125
|
+
|
|
98
126
|
### `Badge`
|
|
99
127
|
|
|
100
128
|
Small status label with ZORA tone, emphasis, and size defaults.
|
|
@@ -153,8 +181,8 @@ ZORA props:
|
|
|
153
181
|
|
|
154
182
|
Inherited props:
|
|
155
183
|
|
|
156
|
-
Inherits all Surface `CardProps` except `children`, `p`, `radius`, `
|
|
157
|
-
`
|
|
184
|
+
Inherits all Surface `CardProps` except `children`, `p`, `radius`, `variant`, and
|
|
185
|
+
`style`. ZORA owns spacing, radius, and variant selection for this wrapper.
|
|
158
186
|
|
|
159
187
|
</details>
|
|
160
188
|
|
|
@@ -222,6 +250,100 @@ Surface with the same Surface exclusions and re-exposed values listed for
|
|
|
222
250
|
|
|
223
251
|
</details>
|
|
224
252
|
|
|
253
|
+
### `Tabs`
|
|
254
|
+
|
|
255
|
+
Generic controlled tabs for navigation and filtering.
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
<Tabs
|
|
259
|
+
items={[
|
|
260
|
+
{ value: 'all', label: 'All' },
|
|
261
|
+
{ value: 'active', label: 'Active' },
|
|
262
|
+
]}
|
|
263
|
+
onValueChange={setValue}
|
|
264
|
+
value={value}
|
|
265
|
+
/>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
<details>
|
|
269
|
+
<summary>Props</summary>
|
|
270
|
+
|
|
271
|
+
ZORA props:
|
|
272
|
+
|
|
273
|
+
| Prop | Type | Default | Notes |
|
|
274
|
+
| --- | --- | --- | --- |
|
|
275
|
+
| `value` | `string` | - | Active tab value. |
|
|
276
|
+
| `items` | `TabItem[]` | - | Array of tab objects. |
|
|
277
|
+
| `onValueChange` | `(value: string) => void` | - | Change handler. |
|
|
278
|
+
| `variant` | `'underline' \| 'pill' \| 'segmented'` | `'underline'` | Visual style. |
|
|
279
|
+
| `size` | `ZoraControlSize` | `'m'` | Control size. |
|
|
280
|
+
|
|
281
|
+
</details>
|
|
282
|
+
|
|
283
|
+
### `Toolbar`
|
|
284
|
+
|
|
285
|
+
Horizontal shell for actions and tools.
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
<Toolbar>
|
|
289
|
+
<ToolbarAction icon={{ name: 'add-outline' }} label="Add" />
|
|
290
|
+
<ToolbarAction icon={{ name: 'search-outline' }} label="Search" />
|
|
291
|
+
</Toolbar>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
<details>
|
|
295
|
+
<summary>Props</summary>
|
|
296
|
+
|
|
297
|
+
`Toolbar` props:
|
|
298
|
+
|
|
299
|
+
| Prop | Type | Default | Notes |
|
|
300
|
+
| --- | --- | --- | --- |
|
|
301
|
+
| `children` | `React.ReactNode` | - | Toolbar content. |
|
|
302
|
+
| `position` | `'top' \| 'bottom' \| 'inline'` | `'inline'` | Layout position. |
|
|
303
|
+
| `floating` | `boolean` | `false` | Whether the toolbar floats with a shadow. |
|
|
304
|
+
| `compact` | `boolean` | `true` | Tighter padding. |
|
|
305
|
+
|
|
306
|
+
`ToolbarAction` props:
|
|
307
|
+
|
|
308
|
+
| Prop | Type | Default | Notes |
|
|
309
|
+
| --- | --- | --- | --- |
|
|
310
|
+
| `icon` | `ButtonIconSpec` | - | Required icon. |
|
|
311
|
+
| `label` | `string` | - | Accessibility label. |
|
|
312
|
+
| `active` | `boolean` | `false` | Highlighted state. |
|
|
313
|
+
| `onPress` | `() => void` | - | Click handler. |
|
|
314
|
+
|
|
315
|
+
</details>
|
|
316
|
+
|
|
317
|
+
### `Select`
|
|
318
|
+
|
|
319
|
+
Standard dropdown selector wrapping `@react-native-picker/picker`.
|
|
320
|
+
|
|
321
|
+
```tsx
|
|
322
|
+
<Select
|
|
323
|
+
onValueChange={setValue}
|
|
324
|
+
options={[
|
|
325
|
+
{ value: '1', label: 'Option 1' },
|
|
326
|
+
{ value: '2', label: 'Option 2' },
|
|
327
|
+
]}
|
|
328
|
+
value={value}
|
|
329
|
+
/>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
<details>
|
|
333
|
+
<summary>Props</summary>
|
|
334
|
+
|
|
335
|
+
ZORA props:
|
|
336
|
+
|
|
337
|
+
| Prop | Type | Default | Notes |
|
|
338
|
+
| --- | --- | --- | --- |
|
|
339
|
+
| `value` | `string` | - | Selected value. |
|
|
340
|
+
| `options` | `SelectOption[]` | - | Array of option objects. |
|
|
341
|
+
| `onValueChange` | `(value: string) => void` | - | Change handler. |
|
|
342
|
+
| `invalid` | `boolean` | `false` | Error state styling. |
|
|
343
|
+
| `disabled` | `boolean` | `false` | Interaction state. |
|
|
344
|
+
|
|
345
|
+
</details>
|
|
346
|
+
|
|
225
347
|
### `Modal`
|
|
226
348
|
|
|
227
349
|
Centered overlay shell with optional header, body, footer, and width preset.
|
|
@@ -725,6 +847,189 @@ No inherited props. `ConfirmDialogProps` is declared directly by ZORA.
|
|
|
725
847
|
|
|
726
848
|
</details>
|
|
727
849
|
|
|
850
|
+
### `DisclosureSection`
|
|
851
|
+
|
|
852
|
+
Collapsible section for property groups and settings.
|
|
853
|
+
|
|
854
|
+
```tsx
|
|
855
|
+
<DisclosureSection title="Advanced Settings">
|
|
856
|
+
{content}
|
|
857
|
+
</DisclosureSection>
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
<details>
|
|
861
|
+
<summary>Props</summary>
|
|
862
|
+
|
|
863
|
+
ZORA props:
|
|
864
|
+
|
|
865
|
+
| Prop | Type | Default | Notes |
|
|
866
|
+
| --- | --- | --- | --- |
|
|
867
|
+
| `title` | `React.ReactNode` | - | Section title. |
|
|
868
|
+
| `description` | `React.ReactNode` | - | Subheading text. |
|
|
869
|
+
| `defaultOpen` | `boolean` | `true` | Initial state. |
|
|
870
|
+
| `open` | `boolean` | - | Controlled state. |
|
|
871
|
+
| `onOpenChange` | `(open: boolean) => void` | - | Toggle handler. |
|
|
872
|
+
| `actions` | `React.ReactNode` | - | Extra header actions. |
|
|
873
|
+
|
|
874
|
+
</details>
|
|
875
|
+
|
|
876
|
+
### `ResponsivePanel`
|
|
877
|
+
|
|
878
|
+
Side panel that adapts to screen size (inline or overlay).
|
|
879
|
+
|
|
880
|
+
```tsx
|
|
881
|
+
<ResponsivePanel onOpenChange={setOpen} open={open} title="Inspector">
|
|
882
|
+
{content}
|
|
883
|
+
</ResponsivePanel>
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
<details>
|
|
887
|
+
<summary>Props</summary>
|
|
888
|
+
|
|
889
|
+
ZORA props:
|
|
890
|
+
|
|
891
|
+
| Prop | Type | Default | Notes |
|
|
892
|
+
| --- | --- | --- | --- |
|
|
893
|
+
| `open` | `boolean` | - | Required visibility. |
|
|
894
|
+
| `onOpenChange` | `(open: boolean) => void` | - | Required change handler. |
|
|
895
|
+
| `side` | `'left' \| 'right'` | `'right'` | Layout side. |
|
|
896
|
+
| `desktopMode` | `'inline' \| 'floating'` | `'inline'` | Desktop rendering style. |
|
|
897
|
+
| `mobileMode` | `'drawer' \| 'modal'` | `'drawer'` | Mobile rendering style. |
|
|
898
|
+
|
|
899
|
+
</details>
|
|
900
|
+
|
|
901
|
+
### `InspectorField`
|
|
902
|
+
|
|
903
|
+
Dense form field optimized for property panels.
|
|
904
|
+
|
|
905
|
+
```tsx
|
|
906
|
+
<InspectorField control={<IconButton icon={{ name: 'refresh-outline' }} label="Reset" />} label="Opacity">
|
|
907
|
+
<Input value="100%" />
|
|
908
|
+
</InspectorField>
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
<details>
|
|
912
|
+
<summary>Props</summary>
|
|
913
|
+
|
|
914
|
+
ZORA props:
|
|
915
|
+
|
|
916
|
+
| Prop | Type | Default | Notes |
|
|
917
|
+
| --- | --- | --- | --- |
|
|
918
|
+
| `label` | `React.ReactNode` | - | Field label. |
|
|
919
|
+
| `control` | `React.ReactNode` | - | Trailing control slot. |
|
|
920
|
+
| `children` | `React.ReactNode` | - | Main editor content. |
|
|
921
|
+
|
|
922
|
+
Inherits all `FormField` props.
|
|
923
|
+
|
|
924
|
+
</details>
|
|
925
|
+
|
|
926
|
+
### `SwitchField`
|
|
927
|
+
|
|
928
|
+
Labeled boolean toggle row.
|
|
929
|
+
|
|
930
|
+
```tsx
|
|
931
|
+
<SwitchField label="Enable Notifications" onValueChange={setVal} value={val} />
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
<details>
|
|
935
|
+
<summary>Props</summary>
|
|
936
|
+
|
|
937
|
+
ZORA props:
|
|
938
|
+
|
|
939
|
+
| Prop | Type | Default | Notes |
|
|
940
|
+
| --- | --- | --- | --- |
|
|
941
|
+
| `label` | `React.ReactNode` | - | Required label. |
|
|
942
|
+
| `description` | `React.ReactNode` | - | Subheading text. |
|
|
943
|
+
| `value` | `boolean` | - | Required state. |
|
|
944
|
+
| `onValueChange` | `(value: boolean) => void` | - | Required handler. |
|
|
945
|
+
|
|
946
|
+
</details>
|
|
947
|
+
|
|
948
|
+
### `TreeView`
|
|
949
|
+
|
|
950
|
+
Hierarchical list for navigation and layers.
|
|
951
|
+
|
|
952
|
+
```tsx
|
|
953
|
+
<TreeView
|
|
954
|
+
nodes={[
|
|
955
|
+
{ id: '1', label: 'Folder', children: [{ id: '2', label: 'File' }] }
|
|
956
|
+
]}
|
|
957
|
+
onSelect={id => console.log(id)}
|
|
958
|
+
/>
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
<details>
|
|
962
|
+
<summary>Props</summary>
|
|
963
|
+
|
|
964
|
+
ZORA props:
|
|
965
|
+
|
|
966
|
+
| Prop | Type | Default | Notes |
|
|
967
|
+
| --- | --- | --- | --- |
|
|
968
|
+
| `nodes` | `TreeItemNode[]` | - | Required tree data. |
|
|
969
|
+
| `selectedId` | `string` | - | Active node. |
|
|
970
|
+
| `expandedIds` | `string[]` | - | Controlled expansion. |
|
|
971
|
+
| `onSelect` | `(id: string) => void` | - | Click handler. |
|
|
972
|
+
|
|
973
|
+
</details>
|
|
974
|
+
|
|
975
|
+
### `TileGrid` / `PaletteItem`
|
|
976
|
+
|
|
977
|
+
Grid-based selection for palettes and toolboxes.
|
|
978
|
+
|
|
979
|
+
```tsx
|
|
980
|
+
<TileGrid>
|
|
981
|
+
<PaletteItem title="Red" onPress={() => setCol('red')} />
|
|
982
|
+
<PaletteItem title="Blue" onPress={() => setCol('blue')} />
|
|
983
|
+
</TileGrid>
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
<details>
|
|
987
|
+
<summary>Props</summary>
|
|
988
|
+
|
|
989
|
+
`TileGrid` props:
|
|
990
|
+
|
|
991
|
+
| Prop | Type | Default | Notes |
|
|
992
|
+
| --- | --- | --- | --- |
|
|
993
|
+
| `columns` | `number \| 'responsive'` | `'responsive'` | Grid layout. |
|
|
994
|
+
|
|
995
|
+
`PaletteItem` props:
|
|
996
|
+
|
|
997
|
+
| Prop | Type | Default | Notes |
|
|
998
|
+
| --- | --- | --- | --- |
|
|
999
|
+
| `title` | `React.ReactNode` | - | Item title. |
|
|
1000
|
+
| `selected` | `boolean` | `false` | Highlighted state. |
|
|
1001
|
+
| `onPress` | `() => void` | - | Click handler. |
|
|
1002
|
+
|
|
1003
|
+
</details>
|
|
1004
|
+
|
|
1005
|
+
### `CollectionEditor`
|
|
1006
|
+
|
|
1007
|
+
Generic visual shell for editing ordered collections.
|
|
1008
|
+
|
|
1009
|
+
```tsx
|
|
1010
|
+
<CollectionEditor
|
|
1011
|
+
items={items}
|
|
1012
|
+
renderItem={({ item }) => <Text>{item.name}</Text>}
|
|
1013
|
+
onAdd={() => add()}
|
|
1014
|
+
onRemove={index => remove(index)}
|
|
1015
|
+
/>
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
<details>
|
|
1019
|
+
<summary>Props</summary>
|
|
1020
|
+
|
|
1021
|
+
ZORA props:
|
|
1022
|
+
|
|
1023
|
+
| Prop | Type | Default | Notes |
|
|
1024
|
+
| --- | --- | --- | --- |
|
|
1025
|
+
| `items` | `readonly T[]` | - | Required collection. |
|
|
1026
|
+
| `renderItem` | `(props) => ReactNode` | - | Required item renderer. |
|
|
1027
|
+
| `onAdd` | `() => void` | - | Add handler. |
|
|
1028
|
+
| `onRemove` | `(index: number) => void` | - | Remove handler. |
|
|
1029
|
+
| `onMove` | `(from, to) => void` | - | Reorder handler. |
|
|
1030
|
+
|
|
1031
|
+
</details>
|
|
1032
|
+
|
|
728
1033
|
## Theme
|
|
729
1034
|
|
|
730
1035
|
### `ZoraProvider`
|
|
@@ -795,12 +1100,12 @@ const zoraTheme: ThemeConfig = {
|
|
|
795
1100
|
light: {
|
|
796
1101
|
primaryColor: '#0f766e',
|
|
797
1102
|
harmony: 'analogous',
|
|
798
|
-
|
|
1103
|
+
systemTone: 'jewel',
|
|
799
1104
|
},
|
|
800
1105
|
dark: {
|
|
801
1106
|
primaryColor: '#2dd4bf',
|
|
802
1107
|
harmony: 'analogous',
|
|
803
|
-
|
|
1108
|
+
systemTone: 'jewel',
|
|
804
1109
|
},
|
|
805
1110
|
};
|
|
806
1111
|
```
|
|
@@ -815,24 +1120,37 @@ export {
|
|
|
815
1120
|
Badge,
|
|
816
1121
|
Button,
|
|
817
1122
|
Card,
|
|
1123
|
+
CollectionEditor,
|
|
818
1124
|
ConfirmDialog,
|
|
819
1125
|
createZoraTheme,
|
|
1126
|
+
DisclosureSection,
|
|
820
1127
|
Drawer,
|
|
821
1128
|
EmptyState,
|
|
822
1129
|
FormField,
|
|
1130
|
+
IconButton,
|
|
823
1131
|
Input,
|
|
1132
|
+
InspectorField,
|
|
824
1133
|
Modal,
|
|
825
1134
|
Notice,
|
|
826
1135
|
Page,
|
|
827
1136
|
PageHeader,
|
|
828
1137
|
PageSection,
|
|
1138
|
+
PaletteItem,
|
|
829
1139
|
Panel,
|
|
1140
|
+
ResponsivePanel,
|
|
830
1141
|
SectionHeader,
|
|
1142
|
+
Select,
|
|
831
1143
|
SettingsLayout,
|
|
832
1144
|
SettingsRow,
|
|
833
1145
|
SidebarLayout,
|
|
1146
|
+
SwitchField,
|
|
1147
|
+
Tabs,
|
|
834
1148
|
Textarea,
|
|
1149
|
+
TileGrid,
|
|
1150
|
+
Toolbar,
|
|
1151
|
+
ToolbarAction,
|
|
835
1152
|
TopbarLayout,
|
|
1153
|
+
TreeView,
|
|
836
1154
|
ZoraProvider,
|
|
837
1155
|
zoraTheme,
|
|
838
1156
|
};
|
|
@@ -842,24 +1160,37 @@ export type {
|
|
|
842
1160
|
BadgeProps,
|
|
843
1161
|
ButtonProps,
|
|
844
1162
|
CardProps,
|
|
1163
|
+
CollectionEditorProps,
|
|
845
1164
|
ConfirmDialogProps,
|
|
1165
|
+
DisclosureSectionProps,
|
|
846
1166
|
DrawerProps,
|
|
847
1167
|
EmptyStateAction,
|
|
848
1168
|
EmptyStateProps,
|
|
849
1169
|
FormFieldProps,
|
|
1170
|
+
IconButtonProps,
|
|
850
1171
|
InputProps,
|
|
1172
|
+
InspectorFieldProps,
|
|
851
1173
|
ModalProps,
|
|
852
1174
|
NoticeProps,
|
|
853
1175
|
PageHeaderProps,
|
|
854
1176
|
PageProps,
|
|
855
1177
|
PageSectionProps,
|
|
1178
|
+
PaletteItemProps,
|
|
856
1179
|
PanelProps,
|
|
1180
|
+
ResponsivePanelProps,
|
|
857
1181
|
SectionHeaderProps,
|
|
1182
|
+
SelectProps,
|
|
858
1183
|
SettingsLayoutProps,
|
|
859
1184
|
SettingsRowProps,
|
|
860
1185
|
SidebarLayoutProps,
|
|
1186
|
+
SwitchFieldProps,
|
|
1187
|
+
TabsProps,
|
|
861
1188
|
TextareaProps,
|
|
1189
|
+
TileGridProps,
|
|
1190
|
+
ToolbarProps,
|
|
1191
|
+
ToolbarActionProps,
|
|
862
1192
|
TopbarLayoutProps,
|
|
1193
|
+
TreeViewProps,
|
|
863
1194
|
ZoraProviderProps,
|
|
864
1195
|
ZoraThemeOverride,
|
|
865
1196
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CardProps as SurfaceCardProps } from '@ankhorage/surface';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import type { ZoraCardTone } from '../../internal/recipes';
|
|
4
|
-
export interface CardProps extends Omit<SurfaceCardProps, 'children' | 'p' | 'radius' | '
|
|
4
|
+
export interface CardProps extends Omit<SurfaceCardProps, 'children' | 'p' | 'radius' | 'variant'> {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
title?: React.ReactNode;
|
|
7
7
|
description?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,SAAU,SAAQ,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,GAAG,GAAG,QAAQ,GAAG,SAAS,CAAC;IAChG,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/IconButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,QAAkB,EAClB,IAAgB,EAChB,IAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe,qBAajB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IconButton as SurfaceIconButton } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { resolveButtonRecipe } from '../../internal/recipes';
|
|
4
|
+
export function IconButton({ icon, label, emphasis = 'ghost', tone = 'neutral', size = 'm', ...props }) {
|
|
5
|
+
const recipe = resolveButtonRecipe({ emphasis, tone, size });
|
|
6
|
+
return (<SurfaceIconButton {...props} icon={icon} accessibilityLabel={label} size={recipe.size} tone={recipe.tone} variant={recipe.variant}/>);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/components/icon-button/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,QAAQ,GAAG,OAAO,EAClB,IAAI,GAAG,SAAS,EAChB,IAAI,GAAG,GAAG,EACV,GAAG,KAAK,EACQ;IAChB,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7D,OAAO,CACL,CAAC,iBAAiB,CAChB,IAAI,KAAK,CAAC,CACV,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,kBAAkB,CAAC,CAAC,KAAK,CAAC,CAC1B,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAClB,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAClB,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EACxB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/icon-button/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
|
+
import type { ZoraControlSize, ZoraEmphasis, ZoraTone } from '../../internal/recipes';
|
|
3
|
+
export interface IconButtonProps {
|
|
4
|
+
icon: ButtonIconSpec;
|
|
5
|
+
label: string;
|
|
6
|
+
emphasis?: ZoraEmphasis;
|
|
7
|
+
tone?: ZoraTone;
|
|
8
|
+
size?: ZoraControlSize;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
onPress?: () => void;
|
|
12
|
+
testID?: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEtF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/icon-button/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SelectProps } from './types';
|
|
3
|
+
export declare function Select<TValue extends string = string>({ value, options, onValueChange, disabled, invalid, testID, }: SelectProps<TValue>): React.JSX.Element;
|
|
4
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/select/Select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,MAAM,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,EAAE,EACrD,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,OAAO,EACP,MAAM,GACP,EAAE,WAAW,CAAC,MAAM,CAAC,qBAmCrB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Box, useTheme } from '@ankhorage/surface';
|
|
2
|
+
import { Picker } from '@react-native-picker/picker';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export function Select({ value, options, onValueChange, disabled, invalid, testID, }) {
|
|
5
|
+
const { theme } = useTheme();
|
|
6
|
+
return (<Box bg="surface" borderColor={invalid ? theme.colors.error : theme.colors.border} borderWidth={1} opacity={disabled ? 0.5 : 1} radius="m" testID={testID}>
|
|
7
|
+
<Picker enabled={!disabled} onValueChange={(itemValue) => onValueChange(itemValue)} selectedValue={value} style={{
|
|
8
|
+
height: 44,
|
|
9
|
+
width: '100%',
|
|
10
|
+
backgroundColor: 'transparent',
|
|
11
|
+
color: theme.colors.text,
|
|
12
|
+
borderWidth: 0,
|
|
13
|
+
}}>
|
|
14
|
+
{options.map((option) => (<Picker.Item key={option.value} enabled={!option.disabled} label={option.label} value={option.value}/>))}
|
|
15
|
+
</Picker>
|
|
16
|
+
</Box>);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,UAAU,MAAM,CAAiC,EACrD,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,OAAO,EACP,MAAM,GACc;IACpB,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE7B,OAAO,CACL,CAAC,GAAG,CACF,EAAE,CAAC,SAAS,CACZ,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC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":"index.js","sourceRoot":"","sources":["../../../src/components/select/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SelectOption<TValue extends string = string> {
|
|
2
|
+
value: TValue;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface SelectProps<TValue extends string = string> {
|
|
7
|
+
value: TValue;
|
|
8
|
+
options: readonly SelectOption<TValue>[];
|
|
9
|
+
onValueChange: (value: TValue) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
testID?: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/select/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IACzC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/select/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TabsProps } from './types';
|
|
3
|
+
export declare function Tabs<TValue extends string = string>({ value, items, onValueChange, variant, size, disabled: tabsDisabled, testID, }: TabsProps<TValue>): React.JSX.Element;
|
|
4
|
+
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAW,SAAS,EAAE,MAAM,SAAS,CAAC;AAElD,wBAAgB,IAAI,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,EAAE,EACnD,KAAK,EACL,KAAK,EACL,aAAa,EACb,OAAqB,EACrB,IAAU,EACV,QAAQ,EAAE,YAAY,EACtB,MAAM,GACP,EAAE,SAAS,CAAC,MAAM,CAAC,qBAwFnB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Box, Stack, Text, useTheme } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Button } from '../button';
|
|
4
|
+
export function Tabs({ value, items, onValueChange, variant = 'underline', size = 'm', disabled: tabsDisabled, testID, }) {
|
|
5
|
+
const { theme } = useTheme();
|
|
6
|
+
const renderTab = (item) => {
|
|
7
|
+
const isActive = item.value === value;
|
|
8
|
+
const isDisabled = tabsDisabled ?? item.disabled;
|
|
9
|
+
if (variant === 'segmented') {
|
|
10
|
+
return (<Button key={item.value} emphasis={isActive ? 'solid' : 'ghost'} tone="neutral" size={size} disabled={isDisabled} onPress={() => onValueChange(item.value)} leadingIcon={item.icon} testID={item.testID}>
|
|
11
|
+
{item.label}
|
|
12
|
+
{item.badge}
|
|
13
|
+
</Button>);
|
|
14
|
+
}
|
|
15
|
+
if (variant === 'pill') {
|
|
16
|
+
return (<Button key={item.value} emphasis={isActive ? 'soft' : 'ghost'} tone={isActive ? 'primary' : 'neutral'} size={size} disabled={isDisabled} onPress={() => onValueChange(item.value)} leadingIcon={item.icon} testID={item.testID}>
|
|
17
|
+
{item.label}
|
|
18
|
+
{item.badge}
|
|
19
|
+
</Button>);
|
|
20
|
+
}
|
|
21
|
+
// Default: 'underline'
|
|
22
|
+
return (<Box key={item.value} borderColor={isActive ? theme.colors.primary : 'transparent'} pb="xs" style={{
|
|
23
|
+
borderBottomWidth: 2,
|
|
24
|
+
}}>
|
|
25
|
+
<Button emphasis="ghost" tone="neutral" size={size} disabled={isDisabled} onPress={() => onValueChange(item.value)} leadingIcon={item.icon} testID={item.testID}>
|
|
26
|
+
<Text color={isActive ? theme.colors.primary : undefined} tone={isActive ? undefined : 'muted'} weight={isActive ? 'semiBold' : 'regular'}>
|
|
27
|
+
{item.label}
|
|
28
|
+
</Text>
|
|
29
|
+
{item.badge}
|
|
30
|
+
</Button>
|
|
31
|
+
</Box>);
|
|
32
|
+
};
|
|
33
|
+
return (<Stack direction="row" gap={variant === 'segmented' ? 'none' : 'm'} align="center" testID={testID} p={variant === 'segmented' ? 'xxs' : 'none'} bg={variant === 'segmented' ? 'subtle' : 'transparent'} radius={variant === 'segmented' ? 'm' : 'none'}>
|
|
34
|
+
{items.map(renderTab)}
|
|
35
|
+
</Stack>);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,MAAM,UAAU,IAAI,CAAiC,EACnD,KAAK,EACL,KAAK,EACL,aAAa,EACb,OAAO,GAAG,WAAW,EACrB,IAAI,GAAG,GAAG,EACV,QAAQ,EAAE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