@godxjp/ui 28.13.0 → 29.0.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/agent/START-HERE.md +29 -10
- package/agent/components/Anchor.json +6 -1
- package/agent/components/AppShell.json +1 -1
- package/agent/components/AreaChart.json +19 -1
- package/agent/components/BarChart.json +11 -1
- package/agent/components/Cascader.json +1 -1
- package/agent/components/CompactBarTrend.json +1 -1
- package/agent/components/DataState.json +1 -1
- package/agent/components/DataTable.json +4 -4
- package/agent/components/FormField.json +1 -1
- package/agent/components/InfiniteQueryState.json +1 -1
- package/agent/components/Input.json +1 -1
- package/agent/components/LineChart.json +20 -2
- package/agent/components/ListRow.json +1 -1
- package/agent/components/Masonry.json +1 -1
- package/agent/components/MasterDetail.json +1 -1
- package/agent/components/PasswordStrength.json +1 -1
- package/agent/components/PermissionMatrix.json +1 -1
- package/agent/components/Select.json +1 -0
- package/agent/components/Sidebar.json +1 -1
- package/agent/components/Table.json +8 -3
- package/agent/components/ThemeScope.json +49 -0
- package/agent/components/Topbar.json +1 -0
- package/agent/components/TopbarItem.json +2 -1
- package/agent/components/Transfer.json +1 -1
- package/agent/components/TreeSelect.json +1 -1
- package/agent/components/UploadCropDialog.json +1 -1
- package/agent/components/formatDate.json +1 -1
- package/agent/components-index.json +5 -0
- package/agent/components.json +138 -30
- package/agent/index.json +19 -9
- package/agent/llms.txt +10 -10
- package/agent/patterns/tenant-brand-color.json +28 -0
- package/agent/patterns-index.json +27 -0
- package/agent/patterns.json +28 -0
- package/agent/rules.json +15 -0
- package/agent/tokens.json +4965 -970
- package/dist/app/index.d.ts +3 -0
- package/dist/app/index.js +3 -0
- package/dist/app/tenant-theme.d.ts +80 -0
- package/dist/app/tenant-theme.js +154 -0
- package/dist/app/theme-axes.d.ts +14 -1
- package/dist/app/theme-axes.js +24 -31
- package/dist/components/charts/chart-cartesian.d.ts +5 -1
- package/dist/components/charts/chart-cartesian.js +15 -8
- package/dist/components/data-display/badge.d.ts +1 -1
- package/dist/components/data-display/badge.js +20 -2
- package/dist/components/data-display/carousel.js +4 -4
- package/dist/components/data-display/data-table.js +13 -2
- package/dist/components/data-display/permission-matrix.js +1 -1
- package/dist/components/data-display/table.d.ts +11 -2
- package/dist/components/data-display/table.js +18 -2
- package/dist/components/data-entry/control-appearance.d.ts +12 -6
- package/dist/components/data-entry/control-appearance.js +1 -1
- package/dist/components/data-entry/select.js +4 -3
- package/dist/components/feedback/dialog.js +6 -3
- package/dist/components/feedback/overlay-header-tone.d.ts +7 -0
- package/dist/components/feedback/overlay-header-tone.js +4 -4
- package/dist/components/feedback/sheet.d.ts +1 -1
- package/dist/components/feedback/sheet.js +6 -9
- package/dist/components/feedback/sonner.js +16 -3
- package/dist/components/general/button.js +22 -5
- package/dist/components/layout/affix.js +15 -1
- package/dist/components/layout/sidebar.js +7 -1
- package/dist/components/navigation/anchor.d.ts +1 -1
- package/dist/components/navigation/anchor.js +5 -4
- package/dist/components/navigation/app-setting-picker.js +1 -1
- package/dist/components/navigation/pagination.js +1 -1
- package/dist/components/navigation/tabs.js +15 -2
- package/dist/components/query/infinite-query-state.d.ts +22 -6
- package/dist/lib/control-styles.d.ts +31 -11
- package/dist/lib/control-styles.js +6 -6
- package/dist/lib/overlay-portal.d.ts +20 -0
- package/dist/lib/overlay-portal.js +93 -0
- package/dist/props/components/app.prop.d.ts +12 -0
- package/dist/props/components/charts.prop.d.ts +30 -0
- package/dist/props/components/index.d.ts +1 -1
- package/dist/props/components/navigation.prop.d.ts +21 -2
- package/dist/props/components/query.prop.d.ts +36 -2
- package/dist/props/registry.d.ts +46 -1
- package/dist/props/registry.js +38 -3
- package/dist/styles/alert-layout.css +34 -14
- package/dist/styles/badge-layout.css +10 -6
- package/dist/styles/base.css +14 -5
- package/dist/styles/card-layout.css +19 -8
- package/dist/styles/chart-layout.css +22 -3
- package/dist/styles/control.css +165 -59
- package/dist/styles/data-display-layout.css +129 -36
- package/dist/styles/data-entry-layout.css +23 -87
- package/dist/styles/dialog-layout.css +49 -19
- package/dist/styles/float-button-layout.css +5 -5
- package/dist/styles/focus-ring.css +9 -5
- package/dist/styles/layout.css +42 -15
- package/dist/styles/logo-layout.css +1 -1
- package/dist/styles/motion.css +1 -1
- package/dist/styles/navigation-layout.css +90 -29
- package/dist/styles/shell-layout.css +63 -40
- package/dist/styles/table-layout.css +56 -17
- package/dist/styles/text-layout.css +13 -4
- package/dist/styles/toggle.css +8 -2
- package/dist/tokens/components/actions.css +1 -1
- package/dist/tokens/components/attachments.css +4 -4
- package/dist/tokens/components/badge.css +4 -4
- package/dist/tokens/components/callout.css +1 -1
- package/dist/tokens/components/card.css +9 -4
- package/dist/tokens/components/chart.css +10 -1
- package/dist/tokens/components/chat-bubble.css +1 -1
- package/dist/tokens/components/control.css +28 -10
- package/dist/tokens/components/conversations.css +2 -1
- package/dist/tokens/components/data-display.css +12 -7
- package/dist/tokens/components/descriptions.css +1 -1
- package/dist/tokens/components/draggable-panel.css +1 -1
- package/dist/tokens/components/feedback.css +28 -8
- package/dist/tokens/components/float-button.css +1 -1
- package/dist/tokens/components/legal-document.css +1 -1
- package/dist/tokens/components/logo.css +1 -1
- package/dist/tokens/components/mega-menu.css +5 -3
- package/dist/tokens/components/navigation.css +21 -7
- package/dist/tokens/components/segmented.css +8 -3
- package/dist/tokens/components/shell.css +19 -5
- package/dist/tokens/components/table.css +9 -1
- package/dist/tokens/components/thought-chain.css +1 -1
- package/dist/tokens/components/toggle.css +2 -0
- package/dist/tokens/components/tree.css +3 -1
- package/dist/tokens/components/upload.css +6 -6
- package/dist/tokens/components/welcome.css +1 -1
- package/dist/tokens/foundation.css +28 -1
- package/docs/COMPOSITION-VS-COMPONENT.md +31 -0
- package/docs/CUSTOMER-THEMING.md +637 -1
- package/docs/FRAME-COVERAGE-REPORT.md +3 -2
- package/docs/GLASSMORPHISM-STANDARD.md +196 -0
- package/docs/THEME-API-COVERAGE.md +538 -0
- package/docs/TOKEN-RESOLUTION.md +195 -0
- package/docs/TOKENS.md +63 -24
- package/docs/asset-modules.d.ts +7 -0
- package/docs/data-display/charts.tsx +80 -0
- package/docs/data-display/data-table/index.tsx +30 -0
- package/docs/data-display/popover.tsx +1 -1
- package/docs/data-display/table.tsx +52 -0
- package/docs/feedback/sheet.tsx +10 -10
- package/docs/foundation/density.tsx +4 -4
- package/docs/i18n/messages/en.json +502 -0
- package/docs/i18n/messages/ja.json +502 -0
- package/docs/i18n/messages/vi.json +502 -0
- package/docs/layout/account-chip.tsx +2 -2
- package/docs/layout/responsive-grid.tsx +1 -1
- package/docs/navigation/toolbar.tsx +20 -12
- package/docs/providers/theme-scope.tsx +186 -0
- package/docs/showcase/caimono-price-comparison.tsx +911 -0
- package/docs/showcase/case4-login.tsx +2 -2
- package/docs/showcase/permission-matrix.tsx +13 -5
- package/docs/showcase/table-pagination.tsx +2 -1
- package/docs/showcase/tenant-brand-color.tsx +338 -0
- package/docs/showcase/theme-lab.tsx +2125 -0
- package/docs/themes/flat.css +462 -0
- package/docs/themes/glassmorphism.css +958 -0
- package/docs/themes/index.ts +200 -0
- package/package.json +4 -3
- package/scripts/explain-token.mjs +382 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { ThemeScope, tenantTheme } from "@godxjp/ui/app";
|
|
2
|
+
import {
|
|
3
|
+
Badge,
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
Popover,
|
|
10
|
+
PopoverContent,
|
|
11
|
+
PopoverTrigger,
|
|
12
|
+
} from "@godxjp/ui/data-display";
|
|
13
|
+
import { Select } from "@godxjp/ui/data-entry";
|
|
14
|
+
import {
|
|
15
|
+
Dialog,
|
|
16
|
+
DialogBody,
|
|
17
|
+
DialogContent,
|
|
18
|
+
DialogDescription,
|
|
19
|
+
DialogFooter,
|
|
20
|
+
DialogHeader,
|
|
21
|
+
DialogTitle,
|
|
22
|
+
DialogTrigger,
|
|
23
|
+
Toaster,
|
|
24
|
+
toast,
|
|
25
|
+
} from "@godxjp/ui/feedback";
|
|
26
|
+
import { Button, Text } from "@godxjp/ui/general";
|
|
27
|
+
import { useTranslation } from "@godxjp/ui/i18n";
|
|
28
|
+
import { Flex, PageContainer } from "@godxjp/ui/layout";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* ThemeScope · the region whose overlays keep the region's tokens (gh#877).
|
|
32
|
+
*
|
|
33
|
+
* The screen is a review queue handled on behalf of two customers at once — the case that makes
|
|
34
|
+
* the defect visible, because both regions are on the page together and every overlay they open
|
|
35
|
+
* used to come back in the package's own violet.
|
|
36
|
+
*
|
|
37
|
+
* Each region is themed a DIFFERENT way on purpose: the first from `tenantTheme(hex).vars`, the
|
|
38
|
+
* second from a `.dark` class. ThemeScope has no theme prop and reads neither — it reads the
|
|
39
|
+
* COMPUTED tokens at its own element, which is why both work and why a `[data-tenant]` rule in a
|
|
40
|
+
* consumer's own stylesheet works too. Open a Dialog, a Select listbox, a Popover or a toast from
|
|
41
|
+
* either region: all of them are painted by that region.
|
|
42
|
+
*
|
|
43
|
+
* Composed only from real @godxjp/ui components.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
const REVIEWERS = [
|
|
47
|
+
{ value: "sato", label: "Sakura Sato" },
|
|
48
|
+
{ value: "tran", label: "Trần Minh" },
|
|
49
|
+
{ value: "novak", label: "Ana Novák" },
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
function ReviewRegion({ name }: { name: string }) {
|
|
53
|
+
const { t } = useTranslation();
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Card>
|
|
57
|
+
<CardHeader>
|
|
58
|
+
<CardTitle level={2}>{name}</CardTitle>
|
|
59
|
+
<CardDescription>{t("themeScopeDocs.region.description")}</CardDescription>
|
|
60
|
+
</CardHeader>
|
|
61
|
+
<CardContent>
|
|
62
|
+
<Flex direction="col" gap="md">
|
|
63
|
+
<Flex gap="sm" align="center" wrap>
|
|
64
|
+
<Badge>{t("themeScopeDocs.region.pending")}</Badge>
|
|
65
|
+
<Text tone="muted">{t("themeScopeDocs.region.queue")}</Text>
|
|
66
|
+
</Flex>
|
|
67
|
+
|
|
68
|
+
<Select
|
|
69
|
+
aria-label={t("themeScopeDocs.region.reviewerLabel")}
|
|
70
|
+
placeholder={t("themeScopeDocs.region.reviewerPlaceholder")}
|
|
71
|
+
options={REVIEWERS}
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
<Flex gap="sm" wrap>
|
|
75
|
+
<Dialog>
|
|
76
|
+
<DialogTrigger asChild>
|
|
77
|
+
<Button>{t("themeScopeDocs.region.approve")}</Button>
|
|
78
|
+
</DialogTrigger>
|
|
79
|
+
<DialogContent>
|
|
80
|
+
<DialogHeader>
|
|
81
|
+
<DialogTitle>{t("themeScopeDocs.dialog.title")}</DialogTitle>
|
|
82
|
+
<DialogDescription>{t("themeScopeDocs.dialog.description")}</DialogDescription>
|
|
83
|
+
</DialogHeader>
|
|
84
|
+
<DialogBody>
|
|
85
|
+
<Text>{t("themeScopeDocs.dialog.body")}</Text>
|
|
86
|
+
</DialogBody>
|
|
87
|
+
<DialogFooter>
|
|
88
|
+
<Button onClick={() => toast.success(t("themeScopeDocs.toast.approved"))}>
|
|
89
|
+
{t("themeScopeDocs.dialog.confirm")}
|
|
90
|
+
</Button>
|
|
91
|
+
</DialogFooter>
|
|
92
|
+
</DialogContent>
|
|
93
|
+
</Dialog>
|
|
94
|
+
|
|
95
|
+
<Popover>
|
|
96
|
+
<PopoverTrigger asChild>
|
|
97
|
+
<Button variant="outline">{t("themeScopeDocs.region.history")}</Button>
|
|
98
|
+
</PopoverTrigger>
|
|
99
|
+
<PopoverContent>
|
|
100
|
+
<Text>{t("themeScopeDocs.popover.body")}</Text>
|
|
101
|
+
</PopoverContent>
|
|
102
|
+
</Popover>
|
|
103
|
+
|
|
104
|
+
<Button variant="ghost" onClick={() => toast(t("themeScopeDocs.toast.saved"))}>
|
|
105
|
+
{t("themeScopeDocs.region.notify")}
|
|
106
|
+
</Button>
|
|
107
|
+
</Flex>
|
|
108
|
+
</Flex>
|
|
109
|
+
</CardContent>
|
|
110
|
+
</Card>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export default function Demo() {
|
|
115
|
+
const { t } = useTranslation();
|
|
116
|
+
const acme = tenantTheme("#0076bd");
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<PageContainer
|
|
120
|
+
title={t("themeScopeDocs.page.title")}
|
|
121
|
+
subtitle={t("themeScopeDocs.page.subtitle")}
|
|
122
|
+
>
|
|
123
|
+
<Flex direction="col" gap="lg">
|
|
124
|
+
<Card>
|
|
125
|
+
<CardHeader>
|
|
126
|
+
<CardTitle level={2}>{t("themeScopeDocs.intro.title")}</CardTitle>
|
|
127
|
+
<CardDescription>{t("themeScopeDocs.intro.description")}</CardDescription>
|
|
128
|
+
</CardHeader>
|
|
129
|
+
<CardContent>
|
|
130
|
+
<Text as="p" tone="muted">
|
|
131
|
+
{t("themeScopeDocs.intro.body")}
|
|
132
|
+
</Text>
|
|
133
|
+
</CardContent>
|
|
134
|
+
</Card>
|
|
135
|
+
|
|
136
|
+
{/* Themed from a customer hex. The Toaster lives inside the region, so its toasts do too. */}
|
|
137
|
+
<ThemeScope style={acme.vars} data-tenant="acme">
|
|
138
|
+
<ReviewRegion name={t("themeScopeDocs.acme.name")} />
|
|
139
|
+
<Toaster />
|
|
140
|
+
|
|
141
|
+
{/*
|
|
142
|
+
NESTED, and themed by a CLASS rather than a style: the night-shift console stays dark
|
|
143
|
+
whatever the page does. The INNER scope wins for its overlays — measured, its Dialog
|
|
144
|
+
reads --card 48 8% 12% (dark) where the outer region reads 60 33% 99%.
|
|
145
|
+
|
|
146
|
+
`acme.vars` is repeated here on purpose, and that is worth knowing: `.dark` RESTATES the
|
|
147
|
+
whole brand ramp, so an inner scope that only adds the class would hand its overlays the
|
|
148
|
+
package's dark violet rather than the customer's blue. Inheritance carries what the
|
|
149
|
+
inner scope does not redeclare; `.dark` redeclares this.
|
|
150
|
+
*/}
|
|
151
|
+
<ThemeScope className="dark" style={acme.vars}>
|
|
152
|
+
<ReviewRegion name={t("themeScopeDocs.night.name")} />
|
|
153
|
+
</ThemeScope>
|
|
154
|
+
</ThemeScope>
|
|
155
|
+
|
|
156
|
+
<Card>
|
|
157
|
+
<CardHeader>
|
|
158
|
+
<CardTitle level={2}>{t("themeScopeDocs.without.title")}</CardTitle>
|
|
159
|
+
<CardDescription>{t("themeScopeDocs.without.description")}</CardDescription>
|
|
160
|
+
</CardHeader>
|
|
161
|
+
<CardContent>
|
|
162
|
+
{/* No ThemeScope: the region is themed, its overlays are not. This is the defect. */}
|
|
163
|
+
<div style={acme.vars} data-tenant="acme-unscoped">
|
|
164
|
+
<Dialog>
|
|
165
|
+
<DialogTrigger asChild>
|
|
166
|
+
<Button>{t("themeScopeDocs.without.open")}</Button>
|
|
167
|
+
</DialogTrigger>
|
|
168
|
+
<DialogContent>
|
|
169
|
+
<DialogHeader>
|
|
170
|
+
<DialogTitle>{t("themeScopeDocs.without.dialogTitle")}</DialogTitle>
|
|
171
|
+
<DialogDescription>
|
|
172
|
+
{t("themeScopeDocs.without.dialogDescription")}
|
|
173
|
+
</DialogDescription>
|
|
174
|
+
</DialogHeader>
|
|
175
|
+
<DialogBody>
|
|
176
|
+
<Text>{t("themeScopeDocs.without.dialogBody")}</Text>
|
|
177
|
+
</DialogBody>
|
|
178
|
+
</DialogContent>
|
|
179
|
+
</Dialog>
|
|
180
|
+
</div>
|
|
181
|
+
</CardContent>
|
|
182
|
+
</Card>
|
|
183
|
+
</Flex>
|
|
184
|
+
</PageContainer>
|
|
185
|
+
);
|
|
186
|
+
}
|