haze-ui 1.24.1 → 1.25.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 +139 -0
- package/dist/components/Alert/Alert.js +19 -18
- package/dist/components/ApprovalCard/ApprovalCard.js +27 -25
- package/dist/components/AsyncSection/AsyncSection.js +32 -30
- package/dist/components/AvatarGroup/AvatarGroup.js +29 -0
- package/dist/components/AvatarGroup/index.js +2 -0
- package/dist/components/BackToTop/BackToTop.js +15 -14
- package/dist/components/Banner/Banner.js +19 -18
- package/dist/components/Breadcrumb/Breadcrumb.js +18 -17
- package/dist/components/Calendar/Calendar.js +152 -0
- package/dist/components/Calendar/index.js +2 -0
- package/dist/components/Carousel/Carousel.js +42 -40
- package/dist/components/Cascader/Cascader.js +227 -0
- package/dist/components/Cascader/index.js +2 -0
- package/dist/components/ChatInput/ChatInput.js +30 -29
- package/dist/components/ChatMessage/ChatMessage.js +28 -27
- package/dist/components/Chip/Chip.js +20 -19
- package/dist/components/ColorPicker/ColorPickerCore.js +28 -26
- package/dist/components/Combobox/Combobox.js +62 -41
- package/dist/components/ConfirmDialog/ConfirmDialog.js +40 -39
- package/dist/components/DataTable/DataTable.js +151 -0
- package/dist/components/DataTable/index.js +2 -0
- package/dist/components/DateRangePicker/DateRangePickerCore.js +21 -19
- package/dist/components/Datepicker/Datepicker.js +10 -8
- package/dist/components/Datepicker/DatepickerCore.js +18 -16
- package/dist/components/Empty/Empty.js +21 -19
- package/dist/components/FileInput/FileInput.js +14 -13
- package/dist/components/HoverCard/HoverCard.js +53 -0
- package/dist/components/HoverCard/index.js +2 -0
- package/dist/components/InlineEdit/InlineEdit.js +32 -31
- package/dist/components/Kbd/Kbd.js +21 -0
- package/dist/components/Kbd/index.js +2 -0
- package/dist/components/LocaleProvider/LocaleContext.js +5 -0
- package/dist/components/LocaleProvider/LocaleProvider.js +21 -0
- package/dist/components/LocaleProvider/index.js +4 -0
- package/dist/components/LocaleProvider/locale.js +126 -0
- package/dist/components/LocaleProvider/useStrings.js +17 -0
- package/dist/components/LogViewer/LogViewer.js +44 -43
- package/dist/components/MarkdownRenderer/MarkdownRenderer.js +19 -19
- package/dist/components/MarkdownRenderer/markdown-blocks.js +41 -0
- package/dist/components/ModelPicker/ModelPicker.js +16 -15
- package/dist/components/NumberInput/NumberInputCore.js +34 -33
- package/dist/components/OTPInput/OTPInputCore.js +35 -30
- package/dist/components/Pagination/Pagination.js +31 -30
- package/dist/components/PasswordInput/PasswordInputCore.js +22 -21
- package/dist/components/Progress/Progress.js +40 -39
- package/dist/components/Rating/RatingCore.js +28 -26
- package/dist/components/Sidebar/Sidebar.js +112 -0
- package/dist/components/Sidebar/index.js +2 -0
- package/dist/components/Spinner/Spinner.js +14 -12
- package/dist/components/StreamingText/StreamingText.js +38 -18
- package/dist/components/Tag/Tag.js +16 -14
- package/dist/components/TagGroup/TagGroupItem.js +12 -10
- package/dist/components/TagInput/TagInputCore.js +52 -50
- package/dist/components/ThinkingIndicator/ThinkingIndicator.js +13 -11
- package/dist/components/Toast/ToastContainer.js +44 -28
- package/dist/components/Toast/index.js +4 -3
- package/dist/components/Toast/toast2.js +44 -0
- package/dist/components/TokenCounter/TokenCounter.js +19 -18
- package/dist/components/ToolCallCard/ToolCallCard.js +39 -37
- package/dist/components/Toolbar/Toolbar.js +59 -0
- package/dist/components/Toolbar/ToolbarButton.js +25 -0
- package/dist/components/Toolbar/ToolbarContext.js +8 -0
- package/dist/components/Toolbar/ToolbarSeparator.js +22 -0
- package/dist/components/Toolbar/index.js +4 -0
- package/dist/components/Tour/Tour.js +197 -0
- package/dist/components/Tour/index.js +2 -0
- package/dist/components/Transfer/TransferCore.js +61 -67
- package/dist/components/Tree/TreeItem.js +56 -55
- package/dist/components/Upload/UploadCore.js +36 -35
- package/dist/components/VirtualList/VirtualList.js +140 -26
- package/dist/css/affix.css +1 -1
- package/dist/css/avatar-group.css +2 -0
- package/dist/css/calendar.css +2 -0
- package/dist/css/carousel.css +1 -1
- package/dist/css/cascader.css +2 -0
- package/dist/css/chat-message.css +1 -1
- package/dist/css/chip.css +1 -1
- package/dist/css/code-block.css +1 -1
- package/dist/css/combobox.css +1 -1
- package/dist/css/container.css +1 -1
- package/dist/css/context-menu.css +1 -1
- package/dist/css/conversation-list.css +1 -1
- package/dist/css/data-table.css +2 -0
- package/dist/css/datepicker.css +0 -1
- package/dist/css/diff-viewer.css +1 -1
- package/dist/css/dropdown-menu.css +1 -1
- package/dist/css/hover-card.css +2 -0
- package/dist/css/kbd.css +2 -0
- package/dist/css/list.css +1 -1
- package/dist/css/markdown-renderer.css +1 -1
- package/dist/css/menu.css +1 -1
- package/dist/css/model-picker.css +1 -1
- package/dist/css/navigation-bar.css +1 -1
- package/dist/css/password-input.css +1 -1
- package/dist/css/radio.css +1 -1
- package/dist/css/select.css +1 -1
- package/dist/css/sidebar.css +2 -0
- package/dist/css/step-timeline.css +1 -1
- package/dist/css/stepper.css +1 -1
- package/dist/css/streaming-text.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/toolbar.css +4 -0
- package/dist/css/tour.css +2 -0
- package/dist/css/tree.css +1 -1
- package/dist/css/virtual-list.css +1 -1
- package/dist/css-manifest.json +19 -0
- package/dist/haze-ui.css +36 -26
- package/dist/index.js +130 -115
- package/dist/registry.json +247 -0
- package/dist/types/components/AvatarGroup/AvatarGroup.d.ts +9 -0
- package/dist/types/components/AvatarGroup/index.d.ts +2 -0
- package/dist/types/components/Calendar/Calendar.d.ts +21 -0
- package/dist/types/components/Calendar/index.d.ts +2 -0
- package/dist/types/components/Cascader/Cascader.d.ts +26 -0
- package/dist/types/components/Cascader/index.d.ts +2 -0
- package/dist/types/components/Combobox/Combobox.d.ts +7 -1
- package/dist/types/components/DataTable/DataTable.d.ts +61 -0
- package/dist/types/components/DataTable/index.d.ts +2 -0
- package/dist/types/components/Datepicker/Datepicker.d.ts +3 -1
- package/dist/types/components/Datepicker/DatepickerCore.d.ts +3 -1
- package/dist/types/components/HoverCard/HoverCard.d.ts +49 -0
- package/dist/types/components/HoverCard/index.d.ts +2 -0
- package/dist/types/components/Kbd/Kbd.d.ts +6 -0
- package/dist/types/components/Kbd/index.d.ts +2 -0
- package/dist/types/components/LocaleProvider/LocaleContext.d.ts +19 -0
- package/dist/types/components/LocaleProvider/LocaleProvider.d.ts +13 -0
- package/dist/types/components/LocaleProvider/index.d.ts +6 -0
- package/dist/types/components/LocaleProvider/locale.d.ts +176 -0
- package/dist/types/components/LocaleProvider/useStrings.d.ts +9 -0
- package/dist/types/components/MarkdownRenderer/markdown-blocks.d.ts +6 -0
- package/dist/types/components/Sidebar/Sidebar.d.ts +64 -0
- package/dist/types/components/Sidebar/index.d.ts +4 -0
- package/dist/types/components/Toast/index.d.ts +2 -0
- package/dist/types/components/Toast/toast.d.ts +46 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +16 -0
- package/dist/types/components/Toolbar/ToolbarButton.d.ts +20 -0
- package/dist/types/components/Toolbar/ToolbarContext.d.ts +5 -0
- package/dist/types/components/Toolbar/ToolbarSeparator.d.ts +14 -0
- package/dist/types/components/Toolbar/index.d.ts +6 -0
- package/dist/types/components/Tour/Tour.d.ts +46 -0
- package/dist/types/components/Tour/index.d.ts +2 -0
- package/dist/types/components/VirtualList/VirtualList.d.ts +58 -4
- package/dist/types/components/VirtualList/index.d.ts +1 -1
- package/dist/types/index.d.ts +24 -3
- package/package.json +25 -11
- package/dist/components/Datepicker/Calendar.js +0 -120
- package/dist/types/components/Datepicker/Calendar.d.ts +0 -8
package/README.md
CHANGED
|
@@ -14,6 +14,14 @@ English | [简体中文](./README-zh_CN.md)
|
|
|
14
14
|
- Support themes customization
|
|
15
15
|
- Support Tree-shaking
|
|
16
16
|
|
|
17
|
+
## Why npm-distributed (not copy-paste)
|
|
18
|
+
|
|
19
|
+
**Interaction states are formulas, not values.** Every hover/active/subtle/focus-ring color is a CSS relative-color expression — `oklch(from var(--haze-color-primary) calc(l - 0.045) c h)` — baked into `tokens.css`. Override `--haze-color-primary` on a theme class and the entire interaction-state family re-derives at runtime in the browser, no rebuild, no codegen. In a copy-paste setup every pasted file owns its own copy of that formula, and each theme tweak means re-applying it by hand, file by file.
|
|
20
|
+
|
|
21
|
+
**`haze-ui/css-manifest.json` is machine-readable data.** The authoritative export → CSS-file mapping (family absorption included) is regenerated on every build, so bundler plugins and codemods read one source of truth instead of re-deriving kebab-case file names. A directory of pasted components has no equivalent — the mapping exists only in your head or your fork, and it drifts.
|
|
22
|
+
|
|
23
|
+
**The `ControlOrValue<T>` protocol needs a real runtime.** One prop — `checked?: Control<T> | T` — covers controlled *and* uncontrolled usage because `react-use-control` carries the wiring; a published package is the contract that keeps that behavior identical across every component and version. None of this is hostile to the shadcn / Base UI ecosystem: haze-ui tokens are plain CSS custom properties, so they interoperate with a Tailwind v4 `@theme` block, and haze components compose alongside copy-pasted primitives wherever each fits.
|
|
24
|
+
|
|
17
25
|
## Getting Started
|
|
18
26
|
|
|
19
27
|
### Installation
|
|
@@ -152,6 +160,29 @@ function SettingsView() {
|
|
|
152
160
|
}
|
|
153
161
|
```
|
|
154
162
|
|
|
163
|
+
## Design tokens export (Figma)
|
|
164
|
+
|
|
165
|
+
`toDesignTokens()` converts the token registry into a [W3C Design Tokens](https://tr.designtokens.org/) JSON file — grouped by category (`color` / `font` / `spacing` / `dimension` / `shadow`), each token carrying a W3C `$type` and the source CSS variable in `$extensions['haze-ui.css-var']`, with `$value` being the resolved value of the chosen theme (`light` by default). The Theme Editor ships a one-click entry: the **Export W3C tokens (.json)** button in the toolbar downloads the file for the mode currently being edited, live edits included. The exported file can be imported directly into Figma Tokens / Tokens Studio.
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"color": {
|
|
170
|
+
"color-primary": {
|
|
171
|
+
"$value": "oklch(0.563 0.241 260.8)",
|
|
172
|
+
"$type": "color",
|
|
173
|
+
"$extensions": { "haze-ui.css-var": "--haze-color-primary" }
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"spacing": {
|
|
177
|
+
"space-2": {
|
|
178
|
+
"$value": "8px",
|
|
179
|
+
"$type": "dimension",
|
|
180
|
+
"$extensions": { "haze-ui.css-var": "--haze-space-2" }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
155
186
|
## react-f0rm Integration
|
|
156
187
|
|
|
157
188
|
react-f0rm owns form field state, and its headless `useField` hook is
|
|
@@ -424,6 +455,89 @@ All three are optional; omit them and the field behaves exactly as
|
|
|
424
455
|
before (immediate validation per the form's `mode`, immediate error
|
|
425
456
|
display, `validate`-only).
|
|
426
457
|
|
|
458
|
+
## Accessibility & RTL
|
|
459
|
+
|
|
460
|
+
haze-ui supports RTL via CSS logical properties wherever a side is
|
|
461
|
+
semantic (the *start/end* of reading flow), not just decorative. Set
|
|
462
|
+
`dir="rtl"` (or `direction: rtl`) on an ancestor and those sides mirror
|
|
463
|
+
automatically — no component props change. A regression smoke test
|
|
464
|
+
(`src/lib/rtl.test.tsx`) renders Progress, Alert, Badge, Tag and Dialog
|
|
465
|
+
in a `dir="rtl"` subtree asserting rendering, axe cleanliness and
|
|
466
|
+
unchanged aria contracts.
|
|
467
|
+
|
|
468
|
+
### Direction-responsive by construction (no physical CSS)
|
|
469
|
+
|
|
470
|
+
- **Progress (bar)** — the fill is a normal-flow block with a percentage
|
|
471
|
+
`width`, so it grows from the inline-start edge (right in RTL) with no
|
|
472
|
+
`left`/`right` in its CSS.
|
|
473
|
+
- **Slider** — a native `<input type="range">`; the browser mirrors fill
|
|
474
|
+
and thumb under `dir="rtl"`.
|
|
475
|
+
- **Flex gap / `flex-direction: row`** — gap and row order follow the
|
|
476
|
+
writing mode, so icon-to-label spacing in Tag, ChatMessage, Alert, etc.
|
|
477
|
+
mirrors for free.
|
|
478
|
+
- **Carousel track scrolling** — uses `scrollIntoView({ inline: 'start' })`,
|
|
479
|
+
a logical scroll position.
|
|
480
|
+
|
|
481
|
+
### Fixed: physical → logical conversions
|
|
482
|
+
|
|
483
|
+
| File | Change |
|
|
484
|
+
| --- | --- |
|
|
485
|
+
| `Carousel.tsx` | prev/next buttons `left`/`right` → `inset-inline-start`/`inset-inline-end`, plus a `[dir='rtl']` `scale: -1 1` mirror so the `‹`/`›` glyphs point along the reading direction |
|
|
486
|
+
| `ChatMessage.tsx` | bubble tail corners `border-bottom-right-radius` / `border-bottom-left-radius` → `border-end-end-radius` / `border-end-start-radius` (tail follows the bubble's anchored side) |
|
|
487
|
+
| `Chip.tsx` | close-button `margin-left` → `margin-inline-start` |
|
|
488
|
+
| `Container.tsx` | `margin-left/right: auto` → `margin-inline: auto`; `padding-left/right` → `padding-inline` |
|
|
489
|
+
| `ContextMenuItem.tsx`, `DropdownMenuItem.tsx`, `MenuItem.tsx`, `ConversationItem.tsx` | `text-align: left` → `text-align: start` |
|
|
490
|
+
| `DiffViewer.tsx` | line-number gutter `text-align: right` → `end`, `border-right` → `border-inline-end` (gutter stays on the leading side) |
|
|
491
|
+
| `List.tsx` | `padding-left` → `padding-inline-start` (list indent), both variants |
|
|
492
|
+
| `NavigationBar.tsx` | end-slot `margin-left: auto` → `margin-inline-start: auto` |
|
|
493
|
+
| `StepTimeline.tsx` | connector line `left` → `inset-inline-start` (stays under the inline-start marker column) |
|
|
494
|
+
| `Stepper/Step.tsx` | connector `left: 50%` → `inset-inline-start: 50%` (extends toward the next step) |
|
|
495
|
+
| `TableHead.tsx` | `th { text-align: left }` → `start` |
|
|
496
|
+
| `TreeItem.tsx` | checkbox/icon `margin-right` → `margin-inline-end`; indent guide `border-left` → `border-inline-start` |
|
|
497
|
+
|
|
498
|
+
Kept physical on purpose — glyph geometry or symmetric layout, not
|
|
499
|
+
reading-flow sides: the rotated border chevrons in Accordion/Disclosure,
|
|
500
|
+
Checkbox's rotated checkmark, Radio's centered dot, Affix's symmetric
|
|
501
|
+
`left: 0; right: 0` stretch.
|
|
502
|
+
|
|
503
|
+
### Partial support: known gaps
|
|
504
|
+
|
|
505
|
+
- **Floating panels (Popover, DropdownMenu, Tooltip, ContextMenu,
|
|
506
|
+
Combobox, Datepicker)** — placements are physical sides
|
|
507
|
+
(`'left'`/`'right'`/`'bottom-end'`, …). The CSS anchor-positioning
|
|
508
|
+
`position-area` grid keywords and the JS collision math
|
|
509
|
+
(`utils/collision.ts`, viewport coordinates) are physical; migrating to
|
|
510
|
+
logical `position-area` keywords is a tracked future change. In RTL the
|
|
511
|
+
panels position identically to LTR.
|
|
512
|
+
- **Input adornments** — `SelectCore` / `ModelPicker` chevrons
|
|
513
|
+
(`background-position: right …` + `padding-right`) and
|
|
514
|
+
`PasswordInputCore`'s absolute reveal button sit on the physical right
|
|
515
|
+
with matching padding. Consistent under RTL, but not mirrored.
|
|
516
|
+
- **Progress (circle)** — SVG `stroke-dashoffset` fill runs clockwise
|
|
517
|
+
regardless of direction (SVG has no inline axis).
|
|
518
|
+
- **Physical-by-design placement APIs** — `Drawer` `placement`
|
|
519
|
+
(`'left'`/`'right'`), `Toast` placement (`'top-left'`, …),
|
|
520
|
+
`SwipeAction` left/right action edges, `BackToTop`'s bottom-right
|
|
521
|
+
corner, `CodeBlock`'s top-right language badge: the side is the API,
|
|
522
|
+
so it stays physical.
|
|
523
|
+
|
|
524
|
+
### Workaround for remaining gaps
|
|
525
|
+
|
|
526
|
+
Wrap with `dir="rtl"` for everything above; for the physical-by-design
|
|
527
|
+
cases, override with logical insets through the `className` every
|
|
528
|
+
component accepts:
|
|
529
|
+
|
|
530
|
+
```jsx
|
|
531
|
+
<Drawer placement="right" className="rtl-drawer" />
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
```css
|
|
535
|
+
[dir='rtl'] .rtl-drawer {
|
|
536
|
+
/* nudge a physical placement back to the reading-flow side */
|
|
537
|
+
inset-inline-end: 0;
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
427
541
|
## Related Projects
|
|
428
542
|
|
|
429
543
|
- [react-use-control](https://github.com/wmzy/react-use-control)
|
|
@@ -458,3 +572,28 @@ import 'haze-ui/css/button.css';
|
|
|
458
572
|
|
|
459
573
|
No — haze-ui is ESM-only (`"type": "module"`). Use a bundler or runtime
|
|
460
574
|
with ESM support (Vite, webpack 5, Next.js, Node ≥ 18, …).
|
|
575
|
+
|
|
576
|
+
### How do I detect (or degrade) the relative-color syntax?
|
|
577
|
+
|
|
578
|
+
Since v1.13, theme interaction states are derived with CSS relative
|
|
579
|
+
colors, so the browser baseline from [Browser support](#browser-support)
|
|
580
|
+
applies — Chrome/Edge 119+, Safari 16.4+, Firefox 128+, with no HSL/hex
|
|
581
|
+
fallbacks shipped. To gate your own fallback styling on support, probe
|
|
582
|
+
the syntax in CSS:
|
|
583
|
+
|
|
584
|
+
```css
|
|
585
|
+
@supports (color: oklch(from red calc(l + 0.05) 0 h)) {
|
|
586
|
+
/* relative colors available: derive custom states from tokens */
|
|
587
|
+
}
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
or from JS before deciding which stylesheet to load:
|
|
591
|
+
|
|
592
|
+
```js
|
|
593
|
+
if (CSS.supports('color: oklch(from red calc(l + 0.05) 0 h)')) {
|
|
594
|
+
// relative colors available — load the v1.13+ token sheet
|
|
595
|
+
} else {
|
|
596
|
+
// below baseline: pin a pre-OKLCH version or ship your own fallbacks
|
|
597
|
+
}
|
|
598
|
+
```
|
|
599
|
+
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useControl as
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { useControl as i } from "react-use-control";
|
|
6
7
|
//#region src/lib/components/Alert/Alert.tsx
|
|
7
|
-
var
|
|
8
|
+
var a = "haze-Alert__base", o = {
|
|
8
9
|
info: "haze-Alert__info",
|
|
9
10
|
success: "haze-Alert__success",
|
|
10
11
|
warning: "haze-Alert__warning",
|
|
11
12
|
danger: "haze-Alert__danger"
|
|
12
|
-
},
|
|
13
|
-
function
|
|
14
|
-
let [
|
|
15
|
-
return
|
|
13
|
+
}, s = "haze-Alert__contentStyle", c = "haze-Alert__closeBtn";
|
|
14
|
+
function l({ visible: l, onClose: u, variant: d = "info", closable: f = !1, className: p, children: m }) {
|
|
15
|
+
let [h, g] = i(l, !0), _ = t("alert");
|
|
16
|
+
return h ? /* @__PURE__ */ r("div", {
|
|
16
17
|
role: "alert",
|
|
17
18
|
className: e([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
a,
|
|
20
|
+
o[d],
|
|
21
|
+
p
|
|
21
22
|
]),
|
|
22
|
-
children: [/* @__PURE__ */
|
|
23
|
-
className: o,
|
|
24
|
-
children: p
|
|
25
|
-
}), d && /* @__PURE__ */ t("button", {
|
|
26
|
-
type: "button",
|
|
23
|
+
children: [/* @__PURE__ */ n("div", {
|
|
27
24
|
className: s,
|
|
28
|
-
|
|
25
|
+
children: m
|
|
26
|
+
}), f && /* @__PURE__ */ n("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
className: c,
|
|
29
|
+
"aria-label": _.close,
|
|
29
30
|
onClick: () => {
|
|
30
|
-
|
|
31
|
+
g(!1), u?.();
|
|
31
32
|
},
|
|
32
33
|
children: "×"
|
|
33
34
|
})]
|
|
34
35
|
}) : null;
|
|
35
36
|
}
|
|
36
37
|
//#endregion
|
|
37
|
-
export {
|
|
38
|
+
export { l as default };
|
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
6
|
//#region src/lib/components/ApprovalCard/ApprovalCard.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var i = "haze-ApprovalCard__card", a = "haze-ApprovalCard__header", o = "haze-ApprovalCard__body", s = "haze-ApprovalCard__desc", c = "haze-ApprovalCard__content", l = "haze-ApprovalCard__actions", u = "haze-ApprovalCard__btn", d = "haze-ApprovalCard__denyBtn", f = "haze-ApprovalCard__approveBtn";
|
|
8
|
+
function p({ title: p, description: m, onApprove: h, onDeny: g, approveText: _, denyText: v, children: y, className: b }) {
|
|
9
|
+
let x = t("approvalCard"), S = p ?? x.title, C = _ ?? x.approve, w = v ?? x.deny;
|
|
10
|
+
return /* @__PURE__ */ r("div", {
|
|
11
|
+
className: e([i, b]),
|
|
10
12
|
children: [
|
|
11
|
-
/* @__PURE__ */ t("div", {
|
|
12
|
-
className: e([i]),
|
|
13
|
-
children: f
|
|
14
|
-
}),
|
|
15
13
|
/* @__PURE__ */ n("div", {
|
|
16
14
|
className: e([a]),
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
children: S
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ r("div", {
|
|
18
|
+
className: e([o]),
|
|
19
|
+
children: [m && /* @__PURE__ */ n("div", {
|
|
21
20
|
className: e([s]),
|
|
22
|
-
children:
|
|
21
|
+
children: m
|
|
22
|
+
}), y && /* @__PURE__ */ n("div", {
|
|
23
|
+
className: e([c]),
|
|
24
|
+
children: y
|
|
23
25
|
})]
|
|
24
26
|
}),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
className: e([
|
|
27
|
-
children: [/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ r("div", {
|
|
28
|
+
className: e([l]),
|
|
29
|
+
children: [/* @__PURE__ */ n("button", {
|
|
28
30
|
type: "button",
|
|
29
|
-
onClick:
|
|
30
|
-
className: e([
|
|
31
|
-
children:
|
|
32
|
-
}), /* @__PURE__ */
|
|
31
|
+
onClick: g,
|
|
32
|
+
className: e([u, d]),
|
|
33
|
+
children: w
|
|
34
|
+
}), /* @__PURE__ */ n("button", {
|
|
33
35
|
type: "button",
|
|
34
|
-
onClick:
|
|
35
|
-
className: e([
|
|
36
|
-
children:
|
|
36
|
+
onClick: h,
|
|
37
|
+
className: e([u, f]),
|
|
38
|
+
children: C
|
|
37
39
|
})]
|
|
38
40
|
})
|
|
39
41
|
]
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
//#endregion
|
|
43
|
-
export {
|
|
45
|
+
export { p as default };
|
|
@@ -1,62 +1,64 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
6
|
//#region src/lib/components/AsyncSection/AsyncSection.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
var i = "haze-AsyncSection__base", a = "haze-AsyncSection__placeholder", o = "haze-AsyncSection__spin", s = "haze-AsyncSection__errorBox", c = "haze-AsyncSection__errorMessage", l = "haze-AsyncSection__retryButton";
|
|
8
|
+
function u({ loading: u = !1, error: d, onRetry: f, loadingText: p, errorText: m, retryText: h, className: g, children: _ }) {
|
|
9
|
+
let v = t("asyncSection"), y = p ?? v.loading, b = h ?? v.retry;
|
|
10
|
+
if (u) return /* @__PURE__ */ n("section", {
|
|
9
11
|
"aria-busy": "true",
|
|
10
|
-
className: e([
|
|
11
|
-
children:
|
|
12
|
+
className: e([i, g]),
|
|
13
|
+
children: r("div", {
|
|
12
14
|
role: "status",
|
|
13
|
-
className: e([
|
|
14
|
-
children: [/* @__PURE__ */
|
|
15
|
+
className: e([a]),
|
|
16
|
+
children: [/* @__PURE__ */ n("span", {
|
|
15
17
|
"aria-hidden": "true",
|
|
16
|
-
className: e([
|
|
17
|
-
children: /* @__PURE__ */
|
|
18
|
+
className: e([o]),
|
|
19
|
+
children: /* @__PURE__ */ r("svg", {
|
|
18
20
|
viewBox: "0 0 24 24",
|
|
19
21
|
fill: "none",
|
|
20
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ n("circle", {
|
|
22
24
|
cx: "12",
|
|
23
25
|
cy: "12",
|
|
24
26
|
r: "10",
|
|
25
27
|
stroke: "var(--haze-color-border)",
|
|
26
28
|
strokeWidth: "3"
|
|
27
|
-
}), /* @__PURE__ */
|
|
29
|
+
}), /* @__PURE__ */ n("path", {
|
|
28
30
|
d: "M12 2a10 10 0 0 1 10 10",
|
|
29
31
|
stroke: "var(--haze-color-primary)",
|
|
30
32
|
strokeWidth: "3",
|
|
31
33
|
strokeLinecap: "round"
|
|
32
34
|
})]
|
|
33
35
|
})
|
|
34
|
-
}),
|
|
36
|
+
}), y]
|
|
35
37
|
})
|
|
36
38
|
});
|
|
37
|
-
if (
|
|
38
|
-
let
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
className: e([
|
|
41
|
-
children:
|
|
39
|
+
if (d != null) {
|
|
40
|
+
let t = m ?? (d instanceof Error && d.message ? d.message : void 0) ?? v.error;
|
|
41
|
+
return /* @__PURE__ */ n("section", {
|
|
42
|
+
className: e([i, g]),
|
|
43
|
+
children: r("div", {
|
|
42
44
|
role: "alert",
|
|
43
|
-
className: e([
|
|
44
|
-
children: [/* @__PURE__ */
|
|
45
|
-
className: e([s]),
|
|
46
|
-
children: i
|
|
47
|
-
}), d && /* @__PURE__ */ t("button", {
|
|
48
|
-
type: "button",
|
|
49
|
-
onClick: d,
|
|
45
|
+
className: e([s]),
|
|
46
|
+
children: [/* @__PURE__ */ n("p", {
|
|
50
47
|
className: e([c]),
|
|
51
|
-
children:
|
|
48
|
+
children: t
|
|
49
|
+
}), f && /* @__PURE__ */ n("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
onClick: f,
|
|
52
|
+
className: e([l]),
|
|
53
|
+
children: b
|
|
52
54
|
})]
|
|
53
55
|
})
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
className: e([
|
|
58
|
-
children:
|
|
58
|
+
return /* @__PURE__ */ n("section", {
|
|
59
|
+
className: e([i, g]),
|
|
60
|
+
children: _
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
//#endregion
|
|
62
|
-
export {
|
|
64
|
+
export { u as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { formatString as t } from "../LocaleProvider/locale.js";
|
|
4
|
+
import { useStrings as n } from "../LocaleProvider/useStrings.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
import { Children as a } from "react";
|
|
8
|
+
//#region src/lib/components/AvatarGroup/AvatarGroup.tsx
|
|
9
|
+
var o = "haze-AvatarGroup__base", s = "haze-AvatarGroup__item", c = "haze-AvatarGroup__itemStacked", l = "haze-AvatarGroup__overflowChip";
|
|
10
|
+
function u({ max: u, total: d, className: f, children: p, ...m }) {
|
|
11
|
+
let h = n("avatarGroup"), g = a.toArray(p), _ = u === void 0 ? g.length : Math.max(u, 0), v = g.length > _, y = v ? g.slice(0, _) : g, b = d ?? g.length - _;
|
|
12
|
+
return /* @__PURE__ */ i("div", {
|
|
13
|
+
...m,
|
|
14
|
+
className: e([o, f]),
|
|
15
|
+
children: [y.map((t, n) => /* @__PURE__ */ r("span", {
|
|
16
|
+
className: e([s, n > 0 && c]),
|
|
17
|
+
children: t
|
|
18
|
+
}, n)), v && /* @__PURE__ */ r("span", {
|
|
19
|
+
className: e([
|
|
20
|
+
s,
|
|
21
|
+
l,
|
|
22
|
+
y.length > 0 && c
|
|
23
|
+
]),
|
|
24
|
+
children: t(h.more, { count: b })
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { u as default };
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useCallback as
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
6
7
|
//#region src/lib/components/BackToTop/BackToTop.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let [
|
|
10
|
-
|
|
11
|
-
}, [
|
|
12
|
-
return
|
|
8
|
+
var o = "haze-BackToTop__button", s = "haze-BackToTop__hidden";
|
|
9
|
+
function c({ threshold: c = 300, children: l = "↑", className: u }) {
|
|
10
|
+
let [d, f] = a(!1), p = t("backToTop"), m = r(() => {
|
|
11
|
+
f(window.scrollY > c);
|
|
12
|
+
}, [c]);
|
|
13
|
+
return i(() => (window.addEventListener("scroll", m, { passive: !0 }), () => window.removeEventListener("scroll", m)), [m]), /* @__PURE__ */ n("button", {
|
|
13
14
|
onClick: () => {
|
|
14
15
|
window.scrollTo({
|
|
15
16
|
top: 0,
|
|
16
17
|
behavior: "smooth"
|
|
17
18
|
});
|
|
18
19
|
},
|
|
19
|
-
"aria-label":
|
|
20
|
+
"aria-label": p.label,
|
|
20
21
|
className: e([
|
|
21
|
-
|
|
22
|
-
!
|
|
23
|
-
|
|
22
|
+
o,
|
|
23
|
+
!d && s,
|
|
24
|
+
u
|
|
24
25
|
]),
|
|
25
|
-
children:
|
|
26
|
+
children: l
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
//#endregion
|
|
29
|
-
export {
|
|
30
|
+
export { c as default };
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useControl as
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { useControl as i } from "react-use-control";
|
|
6
7
|
//#region src/lib/components/Banner/Banner.tsx
|
|
7
|
-
var
|
|
8
|
+
var a = "haze-Banner__banner", o = {
|
|
8
9
|
info: "haze-Banner__info",
|
|
9
10
|
success: "haze-Banner__success",
|
|
10
11
|
warning: "haze-Banner__warning",
|
|
11
12
|
danger: "haze-Banner__danger"
|
|
12
|
-
},
|
|
13
|
-
function
|
|
14
|
-
let [
|
|
15
|
-
return
|
|
13
|
+
}, s = "haze-Banner__closeBtn", c = "haze-Banner__content";
|
|
14
|
+
function l({ visible: l, onClose: u, variant: d = "info", children: f, className: p }) {
|
|
15
|
+
let [m, h] = i(l, !0), g = t("banner");
|
|
16
|
+
return m ? /* @__PURE__ */ r("div", {
|
|
16
17
|
role: "alert",
|
|
17
18
|
className: e([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
a,
|
|
20
|
+
o[d],
|
|
21
|
+
p
|
|
21
22
|
]),
|
|
22
|
-
children: [/* @__PURE__ */
|
|
23
|
-
className: e([
|
|
24
|
-
children:
|
|
25
|
-
}),
|
|
23
|
+
children: [/* @__PURE__ */ n("div", {
|
|
24
|
+
className: e([c]),
|
|
25
|
+
children: f
|
|
26
|
+
}), u && /* @__PURE__ */ n("button", {
|
|
26
27
|
type: "button",
|
|
27
28
|
onClick: () => {
|
|
28
|
-
|
|
29
|
+
h(!1), u?.();
|
|
29
30
|
},
|
|
30
|
-
"aria-label":
|
|
31
|
-
className: e([
|
|
31
|
+
"aria-label": g.close,
|
|
32
|
+
className: e([s]),
|
|
32
33
|
children: "x"
|
|
33
34
|
})]
|
|
34
35
|
}) : null;
|
|
35
36
|
}
|
|
36
37
|
//#endregion
|
|
37
|
-
export {
|
|
38
|
+
export { l as default };
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { Children as
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { Children as i } from "react";
|
|
6
7
|
//#region src/lib/components/Breadcrumb/Breadcrumb.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
"aria-label":
|
|
12
|
-
className: e([
|
|
13
|
-
children:
|
|
14
|
-
className:
|
|
15
|
-
children:
|
|
16
|
-
"aria-current":
|
|
17
|
-
children: [e,
|
|
18
|
-
className:
|
|
8
|
+
var a = "haze-Breadcrumb__nav", o = "haze-Breadcrumb__list", s = "haze-Breadcrumb__sep";
|
|
9
|
+
function c({ separator: c = "/", className: l, children: u }) {
|
|
10
|
+
let d = t("breadcrumb"), f = i.toArray(u);
|
|
11
|
+
return /* @__PURE__ */ n("nav", {
|
|
12
|
+
"aria-label": d.label,
|
|
13
|
+
className: e([a, l]),
|
|
14
|
+
children: n("ol", {
|
|
15
|
+
className: o,
|
|
16
|
+
children: f.map((e, t) => /* @__PURE__ */ r("li", {
|
|
17
|
+
"aria-current": t === f.length - 1 ? "page" : void 0,
|
|
18
|
+
children: [e, t < f.length - 1 && /* @__PURE__ */ n("span", {
|
|
19
|
+
className: s,
|
|
19
20
|
"aria-hidden": "true",
|
|
20
|
-
children:
|
|
21
|
+
children: c
|
|
21
22
|
})]
|
|
22
|
-
},
|
|
23
|
+
}, t))
|
|
23
24
|
})
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
//#endregion
|
|
27
|
-
export {
|
|
28
|
+
export { c as default };
|