@jirawatpyk/aura-react 4.17.0 → 4.19.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/README.md +30 -3
- package/dist/aura.bundle.js +468 -190
- package/dist/cjs/index.cjs +467 -189
- package/dist/esm/ActionBar.js +47 -0
- package/dist/esm/AppShell.js +2 -2
- package/dist/esm/BottomNav.js +45 -0
- package/dist/esm/Command.js +11 -9
- package/dist/esm/DataTable.js +84 -5
- package/dist/esm/DatePicker.js +9 -4
- package/dist/esm/DropdownMenu.js +1 -0
- package/dist/esm/Menu.js +64 -22
- package/dist/esm/Tabs.js +35 -0
- package/dist/esm/Toaster.js +23 -6
- package/dist/esm/dates.js +12 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/locale.js +4 -2
- package/dist/esm/strings.js +3 -0
- package/dist/index.d.ts +106 -5
- package/dist/server/index.cjs +15 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +15 -1
- package/dist/styles.css +88 -3
- package/dist/styles.layer.css +88 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,9 +74,9 @@ export default function Root() {
|
|
|
74
74
|
| `dist/styles.css` | Component CSS (no font import). |
|
|
75
75
|
| `dist/index.d.ts` | Types for every component and helper, generated from the TypeScript sources (one file). |
|
|
76
76
|
|
|
77
|
-
## Components (
|
|
77
|
+
## Components (51)
|
|
78
78
|
|
|
79
|
-
Actions: Button (`ghost`, `size="sm"`), IconButton, Menu, DropdownMenu, Tag · Forms: TextField, PasswordField, Textarea, NumberField, Select, RadioGroup, Checkbox, Switch, SegmentedControl, Combobox (one value, or `multiple`), FileUpload (+ `formatBytes`) · Dates & times: DatePicker, DateRangePicker, Calendar, TimePicker (+ `useFormatDate`, `formatDate`, `parseDate`, `parseTime`) · Feedback: Alert, FormErrorSummary, Toaster/`toast()` (+ `.success/.error/.warning/.info/.loading`), Tooltip, StatusPill, Badge, Progress, Skeleton, EmptyState · Overlays: Dialog, Drawer, Popover · Data: DataTable, FilterBar, Stat · Navigation: Command (⌘K palette) · Layout: AppShell, Container, Stack, Grid, Accordion, Pagination, Card, Tabs, Stepper, SideNav, Breadcrumb, Avatar, Surface, Icon · Theme: ColorSchemeToggle, ColorSchemeScript, `useColorScheme`, ThemeStyle/`createTheme` · Hooks: `useBreakpoint`, `useResponsive`, `breakpoints`, `useAuraLocale`, `useDensity`.
|
|
79
|
+
Actions: Button (`ghost`, `size="sm"`), IconButton, Menu, DropdownMenu (link, danger and radio items), ActionBar, Tag · Forms: TextField, PasswordField, Textarea, NumberField, Select, RadioGroup, Checkbox, Switch, SegmentedControl, Combobox (one value, or `multiple`), FileUpload (+ `formatBytes`) · Dates & times: DatePicker, DateRangePicker, Calendar, TimePicker (+ `useFormatDate`, `formatDate`, `parseDate`, `parseTime`) · Feedback: Alert, FormErrorSummary, Toaster/`toast()` (+ `.success/.error/.warning/.info/.loading`), Tooltip, StatusPill, Badge, Progress, Skeleton, EmptyState · Overlays: Dialog, Drawer, Popover · Data: DataTable, FilterBar, Stat · Navigation: Command (⌘K palette), BottomNav · Layout: AppShell, Container, Stack, Grid, Accordion, Pagination, Card, Tabs, Stepper, SideNav, Breadcrumb, Avatar, Surface, Icon · Theme: ColorSchemeToggle, ColorSchemeScript, `useColorScheme`, ThemeStyle/`createTheme` · Hooks: `useBreakpoint`, `useResponsive`, `breakpoints`, `useAuraLocale`, `useDensity`.
|
|
80
80
|
|
|
81
81
|
## Router links, Swedish, motion
|
|
82
82
|
|
|
@@ -100,7 +100,7 @@ export function Providers({ children, locale }: { children: React.ReactNode; loc
|
|
|
100
100
|
// app/layout.tsx (a Server Component): <body><Providers locale="th">{children}</Providers></body>
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
`linkComponent` is used by Button `href`, Breadcrumb, Pagination `getHref` (page numbers and, since 4.17, the previous / next arrows), Stat `href`, SideNav and DataTable row/pager links. Each of them also takes its own `linkComponent`, which wins over the provider's. Pass `getHref` from a client component (it's a function too). The Next.js starter does all of this, and CI clicks every AURA link in it to check none triggers a full page load. Only `th` shows Buddhist-era years; `en` and `sv` are Gregorian (`sv` weeks start Monday). **Without a provider, components are English with Gregorian dates** — wrap Thai apps in `<AuraProvider locale="th">`. For dates in your own components use `useFormatDate()` — it follows the provider (`const fmt = useFormatDate(); fmt(iso, { format: 'long' })`). Plain `formatDate()` from the package root has no provider to read and stays Thai unless you pass `locale` (until 5.0); the one in `@jirawatpyk/aura-react/server` defaults to English and Gregorian. Values are always Gregorian ISO dates.
|
|
103
|
+
`linkComponent` is used by Button `href`, Breadcrumb, Tabs and Menu items with `href`, BottomNav, Pagination `getHref` (page numbers and, since 4.17, the previous / next arrows), Stat `href`, SideNav and DataTable row/pager links. Each of them also takes its own `linkComponent`, which wins over the provider's. Pass `getHref` from a client component (it's a function too). The Next.js starter does all of this, and CI clicks every AURA link in it to check none triggers a full page load. Only `th` shows Buddhist-era years; `en` and `sv` are Gregorian (`sv` weeks start Monday). **Without a provider, components are English with Gregorian dates** — wrap Thai apps in `<AuraProvider locale="th">`. For dates in your own components use `useFormatDate()` — it follows the provider (`const fmt = useFormatDate(); fmt(iso, { format: 'long' })`). Plain `formatDate()` from the package root has no provider to read and stays Thai unless you pass `locale` (until 5.0); the one in `@jirawatpyk/aura-react/server` defaults to English and Gregorian. Values are always Gregorian ISO dates.
|
|
104
104
|
|
|
105
105
|
## Compact density
|
|
106
106
|
|
|
@@ -159,6 +159,33 @@ Server search in the palette (4.17): control the query and hand over what the se
|
|
|
159
159
|
|
|
160
160
|
DataTable with sort and page in the URL (4.17): `onStateChange={({ sort, page }) => router.push(…)}` reports a sort click once, as `{ sort, page: 1 }`, instead of `onSortChange` and then `onPageChange(1)`. That's one history entry and one server render.
|
|
161
161
|
|
|
162
|
+
## Phone bars, totals, link tabs, time zones (4.19)
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
<AppShell nav={<SideNav … />} bottomNav={<BottomNav value={tab} items={[{ id: 'home', label: 'Home', icon: 'house', href: '/' }, …]} />}>
|
|
166
|
+
<form>
|
|
167
|
+
…fields…
|
|
168
|
+
<ActionBar status={dirty ? 'Unsaved changes' : 'Total 107,000.00 THB · due Oct 22, 2026'}> {/* last child of the form */}
|
|
169
|
+
<Button>Save</Button>
|
|
170
|
+
</ActionBar>
|
|
171
|
+
</form>
|
|
172
|
+
</AppShell>
|
|
173
|
+
|
|
174
|
+
<ActionBar selected={ids.length} onClearSelection={clear}><Button size="sm">Send reminder</Button></ActionBar>
|
|
175
|
+
<DataTable … footer={{ id: 'Total', vat: '9,779.00', total: '149,479.00' }} stickyFooter height={480} />
|
|
176
|
+
<Tabs label="Renewals" value="review" tabs={[{ id: 'pipeline', label: 'Pipeline', href: '/renewals' }, …]} />
|
|
177
|
+
<DropdownMenu items={[{ label: 'Open', href: '/m/1' }, { label: 'Grid', type: 'radio', group: 'View', checked }, { label: 'Void', tone: 'danger' }]} … />
|
|
178
|
+
<DatePicker label="Payment date" max="today" /> {/* with <AuraProvider timeZone="Asia/Bangkok"> */}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- **ActionBar** is `position: sticky`, so it stays in the flow and never covers the last field; it sticks while its parent (the form or card) is on screen. `viewport` (default) floats above the home indicator and above a BottomNav; `container` sits flush at the bottom of a card. The status line is a live region. With `selected`, it reads "N selected", adds Clear, and hides at 0 (focus goes back to where it came from).
|
|
182
|
+
- **BottomNav**: up to five icon + label tabs, 44px+ targets at 320px, `aria-current="page"`, counts and dots. Hidden from `lg` up in CSS (`hideFrom`), with a spacer in the flow, so the server's HTML is right and nothing shifts on hydration. For the notch and home indicator add `viewport-fit=cover` to your viewport meta.
|
|
183
|
+
- **DataTable `footer`**: a totals row with the body's widths and alignment (a Totals card when stacked); `stickyFooter` keeps it in view in a `height` table. Truncated cells show their full text on hover and keyboard focus.
|
|
184
|
+
- **Tabs with `href`** on every item render a `nav` of links (no panels), the current one `aria-current="page"`.
|
|
185
|
+
- **Menu items**: `href` (through `linkComponent`), `tone: 'danger'`, and `type: 'radio'` with `group` / `checked` (menuitemradio in a labelled group).
|
|
186
|
+
- **Time zone**: `timeZone` on AuraProvider, DatePicker, DateRangePicker and Calendar decides "today" (the marker, `min`/`max="today"`, the first month shown); or pass `today` as an ISO date. `todayIn('Asia/Bangkok')` is exported from the root and `/server`.
|
|
187
|
+
- **Toasts** queue past three instead of dropping: six in a row all show, in order, three at a time.
|
|
188
|
+
|
|
162
189
|
## Phones and touch
|
|
163
190
|
|
|
164
191
|
Under 640px every text control uses 16px text (iOS Safari doesn't zoom). On touch screens (`pointer: coarse`) IconButton and `<Button size="sm">` keep their 32px look with a 44px hit area, and Radio, Checkbox and Switch rows are at least 44px with the whole row as the target. Since 4.17 so are menu items, page numbers, segments and calendar days (44px); Combobox and DatePicker toggles and the Tag remove button get 44px hit areas. A Dialog sheet on a phone is capped at `92dvh`, so the browser toolbar never hides its footer. `<Button fullWidth>` fills its row and wraps long Thai or Swedish labels.
|