@godxjp/ui 5.0.2 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -142
- package/dist/app/index.d.ts +140 -0
- package/dist/app/index.js +38 -0
- package/dist/app.prop-IobwLwaM.d.ts +90 -0
- package/dist/checkbox-NkFkqsQ8.d.ts +13 -0
- package/dist/chunk-2XW7J3EI.js +226 -0
- package/dist/chunk-3F2AKYRD.js +416 -0
- package/dist/chunk-3KPEZ5CF.js +37 -0
- package/dist/chunk-3UGU5TYP.js +89 -0
- package/dist/chunk-6RA3KSVK.js +588 -0
- package/dist/chunk-7NZFVD24.js +122 -0
- package/dist/chunk-7PWBC4BY.js +25 -0
- package/dist/chunk-7S7MYFXE.js +61 -0
- package/dist/chunk-7WRZG2IG.js +71 -0
- package/dist/chunk-B775Y6BE.js +1 -0
- package/dist/chunk-BHV2FUOA.js +111 -0
- package/dist/chunk-BI3HERR7.js +70 -0
- package/dist/chunk-BPSKQUL2.js +68 -0
- package/dist/chunk-CDWPQ5RP.js +187 -0
- package/dist/chunk-CP2LET6N.js +244 -0
- package/dist/chunk-CQBADMFG.js +20 -0
- package/dist/chunk-CRERCLIZ.js +33 -0
- package/dist/chunk-DU6ZYZRP.js +238 -0
- package/dist/chunk-DY5C44UP.js +55 -0
- package/dist/chunk-E4HJNQ62.js +117 -0
- package/dist/chunk-E76QIYSY.js +93 -0
- package/dist/chunk-F7PG4OEV.js +37 -0
- package/dist/chunk-GDSVW62T.js +171 -0
- package/dist/chunk-H2FHJOLU.js +178 -0
- package/dist/chunk-HJEBRCXL.js +55 -0
- package/dist/chunk-ICM6XBST.js +16 -0
- package/dist/chunk-IK7I3ABN.js +88 -0
- package/dist/chunk-L6J44O74.js +144 -0
- package/dist/chunk-LDSLS6HE.js +1 -0
- package/dist/chunk-LVNUHUEZ.js +191 -0
- package/dist/chunk-M64MVRLS.js +92 -0
- package/dist/chunk-NGQW3KEM.js +402 -0
- package/dist/chunk-NZ4FOC5N.js +559 -0
- package/dist/chunk-PIIRNAXA.js +26 -0
- package/dist/chunk-S66TJXJU.js +33 -0
- package/dist/chunk-SMLKNECP.js +133 -0
- package/dist/chunk-TAHBM3F2.js +66 -0
- package/dist/chunk-TO33OY4L.js +150 -0
- package/dist/chunk-TO7URV7U.js +51 -0
- package/dist/chunk-TOO5AEKL.js +81 -0
- package/dist/chunk-U3GHAOIJ.js +299 -0
- package/dist/chunk-U7N2A7A3.js +9 -0
- package/dist/chunk-UX634MYF.js +123 -0
- package/dist/chunk-V6UWJKZF.js +28 -0
- package/dist/chunk-VOHTRR5X.js +28 -0
- package/dist/chunk-WRFKVUPW.js +332 -0
- package/dist/chunk-WXW43RK5.js +24 -0
- package/dist/chunk-XG7XDYIM.js +60 -0
- package/dist/chunk-YFCQKO3B.js +842 -0
- package/dist/chunk-ZDWXGWLY.js +73 -0
- package/dist/chunk-ZLK5SPT6.js +11 -0
- package/dist/chunk-ZS6DTAM2.js +31 -0
- package/dist/chunk-ZT5UEUBO.js +1 -0
- package/dist/components/admin/index.d.ts +80 -0
- package/dist/components/admin/index.js +38 -0
- package/dist/components/data-display/badge.d.ts +12 -0
- package/dist/components/data-display/badge.js +3 -0
- package/dist/components/data-display/card.d.ts +87 -0
- package/dist/components/data-display/card.js +2 -0
- package/dist/components/data-display/index.d.ts +72 -0
- package/dist/components/data-display/index.js +89 -0
- package/dist/components/data-display/popover.d.ts +13 -0
- package/dist/components/data-display/popover.js +2 -0
- package/dist/components/data-display/scroll-area.d.ts +7 -0
- package/dist/components/data-display/scroll-area.js +2 -0
- package/dist/components/data-display/table.d.ts +10 -0
- package/dist/components/data-display/table.js +3 -0
- package/dist/components/data-entry/autocomplete.d.ts +16 -0
- package/dist/components/data-entry/autocomplete.js +8 -0
- package/dist/components/data-entry/calendar.d.ts +16 -0
- package/dist/components/data-entry/calendar.js +4 -0
- package/dist/components/data-entry/cascader.d.ts +32 -0
- package/dist/components/data-entry/cascader.js +13 -0
- package/dist/components/data-entry/checkbox.d.ts +13 -0
- package/dist/components/data-entry/checkbox.js +4 -0
- package/dist/components/data-entry/color-picker.d.ts +16 -0
- package/dist/components/data-entry/color-picker.js +6 -0
- package/dist/components/data-entry/command.d.ts +69 -0
- package/dist/components/data-entry/command.js +3 -0
- package/dist/components/data-entry/date-picker.d.ts +16 -0
- package/dist/components/data-entry/date-picker.js +8 -0
- package/dist/components/data-entry/date-range-picker.d.ts +16 -0
- package/dist/components/data-entry/date-range-picker.js +8 -0
- package/dist/components/data-entry/index.d.ts +53 -0
- package/dist/components/data-entry/index.js +152 -0
- package/dist/components/data-entry/input.d.ts +6 -0
- package/dist/components/data-entry/input.js +2 -0
- package/dist/components/data-entry/label.d.ts +8 -0
- package/dist/components/data-entry/label.js +2 -0
- package/dist/components/data-entry/radio.d.ts +24 -0
- package/dist/components/data-entry/radio.js +4 -0
- package/dist/components/data-entry/select.d.ts +18 -0
- package/dist/components/data-entry/select.js +3 -0
- package/dist/components/data-entry/slider.d.ts +16 -0
- package/dist/components/data-entry/slider.js +2 -0
- package/dist/components/data-entry/switch.d.ts +17 -0
- package/dist/components/data-entry/switch.js +2 -0
- package/dist/components/data-entry/textarea.d.ts +6 -0
- package/dist/components/data-entry/textarea.js +3 -0
- package/dist/components/data-entry/time-picker.d.ts +16 -0
- package/dist/components/data-entry/time-picker.js +7 -0
- package/dist/components/data-entry/transfer.d.ts +17 -0
- package/dist/components/data-entry/transfer.js +11 -0
- package/dist/components/data-entry/tree-select.d.ts +26 -0
- package/dist/components/data-entry/tree-select.js +13 -0
- package/dist/components/data-entry/upload.d.ts +42 -0
- package/dist/components/data-entry/upload.js +11 -0
- package/dist/components/feedback/alert.d.ts +60 -0
- package/dist/components/feedback/alert.js +7 -0
- package/dist/components/feedback/dialog.d.ts +64 -0
- package/dist/components/feedback/dialog.js +7 -0
- package/dist/components/feedback/index.d.ts +16 -0
- package/dist/components/feedback/index.js +14 -0
- package/dist/components/feedback/sheet.d.ts +24 -0
- package/dist/components/feedback/sheet.js +2 -0
- package/dist/components/feedback/sonner.d.ts +6 -0
- package/dist/components/feedback/sonner.js +1 -0
- package/dist/components/general/button.d.ts +20 -0
- package/dist/components/general/button.js +2 -0
- package/dist/components/general/index.d.ts +6 -0
- package/dist/components/general/index.js +2 -0
- package/dist/components/layout/index.d.ts +71 -0
- package/dist/components/layout/index.js +5 -0
- package/dist/components/navigation/dropdown-menu.d.ts +28 -0
- package/dist/components/navigation/dropdown-menu.js +2 -0
- package/dist/components/navigation/index.d.ts +32 -0
- package/dist/components/navigation/index.js +12 -0
- package/dist/components/navigation/pagination.d.ts +11 -0
- package/dist/components/navigation/pagination.js +7 -0
- package/dist/components/navigation/steps.d.ts +12 -0
- package/dist/components/navigation/steps.js +3 -0
- package/dist/components/navigation/tabs-items.d.ts +12 -0
- package/dist/components/navigation/tabs-items.js +3 -0
- package/dist/components/navigation/tabs.d.ts +12 -0
- package/dist/components/navigation/tabs.js +2 -0
- package/dist/components/query/index.d.ts +43 -0
- package/dist/components/query/index.js +8 -0
- package/dist/components/ui/index.d.ts +57 -0
- package/dist/components/ui/index.js +37 -0
- package/dist/content.prop-D1Dd3TAc.d.ts +31 -0
- package/dist/data-display.prop-DNTAzmDy.d.ts +58 -0
- package/dist/data-entry.prop-BEGA1lTq.d.ts +323 -0
- package/dist/data-table-D1u_rKLK.d.ts +83 -0
- package/dist/data.prop-BVvfKC_g.d.ts +41 -0
- package/dist/feedback.prop-BmxUlpAW.d.ts +64 -0
- package/dist/filter-bar-B7OGFO9S.d.ts +10 -0
- package/dist/form/index.d.ts +21 -0
- package/dist/form/index.js +4 -0
- package/dist/form.prop-BHgpuFFm.d.ts +41 -0
- package/dist/format-date-ByyZoqI5.d.ts +51 -0
- package/dist/general.prop-D7brMPNL.d.ts +16 -0
- package/dist/i18n/index.d.ts +217 -0
- package/dist/i18n/index.js +2 -0
- package/dist/index.d.ts +46 -26
- package/dist/index.js +39 -13062
- package/dist/inline-C5u6ptJV.d.ts +10 -0
- package/dist/interaction.prop-Cdn7wOtq.d.ts +25 -0
- package/dist/layout.prop-4TCNvyQZ.d.ts +20 -0
- package/dist/layout.prop-C795F0qg.d.ts +112 -0
- package/dist/lib/datetime/index.d.ts +31 -0
- package/dist/lib/datetime/index.js +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -0
- package/dist/navigation.prop-DpZqcXey.d.ts +78 -0
- package/dist/navigation.prop-DxBiClEH.d.ts +20 -0
- package/dist/props/components/index.d.ts +27 -0
- package/dist/props/components/index.js +1 -0
- package/dist/props/index.d.ts +28 -0
- package/dist/props/index.js +3 -0
- package/dist/props/registry.d.ts +649 -0
- package/dist/props/registry.js +1 -0
- package/dist/props/vocabulary/index.d.ts +7 -0
- package/dist/props/vocabulary/index.js +1 -0
- package/dist/query.prop-hIPrk2zI.d.ts +71 -0
- package/dist/search-input-uP01rY1L.d.ts +22 -0
- package/dist/shared.prop-BNRJc9K0.d.ts +45 -0
- package/dist/styles/alert-layout.css +191 -0
- package/dist/styles/badge-layout.css +22 -0
- package/dist/styles/card-layout.css +373 -0
- package/dist/styles/control.css +504 -0
- package/dist/styles/data-display-layout.css +246 -0
- package/dist/styles/density.css +43 -0
- package/dist/styles/dialog-layout.css +84 -0
- package/dist/styles/index.css +105 -0
- package/dist/styles/layout.css +479 -0
- package/dist/styles/shell-layout.css +604 -0
- package/dist/styles/table-layout.css +109 -0
- package/dist/theme/example.service.css +37 -0
- package/dist/tokens/base.css +13 -0
- package/dist/tokens/foundation.css +151 -0
- package/dist/tokens/primitives/badge.css +13 -0
- package/dist/tokens/primitives/card.css +29 -0
- package/dist/tokens/primitives/control.css +55 -0
- package/dist/tokens/primitives/feedback.css +17 -0
- package/dist/tokens/primitives/layout.css +20 -0
- package/dist/tokens/primitives/navigation.css +13 -0
- package/dist/tokens/primitives/table.css +10 -0
- package/dist/types-mvzYGrma.d.ts +37 -0
- package/dist/use-toast-Dol5bdY3.d.ts +34 -0
- package/package.json +279 -117
- package/scripts/ui-audit.mjs +179 -0
- package/BRAND.md +0 -296
- package/CHANGELOG.md +0 -668
- package/config/eslint.js +0 -54
- package/config/prettier.cjs +0 -20
- package/config/tsconfig.base.json +0 -22
- package/config/vitest.base.ts +0 -26
- package/dist/MiniMonth-YAmPGEpC.d.ts +0 -143
- package/dist/Table.types-BbsxoIYE.d.ts +0 -352
- package/dist/color-DO0qqUAb.d.ts +0 -38
- package/dist/components/composites.d.ts +0 -963
- package/dist/components/composites.js +0 -7343
- package/dist/components/composites.js.map +0 -1
- package/dist/components/primitives.d.ts +0 -2744
- package/dist/components/primitives.js +0 -7356
- package/dist/components/primitives.js.map +0 -1
- package/dist/components/shell.d.ts +0 -182
- package/dist/components/shell.js +0 -774
- package/dist/components/shell.js.map +0 -1
- package/dist/hooks.d.ts +0 -100
- package/dist/hooks.js +0 -558
- package/dist/hooks.js.map +0 -1
- package/dist/i18n.d.ts +0 -61
- package/dist/i18n.js +0 -860
- package/dist/i18n.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/padding-DY0JV5Ja.d.ts +0 -16
- package/dist/preferences.d.ts +0 -132
- package/dist/preferences.js +0 -262
- package/dist/preferences.js.map +0 -1
- package/dist/props.d.ts +0 -86
- package/dist/props.js +0 -16
- package/dist/props.js.map +0 -1
- package/dist/size-CQwNvOWd.d.ts +0 -19
- package/dist/types-LTj-2bl-.d.ts +0 -30
- package/dist/useTableViews-D5NIAJ7h.d.ts +0 -154
- package/src/tokens/tailwind.css +0 -158
package/README.md
CHANGED
|
@@ -1,181 +1,140 @@
|
|
|
1
1
|
# @godxjp/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The shared React UI framework for every godx surface (admin, agency portal,
|
|
4
|
+
handheld). Built on shadcn + Radix UI + Tailwind CSS v4.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](src/)
|
|
8
|
-
|
|
9
|
-
`@godxjp/ui` is the **single source of visual truth** for the GoDX platform.
|
|
10
|
-
Every service frontend (admin-platform, forge-service, console-service, me-service,
|
|
11
|
-
chat-service, knowledge-service, …) consumes this package. No service reimplements
|
|
12
|
-
a button, dialog, sidebar, or design token.
|
|
13
|
-
|
|
14
|
-
The framework enforces three Japanese-enterprise design principles:
|
|
15
|
-
|
|
16
|
-
| Principle | Meaning | What it enforces |
|
|
17
|
-
|---|---|---|
|
|
18
|
-
| **渋み** (shibumi) | Restrained elegance | OKLCH primary chroma ≤ 0.18. No neon. No gradients on functional UI. |
|
|
19
|
-
| **間** (ma) | Vertical breathing room | Body `line-height: 1.7`. Generous spacing. Density toggle for dense tables. |
|
|
20
|
-
| **簡素** (kanso) | Simplicity | Three font weights: 400 (body), 500 (heading), 700 (emphasis). No 600 in new code. |
|
|
6
|
+
Location: `packages/godx-ui/` (linked into the app as a `file:` dependency at
|
|
7
|
+
`@godxjp/ui`).
|
|
21
8
|
|
|
22
9
|
---
|
|
23
10
|
|
|
24
|
-
##
|
|
11
|
+
## Role & boundary — read this first
|
|
25
12
|
|
|
26
|
-
|
|
13
|
+
This package is **the single source of UI truth**. It is shared, versioned
|
|
14
|
+
infrastructure, which means two things are non-negotiable:
|
|
27
15
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<BrowserRouter>
|
|
38
|
-
<AppShell sidebar={<Sidebar nav={MY_NAV} />} topbar={<Topbar />}>
|
|
39
|
-
<Routes>{/* service-specific routes */}</Routes>
|
|
40
|
-
</AppShell>
|
|
41
|
-
</BrowserRouter>,
|
|
42
|
-
)
|
|
43
|
-
```
|
|
16
|
+
- **Editing it requires explicit session permission** (the hard gate — see
|
|
17
|
+
[DEVELOPMENT.md](./docs/DEVELOPMENT.md#0-what-this-package-is--and-the-boundary-it-must-keep)).
|
|
18
|
+
By default the package is off-limits; consumers _compose_ its primitives, they
|
|
19
|
+
don't fork them.
|
|
20
|
+
- **It is generic and presentational only.** No app i18n (`useTranslation`), no
|
|
21
|
+
Inertia (`router`/`<Form>`), no Wayfinder routes, no business entities or domain
|
|
22
|
+
logic, no product copy, no raw colors. Those are **consumer-layer** concerns — they
|
|
23
|
+
must never leak into this package. The framework ships **its own theme**, so a
|
|
24
|
+
consumer imports the styles and needs **zero** extra theme configuration.
|
|
44
25
|
|
|
45
|
-
|
|
26
|
+
> Deciding whether a component belongs here vs. app-level? Use the
|
|
27
|
+
> **`godx-ui-component-placement`** skill.
|
|
46
28
|
|
|
47
|
-
|
|
29
|
+
Full contributor rules: **[docs/DEVELOPMENT.md](./docs/DEVELOPMENT.md)**.
|
|
48
30
|
|
|
49
|
-
|
|
31
|
+
---
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
inherit the full toolchain from this package:
|
|
33
|
+
## Architecture (bottom-up)
|
|
53
34
|
|
|
54
|
-
```js
|
|
55
|
-
// eslint.config.js — one line
|
|
56
|
-
export { default } from "@godxjp/ui/eslint-config"
|
|
57
35
|
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
src/tokens/ Design tokens — the single source of values
|
|
37
|
+
foundation.css :root + .dark: colors, fonts, type scale, spacing, radius, wa-iro
|
|
38
|
+
primitives/ Per-domain primitive tokens (card, table, control, badge, …)
|
|
39
|
+
src/styles/ CSS that styles components by [data-slot]; density.css = the one density knob
|
|
40
|
+
index.css Entry: fontsource → tailwindcss → @theme (token→utility map) → *-layout.css
|
|
41
|
+
src/components/ React components by group (data-display, data-entry, layout, feedback, …)
|
|
42
|
+
src/props/ Prop type system: vocabulary/ (atomic) + components/ + registry.ts
|
|
43
|
+
src/lib/ cn(), control-styles, variants
|
|
44
|
+
examples/ *.preview.tsx — Storybook-style stories
|
|
45
|
+
docs/primitives/ <component>/index.tsx demo + examples/ + generated .md
|
|
46
|
+
preview/ The preview app (vite, :6008) rendering examples + docs
|
|
62
47
|
```
|
|
63
48
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
```ts
|
|
70
|
-
// vitest.config.ts
|
|
71
|
-
import base from "@godxjp/ui/vitest-config"
|
|
72
|
-
import { mergeConfig } from "vitest/config"
|
|
73
|
-
export default mergeConfig(base, { test: {} })
|
|
74
|
-
```
|
|
49
|
+
A value is defined **once** as a CSS var (`--primary`), mapped to a utility in the
|
|
50
|
+
`@theme` block (`--color-primary: hsl(var(--primary))`), and consumed as `bg-primary`.
|
|
51
|
+
Components emit `data-slot` / `data-*`; the look lives in `styles/*-layout.css`. See
|
|
52
|
+
[DEVELOPMENT.md §1](./docs/DEVELOPMENT.md#1-architecture--the-layers-bottom-up).
|
|
75
53
|
|
|
76
54
|
---
|
|
77
55
|
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
| Import
|
|
81
|
-
|
|
82
|
-
| `@godxjp/ui`
|
|
83
|
-
| `@godxjp/ui/
|
|
84
|
-
| `@godxjp/ui/
|
|
85
|
-
| `@godxjp/ui/
|
|
86
|
-
| `@godxjp/ui/
|
|
87
|
-
| `@godxjp/ui/
|
|
88
|
-
| `@godxjp/ui/
|
|
89
|
-
| `@godxjp/ui/
|
|
90
|
-
| `@godxjp/ui/
|
|
91
|
-
| `@godxjp/ui/
|
|
92
|
-
| `@godxjp/ui/
|
|
93
|
-
| `@godxjp/ui/eslint-config` | Shared ESLint flat config |
|
|
94
|
-
| `@godxjp/ui/prettier-config` | Shared Prettier config |
|
|
95
|
-
| `@godxjp/ui/tsconfig` | Strict TypeScript base |
|
|
96
|
-
| `@godxjp/ui/vitest-config` | Vitest base with jsdom + coverage thresholds |
|
|
56
|
+
## Component groups
|
|
57
|
+
|
|
58
|
+
| Group | Import | Examples |
|
|
59
|
+
| ------------------ | ------------------------- | ------------------------------------------------------------------------------- |
|
|
60
|
+
| **Layout** | `@godxjp/ui/layout` | `PageContainer`, `Stack`, `Inline`, `ResponsiveGrid` |
|
|
61
|
+
| **General** | `@godxjp/ui/general` | `Button` |
|
|
62
|
+
| **Data Entry** | `@godxjp/ui/data-entry` | `Input`, `Select`, `FormField`, `DatePicker`, `Switch` |
|
|
63
|
+
| **Data Display** | `@godxjp/ui/data-display` | `Table`, `DataTable`, `Card`, `Badge`, `KeyValueGrid`, `Timeline`, `EmptyState` |
|
|
64
|
+
| **Feedback** | `@godxjp/ui/feedback` | `Dialog`, `Sheet`, `Toast`, `Skeleton`, `Alert` |
|
|
65
|
+
| **Query** | `@godxjp/ui/query` | `DataState`, `InfiniteQueryState`, `PrefetchLink`, `MutationFeedback` |
|
|
66
|
+
| **Navigation** | `@godxjp/ui/navigation` | `Tabs`, `FilterBar`, `DropdownMenu`, `Steps`, `Pagination`, `LocalePicker` |
|
|
67
|
+
| **App** | `@godxjp/ui/app` | `AppProvider`, `useDateTime` |
|
|
68
|
+
| **Datetime** | `@godxjp/ui/datetime` | `formatDate` (mandatory for display) |
|
|
69
|
+
| **shadcn paths** | `@godxjp/ui/ui` | Thin re-exports for shadcn-style imports |
|
|
70
|
+
| **Admin (legacy)** | `@godxjp/ui/admin` | Compound admin exports |
|
|
97
71
|
|
|
98
72
|
---
|
|
99
73
|
|
|
100
|
-
##
|
|
101
|
-
|
|
102
|
-
| Component | Radix backing | A11y | Status |
|
|
103
|
-
|---|---|---|---|
|
|
104
|
-
| `Badge` | — | WCAG 2.1 AA | production |
|
|
105
|
-
| `Button` | `@radix-ui/react-slot` | focus-visible, keyboard | production |
|
|
106
|
-
| `Card` | — | — | production |
|
|
107
|
-
| `Input`, `Textarea` | — | aria-invalid, label wire | production |
|
|
108
|
-
| `Label` | `@radix-ui/react-label` | for/id | production |
|
|
109
|
-
| `Tabs`, `Tabs`, `Tabs`, `Tabs` | `@radix-ui/react-tabs` | roving tabindex | production |
|
|
110
|
-
| `Avatar` | — | aria-label | production |
|
|
111
|
-
| `Separator` | `@radix-ui/react-separator` | role separator | production |
|
|
112
|
-
| `Popover`, `Popover`, `Popover` | `@radix-ui/react-popover` | focus trap | production |
|
|
113
|
-
| `DropdownMenu` family | `@radix-ui/react-dropdown-menu` | keyboard nav | production |
|
|
114
|
-
| `Calendar` | `react-day-picker` | ARIA grid | production |
|
|
115
|
-
| `TimeInput` | — | aria-invalid | production |
|
|
116
|
-
| `Dialog` family | `@radix-ui/react-dialog` | focus trap, aria-modal | production |
|
|
117
|
-
| `Sheet` family | `@radix-ui/react-dialog` | focus trap, aria-modal | production |
|
|
118
|
-
| `AlertDialog` family | `@radix-ui/react-alert-dialog` | focus trap | production |
|
|
119
|
-
| `Select` family | `@radix-ui/react-select` | keyboard nav | production |
|
|
120
|
-
| `Switch` | `@radix-ui/react-switch` | role switch | production |
|
|
121
|
-
| `Checkbox` | `@radix-ui/react-checkbox` | role checkbox | production |
|
|
122
|
-
| `Table` family | — | role table | production |
|
|
123
|
-
| `Combobox` family | `cmdk` + Popover | keyboard nav | production |
|
|
124
|
-
| `Toaster`, `toast` | `sonner` | aria-live | production |
|
|
125
|
-
| `Skeleton` | — | aria-hidden | production |
|
|
126
|
-
| `Breadcrumb`, `Breadcrumb`, `Breadcrumb` | — | aria-label, aria-current | production |
|
|
74
|
+
## Consumer setup — theme is self-contained
|
|
127
75
|
|
|
128
|
-
|
|
76
|
+
The framework ships colors, fonts (M PLUS 2 via `@fontsource`), the type scale, and
|
|
77
|
+
the wa-iro palette. A consumer's entire styling surface is **one import + content
|
|
78
|
+
sources** — no `:root` overrides, no font `<link>`:
|
|
129
79
|
|
|
130
|
-
|
|
80
|
+
```css
|
|
81
|
+
/* resources/css/app.css */
|
|
82
|
+
@import "@godxjp/ui/styles";
|
|
83
|
+
@source '../js/**/*.{ts,tsx}';
|
|
84
|
+
@source '../views';
|
|
85
|
+
```
|
|
131
86
|
|
|
132
|
-
|
|
87
|
+
```tsx
|
|
88
|
+
import { AppProvider } from "@godxjp/ui/app"; // locale, tz, date/time format
|
|
89
|
+
import { PageContainer } from "@godxjp/ui/layout"; // every page wraps in this
|
|
90
|
+
```
|
|
133
91
|
|
|
134
|
-
|
|
135
|
-
|---|---|
|
|
136
|
-
| `ja` | production (primary) |
|
|
137
|
-
| `en` | production |
|
|
138
|
-
| `vi` | production |
|
|
139
|
-
| `fil` | production (added v3.0.0) |
|
|
92
|
+
### Mandatory consumer rules
|
|
140
93
|
|
|
141
|
-
|
|
94
|
+
1. **Every page** uses `<PageContainer title subtitle extra footer>`.
|
|
95
|
+
2. **Mobile-first** — verify at 320–390px in preview / browser.
|
|
96
|
+
3. **Spacing via `Stack`/`Inline` `gap` + `ResponsiveGrid`** — no Tailwind `p-*` /
|
|
97
|
+
`gap-*` / `space-x|y-*` for app layout (see `docs/SPACING.md`).
|
|
98
|
+
4. **Semantic tokens only** — no raw colors / hex / `dark:` overrides.
|
|
99
|
+
5. **Dates** display via `formatDate` from `@godxjp/ui/datetime`.
|
|
100
|
+
6. **`AppProvider`** wraps the app for locale / timezone / date-time format.
|
|
101
|
+
7. **Audit** — `npm run ui:audit` must report 0 errors for touched files.
|
|
102
|
+
|
|
103
|
+
Full app-developer rules: [ui-standardization.md](../../.claude/skills/frontend-design/rules/ui-standardization.md).
|
|
142
104
|
|
|
143
105
|
---
|
|
144
106
|
|
|
145
|
-
##
|
|
107
|
+
## Golden ratio (φ ≈ 1.618)
|
|
146
108
|
|
|
147
|
-
|
|
148
|
-
|
|
109
|
+
One token `--phi-unit` drives page/section/card spacing; micro control gaps use the
|
|
110
|
+
4px grid. Density (`compact` | `default` | `comfortable`) retunes `--phi-unit` with
|
|
111
|
+
control + table heights together.
|
|
149
112
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
113
|
+
| App API | φ level |
|
|
114
|
+
| ------------------- | ------------------- |
|
|
115
|
+
| `<Stack gap="md">` | φ⁰ (default) |
|
|
116
|
+
| `<Stack gap="lg">` | φ¹ |
|
|
117
|
+
| `<Stack gap="xl">` | φ² |
|
|
118
|
+
| Card shell / footer | base × φ / base ÷ φ |
|
|
156
119
|
|
|
157
120
|
---
|
|
158
121
|
|
|
159
|
-
##
|
|
160
|
-
|
|
161
|
-
| Service | Status | Notes |
|
|
162
|
-
|---|---|---|
|
|
163
|
-
| `calendar-service/frontend` | adopted | Greenfield; compliant from first commit. |
|
|
164
|
-
| `forge-service/frontend` | adopting (phase 1) | Reference implementation for migration pattern. |
|
|
165
|
-
| `admin-platform/frontend` | partial | Omnify tokens overlap ~90%; full migration pending. |
|
|
166
|
-
| `me-service/frontend` | adopting | Plan #31 R6 — active migration. |
|
|
167
|
-
| `console-service/frontend` | adopting | Epic #1412; AppShell + tokens wired. |
|
|
168
|
-
| `agent-service/frontend` | not started | Plan #21 G17. |
|
|
169
|
-
| `knowledge-service/frontend` | not started | Plan #18 K-phase. |
|
|
170
|
-
| `chat-service/frontend` | adopting | Plan #30 completion phase. |
|
|
122
|
+
## Working on the framework
|
|
171
123
|
|
|
172
|
-
|
|
124
|
+
```bash
|
|
125
|
+
pnpm preview # preview app → http://localhost:6008 (fixed port, kills stale)
|
|
126
|
+
pnpm preview:build # static build — the integration test for examples + docs
|
|
127
|
+
pnpm docs:sync-primitives # regenerate docs/primitives/**/*.md from source
|
|
128
|
+
pnpm typecheck && pnpm audit && pnpm test
|
|
129
|
+
```
|
|
173
130
|
|
|
174
|
-
|
|
131
|
+
→ **[docs/DEVELOPMENT.md](./docs/DEVELOPMENT.md)** is the contributor guideline (the
|
|
132
|
+
boundary, the layers, how to add/extend a component, verification).
|
|
175
133
|
|
|
176
|
-
|
|
177
|
-
Breaking changes require a cross-service audit + major bump.
|
|
178
|
-
See [`CHANGELOG.md`](CHANGELOG.md) for the full history.
|
|
134
|
+
## Docs index
|
|
179
135
|
|
|
180
|
-
|
|
181
|
-
|
|
136
|
+
- [docs/DEVELOPMENT.md](./docs/DEVELOPMENT.md) — contributor guideline (start here to edit the package)
|
|
137
|
+
- [docs/COMPONENTS.md](./docs/COMPONENTS.md) · [docs/TOKENS.md](./docs/TOKENS.md) · [docs/SPACING.md](./docs/SPACING.md)
|
|
138
|
+
- [docs/PROPS-VOCABULARY.md](./docs/PROPS-VOCABULARY.md) · [docs/PROPS-REGISTRY.md](./docs/PROPS-REGISTRY.md)
|
|
139
|
+
- [docs/DATETIME.md](./docs/DATETIME.md) · [docs/FORMS.md](./docs/FORMS.md) · [docs/TESTING.md](./docs/TESTING.md)
|
|
140
|
+
- MCP: **godxjp-ui-mcp** (`.mcp.json`)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { h as AppLocale, j as AppTimeFormat, g as AppDateFormat, k as AppTimezone, i as AppRequestHeaders } from '../types-mvzYGrma.js';
|
|
2
|
+
export { A as APP_DATE_FORMATS, a as APP_LOCALES, b as APP_REQUEST_HEADER_DATE_FORMAT, c as APP_REQUEST_HEADER_LOCALE, d as APP_REQUEST_HEADER_TIMEZONE, e as APP_REQUEST_HEADER_TIME_FORMAT, f as APP_TIME_FORMATS, l as AppTimezoneDefault, m as getDatePattern, n as getDateTimePattern, o as getTimePattern, p as isAppDateFormat, q as isAppTimeFormat } from '../types-mvzYGrma.js';
|
|
3
|
+
import * as react_day_picker from 'react-day-picker';
|
|
4
|
+
import * as date_fns from 'date-fns';
|
|
5
|
+
import { Locale } from 'date-fns';
|
|
6
|
+
import { vi } from 'react-day-picker/locale';
|
|
7
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
+
import { a as AppProviderProp, A as AppContextValue } from '../app.prop-IobwLwaM.js';
|
|
9
|
+
import { j as formatDate, a as FormatDateOptions } from '../format-date-ByyZoqI5.js';
|
|
10
|
+
export { F as FormatDateKind, b as FormatDatetimeOptions, d as detectFormatDateKind, f as formatAppDate, c as formatAppDateLong, e as formatAppDateTime, g as formatAppRelative, h as formatAppTime, i as formatCalendarDate, k as formatTimeOfDay, m as isFormatDateValue } from '../format-date-ByyZoqI5.js';
|
|
11
|
+
export { getDatetimeContext, isValidHhmm, normalizeHhmm, parseDateInput, syncDatetimeContext } from '../lib/datetime/index.js';
|
|
12
|
+
export { usePickerLocales, useTranslation } from '../i18n/index.js';
|
|
13
|
+
import '../shared.prop-BNRJc9K0.js';
|
|
14
|
+
import 'react';
|
|
15
|
+
import '@date-fns/tz';
|
|
16
|
+
|
|
17
|
+
type AppLocaleConfig = {
|
|
18
|
+
code: AppLocale;
|
|
19
|
+
dateFns: Locale;
|
|
20
|
+
dayPicker: typeof vi;
|
|
21
|
+
};
|
|
22
|
+
declare const APP_LOCALE_CONFIG: Record<AppLocale, AppLocaleConfig>;
|
|
23
|
+
declare function isAppLocale(value: string | null | undefined): value is AppLocale;
|
|
24
|
+
declare function getDateFnsLocale(locale: AppLocale): Locale;
|
|
25
|
+
declare function getDayPickerLocale(locale: AppLocale): react_day_picker.DayPickerLocale;
|
|
26
|
+
|
|
27
|
+
/** Curated preset — pass to `<AppProvider timezoneOptions={APP_TIMEZONE_PRESET} />`. */
|
|
28
|
+
declare const APP_TIMEZONE_PRESET: readonly ["UTC", "Asia/Ho_Chi_Minh", "Asia/Bangkok", "Asia/Singapore", "Asia/Jakarta", "Asia/Manila", "Asia/Kuala_Lumpur", "Asia/Yangon", "Asia/Phnom_Penh", "Asia/Vientiane", "Asia/Brunei", "Asia/Tokyo", "Asia/Seoul", "Asia/Shanghai", "Asia/Hong_Kong", "Asia/Taipei", "Asia/Ulaanbaatar", "Asia/Kolkata", "Asia/Karachi", "Asia/Dhaka", "Asia/Colombo", "Asia/Dubai", "Asia/Riyadh", "Asia/Qatar", "Asia/Tehran", "Asia/Jerusalem", "Europe/London", "Europe/Paris", "Europe/Berlin", "Europe/Amsterdam", "Europe/Rome", "Europe/Madrid", "Europe/Moscow", "Europe/Istanbul", "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles", "America/Toronto", "America/Vancouver", "America/Mexico_City", "America/Sao_Paulo", "America/Buenos_Aires", "Australia/Sydney", "Australia/Melbourne", "Australia/Perth", "Pacific/Auckland"];
|
|
29
|
+
/** @deprecated Use `APP_TIMEZONE_PRESET` or `getAllIanaTimezones()`. */
|
|
30
|
+
declare const APP_TIMEZONE_OPTIONS: readonly ["UTC", "Asia/Ho_Chi_Minh", "Asia/Bangkok", "Asia/Singapore", "Asia/Jakarta", "Asia/Manila", "Asia/Kuala_Lumpur", "Asia/Yangon", "Asia/Phnom_Penh", "Asia/Vientiane", "Asia/Brunei", "Asia/Tokyo", "Asia/Seoul", "Asia/Shanghai", "Asia/Hong_Kong", "Asia/Taipei", "Asia/Ulaanbaatar", "Asia/Kolkata", "Asia/Karachi", "Asia/Dhaka", "Asia/Colombo", "Asia/Dubai", "Asia/Riyadh", "Asia/Qatar", "Asia/Tehran", "Asia/Jerusalem", "Europe/London", "Europe/Paris", "Europe/Berlin", "Europe/Amsterdam", "Europe/Rome", "Europe/Madrid", "Europe/Moscow", "Europe/Istanbul", "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles", "America/Toronto", "America/Vancouver", "America/Mexico_City", "America/Sao_Paulo", "America/Buenos_Aires", "Australia/Sydney", "Australia/Melbourne", "Australia/Perth", "Pacific/Auckland"];
|
|
31
|
+
type AppTimezonePreset = (typeof APP_TIMEZONE_PRESET)[number];
|
|
32
|
+
/**
|
|
33
|
+
* Preferred IANA ids not returned by all runtimes (e.g. Node lists `Asia/Saigon` only).
|
|
34
|
+
* Keys are app-facing ids; values are Intl-canonical ids for offset lookup.
|
|
35
|
+
*/
|
|
36
|
+
declare const TIMEZONE_ALIASES: Record<string, string>;
|
|
37
|
+
/** Map app id → Intl id for `DateTimeFormat` / validation. */
|
|
38
|
+
declare function resolveTimezoneForIntl(timezone: string): string;
|
|
39
|
+
/** Full IANA list from runtime — sorted lexicographically. */
|
|
40
|
+
declare function getAllIanaTimezones(): readonly string[];
|
|
41
|
+
declare function isValidIanaTimezone(value: string): boolean;
|
|
42
|
+
/** @deprecated Use `isValidIanaTimezone`. */
|
|
43
|
+
declare function isKnownAppTimezone(value: string): value is AppTimezonePreset;
|
|
44
|
+
/**
|
|
45
|
+
* Options for TimezonePicker.
|
|
46
|
+
* - `configured` omitted/empty → full IANA list
|
|
47
|
+
* - `configured` set → only those ids (+ `current` if missing)
|
|
48
|
+
*/
|
|
49
|
+
declare function resolveTimezonePickerOptions(configured?: readonly string[] | null, current?: string): readonly string[];
|
|
50
|
+
declare function getBrowserTimezone(): string;
|
|
51
|
+
/** City/region segment from IANA id — `Asia/Ho_Chi_Minh` → `Ho Chi Minh`. */
|
|
52
|
+
declare function getTimezoneCityName(timezone: string): string;
|
|
53
|
+
/** UTC/GMT offset via Intl — e.g. `GMT+7`, `UTC`. */
|
|
54
|
+
declare function getTimezoneOffsetLabel(timezone: string, locale?: AppLocale): string;
|
|
55
|
+
/** Intl fallback when no i18n override — `Ho Chi Minh (GMT+7)`. */
|
|
56
|
+
declare function formatTimezoneDisplayLabel(timezone: string, locale?: AppLocale): string;
|
|
57
|
+
declare function getTimezoneLabel(timezone: string, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
58
|
+
declare function resolveDefaultTimezone(defaultTimezone: "browser" | "system" | (string & {}), systemTimezone?: string): string;
|
|
59
|
+
/** Vitest only — reset cached IANA list between cases. */
|
|
60
|
+
declare function resetIanaTimezoneCacheForTests(): void;
|
|
61
|
+
|
|
62
|
+
declare const APP_TIME_FORMAT_OPTIONS: {
|
|
63
|
+
value: "24h" | "12h";
|
|
64
|
+
}[];
|
|
65
|
+
declare function getTimeFormatLabel(timeFormat: AppTimeFormat, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
66
|
+
/** Suggested default per locale — vi/ja → 24h, en → 12h. */
|
|
67
|
+
declare function resolveDefaultTimeFormat(locale: AppLocale): AppTimeFormat;
|
|
68
|
+
|
|
69
|
+
declare const APP_DATE_FORMAT_OPTIONS: {
|
|
70
|
+
value: "iso" | "dmy" | "mdy";
|
|
71
|
+
}[];
|
|
72
|
+
declare function getDateFormatLabel(dateFormat: AppDateFormat, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
73
|
+
/** Suggested default per locale — vi → dmy, ja → iso, en → mdy. */
|
|
74
|
+
declare function resolveDefaultDateFormat(locale: AppLocale): AppDateFormat;
|
|
75
|
+
|
|
76
|
+
declare const DEFAULT_STORAGE_KEY = "godxjp.app";
|
|
77
|
+
type StoredAppPreferences = {
|
|
78
|
+
locale?: AppLocale;
|
|
79
|
+
timezone?: AppTimezone;
|
|
80
|
+
timeFormat?: AppTimeFormat;
|
|
81
|
+
dateFormat?: AppDateFormat;
|
|
82
|
+
};
|
|
83
|
+
declare function readStoredPreferences(storageKey: string): StoredAppPreferences;
|
|
84
|
+
declare function writeStoredPreferences(storageKey: string, preferences: StoredAppPreferences): void;
|
|
85
|
+
|
|
86
|
+
/** Sync locale/timezone into module state for HTTP clients (via `getAppRequestHeaders`). */
|
|
87
|
+
declare function syncAppRequestHeaders(headers: Partial<AppRequestHeaders>): void;
|
|
88
|
+
/** Read current app preference headers — wire to API client `setAppHeaderProvider`. */
|
|
89
|
+
declare function getAppRequestHeaders(): AppRequestHeaders;
|
|
90
|
+
/** Reset to defaults — for tests only. */
|
|
91
|
+
declare function resetAppRequestHeaders(): void;
|
|
92
|
+
|
|
93
|
+
declare function AppProvider({ children, defaultLocale, fallbackLocale, defaultTimezone, systemTimezone, defaultTimeFormat, defaultDateFormat, timezoneOptions, storageKey, persist, onLocaleChange, onTimezoneChange, onTimeFormatChange, onDateFormatChange, }: AppProviderProp): react_jsx_runtime.JSX.Element;
|
|
94
|
+
declare function useAppContext(): AppContextValue;
|
|
95
|
+
/** Returns null outside AppProvider — used by pickers for optional context. */
|
|
96
|
+
declare function useOptionalAppContext(): AppContextValue | null;
|
|
97
|
+
/** Shorthand for `{ locale, setLocale }`. */
|
|
98
|
+
declare function useAppLocale(): {
|
|
99
|
+
locale: AppLocale;
|
|
100
|
+
fallbackLocale: AppLocale;
|
|
101
|
+
setLocale: (locale: AppLocale) => void;
|
|
102
|
+
dateFnsLocale: date_fns.Locale;
|
|
103
|
+
dayPickerLocale: Partial<react_day_picker.DayPickerLocale>;
|
|
104
|
+
};
|
|
105
|
+
/** Shorthand for `{ timezone, setTimezone }`. */
|
|
106
|
+
declare function useAppTimezone(): {
|
|
107
|
+
timezone: string;
|
|
108
|
+
setTimezone: (timezone: AppTimezone) => void;
|
|
109
|
+
};
|
|
110
|
+
/** Shorthand for `{ timeFormat, setTimeFormat }`. */
|
|
111
|
+
declare function useAppTimeFormat(): {
|
|
112
|
+
timeFormat: AppTimeFormat;
|
|
113
|
+
setTimeFormat: (timeFormat: AppTimeFormat) => void;
|
|
114
|
+
};
|
|
115
|
+
/** Shorthand for `{ dateFormat, setDateFormat }`. */
|
|
116
|
+
declare function useAppDateFormat(): {
|
|
117
|
+
dateFormat: AppDateFormat;
|
|
118
|
+
setDateFormat: (dateFormat: AppDateFormat) => void;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Date/time formatters bound to the current AppProvider preferences. */
|
|
122
|
+
declare function useFormatting(): {
|
|
123
|
+
locale: AppLocale;
|
|
124
|
+
timezone: string;
|
|
125
|
+
timeFormat: AppTimeFormat;
|
|
126
|
+
dateFormat: AppDateFormat;
|
|
127
|
+
/** Primary formatter — auto-detect + AppProvider defaults. */
|
|
128
|
+
format: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
129
|
+
formatDate: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
130
|
+
formatCalendarDate: (value: Date | null | undefined, options?: FormatDateOptions) => string;
|
|
131
|
+
formatTime: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
132
|
+
formatDateTime: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
133
|
+
formatDateLong: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
134
|
+
formatRelative: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
135
|
+
formatTimeOfDay: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
136
|
+
};
|
|
137
|
+
/** Alias for useFormatting — emphasises timezone-aware datetime helpers. */
|
|
138
|
+
declare const useDateTime: typeof useFormatting;
|
|
139
|
+
|
|
140
|
+
export { APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_TIMEZONE_OPTIONS, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppDateFormat, AppLocale, type AppLocaleConfig, AppProvider, AppRequestHeaders, AppTimeFormat, AppTimezone, type AppTimezonePreset, DEFAULT_STORAGE_KEY, FormatDateOptions, type StoredAppPreferences, TIMEZONE_ALIASES, formatDate, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getDateFnsLocale, getDateFormatLabel, getDayPickerLocale, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isAppLocale, isKnownAppTimezone, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultDateFormat, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useDateTime, useFormatting, useOptionalAppContext, writeStoredPreferences };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useAppContext } from '../chunk-3F2AKYRD.js';
|
|
2
|
+
export { APP_LOCALES, APP_REQUEST_HEADER_LOCALE, APP_REQUEST_HEADER_TIMEZONE, APP_TIMEZONE_OPTIONS, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppProvider, DEFAULT_STORAGE_KEY, TIMEZONE_ALIASES, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isKnownAppTimezone, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useOptionalAppContext, usePickerLocales, useTranslation, writeStoredPreferences } from '../chunk-3F2AKYRD.js';
|
|
3
|
+
import { formatDate } from '../chunk-YFCQKO3B.js';
|
|
4
|
+
export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, detectFormatDateKind, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, isAppDateFormat, isAppLocale, isAppTimeFormat, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resolveDefaultDateFormat, syncDatetimeContext } from '../chunk-YFCQKO3B.js';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
function useFormatting() {
|
|
8
|
+
const { locale, timezone, timeFormat, dateFormat, dateFnsLocale } = useAppContext();
|
|
9
|
+
const defaults = useMemo(
|
|
10
|
+
() => ({ locale: dateFnsLocale, timezone, timeFormat, dateFormat }),
|
|
11
|
+
[dateFnsLocale, timezone, timeFormat, dateFormat]
|
|
12
|
+
);
|
|
13
|
+
const bind = useMemo(
|
|
14
|
+
() => (value, options) => formatDate(value, { ...defaults, ...options }),
|
|
15
|
+
[defaults]
|
|
16
|
+
);
|
|
17
|
+
return useMemo(
|
|
18
|
+
() => ({
|
|
19
|
+
locale,
|
|
20
|
+
timezone,
|
|
21
|
+
timeFormat,
|
|
22
|
+
dateFormat,
|
|
23
|
+
/** Primary formatter — auto-detect + AppProvider defaults. */
|
|
24
|
+
format: bind,
|
|
25
|
+
formatDate: bind,
|
|
26
|
+
formatCalendarDate: (value, options) => formatDate(value, { ...defaults, ...options, kind: "calendar" }),
|
|
27
|
+
formatTime: (value, options) => formatDate(value, { ...defaults, ...options, kind: "time" }),
|
|
28
|
+
formatDateTime: (value, options) => formatDate(value, { ...defaults, ...options, kind: "datetime" }),
|
|
29
|
+
formatDateLong: (value, options) => formatDate(value, { ...defaults, ...options, kind: "long" }),
|
|
30
|
+
formatRelative: (value, options) => formatDate(value, { ...defaults, ...options, kind: "relative" }),
|
|
31
|
+
formatTimeOfDay: (value, options) => formatDate(value, { ...defaults, ...options, kind: "time" })
|
|
32
|
+
}),
|
|
33
|
+
[locale, timezone, timeFormat, dateFormat, defaults, bind]
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
var useDateTime = useFormatting;
|
|
37
|
+
|
|
38
|
+
export { useDateTime, useFormatting };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Locale } from 'date-fns';
|
|
2
|
+
import { DayPickerProps } from 'react-day-picker';
|
|
3
|
+
import { h as AppLocale, l as AppTimezoneDefault, k as AppTimezone, j as AppTimeFormat, g as AppDateFormat, i as AppRequestHeaders } from './types-mvzYGrma.js';
|
|
4
|
+
import { C as ChildrenProp, a as ClassNameProp, D as DisabledProp, I as IdProp } from './shared.prop-BNRJc9K0.js';
|
|
5
|
+
|
|
6
|
+
/** App shell prop types — @see docs/COMPONENTS.md#app */
|
|
7
|
+
|
|
8
|
+
/** @see AppProvider */
|
|
9
|
+
type AppProviderProp = {
|
|
10
|
+
children: ChildrenProp;
|
|
11
|
+
/** Initial locale when nothing in storage. Default: `vi`. */
|
|
12
|
+
defaultLocale?: AppLocale;
|
|
13
|
+
/** Fallback when a translation key is missing. Default: `en`. */
|
|
14
|
+
fallbackLocale?: AppLocale;
|
|
15
|
+
/** Initial timezone: IANA id, `browser`, or `system`. Default: `browser`. */
|
|
16
|
+
defaultTimezone?: AppTimezoneDefault;
|
|
17
|
+
/** Backend/system timezone when `defaultTimezone` is `system`. */
|
|
18
|
+
systemTimezone?: AppTimezone;
|
|
19
|
+
/** Initial clock format. `"locale"` derives from `defaultLocale`. Default: `"locale"`. */
|
|
20
|
+
defaultTimeFormat?: AppTimeFormat | "locale";
|
|
21
|
+
/** Initial date display format. `"locale"` derives from `defaultLocale`. Default: `"locale"`. */
|
|
22
|
+
defaultDateFormat?: AppDateFormat | "locale";
|
|
23
|
+
/**
|
|
24
|
+
* IANA ids shown in `TimezonePicker`.
|
|
25
|
+
* Omit for the full IANA list; set to restrict (e.g. `APP_TIMEZONE_PRESET`).
|
|
26
|
+
*/
|
|
27
|
+
timezoneOptions?: readonly AppTimezone[];
|
|
28
|
+
/** localStorage key. Default: `godxjp.app`. */
|
|
29
|
+
storageKey?: string;
|
|
30
|
+
/** Persist user choices. Default: true. */
|
|
31
|
+
persist?: boolean;
|
|
32
|
+
onLocaleChange?: (locale: AppLocale) => void;
|
|
33
|
+
onTimezoneChange?: (timezone: AppTimezone) => void;
|
|
34
|
+
onTimeFormatChange?: (timeFormat: AppTimeFormat) => void;
|
|
35
|
+
onDateFormatChange?: (dateFormat: AppDateFormat) => void;
|
|
36
|
+
};
|
|
37
|
+
/** @see LocalePicker */
|
|
38
|
+
type LocalePickerProp = {
|
|
39
|
+
className?: ClassNameProp;
|
|
40
|
+
disabled?: DisabledProp;
|
|
41
|
+
id?: IdProp;
|
|
42
|
+
/** Controlled value; default reads/writes AppProvider. */
|
|
43
|
+
value?: AppLocale;
|
|
44
|
+
onChange?: (locale: AppLocale) => void;
|
|
45
|
+
};
|
|
46
|
+
/** @see TimezonePicker */
|
|
47
|
+
type TimezonePickerProp = {
|
|
48
|
+
className?: ClassNameProp;
|
|
49
|
+
disabled?: DisabledProp;
|
|
50
|
+
id?: IdProp;
|
|
51
|
+
value?: AppTimezone;
|
|
52
|
+
onChange?: (timezone: AppTimezone) => void;
|
|
53
|
+
/** Override AppProvider list; omit to use context or full IANA. */
|
|
54
|
+
options?: readonly AppTimezone[];
|
|
55
|
+
};
|
|
56
|
+
/** @see TimeFormatPicker */
|
|
57
|
+
type TimeFormatPickerProp = {
|
|
58
|
+
className?: ClassNameProp;
|
|
59
|
+
disabled?: DisabledProp;
|
|
60
|
+
id?: IdProp;
|
|
61
|
+
value?: AppTimeFormat;
|
|
62
|
+
onChange?: (timeFormat: AppTimeFormat) => void;
|
|
63
|
+
};
|
|
64
|
+
/** @see DateFormatPicker */
|
|
65
|
+
type DateFormatPickerProp = {
|
|
66
|
+
className?: ClassNameProp;
|
|
67
|
+
disabled?: DisabledProp;
|
|
68
|
+
id?: IdProp;
|
|
69
|
+
value?: AppDateFormat;
|
|
70
|
+
onChange?: (dateFormat: AppDateFormat) => void;
|
|
71
|
+
};
|
|
72
|
+
/** Value exposed by `useAppContext`. */
|
|
73
|
+
type AppContextValue = {
|
|
74
|
+
locale: AppLocale;
|
|
75
|
+
fallbackLocale: AppLocale;
|
|
76
|
+
timezone: AppTimezone;
|
|
77
|
+
timeFormat: AppTimeFormat;
|
|
78
|
+
dateFormat: AppDateFormat;
|
|
79
|
+
dateFnsLocale: Locale;
|
|
80
|
+
dayPickerLocale: NonNullable<DayPickerProps["locale"]>;
|
|
81
|
+
requestHeaders: AppRequestHeaders;
|
|
82
|
+
/** Configured picker list; `undefined` → full IANA in TimezonePicker. */
|
|
83
|
+
timezoneOptions?: readonly AppTimezone[];
|
|
84
|
+
setLocale: (locale: AppLocale) => void;
|
|
85
|
+
setTimezone: (timezone: AppTimezone) => void;
|
|
86
|
+
setTimeFormat: (timeFormat: AppTimeFormat) => void;
|
|
87
|
+
setDateFormat: (dateFormat: AppDateFormat) => void;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type { AppContextValue as A, DateFormatPickerProp as D, LocalePickerProp as L, TimeFormatPickerProp as T, AppProviderProp as a, TimezonePickerProp as b };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { c as CheckboxGroupProp } from './data-entry.prop-BEGA1lTq.js';
|
|
5
|
+
|
|
6
|
+
declare function CheckboxGroup({ value: controlledValue, defaultValue, onChange, options, orientation, disabled, name, className, children, }: CheckboxGroupProp): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
/** Checkbox — dùng standalone hoặc `Checkbox.Group` với `options` (Ant Design style). */
|
|
9
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>> & {
|
|
10
|
+
Group: typeof CheckboxGroup;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { Checkbox as C, CheckboxGroup as a };
|