hisd3-ui-kit 4.7.1 → 5.1.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 +121 -1
- package/dist/index.cjs.js +90 -60
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +190 -6
- package/dist/index.js +147 -117
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,7 +116,9 @@ const menuItems = [
|
|
|
116
116
|
| `HISD3Tabs` | Underlined filter tabs; each item may carry a `count`. |
|
|
117
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`. |
|
|
118
118
|
| `HISD3Button` | `variant`: `primary` (filled), `secondary` (default, dark 2px outline), `ghost`, `danger`. Accepts all antd `Button` props (`icon`, `size`, `loading`, …). |
|
|
119
|
-
| `HISD3Input` / `HISD3SearchInput` | 2px-bordered input; the search variant is
|
|
119
|
+
| `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
|
+
| `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). |
|
|
121
|
+
| `HISD3Form*` fields | Every antd data-entry control pre-wrapped in `Form.Item`, with `loading` skeletons. See *Form fields* below. |
|
|
120
122
|
| `HISD3HeaderActions` | Spacing wrapper for the top-right controls; `divided` inserts a rule before the last child. |
|
|
121
123
|
| `HISD3NotificationButton` | Soft-grey circular button with a solid bell glyph and a count pill on its top-right edge; tints to the primary color while its panel is open. Pass `icon` to swap the glyph. Props: `items` (`{ id, title, description, time, unread, avatarSrc, icon, onClick }`), `count` (defaults to the unread tally), `loading`, `size` (default 40), `icon`, `onMarkAllRead`, `onSeeAll`, `emptyText`. |
|
|
122
124
|
| `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`. |
|
|
@@ -201,6 +203,124 @@ logo is used. `HISD3_LOGO_SRC` is exported if you need the mark elsewhere.
|
|
|
201
203
|
`primary` accepts the brand presets `"brand"` (the logo's gear, `#E5533B`) and
|
|
202
204
|
`"brandBlue"` (its cloud, `#1B6FE0`), any other preset, or a hex value.
|
|
203
205
|
|
|
206
|
+
## Select
|
|
207
|
+
|
|
208
|
+
`HISD3Select` is antd's `Select` with two additions, and takes every `Select`
|
|
209
|
+
prop. `HISD3FormSelect` uses it, so both work the same way.
|
|
210
|
+
|
|
211
|
+
- **Long text wraps** — in the chosen value and in every option — instead of
|
|
212
|
+
being cut off with "…". On by default; `wrap={false}` turns it off.
|
|
213
|
+
- **`description` on an option** is shown under its label, smaller and muted,
|
|
214
|
+
in the dropdown and in the box. With `showSearch`, typing matches the label
|
|
215
|
+
and the description.
|
|
216
|
+
|
|
217
|
+
`monoLabel` puts the label line in a monospace font, for codes:
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
<HISD3Select
|
|
221
|
+
showSearch
|
|
222
|
+
monoLabel
|
|
223
|
+
placeholder="Search an account…"
|
|
224
|
+
options={accounts.map((a) => ({ value: a.code, label: a.code, description: a.title }))}
|
|
225
|
+
/>
|
|
226
|
+
|
|
227
|
+
<HISD3FormSelect
|
|
228
|
+
name="accountCode"
|
|
229
|
+
label="Account"
|
|
230
|
+
fieldProps={{ showSearch: true, monoLabel: true, options: accountOptions }}
|
|
231
|
+
/>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Your own `optionRender`, `labelRender`, `filterOption` or `optionFilterProp`
|
|
235
|
+
replaces the default. `HISD3SelectLabel` renders the same two-line layout for a
|
|
236
|
+
custom `optionRender` / `labelRender`.
|
|
237
|
+
|
|
238
|
+
Wrapped rows are not all one height, so `virtual` is off while `wrap` is on.
|
|
239
|
+
For a list of thousands of options, pass `virtual` (or search on the server and
|
|
240
|
+
show a capped list). Tags in `mode="multiple"` stay on one line.
|
|
241
|
+
|
|
242
|
+
## Form fields
|
|
243
|
+
|
|
244
|
+
Each `HISD3Form*` field is an antd control inside a `Form.Item`. It takes every
|
|
245
|
+
`Form.Item` prop (`name`, `label`, `rules`, `tooltip`, `extra`, …) plus:
|
|
246
|
+
|
|
247
|
+
| Prop | |
|
|
248
|
+
| --- | --- |
|
|
249
|
+
| `fieldProps` | Props for the wrapped control (`placeholder`, `options`, `size`, `format`, …). |
|
|
250
|
+
| `loading` | Shows a skeleton in place of the control. The form value is kept. |
|
|
251
|
+
| `loadingProps` | Props for the default `Skeleton.Input`. |
|
|
252
|
+
| `vertical` | Label above the control (`layout="vertical"` for this item). |
|
|
253
|
+
| `bolderLabel` | Semi-bold label; the control text is unchanged. |
|
|
254
|
+
|
|
255
|
+
| Field | Wraps | Form value |
|
|
256
|
+
| --- | --- | --- |
|
|
257
|
+
| `HISD3FormInput` | `HISD3Input` | string |
|
|
258
|
+
| `HISD3FormPassword` | `Input.Password` | string |
|
|
259
|
+
| `HISD3FormSearch` | `Input.Search` | string |
|
|
260
|
+
| `HISD3FormTextArea` | `Input.TextArea` | string |
|
|
261
|
+
| `HISD3FormOTP` | `Input.OTP` | string |
|
|
262
|
+
| `HISD3FormInputNumber` | `InputNumber` | number |
|
|
263
|
+
| `HISD3FormAutoComplete` | `AutoComplete` | string |
|
|
264
|
+
| `HISD3FormMentions` | `Mentions` | string |
|
|
265
|
+
| `HISD3FormSelect` | `HISD3Select` | value / value[] |
|
|
266
|
+
| `HISD3FormTreeSelect` | `TreeSelect` | value / value[] |
|
|
267
|
+
| `HISD3FormCascader` | `Cascader` | path array |
|
|
268
|
+
| `HISD3FormRadioGroup` | `Radio.Group` | value |
|
|
269
|
+
| `HISD3FormSegmented` | `Segmented` | value |
|
|
270
|
+
| `HISD3FormCheckbox` | `Checkbox` | boolean (`valuePropName="checked"`) |
|
|
271
|
+
| `HISD3FormCheckboxGroup` | `Checkbox.Group` | value[] |
|
|
272
|
+
| `HISD3FormSwitch` | `Switch` | boolean (`valuePropName="checked"`) |
|
|
273
|
+
| `HISD3FormTransfer` | `Transfer` | right-hand keys (`valuePropName="targetKeys"`) |
|
|
274
|
+
| `HISD3FormSlider` | `Slider` | number, or `[min, max]` with `range` |
|
|
275
|
+
| `HISD3FormRate` | `Rate` | number |
|
|
276
|
+
| `HISD3FormColorPicker` | `ColorPicker` | string in `fieldProps.format` (hex by default) |
|
|
277
|
+
| `HISD3FormDatePicker` | `DatePicker` | Dayjs |
|
|
278
|
+
| `HISD3FormRangePicker` | `DatePicker.RangePicker` | `[Dayjs, Dayjs]` |
|
|
279
|
+
| `HISD3FormTimePicker` | `TimePicker` | Dayjs |
|
|
280
|
+
| `HISD3FormTimeRangePicker` | `TimePicker.RangePicker` | `[Dayjs, Dayjs]` |
|
|
281
|
+
| `HISD3FormUpload` | `Upload` | `UploadFile[]` (`valuePropName="fileList"`) |
|
|
282
|
+
| `HISD3FormUploadDragger` | `Upload.Dragger` | `UploadFile[]` |
|
|
283
|
+
|
|
284
|
+
Upload fields take the trigger as children
|
|
285
|
+
(`<HISD3FormUpload name="files"><HISD3Button>Select file</HISD3Button></HISD3FormUpload>`)
|
|
286
|
+
and use the exported `normalizeUploadFileList` as `getValueFromEvent`. Any
|
|
287
|
+
`Form.Item` prop you pass (`valuePropName`, `getValueFromEvent`, …) overrides
|
|
288
|
+
the field's default.
|
|
289
|
+
|
|
290
|
+
`ref` goes to the control itself, so `ref.current?.focus()` works.
|
|
291
|
+
Pickers and number inputs fill their column.
|
|
292
|
+
|
|
293
|
+
```tsx
|
|
294
|
+
<Form form={form} layout="vertical" onFinish={save}>
|
|
295
|
+
<HISD3FormInput
|
|
296
|
+
name="lastName"
|
|
297
|
+
label="Last name"
|
|
298
|
+
bolderLabel
|
|
299
|
+
loading={loadingPatient}
|
|
300
|
+
rules={[{ required: true, message: "Last name is required" }]}
|
|
301
|
+
fieldProps={{ placeholder: "Dela Cruz", maxLength: 80 }}
|
|
302
|
+
/>
|
|
303
|
+
<HISD3FormSelect
|
|
304
|
+
name="gender"
|
|
305
|
+
label="Gender"
|
|
306
|
+
fieldProps={{ options: [{ value: "M", label: "Male" }, { value: "F", label: "Female" }] }}
|
|
307
|
+
/>
|
|
308
|
+
<HISD3FormDatePicker name="birthDate" label="Birth date" fieldProps={{ format: "MM/DD/YYYY" }} />
|
|
309
|
+
<HISD3FormSwitch name="active" label="Active" />
|
|
310
|
+
</Form>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Wrap a control the kit does not cover with `HISD3FormField` to get the same
|
|
314
|
+
label, spacing and loading behaviour:
|
|
315
|
+
|
|
316
|
+
```tsx
|
|
317
|
+
<HISD3FormField name="doctor" label="Attending" loading={loading}>
|
|
318
|
+
<DoctorPicker />
|
|
319
|
+
</HISD3FormField>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`propsinput` on `HISD3FormInput` still works but is deprecated; use `fieldProps`.
|
|
323
|
+
|
|
204
324
|
## Drawers and modals — `useDialog`
|
|
205
325
|
|
|
206
326
|
Open a drawer or modal from anywhere, without the page holding its state. Put
|