@ankhorage/zora 2.4.3 → 2.4.5
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 +155 -0
- package/dist/components/action-sheet/ActionSheet.d.ts +4 -0
- package/dist/components/action-sheet/ActionSheet.d.ts.map +1 -0
- package/dist/components/action-sheet/ActionSheet.js +8 -0
- package/dist/components/action-sheet/ActionSheet.js.map +1 -0
- package/dist/components/action-sheet/ActionSheetItem.d.ts +4 -0
- package/dist/components/action-sheet/ActionSheetItem.d.ts.map +1 -0
- package/dist/components/action-sheet/ActionSheetItem.js +14 -0
- package/dist/components/action-sheet/ActionSheetItem.js.map +1 -0
- package/dist/components/action-sheet/index.d.ts +4 -0
- package/dist/components/action-sheet/index.d.ts.map +1 -0
- package/dist/components/action-sheet/index.js +3 -0
- package/dist/components/action-sheet/index.js.map +1 -0
- package/dist/components/action-sheet/meta.d.ts +17 -0
- package/dist/components/action-sheet/meta.d.ts.map +1 -0
- package/dist/components/action-sheet/meta.js +17 -0
- package/dist/components/action-sheet/meta.js.map +1 -0
- package/dist/components/action-sheet/types.d.ts +13 -0
- package/dist/components/action-sheet/types.d.ts.map +1 -0
- package/dist/components/action-sheet/types.js +2 -0
- package/dist/components/action-sheet/types.js.map +1 -0
- package/dist/components/data-table/DataTable.d.ts +4 -0
- package/dist/components/data-table/DataTable.d.ts.map +1 -0
- package/dist/components/data-table/DataTable.js +207 -0
- package/dist/components/data-table/DataTable.js.map +1 -0
- package/dist/components/data-table/index.d.ts +3 -0
- package/dist/components/data-table/index.d.ts.map +1 -0
- package/dist/components/data-table/index.js +2 -0
- package/dist/components/data-table/index.js.map +1 -0
- package/dist/components/data-table/meta.d.ts +9 -0
- package/dist/components/data-table/meta.d.ts.map +1 -0
- package/dist/components/data-table/meta.js +9 -0
- package/dist/components/data-table/meta.js.map +1 -0
- package/dist/components/data-table/types.d.ts +51 -0
- package/dist/components/data-table/types.d.ts.map +1 -0
- package/dist/components/data-table/types.js +2 -0
- package/dist/components/data-table/types.js.map +1 -0
- package/dist/components/menu/DropdownMenu.d.ts +4 -0
- package/dist/components/menu/DropdownMenu.d.ts.map +1 -0
- package/dist/components/menu/DropdownMenu.js +6 -0
- package/dist/components/menu/DropdownMenu.js.map +1 -0
- package/dist/components/menu/Menu.d.ts +4 -0
- package/dist/components/menu/Menu.d.ts.map +1 -0
- package/dist/components/menu/Menu.js +43 -0
- package/dist/components/menu/Menu.js.map +1 -0
- package/dist/components/menu/index.d.ts +4 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +3 -0
- package/dist/components/menu/index.js.map +1 -0
- package/dist/components/menu/meta.d.ts +17 -0
- package/dist/components/menu/meta.d.ts.map +1 -0
- package/dist/components/menu/meta.js +17 -0
- package/dist/components/menu/meta.js.map +1 -0
- package/dist/components/menu/types.d.ts +22 -0
- package/dist/components/menu/types.d.ts.map +1 -0
- package/dist/components/menu/types.js +2 -0
- package/dist/components/menu/types.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +8 -0
- package/dist/metadata/componentMeta.js.map +1 -1
- package/package.json +2 -2
- package/src/components/action-sheet/ActionSheet.tsx +11 -0
- package/src/components/action-sheet/ActionSheetItem.tsx +32 -0
- package/src/components/action-sheet/index.ts +3 -0
- package/src/components/action-sheet/meta.ts +19 -0
- package/src/components/action-sheet/types.ts +23 -0
- package/src/components/data-table/DataTable.tsx +388 -0
- package/src/components/data-table/index.ts +11 -0
- package/src/components/data-table/meta.ts +10 -0
- package/src/components/data-table/types.ts +57 -0
- package/src/components/menu/DropdownMenu.tsx +8 -0
- package/src/components/menu/Menu.tsx +63 -0
- package/src/components/menu/index.ts +3 -0
- package/src/components/menu/meta.ts +19 -0
- package/src/components/menu/types.ts +31 -0
- package/src/index.ts +15 -0
- package/src/metadata/componentMeta.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9db4949: Add DataTable for typed app-facing tabular data with row actions, sorting state, loading, empty, and responsive layouts.
|
|
8
|
+
|
|
9
|
+
## 2.4.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 50c9679: Expose Surface-backed Menu, DropdownMenu, ActionSheet, and ActionSheetItem components.
|
|
14
|
+
|
|
3
15
|
## 2.4.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -288,6 +288,8 @@ Metadata model overview:
|
|
|
288
288
|
<details>
|
|
289
289
|
<summary>Components</summary>
|
|
290
290
|
|
|
291
|
+
- `ActionSheet`
|
|
292
|
+
- `ActionSheetItem`
|
|
291
293
|
- `AppBar`
|
|
292
294
|
- `Avatar`
|
|
293
295
|
- `AvatarGroup`
|
|
@@ -299,6 +301,7 @@ Metadata model overview:
|
|
|
299
301
|
- `CheckboxGroup`
|
|
300
302
|
- `Chip`
|
|
301
303
|
- `ChipGroup`
|
|
304
|
+
- `DropdownMenu`
|
|
302
305
|
- `Drawer`
|
|
303
306
|
- `Form`
|
|
304
307
|
- `FormActions`
|
|
@@ -1157,6 +1160,158 @@ Surface with the same Surface exclusions and re-exposed values listed for
|
|
|
1157
1160
|
|
|
1158
1161
|
</details>
|
|
1159
1162
|
|
|
1163
|
+
### `Menu` / `DropdownMenu` / `ActionSheet`
|
|
1164
|
+
|
|
1165
|
+
Action-surface components for overflow actions, row actions, card actions, toolbar
|
|
1166
|
+
menus, profile actions, destructive entry points, and mobile-friendly contextual
|
|
1167
|
+
action sheets.
|
|
1168
|
+
|
|
1169
|
+
`Menu` and `DropdownMenu` expose app-facing action specs while delegating the
|
|
1170
|
+
low-level trigger, portal, focus, keyboard, and dismissal behavior to Surface.
|
|
1171
|
+
`ActionSheet` and `ActionSheetItem` expose a mobile-friendly contextual action
|
|
1172
|
+
surface backed by Surface.
|
|
1173
|
+
|
|
1174
|
+
```tsx
|
|
1175
|
+
<Menu
|
|
1176
|
+
trigger={<IconButton icon={{ name: 'ellipsis-horizontal' }} label="More actions" />}
|
|
1177
|
+
actions={[
|
|
1178
|
+
{
|
|
1179
|
+
id: 'edit',
|
|
1180
|
+
title: 'Edit',
|
|
1181
|
+
icon: { name: 'create-outline' },
|
|
1182
|
+
onPress: edit,
|
|
1183
|
+
},
|
|
1184
|
+
{
|
|
1185
|
+
id: 'duplicate',
|
|
1186
|
+
title: 'Duplicate',
|
|
1187
|
+
icon: { name: 'copy-outline' },
|
|
1188
|
+
onPress: duplicate,
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
id: 'delete',
|
|
1192
|
+
title: 'Delete',
|
|
1193
|
+
description: 'Remove this item permanently.',
|
|
1194
|
+
icon: { name: 'trash-outline' },
|
|
1195
|
+
intent: 'danger',
|
|
1196
|
+
onPress: remove,
|
|
1197
|
+
},
|
|
1198
|
+
]}
|
|
1199
|
+
/>
|
|
1200
|
+
```
|
|
1201
|
+
|
|
1202
|
+
`DropdownMenu` is an app-facing alias for the same trigger/actions composition:
|
|
1203
|
+
|
|
1204
|
+
```tsx
|
|
1205
|
+
<DropdownMenu
|
|
1206
|
+
trigger={<Button variant="outline">Sort</Button>}
|
|
1207
|
+
actions={[
|
|
1208
|
+
{ id: 'newest', title: 'Newest first', selected: true, onPress: sortNewest },
|
|
1209
|
+
{ id: 'oldest', title: 'Oldest first', onPress: sortOldest },
|
|
1210
|
+
]}
|
|
1211
|
+
/>
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
Use `ActionSheet` for a modal contextual action surface:
|
|
1215
|
+
|
|
1216
|
+
```tsx
|
|
1217
|
+
<ActionSheet
|
|
1218
|
+
visible={sheetVisible}
|
|
1219
|
+
onDismiss={() => setSheetVisible(false)}
|
|
1220
|
+
title="Project actions"
|
|
1221
|
+
description="Choose what to do with this project."
|
|
1222
|
+
>
|
|
1223
|
+
<ActionSheetItem label="Edit" icon={{ name: 'create-outline' }} onPress={edit} />
|
|
1224
|
+
<ActionSheetItem label="Duplicate" icon={{ name: 'copy-outline' }} onPress={duplicate} />
|
|
1225
|
+
<ActionSheetItem
|
|
1226
|
+
color="danger"
|
|
1227
|
+
label="Delete"
|
|
1228
|
+
icon={{ name: 'trash-outline' }}
|
|
1229
|
+
onPress={remove}
|
|
1230
|
+
/>
|
|
1231
|
+
</ActionSheet>
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
These components do not own command-palette behavior, nested menus, data-table
|
|
1235
|
+
row logic, or global shortcut handling.
|
|
1236
|
+
|
|
1237
|
+
<details>
|
|
1238
|
+
<summary>Props</summary>
|
|
1239
|
+
|
|
1240
|
+
`Menu` / `DropdownMenu` props:
|
|
1241
|
+
|
|
1242
|
+
| Prop | Type | Default | Notes |
|
|
1243
|
+
| --------------- | ----------------------- | ------- | ------------------------------------------ |
|
|
1244
|
+
| `trigger` | `React.ReactNode` | - | Element used to open/close the menu. |
|
|
1245
|
+
| `actions` | `readonly MenuAction[]` | - | Structured action rows. |
|
|
1246
|
+
| `onDismiss` | `() => void` | - | Called when the menu is dismissed. |
|
|
1247
|
+
| `closeOnSelect` | `boolean` | `true` | Closes the menu after an action activates. |
|
|
1248
|
+
| `testID` | `string` | - | Test id. |
|
|
1249
|
+
| `mode` | `ZoraThemeMode` | - | Optional scoped theme mode override. |
|
|
1250
|
+
| `themeId` | `ZoraThemeId` | - | Optional scoped theme id override. |
|
|
1251
|
+
|
|
1252
|
+
`MenuAction` fields:
|
|
1253
|
+
|
|
1254
|
+
| Field | Type | Default | Notes |
|
|
1255
|
+
| ------------- | ------------------ | ------- | -------------------------------------------- |
|
|
1256
|
+
| `id` | `string` | - | Stable action id. |
|
|
1257
|
+
| `title` | `React.ReactNode` | - | Main action label. |
|
|
1258
|
+
| `description` | `React.ReactNode` | - | Optional secondary text. |
|
|
1259
|
+
| `icon` | `ButtonIconSpec` | - | Convenience icon shortcut. |
|
|
1260
|
+
| `leading` | `React.ReactNode` | - | Custom leading content. Overrides `icon`. |
|
|
1261
|
+
| `trailing` | `React.ReactNode` | - | Custom trailing content. |
|
|
1262
|
+
| `intent` | `MenuActionIntent` | - | Action intent, currently `default`/`danger`. |
|
|
1263
|
+
| `disabled` | `boolean` | `false` | Disables the action. |
|
|
1264
|
+
| `selected` | `boolean` | `false` | Marks the action as selected. |
|
|
1265
|
+
| `onPress` | `() => void` | - | Called when the action is selected. |
|
|
1266
|
+
|
|
1267
|
+
`ActionSheet` props:
|
|
1268
|
+
|
|
1269
|
+
| Prop | Type | Default | Notes |
|
|
1270
|
+
| ----------------- | ----------------- | ---------- | ------------------------------------------ |
|
|
1271
|
+
| `visible` | `boolean` | - | Controls sheet visibility. |
|
|
1272
|
+
| `onDismiss` | `() => void` | - | Called when the sheet is dismissed. |
|
|
1273
|
+
| `title` | `React.ReactNode` | - | Optional sheet title. |
|
|
1274
|
+
| `description` | `React.ReactNode` | - | Optional sheet description. |
|
|
1275
|
+
| `children` | `React.ReactNode` | - | Usually `ActionSheetItem` children. |
|
|
1276
|
+
| `cancelLabel` | `React.ReactNode` | `'Cancel'` | Label for the cancel action. |
|
|
1277
|
+
| `closeOnBackdrop` | `boolean` | `true` | Dismisses the sheet when backdrop pressed. |
|
|
1278
|
+
| `testID` | `string` | - | Test id. |
|
|
1279
|
+
| `mode` | `ZoraThemeMode` | - | Optional scoped theme mode override. |
|
|
1280
|
+
| `themeId` | `ZoraThemeId` | - | Optional scoped theme id override. |
|
|
1281
|
+
|
|
1282
|
+
`ActionSheetItem` props:
|
|
1283
|
+
|
|
1284
|
+
| Prop | Type | Default | Notes |
|
|
1285
|
+
| ------------- | ----------------- | ------- | ----------------------------------------- |
|
|
1286
|
+
| `label` | `React.ReactNode` | - | Main action label. |
|
|
1287
|
+
| `description` | `React.ReactNode` | - | Optional secondary text. |
|
|
1288
|
+
| `icon` | `ButtonIconSpec` | - | Convenience icon shortcut. |
|
|
1289
|
+
| `leading` | `React.ReactNode` | - | Custom leading content. Overrides `icon`. |
|
|
1290
|
+
| `trailing` | `React.ReactNode` | - | Custom trailing content. |
|
|
1291
|
+
| `color` | `ZoraColor` | - | Semantic action color. |
|
|
1292
|
+
| `disabled` | `boolean` | `false` | Disables the action. |
|
|
1293
|
+
| `selected` | `boolean` | `false` | Marks the action as selected. |
|
|
1294
|
+
| `onPress` | `() => void` | - | Called when the item is pressed. |
|
|
1295
|
+
| `testID` | `string` | - | Test id. |
|
|
1296
|
+
| `mode` | `ZoraThemeMode` | - | Optional scoped theme mode override. |
|
|
1297
|
+
| `themeId` | `ZoraThemeId` | - | Optional scoped theme id override. |
|
|
1298
|
+
|
|
1299
|
+
Type aliases:
|
|
1300
|
+
|
|
1301
|
+
```ts
|
|
1302
|
+
type DropdownMenuProps = MenuProps;
|
|
1303
|
+
type MenuActionIntent = 'default' | 'danger';
|
|
1304
|
+
```
|
|
1305
|
+
|
|
1306
|
+
Inherited behavior:
|
|
1307
|
+
|
|
1308
|
+
- `Menu` / `DropdownMenu` are backed by Surface `Menu`.
|
|
1309
|
+
- `ActionSheet` / `ActionSheetItem` are backed by Surface `ActionSheet`.
|
|
1310
|
+
- ZORA adds app-facing naming, icon shortcuts, public exports, metadata, and
|
|
1311
|
+
theme scoping.
|
|
1312
|
+
|
|
1313
|
+
</details>
|
|
1314
|
+
|
|
1160
1315
|
### `Tabs`
|
|
1161
1316
|
|
|
1162
1317
|
Generic controlled tabs for navigation and filtering.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionSheet.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMhD,eAAO,MAAM,WAAW,wDAAuC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionSheet as SurfaceActionSheet } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
4
|
+
function ActionSheetInner({ mode: _mode, themeId: _themeId, ...props }) {
|
|
5
|
+
return <SurfaceActionSheet {...props}/>;
|
|
6
|
+
}
|
|
7
|
+
export const ActionSheet = withZoraThemeScope(ActionSheetInner);
|
|
8
|
+
//# sourceMappingURL=ActionSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionSheet.js","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,SAAS,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB;IACtF,OAAO,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["import { ActionSheet as SurfaceActionSheet } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport type { ActionSheetProps } from './types';\n\nfunction ActionSheetInner({ mode: _mode, themeId: _themeId, ...props }: ActionSheetProps) {\n return <SurfaceActionSheet {...props} />;\n}\n\nexport const ActionSheet = withZoraThemeScope(ActionSheetInner);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionSheetItem.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheetItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAwBpD,eAAO,MAAM,eAAe,4DAA2C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionSheetItem as SurfaceActionSheetItem } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { resolveIconSize } from '../../internal/recipes';
|
|
4
|
+
import { useZoraTheme } from '../../theme/useZoraTheme';
|
|
5
|
+
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
function ActionSheetItemInner({ themeId: _themeId, mode: _mode, icon, leading, ...props }) {
|
|
8
|
+
const { theme } = useZoraTheme();
|
|
9
|
+
const resolvedLeading = leading ??
|
|
10
|
+
(icon ? (<Icon color={theme.semantics.content.muted} name={icon.name} provider={icon.provider} size={resolveIconSize('s')}/>) : undefined);
|
|
11
|
+
return <SurfaceActionSheetItem {...props} leading={resolvedLeading}/>;
|
|
12
|
+
}
|
|
13
|
+
export const ActionSheetItem = withZoraThemeScope(ActionSheetItemInner);
|
|
14
|
+
//# sourceMappingURL=ActionSheetItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionSheetItem.js","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheetItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,SAAS,oBAAoB,CAAC,EAC5B,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,IAAI,EACJ,OAAO,EACP,GAAG,KAAK,EACa;IACrB,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,eAAe,GACnB,OAAO;QACP,CAAC,IAAI,CAAC,CAAC,CAAC,CACN,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CACrC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAChB,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CACxB,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,EAC3B,CACH,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEjB,OAAO,CAAC,sBAAsB,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,EAAG,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["import { ActionSheetItem as SurfaceActionSheetItem } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { resolveIconSize } from '../../internal/recipes';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Icon } from '../icon';\nimport type { ActionSheetItemProps } from './types';\n\nfunction ActionSheetItemInner({\n themeId: _themeId,\n mode: _mode,\n icon,\n leading,\n ...props\n}: ActionSheetItemProps) {\n const { theme } = useZoraTheme();\n const resolvedLeading =\n leading ??\n (icon ? (\n <Icon\n color={theme.semantics.content.muted}\n name={icon.name}\n provider={icon.provider}\n size={resolveIconSize('s')}\n />\n ) : undefined);\n\n return <SurfaceActionSheetItem {...props} leading={resolvedLeading} />;\n}\n\nexport const ActionSheetItem = withZoraThemeScope(ActionSheetItemInner);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/action-sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { ActionSheet } from './ActionSheet';\nexport { ActionSheetItem } from './ActionSheetItem';\nexport type { ActionSheetItemProps, ActionSheetProps } from './types';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const actionSheetMeta: {
|
|
2
|
+
readonly name: "ActionSheet";
|
|
3
|
+
readonly category: "component";
|
|
4
|
+
readonly directManifestNode: false;
|
|
5
|
+
readonly allowedChildren: readonly [];
|
|
6
|
+
readonly note: "Surface-backed contextual action sheet; not represented as a manifest node in v1.";
|
|
7
|
+
readonly props: {};
|
|
8
|
+
};
|
|
9
|
+
export declare const actionSheetItemMeta: {
|
|
10
|
+
readonly name: "ActionSheetItem";
|
|
11
|
+
readonly category: "component";
|
|
12
|
+
readonly directManifestNode: false;
|
|
13
|
+
readonly allowedChildren: readonly [];
|
|
14
|
+
readonly note: "Surface-backed contextual action sheet row; not represented as a manifest node in v1.";
|
|
15
|
+
readonly props: {};
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/meta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;CAOU,CAAC;AAEvC,eAAO,MAAM,mBAAmB;;;;;;;CAOM,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const actionSheetMeta = {
|
|
2
|
+
name: 'ActionSheet',
|
|
3
|
+
category: 'component',
|
|
4
|
+
directManifestNode: false,
|
|
5
|
+
allowedChildren: [],
|
|
6
|
+
note: 'Surface-backed contextual action sheet; not represented as a manifest node in v1.',
|
|
7
|
+
props: {},
|
|
8
|
+
};
|
|
9
|
+
export const actionSheetItemMeta = {
|
|
10
|
+
name: 'ActionSheetItem',
|
|
11
|
+
category: 'component',
|
|
12
|
+
directManifestNode: false,
|
|
13
|
+
allowedChildren: [],
|
|
14
|
+
note: 'Surface-backed contextual action sheet row; not represented as a manifest node in v1.',
|
|
15
|
+
props: {},
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/action-sheet/meta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,WAAW;IACrB,kBAAkB,EAAE,KAAK;IACzB,eAAe,EAAE,EAAE;IACnB,IAAI,EAAE,mFAAmF;IACzF,KAAK,EAAE,EAAE;CAC2B,CAAC;AAEvC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,WAAW;IACrB,kBAAkB,EAAE,KAAK;IACzB,eAAe,EAAE,EAAE;IACnB,IAAI,EAAE,uFAAuF;IAC7F,KAAK,EAAE,EAAE;CAC2B,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\n\nexport const actionSheetMeta = {\n name: 'ActionSheet',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Surface-backed contextual action sheet; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const actionSheetItemMeta = {\n name: 'ActionSheetItem',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Surface-backed contextual action sheet row; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActionSheetItemProps as SurfaceActionSheetItemProps, ActionSheetProps as SurfaceActionSheetProps, ButtonIconSpec } from '@ankhorage/surface';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import type { ZoraColor } from '../../internal/recipes';
|
|
4
|
+
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
|
+
export interface ActionSheetProps extends ZoraBaseProps, Omit<SurfaceActionSheetProps, 'children' | 'mode' | 'themeId'> {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface ActionSheetItemProps extends ZoraBaseProps, Omit<SurfaceActionSheetItemProps, 'color' | 'leading' | 'mode' | 'themeId'> {
|
|
9
|
+
color?: ZoraColor;
|
|
10
|
+
icon?: ButtonIconSpec;
|
|
11
|
+
leading?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,IAAI,2BAA2B,EACnD,gBAAgB,IAAI,uBAAuB,EAC3C,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,gBACf,SAAQ,aAAa,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;IACrF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,oBACf,SACE,aAAa,EACb,IAAI,CAAC,2BAA2B,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;IAC7E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/action-sheet/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ActionSheetItemProps as SurfaceActionSheetItemProps,\n ActionSheetProps as SurfaceActionSheetProps,\n ButtonIconSpec,\n} from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraColor } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface ActionSheetProps\n extends ZoraBaseProps, Omit<SurfaceActionSheetProps, 'children' | 'mode' | 'themeId'> {\n children?: React.ReactNode;\n}\n\nexport interface ActionSheetItemProps\n extends\n ZoraBaseProps,\n Omit<SurfaceActionSheetItemProps, 'color' | 'leading' | 'mode' | 'themeId'> {\n color?: ZoraColor;\n icon?: ButtonIconSpec;\n leading?: React.ReactNode;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,KAAK,EAKV,cAAc,EAGf,MAAM,SAAS,CAAC;AA+WjB,eAAO,MAAM,SAAS,GAxCE,IAAI,SAAS,MAAM,2DAwCgB,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView } from 'react-native';
|
|
3
|
+
import { Box, Show, Stack } from '../../foundation';
|
|
4
|
+
import { EmptyState } from '../../patterns/empty-state';
|
|
5
|
+
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
|
+
import { Button } from '../button';
|
|
7
|
+
import { Card } from '../card';
|
|
8
|
+
import { IconButton } from '../icon-button';
|
|
9
|
+
import { DropdownMenu } from '../menu';
|
|
10
|
+
import { SkeletonList } from '../skeleton';
|
|
11
|
+
import { Text } from '../text';
|
|
12
|
+
function resolveTextAlign(align) {
|
|
13
|
+
switch (align) {
|
|
14
|
+
case 'center':
|
|
15
|
+
return 'center';
|
|
16
|
+
case 'end':
|
|
17
|
+
return 'right';
|
|
18
|
+
case 'start':
|
|
19
|
+
default:
|
|
20
|
+
return 'left';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function resolveCellJustify(align) {
|
|
24
|
+
switch (align) {
|
|
25
|
+
case 'center':
|
|
26
|
+
return 'center';
|
|
27
|
+
case 'end':
|
|
28
|
+
return 'flex-end';
|
|
29
|
+
case 'start':
|
|
30
|
+
default:
|
|
31
|
+
return 'flex-start';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function resolveCellStyle(column) {
|
|
35
|
+
return {
|
|
36
|
+
alignItems: resolveCellJustify(column.align),
|
|
37
|
+
flexGrow: column.width === undefined ? 1 : 0,
|
|
38
|
+
flexShrink: 0,
|
|
39
|
+
minWidth: column.minWidth ?? 140,
|
|
40
|
+
width: column.width,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function resolveRowPadding(density) {
|
|
44
|
+
return density === 'compact'
|
|
45
|
+
? { px: 'm', py: 's' }
|
|
46
|
+
: { px: 'm', py: 'm' };
|
|
47
|
+
}
|
|
48
|
+
function resolveAccessorValue(row, column) {
|
|
49
|
+
if (column.accessor === undefined) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return row[column.accessor];
|
|
53
|
+
}
|
|
54
|
+
function renderDefaultCell(value) {
|
|
55
|
+
if (value === null || value === undefined) {
|
|
56
|
+
return '—';
|
|
57
|
+
}
|
|
58
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
59
|
+
return String(value);
|
|
60
|
+
}
|
|
61
|
+
if (typeof value === 'bigint') {
|
|
62
|
+
return value.toString();
|
|
63
|
+
}
|
|
64
|
+
if (value instanceof Date) {
|
|
65
|
+
return value.toLocaleDateString();
|
|
66
|
+
}
|
|
67
|
+
return '—';
|
|
68
|
+
}
|
|
69
|
+
function createCellContext(column, row, rowIndex) {
|
|
70
|
+
return {
|
|
71
|
+
column,
|
|
72
|
+
row,
|
|
73
|
+
rowIndex,
|
|
74
|
+
value: resolveAccessorValue(row, column),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function renderCell(column, row, rowIndex) {
|
|
78
|
+
const context = createCellContext(column, row, rowIndex);
|
|
79
|
+
return column.renderCell ? column.renderCell(context) : renderDefaultCell(context.value);
|
|
80
|
+
}
|
|
81
|
+
function renderTableCell(column, row, rowIndex) {
|
|
82
|
+
if (column.renderCell) {
|
|
83
|
+
return column.renderCell(createCellContext(column, row, rowIndex));
|
|
84
|
+
}
|
|
85
|
+
return (<Text align={resolveTextAlign(column.align)} variant="bodySmall">
|
|
86
|
+
{renderDefaultCell(resolveAccessorValue(row, column))}
|
|
87
|
+
</Text>);
|
|
88
|
+
}
|
|
89
|
+
function resolveNextSortDirection(current) {
|
|
90
|
+
return current === 'asc' ? 'desc' : 'asc';
|
|
91
|
+
}
|
|
92
|
+
function mapRowActions(row, actions) {
|
|
93
|
+
return actions.map((action) => ({
|
|
94
|
+
description: action.description,
|
|
95
|
+
disabled: action.disabled,
|
|
96
|
+
icon: action.icon,
|
|
97
|
+
id: action.id,
|
|
98
|
+
intent: action.intent,
|
|
99
|
+
onPress: action.onPress ? () => action.onPress?.(row) : undefined,
|
|
100
|
+
title: action.title,
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
function renderRowActions({ row, rowIndex, rowActions, testID, }) {
|
|
104
|
+
const actions = rowActions?.(row, rowIndex) ?? [];
|
|
105
|
+
if (actions.length === 0) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return (<DropdownMenu actions={mapRowActions(row, actions)} trigger={<IconButton icon={{ name: 'ellipsis-horizontal' }} label="Row actions" size="s" variant="ghost"/>} testID={testID ? `${testID}-row-actions-${rowIndex}` : undefined}/>);
|
|
109
|
+
}
|
|
110
|
+
function DataTableHeader({ columns, sort, onSortChange, density, }) {
|
|
111
|
+
const padding = resolveRowPadding(density ?? 'comfortable');
|
|
112
|
+
return (<Box bg="subtle" borderColor="border" borderWidth={1} radius="m">
|
|
113
|
+
<Stack direction="row" align="center">
|
|
114
|
+
{columns.map((column) => {
|
|
115
|
+
const currentDirection = sort?.columnId === column.id ? sort.direction : undefined;
|
|
116
|
+
const sortable = Boolean(column.sortable && onSortChange);
|
|
117
|
+
const directionLabel = currentDirection === undefined ? '' : currentDirection === 'asc' ? ' ↑' : ' ↓';
|
|
118
|
+
return (<Box key={column.id} px={padding.px} py={padding.py} style={resolveCellStyle(column)}>
|
|
119
|
+
{sortable ? (<Button color="primary" onPress={() => onSortChange?.({
|
|
120
|
+
columnId: column.id,
|
|
121
|
+
direction: resolveNextSortDirection(currentDirection),
|
|
122
|
+
})} size="s" variant="ghost">
|
|
123
|
+
{column.header}
|
|
124
|
+
{directionLabel}
|
|
125
|
+
</Button>) : (<Text align={resolveTextAlign(column.align)} emphasis="muted" variant="caption" weight="semiBold">
|
|
126
|
+
{column.header}
|
|
127
|
+
</Text>)}
|
|
128
|
+
</Box>);
|
|
129
|
+
})}
|
|
130
|
+
<Box px={padding.px} py={padding.py} style={{ minWidth: 56, width: 56 }}>
|
|
131
|
+
<Text align="right" emphasis="muted" variant="caption" weight="semiBold">
|
|
132
|
+
Actions
|
|
133
|
+
</Text>
|
|
134
|
+
</Box>
|
|
135
|
+
</Stack>
|
|
136
|
+
</Box>);
|
|
137
|
+
}
|
|
138
|
+
function DataTableDesktop({ columns, rows, rowActions, rowId, sort, onSortChange, density, testID, }) {
|
|
139
|
+
const padding = resolveRowPadding(density ?? 'comfortable');
|
|
140
|
+
return (<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
141
|
+
<Box minWidth={720} style={{ width: '100%' }}>
|
|
142
|
+
<Stack gap="xs">
|
|
143
|
+
<DataTableHeader columns={columns} density={density} onSortChange={onSortChange} sort={sort}/>
|
|
144
|
+
<Stack gap="xs">
|
|
145
|
+
{rows.map((row, rowIndex) => (<Box bg="surface" borderColor="border" borderWidth={1} key={rowId(row, rowIndex)} radius="m" testID={testID ? `${testID}-row-${rowIndex}` : undefined}>
|
|
146
|
+
<Stack direction="row" align="center">
|
|
147
|
+
{columns.map((column) => (<Box key={column.id} px={padding.px} py={padding.py} style={resolveCellStyle(column)}>
|
|
148
|
+
{renderTableCell(column, row, rowIndex)}
|
|
149
|
+
</Box>))}
|
|
150
|
+
<Box px={padding.px} py={padding.py} style={{ alignItems: 'flex-end', minWidth: 56, width: 56 }}>
|
|
151
|
+
{renderRowActions({ row, rowActions, rowIndex, testID })}
|
|
152
|
+
</Box>
|
|
153
|
+
</Stack>
|
|
154
|
+
</Box>))}
|
|
155
|
+
</Stack>
|
|
156
|
+
</Stack>
|
|
157
|
+
</Box>
|
|
158
|
+
</ScrollView>);
|
|
159
|
+
}
|
|
160
|
+
function DataTableMobile({ columns, rows, rowActions, rowId, testID, }) {
|
|
161
|
+
const [primaryColumn, ...detailColumns] = columns;
|
|
162
|
+
return (<Stack gap="s">
|
|
163
|
+
{rows.map((row, rowIndex) => {
|
|
164
|
+
const title = primaryColumn
|
|
165
|
+
? renderCell(primaryColumn, row, rowIndex)
|
|
166
|
+
: `Row ${rowIndex + 1}`;
|
|
167
|
+
const actions = renderRowActions({ row, rowActions, rowIndex, testID });
|
|
168
|
+
return (<Card actions={actions} compact key={rowId(row, rowIndex)} testID={testID ? `${testID}-card-${rowIndex}` : undefined} title={title}>
|
|
169
|
+
<Stack gap="s">
|
|
170
|
+
{detailColumns.map((column) => (<Stack gap="xxs" key={column.id}>
|
|
171
|
+
<Text emphasis="muted" variant="caption" weight="semiBold">
|
|
172
|
+
{column.header}
|
|
173
|
+
</Text>
|
|
174
|
+
{column.renderCell ? (renderCell(column, row, rowIndex)) : (<Text variant="bodySmall">
|
|
175
|
+
{renderDefaultCell(resolveAccessorValue(row, column))}
|
|
176
|
+
</Text>)}
|
|
177
|
+
</Stack>))}
|
|
178
|
+
</Stack>
|
|
179
|
+
</Card>);
|
|
180
|
+
})}
|
|
181
|
+
</Stack>);
|
|
182
|
+
}
|
|
183
|
+
function DataTableInner({ themeId: _themeId, mode: _mode, rows, loading = false, loadingRows = 5, emptyTitle = 'No data', emptyDescription = 'There are no rows to display.', testID, density = 'comfortable', ...props }) {
|
|
184
|
+
if (loading) {
|
|
185
|
+
return <SkeletonList rows={loadingRows} variant="card" testID={testID}/>;
|
|
186
|
+
}
|
|
187
|
+
if (rows.length === 0) {
|
|
188
|
+
return <EmptyState title={emptyTitle} description={emptyDescription}/>;
|
|
189
|
+
}
|
|
190
|
+
const tableProps = {
|
|
191
|
+
...props,
|
|
192
|
+
density,
|
|
193
|
+
emptyDescription,
|
|
194
|
+
emptyTitle,
|
|
195
|
+
loading,
|
|
196
|
+
loadingRows,
|
|
197
|
+
rows,
|
|
198
|
+
testID,
|
|
199
|
+
};
|
|
200
|
+
return (<Box testID={testID}>
|
|
201
|
+
<Show when={{ base: false, md: true }} fallback={<DataTableMobile {...tableProps}/>}>
|
|
202
|
+
<DataTableDesktop {...tableProps}/>
|
|
203
|
+
</Show>
|
|
204
|
+
</Box>);
|
|
205
|
+
}
|
|
206
|
+
export const DataTable = withZoraThemeScope(DataTableInner);
|
|
207
|
+
//# sourceMappingURL=DataTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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C,WAAW,CAAC,CAAC,gBAAgB,CAAC,EAAG,CAAC;IAC1E,CAAC;IAED,MAAM,UAAU,GAAyB;QACvC,GAAG,KAAK;QACR,OAAO;QACP,gBAAgB;QAChB,UAAU;QACV,OAAO;QACP,WAAW;QACX,IAAI;QACJ,MAAM;KACP,CAAC;IAEF,OAAO,CACL,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAClB;MAAA,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAG,CAAC,CACnF;QAAA,CAAC,gBAAgB,CAAC,IAAI,UAAU,CAAC,EACnC;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { ScrollView, type ViewStyle } from 'react-native';\n\nimport { Box, Show, Stack } from '../../foundation';\nimport { EmptyState } from '../../patterns/empty-state';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Button } from '../button';\nimport { Card } from '../card';\nimport { IconButton } from '../icon-button';\nimport { DropdownMenu, type MenuAction } from '../menu';\nimport { SkeletonList } from '../skeleton';\nimport { Text, type TextAlign } from '../text';\nimport type {\n DataTableCellContext,\n DataTableColumn,\n DataTableColumnAlign,\n DataTableDensity,\n DataTableProps,\n DataTableRowAction,\n DataTableSortDirection,\n} from './types';\n\nfunction resolveTextAlign(align: DataTableColumnAlign | undefined): TextAlign {\n switch (align) {\n case 'center':\n return 'center';\n case 'end':\n return 'right';\n case 'start':\n default:\n return 'left';\n }\n}\n\nfunction resolveCellJustify(align: DataTableColumnAlign | undefined): ViewStyle['alignItems'] {\n switch (align) {\n case 'center':\n return 'center';\n case 'end':\n return 'flex-end';\n case 'start':\n default:\n return 'flex-start';\n }\n}\n\nfunction resolveCellStyle<TRow extends object>(column: DataTableColumn<TRow>): ViewStyle {\n return {\n alignItems: resolveCellJustify(column.align),\n flexGrow: column.width === undefined ? 1 : 0,\n flexShrink: 0,\n minWidth: column.minWidth ?? 140,\n width: column.width,\n };\n}\n\nfunction resolveRowPadding(density: DataTableDensity) {\n return density === 'compact'\n ? { px: 'm' as const, py: 's' as const }\n : { px: 'm' as const, py: 'm' as const };\n}\n\nfunction resolveAccessorValue<TRow extends object>(row: TRow, column: DataTableColumn<TRow>) {\n if (column.accessor === undefined) {\n return undefined;\n }\n\n return row[column.accessor];\n}\n\nfunction renderDefaultCell(value: unknown): React.ReactNode {\n if (value === null || value === undefined) {\n return '—';\n }\n\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n\n if (typeof value === 'bigint') {\n return value.toString();\n }\n\n if (value instanceof Date) {\n return value.toLocaleDateString();\n }\n\n return '—';\n}\n\nfunction createCellContext<TRow extends object>(\n column: DataTableColumn<TRow>,\n row: TRow,\n rowIndex: number,\n): DataTableCellContext<TRow> {\n return {\n column,\n row,\n rowIndex,\n value: resolveAccessorValue(row, column),\n };\n}\n\nfunction renderCell<TRow extends object>(\n column: DataTableColumn<TRow>,\n row: TRow,\n rowIndex: number,\n) {\n const context = createCellContext(column, row, rowIndex);\n return column.renderCell ? column.renderCell(context) : renderDefaultCell(context.value);\n}\n\nfunction renderTableCell<TRow extends object>(\n column: DataTableColumn<TRow>,\n row: TRow,\n rowIndex: number,\n) {\n if (column.renderCell) {\n return column.renderCell(createCellContext(column, row, rowIndex));\n }\n\n return (\n <Text align={resolveTextAlign(column.align)} variant=\"bodySmall\">\n {renderDefaultCell(resolveAccessorValue(row, column))}\n </Text>\n );\n}\n\nfunction resolveNextSortDirection(\n current: DataTableSortDirection | undefined,\n): DataTableSortDirection {\n return current === 'asc' ? 'desc' : 'asc';\n}\n\nfunction mapRowActions<TRow extends object>(\n row: TRow,\n actions: readonly DataTableRowAction<TRow>[],\n): readonly MenuAction[] {\n return actions.map((action) => ({\n description: action.description,\n disabled: action.disabled,\n icon: action.icon,\n id: action.id,\n intent: action.intent,\n onPress: action.onPress ? () => action.onPress?.(row) : undefined,\n title: action.title,\n }));\n}\n\nfunction renderRowActions<TRow extends object>({\n row,\n rowIndex,\n rowActions,\n testID,\n}: {\n row: TRow;\n rowIndex: number;\n rowActions: DataTableProps<TRow>['rowActions'];\n testID?: string;\n}) {\n const actions = rowActions?.(row, rowIndex) ?? [];\n\n if (actions.length === 0) {\n return null;\n }\n\n return (\n <DropdownMenu\n actions={mapRowActions(row, actions)}\n trigger={\n <IconButton\n icon={{ name: 'ellipsis-horizontal' }}\n label=\"Row actions\"\n size=\"s\"\n variant=\"ghost\"\n />\n }\n testID={testID ? `${testID}-row-actions-${rowIndex}` : undefined}\n />\n );\n}\n\nfunction DataTableHeader<TRow extends object>({\n columns,\n sort,\n onSortChange,\n density,\n}: Pick<DataTableProps<TRow>, 'columns' | 'density' | 'onSortChange' | 'sort'>) {\n const padding = resolveRowPadding(density ?? 'comfortable');\n\n return (\n <Box bg=\"subtle\" borderColor=\"border\" borderWidth={1} radius=\"m\">\n <Stack direction=\"row\" align=\"center\">\n {columns.map((column) => {\n const currentDirection = sort?.columnId === column.id ? sort.direction : undefined;\n const sortable = Boolean(column.sortable && onSortChange);\n const directionLabel =\n currentDirection === undefined ? '' : currentDirection === 'asc' ? ' ↑' : ' ↓';\n\n return (\n <Box key={column.id} px={padding.px} py={padding.py} style={resolveCellStyle(column)}>\n {sortable ? (\n <Button\n color=\"primary\"\n onPress={() =>\n onSortChange?.({\n columnId: column.id,\n direction: resolveNextSortDirection(currentDirection),\n })\n }\n size=\"s\"\n variant=\"ghost\"\n >\n {column.header}\n {directionLabel}\n </Button>\n ) : (\n <Text\n align={resolveTextAlign(column.align)}\n emphasis=\"muted\"\n variant=\"caption\"\n weight=\"semiBold\"\n >\n {column.header}\n </Text>\n )}\n </Box>\n );\n })}\n <Box px={padding.px} py={padding.py} style={{ minWidth: 56, width: 56 }}>\n <Text align=\"right\" emphasis=\"muted\" variant=\"caption\" weight=\"semiBold\">\n Actions\n </Text>\n </Box>\n </Stack>\n </Box>\n );\n}\n\nfunction DataTableDesktop<TRow extends object>({\n columns,\n rows,\n rowActions,\n rowId,\n sort,\n onSortChange,\n density,\n testID,\n}: DataTableProps<TRow>) {\n const padding = resolveRowPadding(density ?? 'comfortable');\n\n return (\n <ScrollView horizontal showsHorizontalScrollIndicator={false}>\n <Box minWidth={720} style={{ width: '100%' }}>\n <Stack gap=\"xs\">\n <DataTableHeader\n columns={columns}\n density={density}\n onSortChange={onSortChange}\n sort={sort}\n />\n <Stack gap=\"xs\">\n {rows.map((row, rowIndex) => (\n <Box\n bg=\"surface\"\n borderColor=\"border\"\n borderWidth={1}\n key={rowId(row, rowIndex)}\n radius=\"m\"\n testID={testID ? `${testID}-row-${rowIndex}` : undefined}\n >\n <Stack direction=\"row\" align=\"center\">\n {columns.map((column) => (\n <Box\n key={column.id}\n px={padding.px}\n py={padding.py}\n style={resolveCellStyle(column)}\n >\n {renderTableCell(column, row, rowIndex)}\n </Box>\n ))}\n <Box\n px={padding.px}\n py={padding.py}\n style={{ alignItems: 'flex-end', minWidth: 56, width: 56 }}\n >\n {renderRowActions({ row, rowActions, rowIndex, testID })}\n </Box>\n </Stack>\n </Box>\n ))}\n </Stack>\n </Stack>\n </Box>\n </ScrollView>\n );\n}\n\nfunction DataTableMobile<TRow extends object>({\n columns,\n rows,\n rowActions,\n rowId,\n testID,\n}: DataTableProps<TRow>) {\n const [primaryColumn, ...detailColumns] = columns;\n\n return (\n <Stack gap=\"s\">\n {rows.map((row, rowIndex) => {\n const title = primaryColumn\n ? renderCell(primaryColumn, row, rowIndex)\n : `Row ${rowIndex + 1}`;\n const actions = renderRowActions({ row, rowActions, rowIndex, testID });\n\n return (\n <Card\n actions={actions}\n compact\n key={rowId(row, rowIndex)}\n testID={testID ? `${testID}-card-${rowIndex}` : undefined}\n title={title}\n >\n <Stack gap=\"s\">\n {detailColumns.map((column) => (\n <Stack gap=\"xxs\" key={column.id}>\n <Text emphasis=\"muted\" variant=\"caption\" weight=\"semiBold\">\n {column.header}\n </Text>\n {column.renderCell ? (\n renderCell(column, row, rowIndex)\n ) : (\n <Text variant=\"bodySmall\">\n {renderDefaultCell(resolveAccessorValue(row, column))}\n </Text>\n )}\n </Stack>\n ))}\n </Stack>\n </Card>\n );\n })}\n </Stack>\n );\n}\n\nfunction DataTableInner<TRow extends object>({\n themeId: _themeId,\n mode: _mode,\n rows,\n loading = false,\n loadingRows = 5,\n emptyTitle = 'No data',\n emptyDescription = 'There are no rows to display.',\n testID,\n density = 'comfortable',\n ...props\n}: DataTableProps<TRow>) {\n if (loading) {\n return <SkeletonList rows={loadingRows} variant=\"card\" testID={testID} />;\n }\n\n if (rows.length === 0) {\n return <EmptyState title={emptyTitle} description={emptyDescription} />;\n }\n\n const tableProps: DataTableProps<TRow> = {\n ...props,\n density,\n emptyDescription,\n emptyTitle,\n loading,\n loadingRows,\n rows,\n testID,\n };\n\n return (\n <Box testID={testID}>\n <Show when={{ base: false, md: true }} fallback={<DataTableMobile {...tableProps} />}>\n <DataTableDesktop {...tableProps} />\n </Show>\n </Box>\n );\n}\n\nexport const DataTable = withZoraThemeScope(DataTableInner);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/data-table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { DataTable } from './DataTable';\nexport type {\n DataTableCellContext,\n DataTableColumn,\n DataTableColumnAlign,\n DataTableDensity,\n DataTableProps,\n DataTableRowAction,\n DataTableSortDirection,\n DataTableSortState,\n} from './types';\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const dataTableMeta: {
|
|
2
|
+
readonly name: "DataTable";
|
|
3
|
+
readonly category: "component";
|
|
4
|
+
readonly directManifestNode: false;
|
|
5
|
+
readonly allowedChildren: readonly [];
|
|
6
|
+
readonly note: "Code-facing typed data table component; not represented as a manifest node in v1.";
|
|
7
|
+
readonly props: {};
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=meta.d.ts.map
|