@canonical/svelte-ds-app-launchpad 0.42.0 → 0.44.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.
Files changed (30) hide show
  1. package/README.md +0 -6
  2. package/dist/Welcome.mdx +3 -3
  3. package/dist/components/Breadcrumbs/common/common/Item/types.d.ts +2 -2
  4. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  5. package/dist/components/Breadcrumbs/types.d.ts +3 -3
  6. package/dist/components/Checkbox/styles.css +0 -1
  7. package/dist/components/Link/styles.css +0 -1
  8. package/dist/components/Modal/Modal.svelte +6 -31
  9. package/dist/components/Modal/types.d.ts +6 -3
  10. package/dist/components/Modal/utils/closedByFallbackAttachment.d.ts +9 -0
  11. package/dist/components/Modal/utils/closedByFallbackAttachment.js +46 -0
  12. package/dist/components/Modal/utils/index.d.ts +1 -0
  13. package/dist/components/Modal/utils/index.js +1 -0
  14. package/dist/components/NumberInput/styles.css +1 -1
  15. package/dist/components/Radio/styles.css +0 -1
  16. package/dist/components/Select/Select.svelte +3 -2
  17. package/dist/components/Select/styles.css +37 -57
  18. package/dist/components/Select/types.d.ts +2 -1
  19. package/dist/components/Switch/styles.css +0 -1
  20. package/dist/components/TextInput/styles.css +1 -1
  21. package/dist/index.css +0 -1
  22. package/dist/modifier-families/constants.d.ts +0 -1
  23. package/dist/modifier-families/constants.js +0 -2
  24. package/dist/modifier-families/types.d.ts +4 -4
  25. package/dist/styles/ds-shim.css +21 -42
  26. package/dist/styles/index.css +12 -26
  27. package/package.json +17 -18
  28. package/dist/modifier-families/styles/density.css +0 -14
  29. package/dist/modifier-families/styles/index.css +0 -2
  30. package/dist/modifier-families/styles/severity.css +0 -87
package/README.md CHANGED
@@ -15,12 +15,6 @@ Import the main styles in your project's layout file (e.g. `routes/+layout.svelt
15
15
  ```svelte
16
16
  <script lang="ts">
17
17
  import "@canonical/svelte-ds-app-launchpad/styles.css";
18
-
19
- import "@canonical/launchpad-design-tokens/dist/css/dimension/responsive.css";
20
- import "@canonical/launchpad-design-tokens/dist/css/typography/responsive.css";
21
- import "@canonical/launchpad-design-tokens/dist/css/opacity/opacity.css";
22
- import "@canonical/launchpad-design-tokens/dist/css/transition/preferred.css";
23
- import "@canonical/launchpad-design-tokens/dist/css/color/light.css"; // dark.css or system.css
24
18
  </script>
25
19
  ```
26
20
 
package/dist/Welcome.mdx CHANGED
@@ -11,10 +11,10 @@ import { PackageInfo } from "@canonical/storybook-helpers";
11
11
  tier="apps"
12
12
  framework="svelte"
13
13
  status="prerelease"
14
- dependencies={["@canonical/launchpad-design-tokens", "@floating-ui/dom"]}
14
+ dependencies={["@floating-ui/dom"]}
15
15
  links={{
16
16
  source:
17
- "https://github.com/canonical/pragma/tree/main/packages/svelte/ds-app-launchpad",
18
- ontology: "https://github.com/canonical/design-system",
17
+ "https://github.com/canonical/pragma-web/tree/main/packages/svelte/ds-app-launchpad",
18
+ ontology: "https://github.com/canonical/pragma-core/tree/main/packages/semantics/design-system",
19
19
  }}
20
20
  />
