Skip to content

Commit 7be0d30

Browse files
Conformance pass.
\# What \# Why \# How \# Designs \# Test Steps \# Other Notes
1 parent 56ee6b4 commit 7be0d30

File tree

8 files changed

+56
-43
lines changed

8 files changed

+56
-43
lines changed

src/ak-brand/ak-brand.builder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import type { ElementRest } from "../types.js";
12
import { Brand } from "./ak-brand.component.js";
23

34
import { spread } from "@open-wc/lit-helpers";
45

56
import { html } from "lit";
67
import { ifDefined } from "lit/directives/if-defined.js";
78

8-
export type BrandProps = Partial<HTMLElement> & Partial<Pick<Brand, "src" | "alt">>;
9+
export type BrandProps = ElementRest & Partial<Pick<Brand, "src" | "alt">>;
910

1011
/**
1112
* @summary Helper function to create a Brand component programmatically

src/ak-divider/ak-divider.builder.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import type { ElementRest } from "../types.js";
12
import { type DividerOrientation, type DividerVariant } from "./ak-divider.component.js";
23

4+
import { spread } from "@open-wc/lit-helpers";
5+
36
import { html, TemplateResult } from "lit";
47
import { ifDefined } from "lit/directives/if-defined.js";
58

6-
export type DividerProps = {
9+
export type DividerProps = ElementRest & {
710
variant?: DividerVariant;
811
orientation?: DividerOrientation;
912
content?: string | TemplateResult;
@@ -17,13 +20,16 @@ export type DividerProps = {
1720
* @see {@link Divider} - The underlying web component
1821
*/
1922
export function akDivider(options: DividerProps = {}) {
20-
const { variant, orientation, content } = options;
23+
const { variant, orientation, content, ...rest } = options;
2124

2225
// Handle string content by wrapping in a span
2326
const message = typeof content === "string" ? html`<span>${content.trim()}</span>` : content;
2427

2528
return html`
26-
<ak-divider variant=${ifDefined(variant)} orientation=${ifDefined(orientation)}
29+
<ak-divider
30+
${spread(rest)}
31+
variant=${ifDefined(variant)}
32+
orientation=${ifDefined(orientation)}
2733
>${message}</ak-divider
2834
>
2935
`;

src/ak-empty-state/ak-empty-state.builder.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import "./ak-empty-state.component.js";
22

3+
import type { ElementRest } from "../types.js";
34
import { EmptyState } from "./ak-empty-state.component.js";
45

6+
import { spread } from "@open-wc/lit-helpers";
57
import { match, P } from "ts-pattern";
68

79
import { html, TemplateResult } from "lit";
@@ -18,9 +20,8 @@ export interface EmptyStateSlots {
1820
secondaryActions?: string | TemplateResult;
1921
}
2022

21-
export type EmptyStateProps = Partial<
22-
Pick<EmptyState, "size" | "loading" | "textOnly" | "spinnerOnly">
23-
> &
23+
export type EmptyStateProps = ElementRest &
24+
Partial<Pick<EmptyState, "size" | "loading" | "textOnly" | "spinnerOnly">> &
2425
EmptyStateSlots & { fullHeight?: boolean };
2526

2627
const SLOTNAMES: (keyof EmptyStateSlots)[] = [
@@ -46,7 +47,7 @@ type SlotContent = string | TemplateResult | undefined;
4647
*
4748
* @see {@link EmptyState} - The underlying web component
4849
*/
49-
export function akEmptyState(options: EmptyStateProps) {
50+
export function akEmptyState(options: EmptyStateProps = {}) {
5051
const slots = SLOTNAMES.filter((s) => !!options[s]);
5152

5253
const slotRenderer = (s: string, c: string | TemplateResult) => html`<div slot=${s}>${c}</div>`;
@@ -68,10 +69,11 @@ export function akEmptyState(options: EmptyStateProps) {
6869
...Object.fromEntries(slots.map((s) => [s, slotHandler(s)])),
6970
};
7071

71-
const { size, fullHeight, spinnerOnly, textOnly, loading } = opts;
72+
const { size, fullHeight, spinnerOnly, textOnly, loading, ...rest } = opts;
7273

7374
return html`
7475
<ak-empty-state
76+
${spread(rest)}
7577
?loading=${loading}
7678
?full-height=${fullHeight}
7779
?text-only=${textOnly}

src/ak-progress/ak-progress.builder.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
import "./ak-progress.component.js";
22

3+
import type { ElementRest } from "../types.js";
34
import { Progress, ProgressBarSize } from "./ak-progress.component.js";
45

6+
import { spread } from "@open-wc/lit-helpers";
7+
58
import { html, nothing, TemplateResult } from "lit";
69
import { ifDefined } from "lit/directives/if-defined.js";
710

811
/* The `pick`ed fields here correspond to their types in the Progress class above. */
912

10-
export interface ProgressProps extends Partial<
11-
Pick<
12-
Progress,
13-
"variant" | "severity" | "min" | "max" | "value" | "showIcon" | "oneWay" | "displayValue"
14-
>
15-
> {
16-
size?: ProgressBarSize;
17-
label?: string | TemplateResult;
18-
icon?: string | TemplateResult;
19-
}
13+
export type ProgressProps = ElementRest &
14+
Partial<
15+
Pick<
16+
Progress,
17+
| "variant"
18+
| "severity"
19+
| "min"
20+
| "max"
21+
| "value"
22+
| "showIcon"
23+
| "oneWay"
24+
| "displayValue"
25+
>
26+
> & {
27+
size?: ProgressBarSize;
28+
label?: string | TemplateResult;
29+
icon?: string | TemplateResult;
30+
};
2031

2132
/**
2233
* @summary Helper function to create a Progress component programmatically
@@ -38,10 +49,12 @@ export function akProgress(options: ProgressProps) {
3849
displayValue,
3950
label,
4051
icon,
52+
...rest
4153
} = options;
4254

4355
return html`
4456
<ak-progress
57+
${spread(rest)}
4558
variant=${ifDefined(variant)}
4659
size=${ifDefined(size)}
4760
severity=${ifDefined(severity)}

src/ak-progress/ak-progress.component.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,12 @@ import { styleMap } from "lit/directives/style-map.js";
1212
export const progressBarVariants = ["none", "top", "inside", "outside", "indeterminate"] as const;
1313
export type ProgressBarVariant = (typeof progressBarVariants)[number];
1414

15-
export const progressBarSize = ["xs", "sm", "lg"] as const;
15+
export const progressBarSize = ["xs", "sm", "md", "lg"] as const;
1616
export type ProgressBarSize = (typeof progressBarSize)[number];
1717

1818
export const progressBarSeverity = ["success", "danger", "warning"] as const;
1919
export type ProgressBarSeverity = (typeof progressBarSeverity)[number];
2020

21-
export interface IProgress {
22-
variant?: ProgressBarVariant;
23-
_size?: ProgressBarSize;
24-
severity?: ProgressBarSeverity;
25-
min?: number;
26-
max?: number;
27-
value?: number;
28-
showIcon?: boolean;
29-
oneWay?: boolean;
30-
displayValue?: (_: number) => string;
31-
}
32-
3321
const SEVERITY_ICONS = new Map<ProgressBarSeverity, string>([
3422
["danger", "fa-times"],
3523
["warning", "fa-exclamation-triangle"],
@@ -88,10 +76,10 @@ const SEVERITY_ICONS = new Map<ProgressBarSeverity, string>([
8876
* @cssprop --ak-v1-c-progress--m-xs__bar--Height - Height for xs size variant
8977
* @cssprop --ak-v1-c-progress--m-indeterminate--GridGap - Collapsed gap size for indeterminate variant
9078
*/
91-
export class Progress extends AkLitElement implements IProgress {
79+
export class Progress extends AkLitElement {
9280
static readonly styles = [styles, indeterminateAnimation];
9381

94-
@property({ type: String })
82+
@property({ type: String, reflect: true })
9583
public variant: ProgressBarVariant = "top";
9684

9785
@property({ reflect: true })

src/ak-progress/ak-progress.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const meta: Meta<Progress> = {
2727
options: ["none", "top", "inside", "outside"],
2828
description: "Position of the progress value display",
2929
},
30-
_size: {
30+
size: {
3131
control: { type: "select" },
3232
options: ["sm", "lg"],
3333
description: "Size variant of the progress bar",
@@ -566,7 +566,7 @@ export const BuilderCustomFormatting: Story = {
566566
value: 387,
567567
displayValue: (value: number) => `${value} MB / 500 MB`,
568568
label: "Memory usage",
569-
severity: (value) => (value > 400 ? "danger" : value > 300 ? "warning" : undefined),
569+
severity: "warning",
570570
})}
571571
${akProgress({
572572
min: -10,

src/ak-progress/ak-progress.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { akProgress, type ProgressProps } from "./ak-progress.builder.js";
22
import {
3-
type IProgress,
43
Progress,
54
type ProgressBarSeverity,
65
type ProgressBarSize,
@@ -9,7 +8,6 @@ import {
98

109
export {
1110
akProgress,
12-
type IProgress,
1311
Progress,
1412
type ProgressBarSeverity,
1513
type ProgressBarSize,

src/ak-spinner/ak-spinner.builder.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import "./ak-spinner.js";
22

3+
import type { ElementRest } from "../types.js";
34
import { type Spinner, type SpinnerSize } from "./ak-spinner.component.js";
45

6+
import { spread } from "@open-wc/lit-helpers";
7+
58
import { html } from "lit";
69
import { ifDefined } from "lit/directives/if-defined.js";
710

8-
export type SpinnerProps = Partial<Pick<Spinner, "label">> & {
9-
inline?: boolean;
10-
size?: SpinnerSize;
11-
};
11+
export type SpinnerProps = ElementRest &
12+
Partial<Pick<Spinner, "label">> & {
13+
inline?: boolean;
14+
size?: SpinnerSize;
15+
};
1216

1317
/**
1418
* @summary Helper function to create a Spinner component programmatically
@@ -18,9 +22,10 @@ export type SpinnerProps = Partial<Pick<Spinner, "label">> & {
1822
* @see {@link Spinner} - The underlying web component
1923
*/
2024
export function akSpinner(options: SpinnerProps = { inline: false }) {
21-
const { size, label, inline } = options;
25+
const { size, label, inline, ...rest } = options;
2226

2327
return html`<ak-spinner
28+
${spread(rest)}
2429
size=${ifDefined(size)}
2530
label=${ifDefined(label)}
2631
?inline=${!!inline}

0 commit comments

Comments
 (0)