@aortl/admin-react 0.18.5 → 0.19.1
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/CHANGELOG.md +19 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/PropertyList.d.ts +1 -1
- package/dist/PropertyList.d.ts.map +1 -1
- package/dist/ToggleButton.d.ts +25 -0
- package/dist/ToggleButton.d.ts.map +1 -0
- package/dist/admin.scoped.css +31 -2
- package/dist/index.cjs +57 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +57 -7
- package/dist/index.mjs.map +1 -1
- package/dist/useHotkey.d.ts +10 -0
- package/dist/useHotkey.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.19.1] - 2026-07-02
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Copyable `PropertyList` value cells copy on click anywhere in the cell, not only on the copy button (which stays as the keyboard and screen-reader path). Selecting text or clicking an interactive child doesn't trigger a copy; the cell shows a pointer cursor. (both)
|
|
12
|
+
|
|
13
|
+
## [0.19.0] - 2026-07-02
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `ToggleButton` — a two-state button styled like `Button` (same variants, sizes, icons, `hotkey`), wrapping Base UI Toggle. CSS-side there is no new class: any `.btn` with an `aria-pressed` attribute renders a leading mini-switch indicator, and `aria-pressed="true"` slides it on and adds a selected wash — so vanilla toggles and `.btn-group` composition work out of the box. (both)
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Dialog body no longer clips its content in Safari. `.dialog-body` (and the form-dialog wrapper) used `flex: 1 1 0%`; Safari collapses a `flex-basis: 0` item that is itself an `overflow` scroll container to ~0 content height, so even short bodies were cut off behind a scrollbar. Switched to `flex: 1 1 auto` — content still shrinks and scrolls when tall. (css)
|
|
22
|
+
|
|
7
23
|
## [0.18.5] - 2026-06-30
|
|
8
24
|
|
|
9
25
|
### Fixed
|
|
@@ -111,12 +127,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
111
127
|
- Make `primary` a high-contrast neutral and move blue to `info`. (both)
|
|
112
128
|
- Use solid color fills for `Alert` and `Badge` status variants. (both)
|
|
113
129
|
|
|
114
|
-
[Unreleased]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.
|
|
130
|
+
[Unreleased]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.19.1...HEAD
|
|
115
131
|
[0.16.1]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.16.0...v0.16.1
|
|
116
132
|
[0.16.0]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.15.1...v0.16.0
|
|
117
133
|
[0.15.1]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.15.0...v0.15.1
|
|
118
134
|
[0.15.0]: https://github.com/Digital-Udvikling/admin-design-system/releases/tag/v0.15.0
|
|
119
135
|
|
|
136
|
+
[0.19.1]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.19.0...v0.19.1
|
|
137
|
+
[0.19.0]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.18.5...v0.19.0
|
|
120
138
|
[0.18.5]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.18.4...v0.18.5
|
|
121
139
|
[0.18.4]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.18.3...v0.18.4
|
|
122
140
|
[0.18.3]: https://github.com/Digital-Udvikling/admin-design-system/compare/v0.18.2...v0.18.3
|
package/dist/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAInD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AACjF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,OAAO,UAAU,CAAC;IACpE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;uEACmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,uFAAuF;IACvF,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAmB,EACnB,IAAW,EACX,SAAS,EACT,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,SAAS,EACT,IAAe,EACf,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,GAAG,EACH,GAAG,IAAI,EACR,EAAE,WAAW,2CAkCb"}
|
package/dist/PropertyList.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface PropertyListValueProps extends ComponentProps<"dd"> {
|
|
|
36
36
|
/** Per-slot class overrides. `className` targets the root; these target inner slots. */
|
|
37
37
|
classNames?: SlotClasses<"copy">;
|
|
38
38
|
}
|
|
39
|
-
declare function PropertyListValue({ numeric, copyable, empty, copyValue, className, classNames, children, ...rest }: PropertyListValueProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
declare function PropertyListValue({ numeric, copyable, empty, copyValue, className, classNames, children, onClick, ...rest }: PropertyListValueProps): import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export declare const PropertyList: typeof PropertyListRoot & {
|
|
41
41
|
Item: typeof PropertyListItem;
|
|
42
42
|
Label: typeof PropertyListLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyList.d.ts","sourceRoot":"","sources":["../src/PropertyList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"PropertyList.d.ts","sourceRoot":"","sources":["../src/PropertyList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAmB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAM,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AA4C5C,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,wFAAwF;IACxF,UAAU,CAAC,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;CAC7C;AAED,iBAAS,gBAAgB,CAAC,EACxB,OAAO,EACP,OAAO,EACP,cAAc,EACd,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,iBAAiB,2CAoBnB;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC1F,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,UAAU,CAAC,EAAE,WAAW,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;CAC5C;AASD,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,qBAAqB,2CAoBvB;AAED,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAC1D,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,sBAAsB,2CAExE;AAED,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mFAAmF;IACnF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,iBAAS,iBAAiB,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAO,EACP,GAAG,IAAI,EACR,EAAE,sBAAsB,2CA0DxB;AAED,eAAO,MAAM,YAAY;;;;CAIvB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { ButtonSize, ButtonVariant } from './Button';
|
|
4
|
+
import { IconProp } from './icon';
|
|
5
|
+
export interface ToggleButtonProps extends ComponentProps<typeof BaseToggle> {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
fullWidth?: boolean;
|
|
9
|
+
/** Leading icon. Pass a component (`icon={IconStar}`) or an element. */
|
|
10
|
+
icon?: IconProp;
|
|
11
|
+
/** Trailing icon. Pass a component (`iconTrailing={IconChevronDown}`) or an element. */
|
|
12
|
+
iconTrailing?: IconProp;
|
|
13
|
+
/**
|
|
14
|
+
* Keyboard shortcut that dispatches a native click on the button, flipping
|
|
15
|
+
* the pressed state. Same syntax as `useHotkey`. Pass an array for
|
|
16
|
+
* alternatives — only the first is rendered as a visual chip.
|
|
17
|
+
*/
|
|
18
|
+
hotkey?: string | readonly string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A two-state button styled like `Button`; `aria-pressed` carries the state,
|
|
22
|
+
* which CSS renders as a leading mini switch. Composes with `ButtonGroup`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ToggleButton({ variant, size, fullWidth, icon, iconTrailing, hotkey, className, disabled, children, ref, ...rest }: ToggleButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=ToggleButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleButton.d.ts","sourceRoot":"","sources":["../src/ToggleButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAInD,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,OAAO,UAAU,CAAC;IAC1E,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wEAAwE;IACxE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,wFAAwF;IACxF,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAmB,EACnB,IAAW,EACX,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,GAAG,IAAI,EACR,EAAE,iBAAiB,2CA2BnB"}
|
package/dist/admin.scoped.css
CHANGED
|
@@ -1744,6 +1744,9 @@
|
|
|
1744
1744
|
padding: 0.125rem;
|
|
1745
1745
|
transition: opacity 100ms ease, color 100ms ease;
|
|
1746
1746
|
}
|
|
1747
|
+
:scope._ao-property-list-value-copyable, :scope ._ao-property-list-value-copyable {
|
|
1748
|
+
cursor: pointer;
|
|
1749
|
+
}
|
|
1747
1750
|
:scope._ao-property-list-value-copyable ._ao-property-list-copy, :scope ._ao-property-list-value-copyable ._ao-property-list-copy {
|
|
1748
1751
|
display: inline-flex;
|
|
1749
1752
|
opacity: 0;
|
|
@@ -1874,6 +1877,29 @@
|
|
|
1874
1877
|
opacity: 90%;
|
|
1875
1878
|
}
|
|
1876
1879
|
}
|
|
1880
|
+
:scope._ao-btn:is([aria-pressed="true"], [data-pressed]), :scope ._ao-btn:is([aria-pressed="true"], [data-pressed]) {
|
|
1881
|
+
background-color: var(--color-primary-muted);
|
|
1882
|
+
color: var(--color-primary);
|
|
1883
|
+
}
|
|
1884
|
+
:scope._ao-btn:is([aria-pressed], [data-pressed])::before, :scope ._ao-btn:is([aria-pressed], [data-pressed])::before {
|
|
1885
|
+
--btn-toggle-thumb: var(--color-paper);
|
|
1886
|
+
content: "";
|
|
1887
|
+
flex-shrink: 0;
|
|
1888
|
+
inline-size: 1.75em;
|
|
1889
|
+
block-size: 1em;
|
|
1890
|
+
border-radius: 9999px;
|
|
1891
|
+
background-color: var(--color-border-strong);
|
|
1892
|
+
background-image: radial-gradient( circle closest-side, var(--btn-toggle-thumb) calc(100% - 0.5px), transparent );
|
|
1893
|
+
background-size: calc(1em - 4px) calc(1em - 4px);
|
|
1894
|
+
background-position: 2px 50%;
|
|
1895
|
+
background-repeat: no-repeat;
|
|
1896
|
+
transition: background-color 150ms, background-position 150ms;
|
|
1897
|
+
}
|
|
1898
|
+
:scope._ao-btn:is([aria-pressed="true"], [data-pressed])::before, :scope ._ao-btn:is([aria-pressed="true"], [data-pressed])::before {
|
|
1899
|
+
--btn-toggle-thumb: var(--color-primary-content);
|
|
1900
|
+
background-color: var(--color-primary);
|
|
1901
|
+
background-position: calc(100% - 2px) 50%;
|
|
1902
|
+
}
|
|
1877
1903
|
:scope._ao-btn-sm, :scope ._ao-btn-sm {
|
|
1878
1904
|
gap: calc(var(--spacing) * 1.5);
|
|
1879
1905
|
padding-inline: calc(var(--spacing) * 3);
|
|
@@ -1930,6 +1956,9 @@
|
|
|
1930
1956
|
:scope._ao-btn-loading::before, :scope ._ao-btn-loading::before {
|
|
1931
1957
|
animation-duration: 2s;
|
|
1932
1958
|
}
|
|
1959
|
+
:scope._ao-btn:is([aria-pressed], [data-pressed])::before, :scope ._ao-btn:is([aria-pressed], [data-pressed])::before {
|
|
1960
|
+
transition: none;
|
|
1961
|
+
}
|
|
1933
1962
|
}
|
|
1934
1963
|
:scope._ao-btn-group, :scope ._ao-btn-group {
|
|
1935
1964
|
display: inline-flex;
|
|
@@ -3635,7 +3664,7 @@
|
|
|
3635
3664
|
:scope._ao-dialog-body, :scope ._ao-dialog-body {
|
|
3636
3665
|
display: flex;
|
|
3637
3666
|
min-height: calc(var(--spacing) * 0);
|
|
3638
|
-
flex:
|
|
3667
|
+
flex: auto;
|
|
3639
3668
|
flex-direction: column;
|
|
3640
3669
|
gap: calc(var(--spacing) * 3);
|
|
3641
3670
|
overflow-y: auto;
|
|
@@ -3645,7 +3674,7 @@
|
|
|
3645
3674
|
:scope._ao-dialog > form, :scope ._ao-dialog > form {
|
|
3646
3675
|
display: flex;
|
|
3647
3676
|
min-height: calc(var(--spacing) * 0);
|
|
3648
|
-
flex:
|
|
3677
|
+
flex: auto;
|
|
3649
3678
|
flex-direction: column;
|
|
3650
3679
|
}
|
|
3651
3680
|
:scope._ao-dialog-footer, :scope ._ao-dialog-footer {
|
package/dist/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
4
4
|
let react = require("react");
|
|
5
5
|
let _base_ui_react_avatar = require("@base-ui/react/avatar");
|
|
6
6
|
let _base_ui_react_button = require("@base-ui/react/button");
|
|
7
|
+
let _base_ui_react_toggle = require("@base-ui/react/toggle");
|
|
7
8
|
let _base_ui_react_input = require("@base-ui/react/input");
|
|
8
9
|
let _base_ui_react_number_field = require("@base-ui/react/number-field");
|
|
9
10
|
let _base_ui_react_field = require("@base-ui/react/field");
|
|
@@ -568,16 +569,28 @@ function useHotkey(keys, handler, options) {
|
|
|
568
569
|
}, [derived, enabled]);
|
|
569
570
|
return derived;
|
|
570
571
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
572
|
+
/**
|
|
573
|
+
* `useHotkey` bound to a rendered element: the chord dispatches a native
|
|
574
|
+
* `.click()`, so `onClick` fires, `type="submit"` submits, an anchor
|
|
575
|
+
* navigates. Returns `setRef` to pass as the element's ref; it latches the
|
|
576
|
+
* element and forwards `ref`.
|
|
577
|
+
*/
|
|
578
|
+
function useHotkeyClick(keys, ref, options) {
|
|
574
579
|
const elementRef = (0, react.useRef)(null);
|
|
575
580
|
const setRef = (0, react.useCallback)((node) => {
|
|
576
581
|
elementRef.current = node;
|
|
577
582
|
if (typeof ref === "function") ref(node);
|
|
578
583
|
else if (ref) ref.current = node;
|
|
579
584
|
}, [ref]);
|
|
580
|
-
|
|
585
|
+
return {
|
|
586
|
+
...useHotkey(keys, () => elementRef.current?.click(), options),
|
|
587
|
+
setRef
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/Button.tsx
|
|
592
|
+
function Button({ variant = "default", size = "md", fullWidth, loading, icon, iconTrailing, hotkey, className, type = "button", disabled, children, onClick, ref, ...rest }) {
|
|
593
|
+
const { ariaKeyShortcuts, primaryChord, setRef } = useHotkeyClick(hotkey, ref, { enabled: !disabled && !loading });
|
|
581
594
|
const iconOnly = children == null && (icon != null || iconTrailing != null);
|
|
582
595
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_button.Button, {
|
|
583
596
|
ref: setRef,
|
|
@@ -617,6 +630,33 @@ function ButtonGroup({ orientation = "horizontal", fullWidth = false, role = "gr
|
|
|
617
630
|
});
|
|
618
631
|
}
|
|
619
632
|
//#endregion
|
|
633
|
+
//#region src/ToggleButton.tsx
|
|
634
|
+
/**
|
|
635
|
+
* A two-state button styled like `Button`; `aria-pressed` carries the state,
|
|
636
|
+
* which CSS renders as a leading mini switch. Composes with `ButtonGroup`.
|
|
637
|
+
*/
|
|
638
|
+
function ToggleButton({ variant = "default", size = "md", fullWidth, icon, iconTrailing, hotkey, className, disabled, children, ref, ...rest }) {
|
|
639
|
+
const { ariaKeyShortcuts, primaryChord, setRef } = useHotkeyClick(hotkey, ref, { enabled: !disabled });
|
|
640
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_toggle.Toggle, {
|
|
641
|
+
ref: setRef,
|
|
642
|
+
disabled,
|
|
643
|
+
"aria-keyshortcuts": ariaKeyShortcuts,
|
|
644
|
+
className: cn([
|
|
645
|
+
"btn",
|
|
646
|
+
variant !== "default" && `btn-${variant}`,
|
|
647
|
+
size !== "md" && `btn-${size}`,
|
|
648
|
+
fullWidth && "btn-full-width"
|
|
649
|
+
], className),
|
|
650
|
+
...rest,
|
|
651
|
+
children: [
|
|
652
|
+
renderIcon(icon),
|
|
653
|
+
children,
|
|
654
|
+
renderIcon(iconTrailing),
|
|
655
|
+
primaryChord !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kbd, { keys: primaryChord }) : null
|
|
656
|
+
]
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
//#endregion
|
|
620
660
|
//#region src/Breadcrumbs.tsx
|
|
621
661
|
function BreadcrumbsRoot({ separator, className, children, "aria-label": ariaLabel = "Breadcrumb", ...rest }) {
|
|
622
662
|
const items = react.Children.toArray(children).filter(react.isValidElement);
|
|
@@ -2542,8 +2582,9 @@ function PropertyListLabel({ className, ...rest }) {
|
|
|
2542
2582
|
...rest
|
|
2543
2583
|
});
|
|
2544
2584
|
}
|
|
2545
|
-
function PropertyListValue({ numeric, copyable, empty, copyValue, className, classNames, children, ...rest }) {
|
|
2585
|
+
function PropertyListValue({ numeric, copyable, empty, copyValue, className, classNames, children, onClick, ...rest }) {
|
|
2546
2586
|
const ddRef = (0, react.useRef)(null);
|
|
2587
|
+
const copyButtonRef = (0, react.useRef)(null);
|
|
2547
2588
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
2548
2589
|
async function handleCopy() {
|
|
2549
2590
|
const text = copyValue ?? ddRef.current?.textContent?.trim() ?? "";
|
|
@@ -2554,6 +2595,14 @@ function PropertyListValue({ numeric, copyable, empty, copyValue, className, cla
|
|
|
2554
2595
|
setTimeout(() => setCopied(false), 1200);
|
|
2555
2596
|
} catch {}
|
|
2556
2597
|
}
|
|
2598
|
+
function handleCellClick(event) {
|
|
2599
|
+
onClick?.(event);
|
|
2600
|
+
if (event.defaultPrevented) return;
|
|
2601
|
+
if (window.getSelection()?.toString()) return;
|
|
2602
|
+
const interactive = event.target.closest("a, button, input, select, textarea");
|
|
2603
|
+
if (interactive && interactive !== copyButtonRef.current) return;
|
|
2604
|
+
handleCopy();
|
|
2605
|
+
}
|
|
2557
2606
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
|
|
2558
2607
|
ref: ddRef,
|
|
2559
2608
|
className: cn([
|
|
@@ -2562,12 +2611,13 @@ function PropertyListValue({ numeric, copyable, empty, copyValue, className, cla
|
|
|
2562
2611
|
copyable && "property-list-value-copyable",
|
|
2563
2612
|
empty && "property-list-value-empty"
|
|
2564
2613
|
], className),
|
|
2614
|
+
onClick: copyable ? handleCellClick : onClick,
|
|
2565
2615
|
...rest,
|
|
2566
2616
|
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2617
|
+
ref: copyButtonRef,
|
|
2567
2618
|
type: "button",
|
|
2568
2619
|
"aria-label": "Copy",
|
|
2569
2620
|
className: cn("property-list-copy", classNames?.copy),
|
|
2570
|
-
onClick: handleCopy,
|
|
2571
2621
|
"data-copied": copied ? "true" : void 0,
|
|
2572
2622
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyGlyph, { className: cn("property-list-copy-icon", void 0) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckGlyph, { className: cn("property-list-copy-icon-copied", void 0) })]
|
|
2573
2623
|
})]
|
|
@@ -2895,6 +2945,7 @@ exports.Table = Table;
|
|
|
2895
2945
|
exports.Tabs = Tabs;
|
|
2896
2946
|
exports.Textarea = Textarea;
|
|
2897
2947
|
exports.Timeline = Timeline;
|
|
2948
|
+
exports.ToggleButton = ToggleButton;
|
|
2898
2949
|
exports.Tooltip = Tooltip;
|
|
2899
2950
|
exports.getPaginationItems = getPaginationItems;
|
|
2900
2951
|
exports.useAppShell = useAppShell;
|