dap-design-system 0.51.0 → 0.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/components/avatar/avatar.component.d.ts +0 -1
  2. package/dist/components/datatable/helpers/angular.d.ts +125 -0
  3. package/dist/components/datatable/helpers/index.d.ts +4 -0
  4. package/dist/components/datatable/helpers/svelte.d.ts +87 -0
  5. package/dist/components/option-group/option-group.component.d.ts +24 -0
  6. package/dist/components/option-group/option-group.d.ts +8 -0
  7. package/dist/components/scroll-progress/scroll-progress.component.d.ts +57 -0
  8. package/dist/components/select/select.component.d.ts +9 -1
  9. package/dist/{components-DIhrAQ_z.js → components-BWz7rTny.js} +7682 -7491
  10. package/dist/components-BWz7rTny.js.map +1 -0
  11. package/dist/components.d.ts +2 -0
  12. package/dist/components.js +53 -51
  13. package/dist/dap-design-system.d.ts +2 -0
  14. package/dist/dds.js +151 -149
  15. package/dist/helpers/angular.js +57 -0
  16. package/dist/helpers/angular.js.map +1 -0
  17. package/dist/helpers/svelte.js +114 -0
  18. package/dist/helpers/svelte.js.map +1 -0
  19. package/dist/manifest/types/vue/index.d.ts +330 -284
  20. package/dist/manifest/vscode.html-custom-data.json +379 -319
  21. package/dist/manifest/web-types.json +571 -487
  22. package/dist/react/dap-ds-avatar/index.d.ts +1 -4
  23. package/dist/react/dap-ds-option-group/index.d.ts +18 -0
  24. package/dist/react/dap-ds-scroll-progress/index.d.ts +23 -0
  25. package/dist/react/index.d.ts +12 -10
  26. package/dist/react-types.ts +13 -11
  27. package/dist/react.js +668 -655
  28. package/dist/react.js.map +1 -1
  29. package/package.json +15 -1
  30. package/dist/components-DIhrAQ_z.js.map +0 -1
@@ -11,7 +11,6 @@ export type AvatarVariant = 'image' | 'initials' | 'icon';
11
11
  * @slot icon - The icon to display when variant is 'icon'.
12
12
  * @slot fallback - Custom fallback content when image fails to load.
13
13
  *
14
- * @event dds-click - Fired when the avatar is clicked (only when interactive).
15
14
  * @event dds-load - Fired when the image loads successfully.
16
15
  * @event dds-error - Fired when the image fails to load.
17
16
  *