@@ -1,5 +1,5 @@
1
- import type { Segment } from "../../../types.js";
2
- export type ItemProps = Segment & {
1
+ import type { BreadcrumbsSegment } from "../../../types.js";
2
+ export type ItemProps = BreadcrumbsSegment & {
3
3
  /** Indicates whether this segment represents the current page */
4
4
  current?: boolean;
5
5
  };
@@ -1,2 +1,2 @@
1
1
  export { default as Breadcrumbs } from "./Breadcrumbs.svelte";
2
- export type { BreadcrumbsProps, Segment } from "./types.js";
2
+ export type { BreadcrumbsProps, BreadcrumbsSegment } from "./types.js";
@@ -8,12 +8,12 @@ type TextSegment = Omit<SvelteHTMLElements["span"], "children"> & {
8
8
  label: string;
9
9
  href?: never;
10
10
  };
11
- export type Segment = LinkSegment | TextSegment;
11
+ export type BreadcrumbsSegment = LinkSegment | TextSegment;
12
12
  export interface BreadcrumbsProps extends Omit<SvelteHTMLElements["nav"], "children"> {
13
13
  /**
14
14
  * Breadcrumb segments.
15
15
  */
16
- segments: Segment[];
16
+ segments: BreadcrumbsSegment[];
17
17
  /**
18
18
  * The number of segments, from the end, that should never be collapsed.
19
19
  * If set to `all` or a number greater or equal to the total number of segments, no segments will be collapsed.
@@ -22,7 +22,7 @@ export interface BreadcrumbsProps extends Omit<SvelteHTMLElements["nav"], "child
22
22
  */
23
23
  minNumExpanded?: "all" | number;
24
24
  }
25
- export type PossiblyCollapsedSegment = Segment & {
25
+ export type PossiblyCollapsedSegment = BreadcrumbsSegment & {
26
26
  collapsed?: boolean;
27
27
  };
28
28
  export {};
@@ -4,7 +4,6 @@
4
4
  appearance: none;
5
5
  flex-grow: 0;
6
6
  flex-shrink: 0;
7
- outline-offset: 1px;
8
7
 
9
8
  width: var(--dimension-200);
10
9
  height: var(--dimension-200);
@@ -1,7 +1,6 @@
1
1
  /* Generated by @canonical/summon:component-svelte v0.1.0 */
2
2
 
3
3
  .ds.link {
4
- outline-offset: 0px;
5
4
  text-decoration: none;
6
5
  color: var(--color-text-link);
7
6
 
@@ -1,9 +1,8 @@
1
1
  <!-- @canonical/generator-ds 0.10.0-experimental.2 -->
2
2
 
3
3
  <script lang="ts">
4
- import { useIsMounted } from "../../useFunctions/index.js";
5
- import { isEventTargetInElement } from "../../utils/index.js";
6
4
  import type { ModalProps } from "./types.js";
5
+ import { closedByFallbackAttachment } from "./utils/index.js";
7
6
  import "./styles.css";
8
7
 
9
8
  const componentCssClassNameBase = "modal";
@@ -15,8 +14,7 @@
15
14
  class: className,
16
15
  trigger,
17
16
  children,
18
- closeOnOutsideClick = true,
19
- onclick,
17
+ closedby = "any",
20
18
  ontoggle: ontoggleProp,
21
19
  open = $bindable(),
22
20
  ...rest
@@ -25,27 +23,6 @@
25
23
  const fallbackId = $props.id();
26
24
  const id = $derived(idProp || fallbackId);
27
25
 
28
- const isMounted = useIsMounted();
29
-
30
- // Webkit doesn't support `closedby` attribute on dialog elements (https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/closedBy).
31
- // TODO(closedby): Remove this fallback when Webkit supports it.
32
- let contentWrapperRef = $state<HTMLElement>();
33
-
34
- const isClosedByFallbackNeeded = $derived(
35
- isMounted.value && !("closedBy" in HTMLDialogElement.prototype),
36
- );
37
-
38
- const fallbackOnclick: typeof onclick = (e) => {
39
- onclick?.(e);
40
- if (
41
- closeOnOutsideClick &&
42
- contentWrapperRef &&
43
- !isEventTargetInElement(e.target, contentWrapperRef)
44
- ) {
45
- open = false;
46
- }
47
- };
48
-
49
26
  /** Capture the initial value of `open` for SSR paint. After hydration, the dialog's open attribute should never be set manually. */
50
27
  const initialOpen = open;
51
28
 
@@ -63,17 +40,17 @@
63
40
  "aria-haspopup": "dialog",
64
41
  })}
65
42
 
