@bacon-pos/ui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Alert/Alert.js +137 -0
- package/lib/commonjs/components/Alert/Alert.js.map +1 -0
- package/lib/commonjs/components/Alert/Alert.stories.js +104 -0
- package/lib/commonjs/components/Alert/Alert.stories.js.map +1 -0
- package/lib/commonjs/components/Alert/Alert.test.js +62 -0
- package/lib/commonjs/components/Alert/Alert.test.js.map +1 -0
- package/lib/commonjs/components/Alert/index.js +13 -0
- package/lib/commonjs/components/Alert/index.js.map +1 -0
- package/lib/commonjs/components/EmptyState/EmptyState.js +88 -0
- package/lib/commonjs/components/EmptyState/EmptyState.js.map +1 -0
- package/lib/commonjs/components/EmptyState/EmptyState.stories.js +46 -0
- package/lib/commonjs/components/EmptyState/EmptyState.stories.js.map +1 -0
- package/lib/commonjs/components/EmptyState/EmptyState.test.js +40 -0
- package/lib/commonjs/components/EmptyState/EmptyState.test.js.map +1 -0
- package/lib/commonjs/components/EmptyState/index.js +13 -0
- package/lib/commonjs/components/EmptyState/index.js.map +1 -0
- package/lib/commonjs/components/Sidebar/Sidebar.js +264 -0
- package/lib/commonjs/components/Sidebar/Sidebar.js.map +1 -0
- package/lib/commonjs/components/Sidebar/Sidebar.stories.js +229 -0
- package/lib/commonjs/components/Sidebar/Sidebar.stories.js.map +1 -0
- package/lib/commonjs/components/Sidebar/Sidebar.test.js +131 -0
- package/lib/commonjs/components/Sidebar/Sidebar.test.js.map +1 -0
- package/lib/commonjs/components/Sidebar/index.js +13 -0
- package/lib/commonjs/components/Sidebar/index.js.map +1 -0
- package/lib/commonjs/components/StatTile/StatTile.js +94 -0
- package/lib/commonjs/components/StatTile/StatTile.js.map +1 -0
- package/lib/commonjs/components/StatTile/StatTile.stories.js +100 -0
- package/lib/commonjs/components/StatTile/StatTile.stories.js.map +1 -0
- package/lib/commonjs/components/StatTile/StatTile.test.js +49 -0
- package/lib/commonjs/components/StatTile/StatTile.test.js.map +1 -0
- package/lib/commonjs/components/StatTile/index.js +13 -0
- package/lib/commonjs/components/StatTile/index.js.map +1 -0
- package/lib/commonjs/components/Table/DataTable.js +149 -0
- package/lib/commonjs/components/Table/DataTable.js.map +1 -0
- package/lib/commonjs/components/Table/DataTable.stories.js +214 -0
- package/lib/commonjs/components/Table/DataTable.stories.js.map +1 -0
- package/lib/commonjs/components/Table/DataTable.test.js +143 -0
- package/lib/commonjs/components/Table/DataTable.test.js.map +1 -0
- package/lib/commonjs/components/Table/Table.js +520 -0
- package/lib/commonjs/components/Table/Table.js.map +1 -0
- package/lib/commonjs/components/Table/Table.stories.js +385 -0
- package/lib/commonjs/components/Table/Table.stories.js.map +1 -0
- package/lib/commonjs/components/Table/Table.test.js +278 -0
- package/lib/commonjs/components/Table/Table.test.js.map +1 -0
- package/lib/commonjs/components/Table/index.js +20 -0
- package/lib/commonjs/components/Table/index.js.map +1 -0
- package/lib/commonjs/components/brand/BaconLogo.js +29 -0
- package/lib/commonjs/components/brand/BaconLogo.js.map +1 -0
- package/lib/commonjs/components/brand/index.js +7 -0
- package/lib/commonjs/components/brand/index.js.map +1 -1
- package/lib/commonjs/components/index.js +83 -28
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/module/components/Alert/Alert.js +133 -0
- package/lib/module/components/Alert/Alert.js.map +1 -0
- package/lib/module/components/Alert/Alert.stories.js +100 -0
- package/lib/module/components/Alert/Alert.stories.js.map +1 -0
- package/lib/module/components/Alert/Alert.test.js +62 -0
- package/lib/module/components/Alert/Alert.test.js.map +1 -0
- package/lib/module/components/Alert/index.js +4 -0
- package/lib/module/components/Alert/index.js.map +1 -0
- package/lib/module/components/EmptyState/EmptyState.js +84 -0
- package/lib/module/components/EmptyState/EmptyState.js.map +1 -0
- package/lib/module/components/EmptyState/EmptyState.stories.js +42 -0
- package/lib/module/components/EmptyState/EmptyState.stories.js.map +1 -0
- package/lib/module/components/EmptyState/EmptyState.test.js +40 -0
- package/lib/module/components/EmptyState/EmptyState.test.js.map +1 -0
- package/lib/module/components/EmptyState/index.js +4 -0
- package/lib/module/components/EmptyState/index.js.map +1 -0
- package/lib/module/components/Sidebar/Sidebar.js +260 -0
- package/lib/module/components/Sidebar/Sidebar.js.map +1 -0
- package/lib/module/components/Sidebar/Sidebar.stories.js +225 -0
- package/lib/module/components/Sidebar/Sidebar.stories.js.map +1 -0
- package/lib/module/components/Sidebar/Sidebar.test.js +131 -0
- package/lib/module/components/Sidebar/Sidebar.test.js.map +1 -0
- package/lib/module/components/Sidebar/index.js +4 -0
- package/lib/module/components/Sidebar/index.js.map +1 -0
- package/lib/module/components/StatTile/StatTile.js +90 -0
- package/lib/module/components/StatTile/StatTile.js.map +1 -0
- package/lib/module/components/StatTile/StatTile.stories.js +96 -0
- package/lib/module/components/StatTile/StatTile.stories.js.map +1 -0
- package/lib/module/components/StatTile/StatTile.test.js +49 -0
- package/lib/module/components/StatTile/StatTile.test.js.map +1 -0
- package/lib/module/components/StatTile/index.js +4 -0
- package/lib/module/components/StatTile/index.js.map +1 -0
- package/lib/module/components/Table/DataTable.js +145 -0
- package/lib/module/components/Table/DataTable.js.map +1 -0
- package/lib/module/components/Table/DataTable.stories.js +210 -0
- package/lib/module/components/Table/DataTable.stories.js.map +1 -0
- package/lib/module/components/Table/DataTable.test.js +143 -0
- package/lib/module/components/Table/DataTable.test.js.map +1 -0
- package/lib/module/components/Table/Table.js +516 -0
- package/lib/module/components/Table/Table.js.map +1 -0
- package/lib/module/components/Table/Table.stories.js +381 -0
- package/lib/module/components/Table/Table.stories.js.map +1 -0
- package/lib/module/components/Table/Table.test.js +278 -0
- package/lib/module/components/Table/Table.test.js.map +1 -0
- package/lib/module/components/Table/index.js +5 -0
- package/lib/module/components/Table/index.js.map +1 -0
- package/lib/module/components/brand/BaconLogo.js +25 -0
- package/lib/module/components/brand/BaconLogo.js.map +1 -0
- package/lib/module/components/brand/index.js +1 -0
- package/lib/module/components/brand/index.js.map +1 -1
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/typescript/commonjs/components/Alert/Alert.d.ts +41 -0
- package/lib/typescript/commonjs/components/Alert/Alert.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Alert/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Alert/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/EmptyState/EmptyState.d.ts +30 -0
- package/lib/typescript/commonjs/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/EmptyState/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/EmptyState/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Sidebar/Sidebar.d.ts +57 -0
- package/lib/typescript/commonjs/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Sidebar/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Sidebar/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/StatTile/StatTile.d.ts +31 -0
- package/lib/typescript/commonjs/components/StatTile/StatTile.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/StatTile/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/StatTile/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Table/DataTable.d.ts +53 -0
- package/lib/typescript/commonjs/components/Table/DataTable.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Table/Table.d.ts +85 -0
- package/lib/typescript/commonjs/components/Table/Table.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Table/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/Table/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/BaconLogo.d.ts +13 -0
- package/lib/typescript/commonjs/components/brand/BaconLogo.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/index.d.ts +1 -0
- package/lib/typescript/commonjs/components/brand/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/index.d.ts.map +1 -1
- package/lib/typescript/module/components/Alert/Alert.d.ts +41 -0
- package/lib/typescript/module/components/Alert/Alert.d.ts.map +1 -0
- package/lib/typescript/module/components/Alert/index.d.ts +3 -0
- package/lib/typescript/module/components/Alert/index.d.ts.map +1 -0
- package/lib/typescript/module/components/EmptyState/EmptyState.d.ts +30 -0
- package/lib/typescript/module/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/typescript/module/components/EmptyState/index.d.ts +3 -0
- package/lib/typescript/module/components/EmptyState/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Sidebar/Sidebar.d.ts +57 -0
- package/lib/typescript/module/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/lib/typescript/module/components/Sidebar/index.d.ts +3 -0
- package/lib/typescript/module/components/Sidebar/index.d.ts.map +1 -0
- package/lib/typescript/module/components/StatTile/StatTile.d.ts +31 -0
- package/lib/typescript/module/components/StatTile/StatTile.d.ts.map +1 -0
- package/lib/typescript/module/components/StatTile/index.d.ts +3 -0
- package/lib/typescript/module/components/StatTile/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Table/DataTable.d.ts +53 -0
- package/lib/typescript/module/components/Table/DataTable.d.ts.map +1 -0
- package/lib/typescript/module/components/Table/Table.d.ts +85 -0
- package/lib/typescript/module/components/Table/Table.d.ts.map +1 -0
- package/lib/typescript/module/components/Table/index.d.ts +5 -0
- package/lib/typescript/module/components/Table/index.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/BaconLogo.d.ts +13 -0
- package/lib/typescript/module/components/brand/BaconLogo.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/index.d.ts +1 -0
- package/lib/typescript/module/components/brand/index.d.ts.map +1 -1
- package/lib/typescript/module/components/index.d.ts +5 -0
- package/lib/typescript/module/components/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Alert/Alert.tsx +132 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/EmptyState/EmptyState.tsx +91 -0
- package/src/components/EmptyState/index.ts +2 -0
- package/src/components/Sidebar/Sidebar.tsx +320 -0
- package/src/components/Sidebar/index.ts +2 -0
- package/src/components/StatTile/StatTile.tsx +98 -0
- package/src/components/StatTile/index.ts +2 -0
- package/src/components/Table/DataTable.tsx +173 -0
- package/src/components/Table/Table.tsx +556 -0
- package/src/components/Table/index.ts +10 -0
- package/src/components/brand/BaconLogo.tsx +25 -0
- package/src/components/brand/index.ts +1 -0
- package/src/components/index.ts +5 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { type ButtonVariant } from '../Button/Button';
|
|
3
|
+
import type { IconName } from '../Icon/icons.generated';
|
|
4
|
+
export interface EmptyStateAction {
|
|
5
|
+
label: string;
|
|
6
|
+
onPress: () => void;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
}
|
|
10
|
+
export interface EmptyStateProps {
|
|
11
|
+
/** Icon shown in the badge above the title. */
|
|
12
|
+
icon?: IconName;
|
|
13
|
+
/** Title line. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Supporting description below the title. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Optional call-to-action button. */
|
|
18
|
+
action?: EmptyStateAction;
|
|
19
|
+
/** Vertical padding around the block. Defaults to 32. */
|
|
20
|
+
paddingVertical?: number;
|
|
21
|
+
/** Override the container style. */
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Empty state — a centered icon, title, description and optional action button.
|
|
26
|
+
* Used by `Table`/`DataTable` when there's no data, and reusable anywhere a
|
|
27
|
+
* "nothing here yet" message is needed.
|
|
28
|
+
*/
|
|
29
|
+
export declare function EmptyState({ icon, title, description, action, paddingVertical, style, }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=EmptyState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../../../../src/components/EmptyState/EmptyState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAiB,EACjB,KAAK,EACL,WAAW,EACX,MAAM,EACN,eAAoB,EACpB,KAAK,GACN,EAAE,eAAe,2CAiDjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/EmptyState/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { IconName } from '../Icon/icons.generated';
|
|
4
|
+
export interface SidebarItem {
|
|
5
|
+
/** Stable key; also the active identifier. */
|
|
6
|
+
key: string;
|
|
7
|
+
/** Button text (hidden when collapsed). */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Leading icon. When omitted, expanded reserves the icon space and collapsed shows the label's initial. */
|
|
10
|
+
icon?: IconName;
|
|
11
|
+
/** Optional icon shown when the item is active (e.g. a filled variant). */
|
|
12
|
+
activeIcon?: IconName;
|
|
13
|
+
/** Press handler. */
|
|
14
|
+
onPress?: () => void;
|
|
15
|
+
/** Dim and block the item. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SidebarProps {
|
|
19
|
+
/** Navigation items — rendered top-to-bottom. Defaults to none. */
|
|
20
|
+
items?: SidebarItem[];
|
|
21
|
+
/** Active item key (controlled). */
|
|
22
|
+
activeKey?: string;
|
|
23
|
+
/** Active item key for the uncontrolled case. */
|
|
24
|
+
defaultActiveKey?: string;
|
|
25
|
+
/** Called with the pressed item's key. */
|
|
26
|
+
onChange?: (key: string) => void;
|
|
27
|
+
/** Collapsed (icons only) state — controlled. */
|
|
28
|
+
collapsed?: boolean;
|
|
29
|
+
/** Initial collapsed state (uncontrolled). Defaults to false. */
|
|
30
|
+
defaultCollapsed?: boolean;
|
|
31
|
+
/** Called when the collapse state changes. */
|
|
32
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
33
|
+
/** Show the built-in expand/collapse toggle. Defaults to true. */
|
|
34
|
+
showToggle?: boolean;
|
|
35
|
+
/** Logo shown at the top. Defaults to the Bacon mark. */
|
|
36
|
+
logo?: ReactNode;
|
|
37
|
+
/** Bottom supporting text (e.g. a version). Defaults to none. */
|
|
38
|
+
footer?: string;
|
|
39
|
+
/** Expanded width. Defaults to 284 (Figma). */
|
|
40
|
+
expandedWidth?: number;
|
|
41
|
+
/** Collapsed width. Defaults to 122 (Figma). */
|
|
42
|
+
collapsedWidth?: number;
|
|
43
|
+
/** Scroll indicator color. Defaults to a subtle neutral. */
|
|
44
|
+
scrollbarColor?: string;
|
|
45
|
+
/** Override the container style. */
|
|
46
|
+
style?: StyleProp<ViewStyle>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Sidebar — the app's main navigation drawer (Figma "Sidebar"). Expands/collapses
|
|
50
|
+
* between a labelled and an icon-only rail (animated width). The logo defaults to
|
|
51
|
+
* the Bacon mark (override via `logo`); an optional `footer` shows supporting text
|
|
52
|
+
* at the bottom. Items are dynamic buttons (icon + label via props); the list
|
|
53
|
+
* scrolls with an elegant auto-hiding indicator when it overflows, leaving the
|
|
54
|
+
* footer pinned. Buttons have hover and active states to mark the current section.
|
|
55
|
+
*/
|
|
56
|
+
export declare function Sidebar({ items, activeKey, defaultActiveKey, onChange, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, showToggle, logo, footer, expandedWidth, collapsedWidth, scrollbarColor, style, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
//# sourceMappingURL=Sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4GAA4G;IAC5G,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,QAAQ,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,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { IconName } from '../Icon/icons.generated';
|
|
4
|
+
export interface StatTileProps {
|
|
5
|
+
/** Small label above the value. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The value — a string/number, or a node for custom formatting/color. */
|
|
8
|
+
value: ReactNode;
|
|
9
|
+
/** Optional leading icon. */
|
|
10
|
+
icon?: IconName;
|
|
11
|
+
/** Fixed width. Omit to fill the parent (works in a flex/grid row of tiles). */
|
|
12
|
+
width?: number;
|
|
13
|
+
/** Make the tile pressable. */
|
|
14
|
+
onPress?: () => void;
|
|
15
|
+
/** Tile background. Defaults to `background.subtle`. */
|
|
16
|
+
backgroundColor?: string;
|
|
17
|
+
/** Label color. Defaults to `secondary`. */
|
|
18
|
+
labelColor?: string;
|
|
19
|
+
/** Value color (when `value` is text). Defaults to `primary`. */
|
|
20
|
+
valueColor?: string;
|
|
21
|
+
/** Override the container style. */
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
accessibilityLabel?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* StatTile — a compact KPI card: a small label over a prominent value (Figma
|
|
27
|
+
* "info card"). Fills its parent by default (so a row/grid of tiles sizes evenly)
|
|
28
|
+
* or takes a fixed `width`. `value` accepts a node for custom color/formatting.
|
|
29
|
+
*/
|
|
30
|
+
export declare function StatTile({ label, value, icon, width, onPress, backgroundColor, labelColor, valueColor, style, accessibilityLabel, }: StatTileProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=StatTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatTile.d.ts","sourceRoot":"","sources":["../../../../../src/components/StatTile/StatTile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,KAAK,EAAE,SAAS,CAAC;IACjB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,UAAU,EACV,KAAK,EACL,kBAAkB,GACnB,EAAE,aAAa,2CAoDf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/StatTile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { type EmptyStateProps } from '../EmptyState/EmptyState';
|
|
3
|
+
import type { IconName } from '../Icon/icons.generated';
|
|
4
|
+
import { type TableProps } from './Table';
|
|
5
|
+
export interface DataTableTab {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: IconName;
|
|
9
|
+
}
|
|
10
|
+
export interface DataTablePagination {
|
|
11
|
+
/** 1-based current page. */
|
|
12
|
+
page: number;
|
|
13
|
+
pageSize: number;
|
|
14
|
+
/** Total row count (across pages). */
|
|
15
|
+
total: number;
|
|
16
|
+
onPageChange: (page: number) => void;
|
|
17
|
+
/** Customize the range label. Defaults to `${from}–${to} of ${total}`. */
|
|
18
|
+
formatRange?: (from: number, to: number, total: number) => string;
|
|
19
|
+
}
|
|
20
|
+
export interface DataTableProps<T> extends Omit<TableProps<T>, 'empty'> {
|
|
21
|
+
/** Tabs above the toolbar (reuses `ChipGroup`). */
|
|
22
|
+
tabs?: DataTableTab[];
|
|
23
|
+
/** Active tab (controlled). */
|
|
24
|
+
activeTab?: string;
|
|
25
|
+
defaultTab?: string;
|
|
26
|
+
onTabChange?: (value: string) => void;
|
|
27
|
+
/** Show the search field. */
|
|
28
|
+
searchable?: boolean;
|
|
29
|
+
searchValue?: string;
|
|
30
|
+
onSearchChange?: (value: string) => void;
|
|
31
|
+
searchPlaceholder?: string;
|
|
32
|
+
/** Show a create button on the right of the toolbar. */
|
|
33
|
+
createLabel?: string;
|
|
34
|
+
onCreate?: () => void;
|
|
35
|
+
createIcon?: IconName;
|
|
36
|
+
/** Structured empty state (alternative to Table's `empty` node). */
|
|
37
|
+
emptyState?: EmptyStateProps;
|
|
38
|
+
/** Raw empty node (wins over `emptyState`). */
|
|
39
|
+
empty?: React.ReactNode;
|
|
40
|
+
/** Pagination controls below the table. */
|
|
41
|
+
pagination?: DataTablePagination;
|
|
42
|
+
/** Gap between toolbar sections. Defaults to 16. */
|
|
43
|
+
gap?: number;
|
|
44
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* DataTable — the turnkey management table (Figma): optional tabs (`ChipGroup`),
|
|
48
|
+
* a search + create toolbar, the `Table` body, a structured `EmptyState`, and
|
|
49
|
+
* optional pagination — assembled with consistent spacing. For bespoke layouts,
|
|
50
|
+
* compose `Table` + `EmptyState` yourself.
|
|
51
|
+
*/
|
|
52
|
+
export declare function DataTable<T>({ tabs, activeTab, defaultTab, onTabChange, searchable, searchValue, onSearchChange, searchPlaceholder, createLabel, onCreate, createIcon, emptyState, empty, pagination, gap, containerStyle, ...tableProps }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
//# sourceMappingURL=DataTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/DataTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,M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B,WAAW,EACX,QAAQ,EACR,UAAmB,EACnB,UAAU,EACV,KAAK,EACL,UAAU,EACV,GAAQ,EACR,cAAc,EACd,GAAG,UAAU,EACd,EAAE,cAAc,CAAC,CAAC,CAAC,2CAwDnB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
export type ColumnAlign = 'left' | 'center' | 'right';
|
|
4
|
+
export type SortDirection = 'asc' | 'desc';
|
|
5
|
+
export interface TableSort {
|
|
6
|
+
key: string;
|
|
7
|
+
direction: SortDirection;
|
|
8
|
+
}
|
|
9
|
+
export interface TableColumn<T> {
|
|
10
|
+
/** Unique column id. */
|
|
11
|
+
key: string;
|
|
12
|
+
/** Header content (string or node). */
|
|
13
|
+
header: ReactNode;
|
|
14
|
+
/** Cell renderer. Defaults to `String(row[key])`. Return a string/number or any node (e.g. a `Badge`). */
|
|
15
|
+
render?: (row: T, index: number) => ReactNode;
|
|
16
|
+
/** Flex grow. Defaults to 1. Ignored when `width` is set. */
|
|
17
|
+
flex?: number;
|
|
18
|
+
/** Fixed column width in px. */
|
|
19
|
+
width?: number;
|
|
20
|
+
/** Text/content alignment. Defaults to `left`. */
|
|
21
|
+
align?: ColumnAlign;
|
|
22
|
+
/** Enable sorting on this column (needs `sortAccessor`). */
|
|
23
|
+
sortable?: boolean;
|
|
24
|
+
/** Value used to sort this column when sorting internally. */
|
|
25
|
+
sortAccessor?: (row: T) => string | number;
|
|
26
|
+
}
|
|
27
|
+
export interface TableProps<T> {
|
|
28
|
+
columns: TableColumn<T>[];
|
|
29
|
+
data: T[];
|
|
30
|
+
/** Stable key per row. */
|
|
31
|
+
keyExtractor: (row: T, index: number) => string;
|
|
32
|
+
/** Row press (non-expandable tables). Expandable rows toggle on press instead. */
|
|
33
|
+
onRowPress?: (row: T, index: number) => void;
|
|
34
|
+
/** Expandable (accordion) rows — mutually exclusive with `renderActions`. */
|
|
35
|
+
expandable?: boolean;
|
|
36
|
+
/** Content shown when a row is expanded. */
|
|
37
|
+
renderExpanded?: (row: T, index: number) => ReactNode;
|
|
38
|
+
/** One open row at a time (`single`) or many (`multiple`). Defaults to `single`. */
|
|
39
|
+
expansionMode?: 'single' | 'multiple';
|
|
40
|
+
/** Controlled expanded row keys. */
|
|
41
|
+
expandedKeys?: string[];
|
|
42
|
+
defaultExpandedKeys?: string[];
|
|
43
|
+
onExpandedChange?: (keys: string[]) => void;
|
|
44
|
+
/** Trailing per-row actions (e.g. edit/delete) — mutually exclusive with `expandable`. */
|
|
45
|
+
renderActions?: (row: T, index: number) => ReactNode;
|
|
46
|
+
/** Width reserved for the actions column. Defaults to 96. */
|
|
47
|
+
actionsWidth?: number;
|
|
48
|
+
/** Row selection via checkboxes. */
|
|
49
|
+
selectable?: boolean;
|
|
50
|
+
selectedKeys?: string[];
|
|
51
|
+
defaultSelectedKeys?: string[];
|
|
52
|
+
onSelectionChange?: (keys: string[]) => void;
|
|
53
|
+
/** Controlled sort. Omit for internal sorting via each column's `sortAccessor`. */
|
|
54
|
+
sort?: TableSort;
|
|
55
|
+
defaultSort?: TableSort;
|
|
56
|
+
onSortChange?: (sort: TableSort) => void;
|
|
57
|
+
/** Rounded, clipped container. Defaults to true. */
|
|
58
|
+
rounded?: boolean;
|
|
59
|
+
/** Cap the body height; rows scroll with the elegant indicator, header stays. */
|
|
60
|
+
maxHeight?: number;
|
|
61
|
+
scrollbarColor?: string;
|
|
62
|
+
/** Show a loading placeholder instead of rows. */
|
|
63
|
+
loading?: boolean;
|
|
64
|
+
/** Loading style: a centered `spinner` (default) or shimmering `skeleton` rows. */
|
|
65
|
+
loadingVariant?: 'spinner' | 'skeleton';
|
|
66
|
+
/** Text under the spinner. Defaults to "Loading data"; pass `null` to hide it. */
|
|
67
|
+
loadingText?: string | null;
|
|
68
|
+
/** Number of skeleton rows. Defaults to 5. */
|
|
69
|
+
skeletonRows?: number;
|
|
70
|
+
/** Shown when there is no data (and not loading). */
|
|
71
|
+
empty?: ReactNode;
|
|
72
|
+
/** Below this width the table renders each row as a card. Defaults to 640. */
|
|
73
|
+
mobileBreakpoint?: number;
|
|
74
|
+
style?: StyleProp<ViewStyle>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Table — a flexible, token-driven data table (Figma "Table"). Columns define
|
|
78
|
+
* width/flex, alignment and cell renderers (text, `Badge`, anything). Supports
|
|
79
|
+
* sortable headers, checkbox selection, and accordion rows (expand on row press)
|
|
80
|
+
* OR a trailing actions column (the two are mutually exclusive). A sticky header
|
|
81
|
+
* with an elegant scrolling body (`maxHeight`), loading and empty states, and a
|
|
82
|
+
* card fallback below `mobileBreakpoint`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function Table<T>({ columns, data, keyExtractor, onRowPress, expandable, renderExpanded, expansionMode, expandedKeys, defaultExpandedKeys, onExpandedChange, renderActions, actionsWidth, selectable, selectedKeys, defaultSelectedKeys, onSelectionChange, sort, defaultSort, onSortChange, rounded, maxHeight, scrollbarColor, loading, loadingVariant, loadingText, skeletonRows, empty, mobileBreakpoint, style, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
85
|
+
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAOL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAQtB,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAC3C,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,W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AAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,YAAiB,EACjB,UAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,OAAc,EACd,SAAS,EACT,cAAc,EACd,OAAe,EACf,cAA0B,EAC1B,WAA4B,EAC5B,YAAgB,EAChB,KAAK,EACL,gBAAsB,EACtB,KAAK,GACN,EAAE,UAAU,CAAC,CAAC,CAAC,2CAgZf"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Table } from './Table';
|
|
2
|
+
export type { TableProps, TableColumn, TableSort, ColumnAlign, SortDirection, } from './Table';
|
|
3
|
+
export { DataTable } from './DataTable';
|
|
4
|
+
export type { DataTableProps, DataTableTab, DataTablePagination } from './DataTable';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface BaconLogoProps {
|
|
2
|
+
/** Rendered height in px; width follows the mark's aspect ratio. Defaults to 40. */
|
|
3
|
+
height?: number;
|
|
4
|
+
/** Mark color. Defaults to the Bacon red. */
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The Bacon POS brand mark (the red "B"). Rendered at its natural aspect ratio
|
|
9
|
+
* and not tinted by default — the brand color is preserved. Used as the default
|
|
10
|
+
* logo in `Sidebar`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function BaconLogo({ height, color }: BaconLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=BaconLogo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaconLogo.d.ts","sourceRoot":"","sources":["../../../../../src/components/brand/BaconLogo.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAAW,EAAE,KAAiB,EAAE,EAAE,cAAc,2CAG3E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Logo, type LogoProps, type LogoName } from './Logo';
|
|
2
|
+
export { BaconLogo, type BaconLogoProps } from './BaconLogo';
|
|
2
3
|
export { Flag, type FlagProps, type FlagCountry } from './Flag';
|
|
3
4
|
export { graphics, type GraphicName, type Graphic } from './registry';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/brand/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/brand/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './Alert';
|
|
1
2
|
export * from './Avatar';
|
|
2
3
|
export * from './Badge';
|
|
3
4
|
export * from './brand';
|
|
@@ -9,6 +10,7 @@ export * from './CodeField';
|
|
|
9
10
|
export * from './CodeInput';
|
|
10
11
|
export * from './Dialog';
|
|
11
12
|
export * from './Dropdown';
|
|
13
|
+
export * from './EmptyState';
|
|
12
14
|
export * from './Icon';
|
|
13
15
|
export * from './IconButton';
|
|
14
16
|
export * from './Input';
|
|
@@ -20,9 +22,12 @@ export * from './ProgressBar';
|
|
|
20
22
|
export * from './QuantityStepper';
|
|
21
23
|
export * from './Radio';
|
|
22
24
|
export * from './Select';
|
|
25
|
+
export * from './Sidebar';
|
|
23
26
|
export * from './Spinner';
|
|
27
|
+
export * from './StatTile';
|
|
24
28
|
export * from './Surface';
|
|
25
29
|
export * from './Switch';
|
|
30
|
+
export * from './Table';
|
|
26
31
|
export * from './Text';
|
|
27
32
|
export * from './Toast';
|
|
28
33
|
export * from './UserChip';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,a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AC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAE3B,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Pressable, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { useTheme, type Theme } from '../../theme';
|
|
4
|
+
import { palette } from '../../theme/palette';
|
|
5
|
+
import { Icon } from '../Icon/Icon';
|
|
6
|
+
import type { IconName } from '../Icon/icons.generated';
|
|
7
|
+
import { Text } from '../Text/Text';
|
|
8
|
+
|
|
9
|
+
export type AlertStatus = 'info' | 'warning' | 'success' | 'destructive';
|
|
10
|
+
|
|
11
|
+
export interface AlertProps {
|
|
12
|
+
/** Color/status. Defaults to `info`. */
|
|
13
|
+
status?: AlertStatus;
|
|
14
|
+
/** Optional bold title line above the message. */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Message text. Alternatively pass `children`. */
|
|
17
|
+
message?: string;
|
|
18
|
+
/** Message content (overrides `message`). */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** Leading icon. Defaults to `info` (as in the design). */
|
|
21
|
+
icon?: IconName;
|
|
22
|
+
/** Hide the leading icon. */
|
|
23
|
+
showIcon?: boolean;
|
|
24
|
+
/** Vertical alignment of the icon vs the text. Defaults to `center`. */
|
|
25
|
+
iconAlign?: 'top' | 'center';
|
|
26
|
+
/** Trailing content (e.g. a link/button). */
|
|
27
|
+
action?: ReactNode;
|
|
28
|
+
/** Show a close (×) button and call this on press. */
|
|
29
|
+
onClose?: () => void;
|
|
30
|
+
/** Background override (for a custom status). */
|
|
31
|
+
backgroundColor?: string;
|
|
32
|
+
/** Foreground (text/icon) override. */
|
|
33
|
+
color?: string;
|
|
34
|
+
/** Fixed width. Omit to fill the parent. */
|
|
35
|
+
width?: number;
|
|
36
|
+
/** Override the container style. */
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function statusColors(theme: Theme, status: AlertStatus): { bg: string; fg: string } {
|
|
41
|
+
switch (status) {
|
|
42
|
+
case 'warning':
|
|
43
|
+
return { bg: theme.colors.feedback.warningSubtle, fg: palette.warning[600] };
|
|
44
|
+
case 'success':
|
|
45
|
+
return { bg: theme.colors.feedback.successSubtle, fg: theme.colors.feedback.success };
|
|
46
|
+
case 'destructive':
|
|
47
|
+
return { bg: theme.colors.feedback.errorSubtle, fg: theme.colors.feedback.error };
|
|
48
|
+
case 'info':
|
|
49
|
+
default:
|
|
50
|
+
return { bg: theme.colors.background.subtle, fg: palette.neutral[500] };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Alert — an inline banner in four statuses (info / warning / success /
|
|
56
|
+
* destructive), each a subtle tinted surface with a matching icon and text
|
|
57
|
+
* (Figma "Alert"). Fills its parent by default (text wraps to any width) or takes
|
|
58
|
+
* a fixed `width`. Supports an optional title, a trailing action and a close
|
|
59
|
+
* button; colors are overridable for custom statuses.
|
|
60
|
+
*/
|
|
61
|
+
export function Alert({
|
|
62
|
+
status = 'info',
|
|
63
|
+
title,
|
|
64
|
+
message,
|
|
65
|
+
children,
|
|
66
|
+
icon = 'info',
|
|
67
|
+
showIcon = true,
|
|
68
|
+
iconAlign = 'center',
|
|
69
|
+
action,
|
|
70
|
+
onClose,
|
|
71
|
+
backgroundColor,
|
|
72
|
+
color,
|
|
73
|
+
width,
|
|
74
|
+
style,
|
|
75
|
+
}: AlertProps) {
|
|
76
|
+
const theme = useTheme();
|
|
77
|
+
const { bg, fg } = statusColors(theme, status);
|
|
78
|
+
const foreground = color ?? fg;
|
|
79
|
+
const background = backgroundColor ?? bg;
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<View
|
|
83
|
+
accessibilityRole="alert"
|
|
84
|
+
style={[
|
|
85
|
+
{
|
|
86
|
+
flexDirection: 'row',
|
|
87
|
+
alignItems: 'flex-start',
|
|
88
|
+
gap: 16,
|
|
89
|
+
paddingVertical: 20,
|
|
90
|
+
paddingHorizontal: 16,
|
|
91
|
+
borderRadius: theme.radii.lg,
|
|
92
|
+
backgroundColor: background,
|
|
93
|
+
...(width != null ? { width } : { alignSelf: 'stretch' }),
|
|
94
|
+
},
|
|
95
|
+
style,
|
|
96
|
+
]}
|
|
97
|
+
>
|
|
98
|
+
{showIcon ? (
|
|
99
|
+
<View style={{ width: 24, height: 24, flexShrink: 0, alignSelf: iconAlign === 'center' ? 'center' : 'flex-start' }}>
|
|
100
|
+
<Icon name={icon} size={24} color={foreground} />
|
|
101
|
+
</View>
|
|
102
|
+
) : null}
|
|
103
|
+
|
|
104
|
+
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
105
|
+
{title ? (
|
|
106
|
+
<Text variant="bodyLarge" weight="semibold" color={foreground}>
|
|
107
|
+
{title}
|
|
108
|
+
</Text>
|
|
109
|
+
) : null}
|
|
110
|
+
{children ?? (message ? (
|
|
111
|
+
<Text variant="bodyLarge" color={foreground}>
|
|
112
|
+
{message}
|
|
113
|
+
</Text>
|
|
114
|
+
) : null)}
|
|
115
|
+
</View>
|
|
116
|
+
|
|
117
|
+
{action ? <View style={{ flexShrink: 0 }}>{action}</View> : null}
|
|
118
|
+
|
|
119
|
+
{onClose ? (
|
|
120
|
+
<Pressable
|
|
121
|
+
onPress={onClose}
|
|
122
|
+
hitSlop={8}
|
|
123
|
+
accessibilityRole="button"
|
|
124
|
+
accessibilityLabel="Dismiss"
|
|
125
|
+
style={{ width: 24, height: 24, flexShrink: 0, alignItems: 'center', justifyContent: 'center' }}
|
|
126
|
+
>
|
|
127
|
+
<Icon name="close" size={20} color={foreground} />
|
|
128
|
+
</Pressable>
|
|
129
|
+
) : null}
|
|
130
|
+
</View>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { useTheme } from '../../theme';
|
|
3
|
+
import { Button, type ButtonVariant } from '../Button/Button';
|
|
4
|
+
import { Icon } from '../Icon/Icon';
|
|
5
|
+
import type { IconName } from '../Icon/icons.generated';
|
|
6
|
+
import { Text } from '../Text/Text';
|
|
7
|
+
|
|
8
|
+
export interface EmptyStateAction {
|
|
9
|
+
label: string;
|
|
10
|
+
onPress: () => void;
|
|
11
|
+
icon?: IconName;
|
|
12
|
+
variant?: ButtonVariant;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface EmptyStateProps {
|
|
16
|
+
/** Icon shown in the badge above the title. */
|
|
17
|
+
icon?: IconName;
|
|
18
|
+
/** Title line. */
|
|
19
|
+
title: string;
|
|
20
|
+
/** Supporting description below the title. */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Optional call-to-action button. */
|
|
23
|
+
action?: EmptyStateAction;
|
|
24
|
+
/** Vertical padding around the block. Defaults to 32. */
|
|
25
|
+
paddingVertical?: number;
|
|
26
|
+
/** Override the container style. */
|
|
27
|
+
style?: StyleProp<ViewStyle>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Empty state — a centered icon, title, description and optional action button.
|
|
32
|
+
* Used by `Table`/`DataTable` when there's no data, and reusable anywhere a
|
|
33
|
+
* "nothing here yet" message is needed.
|
|
34
|
+
*/
|
|
35
|
+
export function EmptyState({
|
|
36
|
+
icon = 'no-photo',
|
|
37
|
+
title,
|
|
38
|
+
description,
|
|
39
|
+
action,
|
|
40
|
+
paddingVertical = 32,
|
|
41
|
+
style,
|
|
42
|
+
}: EmptyStateProps) {
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const variant = action?.variant ?? 'inverse';
|
|
45
|
+
const actionIconColor =
|
|
46
|
+
variant === 'default'
|
|
47
|
+
? theme.colors.action.primaryForeground
|
|
48
|
+
: variant === 'secondary'
|
|
49
|
+
? theme.colors.action.secondaryForeground
|
|
50
|
+
: theme.colors.action.inverseForeground;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<View style={[{ alignItems: 'center', gap: 12, paddingVertical, paddingHorizontal: 24 }, style]}>
|
|
54
|
+
<View
|
|
55
|
+
style={{
|
|
56
|
+
width: 48,
|
|
57
|
+
height: 48,
|
|
58
|
+
borderRadius: 24,
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
justifyContent: 'center',
|
|
61
|
+
backgroundColor: theme.colors.background.subtle,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Icon name={icon} size={24} color="tertiary" />
|
|
65
|
+
</View>
|
|
66
|
+
|
|
67
|
+
<View style={{ alignItems: 'center', gap: 4 }}>
|
|
68
|
+
<Text variant="bodyLarge" weight="medium" color="primary" align="center">
|
|
69
|
+
{title}
|
|
70
|
+
</Text>
|
|
71
|
+
{description ? (
|
|
72
|
+
<Text variant="bodyMedium" color="tertiary" align="center" style={{ maxWidth: 420 }}>
|
|
73
|
+
{description}
|
|
74
|
+
</Text>
|
|
75
|
+
) : null}
|
|
76
|
+
</View>
|
|
77
|
+
|
|
78
|
+
{action ? (
|
|
79
|
+
<View style={{ marginTop: 4 }}>
|
|
80
|
+
<Button
|
|
81
|
+
label={action.label}
|
|
82
|
+
variant={action.variant ?? 'inverse'}
|
|
83
|
+
size="sm"
|
|
84
|
+
onPress={action.onPress}
|
|
85
|
+
leftIcon={action.icon ? <Icon name={action.icon} size={20} color={actionIconColor} /> : undefined}
|
|
86
|
+
/>
|
|
87
|
+
</View>
|
|
88
|
+
) : null}
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
}
|