@@ -0,0 +1,125 @@
1
+ import { RenderCallbackContent } from '../types/cell-content';
2
+ /**
3
+ * Angular core types - defined locally to avoid requiring @angular/core as a dependency
4
+ */
5
+ interface Type<T> extends Function {
6
+ new (...args: any[]): T;
7
+ }
8
+ interface ComponentRef<T> {
9
+ instance: T;
10
+ setInput: (name: string, value: unknown) => void;
11
+ changeDetectorRef: {
12
+ detectChanges: () => void;
13
+ };
14
+ destroy: () => void;
15
+ }
16
+ interface EnvironmentInjector {
17
+ get: (token: any) => any;
18
+ }
19
+ /**
20
+ * Options for creating an Angular cell
21
+ */
22
+ export interface AngularCellOptions {
23
+ /**
24
+ * Angular component class to render
25
+ * Uses Type<any> to support different Angular component types
26
+ */
27
+ component: Type<any>;
28
+ /**
29
+ * Input bindings to pass to the component
30
+ * These are set using Angular's setInput() method (Angular 14+)
31
+ */
32
+ inputs?: Record<string, any>;
33
+ /**
34
+ * Output event handlers to subscribe to
35
+ * Each output is expected to be an EventEmitter that will be subscribed to
36
+ * @example
37
+ * {
38
+ * click: (e) => console.log('clicked', e),
39
+ * change: (value) => console.log('changed', value)
40
+ * }
41
+ */
42
+ outputs?: Record<string, (...args: any[]) => void>;
43
+ /**
44
+ * Content to project into the component (ng-content)
45
+ * Note: Dynamic content projection is limited in Angular
46
+ */
47
+ content?: string;
48
+ /**
49
+ * Optional EnvironmentInjector for dependency injection
50
+ * If not provided, component will be created without DI context
51
+ */
52
+ environmentInjector?: EnvironmentInjector;
53
+ }
54
+ /**
55
+ * Type for Angular's createComponent function
56
+ * Made flexible to support different Angular versions
57
+ */
58
+ type CreateComponentFn = (component: Type<any>, options: Record<string, any>) => ComponentRef<any>;
59
+ /**
60
+ * Create a datatable cell that renders an Angular component using a factory function.
61
+ *
62
+ * This helper manages the Angular component lifecycle, creating and destroying
63
+ * the component when the cell is added/removed from the table.
64
+ *
65
+ * Note: This helper requires Angular 14+ for the `createComponent` function
66
+ * and `setInput` method support.
67
+ *
68
+ * @param createComponentFn - Angular's createComponent function from @angular/core
69
+ * @param options - Angular cell options
70
+ * @returns Render callback content for the datatable
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * import { createComponent, EnvironmentInjector, inject } from '@angular/core'
75
+ * import { createAngularCellWithFactory } from 'dap-design-system/helpers/angular'
76
+ * import { StatusBadgeComponent } from './status-badge.component'
77
+ *
78
+ * // Inside a component class
79
+ * private readonly injector = inject(EnvironmentInjector)
80
+ *
81
+ * columns = [
82
+ * {
83
+ * id: 'status',
84
+ * header: 'Status',
85
+ * cell: (info) => createAngularCellWithFactory(createComponent, {
86
+ * component: StatusBadgeComponent,
87
+ * inputs: {
88
+ * status: info.row.original.status,
89
+ * variant: 'success'
90
+ * },
91
+ * outputs: {
92
+ * click: () => console.log('Badge clicked')
93
+ * },
94
+ * environmentInjector: this.injector
95
+ * })
96
+ * }
97
+ * ]
98
+ * ```
99
+ */
100
+ export declare function createAngularCellWithFactory(createComponentFn: CreateComponentFn, options: AngularCellOptions): RenderCallbackContent;
101
+ /**
102
+ * @deprecated Use createAngularCellWithFactory instead.
103
+ * This alias is provided for backwards compatibility.
104
+ */
105
+ export declare const createAngularCell: typeof createAngularCellWithFactory;
106
+ /**
107
+ * Type helper for creating type-safe cell renderers
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * import type { AngularCellRenderer } from 'dap-design-system/helpers/angular'
112
+ *
113
+ * interface User {
114
+ * id: number
115
+ * status: string
116
+ * }
117
+ *
118
+ * const statusCell: AngularCellRenderer<User> = (row) => createAngularCellWithFactory(createComponent, {
119
+ * component: StatusBadgeComponent,
120
+ * inputs: { status: row.status }
121
+ * })
122
+ * ```
123
+ */
124
+ export type AngularCellRenderer<TData = any> = (row: TData) => RenderCallbackContent;
125
+ export {};
@@ -11,3 +11,7 @@ export type { VueCellOptions, VueCellRenderer } from './vue';
11
11
  export { createVueCell } from './vue';
12
12
  export type { ReactCellOptions, ReactCellRenderer } from './react';
13
13
  export { createReactCell } from './react';
