hisd3-ui-kit 5.1.0 → 5.2.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 +55 -7
- package/dist/index.cjs.js +146 -140
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +115 -8
- package/dist/index.js +154 -148
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ copy and one theme chain.
|
|
|
25
25
|
```tsx
|
|
26
26
|
import { HISD3Provider } from "hisd3-ui-kit";
|
|
27
27
|
|
|
28
|
-
<HISD3Provider primary="red">
|
|
28
|
+
<HISD3Provider primary="red" mode="light"> {/* primary: "red" | "orange" | "teal" | "blue" | "green" | "purple" | "brand" | "brandBlue" | "#hex"; mode: "light" | "dark" */}
|
|
29
29
|
<App />
|
|
30
30
|
</HISD3Provider>
|
|
31
31
|
```
|
|
@@ -33,7 +33,7 @@ import { HISD3Provider } from "hisd3-ui-kit";
|
|
|
33
33
|
`HISD3Provider` sets up antd's `ConfigProvider` (CSS variables on, so every kit
|
|
34
34
|
component and every plain antd component follows the chosen primary), antd
|
|
35
35
|
`App` (themed `modal.confirm` / `message`), and the styled-components
|
|
36
|
-
`ThemeProvider`. Options: `primary`, `borders` (`"hairline"` default, or
|
|
36
|
+
`ThemeProvider`. Options: `primary`, `mode` (`"light"` default, or `"dark"`), `borders` (`"hairline"` default, or
|
|
37
37
|
`"bold"` for the original 2px near-black rules), `radius` (default 0),
|
|
38
38
|
`lineWidth` (overrides the `borders` preset), `overrides` (extra antd
|
|
39
39
|
`ThemeConfig`), or `theme` to bypass the generator entirely.
|
|
@@ -44,7 +44,36 @@ states. Every kit component follows `--hisd3-rule-width`, so switching
|
|
|
44
44
|
`borders="bold"` retunes the sidebar, header, table, tabs, pagination, inputs
|
|
45
45
|
and buttons together.
|
|
46
46
|
|
|
47
|
-
Need just the antd theme object (e.g. for Storybook)? `createHisd3Theme({ primary: "teal" })`.
|
|
47
|
+
Need just the antd theme object (e.g. for Storybook)? `createHisd3Theme({ primary: "teal", mode: "dark" })`.
|
|
48
|
+
|
|
49
|
+
### One primary, readable in light and dark
|
|
50
|
+
|
|
51
|
+
An app sets one thing, its `primary`; neutrals, type, spacing and status
|
|
52
|
+
colours are the same for every app. The kit makes any primary readable:
|
|
53
|
+
|
|
54
|
+
- **Light:** a primary is darkened until it reads at 4.5:1 on the page, on
|
|
55
|
+
its own tint and under white text. Teal, Blue, Green and Purple are used as
|
|
56
|
+
given; Red, Orange, Brand and Brand blue come out a little darker.
|
|
57
|
+
- **Dark:** it is lightened until it reads at 4.5:1 on the dark page and on
|
|
58
|
+
its tint, and carries dark text (`--hisd3-on-primary`).
|
|
59
|
+
- `resolvePrimaryPalette(primary, mode)` returns what the kit applies
|
|
60
|
+
(`primary`, `onPrimary`, `primaryBg`, …; `source` is the colour as asked
|
|
61
|
+
for, for logos only). `contrastRatio(a, b)` is the WCAG ratio it checks with.
|
|
62
|
+
|
|
63
|
+
Status colours (`HISD3_STATUS`) replace antd's defaults, which failed
|
|
64
|
+
contrast: success `#2E7D32`, error `#B42318`, warning `#B54708` in light;
|
|
65
|
+
`#6FBF73`, `#FF8A7A`, `#F0A35E` in dark, each on its own tint. Every form
|
|
66
|
+
field (text, number, select, date, cascader, tree, mentions, checkbox,
|
|
67
|
+
radio, search) shares one 3:1 edge (`controlBorder`, `--hisd3-input-border`),
|
|
68
|
+
the field fill and a 2px primary edge on focus.
|
|
69
|
+
|
|
70
|
+
`mode` is the app's to own: keep the person's choice (light, dark, or the
|
|
71
|
+
computer's `prefers-color-scheme`) and pass the result in. Dark mode is the
|
|
72
|
+
same system on a warm near-black (`HISD3_NEUTRALS_DARK`); every kit
|
|
73
|
+
component reads CSS variables, so nothing is inverted by hand. For a region
|
|
74
|
+
that must stay light in a dark app (a printout), scope the light variables to
|
|
75
|
+
it: `hisd3VarsCss({ primary, mode: "light", selector: ".my-paper" })` plus an
|
|
76
|
+
antd `ConfigProvider` with `createHisd3Theme({ primary, mode: "light" })`.
|
|
48
77
|
|
|
49
78
|
## 2. Build a page
|
|
50
79
|
|
|
@@ -112,9 +141,9 @@ const menuItems = [
|
|
|
112
141
|
| `HISD3Provider` | Root theme provider (see above). |
|
|
113
142
|
| `HISD3Sidebar` | App shell (see *Scrolling* below): brand block, grouped menu with accent bar on the active route, account dropdown (Settings / Logout with confirm), collapsible, optional top-nav mode (`layoutTop`). `menuItems` accept `{ key, path, name, icon, children, group, hideInMenu, disabled }`. `renderMenuLink` lets you plug in react-router's `<Link>`. Props `bareContent` + `hideHeaderBar` hand the header over to `HISD3PageHeader`. `collapseTrigger` places the collapse control: `"edge"` (default) floats a round chevron on the sidebar's right edge, level with the top bar — it works even when the top bar is hidden, and `collapseTriggerOffset` moves it down — `"header"` puts a square button in the shell's own top bar, `"none"` renders neither. |
|
|
114
143
|
| `HISD3PageHeader` / `HISD3PageBody` | Top bar (breadcrumb left, actions right) that stays pinned while the page scrolls, plus a large title + subtitle that scrolls away; `HISD3PageBody` is the matching padded content area. |
|
|
115
|
-
| `HISD3Table<T>` | antd `Table` restyled compactly — 45px rows, 14px cell text, uppercase
|
|
144
|
+
| `HISD3Table<T>` | antd `Table` restyled compactly — 45px rows, 14px cell text, uppercase 12px headers in the secondary text colour, hairline row rules. antd's own `size="small"` tightens it further with the HISD3 pagination bar: "Total N items", square page buttons, page-size toggle. Pass `pagination={{ current, pageSize, total, onChange, pageSizeOptions?, hidePageSize? }}` or `false`. Optional `footer` strip. Cell helper classes: `hisd3-cell-primary`, `hisd3-cell-link`, `hisd3-cell-muted`. |
|
|
116
145
|
| `HISD3Tabs` | Underlined filter tabs; each item may carry a `count`. |
|
|
117
|
-
| `HISD3Tag` | Uppercase status pill. `variant`: `neutral` (grey, e.g. ACTIVE / IN PATIENT), `soft` (primary tint, e.g. ER PATIENT), `outline` (2px primary border, e.g. OUT PATIENT), `solid`. `tone`: `primary` \| `success` \| `warning` \| `danger` \| `default`. |
|
|
146
|
+
| `HISD3Tag` | Uppercase status pill, 12px on a 24px pill. `variant`: `neutral` (grey, e.g. ACTIVE / IN PATIENT), `soft` (primary tint, e.g. ER PATIENT), `outline` (2px primary border, e.g. OUT PATIENT), `solid`. `tone`: `primary` \| `success` \| `warning` \| `danger` \| `default`. |
|
|
118
147
|
| `HISD3Button` | `variant`: `primary` (filled), `secondary` (default, dark 2px outline), `ghost`, `danger`. Accepts all antd `Button` props (`icon`, `size`, `loading`, …). |
|
|
119
148
|
| `HISD3Input` / `HISD3SearchInput` | 2px-bordered input; the search variant is a light field with a leading icon and a visible border, lighter than the page so it never reads as disabled. `size`: `"small"` 32px, `"middle"` 40px (default), `"large"` 56px. Colours: `--hisd3-input-bg`, `--hisd3-input-bg-hover`, `--hisd3-input-border-hover`. |
|
|
120
149
|
| `HISD3Select` | antd `Select` that wraps long text instead of cutting it with "…", and shows an option's `description` on a second line. See [Select](#select). |
|
|
@@ -126,7 +155,9 @@ const menuItems = [
|
|
|
126
155
|
| `UserMenu` | The sidebar-footer account card, on its own. |
|
|
127
156
|
|
|
128
157
|
Theme utilities: `createHisd3Theme`, `hisd3AntdTheme` (red default),
|
|
129
|
-
`HISD3_PRESETS`, `HISD3_NEUTRALS`, `
|
|
158
|
+
`HISD3_PRESETS`, `HISD3_NEUTRALS`, `HISD3_NEUTRALS_DARK`, `HISD3_STATUS`,
|
|
159
|
+
`HISD3_BORDER_PRESETS`, `HISD3_BORDER_PRESETS_DARK`, `hisd3VarsCss`,
|
|
160
|
+
`resolvePrimaryPalette`, `contrastRatio`, `mix`, `shade`, `borderVarsCss`,
|
|
130
161
|
`HISD3_FONT_FAMILY`,
|
|
131
162
|
`HISD3_FONT_WEIGHT_HEADING` (800) / `HISD3_FONT_WEIGHT_BODY` (400), `HISD3_LAYOUT`,
|
|
132
163
|
`resolvePrimary`, `tint`. Plain antd components (Form, Select, DatePicker,
|
|
@@ -162,7 +193,10 @@ Inside styled-components or CSS you can rely on antd's variables:
|
|
|
162
193
|
`var(--ant-color-border)`, `var(--ant-color-border-secondary)`,
|
|
163
194
|
`var(--ant-color-text)`, `var(--ant-color-text-tertiary)`,
|
|
164
195
|
`var(--ant-color-bg-layout)`. The header controls additionally read
|
|
165
|
-
`--hisd3-control-bg` / `--hisd3-control-bg-hover` (the grey circle fill)
|
|
196
|
+
`--hisd3-control-bg` / `--hisd3-control-bg-hover` (the grey circle fill),
|
|
197
|
+
`--hisd3-input-border` / `--hisd3-input-border-hover` (every field's edge),
|
|
198
|
+
`--hisd3-on-primary` (text on a primary fill), `--hisd3-hover` (a row's hover
|
|
199
|
+
wash) and
|
|
166
200
|
`--hisd3-popup-radius`, `--hisd3-bell-stretch` (how wide the bell glyph is drawn, default `1.12`), `--hisd3-edge-trigger-bg` / `--hisd3-edge-trigger-color` (the sidebar collapse chevron, primary-filled by default), so you can retune them per app without forking the
|
|
167
201
|
components.
|
|
168
202
|
|
|
@@ -364,6 +398,20 @@ again — and the instance unmounts once the animation finishes.
|
|
|
364
398
|
|
|
365
399
|
## Migrating
|
|
366
400
|
|
|
401
|
+
### from 5.1
|
|
402
|
+
|
|
403
|
+
Nothing to change in code; the look moves:
|
|
404
|
+
|
|
405
|
+
- Status colours, field edges, placeholders, column headings (12px), tags
|
|
406
|
+
(12px on 24px), sidebar group titles (12px) and the Segmented control now
|
|
407
|
+
meet WCAG AA. An app that set these itself in `overrides` can drop them.
|
|
408
|
+
- A light primary is darkened a little in light mode (see "One primary,
|
|
409
|
+
readable in light and dark").
|
|
410
|
+
- Card titles: 18px, and 16px on `size="small"` cards.
|
|
411
|
+
- `HISD3Sidebar` shows the HISD3 mark when `logoUrl` fails to load, not a
|
|
412
|
+
broken image.
|
|
413
|
+
- New: `mode: "dark"`.
|
|
414
|
+
|
|
367
415
|
### from 3.x
|
|
368
416
|
|
|
369
417
|
- Wrap the app in `HISD3Provider` (the sidebar still works standalone with the red default, but the provider is what lets you pick a primary).
|