@canonical/react-ds-global 0.47.0 → 0.49.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 +78 -0
- package/dist/esm/lib/_work_in_progress/Label/styles.css +13 -3
- package/dist/esm/lib/common/IconButtonStandIn/IconButtonStandIn.js +10 -0
- package/dist/esm/lib/common/IconButtonStandIn/IconButtonStandIn.js.map +1 -0
- package/dist/esm/lib/common/IconButtonStandIn/index.js +3 -0
- package/dist/esm/lib/common/IconButtonStandIn/index.js.map +1 -0
- package/dist/esm/lib/common/IconButtonStandIn/types.js +2 -0
- package/dist/esm/lib/common/IconButtonStandIn/types.js.map +1 -0
- package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js +1 -1
- package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js.map +1 -1
- package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +13 -7
- package/dist/esm/lib/component/Breadcrumbs/styles.css +10 -0
- package/dist/esm/lib/component/Button/Button.js +28 -12
- package/dist/esm/lib/component/Button/Button.js.map +1 -1
- package/dist/esm/lib/component/Button/styles.css +66 -33
- package/dist/esm/lib/component/InlineCode/styles.css +6 -3
- package/dist/esm/lib/component/Tabs/common/Item/styles.css +40 -26
- package/dist/esm/lib/component/Tabs/styles.css +1 -1
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js +1 -1
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js.map +1 -1
- package/dist/esm/lib/pattern/Modal/Provider.js +9 -8
- package/dist/esm/lib/pattern/Modal/Provider.js.map +1 -1
- package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js +3 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js.map +1 -1
- package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +2 -11
- package/dist/esm/lib/pattern/Modal/common/Header/Header.js +2 -2
- package/dist/esm/lib/pattern/Modal/common/Header/Header.js.map +1 -1
- package/dist/esm/lib/pattern/Modal/index.js +1 -0
- package/dist/esm/lib/pattern/Modal/index.js.map +1 -1
- package/dist/types/lib/common/IconButtonStandIn/IconButtonStandIn.d.ts +8 -0
- package/dist/types/lib/common/IconButtonStandIn/IconButtonStandIn.d.ts.map +1 -0
- package/dist/types/lib/common/IconButtonStandIn/index.d.ts +3 -0
- package/dist/types/lib/common/IconButtonStandIn/index.d.ts.map +1 -0
- package/dist/types/lib/common/IconButtonStandIn/types.d.ts +28 -0
- package/dist/types/lib/common/IconButtonStandIn/types.d.ts.map +1 -0
- package/dist/types/lib/component/Breadcrumbs/common/Item/Item.d.ts +1 -1
- package/dist/types/lib/component/Breadcrumbs/common/Item/Item.d.ts.map +1 -1
- package/dist/types/lib/component/Button/Button.d.ts +4 -1
- package/dist/types/lib/component/Button/Button.d.ts.map +1 -1
- package/dist/types/lib/component/Button/types.d.ts +15 -4
- package/dist/types/lib/component/Button/types.d.ts.map +1 -1
- package/dist/types/lib/pattern/Modal/Provider.d.ts.map +1 -1
- package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts.map +1 -1
- package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts +1 -1
- package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts.map +1 -1
- package/dist/types/lib/pattern/Modal/index.d.ts +1 -0
- package/dist/types/lib/pattern/Modal/index.d.ts.map +1 -1
- package/dist/types/lib/pattern/Modal/types.d.ts +4 -3
- package/dist/types/lib/pattern/Modal/types.d.ts.map +1 -1
- package/package.json +22 -19
package/README.md
CHANGED
|
@@ -41,6 +41,84 @@ function Example() {
|
|
|
41
41
|
|
|
42
42
|
Components accept standard HTML attributes for their underlying elements. A `Button` accepts all `ButtonHTMLAttributes`, a `Link` accepts all `AnchorHTMLAttributes`, and so on.
|
|
43
43
|
|
|
44
|
+
## Testing with Jest
|
|
45
|
+
|
|
46
|
+
The packages are ES modules only, and each component imports its own stylesheet, which a Jest 29 + jsdom
|
|
47
|
+
project does not follow without help. Four things are needed:
|
|
48
|
+
|
|
49
|
+
- **Transform the packages.** `transformIgnorePatterns` excludes `node_modules` from the transformer by
|
|
50
|
+
default, and `@canonical` has to be let back through so that `ts-jest` (with `allowJs`) or `babel-jest`
|
|
51
|
+
reads the ES modules instead of failing on their `export` statements.
|
|
52
|
+
- **Stub the stylesheets.** A component imports `./styles.css`; map `\.css$` to an empty module.
|
|
53
|
+
- **Map the packages a CommonJS resolver cannot find.** Two packaging shapes break the resolver.
|
|
54
|
+
`@canonical/react-hooks` and `@canonical/ds-types` publish an export map whose only runtime condition is
|
|
55
|
+
`import`, and `@canonical/react-ds-app` publishes no `main` and no `exports` map, only a `module` field.
|
|
56
|
+
Until each is mapped to its `dist/esm` entry, importing it stops the suite with `Cannot find module` —
|
|
57
|
+
`@canonical/react-hooks`, `@canonical/ds-types` or `@canonical/react-ds-app`. Extend the group with any
|
|
58
|
+
other `@canonical` package that fails the same way.
|
|
59
|
+
- **Give jsdom a dialog.** jsdom implements `HTMLDialogElement` but not `showModal()` or `close()`, and
|
|
60
|
+
`Modal` opens through `showModal()`, so the two methods are stubbed.
|
|
61
|
+
|
|
62
|
+
With the stub in `tests/style-stub.js` and the dialog stub in `tests/setup.ts`, the configuration is:
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
/** @type {import('jest').Config} */
|
|
66
|
+
module.exports = {
|
|
67
|
+
testEnvironment: "jsdom",
|
|
68
|
+
transform: {
|
|
69
|
+
"^.+\\.(ts|tsx|js|mjs)$": [
|
|
70
|
+
"ts-jest",
|
|
71
|
+
{
|
|
72
|
+
tsconfig: {
|
|
73
|
+
jsx: "react-jsx",
|
|
74
|
+
module: "esnext",
|
|
75
|
+
moduleResolution: "bundler",
|
|
76
|
+
allowJs: true,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
transformIgnorePatterns: ["/node_modules/(?!@canonical/)"],
|
|
82
|
+
moduleNameMapper: {
|
|
83
|
+
"^@canonical/(react-hooks|ds-types|react-ds-app)$":
|
|
84
|
+
"<rootDir>/node_modules/@canonical/$1/dist/esm/index.js",
|
|
85
|
+
"\\.css$": "<rootDir>/tests/style-stub.js",
|
|
86
|
+
},
|
|
87
|
+
setupFiles: ["<rootDir>/tests/setup.ts"],
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
// tests/setup.ts
|
|
93
|
+
if (typeof HTMLDialogElement !== "undefined") {
|
|
94
|
+
const proto = HTMLDialogElement.prototype as any;
|
|
95
|
+
if (!proto.showModal) {
|
|
96
|
+
proto.showModal = function (this: HTMLDialogElement) {
|
|
97
|
+
this.setAttribute("open", "");
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (!proto.close) {
|
|
101
|
+
proto.close = function (this: HTMLDialogElement, value?: string) {
|
|
102
|
+
if (!this.hasAttribute("open")) return;
|
|
103
|
+
this.removeAttribute("open");
|
|
104
|
+
if (value !== undefined) (this as any).returnValue = value;
|
|
105
|
+
this.dispatchEvent(new Event("close"));
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
// tests/style-stub.js
|
|
113
|
+
module.exports = {};
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Vitest needs none of those pieces — no transform list, no stylesheet stub and no mapper — but two settings of
|
|
117
|
+
its own. `test.server.deps.inline` keeps `@canonical` out of the externalised `node_modules` that Node loads
|
|
118
|
+
directly and that cannot read a `.css` import, and `resolve.mainFields` adds `module`, the only entry field
|
|
119
|
+
`@canonical/react-ds-app` publishes. The dialog stub is the same one, and in this repository's own suites it
|
|
120
|
+
is declared in the test files that open a modal.
|
|
121
|
+
|
|
44
122
|
## Modifier Families
|
|
45
123
|
|
|
46
124
|
Several components accept appearance props that correspond to modifier families from `@canonical/ds-types`:
|
|
@@ -22,12 +22,22 @@
|
|
|
22
22
|
|
|
23
23
|
/* Additional styling */
|
|
24
24
|
line-height: var(--label-line-height, 1.2);
|
|
25
|
+
/* The label sits on the modifier's tinted fill, so it reads the on-fill
|
|
26
|
+
* text channel. `--modifier-color-text` is the standalone modifier colour,
|
|
27
|
+
* meant for the page background: on the modifier's solid fill
|
|
28
|
+
* (`--modifier-color-foreground-primary`) it is the same hue on the same
|
|
29
|
+
* hue, red on red for `error`. Families that publish no on-fill channel
|
|
30
|
+
* (anticipation, lifecycle) fall back to their standalone text colour,
|
|
31
|
+
* which reads on their tinted fill. */
|
|
25
32
|
color: var(
|
|
26
|
-
--modifier-color-text,
|
|
27
|
-
var(
|
|
33
|
+
--modifier-color-text-on-foreground-secondary,
|
|
34
|
+
var(
|
|
35
|
+
--modifier-color-text,
|
|
36
|
+
var(--label-color, var(--color-text-secondary, inherit))
|
|
37
|
+
)
|
|
28
38
|
);
|
|
29
39
|
background-color: var(
|
|
30
|
-
--modifier-color-foreground-
|
|
40
|
+
--modifier-color-foreground-secondary,
|
|
31
41
|
var(--label-background, transparent)
|
|
32
42
|
);
|
|
33
43
|
padding-inline: var(--label-padding-inline, var(--spacing-xsmall, 0.25rem));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../component/Button/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Private stand-in for IconButton: its props, drawn by Button until
|
|
5
|
+
* IconButton and its sheet land.
|
|
6
|
+
*/
|
|
7
|
+
export default function IconButtonStandIn(props) {
|
|
8
|
+
return _jsx(Button, { ...props });
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=IconButtonStandIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButtonStandIn.js","sourceRoot":"","sources":["../../../../../src/lib/common/IconButtonStandIn/IconButtonStandIn.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAGzD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,KAA6B;IAE7B,OAAO,KAAC,MAAM,OAAK,KAAK,GAAI,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/common/IconButtonStandIn/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/common/IconButtonStandIn/types.ts"],"names":[],"mappings":""}
|
|
@@ -11,7 +11,7 @@ const componentCssClassName = "ds breadcrumbs-item";
|
|
|
11
11
|
*/
|
|
12
12
|
const Item = ({ children, label, url, current = false, separator = "/", disabled = false, className, LinkComponent = "a",
|
|
13
13
|
// Destructure Item props we don't spread to DOM
|
|
14
|
-
|
|
14
|
+
items: _items, Component: _Component, ...props }) => {
|
|
15
15
|
const content = children ?? label;
|
|
16
16
|
const Link = LinkComponent;
|
|
17
17
|
return (_jsxs("li", { className: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Breadcrumbs/common/Item/Item.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,QAAQ,EACR,KAAK,EACL,GAAG,EACH,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,GAAG,EACf,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,aAAa,GAAG,GAAG;AACnB,gDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Breadcrumbs/common/Item/Item.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,M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13
13
|
* Tokens follow the Figma spec: links use color-text-link, the current item
|
|
14
|
-
* and the separator use color-text, and the
|
|
15
|
-
* dimension scale (Figma specs 6px, which is not on the scale; the
|
|
16
|
-
* token is dimension-100 = 8px).
|
|
14
|
+
* and the separator use color-text, and the spacing around the separator
|
|
15
|
+
* uses the dimension scale (Figma specs 6px, which is not on the scale; the
|
|
16
|
+
* nearest token is dimension-100 = 8px).
|
|
17
17
|
*/
|
|
18
18
|
.ds.breadcrumbs-item {
|
|
19
19
|
/* Component tokens — pure aliases to semantic tokens, component-scoped
|
|
20
|
-
per cs:styling.tokens.scoping
|
|
20
|
+
per cs:styling.tokens.scoping. The separator spacing token
|
|
21
|
+
(--breadcrumbs-item-separator-margin) is defined on `.ds.breadcrumbs`,
|
|
22
|
+
the component root, because the list's column-gap reads it too. */
|
|
21
23
|
--breadcrumbs-item-link-color: var(--color-text-link);
|
|
22
24
|
--breadcrumbs-item-current-color: var(--color-text);
|
|
23
25
|
--breadcrumbs-item-disabled-color: var(--color-text-disabled);
|
|
24
26
|
--breadcrumbs-item-separator-color: var(--color-text);
|
|
25
|
-
--breadcrumbs-item-separator-margin: var(--dimension-100);
|
|
26
27
|
--breadcrumbs-item-focus-color: var(--color-text-link);
|
|
27
28
|
|
|
28
29
|
/* layout.type: flow, layout.direction: horizontal */
|
|
29
30
|
display: flex;
|
|
30
31
|
flex-direction: row;
|
|
31
32
|
|
|
33
|
+
/* Distance between the separator and the link. */
|
|
34
|
+
column-gap: var(--breadcrumbs-item-separator-margin);
|
|
35
|
+
|
|
32
36
|
/* layout.align: center */
|
|
33
37
|
align-items: center;
|
|
34
38
|
|
|
@@ -53,9 +57,11 @@
|
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
/* Separator element — DSL role: separator. Rendered before the link so a
|
|
56
|
-
wrapped row starts with the slash; hidden on the first item.
|
|
60
|
+
wrapped row starts with the slash; hidden on the first item. Spacing
|
|
61
|
+
around it is gap-based (the list column-gap before, the item
|
|
62
|
+
column-gap after) rather than separator margins, so a separator that
|
|
63
|
+
opens a wrapped row aligns flush with the container edge. */
|
|
57
64
|
& > .separator {
|
|
58
|
-
margin-inline: var(--breadcrumbs-item-separator-margin);
|
|
59
65
|
color: var(--breadcrumbs-item-separator-color);
|
|
60
66
|
}
|
|
61
67
|
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
* (the typography-text-primary tier, per the Figma spec).
|
|
15
15
|
*/
|
|
16
16
|
.ds.breadcrumbs {
|
|
17
|
+
/* Component token — a pure alias to a semantic token, component-scoped
|
|
18
|
+
per cs:styling.tokens.scoping. Defined on the component root so both
|
|
19
|
+
the list and the items resolve it. */
|
|
20
|
+
--breadcrumbs-item-separator-margin: var(--dimension-100);
|
|
21
|
+
|
|
17
22
|
& > .list {
|
|
18
23
|
/* layout.type: flow, layout.direction: horizontal */
|
|
19
24
|
display: flex;
|
|
@@ -23,6 +28,11 @@
|
|
|
23
28
|
/* Guidelines: 4px vertical distance between wrapped rows */
|
|
24
29
|
row-gap: var(--dimension-050);
|
|
25
30
|
|
|
31
|
+
/* Distance between an item and the next item's separator. The
|
|
32
|
+
separator itself carries no start margin, so a separator that
|
|
33
|
+
opens a wrapped row aligns flush with the container edge. */
|
|
34
|
+
column-gap: var(--breadcrumbs-item-separator-margin);
|
|
35
|
+
|
|
26
36
|
/* layout.align: center */
|
|
27
37
|
align-items: center;
|
|
28
38
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Spinner } from "../../subcomponent/Spinner/index.js";
|
|
3
3
|
import { Icon } from "../Icon/index.js";
|
|
4
4
|
import "./styles.css";
|
|
@@ -10,9 +10,12 @@ const componentCssClassName = "ds button";
|
|
|
10
10
|
*
|
|
11
11
|
* `import { Button } from "@canonical/react-ds-global";`
|
|
12
12
|
*
|
|
13
|
+
* Fragments: renders the button plus, when `loading` is controlled, a sibling
|
|
14
|
+
* status region, so the component has no single root element.
|
|
15
|
+
*
|
|
13
16
|
* @implements ds:global.component.button
|
|
14
17
|
*/
|
|
15
|
-
const Button = ({ id, className, children, style, importance = "primary", anticipation, variant, icon, loading =
|
|
18
|
+
const Button = ({ id, className, children, style, importance = "primary", anticipation, variant, icon, loading, loadingLabel = "Loading", disabled, onClick, ...props }) => {
|
|
16
19
|
// Booleans and nullish children render nothing; everything else (including
|
|
17
20
|
// the number 0) produces visible text that names the button.
|
|
18
21
|
const hasVisibleChildren = children != null && typeof children !== "boolean" && children !== "";
|
|
@@ -27,16 +30,29 @@ const Button = ({ id, className, children, style, importance = "primary", antici
|
|
|
27
30
|
// The icon slot only accepts a design-system icon name; the Icon component
|
|
28
31
|
// maps it to the @canonical/ds-assets sprite (decorative by default).
|
|
29
32
|
const iconElement = icon && (_jsx("span", { className: "icon", children: _jsx(Icon, { icon: icon }) }));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
33
|
+
// A loading button stays focusable (a natively disabled button would drop
|
|
34
|
+
// keyboard focus to the document) and is instead marked aria-disabled, with
|
|
35
|
+
// activation blocked here.
|
|
36
|
+
const isBlocked = loading === true && !disabled;
|
|
37
|
+
// Blocks activation while loading: preventDefault stops a form submission
|
|
38
|
+
// and the consumer's handler is not invoked.
|
|
39
|
+
const handleClick = (event) => {
|
|
40
|
+
if (loading) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
onClick?.(event);
|
|
45
|
+
};
|
|
46
|
+
return (_jsxs(_Fragment, { children: [_jsxs("button", { id: id, className: [
|
|
47
|
+
componentCssClassName,
|
|
48
|
+
importance,
|
|
49
|
+
anticipation,
|
|
50
|
+
variant,
|
|
51
|
+
loading && "loading",
|
|
52
|
+
className,
|
|
53
|
+
]
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.join(" "), style: style, "aria-busy": loading || undefined, "aria-disabled": isBlocked || undefined, disabled: disabled, ...props, onClick: handleClick, children: [iconElement, hasVisibleChildren && _jsx("span", { className: "label", children: children }), loading && (_jsx("span", { className: "loading-spinner", "aria-hidden": "true", children: _jsx(Spinner, {}) }))] }), loading !== undefined && (_jsx("span", { className: "ds button-loading-status", role: "status", children: loading ? loadingLabel : "" }))] }));
|
|
40
56
|
};
|
|
41
57
|
export default Button;
|
|
42
58
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,GAAG,SAAS,EACtB,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,YAAY,GAAG,SAAS,EACxB,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,kBAAkB,GACtB,QAAQ,IAAI,IA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AAkB,IAAI,eAAM,SAAS,EAAC,OAAO,YAAE,QAAQ,GAAQ,EAC/D,OAAO,IAAI,CACV,eAAM,SAAS,EAAC,iBAAiB,iBAAa,MAAM,YAClD,KAAC,OAAO,KAAG,GACN,CACR,IACM,EAMR,OAAO,KAAK,SAAS,IAAI,CACxB,eAAM,SAAS,EAAC,0BAA0B,EAAC,IAAI,EAAC,QAAQ,YACrD,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GACvB,CACR,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -33,20 +33,7 @@
|
|
|
33
33
|
--button-padding-inline-start: var(--dimension-200);
|
|
34
34
|
--button-gap: var(--dimension-100);
|
|
35
35
|
--button-border-width: var(--dimension-stroke-thickness-medium);
|
|
36
|
-
/* Label typography — the `typography.text.primary` composite token, the
|
|
37
|
-
default text style for UI elements such as buttons: regular weight, and
|
|
38
|
-
the token's size and ratio.*/
|
|
39
36
|
--button-font-weight: var(--typography-text-primary-font-weight);
|
|
40
|
-
--button-font-size: var(--typography-text-primary-font-size);
|
|
41
|
-
|
|
42
|
-
--button-line-height: round(
|
|
43
|
-
up,
|
|
44
|
-
calc(
|
|
45
|
-
var(--button-font-size) *
|
|
46
|
-
var(--typography-text-primary-line-height)
|
|
47
|
-
),
|
|
48
|
-
var(--baseline-height)
|
|
49
|
-
);
|
|
50
37
|
}
|
|
51
38
|
|
|
52
39
|
/* ==========================================================================
|
|
@@ -86,10 +73,14 @@
|
|
|
86
73
|
the density seat below subtracts one constant. (The previous
|
|
87
74
|
width-multiplied toggle left the primary 2px shorter than the secondary
|
|
88
75
|
and seated its label ~1px high.) */
|
|
76
|
+
/* 100% when the importance shows a border, 0% when it does not. Every
|
|
77
|
+
border colour (enabled, disabled, loading) is mixed with transparent by
|
|
78
|
+
this amount, so a borderless importance stays borderless in all states. */
|
|
79
|
+
--button-outline-mix: calc(var(--modifier-outline, 0) * 100%);
|
|
89
80
|
border-color: color-mix(
|
|
90
81
|
in srgb,
|
|
91
82
|
var(--modifier-color-border, var(--button-color-border))
|
|
92
|
-
|
|
83
|
+
var(--button-outline-mix),
|
|
93
84
|
transparent
|
|
94
85
|
);
|
|
95
86
|
border-style: solid;
|
|
@@ -103,10 +94,22 @@
|
|
|
103
94
|
this file (the button no longer carries `.p`, so the engine's on-element nudges
|
|
104
95
|
don't apply — without the seat the label is flat/unaligned). --font-size /
|
|
105
96
|
--line-height stay exposed, as on every text-styled element, for any
|
|
106
|
-
consumer that reads them.
|
|
107
|
-
|
|
108
|
-
--
|
|
97
|
+
consumer that reads them. Resolve size and ratio here so nested
|
|
98
|
+
typography contexts can supply them. */
|
|
99
|
+
--font-size: var(
|
|
100
|
+
--button-font-size,
|
|
101
|
+
var(--typography-text-primary-font-size)
|
|
102
|
+
);
|
|
103
|
+
--line-height: var(
|
|
104
|
+
--button-line-height,
|
|
105
|
+
round(
|
|
106
|
+
up,
|
|
107
|
+
calc(var(--font-size) * var(--typography-text-primary-line-height)),
|
|
108
|
+
var(--baseline-height)
|
|
109
|
+
)
|
|
110
|
+
);
|
|
109
111
|
font-family: var(--typography-text-primary-font-family);
|
|
112
|
+
font-size: var(--font-size);
|
|
110
113
|
font-weight: var(--button-font-weight);
|
|
111
114
|
letter-spacing: var(--typography-text-primary-letter-spacing);
|
|
112
115
|
padding-inline: var(--button-padding-inline-start)
|
|
@@ -129,14 +132,14 @@
|
|
|
129
132
|
|
|
130
133
|
/* State fallbacks resolve to the default (primary) surface states when no
|
|
131
134
|
importance modifier supplies `--modifier-surface-*`. */
|
|
132
|
-
&:hover:not(:disabled) {
|
|
135
|
+
&:hover:not(:disabled, .loading) {
|
|
133
136
|
background-color: var(
|
|
134
137
|
--modifier-surface-hover,
|
|
135
138
|
var(--button-color-background-hover)
|
|
136
139
|
);
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
&:active:not(:disabled) {
|
|
142
|
+
&:active:not(:disabled, .loading) {
|
|
140
143
|
background-color: var(
|
|
141
144
|
--modifier-surface-active,
|
|
142
145
|
var(--button-color-background-active)
|
|
@@ -164,9 +167,14 @@
|
|
|
164
167
|
--modifier-surface-disabled,
|
|
165
168
|
var(--button-color-background-disabled)
|
|
166
169
|
);
|
|
167
|
-
border-color:
|
|
168
|
-
|
|
169
|
-
var(
|
|
170
|
+
border-color: color-mix(
|
|
171
|
+
in srgb,
|
|
172
|
+
var(
|
|
173
|
+
--modifier-color-border-disabled,
|
|
174
|
+
var(--color-border-highlighted-disabled)
|
|
175
|
+
)
|
|
176
|
+
var(--button-outline-mix),
|
|
177
|
+
transparent
|
|
170
178
|
);
|
|
171
179
|
}
|
|
172
180
|
}
|
|
@@ -190,6 +198,10 @@
|
|
|
190
198
|
color: var(--modifier-color-icon, var(--modifier-color-text, currentColor));
|
|
191
199
|
}
|
|
192
200
|
|
|
201
|
+
.ds.button:where(.secondary.destructive:not(.link, :disabled)) > .icon {
|
|
202
|
+
color: var(--color-icon);
|
|
203
|
+
}
|
|
204
|
+
|
|
193
205
|
.ds.button:disabled > .icon {
|
|
194
206
|
color: var(--modifier-color-icon-disabled, var(--color-icon-disabled));
|
|
195
207
|
}
|
|
@@ -198,20 +210,28 @@
|
|
|
198
210
|
Loading State
|
|
199
211
|
========================================================================== */
|
|
200
212
|
|
|
201
|
-
/* Loading
|
|
202
|
-
icon and label stay in the DOM (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
213
|
+
/* Loading overlays a Spinner on the icon and label but keeps the button's
|
|
214
|
+
width: the icon and label stay in the DOM (transparent, so their box
|
|
215
|
+
still reserves space and the label still names the button;
|
|
216
|
+
`visibility: hidden` would remove it from the accessible name) and the
|
|
217
|
+
Spinner is centred on top. A loading button blocks activation, but it
|
|
218
|
+
must not *read* as disabled — it is working, not unavailable — so it
|
|
219
|
+
keeps the enabled surface, text and border colours, overriding the
|
|
220
|
+
:disabled greying above when both apply. */
|
|
207
221
|
.ds.button.loading {
|
|
222
|
+
cursor: progress;
|
|
208
223
|
color: var(--modifier-color-text, var(--button-color-text));
|
|
209
224
|
background-color: var(--modifier-surface, var(--button-color-background));
|
|
210
|
-
border-color:
|
|
225
|
+
border-color: color-mix(
|
|
226
|
+
in srgb,
|
|
227
|
+
var(--modifier-color-border, var(--button-color-border))
|
|
228
|
+
var(--button-outline-mix),
|
|
229
|
+
transparent
|
|
230
|
+
);
|
|
211
231
|
|
|
212
232
|
& > .icon,
|
|
213
233
|
& > .label {
|
|
214
|
-
|
|
234
|
+
opacity: 0;
|
|
215
235
|
}
|
|
216
236
|
|
|
217
237
|
& > .loading-spinner {
|
|
@@ -223,6 +243,20 @@
|
|
|
223
243
|
}
|
|
224
244
|
}
|
|
225
245
|
|
|
246
|
+
/* The status region announcing the loading label is visually hidden but
|
|
247
|
+
stays in the accessibility tree. */
|
|
248
|
+
.ds.button-loading-status {
|
|
249
|
+
position: absolute;
|
|
250
|
+
width: 1px;
|
|
251
|
+
height: 1px;
|
|
252
|
+
margin: -1px;
|
|
253
|
+
padding: 0;
|
|
254
|
+
overflow: hidden;
|
|
255
|
+
clip-path: inset(50%);
|
|
256
|
+
white-space: nowrap;
|
|
257
|
+
border: 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
226
260
|
/* ==========================================================================
|
|
227
261
|
Link Variant
|
|
228
262
|
========================================================================== */
|
|
@@ -236,7 +270,7 @@
|
|
|
236
270
|
text-decoration: underline;
|
|
237
271
|
text-underline-offset: var(--tmp-dimension-underline-offset-link, 0.075em);
|
|
238
272
|
|
|
239
|
-
&:hover:not(:disabled) {
|
|
273
|
+
&:hover:not(:disabled, .loading) {
|
|
240
274
|
background-color: transparent;
|
|
241
275
|
border-color: transparent;
|
|
242
276
|
text-decoration-thickness: var(
|
|
@@ -245,7 +279,7 @@
|
|
|
245
279
|
);
|
|
246
280
|
}
|
|
247
281
|
|
|
248
|
-
&:active:not(:disabled) {
|
|
282
|
+
&:active:not(:disabled, .loading) {
|
|
249
283
|
background-color: transparent;
|
|
250
284
|
border-color: transparent;
|
|
251
285
|
}
|
|
@@ -325,7 +359,6 @@
|
|
|
325
359
|
box-sizing: border-box;
|
|
326
360
|
block-size: auto;
|
|
327
361
|
align-items: flex-start;
|
|
328
|
-
justify-content: flex-start;
|
|
329
362
|
line-height: var(--control-seat-line);
|
|
330
363
|
padding-block: var(--seat-before) var(--seat-after);
|
|
331
364
|
}
|
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
--inline-code-color-text: var(--color-text);
|
|
6
6
|
--inline-code-color-background: var(--color-foreground-secondary);
|
|
7
7
|
--inline-code-padding-inline: var(--dimension-050);
|
|
8
|
+
--inline-code-padding-block: var(--dimension-025);
|
|
8
9
|
--inline-code-border-radius: var(--dimension-radius-small);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
/* The `.code` baseline utility (from @canonical/styles) supplies the
|
|
12
|
-
monospace typography tier
|
|
13
|
-
the
|
|
14
|
-
horizontal padding
|
|
13
|
+
monospace typography tier; inline `.code` gets no vertical padding of its
|
|
14
|
+
own, so the chip adds it — 2px top and bottom per the design review —
|
|
15
|
+
plus the horizontal padding and the code colour and background (both
|
|
16
|
+
mode-aware). */
|
|
15
17
|
.ds.inline-code {
|
|
16
18
|
color: var(--inline-code-color-text);
|
|
17
19
|
background-color: var(--inline-code-color-background);
|
|
18
20
|
|
|
21
|
+
padding-block: var(--inline-code-padding-block);
|
|
19
22
|
padding-inline: var(--inline-code-padding-inline);
|
|
20
23
|
border-radius: var(--inline-code-border-radius);
|
|
21
24
|
}
|
|
@@ -6,19 +6,18 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Figma (node 4388-106316): each tab is text with `--dimension-200` (16px)
|
|
8
8
|
* horizontal padding, no gap to its neighbours. The tab shows a bottom border
|
|
9
|
-
* on hover (muted) and when active (highlighted)
|
|
10
|
-
* muted with no
|
|
9
|
+
* on hover (muted) and when active (highlighted), and a focus border on
|
|
10
|
+
* every side when keyboard-focused; an inert tab (no url) is muted with no
|
|
11
|
+
* hover affordance.
|
|
11
12
|
*
|
|
12
|
-
* Baseline grid: the tab box snaps to the typographic baseline grid —
|
|
13
|
-
*
|
|
14
|
-
* (1bU =
|
|
13
|
+
* Baseline grid: the tab box snaps to the typographic baseline grid — the
|
|
14
|
+
* density height rule below sizes it to a whole multiple of
|
|
15
|
+
* --baseline-height (1bU = 4px), so the strip sits on the same grid as
|
|
16
|
+
* surrounding text.
|
|
15
17
|
*/
|
|
16
18
|
:root {
|
|
17
|
-
--tabs-tab-border-width: var(--dimension-
|
|
19
|
+
--tabs-tab-border-width: var(--dimension-stroke-thickness-large);
|
|
18
20
|
--tabs-tab-padding-inline: var(--space-200); /* 16px */
|
|
19
|
-
/* 5bU = 40px tab height on the 8px baseline grid. */
|
|
20
|
-
--tabs-tab-min-block-size: calc(var(--baseline-height) * 5);
|
|
21
|
-
--tabs-tab-focus-ring-width: var(--dimension-strokeThickness-large, 2px);
|
|
22
21
|
--tabs-tab-focus-ring-color: var(--color-focus-ring);
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -30,9 +29,6 @@
|
|
|
30
29
|
display: inline-flex;
|
|
31
30
|
align-items: center;
|
|
32
31
|
box-sizing: border-box;
|
|
33
|
-
/* Baseline-snapped block size; vertical padding kept to baseline units so the
|
|
34
|
-
label's line box centres on the grid. */
|
|
35
|
-
min-block-size: var(--tabs-tab-min-block-size);
|
|
36
32
|
padding-block: var(--space-100); /* 1bU */
|
|
37
33
|
padding-inline: var(--tabs-tab-padding-inline);
|
|
38
34
|
font: var(--typography-text-primary);
|
|
@@ -40,27 +36,27 @@
|
|
|
40
36
|
text-decoration: none;
|
|
41
37
|
white-space: nowrap;
|
|
42
38
|
|
|
43
|
-
/* Transparent
|
|
44
|
-
|
|
45
|
-
border
|
|
39
|
+
/* Transparent border reserved on every side so the row never shifts when
|
|
40
|
+
the hover/active underline or the keyboard focus border appears. */
|
|
41
|
+
border: var(--tabs-tab-border-width) solid transparent;
|
|
42
|
+
}
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
outline-offset: calc(-1 * var(--tabs-tab-focus-ring-width));
|
|
55
|
-
}
|
|
44
|
+
:where(.comfortable, .dense, .app, .site, .docs) .ds.tabs-item .tabs-link {
|
|
45
|
+
min-block-size: calc(
|
|
46
|
+
var(--density-line-height-effective, calc(var(--baseline-height) * 8)) +
|
|
47
|
+
3 *
|
|
48
|
+
var(--baseline-height)
|
|
49
|
+
);
|
|
50
|
+
padding-block: 0;
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
/* Hover: a muted bottom border hints the tab is navigable, and settles faster
|
|
59
54
|
than the active/selection change (below). Not on the active tab (it already
|
|
60
55
|
shows the highlighted border), nor on inert or disabled tabs (they are not
|
|
61
|
-
interactive)
|
|
56
|
+
interactive); suppressed while keyboard-focused so the hover affordance
|
|
57
|
+
never paints over the focus border. */
|
|
62
58
|
.ds.tabs-item:not([data-active]):not([data-inert]):not([data-disabled])
|
|
63
|
-
|
|
59
|
+
.tabs-link:hover:not(:focus-visible) {
|
|
64
60
|
border-bottom-color: var(--color-border-muted);
|
|
65
61
|
transition-duration: var(--motion-duration-fast);
|
|
66
62
|
}
|
|
@@ -71,6 +67,24 @@
|
|
|
71
67
|
border-bottom-color: var(--color-border-highlighted);
|
|
72
68
|
}
|
|
73
69
|
|
|
70
|
+
/* Keyboard focus: the design-system focus border. Sits after the active rule so the focus border wins
|
|
71
|
+
on every edge of a focused tab, including the underline edge of a
|
|
72
|
+
focused+active tab; hover defers to it via :not(:focus-visible) above.
|
|
73
|
+
:focus-visible only, so pointer clicks stay quiet. A border lives inside
|
|
74
|
+
the tab's box, so the strip's overflow can never clip it. When design-tokens ships
|
|
75
|
+
--border-focus-ring, this rule becomes `border-color:
|
|
76
|
+
var(--border-focus-ring)`. */
|
|
77
|
+
.ds.tabs-item .tabs-link:focus-visible {
|
|
78
|
+
/* The border below IS the focus indicator; suppress the UA default ring
|
|
79
|
+
(outline: auto), which the old custom outline used to replace and would
|
|
80
|
+
otherwise show through alongside the border. */
|
|
81
|
+
outline: none;
|
|
82
|
+
border-color: var(
|
|
83
|
+
--modifier-color-focus-ring,
|
|
84
|
+
var(--tabs-tab-focus-ring-color)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
74
88
|
/* Inert (no url) or disabled tabs: muted, non-interactive, no hover
|
|
75
89
|
affordance. */
|
|
76
90
|
.ds.tabs-item[data-inert] .tabs-link,
|
|
@@ -14,7 +14,7 @@ const componentCssClassName = "ds tooltip-area";
|
|
|
14
14
|
*
|
|
15
15
|
* `import { TooltipEngine } from "@canonical/react-ds-global";`
|
|
16
16
|
*/
|
|
17
|
-
const TooltipEngine = ({ children, style, className, Message, icon, open, distance = "
|
|
17
|
+
const TooltipEngine = ({ children, style, className, Message, icon, open, distance = "16px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
|
|
18
18
|
const { targetRef, popupRef, popupPositionStyle, popupId, isOpen, bestPosition, arrowOffset, getToggleProps, getContentProps,
|
|
19
19
|
// `open` is the public alias for the hook's controlled `isOpen`; when set it
|
|
20
20
|
// overrides hover/focus so the tooltip stays in the given state.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipEngine.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/TooltipEngine.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,CAAC,EACrB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"TooltipEngine.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/TooltipEngine.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,CAAC,EACrB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,GAAG,MAAM,EACjB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,GAAG,KAAK,EACW,EAAgB,EAAE;IACrC,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe;IACf,6EAA6E;IAC7E,iEAAiE;MAClE,GAAG,aAAa,CAAC;QAChB,QAAQ;QACR,OAAO;QACP,GAAG,KAAK;QACR,MAAM,EAAE,IAAI,IAAI,KAAK,CAAC,MAAM;QAC5B,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,cAAc,EAAE,CAAC;IACtC,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IAEvC,8EAA8E;IAC9E,6EAA6E;IAC7E,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAE/B,2EAA2E;IAC3E,sDAAsD;IACtD,MAAM,UAAU,GAAkB,WAAW;QAC3C,CAAC,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N,CAAC,CAAC,YAAY,CAAC,qBAAqB,EAAE,aAAa,IAAI,QAAQ,CAAC,IAAI,CAAC;gBACrE,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -14,14 +14,15 @@ const componentCssClassName = "ds modal";
|
|
|
14
14
|
* instance, sending a delete request.
|
|
15
15
|
*
|
|
16
16
|
* It renders a native `<dialog>` opened with `showModal()`, so the backdrop,
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* in
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
17
|
+
* page inertness and Escape handling come from the platform rather than from
|
|
18
|
+
* JavaScript. Focus moves into the dialog when it opens and cannot reach the
|
|
19
|
+
* page content behind it, though users can still tab out of the document. The
|
|
20
|
+
* modal is self-contained: the open state lives in the `<dialog>` element, not
|
|
21
|
+
* in a prop, so the header's close button and Escape close it — and a backdrop
|
|
22
|
+
* click too, once `closeOnBackdropClick` opts in — without the consumer wiring
|
|
23
|
+
* anything. Opening always goes through the `ref` — which is required, since
|
|
24
|
+
* `showModal()` is the only way in: `ref.current?.showModal()` opens the modal
|
|
25
|
+
* and `ref.current?.close()` closes it.
|
|
25
26
|
*
|
|
26
27
|
* A native dialog opened with `showModal()` renders in the browser's top
|
|
27
28
|
* layer, so even under an ancestor with `overflow: hidden` the modal is not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/Provider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,OAAO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"ds modal-footer";
|
|
|
8
8
|
* capture the decision; the button's modifiers must match the consequence, so a
|
|
9
9
|
* destructive confirmation uses a destructive button.
|
|
10
10
|
*
|
|
11
|
+
* Actions line up at the inline-start edge. Render the primary action first —
|
|
12
|
+
* markup order is screen order.
|
|
13
|
+
*
|
|
11
14
|
* @implements ds:global.subcomponent.modal-footer
|
|
12
15
|
*/
|
|
13
16
|
const Footer = ({ children, className, ...props }) => (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.js","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Footer/Footer.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"Footer.js","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Footer/Footer.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACI,EAAsB,EAAE,CAAC,CACrC,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,cAAc,CAAC;AAEpC,eAAe,MAAM,CAAC"}
|
|
@@ -4,15 +4,6 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Modal.Footer styles
|
|
6
6
|
* @implements ds:global.subcomponent.modal-footer
|
|
7
|
-
*
|
|
8
|
-
* DSL anatomy mapping:
|
|
9
|
-
* - layout.type: flow, layout.direction: horizontal -> display: flex; flex-direction: row
|
|
10
|
-
* - layout.justify: end -> justify-content: flex-end
|
|
11
|
-
* - spacing.gap: spacing/small -> gap: var(--modal-footer-gap)
|
|
12
|
-
* - spacing.internal: spacing/medium -> padding-block / padding-inline
|
|
13
|
-
* - appearance.border.top: border/style/divider -> an inset ::before rule, not a
|
|
14
|
-
* border (a border would span the full dialog width; the design insets the
|
|
15
|
-
* rule to the inline padding)
|
|
16
7
|
*/
|
|
17
8
|
|
|
18
9
|
/* Component tokens — sourced from @canonical/design-tokens */
|
|
@@ -27,11 +18,11 @@
|
|
|
27
18
|
}
|
|
28
19
|
|
|
29
20
|
.ds.modal-footer {
|
|
30
|
-
/* layout.type: flow, direction horizontal, justify
|
|
21
|
+
/* layout.type: flow, direction horizontal, justify start */
|
|
31
22
|
display: flex;
|
|
32
23
|
flex-direction: row;
|
|
33
24
|
align-items: center;
|
|
34
|
-
justify-content: flex-
|
|
25
|
+
justify-content: flex-start;
|
|
35
26
|
gap: var(--modal-footer-gap);
|
|
36
27
|
padding-block: var(--modal-footer-padding-block);
|
|
37
28
|
padding-inline: var(--modal-footer-padding-inline);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { IconButtonStandIn as IconButton } from "../../../../common/IconButtonStandIn/index.js";
|
|
3
3
|
import { useModalContext } from "../../hooks/useModalContext.js";
|
|
4
4
|
import "./styles.css";
|
|
5
5
|
const componentCssClassName = "ds modal-header";
|
|
@@ -20,7 +20,7 @@ const componentCssClassName = "ds modal-header";
|
|
|
20
20
|
*/
|
|
21
21
|
const Header = ({ children, titleId, undismissible = false, dismissLabel = "Close", onDismiss, className, ...props }) => {
|
|
22
22
|
const modal = useModalContext();
|
|
23
|
-
return (_jsxs("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: [_jsx("span", { className: "title", id: titleId ?? modal.titleId, children: children }), !undismissible && (_jsx(
|
|
23
|
+
return (_jsxs("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: [_jsx("span", { className: "title", id: titleId ?? modal.titleId, children: children }), !undismissible && (_jsx(IconButton, { type: "button", className: "close", importance: "tertiary", icon: "close", "aria-label": dismissLabel, onClick: onDismiss ?? modal.onDismiss }))] }));
|
|
24
24
|
};
|
|
25
25
|
Header.displayName = "Modal.Header";
|
|
26
26
|
export default Header;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Header/Header.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Header/Header.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,IAAI,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,QAAQ,EACR,OAAO,EACP,aAAa,GAAG,KAAK,EACrB,YAAY,GAAG,OAAO,EACtB,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACI,EAAsB,EAAE;IACpC,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,OAAO,CACL,eACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,aAET,eAAM,SAAS,EAAC,OAAO,EAAC,EAAE,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,YACjD,QAAQ,GACJ,EACN,CAAC,aAAa,IAAI,CAIjB,KAAC,UAAU,IACT,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,OAAO,EACjB,UAAU,EAAC,UAAU,EACrB,IAAI,EAAC,OAAO,gBACA,YAAY,EACxB,OAAO,EAAE,SAAS,IAAI,KAAK,CAAC,SAAS,GACrC,CACH,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,cAAc,CAAC;AAEpC,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { IconButtonStandInProps } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Private stand-in for IconButton: its props, drawn by Button until
|
|
5
|
+
* IconButton and its sheet land.
|
|
6
|
+
*/
|
|
7
|
+
export default function IconButtonStandIn(props: IconButtonStandInProps): React.ReactElement;
|
|
8
|
+
//# sourceMappingURL=IconButtonStandIn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButtonStandIn.d.ts","sourceRoot":"","sources":["../../../../../src/lib/common/IconButtonStandIn/IconButtonStandIn.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,KAAK,EAAE,sBAAsB,GAC5B,KAAK,CAAC,YAAY,CAEpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/common/IconButtonStandIn/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtE,mBAAmB,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IconName } from "@canonical/ds-assets";
|
|
2
|
+
import type { ButtonProps } from "../../component/Button/index.js";
|
|
3
|
+
/** An accessible name: `aria-label`, `aria-labelledby`, or both. */
|
|
4
|
+
type AccessibleName = {
|
|
5
|
+
/** The accessible name. */
|
|
6
|
+
"aria-label": string;
|
|
7
|
+
/** The id of an element whose text names the button. */
|
|
8
|
+
"aria-labelledby"?: string;
|
|
9
|
+
} | {
|
|
10
|
+
/** The accessible name. */
|
|
11
|
+
"aria-label"?: string;
|
|
12
|
+
/** The id of an element whose text names the button. */
|
|
13
|
+
"aria-labelledby": string;
|
|
14
|
+
};
|
|
15
|
+
/** The stand-in's own props; the rest are Button's. */
|
|
16
|
+
type OwnProps = {
|
|
17
|
+
/** The design-system icon, the button's only visible content. */
|
|
18
|
+
icon: IconName;
|
|
19
|
+
/** No visible children: name it with `aria-label` or `aria-labelledby`. */
|
|
20
|
+
children?: never;
|
|
21
|
+
} & AccessibleName;
|
|
22
|
+
/**
|
|
23
|
+
* IconButton's props, copied: Button's props with a required `icon` and
|
|
24
|
+
* accessible name, no children and no `variant`.
|
|
25
|
+
*/
|
|
26
|
+
export type IconButtonStandInProps = OwnProps & Omit<ButtonProps, keyof OwnProps | "variant">;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/common/IconButtonStandIn/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,oEAAoE;AACpE,KAAK,cAAc,GACf;IACE,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACD;IACE,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEN,uDAAuD;AACvD,KAAK,QAAQ,GAAG;IACd,iEAAiE;IACjE,IAAI,EAAE,QAAQ,CAAC;IACf,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,GAAG,cAAc,CAAC;AAEnB;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAC3C,IAAI,CAAC,WAAW,EAAE,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
import type { ItemProps } from "./types.js";
|
|
3
3
|
import "./styles.css";
|
|
4
|
-
declare function Item({ children, label, url, current, separator, disabled, className, LinkComponent,
|
|
4
|
+
declare function Item({ children, label, url, current, separator, disabled, className, LinkComponent, items: _items, Component: _Component, ...props }: ItemProps): React.ReactElement;
|
|
5
5
|
declare namespace Item {
|
|
6
6
|
var displayName: string;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Breadcrumbs/common/Item/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;sBAYR,EACZ,QAAQ,EACR,KAAK,EACL,GAAG,EACH,OAAe,EACf,SAAe,EACf,QAAgB,EAChB,SAAS,EACT,aAAmB,EAEnB,
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Breadcrumbs/common/Item/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;sBAYR,EACZ,QAAQ,EACR,KAAK,EACL,GAAG,EACH,OAAe,EACf,SAAe,EACf,QAAgB,EAChB,SAAS,EACT,aAAmB,EAEnB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,UAAU,EACrB,GAAG,KAAK,EACT,EAAE,SAAS,GAAG,KAAK,CAAC,YAAY;;;;eAgDlB,IAAI"}
|
|
@@ -8,8 +8,11 @@ import "./styles.css";
|
|
|
8
8
|
*
|
|
9
9
|
* `import { Button } from "@canonical/react-ds-global";`
|
|
10
10
|
*
|
|
11
|
+
* Fragments: renders the button plus, when `loading` is controlled, a sibling
|
|
12
|
+
* status region, so the component has no single root element.
|
|
13
|
+
*
|
|
11
14
|
* @implements ds:global.component.button
|
|
12
15
|
*/
|
|
13
|
-
declare const Button: ({ id, className, children, style, importance, anticipation, variant, icon, loading, disabled, ...props }: Props) => React.ReactElement;
|
|
16
|
+
declare const Button: ({ id, className, children, style, importance, anticipation, variant, icon, loading, loadingLabel, disabled, onClick, ...props }: Props) => React.ReactElement;
|
|
14
17
|
export default Button;
|
|
15
18
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,cAAc,CAAC;AAItB
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,MAAM,oIAcT,KAAK,KAAG,KAAK,CAAC,YAqFhB,CAAC;eAEa,MAAM"}
|
|
@@ -43,12 +43,23 @@ type OwnProps = {
|
|
|
43
43
|
*/
|
|
44
44
|
icon?: IconName;
|
|
45
45
|
/**
|
|
46
|
-
* Whether the button is in a loading (busy) state.
|
|
47
|
-
*
|
|
48
|
-
* the action cannot be triggered again
|
|
49
|
-
*
|
|
46
|
+
* Whether the button is in a loading (busy) state. Overlays a Spinner,
|
|
47
|
+
* marks the button `aria-busy` and `aria-disabled`, and blocks activation
|
|
48
|
+
* (clicks and form submission) so the action cannot be triggered again
|
|
49
|
+
* while it is in flight. The button stays focusable, so keyboard focus is
|
|
50
|
+
* not lost when loading starts.
|
|
51
|
+
*
|
|
52
|
+
* Passing `loading` (even as `false`) also renders a visually hidden
|
|
53
|
+
* `role="status"` region after the button that announces `loadingLabel`
|
|
54
|
+
* while loading. Pass it from the first render so the region exists before
|
|
55
|
+
* it is needed.
|
|
50
56
|
*/
|
|
51
57
|
loading?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Text announced by assistive technology when `loading` becomes true.
|
|
60
|
+
* @default "Loading"
|
|
61
|
+
*/
|
|
62
|
+
loadingLabel?: string;
|
|
52
63
|
};
|
|
53
64
|
type Props = OwnProps & Omit<ComponentProps<"button">, keyof OwnProps>;
|
|
54
65
|
export type { Props as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;;;;GAKG;AACH,KAAK,QAAQ,GAAG;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;;;;GAKG;AACH,KAAK,QAAQ,GAAG;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC;AAEvE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,cAAc,CAAC;0BAgDJ,EAChB,GAAG,EACH,oBAA4B,EAC5B,QAAQ,EACR,SAAS,EACT,OAAO,EACP,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,UAAU,GAAG,KAAK,CAAC,YAAY;;;;;;eA8EnB,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;wBAgBN,EACd,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,KAAK,CAAC,YAAY;;;;eAWpB,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Header/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;wBAmBN,EACd,QAAQ,EACR,OAAO,EACP,aAAqB,EACrB,YAAsB,EACtB,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,KAAK,CAAC,YAAY;;;;
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Header/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;wBAmBN,EACd,QAAQ,EACR,OAAO,EACP,aAAqB,EACrB,YAAsB,EACtB,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,KAAK,CAAC,YAAY;;;;eA8BpB,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -34,9 +34,10 @@ type OwnProps = {
|
|
|
34
34
|
* @implements ds:global.pattern.modal
|
|
35
35
|
*
|
|
36
36
|
* `open` is omitted because a `<dialog>` carrying the `open` attribute is
|
|
37
|
-
* *non-modal*: no top layer, no backdrop,
|
|
38
|
-
* ever opened through `showModal()`, so the
|
|
39
|
-
* element and not in a prop. Use the `ref` to
|
|
37
|
+
* *non-modal*: no top layer, no backdrop, and the page behind it stays
|
|
38
|
+
* interactive. The modal is only ever opened through `showModal()`, so the
|
|
39
|
+
* open state lives in the DOM element and not in a prop. Use the `ref` to
|
|
40
|
+
* open or close it.
|
|
40
41
|
*
|
|
41
42
|
* `onClose` is *not* omitted: the native `close` event is how a consumer hears
|
|
42
43
|
* that the modal is gone, whichever way out the user took, and it replaces the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACV,MAAM,OAAO,CAAC;AAEf,KAAK,QAAQ,GAAG;IACd;;;;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E;IACrE,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;OAIG;IACH,GAAG,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,KAAK,EAAE,oBAAoB,KACxB,YAAY,CAAC,mBAAmB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-ds-global",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
8
11
|
"style": "dist/esm/lib/index.css",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
@@ -53,26 +56,26 @@
|
|
|
53
56
|
"test:vitest:watch": "vitest"
|
|
54
57
|
},
|
|
55
58
|
"dependencies": {
|
|
56
|
-
"@canonical/ds-assets": "^0.
|
|
57
|
-
"@canonical/ds-utils": "^0.
|
|
58
|
-
"@canonical/react-hooks": "^0.
|
|
59
|
-
"@canonical/
|
|
60
|
-
"@canonical/styles": "^0.47.0",
|
|
59
|
+
"@canonical/ds-assets": "^0.49.0",
|
|
60
|
+
"@canonical/ds-utils": "^0.49.0",
|
|
61
|
+
"@canonical/react-hooks": "^0.49.0",
|
|
62
|
+
"@canonical/styles": "^0.49.0",
|
|
61
63
|
"react": "^19.2.4",
|
|
62
64
|
"react-dom": "^19.2.4"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
|
-
"@biomejs/biome": "2.
|
|
66
|
-
"@canonical/biome-config": "0.
|
|
67
|
-
"@canonical/design-tokens": "0.
|
|
68
|
-
"@canonical/ds-types": "^0.
|
|
69
|
-
"@canonical/router-core": "^0.
|
|
70
|
-
"@canonical/router-react": "^0.
|
|
71
|
-
"@canonical/storybook-addon-utils": "^0.
|
|
72
|
-
"@canonical/storybook-
|
|
73
|
-
"@canonical/
|
|
74
|
-
"@canonical/
|
|
75
|
-
"@canonical/
|
|
67
|
+
"@biomejs/biome": "2.6.9",
|
|
68
|
+
"@canonical/biome-config": "0.47.0",
|
|
69
|
+
"@canonical/design-tokens": "0.46.0",
|
|
70
|
+
"@canonical/ds-types": "^0.49.0",
|
|
71
|
+
"@canonical/router-core": "^0.49.0",
|
|
72
|
+
"@canonical/router-react": "^0.49.0",
|
|
73
|
+
"@canonical/storybook-addon-utils": "^0.49.0",
|
|
74
|
+
"@canonical/storybook-config": "^0.49.0",
|
|
75
|
+
"@canonical/storybook-helpers": "^0.49.0",
|
|
76
|
+
"@canonical/typescript-config-react": "^0.49.0",
|
|
77
|
+
"@canonical/vitest-config-react": "^0.49.0",
|
|
78
|
+
"@canonical/webarchitect": "0.46.0",
|
|
76
79
|
"@chromatic-com/storybook": "^5.0.1",
|
|
77
80
|
"@storybook/addon-docs": "^10.6.0",
|
|
78
81
|
"@storybook/react-vite": "^10.6.0",
|
|
@@ -84,11 +87,11 @@
|
|
|
84
87
|
"@vitejs/plugin-react": "^6.0.0",
|
|
85
88
|
"copyfiles": "^2.4.1",
|
|
86
89
|
"globals": "^17.4.0",
|
|
87
|
-
"jsdom": "^
|
|
90
|
+
"jsdom": "^31.0.0",
|
|
88
91
|
"storybook": "^10.6.0",
|
|
89
92
|
"typescript": "^7.0.2",
|
|
90
93
|
"vite": "^8.0.1",
|
|
91
94
|
"vitest": "^5.0.0"
|
|
92
95
|
},
|
|
93
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "9b71099ded16351ee14432246e3d8190f48767ed"
|
|
94
97
|
}
|