14
+ export type { AngularCellOptions, AngularCellRenderer } from './angular';
15
+ export { createAngularCell, createAngularCellWithFactory } from './angular';
16
+ export type { SvelteCellOptions, SvelteCellRenderer } from './svelte';
17
+ export { createSvelteCell } from './svelte';
@@ -0,0 +1,87 @@
1
+ import { RenderCallbackContent } from '../types/cell-content';
2
+ /**
3
+ * Options for creating a Svelte cell
4
+ */
5
+ export interface SvelteCellOptions {
6
+ /**
7
+ * Svelte component to render (works with both Svelte 4 and 5)
8
+ * - Svelte 4: Class-based component (SvelteComponent)
9
+ * - Svelte 5: Function-based component (Component)
10
+ */
11
+ component: any;
12
+ /**
13
+ * Props to pass to the component
14
+ */
15
+ props?: Record<string, any>;
16
+ /**
17
+ * Event listeners to attach to the component
18
+ * Uses Svelte's event dispatching system ($on for v4, events option for v5)
19
+ * @example
20
+ * {
21
+ * click: (e) => console.log('clicked', e),
22
+ * change: (value) => console.log('changed', value)
23
+ * }
24
+ */
25
+ on?: Record<string, (...args: any[]) => void>;
26
+ /**
27
+ * Optional context to pass to the component
28
+ * Accepts either a Map or a plain object (converted to Map internally)
29
+ */
30
+ context?: Map<any, any> | Record<string, any>;
31
+ }
32
+ /**
33
+ * Create a datatable cell that renders a Svelte component
34
+ *
35
+ * This helper manages the Svelte component lifecycle, mounting and unmounting
36
+ * the component when the cell is added/removed from the table.
37
+ *
38
+ * Supports both Svelte 4 (class-based) and Svelte 5 (function-based) components
39
+ * with automatic version detection.
40
+ *
41
+ * @param options - Svelte cell options
42
+ * @returns Render callback content for the datatable
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * import { createSvelteCell } from 'dap-design-system/helpers/svelte'
47
+ * import StatusBadge from './StatusBadge.svelte'
48
+ *
49
+ * const columns = [
50
+ * {
51
+ * id: 'status',
52
+ * header: 'Status',
53
+ * cell: (row) => createSvelteCell({
54
+ * component: StatusBadge,
55
+ * props: {
56
+ * status: row.status,
57
+ * variant: 'success'
58
+ * },
59
+ * on: {
60
+ * click: () => console.log('Badge clicked')
61
+ * }
62
+ * })
63
+ * }
64
+ * ]
65
+ * ```
66
+ */
67
+ export declare function createSvelteCell(options: SvelteCellOptions): RenderCallbackContent;
68
+ export declare function createSvelteCell(component: any, props?: Record<string, any>): RenderCallbackContent;
69
+ /**
70
+ * Type helper for creating type-safe cell renderers
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * import type { SvelteCellRenderer } from 'dap-design-system/helpers/svelte'
75
+ *
76
+ * interface User {
77
+ * id: number
78
+ * status: string
79
+ * }
80
+ *
81
+ * const statusCell: SvelteCellRenderer<User> = (row) => createSvelteCell({
82
+ * component: StatusBadge,
83
+ * props: { status: row.status }
84
+ * })
85
+ * ```
86
+ */
87
+ export type SvelteCellRenderer<TData = any> = (row: TData) => RenderCallbackContent;
@@ -0,0 +1,24 @@
1
+ import { DdsElement } from '../../internal/dds-hu-element';
2
+ /**
3
+ * `dap-ds-option-group`
4
+ * @summary An option group is a container for grouping related option items.
5
+ * Used with dap-ds-select to create grouped options that render as native optgroup elements.
6
+ * @element dap-ds-option-group
7
+ * @title - Option group
8
+ *
9
+ * @property {string} label - The label of the option group (displayed in native optgroup).
10
+ * @property {boolean} disabled - Whether all options in the group are disabled.
11
+ *
12
+ * @slot - The option items in this group.
13
+ *
14
+ * @csspart base - The main option group container.
15
+ * @csspart label - The label of the option group.
16
+ */
17
+ export default class DapDSOptionGroup extends DdsElement {
18
+ /** The label of the option group */
19
+ label?: string;
20
+ /** Whether all options in the group are disabled */
21
+ disabled?: boolean;
22
+ static readonly styles: import('lit').CSSResult;
23
+ render(): import('lit-html').TemplateResult<1>;
24
+ }
@@ -0,0 +1,8 @@
1
+ import { default as DapDSOptionGroup } from './option-group.component.js';
2
+ export * from './option-group.component.js';
3
+ export default DapDSOptionGroup;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'dap-ds-option-group': DapDSOptionGroup;
7
+ }
8
+ }
@@ -0,0 +1,57 @@
1
+ import { DdsElement } from '../../internal/dds-hu-element';
2
+ export type ScrollProgressVariant = 'neutral' | 'brand' | 'negative' | 'positive' | 'inverted';
3
+ export type ScrollProgressSize = 'xs' | 'sm' | 'md';
4
+ /**
5
+ * `dap-ds-scroll-progress`
6
+ * @summary A progress bar that displays scroll position, supporting both page-level and container-level scroll tracking.
7
+ * @element dap-ds-scroll-progress
8
+ * @title - Scroll Progress
9
+ *
10
+ * @csspart base - The main scroll progress container.
11
+ * @csspart track - The progress track (background).
12
+ * @csspart fill - The progress fill bar.
13
+ *
14
+ * @cssprop --dds-scroll-progress-z-index - Z-index for fixed positioning (default: 1000)
15
+ * @cssprop --dds-scroll-progress-transition - Transition for progress updates (default: width 0.1s ease-out)
16
+ * @cssprop --dds-scroll-progress-track-color - Background color of the progress track (default: var(--dds-neutral-200))
17
+ * @cssprop --dds-scroll-progress-fill-color-neutral - Fill color for neutral variant
18
+ * @cssprop --dds-scroll-progress-fill-color-brand - Fill color for brand variant
19
+ * @cssprop --dds-scroll-progress-fill-color-negative - Fill color for negative variant
20
+ * @cssprop --dds-scroll-progress-fill-color-positive - Fill color for positive variant
21
+ * @cssprop --dds-scroll-progress-fill-color-inverted - Fill color for inverted variant
22
+ *
23
+ */
24
+ export default class DapDSScrollProgress extends DdsElement {
25
+ /**
26
+ * CSS selector for scroll container. If not set, tracks global page scroll.
27
+ * When set, the component uses sticky positioning within the container.
28
+ */
29
+ target?: string;
30
+ /**
31
+ * The color variant of the progress indicator.
32
+ * @type {"neutral" | "brand" | "negative" | "positive" | "inverted"}
33
+ */
34
+ variant: ScrollProgressVariant;
35
+ /**
36
+ * The size of the progress bar.
37
+ * @type {"xs" | "sm" | "md"}
38
+ */
39
+ size: ScrollProgressSize;
40
+ /**
41
+ * Current progress value (0-100).
42
+ */
43
+ private progress;
44
+ private targetElement;
45
+ private rafId;
46
+ private boundHandleScroll;
47
+ static readonly styles: import('lit').CSSResult;
48
+ constructor();
49
+ connectedCallback(): void;
50
+ disconnectedCallback(): void;
51
+ protected updated(changedProperties: Map<PropertyKey, unknown>): void;
52
+ private setupScrollListener;
53
+ private cleanupScrollListener;
54
+ private handleScroll;
55
+ private calculateProgress;
56
+ render(): import('lit-html').TemplateResult<1>;
57
+ }
@@ -1,5 +1,6 @@
1
1
  import { FloatingStrategy, PopupPlacement } from '../../common/types';