66
- <!-- A non-modal dialog has no real `::backdrop` so we need to fake one. Can't be a pseudo-element, because a pseudo lives inside the dialog so `closeOnOutsideClick` wouldn't work. -->
43
+ <!-- A non-modal dialog has no real `::backdrop` so we need to fake one. Can't be a pseudo-element, because a pseudo lives inside the dialog so `closedby="any"` wouldn't work. -->
67
44
  {#if initialOpen}
68
45
  <div class={componentCssClassNameNonModalBackdrop}></div>
69
46
  {/if}
70
47
  <dialog
71
48
  {id}
72
49
  class={[componentCssClassName, className]}
73
- closedby={closeOnOutsideClick ? "any" : "closerequest"}
74
- onclick={isClosedByFallbackNeeded ? fallbackOnclick : onclick}
50
+ {closedby}
75
51
  {ontoggle}
76
52
  open={initialOpen}
53
+ {@attach closedByFallbackAttachment(closedby)}
77
54
  {@attach (dialogEl) => {
78
55
  // Suppress the transition on mount so that when we upgrade to modal the open fade doesn't play.
79
56
  dialogEl.classList.add("no-transition");
@@ -105,9 +82,7 @@
105
82
  }}
106
83
  {...rest}
107
84
  >
108
- <div style="display: contents;" bind:this={contentWrapperRef}>
109
- {@render children?.(id, () => (open = false))}
110
- </div>
85
+ {@render children?.(id, () => (open = false))}
111
86
  </dialog>
112
87
 
113
88
  <!-- @component
@@ -18,11 +18,14 @@ export interface ModalProps extends BaseProps {
18
18
  */
19
19
  trigger?: Snippet<[triggerProps: ModalTriggerProps]>;
20
20
  /**
21
- * Whether to close the modal when clicking outside of it.
21
+ * Which user actions close the modal. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog#closedby).
22
+ * - `"any"`: outside click, close requests (e.g. Escape) and programmatic close.
23
+ * - `"closerequest"`: close requests and programmatic close.
24
+ * - `"none"`: programmatic close only.
22
25
  *
23
- * @default true
26
+ * @default "any"
24
27
  */
25
- closeOnOutsideClick?: boolean;
28
+ closedby?: BaseProps["closedby"];
26
29
  /**
27
30
  * Content of the modal.
28
31
  *
@@ -0,0 +1,9 @@
1
+ import type { Attachment } from "svelte/attachments";
2
+ import type { HTMLDialogAttributes } from "svelte/elements";
3
+ /**
4
+ * Emulates the `closedby` attribute on dialogs in browsers that don't support it.
5
+ *
6
+ * Webkit doesn't support `closedby` attribute on dialog elements (https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/closedBy).
7
+ * TODO(closedby): Remove this fallback when Webkit supports it.
8
+ */
9
+ export declare function closedByFallbackAttachment(closedby: HTMLDialogAttributes["closedby"]): Attachment<HTMLDialogElement>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Emulates the `closedby` attribute on dialogs in browsers that don't support it.
3
+ *
4
+ * Webkit doesn't support `closedby` attribute on dialog elements (https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/closedBy).
5
+ * TODO(closedby): Remove this fallback when Webkit supports it.
6
+ */
7
+ export function closedByFallbackAttachment(closedby) {
8
+ return (dialogEl) => {
9
+ if ("closedBy" in HTMLDialogElement.prototype)
10
+ return;
11
+ // Backdrop hits target the dialog itself but land outside its border box.
12
+ const isOnBackdrop = (e) => {
13
+ if (e.target !== dialogEl)
14
+ return false;
15
+ const rect = dialogEl.getBoundingClientRect();
16
+ return (e.clientX < rect.left ||
17
+ e.clientX > rect.right ||
18
+ e.clientY < rect.top ||
19
+ e.clientY > rect.bottom);
20
+ };
21
+ let isPointerDownOnBackdrop = false;
22
+ const controller = new AbortController();
23
+ const { signal } = controller;
24
+ // Listen on the document so presses outside the dialog also reset the flag.
25
+ document.addEventListener("pointerdown", (e) => {
26
+ isPointerDownOnBackdrop = isOnBackdrop(e);
27
+ }, { capture: true, signal });
28
+ dialogEl.addEventListener("pointerup", (e) => {
29
+ const isLightDismiss = closedby === "any" && isPointerDownOnBackdrop && isOnBackdrop(e);
30
+ isPointerDownOnBackdrop = false;
31
+ // Light dismiss is a close request, so it fires a cancelable `cancel` first.
32
+ if (isLightDismiss &&
33
+ dialogEl.dispatchEvent(new Event("cancel", { cancelable: true }))) {
34
+ dialogEl.close();
35
+ }
36
+ }, { signal });
37
+ // Natively, `closedby="none"` doesn't fire `cancel` at all.
38
+ dialogEl.addEventListener("cancel", (e) => {
39
+ if (closedby !== "none")
40
+ return;
41
+ e.preventDefault();
42
+ e.stopImmediatePropagation();
43
+ }, { capture: true, signal });
44
+ return () => controller.abort();
45
+ };
46
+ }
@@ -0,0 +1 @@
1
+ export * from "./closedByFallbackAttachment.js";
@@ -0,0 +1 @@
1
+ export * from "./closedByFallbackAttachment.js";
@@ -17,7 +17,7 @@
17
17
  );
18
18
  --color-border-input: var(--modifier-color-border, var(--color-border));
19
19
  --color-outline-input: var(
20
- --modifier-color-focusRing,
20
+ --modifier-color-focus-ring,
21
21
  var(--color-focusRing)
22
22
  );
23
23
  }
@@ -4,7 +4,6 @@
4
4
  appearance: none;
5
5
  flex-grow: 0;
6
6
  flex-shrink: 0;
7
- outline-offset: 1px;
8
7
 
9
8
  width: var(--dimension-200);
10
9
  height: var(--dimension-200);
@@ -12,8 +12,9 @@
12
12
  ref = $bindable(),
13
13
  value = $bindable(),
14
14
  children,
15
- severity,
15
+ criticality,
16
16
  density,
17
+ importance,
17
18
  "data-testid": dataTestId,
18
19
  ...rest
19
20
  }: SelectProps = $props();
@@ -26,7 +27,7 @@
26
27
  - alternatively, anchor positioning support is widespread enough to position the chevron icon without needing a wrapper element.
27
28
  -->
28
29
  <div
29
- class={[componentCssClassName, className, severity, density]}
30
+ class={[componentCssClassName, className, criticality, density, importance]}
30
31
  data-testid={dataTestId}
31
32
  >
32
33
  <select bind:value bind:this={ref} {...rest}>
