@canonical/react-ds-core 0.10.0-experimental.0 → 0.10.0-experimental.4
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/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/index.js +2 -0
- package/dist/esm/lib/index.js.map +1 -0
- package/dist/esm/lib/types/index.js +2 -0
- package/dist/esm/lib/types/index.js.map +1 -0
- package/dist/esm/lib/types/polymorphic.js +2 -0
- package/dist/esm/lib/types/polymorphic.js.map +1 -0
- package/dist/esm/storybook/decorators.js +3 -0
- package/dist/esm/storybook/decorators.js.map +1 -0
- package/dist/esm/ui/Badge/Badge.js +21 -0
- package/dist/esm/ui/Badge/Badge.js.map +1 -0
- package/dist/esm/ui/Badge/hooks/useBadge.js +23 -0
- package/dist/esm/ui/Badge/hooks/useBadge.js.map +1 -0
- package/dist/esm/ui/Badge/index.js +4 -0
- package/dist/esm/ui/Badge/index.js.map +1 -0
- package/dist/esm/ui/Badge/styles.css +21 -0
- package/dist/esm/ui/Badge/types.js +3 -0
- package/dist/esm/ui/Badge/types.js.map +1 -0
- package/dist/esm/ui/Chip/styles.css +7 -0
- package/dist/esm/ui/Icon/Icon.js +15 -0
- package/dist/esm/ui/Icon/Icon.js.map +1 -0
- package/dist/esm/ui/Icon/index.js +4 -0
- package/dist/esm/ui/Icon/index.js.map +1 -0
- package/dist/esm/ui/Icon/styles.css +12 -0
- package/dist/esm/ui/Icon/types.js +3 -0
- package/dist/esm/ui/Icon/types.js.map +1 -0
- package/dist/esm/ui/Link/Link.js +15 -0
- package/dist/esm/ui/Link/Link.js.map +1 -0
- package/dist/esm/ui/Link/index.js +4 -0
- package/dist/esm/ui/Link/index.js.map +1 -0
- package/dist/esm/ui/Link/styles.css +25 -0
- package/dist/esm/ui/Link/types.js +3 -0
- package/dist/esm/ui/Link/types.js.map +1 -0
- package/dist/esm/ui/Rule/Rule.js +16 -0
- package/dist/esm/ui/Rule/Rule.js.map +1 -0
- package/dist/esm/ui/Rule/index.js +4 -0
- package/dist/esm/ui/Rule/index.js.map +1 -0
- package/dist/esm/ui/Rule/styles.css +16 -0
- package/dist/esm/ui/Rule/types.js +3 -0
- package/dist/esm/ui/Rule/types.js.map +1 -0
- package/dist/esm/ui/Tooltip/common/TooltipArea/TooltipArea.js +1 -1
- package/dist/esm/ui/Tooltip/common/TooltipArea/TooltipArea.js.map +1 -1
- package/dist/esm/ui/Tooltip/common/TooltipArea/styles.css +1 -1
- package/dist/esm/ui/index.js +4 -0
- package/dist/esm/ui/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/index.d.ts +2 -0
- package/dist/types/lib/index.d.ts.map +1 -0
- package/dist/types/lib/types/index.d.ts +2 -0
- package/dist/types/lib/types/index.d.ts.map +1 -0
- package/dist/types/lib/types/polymorphic.d.ts +24 -0
- package/dist/types/lib/types/polymorphic.d.ts.map +1 -0
- package/dist/types/storybook/decorators.d.ts +3 -0
- package/dist/types/storybook/decorators.d.ts.map +1 -0
- package/dist/types/ui/Badge/Badge.d.ts +11 -0
- package/dist/types/ui/Badge/Badge.d.ts.map +1 -0
- package/dist/types/ui/Badge/hooks/useBadge.d.ts +7 -0
- package/dist/types/ui/Badge/hooks/useBadge.d.ts.map +1 -0
- package/dist/types/ui/Badge/index.d.ts +3 -0
- package/dist/types/ui/Badge/index.d.ts.map +1 -0
- package/dist/types/ui/Badge/types.d.ts +42 -0
- package/dist/types/ui/Badge/types.d.ts.map +1 -0
- package/dist/types/ui/Button/types.d.ts +6 -2
- package/dist/types/ui/Button/types.d.ts.map +1 -1
- package/dist/types/ui/Icon/Icon.d.ts +13 -0
- package/dist/types/ui/Icon/Icon.d.ts.map +1 -0
- package/dist/types/ui/Icon/index.d.ts +3 -0
- package/dist/types/ui/Icon/index.d.ts.map +1 -0
- package/dist/types/ui/Icon/types.d.ts +13 -0
- package/dist/types/ui/Icon/types.d.ts.map +1 -0
- package/dist/types/ui/Link/Link.d.ts +10 -0
- package/dist/types/ui/Link/Link.d.ts.map +1 -0
- package/dist/types/ui/Link/index.d.ts +3 -0
- package/dist/types/ui/Link/index.d.ts.map +1 -0
- package/dist/types/ui/Link/types.d.ts +13 -0
- package/dist/types/ui/Link/types.d.ts.map +1 -0
- package/dist/types/ui/Rule/Rule.d.ts +12 -0
- package/dist/types/ui/Rule/Rule.d.ts.map +1 -0
- package/dist/types/ui/Rule/index.d.ts +3 -0
- package/dist/types/ui/Rule/index.d.ts.map +1 -0
- package/dist/types/ui/Rule/types.d.ts +11 -0
- package/dist/types/ui/Rule/types.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +4 -0
- package/dist/types/ui/index.d.ts.map +1 -1
- package/package.json +12 -11
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polymorphic.js","sourceRoot":"","sources":["../../../../src/lib/types/polymorphic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/storybook/decorators.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,CAC/C,cAAK,GAAG,EAAC,KAAK,YACZ,KAAC,KAAK,KAAG,GACL,CACP,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
import useBadge from "./hooks/useBadge.js";
|
|
4
|
+
const componentCssClassName = "ds badge";
|
|
5
|
+
/**
|
|
6
|
+
* description of the Badge component
|
|
7
|
+
* @returns {React.ReactElement} - Rendered Badge
|
|
8
|
+
* @implements syntax:core:component:badge:1.0.0
|
|
9
|
+
*/
|
|
10
|
+
const Badge = ({ value, className, severity, humanizeOptions, pluralizeOptions, ...props }) => {
|
|
11
|
+
const { displayValue, title } = useBadge({
|
|
12
|
+
value,
|
|
13
|
+
humanizeOptions,
|
|
14
|
+
pluralizeOptions,
|
|
15
|
+
});
|
|
16
|
+
return (_jsx("span", { title: title, className: [componentCssClassName, severity, className]
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(" "), ...props, children: displayValue }));
|
|
19
|
+
};
|
|
20
|
+
export default Badge;
|
|
21
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../../src/ui/Badge/Badge.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AACtB,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAE3C,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAEzC;;;;GAIG;AACH,MAAM,KAAK,GAAG,CAAC,EACb,KAAK,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,GAAG,KAAK,EACG,EAAsB,EAAE;IACnC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;QACvC,KAAK;QACL,eAAe;QACf,gBAAgB;KACjB,CAAC,CAAC;IAEH,OAAO,CACL,eACE,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,CAAC,qBAAqB,EAAE,QAAQ,EAAE,SAAS,CAAC;aACpD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,YAER,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { humanizeNumber, pluralize, } from "@canonical/utils";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
const DEFAULT_HUMANIZE_OPTIONS = {
|
|
4
|
+
overflowIndicator: "+",
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A hook to manage a Badge's internal state
|
|
8
|
+
*/
|
|
9
|
+
const useBadge = ({ value, humanizeOptions, pluralizeOptions, }) => {
|
|
10
|
+
// Badge values must be at least 0 to preserve their purpose as natural number indicators
|
|
11
|
+
const valueToUse = useMemo(() => Math.max(0, value), [value]);
|
|
12
|
+
const displayValue = useMemo(() => {
|
|
13
|
+
const options = { ...DEFAULT_HUMANIZE_OPTIONS, ...humanizeOptions };
|
|
14
|
+
return humanizeNumber(valueToUse, options).displayValue;
|
|
15
|
+
}, [valueToUse, humanizeOptions]);
|
|
16
|
+
const title = useMemo(() => `${displayValue} ${pluralize(valueToUse, pluralizeOptions)}`, [valueToUse, displayValue, pluralizeOptions]);
|
|
17
|
+
return useMemo(() => ({
|
|
18
|
+
displayValue,
|
|
19
|
+
title,
|
|
20
|
+
}), [displayValue, title]);
|
|
21
|
+
};
|
|
22
|
+
export default useBadge;
|
|
23
|
+
//# sourceMappingURL=useBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBadge.js","sourceRoot":"","sources":["../../../../../src/ui/Badge/hooks/useBadge.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,MAAM,wBAAwB,GAA0B;IACtD,iBAAiB,EAAE,GAAG;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,EAChB,KAAK,EACL,eAAe,EACf,gBAAgB,GACF,EAAkB,EAAE;IAClC,yFAAyF;IACzF,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,MAAM,YAAY,GAAW,OAAO,CAAC,GAAG,EAAE;QACxC,MAAM,OAAO,GAAG,EAAE,GAAG,wBAAwB,EAAE,GAAG,eAAe,EAAE,CAAC;QAEpE,OAAO,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,YAAY,CAAC;IAC1D,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;IAElC,MAAM,KAAK,GAAW,OAAO,CAC3B,GAAG,EAAE,CAAC,GAAG,YAAY,IAAI,SAAS,CAAC,UAAU,EAAE,gBAAgB,CAAC,EAAE,EAClE,CAAC,UAAU,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAC7C,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,YAAY;QACZ,KAAK;KACN,CAAC,EACF,CAAC,YAAY,EAAE,KAAK,CAAC,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Badge/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* Badge.css */
|
|
2
|
+
.ds.badge {
|
|
3
|
+
/** Pull the badge closer to the edge of a chip */
|
|
4
|
+
--badge-chip-margin-tweak: 0.15rem;
|
|
5
|
+
|
|
6
|
+
/* Base badge styles using tokens */
|
|
7
|
+
background-color: var(--intent-color, var(--badge-color-background));
|
|
8
|
+
border-radius: var(--badge-border-radius);
|
|
9
|
+
box-sizing: content-box;
|
|
10
|
+
color: var(--intent-color-text, var(--badge-color-text));
|
|
11
|
+
display: inline-block;
|
|
12
|
+
font-size: var(--badge-font-size);
|
|
13
|
+
font-weight: var(--badge-font-weight);
|
|
14
|
+
line-height: var(--badge-line-height);
|
|
15
|
+
margin-bottom: var(--badge-margin-bottom);
|
|
16
|
+
max-width: var(--badge-max-width);
|
|
17
|
+
min-width: var(--badge-min-width);
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
padding: var(--badge-padding-vertical) var(--badge-padding-horizontal);
|
|
20
|
+
text-align: center;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Badge/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
|
|
@@ -76,4 +76,11 @@
|
|
|
76
76
|
var(--chip-color-background-active)
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
/* Context-specific styling for badges within chips */
|
|
81
|
+
& .ds.badge {
|
|
82
|
+
align-self: center;
|
|
83
|
+
margin-left: var(--spacing-horizontal-small);
|
|
84
|
+
margin-right: var(--badge-chip-margin-tweak);
|
|
85
|
+
}
|
|
79
86
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
const componentCssClassName = "ds icon";
|
|
4
|
+
/**
|
|
5
|
+
* Icon component that renders SVG icons from @canonical/ds-assets
|
|
6
|
+
* @param iconName - Name of the icon to render
|
|
7
|
+
* @param rootPath - Root path to the icons (default: /icons)
|
|
8
|
+
* @returns {React.ReactElement} - Rendered Icon SVG
|
|
9
|
+
* @implements syntax:core:component:icon:1.0.0
|
|
10
|
+
*/
|
|
11
|
+
const Icon = ({ xmlns = "http://www.w3.org/2000/svg", viewBox = "0 0 16 16", icon, className, rootPath = "/icons", role = "img", ...props }) => {
|
|
12
|
+
return (_jsx("svg", { xmlns: xmlns, viewBox: viewBox, className: [componentCssClassName, className].filter(Boolean).join(" "), role: role, ...props, children: _jsx("use", { href: `${rootPath}/${icon}.svg#${icon}` }) }));
|
|
13
|
+
};
|
|
14
|
+
export default Icon;
|
|
15
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../src/ui/Icon/Icon.tsx"],"names":[],"mappings":";AAKA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,KAAK,GAAG,4BAA4B,EACpC,OAAO,GAAG,WAAW,EACrB,IAAI,EACJ,SAAS,EACT,QAAQ,GAAG,QAAQ,EACnB,IAAI,GAAG,KAAK,EACZ,GAAG,KAAK,EACE,EAAgB,EAAE;IAC5B,OAAO,CACL,cACE,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,IAAI,EAAE,IAAI,KACN,KAAK,YAET,cAAK,IAAI,EAAE,GAAG,QAAQ,IAAI,IAAI,QAAQ,IAAI,EAAE,GAAI,GAC5C,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Icon/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Icon/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
const componentCssClassName = "ds link";
|
|
4
|
+
/**
|
|
5
|
+
* Link component that can be rendered as different elements while maintaining consistent styling
|
|
6
|
+
* @implements syntax:core:component:link:1.0.0
|
|
7
|
+
*/
|
|
8
|
+
const Link = ({ as, className, children, appearance, ...props }) => {
|
|
9
|
+
const Component = as || "a";
|
|
10
|
+
return (_jsx(Component, { className: [componentCssClassName, className, appearance]
|
|
11
|
+
.filter(Boolean)
|
|
12
|
+
.join(" "), ...props, children: children }));
|
|
13
|
+
};
|
|
14
|
+
export default Link;
|
|
15
|
+
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../src/ui/Link/Link.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;GAGG;AACH,MAAM,IAAI,GAAG,CAAqC,EAChD,EAAE,EACF,SAAS,EACT,QAAQ,EACR,UAAU,EACV,GAAG,KAAK,EACY,EAAgB,EAAE;IACtC,MAAM,SAAS,GAAG,EAAE,IAAI,GAAG,CAAC;IAE5B,OAAO,CACL,KAAC,SAAS,IACR,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,EAAE,UAAU,CAAC;aACtD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,YAER,QAAQ,GACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Link/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* @canonical/generator-ds 0.10.0-experimental.2 */
|
|
2
|
+
|
|
3
|
+
.ds.link {
|
|
4
|
+
&.soft {
|
|
5
|
+
/*
|
|
6
|
+
Soft links are explicitly meant to use normal text color
|
|
7
|
+
TODO because <a> tag have their color set in the styles package, we need to set a specific color here.
|
|
8
|
+
Otherwise, we could use `currentColor` or only apply link color to non-soft links, which would allow the link to inherit color from parent.
|
|
9
|
+
We should confirm this approach is what we want.
|
|
10
|
+
*/
|
|
11
|
+
color: var(--tmp-color-text-default);
|
|
12
|
+
|
|
13
|
+
&:hover {
|
|
14
|
+
color: var(--tmp-color-text-link-default);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:visited {
|
|
18
|
+
color: var(--tmp-color-text-default);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&[aria-current="page"] {
|
|
22
|
+
font-weight: var(--link-soft-selected-font-weight);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Link/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
const componentCssClassName = "ds rule";
|
|
4
|
+
/**
|
|
5
|
+
* A component that separates content into logical groups.
|
|
6
|
+
* @TODO implement fixed-width behavior after implementation of the Grid
|
|
7
|
+
* @returns {React.ReactElement} - Rendered Rule
|
|
8
|
+
* @implements syntax:core:component:rule:1.0.0
|
|
9
|
+
*/
|
|
10
|
+
const Rule = ({ className, emphasis, ...props }) => {
|
|
11
|
+
return (_jsx("hr", { className: [componentCssClassName, emphasis, className]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(" "), ...props }));
|
|
14
|
+
};
|
|
15
|
+
export default Rule;
|
|
16
|
+
//# sourceMappingURL=Rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rule.js","sourceRoot":"","sources":["../../../../src/ui/Rule/Rule.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;;;GAKG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACE,EAAsB,EAAE;IAClC,OAAO,CACL,aACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,QAAQ,EAAE,SAAS,CAAC;aACpD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Rule/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* @canonical/generator-ds 0.10.0-experimental.2 */
|
|
2
|
+
|
|
3
|
+
.ds.rule {
|
|
4
|
+
background-color: var(
|
|
5
|
+
--intent-separator-bar-color,
|
|
6
|
+
var(--rule-color-background)
|
|
7
|
+
);
|
|
8
|
+
border-width: var(--rule-border-width);
|
|
9
|
+
height: var(--intent-separator-bar-height, var(--rule-height));
|
|
10
|
+
margin-block-start: var(--rule-margin-top);
|
|
11
|
+
/* global modifiers can change the height of the rule. Subtract the actual height of the rule from the target height to keep baseline alignment */
|
|
12
|
+
margin-block-end: calc(
|
|
13
|
+
var(--rule-height-with-margin) -
|
|
14
|
+
var(--intent-separator-bar-height, var(--rule-height))
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Rule/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
|
|
@@ -19,7 +19,7 @@ const TooltipArea = ({ children, style, className, Message, distance = "6px", ta
|
|
|
19
19
|
.join(" "), onPointerEnter: handleTriggerEnter, onFocus: handleTriggerFocus, ref: popupRef, style: {
|
|
20
20
|
...messageElementStyle,
|
|
21
21
|
...popupPositionStyle,
|
|
22
|
-
// @ts-
|
|
22
|
+
// @ts-expect-error allow binding arrow size to distance, as it is needed both in JS and CSS calculations
|
|
23
23
|
"--tooltip-spacing-arrow-size": distance,
|
|
24
24
|
...(autoFit &&
|
|
25
25
|
bestPosition?.autoFitOffset && {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipArea.js","sourceRoot":"","sources":["../../../../../../src/ui/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,GAAG,KAAK,EACS,EAAgB,EAAE;IACnC,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,GACb,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAE9C,MAAM,qBAAqB,GAAG,CAC5B,KAAC,OAAO,IACN,EAAE,EAAE,OAAO,EACX,SAAS,EAAE;YACT,YAAY,EAAE,YAAY;YAC1B,uBAAuB;YACvB,OAAO,IAAI,SAAS;SACrB;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,cAAc,EAAE,kBAAkB,EAClC,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE;YACL,GAAG,mBAAmB;YACtB,GAAG,kBAAkB;YACrB,
|
|
1
|
+
{"version":3,"file":"TooltipArea.js","sourceRoot":"","sources":["../../../../../../src/ui/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,GAAG,KAAK,EACS,EAAgB,EAAE;IACnC,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,GACb,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAE9C,MAAM,qBAAqB,GAAG,CAC5B,KAAC,OAAO,IACN,EAAE,EAAE,OAAO,EACX,SAAS,EAAE;YACT,YAAY,EAAE,YAAY;YAC1B,uBAAuB;YACvB,OAAO,IAAI,SAAS;SACrB;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,cAAc,EAAE,kBAAkB,EAClC,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE;YACL,GAAG,mBAAmB;YACtB,GAAG,kBAAkB;YACrB,yGAAyG;YACzG,8BAA8B,EAAE,QAAQ;YACxC,GAAG,CAAC,OAAO;gBACT,YAAY,EAAE,aAAa,IAAI;gBAC7B,4BAA4B,EAAE,GAAG,YAAY,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,IAAI;gBACzE,6BAA6B,EAAE,GAAG,YAAY,EAAE,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI;aAC5E,CAAC;SACL,EACD,MAAM,EAAE,MAAM,YAEb,OAAO,GACA,CACX,CAAC;IAEF,OAAO;IACL,0GAA0G;IAC1G,gBACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,kBAAkB,EAClC,cAAc,EAAE,kBAAkB,aAElC,eACE,EAAE,EAAE,eAAe,EACnB,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,GAAG,EAAE,SAAS,sBACI,OAAO,YAExB,QAAQ,GACJ,EAIN,OAAO,MAAM,KAAK,WAAW;gBAC5B,CAAC,CAAC,sEAAsE;oBACtE,8FAA8F;oBAC9F,oCAAoC;oBACpC,YAAY,CAAC,qBAAqB,EAAE,aAAa,IAAI,QAAQ,CAAC,IAAI,CAAC;gBACrE,CAAC,CAAC,qBAAqB,IACpB,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
display: inline-block;
|
|
7
7
|
|
|
8
8
|
& > * {
|
|
9
|
-
/* The tooltip targets must have no margin in order for tooltip placements to work correctly */
|
|
9
|
+
/* biome-ignore lint/complexity/noImportantStyles: The tooltip targets must have no margin in order for tooltip placements to work correctly */
|
|
10
10
|
margin: 0 !important;
|
|
11
11
|
}
|
|
12
12
|
}
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export * from "./Badge/index.js";
|
|
1
2
|
export * from "./Button/index.js";
|
|
2
3
|
export * from "./Chip/index.js";
|
|
4
|
+
export * from "./Icon/index.js";
|
|
5
|
+
export * from "./Link/index.js";
|
|
6
|
+
export * from "./Rule/index.js";
|
|
3
7
|
export * from "./Tooltip/index.js";
|
|
4
8
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentProps, ElementType } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Utility type for creating polymorphic components in React.
|
|
4
|
+
* This type combines the props of the specified element type with the component's own props,
|
|
5
|
+
* allowing the component to be rendered as different HTML elements or custom components.
|
|
6
|
+
* @template TOwnProps - The props specific to the underlying component.
|
|
7
|
+
* @template TElement - The element type to render as.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import type { PolymorphicComponentProps } from '@canonical/ds-types';
|
|
11
|
+
*
|
|
12
|
+
* interface LinkOwnProps {
|
|
13
|
+
* children?: ReactNode;
|
|
14
|
+
* appearance?: "soft";
|
|
15
|
+
* }
|
|
16
|
+
* // A link that is, by default, an "a" element, but can be changed via the `as` prop
|
|
17
|
+
* export type LinkProps<TElement extends ElementType = "a"> =
|
|
18
|
+
* PolymorphicComponentProps<LinkOwnProps, TElement>;
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type PolymorphicComponentProps<TOwnProps extends Object, TElement extends ElementType> = TOwnProps & {
|
|
22
|
+
as?: TElement;
|
|
23
|
+
} & Omit<ComponentProps<TElement>, keyof TOwnProps>;
|
|
24
|
+
//# sourceMappingURL=polymorphic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polymorphic.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/polymorphic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,yBAAyB,CACnC,SAAS,SAAS,MAAM,EACxB,QAAQ,SAAS,WAAW,IAC1B,SAAS,GAAG;IAAE,EAAE,CAAC,EAAE,QAAQ,CAAA;CAAE,GAAG,IAAI,CACpC,cAAc,CAAC,QAAQ,CAAC,EACxB,MAAM,SAAS,CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/storybook/decorators.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC,eAAO,MAAM,GAAG,SAAU,OAAO,WAAW,4CAI3C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { BadgeProps } from "./types.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
/**
|
|
5
|
+
* description of the Badge component
|
|
6
|
+
* @returns {React.ReactElement} - Rendered Badge
|
|
7
|
+
* @implements syntax:core:component:badge:1.0.0
|
|
8
|
+
*/
|
|
9
|
+
declare const Badge: ({ value, className, severity, humanizeOptions, pluralizeOptions, ...props }: BadgeProps) => React.ReactElement;
|
|
10
|
+
export default Badge;
|
|
11
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/ui/Badge/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,cAAc,CAAC;AAKtB;;;;GAIG;AACH,QAAA,MAAM,KAAK,GAAI,6EAOZ,UAAU,KAAG,KAAK,CAAC,YAkBrB,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UseBadgeProps, UseBadgeResult } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A hook to manage a Badge's internal state
|
|
4
|
+
*/
|
|
5
|
+
declare const useBadge: ({ value, humanizeOptions, pluralizeOptions, }: UseBadgeProps) => UseBadgeResult;
|
|
6
|
+
export default useBadge;
|
|
7
|
+
//# sourceMappingURL=useBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBadge.d.ts","sourceRoot":"","sources":["../../../../../src/ui/Badge/hooks/useBadge.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMjE;;GAEG;AACH,QAAA,MAAM,QAAQ,GAAI,+CAIf,aAAa,KAAG,cAsBlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/Badge/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ModifierFamily } from "@canonical/ds-types";
|
|
2
|
+
import type { HumanizeNumberOptions, PluralizeOptions } from "@canonical/utils";
|
|
3
|
+
import type { HTMLAttributes } from "react";
|
|
4
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Numeric value to be displayed.
|
|
7
|
+
*/
|
|
8
|
+
value: number;
|
|
9
|
+
/**
|
|
10
|
+
* Visual appearance of the badge, typically reflecting status.
|
|
11
|
+
* Options include:
|
|
12
|
+
* - "positive": Indicates a positive status
|
|
13
|
+
* - "negative": Indicates a negative status
|
|
14
|
+
* - "caution": Indicates a cautionary status
|
|
15
|
+
* - "information": Indicates an informative status
|
|
16
|
+
* // TODO neutral intent is currently defined in a very button-centric way. It should unset other appearances, but it currently applies default button styling.
|
|
17
|
+
* Possibly we will need to revisit this by binding component variables without component name prefix, so that neutral can reset components to their neutral state.
|
|
18
|
+
*
|
|
19
|
+
* When no appearance is specified, uses the default badge styling.
|
|
20
|
+
*/
|
|
21
|
+
severity?: ModifierFamily<"severity">;
|
|
22
|
+
/**
|
|
23
|
+
* Options for humanizing the numeric value displayed in the badge.
|
|
24
|
+
*/
|
|
25
|
+
humanizeOptions?: HumanizeNumberOptions;
|
|
26
|
+
/**
|
|
27
|
+
* Options for the pluralization of the item being counted.
|
|
28
|
+
*/
|
|
29
|
+
pluralizeOptions?: PluralizeOptions;
|
|
30
|
+
}
|
|
31
|
+
export type UseBadgeProps = Pick<BadgeProps, "value" | "humanizeOptions" | "pluralizeOptions">;
|
|
32
|
+
/**
|
|
33
|
+
* Result of the useBadge hook.
|
|
34
|
+
* Contains the formatted display value and ARIA label for accessibility.
|
|
35
|
+
*/
|
|
36
|
+
export interface UseBadgeResult {
|
|
37
|
+
/** Formatted value to be displayed in the badge */
|
|
38
|
+
displayValue: string | number;
|
|
39
|
+
/** Title attribute, for displaying additional context about the badge on hover */
|
|
40
|
+
title: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Badge/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,eAAe,CAAC;IACjE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC;IAExC;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,UAAU,EACV,OAAO,GAAG,iBAAiB,GAAG,kBAAkB,CACjD,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ModifierFamily } from "@canonical/ds-types";
|
|
1
2
|
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
3
|
export interface BaseProps {
|
|
3
4
|
id?: string;
|
|
@@ -10,8 +11,11 @@ export interface BaseProps {
|
|
|
10
11
|
* `aria-label` prop to ensure that the button label is applied properly. Otherwise, the label will be set to [object Object].
|
|
11
12
|
* */
|
|
12
13
|
children: ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The visual style of the button
|
|
16
|
+
* TODO link button will be a separate component in the future
|
|
17
|
+
* */
|
|
18
|
+
appearance?: ModifierFamily<"severity"> | "base" | "link";
|
|
15
19
|
}
|
|
16
20
|
type Props = BaseProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
17
21
|
export default Props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/types.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,WAAW,SAAS;IAExB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;SAKK;IACL,QAAQ,EAAE,SAAS,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/types.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,WAAW,SAAS;IAExB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;SAKK;IACL,QAAQ,EAAE,SAAS,CAAC;IACpB;;;SAGK;IACL,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC;CAC3D;AAED,KAAK,KAAK,GAAG,SAAS,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEjE,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { IconProps } from "./types.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
/**
|
|
5
|
+
* Icon component that renders SVG icons from @canonical/ds-assets
|
|
6
|
+
* @param iconName - Name of the icon to render
|
|
7
|
+
* @param rootPath - Root path to the icons (default: /icons)
|
|
8
|
+
* @returns {React.ReactElement} - Rendered Icon SVG
|
|
9
|
+
* @implements syntax:core:component:icon:1.0.0
|
|
10
|
+
*/
|
|
11
|
+
declare const Icon: ({ xmlns, viewBox, icon, className, rootPath, role, ...props }: IconProps) => ReactElement;
|
|
12
|
+
export default Icon;
|
|
13
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../src/ui/Icon/Icon.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,IAAI,GAAI,+DAQX,SAAS,KAAG,YAYd,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/Icon/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IconName } from "@canonical/ds-assets";
|
|
2
|
+
import type { SVGAttributes } from "react";
|
|
3
|
+
/**
|
|
4
|
+
We have used the `HTMLDivElement` as a default props base.
|
|
5
|
+
If your component is based on a different HTML element, please update it accordingly.
|
|
6
|
+
See https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API for a full list of HTML elements interfaces.
|
|
7
|
+
*/
|
|
8
|
+
export interface IconProps extends SVGAttributes<HTMLOrSVGElement> {
|
|
9
|
+
icon: IconName;
|
|
10
|
+
/** Root path to the icons (default: /icons). Must be exposed to the user. */
|
|
11
|
+
rootPath?: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Icon/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;EAIE;AACF,MAAM,WAAW,SAAU,SAAQ,aAAa,CAAC,gBAAgB,CAAC;IAEhE,IAAI,EAAE,QAAQ,CAAC;IACf,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ElementType, ReactElement } from "react";
|
|
2
|
+
import type { LinkProps } from "./types.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
/**
|
|
5
|
+
* Link component that can be rendered as different elements while maintaining consistent styling
|
|
6
|
+
* @implements syntax:core:component:link:1.0.0
|
|
7
|
+
*/
|
|
8
|
+
declare const Link: <TElement extends ElementType = "a">({ as, className, children, appearance, ...props }: LinkProps<TElement>) => ReactElement;
|
|
9
|
+
export default Link;
|
|
10
|
+
//# sourceMappingURL=Link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../src/ui/Link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;AAItB;;;GAGG;AACH,QAAA,MAAM,IAAI,GAAI,QAAQ,SAAS,WAAW,GAAG,GAAG,EAAE,mDAM/C,SAAS,CAAC,QAAQ,CAAC,KAAG,YAaxB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/Link/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from "react";
|
|
2
|
+
import type { PolymorphicComponentProps } from "../../lib/index.js";
|
|
3
|
+
interface LinkOwnProps {
|
|
4
|
+
/** Additional CSS classes */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Link contents */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** Link appearance modifier */
|
|
9
|
+
appearance?: "soft";
|
|
10
|
+
}
|
|
11
|
+
export type LinkProps<TElement extends ElementType = "a"> = PolymorphicComponentProps<LinkOwnProps, TElement>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Link/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEpE,UAAU,YAAY;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,SAAS,CAAC,QAAQ,SAAS,WAAW,GAAG,GAAG,IACtD,yBAAyB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { RuleProps } from "./types.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
/**
|
|
5
|
+
* A component that separates content into logical groups.
|
|
6
|
+
* @TODO implement fixed-width behavior after implementation of the Grid
|
|
7
|
+
* @returns {React.ReactElement} - Rendered Rule
|
|
8
|
+
* @implements syntax:core:component:rule:1.0.0
|
|
9
|
+
*/
|
|
10
|
+
declare const Rule: ({ className, emphasis, ...props }: RuleProps) => React.ReactElement;
|
|
11
|
+
export default Rule;
|
|
12
|
+
//# sourceMappingURL=Rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rule.d.ts","sourceRoot":"","sources":["../../../../src/ui/Rule/Rule.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;AAItB;;;;;GAKG;AACH,QAAA,MAAM,IAAI,GAAI,mCAIX,SAAS,KAAG,KAAK,CAAC,YASpB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/Rule/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ModifierFamily } from "@canonical/ds-types";
|
|
2
|
+
import type { HTMLAttributes } from "react";
|
|
3
|
+
/**
|
|
4
|
+
We have used the `HTMLDivElement` as a default props base.
|
|
5
|
+
If your component is based on a different HTML element, please update it accordingly.
|
|
6
|
+
See https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API for a full list of HTML elements interfaces.
|
|
7
|
+
*/
|
|
8
|
+
export interface RuleProps extends HTMLAttributes<HTMLHRElement> {
|
|
9
|
+
emphasis?: ModifierFamily<"emphasis">;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Rule/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;EAIE;AACF,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,aAAa,CAAC;IAC9D,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CACvC"}
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export * from "./Badge/index.js";
|
|
1
2
|
export * from "./Button/index.js";
|
|
2
3
|
export * from "./Chip/index.js";
|
|
4
|
+
export * from "./Icon/index.js";
|
|
5
|
+
export * from "./Link/index.js";
|
|
6
|
+
export * from "./Rule/index.js";
|
|
3
7
|
export * from "./Tooltip/index.js";
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-ds-core",
|
|
3
|
-
"version": "0.10.0-experimental.
|
|
3
|
+
"version": "0.10.0-experimental.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -34,36 +34,37 @@
|
|
|
34
34
|
"check:ts": "tsc --noEmit",
|
|
35
35
|
"storybook": "storybook dev -p 6006 --no-open --host 0.0.0.0",
|
|
36
36
|
"test": "bun run test:vitest",
|
|
37
|
-
"test:watch": "bun run test:vitest:watch",
|
|
38
37
|
"test:vitest": "vitest run",
|
|
39
38
|
"test:vitest:watch": "vitest"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@canonical/
|
|
43
|
-
"@canonical/
|
|
44
|
-
"@canonical/
|
|
41
|
+
"@canonical/ds-assets": "^0.10.0-experimental.4",
|
|
42
|
+
"@canonical/storybook-config": "^0.10.0-experimental.4",
|
|
43
|
+
"@canonical/styles": "^0.10.0-experimental.4",
|
|
44
|
+
"@canonical/utils": "^0.10.0-experimental.4",
|
|
45
45
|
"react": "^19.1.0",
|
|
46
46
|
"react-dom": "^19.1.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@biomejs/biome": "
|
|
50
|
-
"@canonical/biome-config": "^0.10.0-experimental.
|
|
51
|
-
"@canonical/
|
|
49
|
+
"@biomejs/biome": "2.2.4",
|
|
50
|
+
"@canonical/biome-config": "^0.10.0-experimental.4",
|
|
51
|
+
"@canonical/ds-types": "^0.10.0-experimental.4",
|
|
52
|
+
"@canonical/typescript-config-react": "^0.10.0-experimental.4",
|
|
52
53
|
"@chromatic-com/storybook": "^4.0.0",
|
|
53
54
|
"@testing-library/jest-dom": "^6.6.3",
|
|
54
55
|
"@testing-library/react": "^16.3.0",
|
|
55
56
|
"@types/node": "^24.0.0",
|
|
56
57
|
"@types/react": "^19.1.8",
|
|
57
58
|
"@types/react-dom": "^19.1.6",
|
|
58
|
-
"@vitejs/plugin-react": "^
|
|
59
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
59
60
|
"copyfiles": "^2.4.1",
|
|
60
61
|
"globals": "^16.2.0",
|
|
61
|
-
"jsdom": "^
|
|
62
|
+
"jsdom": "^27.0.0",
|
|
62
63
|
"storybook": "^9.0.8",
|
|
63
64
|
"typescript": "^5.8.3",
|
|
64
65
|
"vite": "^7.0.0",
|
|
65
66
|
"vite-tsconfig-paths": "^5.1.4",
|
|
66
67
|
"vitest": "^3.2.3"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "2c35cfbe5527808f3d612a1c683da1b113861e3d"
|
|
69
70
|
}
|