hisd3-ui-kit 4.0.1 → 4.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 +49 -9
- package/dist/index.cjs.js +400 -89
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +123 -10
- package/dist/index.js +401 -90
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,9 +33,16 @@ 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`, `
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
`ThemeProvider`. Options: `primary`, `borders` (`"hairline"` default, or
|
|
37
|
+
`"bold"` for the original 2px near-black rules), `radius` (default 0),
|
|
38
|
+
`lineWidth` (overrides the `borders` preset), `overrides` (extra antd
|
|
39
|
+
`ThemeConfig`), or `theme` to bypass the generator entirely.
|
|
40
|
+
|
|
41
|
+
Borders are hairline by default — 1px warm grey (`#D9D5CE` structural,
|
|
42
|
+
`#E7E4DE` row rules), with near-black kept for type and for control hover
|
|
43
|
+
states. Every kit component follows `--hisd3-rule-width`, so switching
|
|
44
|
+
`borders="bold"` retunes the sidebar, header, table, tabs, pagination, inputs
|
|
45
|
+
and buttons together.
|
|
39
46
|
|
|
40
47
|
Need just the antd theme object (e.g. for Storybook)? `createHisd3Theme({ primary: "teal" })`.
|
|
41
48
|
|
|
@@ -44,7 +51,7 @@ Need just the antd theme object (e.g. for Storybook)? `createHisd3Theme({ primar
|
|
|
44
51
|
```tsx
|
|
45
52
|
import {
|
|
46
53
|
HISD3Sidebar, HISD3PageHeader, HISD3PageBody, HISD3SearchInput, HISD3Tabs,
|
|
47
|
-
HISD3Table, HISD3Tag, HISD3Button,
|
|
54
|
+
HISD3Table, HISD3Tag, HISD3Button, HISD3HeaderActions, HISD3NotificationButton, HISD3AvatarMenu,
|
|
48
55
|
} from "hisd3-ui-kit";
|
|
49
56
|
|
|
50
57
|
const menuItems = [
|
|
@@ -66,6 +73,7 @@ const menuItems = [
|
|
|
66
73
|
onLogout={logout}
|
|
67
74
|
bareContent // let HISD3PageHeader own the gutters
|
|
68
75
|
hideHeaderBar // HISD3PageHeader renders the top bar
|
|
76
|
+
hideAccountCard // account lives in the header instead (HISD3AvatarMenu)
|
|
69
77
|
>
|
|
70
78
|
<HISD3PageHeader
|
|
71
79
|
title="Billing Folios"
|
|
@@ -74,6 +82,14 @@ const menuItems = [
|
|
|
74
82
|
extra={<>
|
|
75
83
|
<HISD3Button icon={<ReloadOutlined />}>Refresh</HISD3Button>
|
|
76
84
|
<HISD3Button variant="primary" icon={<PlusOutlined />}>New folio</HISD3Button>
|
|
85
|
+
<HISD3HeaderActions divided>
|
|
86
|
+
<HISD3NotificationButton
|
|
87
|
+
items={notifications}
|
|
88
|
+
onMarkAllRead={markAllRead}
|
|
89
|
+
onSeeAll={() => router.push("/notifications")}
|
|
90
|
+
/>
|
|
91
|
+
<HISD3AvatarMenu account={currentUser} avatarSrc={currentUser.photoUrl} onLogout={logout} />
|
|
92
|
+
</HISD3HeaderActions>
|
|
77
93
|
</>}
|
|
78
94
|
/>
|
|
79
95
|
<HISD3PageBody>
|
|
@@ -94,22 +110,40 @@ const menuItems = [
|
|
|
94
110
|
| Component | What it is |
|
|
95
111
|
| --- | --- |
|
|
96
112
|
| `HISD3Provider` | Root theme provider (see above). |
|
|
97
|
-
| `HISD3Sidebar` | App shell: 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`. |
|
|
98
|
-
| `HISD3PageHeader` / `HISD3PageBody` |
|
|
113
|
+
| `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`. |
|
|
114
|
+
| `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. |
|
|
99
115
|
| `HISD3Table<T>` | antd `Table` restyled (uppercase muted headers, 2px row rules) 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`. |
|
|
100
116
|
| `HISD3Tabs` | Underlined filter tabs; each item may carry a `count`. |
|
|
101
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`. |
|
|
102
118
|
| `HISD3Button` | `variant`: `primary` (filled), `secondary` (default, dark 2px outline), `ghost`, `danger`. Accepts all antd `Button` props (`icon`, `size`, `loading`, …). |
|
|
103
119
|
| `HISD3Input` / `HISD3SearchInput` | 2px-bordered input; the search variant is the grey filled hero field with a leading icon (`compact` for a 48px version). |
|
|
104
|
-
| `
|
|
120
|
+
| `HISD3HeaderActions` | Spacing wrapper for the top-right controls; `divided` inserts a rule before the last child. |
|
|
121
|
+
| `HISD3NotificationButton` | Soft-grey circular bell button (Facebook-style) with an unread badge; tints to the primary color while its panel is open. Props: `items` (`{ id, title, description, time, unread, avatarSrc, icon, onClick }`), `count` (defaults to the unread tally), `loading`, `size` (default 40), `onMarkAllRead`, `onSeeAll`, `emptyText`. |
|
|
122
|
+
| `HISD3AvatarMenu` | Circular avatar button with a small chevron badge (Facebook-style); clicking it opens a menu with the signed-in identity plus Settings and Logout (confirm dialog by default). Falls back to initials on a grey circle when there is no photo. Props: `account`, `avatarSrc`, `settingsUrl` / `onSettings`, `onLogout`, `confirmLogout`, `extraItems`, `shape` (`circle` \| `square`), `size` (default 40), `hideChevron`. |
|
|
123
|
+
| `UserMenu` | The sidebar-footer account card, on its own. |
|
|
105
124
|
|
|
106
125
|
Theme utilities: `createHisd3Theme`, `hisd3AntdTheme` (red default),
|
|
107
|
-
`HISD3_PRESETS`, `HISD3_NEUTRALS`, `
|
|
126
|
+
`HISD3_PRESETS`, `HISD3_NEUTRALS`, `HISD3_BORDER_PRESETS`, `borderVarsCss`,
|
|
127
|
+
`HISD3_FONT_FAMILY`,
|
|
108
128
|
`HISD3_FONT_WEIGHT_HEADING` (800) / `HISD3_FONT_WEIGHT_BODY` (400), `HISD3_LAYOUT`,
|
|
109
129
|
`resolvePrimary`, `tint`. Plain antd components (Form, Select, DatePicker,
|
|
110
130
|
Modal, …) inherit the same tokens automatically, so use them freely alongside
|
|
111
131
|
the kit.
|
|
112
132
|
|
|
133
|
+
### Scrolling
|
|
134
|
+
|
|
135
|
+
The shell fills exactly one viewport and the content column scrolls inside it,
|
|
136
|
+
so the page header stays pinned and the document never rubber-bands ("bounces")
|
|
137
|
+
past the top or bottom — the behaviour you expect from a desktop app. Nothing to
|
|
138
|
+
configure; pass `scrollContent={false}` to `HISD3Sidebar` if you need the window
|
|
139
|
+
to be the scroller instead (infinite scroll bound to `window`, browser scroll
|
|
140
|
+
restoration, and similar).
|
|
141
|
+
|
|
142
|
+
Because the scroller is the content column rather than the window, code that
|
|
143
|
+
listens for `window` scroll events or calls `window.scrollTo` inside a page
|
|
144
|
+
needs to target that element instead — for example
|
|
145
|
+
`document.querySelector(".ant-layout-has-sider > .ant-layout")`.
|
|
146
|
+
|
|
113
147
|
Typography: Archivo throughout, loaded from Google Fonts by the kit — body 400,
|
|
114
148
|
headings 800. The kit defines `--font-body`, `--font-heading` and
|
|
115
149
|
`--font-weight-heading` on `:root`, so your own CSS can use them, and native
|
|
@@ -119,7 +153,10 @@ Inside styled-components or CSS you can rely on antd's variables:
|
|
|
119
153
|
`var(--ant-color-primary)`, `var(--ant-color-primary-bg)`,
|
|
120
154
|
`var(--ant-color-border)`, `var(--ant-color-border-secondary)`,
|
|
121
155
|
`var(--ant-color-text)`, `var(--ant-color-text-tertiary)`,
|
|
122
|
-
`var(--ant-color-bg-layout)`.
|
|
156
|
+
`var(--ant-color-bg-layout)`. The header controls additionally read
|
|
157
|
+
`--hisd3-control-bg` / `--hisd3-control-bg-hover` (the grey circle fill) and
|
|
158
|
+
`--hisd3-popup-radius`, so you can retune them per app without forking the
|
|
159
|
+
components.
|
|
123
160
|
|
|
124
161
|
## Migrating
|
|
125
162
|
|
|
@@ -127,6 +164,9 @@ Inside styled-components or CSS you can rely on antd's variables:
|
|
|
127
164
|
|
|
128
165
|
- Wrap the app in `HISD3Provider` (the sidebar still works standalone with the red default, but the provider is what lets you pick a primary).
|
|
129
166
|
- The default look changed from teal/rounded to the red/square Backoffice style. To keep teal: `<HISD3Provider primary="teal">`.
|
|
167
|
+
- The shell now scrolls its content column instead of the window (pinned header, no rubber-banding). Pass `scrollContent={false}` to `HISD3Sidebar` to restore window scrolling.
|
|
168
|
+
- Borders are now hairline by default; pass `borders="bold"` to `HISD3Provider` to keep the 2px near-black look.
|
|
169
|
+
- New `hideAccountCard` prop on `HISD3Sidebar` for apps that put the account in the header via `HISD3AvatarMenu`.
|
|
130
170
|
- `HISD3Sidebar`: `logoUrl` and `styledTheme` are now optional; a primary-colored square is shown when there is no logo. `HISD3_COLORS` is deprecated in favour of `HISD3_PRESETS`.
|
|
131
171
|
|
|
132
172
|
### from 2.x (antd 5 / ProLayout)
|