@ids-group-ltd/ids-design-system 0.14.4 → 0.14.6-beta.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 +176 -1
- package/components.md +15 -15
- package/docs/agent/INDEX.md +1 -1
- package/docs/agent/charts/ds-bar-chart.md +1 -1
- package/docs/agent/charts/ds-chart.md +1 -1
- package/docs/agent/charts/ds-column-chart.md +1 -1
- package/docs/agent/charts/ds-config.md +1 -1
- package/docs/agent/charts/ds-funnel-chart.md +1 -1
- package/docs/agent/charts/ds-heatmap-chart.md +1 -1
- package/docs/agent/charts/ds-line-chart.md +1 -1
- package/docs/agent/charts/ds-pie-chart.md +3 -3
- package/docs/agent/charts/ds-scatter-chart.md +1 -1
- package/docs/agent/charts/ds-waterfall-chart.md +1 -1
- package/docs/agent/navigation/ds-breadcrumbs.md +1 -1
- package/docs/agent/overlays/ds-tooltip.md +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +4 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +2 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +58 -163
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +21 -34
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +34 -105
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +22 -48
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +7 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +6 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +28 -130
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar.mjs +11 -29
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs +10 -28
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +20 -13
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +42 -69
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs +15 -20
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs +6 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.mjs +3 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +12 -28
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +58 -112
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs +182 -432
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +8 -12
- 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 +8 -22
- 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 +28 -123
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +45 -116
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs +4 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +7 -16
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +7 -8
- 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 +3 -3
- 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 +16 -45
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs +10 -14
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +19 -41
- 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 +48 -163
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +27 -85
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +17 -25
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +21 -41
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs +3 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +50 -166
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +7 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs +6 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +19 -36
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +30 -57
- 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 +37 -103
- 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 +5 -6
- 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 +9 -15
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +8 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs +9 -24
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +32 -120
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +14 -24
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +15 -24
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs +9 -16
- package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +27 -91
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +16 -41
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +8 -11
- 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 +18 -52
- 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 +4 -7
- 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 +30 -49
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +8 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +6 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sparkline.mjs +29 -13
- package/fesm2022/ids-group-ltd-ids-design-system-components-sparkline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +8 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +5 -20
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +5 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +11 -23
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +7 -16
- 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-resize.mjs +9 -43
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-resize.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +167 -353
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +33 -86
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +7 -7
- 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 +23 -47
- 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 +21 -49
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +35 -63
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +2 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +38 -50
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +3 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs +28 -85
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +325 -579
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +52 -85
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +4 -21
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs +4 -13
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs +1 -2
- package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs.map +1 -1
- package/migrations/0.14.5.json +311 -0
- package/migrations/0.14.6-beta.0.json +9 -0
- package/package.json +1 -1
- package/schematics/check-overrides/surface.json +20 -2
- package/styles/_breakpoints.scss +6 -23
- package/styles/_chart-data-table.scss +3 -11
- package/styles/_chart-frame.scss +14 -63
- package/styles/_chart-interactive.scss +8 -36
- package/styles/_chart-motion.scss +11 -39
- package/styles/_check-box.scss +7 -26
- package/styles/_check-mark.scss +7 -23
- package/styles/_chip-row.scss +3 -14
- package/styles/_clear-button.scss +2 -7
- package/styles/_control-label.scss +2 -13
- package/styles/_control-line.scss +2 -6
- package/styles/_dropdown-overlay.scss +8 -33
- package/styles/_ds-color.scss +9 -28
- package/styles/_field-box.scss +4 -16
- package/styles/_field-group-segment.scss +6 -6
- package/styles/_field-label.scss +3 -14
- package/styles/_field-state.scss +5 -10
- package/styles/_focus.scss +20 -60
- package/styles/_icon-base.scss +0 -2
- package/styles/_layout-utils.scss +0 -3
- package/styles/_link.scss +4 -18
- package/styles/_overlay-motion.scss +15 -38
- package/styles/_page-grid.scss +4 -29
- package/styles/_press.scss +5 -18
- package/styles/_reset.scss +1 -14
- package/styles/_scrollbar.scss +0 -2
- package/styles/_skeleton-shimmer.scss +3 -14
- package/styles/_status.scss +5 -13
- package/styles/_surface-motion.scss +7 -34
- package/styles/_table-controls.scss +3 -6
- package/styles/_text-clip.scss +2 -6
- package/styles/_theme-activation.scss +7 -20
- package/styles/_toast-overlay.scss +2 -6
- package/styles/_tokens-charts.scss +31 -90
- package/styles/_tokens.scss +111 -156
- package/styles/_typography.scss +6 -13
- package/styles/_visually-hidden.scss +2 -3
- package/styles/ds.scss +2 -10
- package/themes/_base-palette.scss +12 -35
- package/themes/_semantic.scss +29 -98
- package/themes/dark/_palette.scss +15 -29
- package/themes/dark/_theme.scss +14 -32
- package/themes/light/_palette.scss +2 -17
- package/themes/light/_theme.scss +1 -7
- package/types/ids-group-ltd-ids-design-system-components-accordion.d.ts +2 -6
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +2 -3
- package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +45 -119
- package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +19 -32
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +29 -92
- package/types/ids-group-ltd-ids-design-system-components-avatar-group.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-avatar.d.ts +23 -46
- package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +5 -5
- package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +4 -8
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +27 -136
- package/types/ids-group-ltd-ids-design-system-components-bar.d.ts +13 -32
- package/types/ids-group-ltd-ids-design-system-components-bottom-sheet.d.ts +6 -12
- package/types/ids-group-ltd-ids-design-system-components-breadcrumbs.d.ts +6 -9
- package/types/ids-group-ltd-ids-design-system-components-button-group.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +36 -55
- package/types/ids-group-ltd-ids-design-system-components-calendar-day.d.ts +13 -18
- package/types/ids-group-ltd-ids-design-system-components-card.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-chart-data-table.d.ts +5 -11
- package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +10 -26
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +27 -49
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +161 -385
- package/types/ids-group-ltd-ids-design-system-components-checkbox.d.ts +6 -10
- package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +5 -14
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +29 -124
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +23 -70
- package/types/ids-group-ltd-ids-design-system-components-description-list.d.ts +3 -3
- package/types/ids-group-ltd-ids-design-system-components-divider.d.ts +3 -7
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +1 -3
- package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +6 -8
- package/types/ids-group-ltd-ids-design-system-components-empty-state.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-field-group.d.ts +17 -50
- package/types/ids-group-ltd-ids-design-system-components-field-message.d.ts +8 -12
- package/types/ids-group-ltd-ids-design-system-components-filter-bar.d.ts +13 -28
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +25 -113
- package/types/ids-group-ltd-ids-design-system-components-heatmap-chart.d.ts +17 -85
- package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +15 -23
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +18 -37
- package/types/ids-group-ltd-ids-design-system-components-layout.d.ts +3 -3
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +51 -160
- package/types/ids-group-ltd-ids-design-system-components-list.d.ts +3 -3
- package/types/ids-group-ltd-ids-design-system-components-loading-overlay.d.ts +4 -9
- package/types/ids-group-ltd-ids-design-system-components-menu.d.ts +13 -21
- package/types/ids-group-ltd-ids-design-system-components-modal.d.ts +15 -28
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +27 -83
- package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +5 -6
- package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +5 -7
- package/types/ids-group-ltd-ids-design-system-components-page-footer.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +6 -10
- package/types/ids-group-ltd-ids-design-system-components-password-rules.d.ts +8 -22
- package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +18 -102
- package/types/ids-group-ltd-ids-design-system-components-popover.d.ts +7 -11
- package/types/ids-group-ltd-ids-design-system-components-radio-group.d.ts +14 -25
- package/types/ids-group-ltd-ids-design-system-components-reserve-messages.d.ts +7 -12
- package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +21 -96
- package/types/ids-group-ltd-ids-design-system-components-search.d.ts +12 -33
- package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +6 -7
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +12 -41
- package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +8 -15
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +23 -40
- package/types/ids-group-ltd-ids-design-system-components-skeleton.d.ts +3 -5
- package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +4 -4
- package/types/ids-group-ltd-ids-design-system-components-sparkline.d.ts +14 -10
- package/types/ids-group-ltd-ids-design-system-components-spinner.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +6 -7
- package/types/ids-group-ltd-ids-design-system-components-stat.d.ts +2 -15
- package/types/ids-group-ltd-ids-design-system-components-status-dot.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-stepper.d.ts +4 -6
- package/types/ids-group-ltd-ids-design-system-components-switch.d.ts +5 -9
- package/types/ids-group-ltd-ids-design-system-components-table-columns.d.ts +3 -7
- package/types/ids-group-ltd-ids-design-system-components-table-export.d.ts +4 -8
- package/types/ids-group-ltd-ids-design-system-components-table-resize.d.ts +9 -43
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +160 -369
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +21 -49
- package/types/ids-group-ltd-ids-design-system-components-tag.d.ts +5 -5
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +17 -34
- package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +17 -38
- package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +20 -37
- package/types/ids-group-ltd-ids-design-system-components-toggle-button.d.ts +2 -3
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +17 -36
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-w3w.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-waterfall-chart.d.ts +21 -70
- package/types/ids-group-ltd-ids-design-system-components.d.ts +262 -415
- package/types/ids-group-ltd-ids-design-system-core.d.ts +134 -260
- package/types/ids-group-ltd-ids-design-system-icons.d.ts +2 -24
- package/types/ids-group-ltd-ids-design-system-overlay.d.ts +4 -13
- package/types/ids-group-ltd-ids-design-system-theme.d.ts +4 -6
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, booleanAttribute, inject, ElementRef, NgZone, effect, ViewEncapsulation, Component } from '@angular/core';
|
|
3
3
|
|
|
4
|
-
// The shimmer animates `background-position
|
|
5
|
-
//
|
|
6
|
-
// ones out of view.
|
|
4
|
+
// The shimmer animates `background-position` on the main thread even off screen; one shared
|
|
5
|
+
// observer pauses the skeletons out of view.
|
|
7
6
|
let offscreenObserver = null;
|
|
8
7
|
function observeVisibility(host, zone) {
|
|
9
8
|
offscreenObserver ??= zone.runOutsideAngular(() => new IntersectionObserver((entries) => {
|
|
@@ -16,17 +15,15 @@ function observeVisibility(host, zone) {
|
|
|
16
15
|
return () => observer.unobserve(host);
|
|
17
16
|
}
|
|
18
17
|
class SkeletonComponent {
|
|
19
|
-
/** CSS width
|
|
18
|
+
/** CSS width, e.g. `'120px'` or `'50%'`. */
|
|
20
19
|
width = input(undefined, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
21
|
-
/** CSS height
|
|
20
|
+
/** CSS height. */
|
|
22
21
|
height = input(undefined, ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
23
22
|
/** Pill radius, for avatar/dot-shaped placeholders. */
|
|
24
23
|
circle = input(false, { ...(ngDevMode ? { debugName: "circle" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
25
24
|
/** `display: inline-block` instead of `block`, to sit inline with text. */
|
|
26
25
|
inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
27
|
-
/** Whether the wave passes over the placeholder
|
|
28
|
-
* same shape and size - for a space held for something that is not loading yet, where motion
|
|
29
|
-
* would claim work that is not happening and cost a main-thread update a frame. */
|
|
26
|
+
/** Whether the wave passes over the placeholder; off, it is a flat block of the same shape. */
|
|
30
27
|
shimmer = input(true, { ...(ngDevMode ? { debugName: "shimmer" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
31
28
|
constructor() {
|
|
32
29
|
if (typeof IntersectionObserver === 'undefined') {
|
|
@@ -34,8 +31,7 @@ class SkeletonComponent {
|
|
|
34
31
|
}
|
|
35
32
|
const host = inject(ElementRef).nativeElement;
|
|
36
33
|
const zone = inject(NgZone);
|
|
37
|
-
//
|
|
38
|
-
// intersection the browser computes on each scrolled frame.
|
|
34
|
+
// Each observed skeleton costs an intersection computation per scrolled frame; a still one has nothing to pause.
|
|
39
35
|
effect((onCleanup) => {
|
|
40
36
|
if (this.shimmer()) {
|
|
41
37
|
onCleanup(observeVisibility(host, zone));
|
|
@@ -43,7 +39,7 @@ class SkeletonComponent {
|
|
|
43
39
|
});
|
|
44
40
|
}
|
|
45
41
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
46
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.22", type: SkeletonComponent, isStandalone: true, selector: "ds-skeleton", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, circle: { classPropertyName: "circle", publicName: "circle", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, shimmer: { classPropertyName: "shimmer", publicName: "shimmer", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "style.width": "width()", "style.height": "height()", "class.circle": "circle()", "class.inline": "inline()", "class.still": "!shimmer()" } }, ngImport: i0, template: '', isInline: true, styles: ["
|
|
42
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.22", type: SkeletonComponent, isStandalone: true, selector: "ds-skeleton", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, circle: { classPropertyName: "circle", publicName: "circle", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, shimmer: { classPropertyName: "shimmer", publicName: "shimmer", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "style.width": "width()", "style.height": "height()", "class.circle": "circle()", "class.inline": "inline()", "class.still": "!shimmer()" } }, ngImport: i0, template: '', isInline: true, styles: [":host{--_skeleton-bg-color: var(--ds-skeleton-bg-color, var(--surface-secondary));--_skeleton-shimmer-color: var(--ds-skeleton-shimmer-color, var(--surface-muted));--_skeleton-wave-period: var(--ds-skeleton-wave-period, 56rem);--_skeleton-wave-duration: var(--ds-skeleton-wave-duration, 3.4s);--_skeleton-wave-steps: var(--ds-skeleton-wave-steps, 68);--_skeleton-wave-angle: var(--ds-skeleton-wave-angle, 135deg);--_skeleton-wave-fade: rgb(from var(--_skeleton-shimmer-color) r g b / 0%);--_skeleton-wave-echo-color: var( --ds-skeleton-wave-echo-color, color-mix(in srgb, var(--_skeleton-shimmer-color) 30%, transparent) );display:block;position:relative;overflow:hidden;background:var(--_skeleton-bg-color);border-radius:var(--radius-md)}:host(.circle){border-radius:var(--radius-pill)}:host(.inline){display:inline-block;vertical-align:middle}:host:after{content:\"\";position:absolute;inset:0;pointer-events:none;background-image:repeating-linear-gradient(var(--_skeleton-wave-angle),var(--_skeleton-wave-echo-color) 0,var(--_skeleton-wave-fade) calc(var(--_skeleton-wave-period) / 4),var(--_skeleton-shimmer-color) calc(var(--_skeleton-wave-period) / 2),var(--_skeleton-wave-fade) calc(var(--_skeleton-wave-period) * .75),var(--_skeleton-wave-echo-color) var(--_skeleton-wave-period));background-size:calc(var(--_skeleton-wave-period) * 1.4142) calc(var(--_skeleton-wave-period) * 1.4142);background-attachment:fixed;animation:ds-skeleton-shimmer-loop var(--_skeleton-wave-duration) steps(var(--_skeleton-wave-steps)) infinite}:host(.is-offscreen):after{animation-play-state:paused}:host(.still):after{animation:none}@keyframes ds-skeleton-shimmer-loop{0%{background-position:0 0}to{background-position:calc(var(--_skeleton-wave-period) / 1.4142) calc(var(--_skeleton-wave-period) / 1.4142)}}\n"] });
|
|
47
43
|
}
|
|
48
44
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SkeletonComponent, decorators: [{
|
|
49
45
|
type: Component,
|
|
@@ -54,7 +50,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
54
50
|
'[class.circle]': 'circle()',
|
|
55
51
|
'[class.inline]': 'inline()',
|
|
56
52
|
'[class.still]': '!shimmer()',
|
|
57
|
-
}, encapsulation: ViewEncapsulation.Emulated, styles: ["
|
|
53
|
+
}, encapsulation: ViewEncapsulation.Emulated, styles: [":host{--_skeleton-bg-color: var(--ds-skeleton-bg-color, var(--surface-secondary));--_skeleton-shimmer-color: var(--ds-skeleton-shimmer-color, var(--surface-muted));--_skeleton-wave-period: var(--ds-skeleton-wave-period, 56rem);--_skeleton-wave-duration: var(--ds-skeleton-wave-duration, 3.4s);--_skeleton-wave-steps: var(--ds-skeleton-wave-steps, 68);--_skeleton-wave-angle: var(--ds-skeleton-wave-angle, 135deg);--_skeleton-wave-fade: rgb(from var(--_skeleton-shimmer-color) r g b / 0%);--_skeleton-wave-echo-color: var( --ds-skeleton-wave-echo-color, color-mix(in srgb, var(--_skeleton-shimmer-color) 30%, transparent) );display:block;position:relative;overflow:hidden;background:var(--_skeleton-bg-color);border-radius:var(--radius-md)}:host(.circle){border-radius:var(--radius-pill)}:host(.inline){display:inline-block;vertical-align:middle}:host:after{content:\"\";position:absolute;inset:0;pointer-events:none;background-image:repeating-linear-gradient(var(--_skeleton-wave-angle),var(--_skeleton-wave-echo-color) 0,var(--_skeleton-wave-fade) calc(var(--_skeleton-wave-period) / 4),var(--_skeleton-shimmer-color) calc(var(--_skeleton-wave-period) / 2),var(--_skeleton-wave-fade) calc(var(--_skeleton-wave-period) * .75),var(--_skeleton-wave-echo-color) var(--_skeleton-wave-period));background-size:calc(var(--_skeleton-wave-period) * 1.4142) calc(var(--_skeleton-wave-period) * 1.4142);background-attachment:fixed;animation:ds-skeleton-shimmer-loop var(--_skeleton-wave-duration) steps(var(--_skeleton-wave-steps)) infinite}:host(.is-offscreen):after{animation-play-state:paused}:host(.still):after{animation:none}@keyframes ds-skeleton-shimmer-loop{0%{background-position:0 0}to{background-position:calc(var(--_skeleton-wave-period) / 1.4142) calc(var(--_skeleton-wave-period) / 1.4142)}}\n"] }]
|
|
58
54
|
}], ctorParameters: () => [], propDecorators: { width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], circle: [{ type: i0.Input, args: [{ isSignal: true, alias: "circle", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], shimmer: [{ type: i0.Input, args: [{ isSignal: true, alias: "shimmer", required: false }] }] } });
|
|
59
55
|
|
|
60
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-skeleton.mjs","sources":["../../../src/lib/components/skeleton/skeleton.component.ts","../../../src/lib/components/skeleton/ids-group-ltd-ids-design-system-components-skeleton.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n NgZone,\n ViewEncapsulation,\n booleanAttribute,\n effect,\n inject,\n input,\n} from '@angular/core';\n\n// The shimmer animates `background-position
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-skeleton.mjs","sources":["../../../src/lib/components/skeleton/skeleton.component.ts","../../../src/lib/components/skeleton/ids-group-ltd-ids-design-system-components-skeleton.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n NgZone,\n ViewEncapsulation,\n booleanAttribute,\n effect,\n inject,\n input,\n} from '@angular/core';\n\n// The shimmer animates `background-position` on the main thread even off screen; one shared\n// observer pauses the skeletons out of view.\nlet offscreenObserver: IntersectionObserver | null = null;\n\nfunction observeVisibility(host: Element, zone: NgZone): () => void {\n offscreenObserver ??= zone.runOutsideAngular(\n () =>\n new IntersectionObserver((entries) => {\n for (const entry of entries) {\n entry.target.classList.toggle('is-offscreen', !entry.isIntersecting);\n }\n }),\n );\n const observer = offscreenObserver;\n observer.observe(host);\n\n return () => observer.unobserve(host);\n}\n\n@Component({\n selector: 'ds-skeleton',\n standalone: true,\n template: '',\n styleUrl: './skeleton.component.scss',\n host: {\n 'aria-hidden': 'true',\n '[style.width]': 'width()',\n '[style.height]': 'height()',\n '[class.circle]': 'circle()',\n '[class.inline]': 'inline()',\n '[class.still]': '!shimmer()',\n },\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class SkeletonComponent {\n /** CSS width, e.g. `'120px'` or `'50%'`. */\n readonly width = input<string | undefined>(undefined);\n /** CSS height. */\n readonly height = input<string | undefined>(undefined);\n /** Pill radius, for avatar/dot-shaped placeholders. */\n readonly circle = input(false, { transform: booleanAttribute });\n /** `display: inline-block` instead of `block`, to sit inline with text. */\n readonly inline = input(false, { transform: booleanAttribute });\n /** Whether the wave passes over the placeholder; off, it is a flat block of the same shape. */\n readonly shimmer = input(true, { transform: booleanAttribute });\n\n constructor() {\n if (typeof IntersectionObserver === 'undefined') {\n return;\n }\n const host = inject<ElementRef<Element>>(ElementRef).nativeElement;\n const zone = inject(NgZone);\n // Each observed skeleton costs an intersection computation per scrolled frame; a still one has nothing to pause.\n effect((onCleanup) => {\n if (this.shimmer()) {\n onCleanup(observeVisibility(host, zone));\n }\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAWA;AACA;AACA,IAAI,iBAAiB,GAAgC,IAAI;AAEzD,SAAS,iBAAiB,CAAC,IAAa,EAAE,IAAY,EAAA;AACpD,IAAA,iBAAiB,KAAK,IAAI,CAAC,iBAAiB,CAC1C,MACE,IAAI,oBAAoB,CAAC,CAAC,OAAO,KAA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,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,iBAAiB,s4BAZlB,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,wwDAAA,CAAA,EAAA,CAAA;;4FAYD,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAf7B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,EAAA,UAAA,EACX,IAAI,EAAA,QAAA,EACN,EAAE,EAAA,IAAA,EAEN;AACJ,wBAAA,aAAa,EAAE,MAAM;AACrB,wBAAA,eAAe,EAAE,SAAS;AAC1B,wBAAA,gBAAgB,EAAE,UAAU;AAC5B,wBAAA,gBAAgB,EAAE,UAAU;AAC5B,wBAAA,gBAAgB,EAAE,UAAU;AAC5B,wBAAA,eAAe,EAAE,YAAY;qBAC9B,EAAA,aAAA,EACc,iBAAiB,CAAC,QAAQ,EAAA,MAAA,EAAA,CAAA,wwDAAA,CAAA,EAAA;;;AC3C3C;;AAEG;;;;"}
|
|
@@ -7,19 +7,19 @@ import { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/componen
|
|
|
7
7
|
|
|
8
8
|
class SliderComponent extends DsControlValueAccessor {
|
|
9
9
|
intl = inject(DS_INTL);
|
|
10
|
-
/** Current value, or `[low, high]` when `range`.
|
|
10
|
+
/** Current value, or `[low, high]` when `range`. */
|
|
11
11
|
value = model(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
12
12
|
/** Minimum selectable value. */
|
|
13
13
|
min = input(0, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
14
14
|
/** Maximum selectable value. */
|
|
15
15
|
max = input(100, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
16
|
-
/**
|
|
16
|
+
/** Snap increment for dragging and arrow keys. */
|
|
17
17
|
step = input(1, { ...(ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
18
|
-
/** Two-thumb
|
|
18
|
+
/** Two-thumb mode: `value` becomes a `[low, high]` tuple. */
|
|
19
19
|
range = input(false, { ...(ngDevMode ? { debugName: "range" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
20
20
|
/** Disables the slider and blocks all interaction. */
|
|
21
21
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
22
|
-
/** Accessible name
|
|
22
|
+
/** Accessible name of the thumb(s); suffixed "minimum"/"maximum" in `range` mode. */
|
|
23
23
|
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
24
24
|
track = viewChild.required('track');
|
|
25
25
|
dragging = -1;
|
|
@@ -82,9 +82,8 @@ class SliderComponent extends DsControlValueAccessor {
|
|
|
82
82
|
}
|
|
83
83
|
this.updateFromClientX(event.clientX);
|
|
84
84
|
}
|
|
85
|
-
// Bound to
|
|
86
|
-
//
|
|
87
|
-
// would leak and keep moving the thumb with no pointer down.
|
|
85
|
+
// Bound to pointerup and pointercancel: touch interventions fire pointercancel, and without it
|
|
86
|
+
// the drag state leaks and keeps moving the thumb with no pointer down.
|
|
88
87
|
onTrackPointerUp(event) {
|
|
89
88
|
if (this.dragging < 0) {
|
|
90
89
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-slider.mjs","sources":["../../../src/lib/components/slider/slider.component.ts","../../../src/lib/components/slider/slider.component.html","../../../src/lib/components/slider/ids-group-ltd-ids-design-system-components-slider.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n model,\n numberAttribute,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/core';\nimport { DsControlValueAccessor } from '@ids-group-ltd/ids-design-system/components';\nimport { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';\nimport { resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\n\ntype SliderValue = number | readonly [number, number];\n\n@Component({\n selector: 'ds-slider',\n standalone: true,\n imports: [FieldMessageComponent],\n templateUrl: './slider.component.html',\n styleUrl: './slider.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SliderComponent),\n multi: true,\n },\n ],\n host: {\n '[class.range]': 'range()',\n '[class.disabled]': 'isDisabled()',\n '[class.invalid]': 'invalidResolved()',\n },\n})\nexport class SliderComponent extends DsControlValueAccessor<SliderValue> {\n protected readonly intl = inject(DS_INTL);\n /** Current value, or `[low, high]` when `range`. Two-way bound. */\n readonly value = model<SliderValue>(0);\n /** Minimum selectable value. */\n readonly min = input(0, { transform: numberAttribute });\n /** Maximum selectable value. */\n readonly max = input(100, { transform: numberAttribute });\n /** Increment applied when dragging (snap) or nudging with arrow keys. */\n readonly step = input(1, { transform: numberAttribute });\n /** Two-thumb range mode — `value` becomes a `[low, high]` tuple. */\n readonly range = input(false, { transform: booleanAttribute });\n /** Disables the slider and blocks all interaction. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Accessible name for the thumb(s) — suffixed \"minimum\"/\"maximum\" in `range` mode. */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly track = viewChild.required<ElementRef<HTMLElement>>('track');\n private dragging = -1;\n\n protected readonly uid = nextControlId('ds-slider');\n protected readonly hintId = computed(() =>\n this.message().text ? `${this.uid}-hint` : null,\n );\n private readonly fieldMessage = resolveFieldMessage({\n disabled: () => this.isDisabled(),\n hint: this.hint,\n warning: this.warning,\n error: this.error,\n errors: this.errors,\n invalid: this.invalid,\n touchedSelf: this.touchedSelf,\n touched: this.touched,\n });\n protected readonly message = this.fieldMessage.message;\n protected readonly invalidResolved = this.fieldMessage.invalid;\n\n protected readonly isDisabled = computed(\n () => this.disabled() || this.formDisabled(),\n );\n\n protected readonly thumbValues = computed<number[]>(() => {\n const value = this.value();\n if (this.range()) {\n const [low, high] = value as readonly [number, number];\n\n return [low, high];\n }\n\n return [value as number];\n });\n\n protected readonly fill = computed<{ left: number; width: number }>(() => {\n const values = this.thumbValues();\n if (this.range()) {\n const low = this.percent(values[0]);\n const high = this.percent(values[1]);\n\n return { left: low, width: high - low };\n }\n\n return { left: 0, width: this.percent(values[0]) };\n });\n\n protected percent(value: number): number {\n const min = this.min();\n const max = this.max();\n\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n }\n\n protected thumbMin(index: number): number {\n return this.range() && index === 1 ? this.thumbValues()[0] : this.min();\n }\n\n protected thumbMax(index: number): number {\n return this.range() && index === 0 ? this.thumbValues()[1] : this.max();\n }\n\n protected onTrackPointerDown(event: PointerEvent): void {\n if (this.isDisabled()) {\n return;\n }\n const track = this.track().nativeElement;\n track.setPointerCapture(event.pointerId);\n this.dragging = this.nearestThumb(event.clientX);\n this.updateFromClientX(event.clientX);\n track.querySelectorAll<HTMLElement>('.thumb')[this.dragging]?.focus();\n }\n\n protected onTrackPointerMove(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n this.updateFromClientX(event.clientX);\n }\n\n // Bound to both pointerup and pointercancel — touch interventions (scroll\n // takeover, stylus lift) fire pointercancel, and without it the drag state\n // would leak and keep moving the thumb with no pointer down.\n protected onTrackPointerUp(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n const track = this.track().nativeElement;\n if (track.hasPointerCapture(event.pointerId)) {\n track.releasePointerCapture(event.pointerId);\n }\n this.dragging = -1;\n this.markTouched();\n }\n\n protected thumbAriaLabel(index: number): string | null {\n const base = this.ariaLabel();\n if (!this.range()) {\n return base;\n }\n\n return index === 0\n ? this.intl().slider.rangeStart(base ?? '')\n : this.intl().slider.rangeEnd(base ?? '');\n }\n\n protected onThumbKeydown(event: KeyboardEvent, index: number): void {\n if (this.isDisabled()) {\n return;\n }\n const step = this.step() || 1;\n let delta = 0;\n let absolute: number | null = null;\n switch (event.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n delta = step;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n delta = -step;\n break;\n case 'PageUp':\n delta = step * 10;\n break;\n case 'PageDown':\n delta = -step * 10;\n break;\n case 'Home':\n absolute = this.thumbMin(index);\n break;\n case 'End':\n absolute = this.thumbMax(index);\n break;\n default:\n return;\n }\n event.preventDefault();\n const current = this.thumbValues()[index];\n this.setThumb(index, absolute ?? this.snap(current + delta));\n }\n\n private nearestThumb(clientX: number): number {\n if (!this.range()) {\n return 0;\n }\n const value = this.valueFromClientX(clientX);\n const [low, high] = this.thumbValues();\n\n return Math.abs(value - low) <= Math.abs(value - high) ? 0 : 1;\n }\n\n private updateFromClientX(clientX: number): void {\n this.setThumb(this.dragging, this.snap(this.valueFromClientX(clientX)));\n }\n\n private valueFromClientX(clientX: number): number {\n const rect = this.track().nativeElement.getBoundingClientRect();\n if (rect.width === 0) {\n return this.min();\n }\n const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));\n\n return this.min() + ratio * (this.max() - this.min());\n }\n\n private setThumb(index: number, next: number): void {\n if (this.range()) {\n const [low, high] = this.thumbValues();\n this.value.set(\n index === 0 ? [Math.min(next, high), high] : [low, Math.max(next, low)],\n );\n } else {\n this.value.set(next);\n }\n }\n\n private snap(raw: number): number {\n const step = this.step() || 1;\n const min = this.min();\n const snapped = Math.round((raw - min) / step) * step + min;\n\n return Math.min(this.max(), Math.max(min, snapped));\n }\n}\n","<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA0CM,MAAO,eAAgB,SAAQ,sBAAmC,CAAA;AACnD,IAAA,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;;AAEhC,IAAA,KAAK,GAAG,KAAK,CAAc,CAAC,4EAAC;;IAE7B,GAAG,GAAG,KAAK,CAAC,CAAC,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAE9C,GAAG,GAAG,KAAK,CAAC,GAAG,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAEhD,IAAI,GAAG,KAAK,CAAC,CAAC,4EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAE/C,KAAK,GAAG,KAAK,CAAC,KAAK,6EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAErD,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAExD,IAAA,SAAS,GAAG,KAAK,CAAgB,IAAI,gFAA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AAA,EAAA,WAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECnCH,isCAsCA,8yFDbY,qBAAqB,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,OAAA,EAAA,WAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAiBpB,eAAe,EAAA,UAAA,EAAA,CAAA;kBApB3B,SAAS;+BACE,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,OAAA,EACP,CAAC,qBAAqB,CAAC,EAAA,aAAA,EAGjB,iBAAiB,CAAC,QAAQ,EAAA,SAAA,EAC9B;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,qBAAqB,CAAC;AAC9C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EAAA,IAAA,EACK;AACJ,wBAAA,eAAe,EAAE,SAAS;AAC1B,wBAAA,kBAAkB,EAAE,cAAc;AAClC,wBAAA,iBAAiB,EAAE,mBAAmB;AACvC,qBAAA,EAAA,QAAA,EAAA,isCAAA,EAAA,MAAA,EAAA,CAAA,svFAAA,CAAA,EAAA;yuBAmBoE,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3D9E;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-slider.mjs","sources":["../../../src/lib/components/slider/slider.component.ts","../../../src/lib/components/slider/slider.component.html","../../../src/lib/components/slider/ids-group-ltd-ids-design-system-components-slider.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n model,\n numberAttribute,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/core';\nimport { DsControlValueAccessor } from '@ids-group-ltd/ids-design-system/components';\nimport { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';\nimport { resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\n\ntype SliderValue = number | readonly [number, number];\n\n@Component({\n selector: 'ds-slider',\n standalone: true,\n imports: [FieldMessageComponent],\n templateUrl: './slider.component.html',\n styleUrl: './slider.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SliderComponent),\n multi: true,\n },\n ],\n host: {\n '[class.range]': 'range()',\n '[class.disabled]': 'isDisabled()',\n '[class.invalid]': 'invalidResolved()',\n },\n})\nexport class SliderComponent extends DsControlValueAccessor<SliderValue> {\n protected readonly intl = inject(DS_INTL);\n /** Current value, or `[low, high]` when `range`. */\n readonly value = model<SliderValue>(0);\n /** Minimum selectable value. */\n readonly min = input(0, { transform: numberAttribute });\n /** Maximum selectable value. */\n readonly max = input(100, { transform: numberAttribute });\n /** Snap increment for dragging and arrow keys. */\n readonly step = input(1, { transform: numberAttribute });\n /** Two-thumb mode: `value` becomes a `[low, high]` tuple. */\n readonly range = input(false, { transform: booleanAttribute });\n /** Disables the slider and blocks all interaction. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Accessible name of the thumb(s); suffixed \"minimum\"/\"maximum\" in `range` mode. */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly track = viewChild.required<ElementRef<HTMLElement>>('track');\n private dragging = -1;\n\n protected readonly uid = nextControlId('ds-slider');\n protected readonly hintId = computed(() =>\n this.message().text ? `${this.uid}-hint` : null,\n );\n private readonly fieldMessage = resolveFieldMessage({\n disabled: () => this.isDisabled(),\n hint: this.hint,\n warning: this.warning,\n error: this.error,\n errors: this.errors,\n invalid: this.invalid,\n touchedSelf: this.touchedSelf,\n touched: this.touched,\n });\n protected readonly message = this.fieldMessage.message;\n protected readonly invalidResolved = this.fieldMessage.invalid;\n\n protected readonly isDisabled = computed(\n () => this.disabled() || this.formDisabled(),\n );\n\n protected readonly thumbValues = computed<number[]>(() => {\n const value = this.value();\n if (this.range()) {\n const [low, high] = value as readonly [number, number];\n\n return [low, high];\n }\n\n return [value as number];\n });\n\n protected readonly fill = computed<{ left: number; width: number }>(() => {\n const values = this.thumbValues();\n if (this.range()) {\n const low = this.percent(values[0]);\n const high = this.percent(values[1]);\n\n return { left: low, width: high - low };\n }\n\n return { left: 0, width: this.percent(values[0]) };\n });\n\n protected percent(value: number): number {\n const min = this.min();\n const max = this.max();\n\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n }\n\n protected thumbMin(index: number): number {\n return this.range() && index === 1 ? this.thumbValues()[0] : this.min();\n }\n\n protected thumbMax(index: number): number {\n return this.range() && index === 0 ? this.thumbValues()[1] : this.max();\n }\n\n protected onTrackPointerDown(event: PointerEvent): void {\n if (this.isDisabled()) {\n return;\n }\n const track = this.track().nativeElement;\n track.setPointerCapture(event.pointerId);\n this.dragging = this.nearestThumb(event.clientX);\n this.updateFromClientX(event.clientX);\n track.querySelectorAll<HTMLElement>('.thumb')[this.dragging]?.focus();\n }\n\n protected onTrackPointerMove(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n this.updateFromClientX(event.clientX);\n }\n\n // Bound to pointerup and pointercancel: touch interventions fire pointercancel, and without it\n // the drag state leaks and keeps moving the thumb with no pointer down.\n protected onTrackPointerUp(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n const track = this.track().nativeElement;\n if (track.hasPointerCapture(event.pointerId)) {\n track.releasePointerCapture(event.pointerId);\n }\n this.dragging = -1;\n this.markTouched();\n }\n\n protected thumbAriaLabel(index: number): string | null {\n const base = this.ariaLabel();\n if (!this.range()) {\n return base;\n }\n\n return index === 0\n ? this.intl().slider.rangeStart(base ?? '')\n : this.intl().slider.rangeEnd(base ?? '');\n }\n\n protected onThumbKeydown(event: KeyboardEvent, index: number): void {\n if (this.isDisabled()) {\n return;\n }\n const step = this.step() || 1;\n let delta = 0;\n let absolute: number | null = null;\n switch (event.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n delta = step;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n delta = -step;\n break;\n case 'PageUp':\n delta = step * 10;\n break;\n case 'PageDown':\n delta = -step * 10;\n break;\n case 'Home':\n absolute = this.thumbMin(index);\n break;\n case 'End':\n absolute = this.thumbMax(index);\n break;\n default:\n return;\n }\n event.preventDefault();\n const current = this.thumbValues()[index];\n this.setThumb(index, absolute ?? this.snap(current + delta));\n }\n\n private nearestThumb(clientX: number): number {\n if (!this.range()) {\n return 0;\n }\n const value = this.valueFromClientX(clientX);\n const [low, high] = this.thumbValues();\n\n return Math.abs(value - low) <= Math.abs(value - high) ? 0 : 1;\n }\n\n private updateFromClientX(clientX: number): void {\n this.setThumb(this.dragging, this.snap(this.valueFromClientX(clientX)));\n }\n\n private valueFromClientX(clientX: number): number {\n const rect = this.track().nativeElement.getBoundingClientRect();\n if (rect.width === 0) {\n return this.min();\n }\n const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));\n\n return this.min() + ratio * (this.max() - this.min());\n }\n\n private setThumb(index: number, next: number): void {\n if (this.range()) {\n const [low, high] = this.thumbValues();\n this.value.set(\n index === 0 ? [Math.min(next, high), high] : [low, Math.max(next, low)],\n );\n } else {\n this.value.set(next);\n }\n }\n\n private snap(raw: number): number {\n const step = this.step() || 1;\n const min = this.min();\n const snapped = Math.round((raw - min) / step) * step + min;\n\n return Math.min(this.max(), Math.max(min, snapped));\n }\n}\n","<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA0CM,MAAO,eAAgB,SAAQ,sBAAmC,CAAA;AACnD,IAAA,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;;AAEhC,IAAA,KAAK,GAAG,KAAK,CAAc,CAAC,4EAAC;;IAE7B,GAAG,GAAG,KAAK,CAAC,CAAC,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAE9C,GAAG,GAAG,KAAK,CAAC,GAAG,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAEhD,IAAI,GAAG,KAAK,CAAC,CAAC,4EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAE/C,KAAK,GAAG,KAAK,CAAC,KAAK,6EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAErD,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAExD,IAAA,SAAS,GAAG,KAAK,CAAgB,IAAI,gFA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AAA,EAAA,WAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECnCH,isCAsCA,8yFDbY,qBAAqB,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,OAAA,EAAA,WAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAiBpB,eAAe,EAAA,UAAA,EAAA,CAAA;kBApB3B,SAAS;+BACE,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,OAAA,EACP,CAAC,qBAAqB,CAAC,EAAA,aAAA,EAGjB,iBAAiB,CAAC,QAAQ,EAAA,SAAA,EAC9B;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,qBAAqB,CAAC;AAC9C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EAAA,IAAA,EACK;AACJ,wBAAA,eAAe,EAAE,SAAS;AAC1B,wBAAA,kBAAkB,EAAE,cAAc;AAClC,wBAAA,iBAAiB,EAAE,mBAAmB;AACvC,qBAAA,EAAA,QAAA,EAAA,isCAAA,EAAA,MAAA,EAAA,CAAA,svFAAA,CAAA,EAAA;yuBAmBoE,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3D9E;;AAEG;;;;"}
|
|
@@ -7,13 +7,15 @@ import { ChartTooltipDirective } from '@ids-group-ltd/ids-design-system/componen
|
|
|
7
7
|
function sparklineGeometry(data, scale) {
|
|
8
8
|
const finite = data.filter((value) => value !== null && Number.isFinite(value));
|
|
9
9
|
if (finite.length === 0) {
|
|
10
|
-
return { path: '', points: [] };
|
|
10
|
+
return { path: '', areaPath: '', points: [] };
|
|
11
11
|
}
|
|
12
12
|
const floor = scale === 'zero' ? Math.min(0, ...finite) : Math.min(...finite);
|
|
13
13
|
const ceiling = scale === 'zero' ? Math.max(0, ...finite) : Math.max(...finite);
|
|
14
14
|
const span = ceiling - floor;
|
|
15
15
|
const lastIndex = data.length - 1;
|
|
16
|
+
const baseline = scale === 'zero' && span > 0 ? (ceiling / span) * 100 : 100;
|
|
16
17
|
const points = [];
|
|
18
|
+
const runs = [];
|
|
17
19
|
let path = '';
|
|
18
20
|
let penDown = false;
|
|
19
21
|
data.forEach((value, index) => {
|
|
@@ -23,27 +25,41 @@ function sparklineGeometry(data, scale) {
|
|
|
23
25
|
}
|
|
24
26
|
const x = lastIndex === 0 ? 50 : (index / lastIndex) * 100;
|
|
25
27
|
const y = span === 0 ? 50 : ((ceiling - value) / span) * 100;
|
|
26
|
-
|
|
28
|
+
const point = { index, x, y };
|
|
29
|
+
points.push(point);
|
|
30
|
+
if (penDown) {
|
|
31
|
+
runs[runs.length - 1].push(point);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
runs.push([point]);
|
|
35
|
+
}
|
|
27
36
|
path += `${penDown ? 'L' : 'M'}${x} ${y}`;
|
|
28
37
|
penDown = true;
|
|
29
38
|
});
|
|
30
|
-
|
|
39
|
+
const areaPath = runs
|
|
40
|
+
.map((run) => `M${run[0].x} ${baseline}` +
|
|
41
|
+
run.map((point) => `L${point.x} ${point.y}`).join('') +
|
|
42
|
+
`L${run[run.length - 1].x} ${baseline}Z`)
|
|
43
|
+
.join('');
|
|
44
|
+
return { path, areaPath, points };
|
|
31
45
|
}
|
|
32
46
|
|
|
33
|
-
/** A word-sized trend line: no axes,
|
|
34
|
-
*
|
|
35
|
-
* `--ds-sparkline-height`. */
|
|
47
|
+
/** A word-sized trend line: no axes, legend or frame, a dot on the last reading, and a tooltip.
|
|
48
|
+
* Sized by `--ds-sparkline-width` and `--ds-sparkline-height`. */
|
|
36
49
|
class SparklineComponent {
|
|
50
|
+
/** Fills the band under the line down to the baseline. The colour is
|
|
51
|
+
* `--ds-sparkline-area-color`, the line's own by default, at `--ds-sparkline-area-opacity`. */
|
|
52
|
+
area = input(false, { ...(ngDevMode ? { debugName: "area" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
37
53
|
/** One reading per step, oldest first. `null` breaks the line. */
|
|
38
|
-
data = input
|
|
54
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
39
55
|
/** What each reading is, for the tooltip. Left out, the tooltip prints the value alone. */
|
|
40
56
|
categories = input([], ...(ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []));
|
|
41
57
|
/** Accessible name, and the series name in the tooltip. Left out, the sparkline is decorative
|
|
42
|
-
* and hidden from assistive technology
|
|
58
|
+
* and hidden from assistive technology. */
|
|
43
59
|
label = input(null, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
44
60
|
scale = input('data', ...(ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []));
|
|
45
|
-
/** Shows the reading under the pointer, and under the keyboard where `label` makes the
|
|
46
|
-
*
|
|
61
|
+
/** Shows the reading under the pointer, and under the keyboard where `label` makes the sparkline
|
|
62
|
+
* focusable: focus opens the last reading; arrows, Home and End move. */
|
|
47
63
|
tooltip = input(true, { ...(ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
48
64
|
/** Formats the value the tooltip prints. Unset, the locale's plain number format. */
|
|
49
65
|
valueFormat = input(null, ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
@@ -124,7 +140,7 @@ class SparklineComponent {
|
|
|
124
140
|
});
|
|
125
141
|
}
|
|
126
142
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SparklineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
127
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: SparklineComponent, isStandalone: true, selector: "ds-sparkline", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired:
|
|
143
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: SparklineComponent, isStandalone: true, selector: "ds-sparkline", inputs: { area: { classPropertyName: "area", publicName: "area", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, valueFormat: { classPropertyName: "valueFormat", publicName: "valueFormat", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "focus": "onFocus()", "blur": "clearActive()", "keydown": "onKeydown($event)" }, properties: { "attr.role": "label() ? 'img' : null", "attr.aria-label": "label()", "attr.aria-hidden": "label() ? null : 'true'", "attr.tabindex": "focusable() ? 0 : null" } }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true, isSignal: true }], ngImport: i0, template: "<svg\n #canvas\n class=\"sparkline\"\n aria-hidden=\"true\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"clearActive()\">\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\">\n @if (area()) {\n <path\n class=\"area\"\n [attr.d]=\"geometry().areaPath\" />\n }\n\n <path\n class=\"line\"\n [attr.d]=\"geometry().path\" />\n </svg>\n\n @if (shownPoint(); as point) {\n <circle\n class=\"dot\"\n [attr.cx]=\"point.x + '%'\"\n [attr.cy]=\"point.y + '%'\" />\n }\n</svg>\n", styles: [":where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_sparkline-width: var(--ds-sparkline-width, 80px);--_sparkline-height: var(--ds-sparkline-height, 24px);--_sparkline-line-color: var(--ds-sparkline-line-color, var(--ds-chart-series-1-color));--_sparkline-line-width: var(--ds-sparkline-line-width, 1.5px);--_sparkline-dot-radius: var(--ds-sparkline-dot-radius, 2.5px);--_sparkline-area-color: var(--ds-sparkline-area-color, var(--_sparkline-line-color));--_sparkline-area-opacity: var(--ds-sparkline-area-opacity, var(--ds-chart-area-opacity));display:inline-block;inline-size:var(--_sparkline-width);block-size:var(--_sparkline-height);vertical-align:middle}:host(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.sparkline{display:block;inline-size:100%;block-size:100%;overflow:visible}.area{fill:var(--_sparkline-area-color);fill-opacity:var(--_sparkline-area-opacity)}.line{fill:none;stroke:var(--_sparkline-line-color);stroke-width:var(--_sparkline-line-width);stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.dot{r:var(--_sparkline-dot-radius);fill:var(--_sparkline-line-color)}@media(forced-colors:active){.line{stroke:CanvasText}.dot{fill:CanvasText}}\n"], dependencies: [{ kind: "directive", type: ChartTooltipDirective, selector: "[dsChartTooltip]", inputs: ["dsChartTooltip", "dsChartTooltipOrigin", "dsChartTooltipTemplate", "dsChartTooltipExtraGap", "dsChartTooltipPinned", "dsChartTooltipSwatches"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
128
144
|
}
|
|
129
145
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SparklineComponent, decorators: [{
|
|
130
146
|
type: Component,
|
|
@@ -136,8 +152,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
136
152
|
'(focus)': 'onFocus()',
|
|
137
153
|
'(blur)': 'clearActive()',
|
|
138
154
|
'(keydown)': 'onKeydown($event)',
|
|
139
|
-
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg\n #canvas\n class=\"sparkline\"\n aria-hidden=\"true\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"clearActive()\">\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\">\n <path\n class=\"line\"\n [attr.d]=\"geometry().path\" />\n </svg>\n\n @if (shownPoint(); as point) {\n <circle\n class=\"dot\"\n [attr.cx]=\"point.x + '%'\"\n [attr.cy]=\"point.y + '%'\" />\n }\n</svg>\n", styles: [":where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_sparkline-width: var(--ds-sparkline-width, 80px);--_sparkline-height: var(--ds-sparkline-height, 24px);--_sparkline-line-color: var(--ds-sparkline-line-color, var(--ds-chart-series-1-color));--_sparkline-line-width: var(--ds-sparkline-line-width, 1.5px);--_sparkline-dot-radius: var(--ds-sparkline-dot-radius, 2.5px);display:inline-block;inline-size:var(--_sparkline-width);block-size:var(--_sparkline-height);vertical-align:middle}:host(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.sparkline{display:block;inline-size:100%;block-size:100%;overflow:visible}.line{fill:none;stroke:var(--_sparkline-line-color);stroke-width:var(--_sparkline-line-width);stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.dot{r:var(--_sparkline-dot-radius);fill:var(--_sparkline-line-color)}@media(forced-colors:active){.line{stroke:CanvasText}.dot{fill:CanvasText}}\n"] }]
|
|
140
|
-
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required:
|
|
155
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg\n #canvas\n class=\"sparkline\"\n aria-hidden=\"true\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"clearActive()\">\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\">\n @if (area()) {\n <path\n class=\"area\"\n [attr.d]=\"geometry().areaPath\" />\n }\n\n <path\n class=\"line\"\n [attr.d]=\"geometry().path\" />\n </svg>\n\n @if (shownPoint(); as point) {\n <circle\n class=\"dot\"\n [attr.cx]=\"point.x + '%'\"\n [attr.cy]=\"point.y + '%'\" />\n }\n</svg>\n", styles: [":where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_sparkline-width: var(--ds-sparkline-width, 80px);--_sparkline-height: var(--ds-sparkline-height, 24px);--_sparkline-line-color: var(--ds-sparkline-line-color, var(--ds-chart-series-1-color));--_sparkline-line-width: var(--ds-sparkline-line-width, 1.5px);--_sparkline-dot-radius: var(--ds-sparkline-dot-radius, 2.5px);--_sparkline-area-color: var(--ds-sparkline-area-color, var(--_sparkline-line-color));--_sparkline-area-opacity: var(--ds-sparkline-area-opacity, var(--ds-chart-area-opacity));display:inline-block;inline-size:var(--_sparkline-width);block-size:var(--_sparkline-height);vertical-align:middle}:host(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.sparkline{display:block;inline-size:100%;block-size:100%;overflow:visible}.area{fill:var(--_sparkline-area-color);fill-opacity:var(--_sparkline-area-opacity)}.line{fill:none;stroke:var(--_sparkline-line-color);stroke-width:var(--_sparkline-line-width);stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.dot{r:var(--_sparkline-dot-radius);fill:var(--_sparkline-line-color)}@media(forced-colors:active){.line{stroke:CanvasText}.dot{fill:CanvasText}}\n"] }]
|
|
156
|
+
}], propDecorators: { area: [{ type: i0.Input, args: [{ isSignal: true, alias: "area", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], categories: [{ type: i0.Input, args: [{ isSignal: true, alias: "categories", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], scale: [{ type: i0.Input, args: [{ isSignal: true, alias: "scale", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], valueFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueFormat", required: false }] }], canvas: [{ type: i0.ViewChild, args: ['canvas', { isSignal: true }] }] } });
|
|
141
157
|
|
|
142
158
|
/**
|
|
143
159
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-sparkline.mjs","sources":["../../../src/lib/components/sparkline/sparkline.math.ts","../../../src/lib/components/sparkline/sparkline.component.ts","../../../src/lib/components/sparkline/sparkline.component.html","../../../src/lib/components/sparkline/ids-group-ltd-ids-design-system-components-sparkline.ts"],"sourcesContent":["import type { SparklineScale } from './sparkline.types';\n\nexport interface SparklinePoint {\n readonly index: number;\n readonly x: number;\n readonly y: number;\n}\n\nexport interface SparklineGeometry {\n readonly path: string;\n readonly points: readonly SparklinePoint[];\n}\n\n/** Positions in percent of the box, x across the readings and y down from the top of the scale.\n * A flat series on the `'data'` scale draws through the middle. A `null` breaks the line. */\nexport function sparklineGeometry(\n data: readonly (number | null)[],\n scale: SparklineScale,\n): SparklineGeometry {\n const finite = data.filter(\n (value): value is number => value !== null && Number.isFinite(value),\n );\n if (finite.length === 0) {\n return { path: '', points: [] };\n }\n const floor = scale === 'zero' ? Math.min(0, ...finite) : Math.min(...finite);\n const ceiling =\n scale === 'zero' ? Math.max(0, ...finite) : Math.max(...finite);\n const span = ceiling - floor;\n const lastIndex = data.length - 1;\n const points: SparklinePoint[] = [];\n let path = '';\n let penDown = false;\n data.forEach((value, index) => {\n if (value === null || !Number.isFinite(value)) {\n penDown = false;\n\n return;\n }\n const x = lastIndex === 0 ? 50 : (index / lastIndex) * 100;\n const y = span === 0 ? 50 : ((ceiling - value) / span) * 100;\n points.push({ index, x, y });\n path += `${penDown ? 'L' : 'M'}${x} ${y}`;\n penDown = true;\n });\n\n return { path, points };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ChartTooltipDirective } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport type {\n ChartTooltipContext,\n ChartTooltipOrigin,\n} from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport { sparklineGeometry } from './sparkline.math';\nimport type { SparklinePoint } from './sparkline.math';\nimport type { SparklineScale } from './sparkline.types';\n\n/** A word-sized trend line: no axes, gridlines, legend or frame, a dot on the last reading, and a\n * tooltip naming the reading under the pointer. Sized by `--ds-sparkline-width` and\n * `--ds-sparkline-height`. */\n@Component({\n selector: 'ds-sparkline',\n standalone: true,\n imports: [ChartTooltipDirective],\n templateUrl: './sparkline.component.html',\n styleUrl: './sparkline.component.scss',\n host: {\n '[attr.role]': \"label() ? 'img' : null\",\n '[attr.aria-label]': 'label()',\n '[attr.aria-hidden]': \"label() ? null : 'true'\",\n '[attr.tabindex]': 'focusable() ? 0 : null',\n '(focus)': 'onFocus()',\n '(blur)': 'clearActive()',\n '(keydown)': 'onKeydown($event)',\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparklineComponent {\n /** One reading per step, oldest first. `null` breaks the line. */\n readonly data = input.required<readonly (number | null)[]>();\n\n /** What each reading is, for the tooltip. Left out, the tooltip prints the value alone. */\n readonly categories = input<readonly string[]>([]);\n\n /** Accessible name, and the series name in the tooltip. Left out, the sparkline is decorative\n * and hidden from assistive technology: it is then taken to sit beside a value that says it. */\n readonly label = input<string | null>(null);\n\n readonly scale = input<SparklineScale>('data');\n\n /** Shows the reading under the pointer, and under the keyboard where `label` makes the\n * sparkline focusable: focus opens the last reading, the arrow keys, Home and End move. */\n readonly tooltip = input(true, { transform: booleanAttribute });\n\n /** Formats the value the tooltip prints. Unset, the locale's plain number format. */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n private readonly locale = inject(LOCALE_ID);\n\n private readonly canvas =\n viewChild.required<ElementRef<SVGSVGElement>>('canvas');\n\n protected readonly focusable = computed(\n () => this.tooltip() && this.label() !== null,\n );\n\n protected readonly geometry = computed(() =>\n sparklineGeometry(this.data(), this.scale()),\n );\n\n protected readonly activePoint = signal<SparklinePoint | null>(null);\n\n protected readonly shownPoint = computed(\n () => this.activePoint() ?? this.geometry().points.at(-1) ?? null,\n );\n\n protected readonly tooltipOrigin = signal<ChartTooltipOrigin | null>(null);\n\n protected readonly tooltipContext = computed<ChartTooltipContext | null>(\n () => {\n const point = this.activePoint();\n const value = point ? this.data()[point.index] : null;\n if (!point || value == null || !this.tooltip()) {\n return null;\n }\n const format =\n this.valueFormat() ??\n ((reading: number) => reading.toLocaleString(this.locale));\n\n return {\n category: this.categories()[point.index] ?? '',\n entries: [\n {\n label: this.label() ?? '',\n value,\n formatted: format(value),\n color:\n 'var(--ds-sparkline-line-color, var(--ds-chart-series-1-color))',\n },\n ],\n };\n },\n );\n\n protected onPointerMove(event: PointerEvent): void {\n const points = this.geometry().points;\n if (!this.tooltip() || points.length === 0) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n const across = ((event.clientX - box.left) / box.width) * 100;\n this.activate(\n points.reduce((best, point) =>\n Math.abs(point.x - across) < Math.abs(best.x - across) ? point : best,\n ),\n );\n }\n\n protected onFocus(): void {\n const last = this.geometry().points.at(-1);\n if (this.focusable() && last) {\n this.activate(last);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const points = this.geometry().points;\n const current = this.activePoint();\n if (!this.focusable() || !current) {\n return;\n }\n const position = points.indexOf(current);\n const target = {\n ArrowLeft: position - 1,\n ArrowRight: position + 1,\n Home: 0,\n End: points.length - 1,\n }[event.key];\n if (target === undefined) {\n return;\n }\n event.preventDefault();\n this.activate(points[Math.min(Math.max(target, 0), points.length - 1)]);\n }\n\n protected clearActive(): void {\n this.activePoint.set(null);\n this.tooltipOrigin.set(null);\n }\n\n private activate(point: SparklinePoint): void {\n if (point === this.activePoint()) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n this.activePoint.set(point);\n this.tooltipOrigin.set({\n x: box.left + (point.x / 100) * box.width,\n y: box.top + (point.y / 100) * box.height,\n });\n }\n}\n","<svg\n #canvas\n class=\"sparkline\"\n aria-hidden=\"true\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"clearActive()\">\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\">\n <path\n class=\"line\"\n [attr.d]=\"geometry().path\" />\n </svg>\n\n @if (shownPoint(); as point) {\n <circle\n class=\"dot\"\n [attr.cx]=\"point.x + '%'\"\n [attr.cy]=\"point.y + '%'\" />\n }\n</svg>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAaA;AAC8F;AACxF,SAAU,iBAAiB,CAC/B,IAAg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A,EAAA,IAAA,EDEY,qBAAqB,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,gBAAA,EAAA,sBAAA,EAAA,wBAAA,EAAA,wBAAA,EAAA,sBAAA,EAAA,wBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAepB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAlB9B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,cAAc,cACZ,IAAI,EAAA,OAAA,EACP,CAAC,qBAAqB,CAAC,EAAA,IAAA,EAG1B;AACJ,wBAAA,aAAa,EAAE,wBAAwB;AACvC,wBAAA,mBAAmB,EAAE,SAAS;AAC9B,wBAAA,oBAAoB,EAAE,yBAAyB;AAC/C,wBAAA,iBAAiB,EAAE,wBAAwB;AAC3C,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,QAAQ,EAAE,eAAe;AACzB,wBAAA,WAAW,EAAE,mBAAmB;AACjC,qBAAA,EAAA,aAAA,EACc,iBAAiB,CAAC,QAAQ,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,kmBAAA,EAAA,MAAA,EAAA,CAAA,w4DAAA,CAAA,EAAA;unBAyBC,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AElE1D;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-sparkline.mjs","sources":["../../../src/lib/components/sparkline/sparkline.math.ts","../../../src/lib/components/sparkline/sparkline.component.ts","../../../src/lib/components/sparkline/sparkline.component.html","../../../src/lib/components/sparkline/ids-group-ltd-ids-design-system-components-sparkline.ts"],"sourcesContent":["import type { SparklineScale } from './sparkline.types';\n\nexport interface SparklinePoint {\n readonly index: number;\n readonly x: number;\n readonly y: number;\n}\n\nexport interface SparklineGeometry {\n readonly path: string;\n /** Each unbroken run of the line closed down to the baseline: zero on the `'zero'` scale, the\n * foot of the box on `'data'`. */\n readonly areaPath: string;\n readonly points: readonly SparklinePoint[];\n}\n\n/** Positions in percent of the box, x across the readings and y down from the top of the scale.\n * A flat series on the `'data'` scale draws through the middle. A `null` breaks the line. */\nexport function sparklineGeometry(\n data: readonly (number | null)[],\n scale: SparklineScale,\n): SparklineGeometry {\n const finite = data.filter(\n (value): value is number => value !== null && Number.isFinite(value),\n );\n if (finite.length === 0) {\n return { path: '', areaPath: '', points: [] };\n }\n const floor = scale === 'zero' ? Math.min(0, ...finite) : Math.min(...finite);\n const ceiling =\n scale === 'zero' ? Math.max(0, ...finite) : Math.max(...finite);\n const span = ceiling - floor;\n const lastIndex = data.length - 1;\n const baseline = scale === 'zero' && span > 0 ? (ceiling / span) * 100 : 100;\n const points: SparklinePoint[] = [];\n const runs: SparklinePoint[][] = [];\n let path = '';\n let penDown = false;\n data.forEach((value, index) => {\n if (value === null || !Number.isFinite(value)) {\n penDown = false;\n\n return;\n }\n const x = lastIndex === 0 ? 50 : (index / lastIndex) * 100;\n const y = span === 0 ? 50 : ((ceiling - value) / span) * 100;\n const point = { index, x, y };\n points.push(point);\n if (penDown) {\n runs[runs.length - 1].push(point);\n } else {\n runs.push([point]);\n }\n path += `${penDown ? 'L' : 'M'}${x} ${y}`;\n penDown = true;\n });\n const areaPath = runs\n .map(\n (run) =>\n `M${run[0].x} ${baseline}` +\n run.map((point) => `L${point.x} ${point.y}`).join('') +\n `L${run[run.length - 1].x} ${baseline}Z`,\n )\n .join('');\n\n return { path, areaPath, points };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ChartTooltipDirective } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport type {\n ChartTooltipContext,\n ChartTooltipOrigin,\n} from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport { sparklineGeometry } from './sparkline.math';\nimport type { SparklinePoint } from './sparkline.math';\nimport type { SparklineScale } from './sparkline.types';\n\n/** A word-sized trend line: no axes, legend or frame, a dot on the last reading, and a tooltip.\n * Sized by `--ds-sparkline-width` and `--ds-sparkline-height`. */\n@Component({\n selector: 'ds-sparkline',\n standalone: true,\n imports: [ChartTooltipDirective],\n templateUrl: './sparkline.component.html',\n styleUrl: './sparkline.component.scss',\n host: {\n '[attr.role]': \"label() ? 'img' : null\",\n '[attr.aria-label]': 'label()',\n '[attr.aria-hidden]': \"label() ? null : 'true'\",\n '[attr.tabindex]': 'focusable() ? 0 : null',\n '(focus)': 'onFocus()',\n '(blur)': 'clearActive()',\n '(keydown)': 'onKeydown($event)',\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparklineComponent {\n /** Fills the band under the line down to the baseline. The colour is\n * `--ds-sparkline-area-color`, the line's own by default, at `--ds-sparkline-area-opacity`. */\n readonly area = input(false, { transform: booleanAttribute });\n\n /** One reading per step, oldest first. `null` breaks the line. */\n readonly data = input<readonly (number | null)[]>([]);\n\n /** What each reading is, for the tooltip. Left out, the tooltip prints the value alone. */\n readonly categories = input<readonly string[]>([]);\n\n /** Accessible name, and the series name in the tooltip. Left out, the sparkline is decorative\n * and hidden from assistive technology. */\n readonly label = input<string | null>(null);\n\n readonly scale = input<SparklineScale>('data');\n\n /** Shows the reading under the pointer, and under the keyboard where `label` makes the sparkline\n * focusable: focus opens the last reading; arrows, Home and End move. */\n readonly tooltip = input(true, { transform: booleanAttribute });\n\n /** Formats the value the tooltip prints. Unset, the locale's plain number format. */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n private readonly locale = inject(LOCALE_ID);\n\n private readonly canvas =\n viewChild.required<ElementRef<SVGSVGElement>>('canvas');\n\n protected readonly focusable = computed(\n () => this.tooltip() && this.label() !== null,\n );\n\n protected readonly geometry = computed(() =>\n sparklineGeometry(this.data(), this.scale()),\n );\n\n protected readonly activePoint = signal<SparklinePoint | null>(null);\n\n protected readonly shownPoint = computed(\n () => this.activePoint() ?? this.geometry().points.at(-1) ?? null,\n );\n\n protected readonly tooltipOrigin = signal<ChartTooltipOrigin | null>(null);\n\n protected readonly tooltipContext = computed<ChartTooltipContext | null>(\n () => {\n const point = this.activePoint();\n const value = point ? this.data()[point.index] : null;\n if (!point || value == null || !this.tooltip()) {\n return null;\n }\n const format =\n this.valueFormat() ??\n ((reading: number) => reading.toLocaleString(this.locale));\n\n return {\n category: this.categories()[point.index] ?? '',\n entries: [\n {\n label: this.label() ?? '',\n value,\n formatted: format(value),\n color:\n 'var(--ds-sparkline-line-color, var(--ds-chart-series-1-color))',\n },\n ],\n };\n },\n );\n\n protected onPointerMove(event: PointerEvent): void {\n const points = this.geometry().points;\n if (!this.tooltip() || points.length === 0) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n const across = ((event.clientX - box.left) / box.width) * 100;\n this.activate(\n points.reduce((best, point) =>\n Math.abs(point.x - across) < Math.abs(best.x - across) ? point : best,\n ),\n );\n }\n\n protected onFocus(): void {\n const last = this.geometry().points.at(-1);\n if (this.focusable() && last) {\n this.activate(last);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const points = this.geometry().points;\n const current = this.activePoint();\n if (!this.focusable() || !current) {\n return;\n }\n const position = points.indexOf(current);\n const target = {\n ArrowLeft: position - 1,\n ArrowRight: position + 1,\n Home: 0,\n End: points.length - 1,\n }[event.key];\n if (target === undefined) {\n return;\n }\n event.preventDefault();\n this.activate(points[Math.min(Math.max(target, 0), points.length - 1)]);\n }\n\n protected clearActive(): void {\n this.activePoint.set(null);\n this.tooltipOrigin.set(null);\n }\n\n private activate(point: SparklinePoint): void {\n if (point === this.activePoint()) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n this.activePoint.set(point);\n this.tooltipOrigin.set({\n x: box.left + (point.x / 100) * box.width,\n y: box.top + (point.y / 100) * box.height,\n });\n }\n}\n","<svg\n #canvas\n class=\"sparkline\"\n aria-hidden=\"true\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"clearActive()\">\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\">\n @if (area()) {\n <path\n class=\"area\"\n [attr.d]=\"geometry().areaPath\" />\n }\n\n <path\n class=\"line\"\n [attr.d]=\"geometry().path\" />\n </svg>\n\n @if (shownPoint(); as point) {\n <circle\n class=\"dot\"\n [attr.cx]=\"point.x + '%'\"\n [attr.cy]=\"point.y + '%'\" />\n }\n</svg>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAgBA;AAC8F;AACxF,SAAU,iBAAiB,CAC/B,IAAgC,EAChC,KAAqB,EAAA;IAErB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CACxB,CAAC,KAAK,KAAsB,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CACrE;AACD,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IAC/C;IACA,MAAM,KAAK,GAAG,KAAK,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAC7E,MAAM,OAAO,GACX,KAAK,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;AACjE,IAAA,MAA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CAAC,MAAM,EAAA,QAAA,EAAA,itBAAA,EAAA,MAAA,EAAA,CAAA,4oEAAA,CAAA,EAAA;gtBA6BC,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AErE1D;;AAEG;;;;"}
|
|
@@ -4,10 +4,10 @@ import { DS_INTL } from '@ids-group-ltd/ids-design-system/core';
|
|
|
4
4
|
|
|
5
5
|
class SpinnerComponent {
|
|
6
6
|
intl = inject(DS_INTL);
|
|
7
|
-
/** Spinner size
|
|
7
|
+
/** Spinner size - sm/md/lg. */
|
|
8
8
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
9
9
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.22", type: SpinnerComponent, isStandalone: true, selector: "ds-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "attr.aria-label": "intl().spinner.label", "class.sm": "size() === 'sm'", "class.lg": "size() === 'lg'" } }, ngImport: i0, template: '', isInline: true, styles: ["
|
|
10
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.22", type: SpinnerComponent, isStandalone: true, selector: "ds-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "attr.aria-label": "intl().spinner.label", "class.sm": "size() === 'sm'", "class.lg": "size() === 'lg'" } }, ngImport: i0, template: '', isInline: true, styles: [":host{--_spinner-color: var(--ds-spinner-color, var(--accent));--_spinner-track-color: var(--ds-spinner-track-color, var(--border-default));display:inline-block;width:var(--spinner-md);height:var(--spinner-md);border:var(--spinner-bw) solid var(--_spinner-track-color);border-top-color:var(--_spinner-color);border-radius:var(--radius-pill);animation:spinner-rotate var(--duration-loop-fast) linear infinite}:host(.sm){width:var(--spinner-sm);height:var(--spinner-sm);border-width:var(--border-width-default)}:host(.lg){width:var(--spinner-lg);height:var(--spinner-lg);border-width:var(--border-width-strong)}@keyframes spinner-rotate{to{transform:rotate(360deg)}}\n"] });
|
|
11
11
|
}
|
|
12
12
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
13
13
|
type: Component,
|
|
@@ -16,7 +16,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
16
16
|
'[attr.aria-label]': 'intl().spinner.label',
|
|
17
17
|
'[class.sm]': "size() === 'sm'",
|
|
18
18
|
'[class.lg]': "size() === 'lg'",
|
|
19
|
-
}, encapsulation: ViewEncapsulation.Emulated, styles: ["
|
|
19
|
+
}, encapsulation: ViewEncapsulation.Emulated, styles: [":host{--_spinner-color: var(--ds-spinner-color, var(--accent));--_spinner-track-color: var(--ds-spinner-track-color, var(--border-default));display:inline-block;width:var(--spinner-md);height:var(--spinner-md);border:var(--spinner-bw) solid var(--_spinner-track-color);border-top-color:var(--_spinner-color);border-radius:var(--radius-pill);animation:spinner-rotate var(--duration-loop-fast) linear infinite}:host(.sm){width:var(--spinner-sm);height:var(--spinner-sm);border-width:var(--border-width-default)}:host(.lg){width:var(--spinner-lg);height:var(--spinner-lg);border-width:var(--border-width-strong)}@keyframes spinner-rotate{to{transform:rotate(360deg)}}\n"] }]
|
|
20
20
|
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-spinner.mjs","sources":["../../../src/lib/components/spinner/spinner.component.ts","../../../src/lib/components/spinner/ids-group-ltd-ids-design-system-components-spinner.ts"],"sourcesContent":["import { Component, ViewEncapsulation, inject, input } from '@angular/core';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/core';\nimport type { DsSize } from '@ids-group-ltd/ids-design-system/core';\n\n@Component({\n selector: 'ds-spinner',\n standalone: true,\n template: '',\n styleUrl: './spinner.component.scss',\n host: {\n role: 'status',\n '[attr.aria-label]': 'intl().spinner.label',\n '[class.sm]': \"size() === 'sm'\",\n '[class.lg]': \"size() === 'lg'\",\n },\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class SpinnerComponent {\n protected readonly intl = inject(DS_INTL);\n\n /** Spinner size
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-spinner.mjs","sources":["../../../src/lib/components/spinner/spinner.component.ts","../../../src/lib/components/spinner/ids-group-ltd-ids-design-system-components-spinner.ts"],"sourcesContent":["import { Component, ViewEncapsulation, inject, input } from '@angular/core';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/core';\nimport type { DsSize } from '@ids-group-ltd/ids-design-system/core';\n\n@Component({\n selector: 'ds-spinner',\n standalone: true,\n template: '',\n styleUrl: './spinner.component.scss',\n host: {\n role: 'status',\n '[attr.aria-label]': 'intl().spinner.label',\n '[class.sm]': \"size() === 'sm'\",\n '[class.lg]': \"size() === 'lg'\",\n },\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class SpinnerComponent {\n protected readonly intl = inject(DS_INTL);\n\n /** Spinner size - sm/md/lg. */\n readonly size = input<DsSize>('md');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAiBa,gBAAgB,CAAA;AACR,IAAA,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;;AAGhC,IAAA,IAAI,GAAG,KAAK,CAAS,IAAI,2EAAC;wGAJxB,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,gBAAgB,4WAVjB,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,4pBAAA,CAAA,EAAA,CAAA;;4FAUD,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAb5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,YAAY,EAAA,UAAA,EACV,IAAI,EAAA,QAAA,EACN,EAAE,EAAA,IAAA,EAEN;AACJ,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,mBAAmB,EAAE,sBAAsB;AAC3C,wBAAA,YAAY,EAAE,iBAAiB;AAC/B,wBAAA,YAAY,EAAE,iBAAiB;qBAChC,EAAA,aAAA,EACc,iBAAiB,CAAC,QAAQ,EAAA,MAAA,EAAA,CAAA,4pBAAA,CAAA,EAAA;;;ACf3C;;AAEG;;;;"}
|