@@ -1,34 +1,32 @@
1
1
  .ds.select {
2
2
  --color-background-select-input-hover: var(
3
- --lp-color-background-secondary-hover-context,
4
- var(--lp-color-background-hover)
3
+ --hover--color-foreground-input,
4
+ var(--color-foreground-input-hover)
5
5
  );
6
6
  --color-background-select-input-active: var(
7
- --lp-color-background-secondary-active-context,
8
- var(--lp-color-background-active)
7
+ --active--color-foreground-input,
8
+ var(--color-foreground-input-active)
9
9
  );
10
10
  --color-background-select-input: var(
11
- --lp-color-background-secondary-context,
12
- var(--lp-color-background-input)
13
- );
14
- --dimension-padding-inline-select-input: var(
15
- --lp-dimension-spacing-inline-xs
11
+ --modifier-color-foreground-input,
12
+ var(--color-foreground-input)
16
13
  );
14
+ --dimension-padding-inline-select-input: var(--dimension-100);
17
15
  --dimension-padding-block-select-input: var(
18
- --lp-dimension-padding-block-context,
19
- var(--lp-dimension-spacing-block-xxs)
16
+ --density-padding-block,
17
+ var(--dimension-050)
20
18
  );
21
19
  --color-border-select-input: var(
22
- --lp-color-border-secondary-context,
23
- var(--lp-color-border-high-contrast)
20
+ --modifier-color-border,
21
+ var(--color-border)
24
22
  );
25
23
  --color-outline-select-input: var(
26
- --lp-color-border-secondary-context,
27
- var(--lp-color-border-focus)
24
+ --modifier-color-focus-ring,
25
+ var(--color-focusRing)
28
26
  );
29
27
 
30
- color: var(--lp-color-text-default);
31
- font: var(--lp-typography-paragraph-default);
28
+ color: var(--color-text);
29
+ font: var(--ds-typography-text-primary);
32
30
 
33
31
  display: inline-grid;
34
32
  align-items: center;
@@ -55,19 +53,19 @@
55
53
  /* Padding + gap + icon size */
56
54
  padding-inline-end: calc(
57
55
  var(--dimension-padding-inline-select-input) +
58
- var(--lp-dimension-spacing-inline-xxxs) +
56
+ var(--dimension-025) +
59
57
  1em
60
58
  );
61
59
  padding-block: var(--dimension-padding-block-select-input);
62
- border-block-end: var(--lp-dimension-stroke-thickness-default) solid
60
+ border-block-end: var(--dimension-stroke-thickness-medium) solid
63
61
  var(--color-border-select-input);
64
62
  background-color: var(--color-background-select-input);
65
63
  outline-color: var(--color-outline-select-input);
66
- border-radius: var(--lp-dimension-radius-none);
64
+ border-radius: var(--dimension-radius-none);
67
65
 
68
- transition-duration: var(--lp-transition-duration-snap);
66
+ transition-duration: var(--ds-transition-duration-snap);
69
67
  transition-property: background-color, border-color, outline-color;
70
- transition-timing-function: var(--lp-transition-timing-ease-in);
68
+ transition-timing-function: var(--ds-transition-timing-ease-in);
71
69
 
72
70
  &:not(:disabled) {
73
71
  &:hover {
@@ -82,46 +80,33 @@
82
80
 
83
81
  &:disabled {
84
82
  cursor: not-allowed;
85
- opacity: var(--lp-opacity-muted);
86
-
87
- + .chevron {
88
- opacity: var(--lp-opacity-muted);
89
- }
83
+ color: var(--disabled--color-text);
84
+ background-color: var(
85
+ --disabled--color-foreground-input,
86
+ var(--color-foreground-input-disabled)
87
+ );
88
+ border-color: var(--color-border-disabled);
90
89
  }
91
90
 
92
91
  &:user-invalid,
93
92
  &[aria-invalid="true"] {
94
- --color-background-select-input: var(
95
- --lp-color-background-negative-default
96
- );
97
- border-color: var(--lp-color-border-negative);
98
- outline-color: var(--lp-color-border-negative);
93
+ --color-background-select-input: var(--color-foreground-input-error);
94
+ border-color: var(--color-border-error);
95
+ outline-color: var(--color-focusRing-error);
99
96
 
100
97
  &:hover {
101
- background-color: var(--lp-color-background-negative-hover);
98
+ background-color: var(--color-foreground-input-error-hover);
102
99
  }
103
100
 
104
101
  &:active,
105
102
  &:focus {
106
- background-color: var(--lp-color-background-negative-active);
103
+ background-color: var(--color-foreground-input-error-active);
107
104
  }
108
105
  }
109
106
 
110
107
  &:not([multiple]) {
111
108
  option {
112
- /*
113
- FIXME(steciuk): The colors currently used for the select background have some baked-in transparency.
114
- This doesn't play well with how the select element is rendered in Chrome, making the options looked washed out and with very low contrast. This is a temporary workaround that aims to strip the transparency from the color while keeping similar visuals.
115
-
116
- A better solution would be to update the design tokens to use solid colors, but the currently tokens and modifiers system are soon to be replaced anyway, so it might not be worth the effort.
117
- */
118
- background-color: var(--lp-color-background-default);
119
- /* biome-ignore lint/suspicious/noDuplicateProperties: Fallback for older chrome versions */
120
- background-color: color-mix(
121
- in srgb,
122
- rgb(from var(--color-background-select-input) r g b / 1) 20%,
123
- var(--lp-color-background-default) 80%
124
- );
109
+ background-color: var(--color-foreground-ghost);
125
110
  }
126
111
  }
127
112
 
@@ -139,22 +124,17 @@
139
124
  }
140
125
  }
141
126
 
142
- &.base {
143
- --color-background-select-input-hover: var(
144
- --lp-color-background-neutral-hover
145
- );
146
- --color-background-select-input-active: var(
147
- --lp-color-background-neutral-active
148
- );
149
- --color-background-select-input: transparent;
127
+ &.tertiary {
128
+ --color-background-select-input-hover: var(--modifier-surface-hover);
129
+ --color-background-select-input-active: var(--modifier-surface-active);
130
+ --color-background-select-input: var(--modifier-surface);
150
131
 
151
132
  > select {
152
133
  border: none;
153
134
 
154
135
  &:not([multiple]) {
155
136
  option {
156
- /* FIXME(steciuk): Pt. 2 of the transparency workaround */
157
- background-color: var(--lp-color-background-default);
137
+ background-color: var(--color-foreground-ghost);
158
138
  }
159
139
  }
160
140
  }
@@ -3,5 +3,6 @@ import type { ModifierFamilyValues } from "../../modifier-families/index.js";
3
3
  export interface SelectProps extends HTMLSelectAttributes {
4
4
  ref?: HTMLSelectElement;
5
5
  density?: Extract<ModifierFamilyValues["density"], "comfortable" | "dense">;
6
- severity?: ModifierFamilyValues["severity"] | "base";
6
+ criticality?: ModifierFamilyValues["criticality"];
7
+ importance?: Extract<ModifierFamilyValues["importance"], "tertiary">;
7
8
  }
@@ -2,7 +2,6 @@
2
2
  appearance: none;
3
3
  position: relative;
4
4
  cursor: pointer;
5
- outline-offset: 0;
6
5
 
7
6
  width: var(--dimension-400);
8
7
  height: var(--dimension-200);
@@ -17,7 +17,7 @@
17
17
  );
18
18
  --color-border-input: var(--modifier-color-border, var(--color-border));
19
19
  --color-outline-input: var(
20
- --modifier-color-focusRing,
20
+ --modifier-color-focus-ring,
21
21
  var(--color-focusRing)
22
22
  );
23
23
  }
package/dist/index.css CHANGED
@@ -2,4 +2,3 @@
2
2
  @import "./styles/ds-tokens.css";
3
3
  @import "./styles/ds-shim.css";
4
4
  @import "./styles/index.css";
5
- @import "./modifier-families/styles/index.css";
@@ -3,6 +3,5 @@ export declare const MODIFIER_FAMILIES: {
3
3
  readonly anticipation: readonly ["constructive", "destructive", "caution"];
4
4
  readonly importance: readonly ["primary", "secondary", "tertiary"];
5
5
  readonly emphasis: readonly ["muted", "branded"];
6
- readonly severity: readonly ["neutral", "positive", "negative", "caution", "information"];
7
6
  readonly density: readonly ["dense", "compact", "comfortable"];
8
7
  };
@@ -3,8 +3,6 @@ export const MODIFIER_FAMILIES = {
3
3
  anticipation: ["constructive", "destructive", "caution"],
4
4
  importance: ["primary", "secondary", "tertiary"],
5
5
  emphasis: ["muted", "branded"],
6
- // TODO: old modifier family. Remove severity after its no longer used
7
- severity: ["neutral", "positive", "negative", "caution", "information"],
8
6
  // compact is launchpad-only; the global density family is comfortable/dense
9
7
  density: ["dense", "compact", "comfortable"],
10
8
  };
@@ -8,16 +8,16 @@ export type ModifierFamilyValues = {
8
8
  *
9
9
  * @example
10
10
  * ```ts
11
- * type Severity = ModifierFamily<'severity'>;
11
+ * type Severity = ModifierFamily<'criticality'>;
12
12
  * // =>
13
13
  * type Severity = {
14
- * severity: 'neutral' | 'positive' | 'negative' | 'caution' | 'information'
14
+ * criticality: 'success' | 'error' | 'warning' | 'information'
15
15
  * }
16
16
  *
17
- * type Modifiers = ModifierFamily<['severity', 'emphasis']>;
17
+ * type Modifiers = ModifierFamily<['criticality', 'emphasis']>;
18
18
  * // =>
19
19
  * type Modifiers = {
20
- * severity: 'neutral' | 'positive' | 'negative' | 'caution' | 'information'
20
+ * criticality: 'success' | 'error' | 'warning' | 'information'
21
21
  * emphasis: 'neutral' | 'highlighted' | 'muted' | 'accented'
22
22
  * }
23
23
  * ```
@@ -2,6 +2,7 @@
2
2
  --ds-transition-duration-fast: 165ms;
3
3
  --ds-transition-duration-brisk: 333ms;
4
4
  --ds-transition-duration-snap: 100ms;
5
+ --ds-transition-duration-slow: 0.4s;
5
6
  --ds-transition-duration-sleepy: 1s;
6
7
  --ds-transition-timing-ease-in: cubic-bezier(0.55, 0.055, 0.675, 0.19);
7
8
  --ds-transition-timing-ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
@@ -44,6 +45,21 @@
44
45
  var(--typography-text-tertiary-bold-font-size) /
45
46
  var(--typography-text-tertiary-bold-line-height)
46
47
  var(--typography-text-tertiary-bold-font-family);
48
+ --ds-typography-heading-1:
49
+ var(--typography-heading-1-font-weight)
50
+ var(--typography-heading-1-font-size) /
51
+ var(--typography-heading-1-line-height)
52
+ var(--typography-heading-1-font-family);
53
+ --ds-typography-heading-2:
54
+ var(--typography-heading-2-font-weight)
55
+ var(--typography-heading-2-font-size) /
56
+ var(--typography-heading-2-line-height)
57
+ var(--typography-heading-2-font-family);
58
+ --ds-typography-heading-3:
59
+ var(--typography-heading-3-font-weight)
60
+ var(--typography-heading-3-font-size) /
61
+ var(--typography-heading-3-line-height)
62
+ var(--typography-heading-3-font-family);
47
63
  --ds-typography-heading-4:
48
64
  var(--typography-heading-4-font-weight)
49
65
  var(--typography-heading-4-font-size) /
@@ -54,6 +70,11 @@
54
70
  var(--typography-heading-5-font-size) /
55
71
  var(--typography-heading-5-line-height)
56
72
  var(--typography-heading-5-font-family);
73
+ --ds-typography-heading-6:
74
+ var(--typography-heading-6-font-weight)
75
+ var(--typography-heading-6-font-size) /
76
+ var(--typography-heading-6-line-height)
77
+ var(--typography-heading-6-font-family);
57
78
  }
58
79
 
59
80
  @layer ds.modifiers {
@@ -66,48 +87,6 @@
66
87
  }
67
88
  }
