panelui-native 0.2.0 → 0.4.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.
Files changed (84) hide show
  1. package/README.md +251 -0
  2. package/lib/module/components/alert/index.js +106 -13
  3. package/lib/module/components/alert/index.js.map +1 -1
  4. package/lib/module/components/badge/index.js +3 -3
  5. package/lib/module/components/badge/index.js.map +1 -1
  6. package/lib/module/components/button/index.js +44 -15
  7. package/lib/module/components/button/index.js.map +1 -1
  8. package/lib/module/components/checkbox/index.js +20 -7
  9. package/lib/module/components/checkbox/index.js.map +1 -1
  10. package/lib/module/components/empty-state/index.js +178 -0
  11. package/lib/module/components/empty-state/index.js.map +1 -0
  12. package/lib/module/components/input-group/index.js +132 -0
  13. package/lib/module/components/input-group/index.js.map +1 -0
  14. package/lib/module/components/label/index.js +117 -0
  15. package/lib/module/components/label/index.js.map +1 -0
  16. package/lib/module/components/progress/index.js +138 -0
  17. package/lib/module/components/progress/index.js.map +1 -0
  18. package/lib/module/components/steps/index.js +354 -0
  19. package/lib/module/components/steps/index.js.map +1 -0
  20. package/lib/module/components/tabs/index.js +9 -3
  21. package/lib/module/components/tabs/index.js.map +1 -1
  22. package/lib/module/components/toast/index.js +479 -0
  23. package/lib/module/components/toast/index.js.map +1 -0
  24. package/lib/module/components/toast/toast-store.js +81 -0
  25. package/lib/module/components/toast/toast-store.js.map +1 -0
  26. package/lib/module/components/typography/index.js +126 -0
  27. package/lib/module/components/typography/index.js.map +1 -0
  28. package/lib/module/icons/index.js +223 -2
  29. package/lib/module/icons/index.js.map +1 -1
  30. package/lib/module/index.js +9 -2
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/providers/panel-ui-provider.js +2 -1
  33. package/lib/module/providers/panel-ui-provider.js.map +1 -1
  34. package/lib/module/theme/use-theme.js +90 -3
  35. package/lib/module/theme/use-theme.js.map +1 -1
  36. package/lib/typescript/src/components/alert/index.d.ts +56 -4
  37. package/lib/typescript/src/components/alert/index.d.ts.map +1 -1
  38. package/lib/typescript/src/components/button/index.d.ts +39 -0
  39. package/lib/typescript/src/components/button/index.d.ts.map +1 -1
  40. package/lib/typescript/src/components/checkbox/index.d.ts +8 -0
  41. package/lib/typescript/src/components/checkbox/index.d.ts.map +1 -1
  42. package/lib/typescript/src/components/empty-state/index.d.ts +73 -0
  43. package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -0
  44. package/lib/typescript/src/components/input-group/index.d.ts +34 -0
  45. package/lib/typescript/src/components/input-group/index.d.ts.map +1 -0
  46. package/lib/typescript/src/components/label/index.d.ts +28 -0
  47. package/lib/typescript/src/components/label/index.d.ts.map +1 -0
  48. package/lib/typescript/src/components/progress/index.d.ts +132 -0
  49. package/lib/typescript/src/components/progress/index.d.ts.map +1 -0
  50. package/lib/typescript/src/components/steps/index.d.ts +62 -0
  51. package/lib/typescript/src/components/steps/index.d.ts.map +1 -0
  52. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  53. package/lib/typescript/src/components/toast/index.d.ts +176 -0
  54. package/lib/typescript/src/components/toast/index.d.ts.map +1 -0
  55. package/lib/typescript/src/components/toast/toast-store.d.ts +65 -0
  56. package/lib/typescript/src/components/toast/toast-store.d.ts.map +1 -0
  57. package/lib/typescript/src/components/typography/index.d.ts +77 -0
  58. package/lib/typescript/src/components/typography/index.d.ts.map +1 -0
  59. package/lib/typescript/src/icons/index.d.ts +25 -0
  60. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  61. package/lib/typescript/src/index.d.ts +10 -3
  62. package/lib/typescript/src/index.d.ts.map +1 -1
  63. package/lib/typescript/src/providers/panel-ui-provider.d.ts.map +1 -1
  64. package/lib/typescript/src/theme/use-theme.d.ts +64 -4
  65. package/lib/typescript/src/theme/use-theme.d.ts.map +1 -1
  66. package/package.json +22 -4
  67. package/src/components/alert/index.tsx +102 -16
  68. package/src/components/badge/index.tsx +3 -3
  69. package/src/components/button/index.tsx +47 -7
  70. package/src/components/checkbox/index.tsx +17 -3
  71. package/src/components/empty-state/index.tsx +136 -0
  72. package/src/components/input-group/index.tsx +164 -0
  73. package/src/components/label/index.tsx +128 -0
  74. package/src/components/progress/index.tsx +147 -0
  75. package/src/components/steps/index.tsx +343 -0
  76. package/src/components/tabs/index.tsx +10 -2
  77. package/src/components/toast/index.tsx +447 -0
  78. package/src/components/toast/toast-store.ts +120 -0
  79. package/src/components/typography/index.tsx +121 -0
  80. package/src/icons/index.tsx +152 -1
  81. package/src/index.ts +76 -3
  82. package/src/providers/panel-ui-provider.tsx +3 -0
  83. package/src/theme/use-theme.ts +119 -4
  84. package/theme.css +330 -7