2
2
  import { GenericFormElement } from '../../internal/mixin/genericFormElement';
3
+ import { default as DapDSOptionItem } from '../option-item/option-item.component';
3
4
  import { default as DapDSOptionList } from '../option-list/option-list.component';
4
5
  /**
5
6
  * `dap-ds-select`
@@ -100,6 +101,8 @@ export default class DapDSSelect extends GenericFormElement {
100
101
  sync?: boolean;
101
102
  /** Whether the select is in mobile mode. */
102
103
  isMobile?: boolean;
104
+ /** Whether to render a native HTML select element for mobile-friendly option selection. */
105
+ native?: boolean;
103
106
  /** The loading state of the select. */
104
107
  loading?: boolean;
105
108
  /** The max heigth of the select dropdown. */
@@ -138,7 +141,7 @@ export default class DapDSSelect extends GenericFormElement {
138
141
  * Get the active descendant element for aria-activedescendant
139
142
  * Returns the currently focused option when dropdown is open, otherwise null
140
143
  */
141
- getActiveDescendant(): import('../option-item/option-item.component').default | null | undefined;
144
+ getActiveDescendant(): DapDSOptionItem | null | undefined;
142
145
  /**
143
146
  * Get the aria-describedby value, combining description and feedback IDs
144
147
  */
@@ -153,6 +156,11 @@ export default class DapDSSelect extends GenericFormElement {
153
156
  handleInvalid(event: Event): void;
154
157
  private readonly handleSelectedChange;
155
158
  private readonly handleOptionDeselect;
159
+ private readonly handleNativeChange;
160
+ private renderNativeOption;
161
+ private renderNativeOptgroup;
162
+ private renderNativeOptions;
163
+ private renderNativeSelect;
156
164
  renderTriggerElement(): import('lit-html').TemplateResult;
157
165
  renderOptionList(): import('lit-html').TemplateResult;
158
166
  render(): import('lit-html').TemplateResult;