68
89
 
69
- /* The criticality modifier exposes every color channel except the solid fill
70
- * and the on-surface text pairing, so a component painting a solid criticality
71
- * surface has nothing to read.
72
- * Upstream fix: https://github.com/canonical/design-tokens/pull/104
73
- * Delete each line once its channel is generated upstream and the
74
- * design-tokens pin is bumped. */
75
- @layer ds.modifiers {
76
- .success {
77
- --modifier-color-foreground-primary: var(
78
- --color-foreground-primary-success
79
- );
80
- --modifier-color-text-onForegroundSecondary: var(
81
- --color-text-onForegroundSecondary-success
82
- );
83
- }
84
-
85
- .error {
86
- --modifier-color-foreground-primary: var(--color-foreground-primary-error);
87
- --modifier-color-text-onForegroundSecondary: var(
88
- --color-text-onForegroundSecondary-error
89
- );
90
- }
91
-
92
- .warning {
93
- --modifier-color-foreground-primary: var(
94
- --color-foreground-primary-warning
95
- );
96
- --modifier-color-text-onForegroundSecondary: var(
97
- --color-text-onForegroundSecondary-warning
98
- );
99
- }
100
-
101
- .information {
102
- --modifier-color-foreground-primary: var(
103
- --color-foreground-primary-information
104
- );
105
- --modifier-color-text-onForegroundSecondary: var(
106
- --color-text-onForegroundSecondary-information
107
- );
108
- }
109
- }
110
-
111
90
  @media (prefers-reduced-motion: reduce) {
112
91
  :root {
113
92
  --ds-transition-duration-fast: 0ms;
@@ -2,32 +2,18 @@
2
2
  @import "./font-faces.css";
3
3
 
4
4
  html {
5
- color: var(--lp-color-text-default);
6
- background-color: var(--lp-color-background-default);
7
-
8
- /*
9
- TODO: Should the color be controlled on the level of modifiers (severity)? If so, how?
10
- Outline colors, according to vanilla should:
11
- - on `Chip` stay default no matter the modifier,
12
- - OK, we just don't subscribe to the context at all;
13
- - on `TextInput` follow the values of the secondary context,
14
- - OK, we subscribe to the secondary context;
15
- - on `Button` stay default for all severities but `positive`, where it should become a very dark green,
16
- - not OK, we don't have the required value in the severity context.
17
- */
18
- --focus-outline: var(--lp-dimension-stroke-thickness-large) solid
19
- var(--lp-color-border-focus);
20
- /* Most elements have the outline on the inside of the element. Needs to be adjusted for specific cases (e.g. checkbox, radio) */
21
- --focus-outline-offset: calc(var(--lp-dimension-stroke-thickness-large) * -1);
5
+ color: var(--color-text);
6
+ background-color: var(--color-background);
22
7
  }
23
8
 
24
9
  body {
25
- font: var(--lp-typography-paragraph-s);
10
+ font: var(--ds-typography-text-primary);
26
11
  }
27
12
 
28
13
  *:focus-visible {
29
- outline: var(--focus-outline);
30
- outline-offset: var(--focus-outline-offset);
14
+ outline: var(--dimension-stroke-thickness-large) solid
15
+ var(--modifier-color-focus-ring, var(--color-focusRing));
16
+ outline-offset: var(--dimension-stroke-thickness-large);
31
17
  }
32
18
 
33
19
  .visually-hidden {
@@ -51,20 +37,20 @@ body {
51
37
  }
52
38
 
53
39
  h1 {
54
- font: var(--lp-typography-h1);
40
+ font: var(--ds-typography-heading-1);
55
41
  }
56
42
  h2 {
57
- font: var(--lp-typography-h2);
43
+ font: var(--ds-typography-heading-2);
58
44
  }
59
45
  h3 {
60
- font: var(--lp-typography-h3);
46
+ font: var(--ds-typography-heading-3);
61
47
  }
62
48
  h4 {
63
- font: var(--lp-typography-h4);
49
+ font: var(--ds-typography-heading-4);
64
50
  }
65
51
  h5 {
66
- font: var(--lp-typography-h5);
52
+ font: var(--ds-typography-heading-5);
67
53
  }
68
54
  h6 {
69
- font: var(--lp-typography-h6);
55
+ font: var(--ds-typography-heading-6);
70
56
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/svelte-ds-app-launchpad",
3
3
  "description": "Launchpad-specific components for the Pragma design system.",
4
- "version": "0.42.0",
4
+ "version": "0.44.0",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -30,13 +30,13 @@
30
30
  },
31
31
  "repository": {
32
32
  "type": "git",
33
- "url": "https://github.com/canonical/pragma"
33
+ "url": "https://github.com/canonical/pragma-web"
34
34
  },
35
35
  "license": "LGPL-3.0",
36
36
  "bugs": {
37
- "url": "https://github.com/canonical/pragma/issues"
37
+ "url": "https://github.com/canonical/pragma-web/issues"
38
38
  },
39
- "homepage": "https://github.com/canonical/pragma/tree/main/packages/svelte/ds-app-launchpad#readme",
39
+ "homepage": "https://github.com/canonical/pragma-web/tree/main/packages/svelte/ds-app-launchpad#readme",
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
@@ -63,36 +63,35 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@biomejs/biome": "2.5.14",
66
- "@canonical/biome-config": "^0.42.0",
67
- "@canonical/design-tokens": "0.10.0",
68
- "@canonical/storybook-config": "^0.42.0",
69
- "@canonical/storybook-helpers": "^0.42.0",
70
- "@canonical/svelte-ssr-test": "^0.42.0",
71
- "@canonical/typescript-config-svelte": "^0.42.0",
72
- "@canonical/webarchitect": "^0.42.0",
66
+ "@canonical/biome-config": "0.43.0",
67
+ "@canonical/storybook-config": "^0.44.0",
68
+ "@canonical/storybook-helpers": "^0.44.0",
69
+ "@canonical/svelte-ssr-test": "^0.44.0",
70
+ "@canonical/typescript-config-svelte": "^0.44.0",
71
+ "@canonical/webarchitect": "0.43.0",
73
72
  "@storybook/addon-docs": "^10.6.0",
74
73
  "@storybook/addon-svelte-csf": "^5.1.3",
75
74
  "@sveltejs/package": "3.0.0-next.8",
76
75
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
77
76
  "@types/bun": "^1.3.10",
78
- "@vitest/browser": "^4.0.18",
79
- "@vitest/browser-playwright": "^4.0.18",
77
+ "@vitest/browser": "^5.0.0",
78
+ "@vitest/browser-playwright": "^5.0.0",
80
79
  "playwright": "^1.61.1",
81
80
  "storybook": "^10.6.0",
82
81
  "svelte-check": "^4.4.5",
83
82
  "typescript": "~6.0.3",
84
83
  "vite": "^8.0.0",
85
- "vitest": "^4.0.18",
86
- "vitest-browser-svelte": "^2.0.2"
84
+ "vitest": "^5.0.0",
85
+ "vitest-browser-svelte": "^3.0.0"
87
86
  },
88
87
  "dependencies": {
89
- "@canonical/launchpad-design-tokens": "^1.1.1",
90
- "@canonical/styles": "^0.42.0",
88
+ "@canonical/design-tokens": "0.43.0",
89
+ "@canonical/styles": "^0.44.0",
91
90
  "@canonical/svelte-icons": "^0.0.9",
92
91
  "@floating-ui/dom": "^1.7.6"
93
92
  },
94
93
  "peerDependencies": {
95
94
  "svelte": "^5.47.1"
96
95
  },
97
- "gitHead": "75c2b17029ba899be3fa645be28290ac6fcb83a9"
96
+ "gitHead": "c1f2abc7f04aa29a88f0e6036645469e82a5dd33"
98
97
  }
@@ -1,14 +0,0 @@
1
- .dense {
2
- --lp-dimension-padding-block-context: var(
3
- --lp-dimension-spacing-block-minimum
4
- );
5
- --lp-dimension-padding-inline-context: var(--lp-dimension-spacing-inline-s);
6
- }
7
-
8
- .compact {
9
- --lp-dimension-padding-block-context: var(
10
- --lp-dimension-spacing-block-minimum
11
- );
12
- --lp-dimension-padding-inline-context: var(--lp-dimension-spacing-inline-xs);
13
- --lp-typography-context: var(--lp-typography-paragraph-s);
14
- }
@@ -1,2 +0,0 @@
1
- @import "./density.css";
2
- @import "./severity.css";
@@ -1,87 +0,0 @@
1
- .positive {
2
- --lp-color-border-context: var(--lp-color-fill-positive-default);
3
- --lp-color-border-hover-context: var(--lp-color-fill-positive-hover);
4
- --lp-color-border-active-context: var(--lp-color-fill-positive-active);
5
- --lp-color-text-context: var(--lp-color-text-white);
6
- --lp-color-background-context: var(--lp-color-fill-positive-default);
7
- --lp-color-background-hover-context: var(--lp-color-fill-positive-hover);
8
- --lp-color-background-active-context: var(--lp-color-fill-positive-active);
9
-
10
- --lp-color-border-secondary-context: var(--lp-color-border-positive);
11
- --lp-color-text-secondary-context: var(--lp-color-text-default);
12
- --lp-color-background-secondary-context: var(
13
- --lp-color-background-positive-default
14
- );
15
- --lp-color-background-secondary-hover-context: var(
16
- --lp-color-background-positive-hover
17
- );
18
- --lp-color-background-secondary-active-context: var(
19
- --lp-color-background-positive-active
20
- );
21
- }
22
-
23
- .negative {
24
- --lp-color-border-context: var(--lp-color-fill-negative-default);
25
- --lp-color-border-hover-context: var(--lp-color-fill-negative-hover);
26
- --lp-color-border-active-context: var(--lp-color-fill-negative-active);
27
- --lp-color-text-context: var(--lp-color-text-white);
28
- --lp-color-background-context: var(--lp-color-fill-negative-default);
29
- --lp-color-background-hover-context: var(--lp-color-fill-negative-hover);
30
- --lp-color-background-active-context: var(--lp-color-fill-negative-active);
31
-
32
- --lp-color-border-secondary-context: var(--lp-color-border-negative);
33
- --lp-color-text-secondary-context: var(--lp-color-text-default);
34
- --lp-color-background-secondary-context: var(
35
- --lp-color-background-negative-default
36
- );
37
- --lp-color-background-secondary-hover-context: var(
38
- --lp-color-background-negative-hover
39
- );
40
- --lp-color-background-secondary-active-context: var(
41
- --lp-color-background-negative-active
42
- );
43
- }
44
-
45
- .caution {
46
- --lp-color-border-context: var(--lp-color-status-caution);
47
- --lp-color-border-hover-context: var(--lp-color-status-caution);
48
- --lp-color-border-active-context: var(--lp-color-status-caution);
49
- --lp-color-text-context: var(--lp-color-text-white);
50
- --lp-color-background-context: var(--lp-color-status-caution);
51
- --lp-color-background-hover-context: var(--lp-color-status-caution);
52
- --lp-color-background-active-context: var(--lp-color-status-caution);
53
-
54
- --lp-color-border-secondary-context: var(--lp-color-border-caution);
55
- --lp-color-text-secondary-context: var(--lp-color-text-default);
56
- --lp-color-background-secondary-context: var(
57
- --lp-color-background-caution-default
58
- );
59
- --lp-color-background-secondary-hover-context: var(
60
- --lp-color-background-caution-hover
61
- );
62
- --lp-color-background-secondary-active-context: var(
63
- --lp-color-background-caution-active
64
- );
65
- }
66
-
67
- .information {
68
- --lp-color-border-context: var(--lp-color-status-information);
69
- --lp-color-border-hover-context: var(--lp-color-status-information);
70
- --lp-color-border-active-context: var(--lp-color-status-information);
71
- --lp-color-text-context: var(--lp-color-text-white);
72
- --lp-color-background-context: var(--lp-color-status-information);
73
- --lp-color-background-hover-context: var(--lp-color-status-information);
74
- --lp-color-background-active-context: var(--lp-color-status-information);
75
-
76
- --lp-color-border-secondary-context: var(--lp-color-border-information);
77
- --lp-color-text-secondary-context: var(--lp-color-text-default);
78
- --lp-color-background-secondary-context: var(
79
- --lp-color-background-information-default
80
- );
81
- --lp-color-background-secondary-hover-context: var(
82
- --lp-color-background-information-hover
83
- );
84
- --lp-color-background-secondary-active-context: var(
85
- --lp-color-background-information-active
86
- );
87
- }