@ids-group-ltd/ids-design-system 0.12.2 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +751 -6
- package/components.md +87 -2
- package/docs/agent/INDEX.md +11 -1
- package/docs/agent/charts/chart-colour-which-palette-a-chart-takes.md +9 -0
- package/docs/agent/charts/chart-frame-the-box-a-chart-draws-around-itself.md +12 -0
- package/docs/agent/charts/ds-bar-chart.md +15 -0
- package/docs/agent/charts/ds-column-chart.md +14 -0
- package/docs/agent/charts/ds-donut-chart.md +17 -0
- package/docs/agent/charts/ds-funnel-chart.md +16 -0
- package/docs/agent/charts/ds-line-chart.md +15 -0
- package/docs/agent/forms/ds-button.md +6 -2
- package/docs/agent/forms/ds-number-stepper.md +1 -0
- package/docs/agent/navigation/ds-sidenav-item.md +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +16 -14
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +161 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +20 -21
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +107 -40
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +43 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +197 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +10 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +173 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs +299 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +69 -17
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +366 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +12 -16
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +631 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +14 -22
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +18 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +4 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +10 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +30 -71
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +31 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +409 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +17 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +3 -0
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +10 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.12.3.json +83 -0
- package/migrations/0.13.0.json +530 -0
- package/package.json +57 -1
- package/styles/_chart-data-table.scss +95 -0
- package/styles/_chart-frame.scss +53 -0
- package/styles/_chart-interactive.scss +40 -0
- package/styles/_chart-motion.scss +45 -0
- package/styles/_control-line.scss +45 -0
- package/styles/_field-state.scss +14 -15
- package/styles/_focus.scss +31 -60
- package/styles/_tokens-charts.scss +149 -39
- package/styles/_tokens.scss +35 -31
- package/themes/dark/_theme.scss +37 -29
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +11 -9
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +104 -0
- package/types/ids-group-ltd-ids-design-system-components-breadcrumbs.d.ts +8 -17
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +60 -30
- package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +34 -0
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +78 -0
- package/types/ids-group-ltd-ids-design-system-components-checkbox.d.ts +6 -1
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +105 -0
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +4 -1
- package/types/ids-group-ltd-ids-design-system-components-donut-chart.d.ts +113 -0
- package/types/ids-group-ltd-ids-design-system-components-field-group.d.ts +52 -11
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +109 -0
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +5 -7
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +241 -0
- package/types/ids-group-ltd-ids-design-system-components-radio-group.d.ts +10 -10
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +5 -2
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +16 -4
- package/types/ids-group-ltd-ids-design-system-components-switch.d.ts +6 -1
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +13 -28
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +11 -1
- package/types/ids-group-ltd-ids-design-system-components.d.ts +163 -3
- package/types/ids-group-ltd-ids-design-system-core.d.ts +12 -1
- package/types/ids-group-ltd-ids-design-system.d.ts +9 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-tree.mjs","sources":["../../../src/lib/components/tree/tree.component.ts","../../../src/lib/components/tree/tree.component.html","../../../src/lib/components/tree/ids-group-ltd-ids-design-system-components-tree.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport type { TreeNode } from './tree.types';\n\ninterface VisibleNode {\n node: TreeNode;\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n}\n\n@Component({\n selector: 'ds-tree',\n standalone: true,\n imports: [IconComponent],\n templateUrl: './tree.component.html',\n styleUrl: './tree.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'tree',\n '(keydown)': 'onKeydown($event)',\n },\n})\nexport class TreeComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Root-level nodes; nest via `children`. */\n readonly nodes = input<readonly TreeNode[]>([]);\n /** Two-way set of currently expanded node ids. */\n readonly expandedIds = model<Set<string>>(new Set());\n /** Two-way id of the currently selected node. */\n readonly selectedId = model<string | null>(null);\n /** Fires with the node when a row is selected (click or Enter/Space). */\n readonly nodeSelected = output<TreeNode>();\n\n private readonly activeId = signal<string | null>(null);\n\n // Depth-first list of currently-visible nodes; drives rendering and keyboard nav.\n protected readonly visibleNodes = computed<VisibleNode[]>(() => {\n const out: VisibleNode[] = [];\n const walk = (list: readonly TreeNode[], level: number): void => {\n for (const node of list) {\n const hasChildren = !!node.children?.length;\n const expanded = this.isExpanded(node.id);\n out.push({ node, level, hasChildren, expanded });\n if (hasChildren && expanded) {\n walk(node.children ?? [], level + 1);\n }\n }\n };\n walk(this.nodes(), 0);\n\n return out;\n });\n\n // The single roving-tabindex treeitem — the active node, or the first one.\n protected readonly effectiveActiveId = computed(\n () => this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null,\n );\n\n protected isExpanded(id: string): boolean {\n return this.expandedIds().has(id);\n }\n\n protected isSelected(id: string): boolean {\n return this.selectedId() === id;\n }\n\n protected isActive(id: string): boolean {\n return this.effectiveActiveId() === id;\n }\n\n protected onRowClick(entry: VisibleNode): void {\n if (entry.node.disabled) {\n return;\n }\n this.select(entry.node);\n if (entry.hasChildren) {\n this.toggle(entry.node);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const visible = this.visibleNodes();\n const index = visible.findIndex(\n (entry) => entry.node.id === this.effectiveActiveId(),\n );\n if (index < 0) {\n return;\n }\n const current = visible[index];\n switch (event.key) {\n case 'ArrowDown':\n this.moveActive(index + 1);\n break;\n case 'ArrowUp':\n this.moveActive(index - 1);\n break;\n case 'Home':\n this.moveActive(0);\n break;\n case 'End':\n this.moveActive(visible.length - 1);\n break;\n case 'ArrowRight':\n if (current.hasChildren && !current.expanded) {\n this.toggle(current.node);\n } else if (current.hasChildren) {\n this.moveActive(index + 1);\n }\n break;\n case 'ArrowLeft':\n if (current.hasChildren && current.expanded) {\n this.toggle(current.node);\n } else {\n this.moveToParent(visible, index);\n }\n break;\n default:\n // Enter / Space activate the focused row via its native button click.\n return;\n }\n event.preventDefault();\n }\n\n private toggle(node: TreeNode): void {\n if (node.disabled || !node.children?.length) {\n return;\n }\n const next = new Set(this.expandedIds());\n if (next.has(node.id)) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n }\n this.expandedIds.set(next);\n }\n\n private select(node: TreeNode): void {\n if (node.disabled) {\n return;\n }\n this.selectedId.set(node.id);\n this.activeId.set(node.id);\n this.nodeSelected.emit(node);\n }\n\n private moveActive(targetIndex: number): void {\n const visible = this.visibleNodes();\n if (targetIndex < 0 || targetIndex >= visible.length) {\n return;\n }\n this.focusNode(visible[targetIndex].node.id);\n }\n\n private moveToParent(visible: VisibleNode[], index: number): void {\n const level = visible[index].level;\n for (let i = index - 1; i >= 0; i--) {\n if (visible[i].level < level) {\n this.focusNode(visible[i].node.id);\n\n return;\n }\n }\n }\n\n private focusNode(id: string): void {\n this.activeId.set(id);\n this.host.nativeElement\n .querySelector<HTMLElement>(`[data-node-id=\"${id}\"]`)\n ?.focus();\n }\n}\n","@for (entry of visibleNodes(); track entry.node.id) {\n <button\n type=\"button\"\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [disabled]=\"entry.node.disabled\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span class=\"label\">\n {{ entry.node.label }}\n </span>\n </button>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAiCa,aAAa,CAAA;AACP,IAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;;AAG1D,IAAA,KAAK,GAAG,KAAK,CAAsB,EAAE,4EAAC;;AAEtC,IAAA,WAAW,GAAG,KAAK,CAAc,IAAI,GAAG,EAAE,kFAAC;;AAE3C,IAAA,UAAU,GAAG,KAAK,CAAgB,IAAI,iFAAC;;IAEvC,YAAY,GAAG,MAAM,EA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AAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,mBAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,YAAA,EAAA,cAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECjC1B,ygCAmCA,EAAA,MAAA,EAAA,CAAA,09FAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDXY,aAAa,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FASZ,aAAa,EAAA,UAAA,EAAA,CAAA;kBAZzB,SAAS;+BACE,SAAS,EAAA,UAAA,EACP,IAAI,EAAA,OAAA,EACP,CAAC,aAAa,CAAC,EAAA,aAAA,EAGT,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,IAAI,EAAE,MAAM;AACZ,wBAAA,WAAW,EAAE,mBAAmB;AACjC,qBAAA,EAAA,QAAA,EAAA,ygCAAA,EAAA,MAAA,EAAA,CAAA,09FAAA,CAAA,EAAA;;;AE/BH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-tree.mjs","sources":["../../../src/lib/components/tree/tree.component.ts","../../../src/lib/components/tree/tree.component.html","../../../src/lib/components/tree/ids-group-ltd-ids-design-system-components-tree.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport type { TreeNode } from './tree.types';\n\ninterface VisibleNode {\n node: TreeNode;\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n}\n\n@Component({\n selector: 'ds-tree',\n standalone: true,\n imports: [IconComponent],\n templateUrl: './tree.component.html',\n styleUrl: './tree.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'tree',\n '(keydown)': 'onKeydown($event)',\n },\n})\nexport class TreeComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Root-level nodes; nest via `children`. */\n readonly nodes = input<readonly TreeNode[]>([]);\n /** Two-way set of currently expanded node ids. */\n readonly expandedIds = model<Set<string>>(new Set());\n /** Two-way id of the currently selected node. */\n readonly selectedId = model<string | null>(null);\n /** Fires with the node when a row is selected (click or Enter/Space). */\n readonly nodeSelected = output<TreeNode>();\n\n private readonly activeId = signal<string | null>(null);\n\n // Depth-first list of currently-visible nodes; drives rendering and keyboard nav.\n protected readonly visibleNodes = computed<VisibleNode[]>(() => {\n const out: VisibleNode[] = [];\n const walk = (list: readonly TreeNode[], level: number): void => {\n for (const node of list) {\n const hasChildren = !!node.children?.length;\n const expanded = this.isExpanded(node.id);\n out.push({ node, level, hasChildren, expanded });\n if (hasChildren && expanded) {\n walk(node.children ?? [], level + 1);\n }\n }\n };\n walk(this.nodes(), 0);\n\n return out;\n });\n\n // The single roving-tabindex treeitem — the active node, or the first one.\n protected readonly effectiveActiveId = computed(\n () => this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null,\n );\n\n protected isExpanded(id: string): boolean {\n return this.expandedIds().has(id);\n }\n\n protected isSelected(id: string): boolean {\n return this.selectedId() === id;\n }\n\n protected isActive(id: string): boolean {\n return this.effectiveActiveId() === id;\n }\n\n protected onRowClick(entry: VisibleNode): void {\n if (entry.node.disabled) {\n return;\n }\n this.select(entry.node);\n if (entry.hasChildren) {\n this.toggle(entry.node);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const visible = this.visibleNodes();\n const index = visible.findIndex(\n (entry) => entry.node.id === this.effectiveActiveId(),\n );\n if (index < 0) {\n return;\n }\n const current = visible[index];\n switch (event.key) {\n case 'ArrowDown':\n this.moveActive(index + 1);\n break;\n case 'ArrowUp':\n this.moveActive(index - 1);\n break;\n case 'Home':\n this.moveActive(0);\n break;\n case 'End':\n this.moveActive(visible.length - 1);\n break;\n case 'ArrowRight':\n if (current.hasChildren && !current.expanded) {\n this.toggle(current.node);\n } else if (current.hasChildren) {\n this.moveActive(index + 1);\n }\n break;\n case 'ArrowLeft':\n if (current.hasChildren && current.expanded) {\n this.toggle(current.node);\n } else {\n this.moveToParent(visible, index);\n }\n break;\n default:\n // Enter / Space activate the focused row via its native button click.\n return;\n }\n event.preventDefault();\n }\n\n private toggle(node: TreeNode): void {\n if (node.disabled || !node.children?.length) {\n return;\n }\n const next = new Set(this.expandedIds());\n if (next.has(node.id)) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n }\n this.expandedIds.set(next);\n }\n\n private select(node: TreeNode): void {\n if (node.disabled) {\n return;\n }\n this.selectedId.set(node.id);\n this.activeId.set(node.id);\n this.nodeSelected.emit(node);\n }\n\n private moveActive(targetIndex: number): void {\n const visible = this.visibleNodes();\n if (targetIndex < 0 || targetIndex >= visible.length) {\n return;\n }\n this.focusNode(visible[targetIndex].node.id);\n }\n\n private moveToParent(visible: VisibleNode[], index: number): void {\n const level = visible[index].level;\n for (let i = index - 1; i >= 0; i--) {\n if (visible[i].level < level) {\n this.focusNode(visible[i].node.id);\n\n return;\n }\n }\n }\n\n private focusNode(id: string): void {\n this.activeId.set(id);\n this.host.nativeElement\n .querySelector<HTMLElement>(`[data-node-id=\"${id}\"]`)\n ?.focus();\n }\n}\n","@for (entry of visibleNodes(); track entry.node.id) {\n <button\n type=\"button\"\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [disabled]=\"entry.node.disabled\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span class=\"label\">\n {{ entry.node.label }}\n </span>\n </button>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAiCa,aAAa,CAAA;AACP,IAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;;AAG1D,IAAA,KAAK,GAAG,KAAK,CAAsB,EAAE,4EAAC;;AAEtC,IAAA,WAAW,GAAG,KAAK,CAAc,IAAI,GAAG,EAAE,kFAAC;;AAE3C,IAAA,UAAU,GAAG,KAAK,CAAgB,IAAI,iFAAC;;IAEvC,YAAY,GAAG,MAAM,EAAY;AAEzB,IAAA,QAAQ,GAAG,MAAM,CAAgB,IAAI,+EAAC;;AAGpC,IAAA,YAAY,GAAG,QAAQ,CAAgB,MAAK;QAC7D,MAAM,GAAG,GAAkB,EAAE;AAC7B,QAAA,MAAM,IAAI,GAAG,CAAC,IAAyB,EAAE,KAAa,KAAU;AAC9D,YAAA,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;gBACvB,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM;gBAC3C,MAAM,QAAQ,GAAG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AAA,UAAA,EAAA,EAAA,MAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECjC1B,ygCAmCA,EAAA,MAAA,EAAA,CAAA,igGAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDXY,aAAa,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FASZ,aAAa,EAAA,UAAA,EAAA,CAAA;kBAZzB,SAAS;+BACE,SAAS,EAAA,UAAA,EACP,IAAI,EAAA,OAAA,EACP,CAAC,aAAa,CAAC,EAAA,aAAA,EAGT,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,IAAI,EAAE,MAAM;AACZ,wBAAA,WAAW,EAAE,mBAAmB;AACjC,qBAAA,EAAA,QAAA,EAAA,ygCAAA,EAAA,MAAA,EAAA,CAAA,igGAAA,CAAA,EAAA;;;AE/BH;;AAEG;;;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, computed, signal, untracked, afterRenderEffect, TemplateRef, Directive, Injector,
|
|
2
|
+
import { inject, computed, signal, PLATFORM_ID, DestroyRef, untracked, afterRenderEffect, TemplateRef, Directive, Injector, afterNextRender, isDevMode, input, booleanAttribute, effect, ElementRef, DOCUMENT } from '@angular/core';
|
|
3
3
|
import { DS_CONFIG } from '@ids-group-ltd/ids-design-system/core';
|
|
4
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
4
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
6
|
import { NgForm, FormGroupDirective, NgControl } from '@angular/forms';
|
|
7
|
+
import { Router, ActivatedRoute, UrlTree } from '@angular/router';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Resolve one brand string against the app-level default. `ds-sidenav` and
|
|
@@ -19,6 +21,316 @@ function resolveBrandValue(value, key) {
|
|
|
19
21
|
return computed(() => value() ?? config.brand?.[key] ?? '');
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
// GENERATED by tools/generate-chart-palette.mjs. Do not edit. Values are var()
|
|
25
|
+
// references, not resolved colours, so a consumer overriding the token still wins
|
|
26
|
+
// at runtime.
|
|
27
|
+
/** @internal Exported for the chart entry points that import it across the boundary;
|
|
28
|
+
* not part of the package surface. */
|
|
29
|
+
const chartColors = {
|
|
30
|
+
series1: 'var(--ds-chart-series-1-color)',
|
|
31
|
+
series2: 'var(--ds-chart-series-2-color)',
|
|
32
|
+
series3: 'var(--ds-chart-series-3-color)',
|
|
33
|
+
series4: 'var(--ds-chart-series-4-color)',
|
|
34
|
+
series5: 'var(--ds-chart-series-5-color)',
|
|
35
|
+
series6: 'var(--ds-chart-series-6-color)',
|
|
36
|
+
series7: 'var(--ds-chart-series-7-color)',
|
|
37
|
+
series8: 'var(--ds-chart-series-8-color)',
|
|
38
|
+
seriesDefault: 'var(--ds-chart-series-default-color)',
|
|
39
|
+
seriesAccent: 'var(--ds-chart-series-accent-color)',
|
|
40
|
+
ramp1: 'var(--ds-chart-ramp-1-color)',
|
|
41
|
+
ramp2: 'var(--ds-chart-ramp-2-color)',
|
|
42
|
+
ramp3: 'var(--ds-chart-ramp-3-color)',
|
|
43
|
+
ramp4: 'var(--ds-chart-ramp-4-color)',
|
|
44
|
+
ramp5: 'var(--ds-chart-ramp-5-color)',
|
|
45
|
+
ramp6: 'var(--ds-chart-ramp-6-color)',
|
|
46
|
+
ramp7: 'var(--ds-chart-ramp-7-color)',
|
|
47
|
+
ramp8: 'var(--ds-chart-ramp-8-color)',
|
|
48
|
+
};
|
|
49
|
+
/** @internal See chartColors. */
|
|
50
|
+
const CHART_SERIES_COLORS = [
|
|
51
|
+
chartColors.series1,
|
|
52
|
+
chartColors.series2,
|
|
53
|
+
chartColors.series3,
|
|
54
|
+
chartColors.series4,
|
|
55
|
+
chartColors.series5,
|
|
56
|
+
chartColors.series6,
|
|
57
|
+
chartColors.series7,
|
|
58
|
+
chartColors.series8,
|
|
59
|
+
];
|
|
60
|
+
/** @internal See chartColors. */
|
|
61
|
+
const CHART_RAMP_COLORS = [
|
|
62
|
+
chartColors.ramp1,
|
|
63
|
+
chartColors.ramp2,
|
|
64
|
+
chartColors.ramp3,
|
|
65
|
+
chartColors.ramp4,
|
|
66
|
+
chartColors.ramp5,
|
|
67
|
+
chartColors.ramp6,
|
|
68
|
+
chartColors.ramp7,
|
|
69
|
+
chartColors.ramp8,
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const numberFormatters = new Map();
|
|
73
|
+
function numberFormatter(locale) {
|
|
74
|
+
const key = locale ?? 'default';
|
|
75
|
+
let formatter = numberFormatters.get(key);
|
|
76
|
+
if (!formatter) {
|
|
77
|
+
formatter = new Intl.NumberFormat(locale);
|
|
78
|
+
numberFormatters.set(key, formatter);
|
|
79
|
+
}
|
|
80
|
+
return formatter;
|
|
81
|
+
}
|
|
82
|
+
/** @internal */
|
|
83
|
+
function formatValue(value, locale) {
|
|
84
|
+
if (!Number.isFinite(value)) {
|
|
85
|
+
return '—';
|
|
86
|
+
}
|
|
87
|
+
return numberFormatter(locale).format(value);
|
|
88
|
+
}
|
|
89
|
+
/** @internal */
|
|
90
|
+
function formatPercent(value, total) {
|
|
91
|
+
if (!total || !Number.isFinite(value) || !Number.isFinite(total)) {
|
|
92
|
+
return '—';
|
|
93
|
+
}
|
|
94
|
+
const percent = (value / total) * 100;
|
|
95
|
+
// A real share must never print as an exact zero: at one decimal, 214 of 987,654,321 rounds to
|
|
96
|
+
// "0.0%" beside a bar too short to see, and the row reads as nothing when it is not nothing.
|
|
97
|
+
if (percent !== 0 && Math.abs(percent) < 0.05) {
|
|
98
|
+
return percent > 0 ? '<0.1%' : '>-0.1%';
|
|
99
|
+
}
|
|
100
|
+
return `${percent.toFixed(1)}%`;
|
|
101
|
+
}
|
|
102
|
+
/** Whole percentages that sum to exactly 100. Rounding each share on its own
|
|
103
|
+
* gives 33/33/33 for three equal parts, and a legend that visibly loses 1%.
|
|
104
|
+
*
|
|
105
|
+
* @internal Exported for the chart entry points; not part of the package surface. */
|
|
106
|
+
function largestRemainder(values) {
|
|
107
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
108
|
+
if (!total) {
|
|
109
|
+
return values.map(() => 0);
|
|
110
|
+
}
|
|
111
|
+
const exact = values.map((value) => (value / total) * 100);
|
|
112
|
+
const floors = exact.map(Math.floor);
|
|
113
|
+
let remaining = 100 - floors.reduce((sum, value) => sum + value, 0);
|
|
114
|
+
const order = exact
|
|
115
|
+
.map((value, index) => ({ index, fraction: value - Math.floor(value) }))
|
|
116
|
+
.sort((a, b) => b.fraction - a.fraction);
|
|
117
|
+
const result = [...floors];
|
|
118
|
+
for (const { index } of order) {
|
|
119
|
+
if (remaining <= 0) {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
result[index]++;
|
|
123
|
+
remaining--;
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
/** @internal */
|
|
128
|
+
function formatTick(value, step) {
|
|
129
|
+
if (!Number.isFinite(value)) {
|
|
130
|
+
return '';
|
|
131
|
+
}
|
|
132
|
+
if (Math.abs(value) < 1000) {
|
|
133
|
+
return String(value);
|
|
134
|
+
}
|
|
135
|
+
// The unit follows the STEP, not the value, so every label on one axis carries the same suffix:
|
|
136
|
+
// a step of 200M labels 1e9 as 1000M, never 1B beside 800M.
|
|
137
|
+
const units = [
|
|
138
|
+
{ suffix: 'B', scale: 1e9 },
|
|
139
|
+
{ suffix: 'M', scale: 1e6 },
|
|
140
|
+
{ suffix: 'K', scale: 1e3 },
|
|
141
|
+
];
|
|
142
|
+
const unit = units.find((candidate) => Math.abs(step) >= candidate.scale) ?? units[2];
|
|
143
|
+
const scaled = value / unit.scale;
|
|
144
|
+
// A step that divides its unit evenly needs no decimal; one that does not needs exactly one on
|
|
145
|
+
// EVERY label, so an axis reads 1.0K · 1.5K · 2.0K rather than mixing 1K with 1.5K. Rounding the
|
|
146
|
+
// whole branch matters too: a caller passing a raw datum instead of a tick would otherwise print
|
|
147
|
+
// every digit of the division, as 987.654321M.
|
|
148
|
+
return step % unit.scale === 0
|
|
149
|
+
? `${Math.round(scaled)}${unit.suffix}`
|
|
150
|
+
: `${scaled.toFixed(1)}${unit.suffix}`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Container width as a signal. It is 0 under SSR, while the container is
|
|
154
|
+
* `display: none`, and before the first observation.
|
|
155
|
+
*
|
|
156
|
+
* @internal */
|
|
157
|
+
function elementWidth(host) {
|
|
158
|
+
const width = signal(0, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
159
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
160
|
+
return width.asReadonly();
|
|
161
|
+
}
|
|
162
|
+
const observer = new ResizeObserver((entries) => {
|
|
163
|
+
width.set(Math.round(entries[0]?.contentRect.width ?? 0));
|
|
164
|
+
});
|
|
165
|
+
observer.observe(host.nativeElement);
|
|
166
|
+
inject(DestroyRef).onDestroy(() => observer.disconnect());
|
|
167
|
+
return width.asReadonly();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const E10 = Math.sqrt(50);
|
|
171
|
+
const E5 = Math.sqrt(10);
|
|
172
|
+
const E2 = Math.sqrt(2);
|
|
173
|
+
/** d3's tick-increment rule. A naive `max / count` produces steps like 482, which
|
|
174
|
+
* no reader parses; this snaps to 1, 2, 5 or 10 times a power of ten. */
|
|
175
|
+
function tickIncrement(domainMax, targetCount) {
|
|
176
|
+
const step = domainMax / Math.max(1, targetCount);
|
|
177
|
+
const power = Math.floor(Math.log10(step));
|
|
178
|
+
const error = step / Math.pow(10, power);
|
|
179
|
+
const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1;
|
|
180
|
+
return factor * Math.pow(10, power);
|
|
181
|
+
}
|
|
182
|
+
/** @internal */
|
|
183
|
+
function tickValues(domainMax, targetCount) {
|
|
184
|
+
if (!Number.isFinite(domainMax) || domainMax <= 0) {
|
|
185
|
+
return [0];
|
|
186
|
+
}
|
|
187
|
+
const step = tickIncrement(domainMax, targetCount);
|
|
188
|
+
const out = [];
|
|
189
|
+
for (let i = 0; i <= Math.ceil(domainMax / step); i++) {
|
|
190
|
+
out.push(i * step);
|
|
191
|
+
}
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
/** @internal */
|
|
195
|
+
function niceMax(domainMax, targetCount) {
|
|
196
|
+
if (!Number.isFinite(domainMax) || domainMax <= 0) {
|
|
197
|
+
return 0;
|
|
198
|
+
}
|
|
199
|
+
const step = tickIncrement(domainMax, targetCount);
|
|
200
|
+
return Math.ceil(domainMax / step) * step;
|
|
201
|
+
}
|
|
202
|
+
/** Distance between two ticks, which `formatTick` needs to pick a precision. A
|
|
203
|
+
* degenerate series yields a single tick and therefore no step.
|
|
204
|
+
*
|
|
205
|
+
* @internal */
|
|
206
|
+
function tickStep(ticks) {
|
|
207
|
+
return ticks.length > 1 ? ticks[1] - ticks[0] : 0;
|
|
208
|
+
}
|
|
209
|
+
/** @internal */
|
|
210
|
+
function linearScale(domainMax, rangeSize) {
|
|
211
|
+
if (!Number.isFinite(domainMax) || domainMax <= 0) {
|
|
212
|
+
return () => 0;
|
|
213
|
+
}
|
|
214
|
+
return (value) => (value / domainMax) * rangeSize;
|
|
215
|
+
}
|
|
216
|
+
/** @internal */
|
|
217
|
+
function bandScale(count, rangeSize, paddingRatio) {
|
|
218
|
+
if (count <= 0) {
|
|
219
|
+
return {
|
|
220
|
+
bandWidth: 0,
|
|
221
|
+
step: 0,
|
|
222
|
+
count: 0,
|
|
223
|
+
position: () => 0,
|
|
224
|
+
indexAt: () => -1,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
const step = rangeSize / count;
|
|
228
|
+
const bandWidth = step * (1 - paddingRatio);
|
|
229
|
+
return {
|
|
230
|
+
bandWidth,
|
|
231
|
+
step,
|
|
232
|
+
count,
|
|
233
|
+
position: (index) => step * index + (step - bandWidth) / 2,
|
|
234
|
+
indexAt: (offset) => Math.min(count - 1, Math.max(0, Math.floor(offset / step))),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Past this the entrance stops reading as one gesture and starts reading as a queue: at 40ms a
|
|
239
|
+
// 100-mark series would otherwise take four seconds to finish arriving.
|
|
240
|
+
const STAGGER_CAP_MS = 300;
|
|
241
|
+
/** Entrance delay for the mark at `index`, in milliseconds. `stepMs` of `0` is the default and
|
|
242
|
+
* means no stagger at all.
|
|
243
|
+
*
|
|
244
|
+
* @internal */
|
|
245
|
+
function staggerDelay(index, stepMs) {
|
|
246
|
+
if (!(stepMs > 0) || !Number.isFinite(index) || index <= 0) {
|
|
247
|
+
return 0;
|
|
248
|
+
}
|
|
249
|
+
return Math.min(index * stepMs, STAGGER_CAP_MS);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Where a roving tabindex lands after `key`, or `null` when the key does not traverse.
|
|
253
|
+
*
|
|
254
|
+
* The ends wrap, as they do in `ds-radio-group`: a chart's marks are a closed set, and Home and
|
|
255
|
+
* End are the direct way to either extreme.
|
|
256
|
+
*
|
|
257
|
+
* @internal */
|
|
258
|
+
function nextRovingIndex(key, current, count) {
|
|
259
|
+
if (!Number.isFinite(count) || count <= 0) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
switch (key) {
|
|
263
|
+
case 'ArrowRight':
|
|
264
|
+
case 'ArrowDown':
|
|
265
|
+
return (current + 1) % count;
|
|
266
|
+
case 'ArrowLeft':
|
|
267
|
+
case 'ArrowUp':
|
|
268
|
+
return (current - 1 + count) % count;
|
|
269
|
+
case 'Home':
|
|
270
|
+
return 0;
|
|
271
|
+
case 'End':
|
|
272
|
+
return count - 1;
|
|
273
|
+
default:
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** Moves DOM focus to the mark `index` within `scope`, which is what makes the roving tabindex a
|
|
278
|
+
* traversal rather than a state change nobody can see. `within` narrows the search for a chart
|
|
279
|
+
* whose marks repeat the same index once per series.
|
|
280
|
+
*
|
|
281
|
+
* @internal */
|
|
282
|
+
function focusMark(scope, index, within = '') {
|
|
283
|
+
const target = scope?.querySelector(`${within}[data-mark-index="${index}"]`);
|
|
284
|
+
if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
285
|
+
target.focus();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function trendOf(values) {
|
|
290
|
+
const first = values[0];
|
|
291
|
+
const last = values[values.length - 1];
|
|
292
|
+
const rose = values.every((value, index) => index === 0 || value > values[index - 1]);
|
|
293
|
+
const fell = values.every((value, index) => index === 0 || value < values[index - 1]);
|
|
294
|
+
if (rose) {
|
|
295
|
+
return 'Rising throughout';
|
|
296
|
+
}
|
|
297
|
+
if (fell) {
|
|
298
|
+
return 'Falling throughout';
|
|
299
|
+
}
|
|
300
|
+
if (last > first) {
|
|
301
|
+
return 'Rising overall';
|
|
302
|
+
}
|
|
303
|
+
if (last < first) {
|
|
304
|
+
return 'Falling overall';
|
|
305
|
+
}
|
|
306
|
+
return 'Ending where it started';
|
|
307
|
+
}
|
|
308
|
+
/** The sentence a screen reader gets as the chart's accessible name. Generated rather than
|
|
309
|
+
* required, because a required one is a field that gets left at the component's default and then
|
|
310
|
+
* lies.
|
|
311
|
+
*
|
|
312
|
+
* The ORDER is the contract: what the chart is and its scale, then the trend, then the extremes,
|
|
313
|
+
* then where the numbers are. Blind readers rank a recital of the encoding lowest of the four
|
|
314
|
+
* levels of chart description, and the encoding is the one thing a screen-reader user cannot use.
|
|
315
|
+
*
|
|
316
|
+
* @internal */
|
|
317
|
+
function describeSeries(label, points, format = formatValue, tableFollows = true) {
|
|
318
|
+
const pointer = tableFollows ? ' Full values in the table below.' : '';
|
|
319
|
+
if (points.length === 0) {
|
|
320
|
+
return `${label}. No data.`;
|
|
321
|
+
}
|
|
322
|
+
if (points.length === 1) {
|
|
323
|
+
return `${label}, one point: ${format(points[0].value)} at ${points[0].label}.${pointer}`;
|
|
324
|
+
}
|
|
325
|
+
const lowest = points.reduce((min, point) => point.value < min.value ? point : min);
|
|
326
|
+
const highest = points.reduce((max, point) => point.value > max.value ? point : max);
|
|
327
|
+
return (`${label}, ${points.length} points, ` +
|
|
328
|
+
`${format(lowest.value)} to ${format(highest.value)}. ` +
|
|
329
|
+
`${trendOf(points.map((point) => point.value))}. ` +
|
|
330
|
+
`Highest in ${highest.label} at ${format(highest.value)}, ` +
|
|
331
|
+
`lowest in ${lowest.label} at ${format(lowest.value)}.${pointer}`);
|
|
332
|
+
}
|
|
333
|
+
|
|
22
334
|
/**
|
|
23
335
|
* @fileoverview How many chips fit one line of a trigger, measured rather than
|
|
24
336
|
* guessed.
|
|
@@ -312,9 +624,14 @@ function resolveFieldMessage(sources) {
|
|
|
312
624
|
}, ...(ngDevMode ? [{ debugName: "advisoryText" }] : /* istanbul ignore next */ []));
|
|
313
625
|
// Advisory errors are deliberately absent: a warning does not make a control
|
|
314
626
|
// invalid, so it never sets aria-invalid and never blocks a submit guard.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
627
|
+
// Disabled wins over every source of invalidity. Measured in Chrome's accessibility tree:
|
|
628
|
+
// `aria-invalid` on a NATIVELY disabled input still reports invalid=true and the node is not
|
|
629
|
+
// ignored, so disabling does not make the attribute inert — the reader still hears "invalid" on
|
|
630
|
+
// a control they cannot act on.
|
|
631
|
+
const invalid = computed(() => !(sources.disabled?.() ?? false) &&
|
|
632
|
+
(sources.invalid() ||
|
|
633
|
+
sources.error().length > 0 ||
|
|
634
|
+
(blocking().length > 0 && interacted())), ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
318
635
|
// Message inputs trim via `trimmedText`, so a non-empty string here is real
|
|
319
636
|
// text — a new one declared without that transform breaks this quietly.
|
|
320
637
|
const message = computed(() => {
|
|
@@ -726,6 +1043,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
726
1043
|
}]
|
|
727
1044
|
}] });
|
|
728
1045
|
|
|
1046
|
+
// The query string is a subset match and the fragment is ignored in both: a sort order, a page
|
|
1047
|
+
// number or an open accordion does not make it a different page.
|
|
1048
|
+
const EXACT_PATH = {
|
|
1049
|
+
paths: 'exact',
|
|
1050
|
+
queryParams: 'subset',
|
|
1051
|
+
fragment: 'ignored',
|
|
1052
|
+
matrixParams: 'ignored',
|
|
1053
|
+
};
|
|
1054
|
+
const PREFIX_PATH = {
|
|
1055
|
+
...EXACT_PATH,
|
|
1056
|
+
paths: 'subset',
|
|
1057
|
+
};
|
|
1058
|
+
/**
|
|
1059
|
+
* No destination is a `<button>`, never an `<a href="#">`: a `#` href navigates, rewriting the URL
|
|
1060
|
+
* and discarding the scroll position. Only the decision is shared — each control keeps its own
|
|
1061
|
+
* template branches, because a shared one would need a wrapper that changes the control's box.
|
|
1062
|
+
*
|
|
1063
|
+
* @internal
|
|
1064
|
+
*/
|
|
1065
|
+
function dsDestination(routerLink, href) {
|
|
1066
|
+
return computed(() => {
|
|
1067
|
+
if (routerLink() !== null) {
|
|
1068
|
+
return 'routerLink';
|
|
1069
|
+
}
|
|
1070
|
+
return href() ? 'href' : 'button';
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* What a navigating control should announce, distinguishing the two things `routerLinkActive`
|
|
1075
|
+
* cannot tell apart.
|
|
1076
|
+
*
|
|
1077
|
+
* `routerLinkActive` matches by PREFIX, so deriving `aria-current="page"` from it makes a
|
|
1078
|
+
* "back to the section" link claim to be the page the reader is already on. ARIA separates the
|
|
1079
|
+
* two: `page` is the page you are on, `true` is the current section or an ancestor of it. So an
|
|
1080
|
+
* exact match announces `page`, a prefix match announces `true`, and anything else stays silent —
|
|
1081
|
+
* which is correct for a button and for a sidenav item without a branch between them.
|
|
1082
|
+
*
|
|
1083
|
+
* Feed the result to `RouterLinkActive.ariaCurrentWhenActive`, never to `[attr.aria-current]`: the
|
|
1084
|
+
* directive removes that attribute from its host in a microtask whenever its own input is unset,
|
|
1085
|
+
* so a template binding is written and then silently wiped. Consequence worth knowing — a narrowed
|
|
1086
|
+
* `routerLinkActiveOptions` narrows the announcement with it, because the directive writes nothing
|
|
1087
|
+
* while it considers the link inactive.
|
|
1088
|
+
*
|
|
1089
|
+
* Must be called from an injection context. Outside a router it returns the override or `null`,
|
|
1090
|
+
* so a control can render with no router present.
|
|
1091
|
+
*
|
|
1092
|
+
* @internal
|
|
1093
|
+
*/
|
|
1094
|
+
function dsAriaCurrent(routerLink, modifiers, override) {
|
|
1095
|
+
const router = inject(Router, { optional: true });
|
|
1096
|
+
// `RouterLink` resolves its commands against the route it sits on, so a relative destination
|
|
1097
|
+
// (`routerLink="."`, `['..', 'sibling']`) means something different from the root. Resolving it
|
|
1098
|
+
// here without the same base would make `.` land on `/` — a prefix of every page, so the item
|
|
1099
|
+
// that IS the current page would announce `true` instead of `page`.
|
|
1100
|
+
const route = inject(ActivatedRoute, { optional: true });
|
|
1101
|
+
return computed(() => {
|
|
1102
|
+
// `null` is the consumer's way of saying "announce nothing"; the directive spells that
|
|
1103
|
+
// `undefined`, so the two meet here rather than at every call site.
|
|
1104
|
+
const explicit = override();
|
|
1105
|
+
if (explicit !== undefined) {
|
|
1106
|
+
return explicit ?? undefined;
|
|
1107
|
+
}
|
|
1108
|
+
const link = routerLink();
|
|
1109
|
+
if (!router || link === null) {
|
|
1110
|
+
return undefined;
|
|
1111
|
+
}
|
|
1112
|
+
const tree = link instanceof UrlTree
|
|
1113
|
+
? link
|
|
1114
|
+
: router.createUrlTree(Array.isArray(link) ? [...link] : [link], {
|
|
1115
|
+
relativeTo: route ?? undefined,
|
|
1116
|
+
...modifiers(),
|
|
1117
|
+
});
|
|
1118
|
+
// `lastSuccessfulNavigation` is only the reactive trigger. The comparison goes through
|
|
1119
|
+
// `Router.isActive`, which reads the LIVE url: the standalone `isActive()` helper compares
|
|
1120
|
+
// against that navigation's `finalUrl` instead, and an app that rewrites its path without
|
|
1121
|
+
// navigating — a docs page tracking the section under the reader, a wizard naming its step —
|
|
1122
|
+
// then keeps announcing the page it landed on. Deprecated in 21.1, and nothing public replaces
|
|
1123
|
+
// the live-url comparison.
|
|
1124
|
+
router.lastSuccessfulNavigation();
|
|
1125
|
+
return router.isActive(tree, EXACT_PATH)
|
|
1126
|
+
? 'page'
|
|
1127
|
+
: router.isActive(tree, PREFIX_PATH)
|
|
1128
|
+
? true
|
|
1129
|
+
: undefined;
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
|
|
729
1133
|
/**
|
|
730
1134
|
* Replaces a picker panel's "no matches" row — an icon, a sentence in the app's
|
|
731
1135
|
* own language, a "clear the filter" button.
|
|
@@ -1360,5 +1764,5 @@ function createTypeAhead() {
|
|
|
1360
1764
|
* Generated bundle index. Do not edit.
|
|
1361
1765
|
*/
|
|
1362
1766
|
|
|
1363
|
-
export { DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, disposeWithLeave, dropdownOverlay, focusIsInside, forwardOverlayTokens, nextControlId, overlayPlacementOf, prepareOverlayEnter, resolveBrandValue, resolveFieldMessage, scrollActiveOptionIntoView, trimmedText, valueControlBridge };
|
|
1767
|
+
export { CHART_RAMP_COLORS, CHART_SERIES_COLORS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, bandScale, chartColors, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, describeSeries, disposeWithLeave, dropdownOverlay, dsAriaCurrent, dsDestination, elementWidth, focusIsInside, focusMark, formatPercent, formatTick, formatValue, forwardOverlayTokens, largestRemainder, linearScale, nextControlId, nextRovingIndex, niceMax, overlayPlacementOf, prepareOverlayEnter, resolveBrandValue, resolveFieldMessage, scrollActiveOptionIntoView, staggerDelay, tickStep, tickValues, trimmedText, valueControlBridge };
|
|
1364
1768
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components.mjs.map
|