@webority/ui-react 0.18.1 → 0.20.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/dist/types/components/AppModal.d.ts +1 -1
- package/dist/types/components/AppMultiSelect.d.ts +1 -1
- package/dist/types/components/AppShell.d.ts +2 -2
- package/dist/types/components/AppThemeToggle.d.ts +50 -0
- package/dist/types/components/AppTimePicker.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/ui-react.js +919 -819
- package/package.json +3 -3
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param {import('react').ReactNode} [props.eyebrow] A small kicker label above the title.
|
|
7
7
|
* @param {import('react').ReactNode} [props.title]
|
|
8
8
|
* @param {import('react').ReactNode} [props.subtitle]
|
|
9
|
-
* @param {string} [props.headerIcon]
|
|
9
|
+
* @param {string} [props.headerIcon] library icon name
|
|
10
10
|
* @param {'default'|'danger'|'success'|'warning'} [props.tone='default'] Tints the header icon
|
|
11
11
|
* and eyebrow to signal intent — a destructive or a success dialog reads it from the header.
|
|
12
12
|
* @param {boolean} [props.dismissible=true] Show the header close (×) button. Pair with
|
|
@@ -30,7 +30,7 @@ import "@webority/ui-elements";
|
|
|
30
30
|
* @param {string} [props.customInvalidMessage] Message for a refused typed entry
|
|
31
31
|
* (default "Enter a valid value.").
|
|
32
32
|
* @param {boolean} [props.disabled]
|
|
33
|
-
* @param {string} [props.icon] Leading glyph inside the control (a
|
|
33
|
+
* @param {string} [props.icon] Leading glyph inside the control (a library icon name).
|
|
34
34
|
* @param {'sm'|'lg'} [props.size] Control size around the default.
|
|
35
35
|
* @param {boolean} [props.collapseChips=false] Keep the chosen chips on one row and fold the
|
|
36
36
|
* overflow into a "+N" counter, rather than letting the control grow.
|
|
@@ -2,7 +2,7 @@ export type NavItemShape = {
|
|
|
2
2
|
key?: string;
|
|
3
3
|
label: string;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* library icon name, or a node, so a
|
|
6
6
|
* product with its own content-icon set (iconsax behind a product `Icon` seam) can use it.
|
|
7
7
|
*/
|
|
8
8
|
icon?: string | import('react').ReactNode;
|
|
@@ -32,7 +32,7 @@ export type NavItemShape = {
|
|
|
32
32
|
* @typedef {object} NavItemShape
|
|
33
33
|
* @property {string} [key]
|
|
34
34
|
* @property {string} label
|
|
35
|
-
* @property {string|import('react').ReactNode} [icon]
|
|
35
|
+
* @property {string|import('react').ReactNode} [icon] library icon name, or a node, so a
|
|
36
36
|
* product with its own content-icon set (iconsax behind a product `Icon` seam) can use it.
|
|
37
37
|
* @property {string} href
|
|
38
38
|
* @property {import('react').ReactNode} [badge] A count or short status at the row's end.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The light/dark switch: flips the whole page's theme with a page-wide effect (a wave rising
|
|
3
|
+
* from the bottom, a circle growing from the press, a wipe, blinds, or a fade). Two shapes:
|
|
4
|
+
* `variant="icon"` (default), one action disc that cycles through the modes, and
|
|
5
|
+
* `variant="segmented"`, one option per mode laid out like `AppSegmented`, so each mode is a
|
|
6
|
+
* button of its own. It owns the theme either way: it reads the stored choice, writes
|
|
7
|
+
* `data-theme` and `data-bs-theme` on `<html>` (which the design system and Bootstrap both
|
|
8
|
+
* read), and remembers the choice in localStorage under `storageKey`.
|
|
9
|
+
*
|
|
10
|
+
* Mount it anywhere in the chrome; two on one page stay in step. To avoid a wrong-theme flash
|
|
11
|
+
* before React runs, stamp the stored choice in an inline script in `<head>` (see the catalogue
|
|
12
|
+
* page); the component then takes over from that state.
|
|
13
|
+
*
|
|
14
|
+
* The effect needs the View Transitions API; without it, under `prefers-reduced-motion`, or when
|
|
15
|
+
* the page already shows the requested theme (dark to auto on a dark system), the switch is
|
|
16
|
+
* instant. Dark always comes up from the bottom and light down from the top, for the effects
|
|
17
|
+
* that have a direction.
|
|
18
|
+
*
|
|
19
|
+
* @param {object} props
|
|
20
|
+
* @param {"icon"|"segmented"} [props.variant="icon"] One cycling disc, or one option per mode.
|
|
21
|
+
* @param {"wave"|"circle"|"slide"|"blinds"|"fade"|"none"} [props.effect="wave"] The page-wide effect.
|
|
22
|
+
* @param {boolean} [props.includeAuto=false] Offer a third, system-following mode: light, dark, auto.
|
|
23
|
+
* @param {string} [props.storageKey="theme"] The localStorage key the choice is kept under.
|
|
24
|
+
* @param {number} [props.duration] Effect length in ms; each effect has its own default.
|
|
25
|
+
* @param {string} [props.label="Theme"] Accessible name: the disc's tooltip ("Theme: dark") or the segmented group's name.
|
|
26
|
+
* @param {string} [props.lightLabel="Light"] The segmented variant's option text for light.
|
|
27
|
+
* @param {string} [props.darkLabel="Dark"] The segmented variant's option text for dark.
|
|
28
|
+
* @param {string} [props.autoLabel="System"] The segmented variant's option text for auto.
|
|
29
|
+
* @param {string} [props.name] The segmented variant's field name (what groups its radios). Defaults to a generated one.
|
|
30
|
+
* @param {"sm"|"md"|"lg"|"xl"} [props.size="md"] The disc's glyph size (16/20/24/28px, the disc scales with it) or the segmented strip's size.
|
|
31
|
+
* @param {"auto"|"top"|"bottom"|"start"|"end"} [props.tooltipPlacement="auto"] The disc's preferred tooltip side.
|
|
32
|
+
* @param {(mode: "light"|"dark"|"auto") => void} [props.onChange] Fires with the new mode once it is applied.
|
|
33
|
+
* @param {string} [props.className]
|
|
34
|
+
*/
|
|
35
|
+
export default function AppThemeToggle({ variant, effect, includeAuto, storageKey, duration, label, lightLabel, darkLabel, autoLabel, name, size, tooltipPlacement, onChange, className, ...rest }: {
|
|
36
|
+
variant?: "icon" | "segmented";
|
|
37
|
+
effect?: "wave" | "circle" | "slide" | "blinds" | "fade" | "none";
|
|
38
|
+
includeAuto?: boolean;
|
|
39
|
+
storageKey?: string;
|
|
40
|
+
duration?: number;
|
|
41
|
+
label?: string;
|
|
42
|
+
lightLabel?: string;
|
|
43
|
+
darkLabel?: string;
|
|
44
|
+
autoLabel?: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
47
|
+
tooltipPlacement?: "auto" | "top" | "bottom" | "start" | "end";
|
|
48
|
+
onChange?: (mode: "light" | "dark" | "auto") => void;
|
|
49
|
+
className?: string;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
@@ -16,6 +16,8 @@ import "@webority/ui-elements";
|
|
|
16
16
|
* @param {boolean} [props.required]
|
|
17
17
|
* @param {string} [props.hint]
|
|
18
18
|
* @param {string} [props.error]
|
|
19
|
+
* @param {import('react').ReactNode} [props.help] Content for the label info-tip.
|
|
20
|
+
* @param {string} [props.helpLabel="More information"] aria-label for the info-tip button.
|
|
19
21
|
* @param {string} [props.name]
|
|
20
22
|
* @param {string} [props.min] Time in "HH:mm" format
|
|
21
23
|
* @param {string} [props.max] Time in "HH:mm" format
|
package/dist/types/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export { default as AppTableToolbar } from "./components/AppTableToolbar.jsx";
|
|
|
80
80
|
export { default as AppTabs } from "./components/AppTabs.jsx";
|
|
81
81
|
export { default as AppTagInput } from "./components/AppTagInput.jsx";
|
|
82
82
|
export { default as AppTextarea } from "./components/AppTextarea.jsx";
|
|
83
|
+
export { default as AppThemeToggle } from "./components/AppThemeToggle.jsx";
|
|
83
84
|
export { default as AppTimeline } from "./components/AppTimeline.jsx";
|
|
84
85
|
export { default as AppTimePicker } from "./components/AppTimePicker.jsx";
|
|
85
86
|
export { default as AppToast } from "./components/AppToast.jsx";
|