package/README.md ADDED
@@ -0,0 +1,251 @@
1
+ # PanelUI — React Native UI components for Expo, styled with Tailwind CSS
2
+
3
+ **PanelUI** (`panelui-native`) is an accessible, high-performance React Native component
4
+ library for Expo apps. 24 typed components — buttons, bottom sheets, dialogs, selects,
5
+ toasts, forms — styled with Tailwind CSS v4 and animated on the UI thread with Reanimated.
6
+ Zero native code, so it runs in Expo Go.
7
+
8
+ [![npm version](https://img.shields.io/npm/v/panelui-native?style=flat-square)](https://www.npmjs.com/package/panelui-native)
9
+ [![npm downloads](https://img.shields.io/npm/dm/panelui-native?style=flat-square)](https://www.npmjs.com/package/panelui-native)
10
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/panelui-native?style=flat-square)](https://bundlephobia.com/package/panelui-native)
11
+ [![MIT license](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](https://github.com/panel-ui/PanelUI/blob/main/LICENSE)
12
+ ![platforms iOS and Android](https://img.shields.io/badge/platforms-iOS%20%7C%20Android-black?style=flat-square)
13
+ ![Expo SDK 57+](https://img.shields.io/badge/Expo-SDK%2057%2B-000?style=flat-square&logo=expo)
14
+
15
+ - ⚡ **Tailwind CSS for React Native** via [Uniwind](https://uniwind.dev) — no Babel transform,
16
+ roughly 2.4–3× faster styling than NativeWind.
17
+ - 🧵 **60fps animations on the UI thread** with Reanimated 4. Press feedback, switches, sheets,
18
+ dialogs and tabs never touch the JS thread.
19
+ - 🎨 **Six built-in themes** — Panel, Moon and Grass, each in light and dark. A theme sets radius
20
+ as well as colour, so switching one restyles the shape of the UI too.
21
+ - 🌗 **Native dark mode.** Theme switching is applied natively by Uniwind, without re-rendering
22
+ your component tree.
23
+ - ♿ **Accessible by default** — every interactive component wires up `accessibilityRole`,
24
+ state and labels.
25
+ - 📦 **TypeScript, tree-shakeable, zero native modules** — works in Expo Go, no prebuild needed.
26
+
27
+ ## Install
28
+
29
+ ```sh
30
+ npx expo install panelui-native uniwind tailwindcss react-native-reanimated react-native-gesture-handler react-native-safe-area-context react-native-svg react-native-worklets
31
+ ```
32
+
33
+ ## Quick start
34
+
35
+ **1. Configure Metro**
36
+
37
+ ```js
38
+ // metro.config.js
39
+ const { getDefaultConfig } = require('expo/metro-config');
40
+ const { withUniwindConfig } = require('uniwind/metro');
41
+
42
+ const config = getDefaultConfig(__dirname);
43
+
44
+ module.exports = withUniwindConfig(config, {
45
+ cssEntryFile: './global.css',
46
+ dtsFile: './uniwind-types.d.ts',
47
+ // Only needed if you use the Moon or Grass themes.
48
+ extraThemes: ['moon', 'moon-dark', 'grass', 'grass-dark'],
49
+ });
50
+ ```
51
+
52
+ **2. Create `global.css`**
53
+
54
+ ```css
55
+ @import 'tailwindcss';
56
+ @import 'uniwind';
57
+ @import 'panelui-native/theme.css';
58
+
59
+ @source './node_modules/panelui-native/src';
60
+ ```
61
+
62
+ **3. Wrap your app**
63
+
64
+ ```tsx
65
+ // App.tsx
66
+ import './global.css';
67
+ import { PanelUIProvider, Button, Card } from 'panelui-native';
68
+
69
+ export default function App() {
70
+ return (
71
+ <PanelUIProvider>
72
+ <Card>
73
+ <Card.Header>
74
+ <Card.Title>Create project</Card.Title>
75
+ <Card.Description>Deploy your new project in one click.</Card.Description>
76
+ </Card.Header>
77
+ <Card.Footer>
78
+ <Button>Deploy</Button>
79
+ </Card.Footer>
80
+ </Card>
81
+ </PanelUIProvider>
82
+ );
83
+ }
84
+ ```
85
+
86
+ `PanelUIProvider` sets up the gesture root, the themed page background, the portal host used by
87
+ overlays, and the toast viewport.
88
+
89
+ ## Components
90
+
91
+ | Component | What it does |
92
+ | --- | --- |
93
+ | `Alert` | Status message with a built-in icon — info, success, warning, destructive |
94
+ | `Avatar` | User image with initials fallback, four sizes |
95
+ | `Badge` | Compact status label with semantic colour variants |
96
+ | `BottomSheet` | Draggable bottom sheet with swipe-to-dismiss |
97
+ | `Button` | Pressable action with variants, sizes, loading state and icon slots |
98
+ | `Card` | Content surface with `Header`, `Content` and `Footer` |
99
+ | `Checkbox` | Animated checkbox with label and description |
100
+ | `Dialog` | Modal dialog with backdrop, title, description and footer actions |
101
+ | `EmptyState` | Placeholder for an empty list or screen, with a stacked-icon media slot |
102
+ | `Frame` | Grouped list section with `Header`, `Panel`, `Row` and `Footer` |
103
+ | `InlineSelect` | Picker that expands its options in place |
104
+ | `Input` | Text field with label, description and error message |
105
+ | `InputGroup` | Input with leading and trailing decorators, auto-measured |
106
+ | `Label` | Form field label with required, invalid and disabled states |
107
+ | `Progress` | Determinate and indeterminate progress bar |
108
+ | `RadioGroup` | Single-select list of options |
109
+ | `Select` | Picker that opens in a bottom sheet |
110
+ | `Skeleton` | Shimmer placeholder for loading content |
111
+ | `Spinner` | Indeterminate loading indicator |
112
+ | `Steps` | Stepper for multi-step flows, horizontal or vertical |
113
+ | `Switch` | Animated on/off toggle |
114
+ | `Tabs` | Segmented navigation with animated indicator |
115
+ | `Toast` | Transient notification queue with swipe-to-dismiss |
116
+ | `Typography` | Semantic text presets — `h1`–`h6`, body sizes, inline code |
117
+
118
+ Plus `PanelUIProvider`, `Portal`, `AnimatedPressable`, `Text`, `useTheme`, `useThemeMode`,
119
+ `useToast`, a set of SVG icons, and the `cn` class-merging helper.
120
+
121
+ Every component takes a `className`, so anything can be restyled with Tailwind utilities:
122
+
123
+ ```tsx
124
+ <Button className="w-full rounded-full" labelClassName="uppercase">
125
+ Continue
126
+ </Button>
127
+ ```
128
+
129
+ ## Toasts
130
+
131
+ ```tsx
132
+ import { useToast } from 'panelui-native';
133
+
134
+ const { toast } = useToast();
135
+
136
+ toast.show('Link copied');
137
+ toast.show({
138
+ variant: 'success',
139
+ label: 'Deployment complete',
140
+ description: 'panelui.dev is live on production.',
141
+ actionLabel: 'View',
142
+ onActionPress: ({ hide }) => hide(),
143
+ });
144
+ ```
145
+
146
+ The queue lives outside React, so `toast.show()` also works from API clients and other
147
+ non-component code.
148
+
149
+ ## Theming and dark mode
150
+
151
+ PanelUI ships three theme families, each in light and dark: **Panel** (`light` / `dark`),
152
+ **Moon** (`moon` / `moon-dark`) and **Grass** (`grass` / `grass-dark`). A family sets its own
153
+ radius scale as well as its own palette — Panel is the Coss default, Moon is sharp and
154
+ monochrome, Grass is soft and green.
155
+
156
+ ```tsx
157
+ import { useTheme, useThemeMode, PANEL_THEMES } from 'panelui-native';
158
+
159
+ // Switch to a specific theme
160
+ const { theme, setTheme } = useTheme();
161
+ setTheme('moon-dark');
162
+ setTheme('system'); // follow the device
163
+
164
+ // Or treat brand and light/dark as separate axes
165
+ const { family, mode, setFamily, toggleMode } = useThemeMode();
166
+ toggleMode(); // dark ↔ light, staying in the current brand
167
+ setFamily('grass'); // switch family, staying in the current mode
168
+ ```
169
+
170
+ Tokens are plain CSS variables, so you can override any of them in your own `global.css`:
171
+
172
+ ```css
173
+ @import 'panelui-native/theme.css';
174
+
175
+ @layer theme {
176
+ :root {
177
+ @variant dark {
178
+ --color-primary: #818cf8;
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ ### Using Expo Router? Read this
185
+
186
+ React Navigation paints its own theme background over every screen, and it defaults to an opaque
187
+ light grey — which sits on top of `PanelUIProvider`'s background and makes theme switching look
188
+ like it does nothing. Feed it the live PanelUI tokens:
189
+
190
+ ```tsx
191
+ import { DarkTheme, DefaultTheme, Stack, ThemeProvider } from 'expo-router';
192
+ import { useCSSVariable } from 'uniwind';
193
+ import { useThemeMode } from 'panelui-native';
194
+
195
+ function ThemedNavigation() {
196
+ const { mode } = useThemeMode();
197
+ const [background, card, text, border] = useCSSVariable([
198
+ '--color-background', '--color-card', '--color-foreground', '--color-border',
199
+ ]) as (string | undefined)[];
200
+
201
+ const base = mode === 'dark' ? DarkTheme : DefaultTheme;
202
+
203
+ return (
204
+ <ThemeProvider value={{ ...base, dark: mode === 'dark',
205
+ colors: { ...base.colors, background, card, text, border } }}>
206
+ <Stack />
207
+ </ThemeProvider>
208
+ );
209
+ }
210
+ ```
211
+
212
+ `useCSSVariable` subscribes to Uniwind's theme changes, so this re-runs on every switch — including
213
+ the named themes, which the OS `Appearance` API knows nothing about. For the same reason, drive
214
+ `<StatusBar>` from `mode` rather than `style="auto"`.
215
+
216
+ ## FAQ
217
+
218
+ ### How is PanelUI different from NativeWind?
219
+
220
+ NativeWind is a styling engine; PanelUI is a component library. PanelUI is built on **Uniwind**,
221
+ a faster Tailwind v4 engine for React Native that skips the Babel transform and applies theme
222
+ changes natively.
223
+
224
+ ### Does it work with Expo Go?
225
+
226
+ Yes. PanelUI is pure TypeScript with no native modules, so no development build or prebuild is
227
+ required.
228
+
229
+ ### Is it accessible?
230
+
231
+ Every interactive component sets an `accessibilityRole`, mirrors its state through
232
+ `accessibilityState`, and exposes labels. Decorative icons are hidden from screen readers.
233
+
234
+ ### Can I use it in a bare React Native app?
235
+
236
+ Yes, as long as Uniwind, Reanimated and Gesture Handler are configured. Expo is the tested
237
+ path.
238
+
239
+ ### Why do my Moon or Grass themes throw "it was not registered"?
240
+
241
+ Named themes must be listed in `extraThemes` in your Metro config — see [Quick start](#quick-start).
242
+
243
+ ## Links
244
+
245
+ - **Documentation and source:** [github.com/panel-ui/PanelUI](https://github.com/panel-ui/PanelUI)
246
+ - **Report an issue:** [github.com/panel-ui/PanelUI/issues](https://github.com/panel-ui/PanelUI/issues)
247
+ - **Changelog:** [releases](https://github.com/panel-ui/PanelUI/releases)
248
+
249
+ ## License
250
+
251
+ MIT © Khalid Abdi
@@ -1,33 +1,52 @@
1
1
  "use strict";
2
2
 
3
+ /**
4
+ * Alert — a status message with an optional leading status icon.
5
+ *
6
+ * Adapted from: heroui-inc/heroui-native src/components/alert/alert.tsx
7
+ * (Indicator / Content / Title / Description anatomy, status-driven icon and
8
+ * title colour), restyled with Coss UI tokens.
9
+ *
10
+ * The `variant` prop name is kept from PanelUI v0.2 rather than renamed to
11
+ * HeroUI's `status`, so existing code keeps working.
12
+ */
3
13
  import { createContext, forwardRef, useContext } from 'react';
4
14
  import { View } from 'react-native';
5
15
  import { tv } from 'tailwind-variants';
16
+ import { useCSSVariable } from 'uniwind';
6
17
  import { cn } from "../../utils/cn.js";
7
18
  import { Text } from "../../primitives/text.js";
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { AlertTriangleIcon, CheckCircleIcon, InfoIcon } from "../../icons/index.js";
20
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
21
  const alertVariants = tv({
10
22
  slots: {
11
- root: 'w-full gap-0.5 rounded-xl border px-3.5 py-3',
12
- title: 'text-sm font-medium text-card-foreground',
23
+ root: 'w-full flex-row gap-3 rounded-xl border px-3.5 py-3',
24
+ indicator: 'pt-px',
25
+ content: 'flex-1 gap-0.5',
26
+ title: 'text-sm font-medium',
13
27
  description: 'text-sm text-muted-foreground'
14
28
  },
15
29
  variants: {
16
30
  variant: {
17
31
  default: {
18
- root: 'border-border bg-surface'
32
+ root: 'border-border bg-surface',
33
+ title: 'text-card-foreground'
19
34
  },
20
35
  info: {
21
- root: 'border-info/32 bg-info/10 dark:bg-info/[0.06]'
36
+ root: 'border-info/32 bg-info-soft',
37
+ title: 'text-info-foreground'
22
38
  },
23
39
  success: {
24
- root: 'border-success/32 bg-success/10 dark:bg-success/[0.06]'
40
+ root: 'border-success/32 bg-success-soft',
41
+ title: 'text-success-foreground'
25
42
  },
26
43
  warning: {
27
- root: 'border-warning/32 bg-warning/10 dark:bg-warning/[0.06]'
44
+ root: 'border-warning/32 bg-warning-soft',
45
+ title: 'text-warning-foreground'
28
46
  },
29
47
  destructive: {
30
- root: 'border-destructive/32 bg-destructive/10 dark:bg-destructive/[0.06]'
48
+ root: 'border-destructive/32 bg-destructive-soft',
49
+ title: 'text-destructive-foreground'
31
50
  }
32
51
  }
33
52
  },
@@ -36,6 +55,22 @@ const alertVariants = tv({
36
55
  }
37
56
  });
38
57
  const AlertContext = /*#__PURE__*/createContext('default');
58
+
59
+ /** CSS variable each variant's indicator icon takes its colour from. */
60
+ const INDICATOR_COLOR_VAR = {
61
+ default: '--color-muted-foreground',
62
+ info: '--color-info-foreground',
63
+ success: '--color-success-foreground',
64
+ warning: '--color-warning-foreground',
65
+ destructive: '--color-destructive-foreground'
66
+ };
67
+ const INDICATOR_ICON = {
68
+ default: InfoIcon,
69
+ info: InfoIcon,
70
+ success: CheckCircleIcon,
71
+ warning: AlertTriangleIcon,
72
+ destructive: AlertTriangleIcon
73
+ };
39
74
  const AlertRoot = /*#__PURE__*/forwardRef(({
40
75
  className,
41
76
  variant = 'default',
@@ -44,7 +79,9 @@ const AlertRoot = /*#__PURE__*/forwardRef(({
44
79
  ...props
45
80
  }, ref) => {
46
81
  const {
47
- root
82
+ root,
83
+ indicator,
84
+ content
48
85
  } = alertVariants({
49
86
  variant
50
87
  });
@@ -57,13 +94,12 @@ const AlertRoot = /*#__PURE__*/forwardRef(({
57
94
  className
58
95
  }),
59
96
  ...props,
60
- children: icon ? /*#__PURE__*/_jsxs(View, {
61
- className: "flex-row items-start gap-3",
97
+ children: icon ? /*#__PURE__*/_jsxs(_Fragment, {
62
98
  children: [/*#__PURE__*/_jsx(View, {
63
- className: "mt-0.5",
99
+ className: indicator(),
64
100
  children: icon
65
101
  }), /*#__PURE__*/_jsx(View, {
66
- className: "flex-1 gap-1",
102
+ className: content(),
67
103
  children: children
68
104
  })]
69
105
  }) : children
@@ -71,6 +107,59 @@ const AlertRoot = /*#__PURE__*/forwardRef(({
71
107
  });
72
108
  });
73
109
  AlertRoot.displayName = 'Alert';
110
+ /**
111
+ * Leading status icon. Resolves both the icon and its colour from the parent
112
+ * Alert's variant, so it follows the active theme.
113
+ */
114
+ const AlertIndicator = /*#__PURE__*/forwardRef(({
115
+ className,
116
+ iconProps,
117
+ children,
118
+ ...props
119
+ }, ref) => {
120
+ const variant = useContext(AlertContext);
121
+ const {
122
+ indicator
123
+ } = alertVariants({
124
+ variant
125
+ });
126
+ const themeColor = useCSSVariable(INDICATOR_COLOR_VAR[variant]);
127
+ const Icon = INDICATOR_ICON[variant];
128
+ const color = iconProps?.color ?? (typeof themeColor === 'string' ? themeColor : undefined);
129
+ return /*#__PURE__*/_jsx(View, {
130
+ ref: ref,
131
+ className: indicator({
132
+ className
133
+ }),
134
+ ...props,
135
+ children: children ?? /*#__PURE__*/_jsx(Icon, {
136
+ size: iconProps?.size ?? 18,
137
+ color: color
138
+ })
139
+ });
140
+ });
141
+ AlertIndicator.displayName = 'Alert.Indicator';
142
+
143
+ /** Flex-1 wrapper for Alert.Title and Alert.Description. */
144
+ const AlertContent = /*#__PURE__*/forwardRef(({
145
+ className,
146
+ ...props
147
+ }, ref) => {
148
+ const variant = useContext(AlertContext);
149
+ const {
150
+ content
151
+ } = alertVariants({
152
+ variant
153
+ });
154
+ return /*#__PURE__*/_jsx(View, {
155
+ ref: ref,
156
+ className: content({
157
+ className
158
+ }),
159
+ ...props
160
+ });
161
+ });
162
+ AlertContent.displayName = 'Alert.Content';
74
163
  const AlertTitle = /*#__PURE__*/forwardRef(({
75
164
  className,
76
165
  ...props
@@ -106,6 +195,10 @@ const AlertDescription = /*#__PURE__*/forwardRef(({
106
195
  });
107
196
  AlertDescription.displayName = 'Alert.Description';
108
197
  export const Alert = Object.assign(AlertRoot, {
198
+ /** @optional Status icon rendered as the leading visual element. */
199
+ Indicator: AlertIndicator,
200
+ /** @optional Wrapper for title and description. */
201
+ Content: AlertContent,
109
202
  Title: AlertTitle,
110
203
  Description: AlertDescription
111
204
  });
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","forwardRef","useContext","View","tv","cn","Text","jsx","_jsx","jsxs","_jsxs","alertVariants","slots","root","title","description","variants","variant","default","info","success","warning","destructive","defaultVariants","AlertContext","AlertRoot","className","icon","children","props","ref","Provider","value","accessibilityRole","displayName","AlertTitle","AlertDescription","Alert","Object","assign","Title","Description"],"sourceRoot":"../../../../src","sources":["components/alert/index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,EAAEC,UAAU,QAAwB,OAAO;AAC7E,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,EAAE,QAAQ,mBAAgB;AACnC,SAASC,IAAI,QAAwB,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7D,MAAMC,aAAa,GAAGP,EAAE,CAAC;EACvBQ,KAAK,EAAE;IACLC,IAAI,EAAE,8CAA8C;IACpDC,KAAK,EAAE,0CAA0C;IACjDC,WAAW,EAAE;EACf,CAAC;EACDC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,OAAO,EAAE;QACPL,IAAI,EAAE;MACR,CAAC;MACDM,IAAI,EAAE;QACJN,IAAI,EAAE;MACR,CAAC;MACDO,OAAO,EAAE;QACPP,IAAI,EAAE;MACR,CAAC;MACDQ,OAAO,EAAE;QACPR,IAAI,EAAE;MACR,CAAC;MACDS,WAAW,EAAE;QACXT,IAAI,EAAE;MACR;IACF;EACF,CAAC;EACDU,eAAe,EAAE;IACfN,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAIF,MAAMO,YAAY,gBAAGxB,aAAa,CAAe,SAAS,CAAC;AAS3D,MAAMyB,SAAS,gBAAGxB,UAAU,CAC1B,CAAC;EAAEyB,SAAS;EAAET,OAAO,GAAG,SAAS;EAAEU,IAAI;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACrE,MAAM;IAAEjB;EAAK,CA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AK;EAChC,MAAMb,OAAO,GAAGf,UAAU,CAACsB,YAAY,CAAC;EACxC,MAAM;IAAET;EAAY,CAAC,GAAGJ,aAAa,CAAC;IAAEM;EAAQ,CAAC,CAAC;EAClD,oBAAOT,IAAA,CAACF,IAAI;IAACwB,GAAG,EAAEA,GAAI;IAACJ,SAAS,EAAErB,EAAE,CAACU,WAAW,CAAC,CAAC,EAAEW,SAAS,CAAE;IAAA,GAAKG;EAAK,CAAG,CAAC;AAC/E,CACF,CAAC;AACDO,gBAAgB,CAACF,WAAW,GAAG,mBAAmB;AAElD,OAAO,MAAMG,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACd,SAAS,EAAE;EAC5Ce,KAAK,EAAEL,UAAU;EACjBM,WAAW,EAAEL;AACf,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","forwardRef","useContext","View","tv","useCSSVariable","cn","Text","AlertTriangleIcon","CheckCircleIcon","InfoIcon","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","alertVariants","slots","root","indicator","content","title","description","variants","variant","default","info","success","warning","destructive","defaultVariants","AlertContext","INDICATOR_COLOR_VAR","INDICATOR_ICON","AlertRoot","className","icon","children","props","ref","Provider","value","accessibilityRole","displayName","AlertIndicator","iconProps","themeColor","Icon","color","undefined","size","AlertContent","AlertTitle","AlertDescription","Alert","Object","assign","Indicator","Content","Title","Description"],"sourceRoot":"../../../../src","sources":["components/alert/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,EAAEC,UAAU,QAAwB,OAAO;AAC7E,SAASC,IAAI,QAA6C,cAAc;AACxE,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,EAAE,QAAQ,mBAAgB;AACnC,SAASC,IAAI,QAAwB,0BAAuB;AAC5D,SAASC,iBAAiB,EAAEC,eAAe,EAAEC,QAAQ,QAAQ,sB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GAAG,EAAEA,GAAI;IAACJ,SAAS,EAAE9B,EAAE,CAACgB,KAAK,CAAC,CAAC,EAAEc,SAAS,CAAE;IAAA,GAAKG;EAAK,CAAG,CAAC;AACzE,CACF,CAAC;AACDc,UAAU,CAACT,WAAW,GAAG,aAAa;AAEtC,MAAMU,gBAAgB,gBAAGrD,UAAU,CACjC,CAAC;EAAEmC,SAAS;EAAE,GAAGG;AAAM,CAAC,EAAEC,GAAG,KAAK;EAChC,MAAMf,OAAO,GAAGvB,UAAU,CAAC8B,YAAY,CAAC;EACxC,MAAM;IAAET;EAAY,CAAC,GAAGN,aAAa,CAAC;IAAEQ;EAAQ,CAAC,CAAC;EAClD,oBAAOb,IAAA,CAACL,IAAI;IAACiC,GAAG,EAAEA,GAAI;IAACJ,SAAS,EAAE9B,EAAE,CAACiB,WAAW,CAAC,CAAC,EAAEa,SAAS,CAAE;IAAA,GAAKG;EAAK,CAAG,CAAC;AAC/E,CACF,CAAC;AACDe,gBAAgB,CAACV,WAAW,GAAG,mBAAmB;AAElD,OAAO,MAAMW,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACtB,SAAS,EAAE;EAC5C;EACAuB,SAAS,EAAEb,cAAc;EACzB;EACAc,OAAO,EAAEP,YAAY;EACrBQ,KAAK,EAAEP,UAAU;EACjBQ,WAAW,EAAEP;AACf,CAAC,CAAC","ignoreList":[]}
@@ -29,15 +29,15 @@ const badgeVariants = tv({
29
29
  label: 'text-white'
30
30
  },
31
31
  success: {
32
- root: 'bg-success/8 dark:bg-success/16',
32
+ root: 'bg-success-subtle',
33
33
  label: 'text-success-foreground'
34
34
  },
35
35
  warning: {
36
- root: 'bg-warning/8 dark:bg-warning/16',
36
+ root: 'bg-warning-subtle',
37
37
  label: 'text-warning-foreground'
38
38
  },
39
39
  info: {
40
- root: 'bg-info/8 dark:bg-info/16',
40
+ root: 'bg-info-subtle',
41
41
  label: 'text-info-foreground'
42
42
  }
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","View","tv","Text","jsx","_jsx","badgeVariants","slots","root","label","variants","variant","default","secondary","outline","destructive","success","warning","info","defaultVariants","Badge","children","className","labelClassName","props","ref","displayName"],"sourceRoot":"../../../../src","sources":["components/badge/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,IAAI,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7C,MAAMC,aAAa,GAAGJ,EAAE,CAAC;EACvBK,KAAK,EAAE;IACLC,IAAI,EAAE,wGAAwG;IAC9GC,KAAK,EAAE;EACT,CAAC;EACDC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,OAAO,EAAE;QAAEJ,IAAI,EAAE,YAAY;QAAEC,KAAK,EAAE;MAA0B,CAAC;MACjEI,SAAS,EAAE;QAAEL,IAAI,EAAE,cAAc;QAAEC,KAAK,EAAE;MAA4B,CAAC;MACvEK,OAAO,EAAE;QAAEN,IAAI,EAAE,8BAA8B;QAAEC,KAAK,EAAE;MAAkB,CAAC;MAC3EM,WAAW,EAAE;QAAEP,IAAI,EAAE,gBAAgB;QAAEC,KAAK,EAAE;MAAa,CAAC;MAC5DO,OAAO,EAAE;QAAER,IAAI,EAAE,iCAAiC;QAAEC,KAAK,EAAE;MAA0B,CAAC;MACtFQ,OAAO,EAAE;QAAET,IAAI,EAAE,iCAAiC;QAAEC,KAAK,EAAE;MAA0B,CAAC;MACtFS,IAAI,EAAE;QAAEV,IAAI,EAAE,2BAA2B;QAAEC,KAAK,EAAE;MAAuB;IAC3E;EACF,CAAC;EACDU,eAAe,EAAE;IACfR,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAUF,OAAO,MAAMS,KAAK,gBAAGpB,UAAU,CAC7B,CAAC;EAAEqB,QAAQ;EAAEC,SAAS;EAAEC,cAAc;EAAEZ,OAAO;EAAE,GAAGa;AAAM,CAAC,EAAEC,GAAG,KAAK;EACnE,MAAM;IAAEjB,IAAI;IAAEC;EAAM,CAAC,GAAGH,aAAa,CAAC;IAAEK;EAAQ,CAAC,CAAC;EAElD,oBACEN,IAAA,CAACJ,IAAI;IAACwB,GAAG,EAAEA,GAAI;IAACH,SAAS,EAAEd,IAAI,CAAC;MAAEc;IAAU,CAAC,CAAE;IAAA,GAAKE,KAAK;IAAAH,QAAA,EACtD,OAAOA,QAAQ,KAAK,QAAQ,gBAC3BhB,IAAA,CAACF,IAAI;MAACmB,SAAS,EAAEb,KAAK,CAAC;QAAEa,SAAS,EAAEC;MAAe,CAAC,CAAE;MAAAF,QAAA,EAAEA;IAAQ,CAAO,CAAC,GAExEA;EACD,CACG,CAAC;AAEX,CACF,CAAC;AAEDD,KAAK,CAACM,WAAW,GAAG,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","View","tv","Text","jsx","_jsx","badgeVariants","slots","root","label","variants","variant","default","secondary","outline","destructive","success","warning","info","defaultVariants","Badge","children","className","labelClassName","props","ref","displayName"],"sourceRoot":"../../../../src","sources":["components/badge/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,IAAI,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7C,MAAMC,aAAa,GAAGJ,EAAE,CAAC;EACvBK,KAAK,EAAE;IACLC,IAAI,EAAE,wGAAwG;IAC9GC,KAAK,EAAE;EACT,CAAC;EACDC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,OAAO,EAAE;QAAEJ,IAAI,EAAE,YAAY;QAAEC,KAAK,EAAE;MAA0B,CAAC;MACjEI,SAAS,EAAE;QAAEL,IAAI,EAAE,cAAc;QAAEC,KAAK,EAAE;MAA4B,CAAC;MACvEK,OAAO,EAAE;QAAEN,IAAI,EAAE,8BAA8B;QAAEC,KAAK,EAAE;MAAkB,CAAC;MAC3EM,WAAW,EAAE;QAAEP,IAAI,EAAE,gBAAgB;QAAEC,KAAK,EAAE;MAAa,CAAC;MAC5DO,OAAO,EAAE;QAAER,IAAI,EAAE,mBAAmB;QAAEC,KAAK,EAAE;MAA0B,CAAC;MACxEQ,OAAO,EAAE;QAAET,IAAI,EAAE,mBAAmB;QAAEC,KAAK,EAAE;MAA0B,CAAC;MACxES,IAAI,EAAE;QAAEV,IAAI,EAAE,gBAAgB;QAAEC,KAAK,EAAE;MAAuB;IAChE;EACF,CAAC;EACDU,eAAe,EAAE;IACfR,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAUF,OAAO,MAAMS,KAAK,gBAAGpB,UAAU,CAC7B,CAAC;EAAEqB,QAAQ;EAAEC,SAAS;EAAEC,cAAc;EAAEZ,OAAO;EAAE,GAAGa;AAAM,CAAC,EAAEC,GAAG,KAAK;EACnE,MAAM;IAAEjB,IAAI;IAAEC;EAAM,CAAC,GAAGH,aAAa,CAAC;IAAEK;EAAQ,CAAC,CAAC;EAElD,oBACEN,IAAA,CAACJ,IAAI;IAACwB,GAAG,EAAEA,GAAI;IAACH,SAAS,EAAEd,IAAI,CAAC;MAAEc;IAAU,CAAC,CAAE;IAAA,GAAKE,KAAK;IAAAH,QAAA,EACtD,OAAOA,QAAQ,KAAK,QAAQ,gBAC3BhB,IAAA,CAACF,IAAI;MAACmB,SAAS,EAAEb,KAAK,CAAC;QAAEa,SAAS,EAAEC;MAAe,CAAC,CAAE;MAAAF,QAAA,EAAEA;IAAQ,CAAO,CAAC,GAExEA;EACD,CACG,CAAC;AAEX,CACF,CAAC;AAEDD,KAAK,CAACM,WAAW,GAAG,OAAO","ignoreList":[]}
@@ -1,36 +1,43 @@
1
1
  "use strict";
2
2
 
3
- import { forwardRef, isValidElement } from 'react';
3
+ import { forwardRef } from 'react';
4
4
  import { tv } from 'tailwind-variants';
5
5
  import { AnimatedPressable } from "../../primitives/animated-pressable.js";
6
6
  import { Text } from "../../primitives/text.js";
7
- import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { Spinner } from "../spinner/index.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
9
  const buttonVariants = tv({
9
10
  slots: {
10
11
  root: 'flex-row items-center justify-center gap-2 rounded-lg border border-transparent',
11
- label: 'font-medium'
12
+ label: 'font-medium',
13
+ spinner: ''
12
14
  },
13
15
  variants: {
14
16
  variant: {
15
17
  primary: {
16
18
  root: 'border-primary bg-primary shadow-sm',
17
- label: 'text-primary-foreground'
19
+ label: 'text-primary-foreground',
20
+ spinner: 'border-primary-foreground/32 border-t-primary-foreground'
18
21
  },
19
22
  secondary: {
20
23
  root: 'bg-secondary',
21
- label: 'text-secondary-foreground'
24
+ label: 'text-secondary-foreground',
25
+ spinner: 'border-secondary-foreground/24 border-t-secondary-foreground'
22
26
  },
23
27
  outline: {
24
28
  root: 'border-input bg-popover shadow-sm',
25
- label: 'text-foreground'
29
+ label: 'text-foreground',
30
+ spinner: 'border-muted border-t-foreground'
26
31
  },
27
32
  ghost: {
28
33
  root: 'bg-transparent',
29
- label: 'text-foreground'
34
+ label: 'text-foreground',
35
+ spinner: 'border-muted border-t-foreground'
30
36
  },
31
37
  destructive: {
32
38
  root: 'border-destructive bg-destructive shadow-sm',
33
- label: 'text-white'
39
+ label: 'text-white',
40
+ spinner: 'border-white/32 border-t-white'
34
41
  }
35
42
  },
36
43
  size: {
@@ -50,6 +57,11 @@ const buttonVariants = tv({
50
57
  root: 'h-11 w-11 px-0'
51
58
  }
52
59
  },
60
+ fullWidth: {
61
+ true: {
62
+ root: 'w-full'
63
+ }
64
+ },
53
65
  disabled: {
54
66
  true: {
55
67
  root: 'opacity-[0.64]'
@@ -61,40 +73,57 @@ const buttonVariants = tv({
61
73
  size: 'md'
62
74
  }
63
75
  });
76
+ const SPINNER_SIZE = {
77
+ sm: 'sm',
78
+ md: 'sm',
79
+ lg: 'md',
80
+ icon: 'sm'
81
+ };
64
82
  export const Button = /*#__PURE__*/forwardRef(({
65
83
  children,
66
84
  className,
67
85
  labelClassName,
68
86
  variant,
69
87
  size,
88
+ fullWidth,
70
89
  disabled,
90
+ loading = false,
91
+ startContent,
92
+ endContent,
71
93
  ...props
72
94
  }, ref) => {
95
+ const isDisabled = disabled || loading;
73
96
  const {
74
97
  root,
75
- label
98
+ label,
99
+ spinner
76
100
  } = buttonVariants({
77
101
  variant,
78
102
  size,
79
- disabled: !!disabled
103
+ fullWidth,
104
+ disabled: isDisabled
80
105
  });
81
- return /*#__PURE__*/_jsx(AnimatedPressable, {
106
+ return /*#__PURE__*/_jsxs(AnimatedPressable, {
82
107
  ref: ref,
83
108
  accessibilityRole: "button",
84
109
  accessibilityState: {
85
- disabled: !!disabled
110
+ disabled: isDisabled,
111
+ busy: loading
86
112
  },
87
- disabled: disabled,
113
+ disabled: isDisabled,
88
114
  className: root({
89
115
  className
90
116
  }),
91
117
  ...props,
92
- children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
118
+ children: [loading ? /*#__PURE__*/_jsx(Spinner, {
119
+ size: SPINNER_SIZE[size ?? 'md'],
120
+ className: spinner()
121
+ }) : startContent, typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
93
122
  className: label({
94
123
  className: labelClassName
95
124
  }),
96
125
  children: children
97
- }) : /*#__PURE__*/isValidElement(children) ? children : children
126
+ }) : children, endContent]
98
127
  });
99
128
  });
100
129
  Button.displayName = 'Button';
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","isValidElement","tv","AnimatedPressable","Text","jsx","_jsx","buttonVariants","slots","root","label","variants","variant","primary","secondary","outline","ghost","destructive","size","sm","md","lg","icon","disabled","true","defaultVariants","Button","children","className","labelClassName","props","ref","accessibilityRole","accessibilityState","displayName"],"sourceRoot":"../../../../src","sources":["components/button/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,cAAc,QAAwB,OAAO;AAElE,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SACEC,iBAAi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E,GAAGO;AAAM,CAAC,EAC1EC,GAAG,KACA;EACH,MAAM;IAAEtB,IAAI;IAAEC;EAAM,CAAC,GAAGH,cAAc,CAAC;IAAEK,OAAO;IAAEM,IAAI;IAAEK,QAAQ,EAAE,CAAC,CAACA;EAAS,CAAC,CAAC;EAE/E,oBACEjB,IAAA,CAACH,iBAAiB;IAChB4B,GAAG,EAAEA,GAAI;IACTC,iBAAiB,EAAC,QAAQ;IAC1BC,kBAAkB,EAAE;MAAEV,QAAQ,EAAE,CAAC,CAACA;IAAS,CAAE;IAC7CA,QAAQ,EAAEA,QAAS;IACnBK,SAAS,EAAEnB,IAAI,CAAC;MAAEmB;IAAU,CAAC,CAAE;IAAA,GAC3BE,KAAK;IAAAH,QAAA,EAER,OAAOA,QAAQ,KAAK,QAAQ,gBAC3BrB,IAAA,CAACF,IAAI;MAACwB,SAAS,EAAElB,KAAK,CAAC;QAAEkB,SAAS,EAAEC;MAAe,CAAC,CAAE;MAAAF,QAAA,EAAEA;IAAQ,CAAO,CAAC,GACtE,aAAA1B,cAAc,CAAC0B,QAAQ,CAAC,GAC1BA,QAAQ,GAERA;EACD,CACgB,CAAC;AAExB,CACF,CAAC;AAEDD,MAAM,CAACQ,WAAW,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","tv","AnimatedPressable","Text","Spinner","jsx","_jsx","jsxs","_jsxs","buttonVariants","slots","root","label","spinner","variants","variant","primary","secondary","outline","ghost","destructive","size","sm","md","lg","icon","fullWidth","true","disabled","defaultVariants","SPINNER_SIZE","Button","children","className","labelClassName","loading","startContent","endContent","props","ref","isDisabled","accessibilityRole","accessibilityState","busy","displayName"],"sourceRoot":"../../../../src","sources":["components/button/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAElD,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SACEC,iBAAiB,QAEZ,wCAAqC;AAC5C,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SAASC,OAAO,QA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