@tmorrow/cre8-wc 1.1.2 → 1.1.3
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/cdn/cre8-wc.esm.js +1 -1
- package/cdn/cre8-wc.esm.js.map +1 -1
- package/cdn/cre8-wc.min.js +1 -1
- package/cdn/cre8-wc.min.js.map +1 -1
- package/lib/cdn-entry.js +129 -0
- package/lib/cdn-entry.js.map +1 -0
- package/lib/components/accordion/accordion.js +58 -40
- package/lib/components/accordion/accordion.js.map +1 -0
- package/lib/components/accordion/accordion.styles.js +4 -0
- package/lib/components/accordion/accordion.styles.js.map +1 -0
- package/lib/components/accordion-item/accordion-item.js +187 -98
- package/lib/components/accordion-item/accordion-item.js.map +1 -0
- package/lib/components/accordion-item/accordion-item.styles.js +4 -0
- package/lib/components/accordion-item/accordion-item.styles.js.map +1 -0
- package/lib/components/alert/alert.js +146 -107
- package/lib/components/alert/alert.js.map +1 -0
- package/lib/components/alert/alert.styles.js +4 -0
- package/lib/components/alert/alert.styles.js.map +1 -0
- package/lib/components/badge/badge.js +73 -50
- package/lib/components/badge/badge.js.map +1 -0
- package/lib/components/badge/badge.styles.js +4 -0
- package/lib/components/badge/badge.styles.js.map +1 -0
- package/lib/components/band/band.js +34 -31
- package/lib/components/band/band.js.map +1 -0
- package/lib/components/band/band.styles.js +4 -0
- package/lib/components/band/band.styles.js.map +1 -0
- package/lib/components/breadcrumbs/breadcrumbs.js +52 -28
- package/lib/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/lib/components/breadcrumbs/breadcrumbs.styles.js +4 -0
- package/lib/components/breadcrumbs/breadcrumbs.styles.js.map +1 -0
- package/lib/components/breadcrumbs-item/breadcrumbs-item.js +28 -27
- package/lib/components/breadcrumbs-item/breadcrumbs-item.js.map +1 -0
- package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.js +4 -0
- package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.js.map +1 -0
- package/lib/components/button/button.js +297 -1040
- package/lib/components/button/button.js.map +1 -0
- package/lib/components/button/button.styles.js +885 -0
- package/lib/components/button/button.styles.js.map +1 -0
- package/lib/components/button-group/button-group.js +30 -27
- package/lib/components/button-group/button-group.js.map +1 -0
- package/lib/components/button-group/button-group.styles.js +4 -0
- package/lib/components/button-group/button-group.styles.js.map +1 -0
- package/lib/components/card/card.js +57 -35
- package/lib/components/card/card.js.map +1 -0
- package/lib/components/card/card.styles.js +4 -0
- package/lib/components/card/card.styles.js.map +1 -0
- package/lib/components/chart/chart.js +528 -354
- package/lib/components/chart/chart.js.map +1 -0
- package/lib/components/chart/chart.styles.js +4 -0
- package/lib/components/chart/chart.styles.js.map +1 -0
- package/lib/components/checkbox-field/checkbox-field.js +66 -53
- package/lib/components/checkbox-field/checkbox-field.js.map +1 -0
- package/lib/components/checkbox-field/checkbox-field.styles.js +4 -0
- package/lib/components/checkbox-field/checkbox-field.styles.js.map +1 -0
- package/lib/components/checkbox-field-item/checkbox-field-item.js +252 -183
- package/lib/components/checkbox-field-item/checkbox-field-item.js.map +1 -0
- package/lib/components/checkbox-field-item/checkbox-field-item.styles.js +4 -0
- package/lib/components/checkbox-field-item/checkbox-field-item.styles.js.map +1 -0
- package/lib/components/contexts/form-internals-context.js +9 -0
- package/lib/components/contexts/form-internals-context.js.map +1 -0
- package/lib/components/cre8-element.js +57 -56
- package/lib/components/cre8-element.js.map +1 -0
- package/lib/components/cre8-form-element.js +212 -244
- package/lib/components/cre8-form-element.js.map +1 -0
- package/lib/components/danger-button/danger-button.js +274 -147
- package/lib/components/danger-button/danger-button.js.map +1 -0
- package/lib/components/danger-button/danger-button.styles.js +4 -0
- package/lib/components/danger-button/danger-button.styles.js.map +1 -0
- package/lib/components/date-picker/calendar/calendar.js +465 -0
- package/lib/components/date-picker/calendar/calendar.js.map +1 -0
- package/lib/components/date-picker/calendar/calendar.styles.js +4 -0
- package/lib/components/date-picker/calendar/calendar.styles.js.map +1 -0
- package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.js +76 -0
- package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.js.map +1 -0
- package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.js +4 -0
- package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.js.map +1 -0
- package/lib/components/date-picker/calendar-navigation/calendar-navigation.js +110 -0
- package/lib/components/date-picker/calendar-navigation/calendar-navigation.js.map +1 -0
- package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.js +4 -0
- package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.js.map +1 -0
- package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.js +116 -0
- package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.js.map +1 -0
- package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.js +4 -0
- package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.js.map +1 -0
- package/lib/components/date-picker/date-picker.js +91 -784
- package/lib/components/date-picker/date-picker.js.map +1 -0
- package/lib/components/date-picker/date-picker.styles.js +4 -0
- package/lib/components/date-picker/date-picker.styles.js.map +1 -0
- package/lib/components/divider/divider.js +45 -35
- package/lib/components/divider/divider.js.map +1 -0
- package/lib/components/divider/divider.styles.js +4 -0
- package/lib/components/divider/divider.styles.js.map +1 -0
- package/lib/components/dropdown/dropdown.js +97 -63
- package/lib/components/dropdown/dropdown.js.map +1 -0
- package/lib/components/dropdown/dropdown.styles.js +4 -0
- package/lib/components/dropdown/dropdown.styles.js.map +1 -0
- package/lib/components/dropdown-item/dropdown-item.js +38 -31
- package/lib/components/dropdown-item/dropdown-item.js.map +1 -0
- package/lib/components/dropdown-item/dropdown-item.styles.js +4 -0
- package/lib/components/dropdown-item/dropdown-item.styles.js.map +1 -0
- package/lib/components/feature/feature.js +40 -35
- package/lib/components/feature/feature.js.map +1 -0
- package/lib/components/feature/feature.styles.js +4 -0
- package/lib/components/feature/feature.styles.js.map +1 -0
- package/lib/components/field/field.js +218 -153
- package/lib/components/field/field.js.map +1 -0
- package/lib/components/field/field.styles.js +4 -0
- package/lib/components/field/field.styles.js.map +1 -0
- package/lib/components/field-note/field-note.js +58 -45
- package/lib/components/field-note/field-note.js.map +1 -0
- package/lib/components/field-note/field-note.styles.js +4 -0
- package/lib/components/field-note/field-note.styles.js.map +1 -0
- package/lib/components/footer/footer.js +25 -18
- package/lib/components/footer/footer.js.map +1 -0
- package/lib/components/footer/footer.styles.js +4 -0
- package/lib/components/footer/footer.styles.js.map +1 -0
- package/lib/components/global-nav/global-nav.js +44 -37
- package/lib/components/global-nav/global-nav.js.map +1 -0
- package/lib/components/global-nav/global-nav.styles.js +4 -0
- package/lib/components/global-nav/global-nav.styles.js.map +1 -0
- package/lib/components/global-nav-item/global-nav-item.js +149 -112
- package/lib/components/global-nav-item/global-nav-item.js.map +1 -0
- package/lib/components/global-nav-item/global-nav-item.styles.js +4 -0
- package/lib/components/global-nav-item/global-nav-item.styles.js.map +1 -0
- package/lib/components/grid/grid.js +48 -45
- package/lib/components/grid/grid.js.map +1 -0
- package/lib/components/grid/grid.styles.js +4 -0
- package/lib/components/grid/grid.styles.js.map +1 -0
- package/lib/components/grid-item/grid-item.js +19 -16
- package/lib/components/grid-item/grid-item.js.map +1 -0
- package/lib/components/grid-item/grid-item.styles.js +4 -0
- package/lib/components/grid-item/grid-item.styles.js.map +1 -0
- package/lib/components/header/header.js +34 -29
- package/lib/components/header/header.js.map +1 -0
- package/lib/components/header/header.styles.js +4 -0
- package/lib/components/header/header.styles.js.map +1 -0
- package/lib/components/heading/heading.js +113 -76
- package/lib/components/heading/heading.js.map +1 -0
- package/lib/components/heading/heading.styles.js +4 -0
- package/lib/components/heading/heading.styles.js.map +1 -0
- package/lib/components/hero/hero.js +43 -40
- package/lib/components/hero/hero.js.map +1 -0
- package/lib/components/hero/hero.styles.js +4 -0
- package/lib/components/hero/hero.styles.js.map +1 -0
- package/lib/components/icon/icon.js +232 -9
- package/lib/components/icon/icon.js.map +1 -0
- package/lib/components/icon/icon.styles.js +4 -0
- package/lib/components/icon/icon.styles.js.map +1 -0
- package/lib/components/inline-alert/inline-alert.js +114 -87
- package/lib/components/inline-alert/inline-alert.js.map +1 -0
- package/lib/components/inline-alert/inline-alert.styles.js +4 -0
- package/lib/components/inline-alert/inline-alert.styles.js.map +1 -0
- package/lib/components/layout/layout.js +30 -27
- package/lib/components/layout/layout.js.map +1 -0
- package/lib/components/layout/layout.styles.js +4 -0
- package/lib/components/layout/layout.styles.js.map +1 -0
- package/lib/components/layout-container/layout-container.js +30 -27
- package/lib/components/layout-container/layout-container.js.map +1 -0
- package/lib/components/layout-container/layout-container.styles.js +4 -0
- package/lib/components/layout-container/layout-container.styles.js.map +1 -0
- package/lib/components/layout-section/layout-section.js +41 -33
- package/lib/components/layout-section/layout-section.js.map +1 -0
- package/lib/components/layout-section/layout-section.styles.js +4 -0
- package/lib/components/layout-section/layout-section.styles.js.map +1 -0
- package/lib/components/linelength-container/linelength-container.js +19 -16
- package/lib/components/linelength-container/linelength-container.js.map +1 -0
- package/lib/components/linelength-container/linelength-container.styles.js +4 -0
- package/lib/components/linelength-container/linelength-container.styles.js.map +1 -0
- package/lib/components/link/link.js +125 -87
- package/lib/components/link/link.js.map +1 -0
- package/lib/components/link/link.styles.js +4 -0
- package/lib/components/link/link.styles.js.map +1 -0
- package/lib/components/link-list/link-list.js +48 -45
- package/lib/components/link-list/link-list.js.map +1 -0
- package/lib/components/link-list/link-list.styles.js +4 -0
- package/lib/components/link-list/link-list.styles.js.map +1 -0
- package/lib/components/link-list-item/link-list-item.js +40 -37
- package/lib/components/link-list-item/link-list-item.js.map +1 -0
- package/lib/components/link-list-item/link-list-item.styles.js +4 -0
- package/lib/components/link-list-item/link-list-item.styles.js.map +1 -0
- package/lib/components/list/list.js +35 -32
- package/lib/components/list/list.js.map +1 -0
- package/lib/components/list/list.styles.js +4 -0
- package/lib/components/list/list.styles.js.map +1 -0
- package/lib/components/list-item/list-item.js +25 -21
- package/lib/components/list-item/list-item.js.map +1 -0
- package/lib/components/list-item/list-item.styles.js +4 -0
- package/lib/components/list-item/list-item.styles.js.map +1 -0
- package/lib/components/loading-spinner/loading-spinner.js +126 -71
- package/lib/components/loading-spinner/loading-spinner.js.map +1 -0
- package/lib/components/loading-spinner/loading-spinner.styles.js +4 -0
- package/lib/components/loading-spinner/loading-spinner.styles.js.map +1 -0
- package/lib/components/logo/logo.js +28 -25
- package/lib/components/logo/logo.js.map +1 -0
- package/lib/components/logo/logo.styles.js +4 -0
- package/lib/components/logo/logo.styles.js.map +1 -0
- package/lib/components/main/main.js +29 -26
- package/lib/components/main/main.js.map +1 -0
- package/lib/components/main/main.styles.js +4 -0
- package/lib/components/main/main.styles.js.map +1 -0
- package/lib/components/modal/modal.js +174 -125
- package/lib/components/modal/modal.js.map +1 -0
- package/lib/components/modal/modal.styles.js +4 -0
- package/lib/components/modal/modal.styles.js.map +1 -0
- package/lib/components/multi-select/multi-select.js +300 -211
- package/lib/components/multi-select/multi-select.js.map +1 -0
- package/lib/components/multi-select/multi-select.styles.js +4 -0
- package/lib/components/multi-select/multi-select.styles.js.map +1 -0
- package/lib/components/nav-container/nav-container.js +19 -16
- package/lib/components/nav-container/nav-container.js.map +1 -0
- package/lib/components/nav-container/nav-container.styles.js +4 -0
- package/lib/components/nav-container/nav-container.styles.js.map +1 -0
- package/lib/components/page-header/page-header.js +36 -29
- package/lib/components/page-header/page-header.js.map +1 -0
- package/lib/components/page-header/page-header.styles.js +4 -0
- package/lib/components/page-header/page-header.styles.js.map +1 -0
- package/lib/components/pagination/page-counter/page-counter.js +67 -0
- package/lib/components/pagination/page-counter/page-counter.js.map +1 -0
- package/lib/components/pagination/page-counter/page-counter.styles.js +4 -0
- package/lib/components/pagination/page-counter/page-counter.styles.js.map +1 -0
- package/lib/components/pagination/pagination.js +282 -237
- package/lib/components/pagination/pagination.js.map +1 -0
- package/lib/components/pagination/pagination.styles.js +4 -0
- package/lib/components/pagination/pagination.styles.js.map +1 -0
- package/lib/components/percent-bar/percent-bar.js +56 -48
- package/lib/components/percent-bar/percent-bar.js.map +1 -0
- package/lib/components/percent-bar/percent-bar.styles.js +4 -0
- package/lib/components/percent-bar/percent-bar.styles.js.map +1 -0
- package/lib/components/popover/popover.js +304 -179
- package/lib/components/popover/popover.js.map +1 -0
- package/lib/components/popover/popover.styles.js +4 -0
- package/lib/components/popover/popover.styles.js.map +1 -0
- package/lib/components/primary-nav/primary-nav.js +44 -37
- package/lib/components/primary-nav/primary-nav.js.map +1 -0
- package/lib/components/primary-nav/primary-nav.styles.js +4 -0
- package/lib/components/primary-nav/primary-nav.styles.js.map +1 -0
- package/lib/components/primary-nav-item/primary-nav-item.js +151 -113
- package/lib/components/primary-nav-item/primary-nav-item.js.map +1 -0
- package/lib/components/primary-nav-item/primary-nav-item.styles.js +4 -0
- package/lib/components/primary-nav-item/primary-nav-item.styles.js.map +1 -0
- package/lib/components/progress-meter/progress-meter.js +74 -57
- package/lib/components/progress-meter/progress-meter.js.map +1 -0
- package/lib/components/progress-meter/progress-meter.styles.js +4 -0
- package/lib/components/progress-meter/progress-meter.styles.js.map +1 -0
- package/lib/components/progress-steps/progress-steps.js +19 -0
- package/lib/components/progress-steps/progress-steps.js.map +1 -0
- package/lib/components/progress-steps/progress-steps.styles.js +4 -0
- package/lib/components/progress-steps/progress-steps.styles.js.map +1 -0
- package/lib/components/progress-steps-item/progress-steps-item.js +52 -40
- package/lib/components/progress-steps-item/progress-steps-item.js.map +1 -0
- package/lib/components/progress-steps-item/progress-steps-item.styles.js +4 -0
- package/lib/components/progress-steps-item/progress-steps-item.styles.js.map +1 -0
- package/lib/components/radio-field/radio-field.js +59 -49
- package/lib/components/radio-field/radio-field.js.map +1 -0
- package/lib/components/radio-field/radio-field.styles.js +4 -0
- package/lib/components/radio-field/radio-field.styles.js.map +1 -0
- package/lib/components/radio-field-item/radio-field-item.js +222 -179
- package/lib/components/radio-field-item/radio-field-item.js.map +1 -0
- package/lib/components/radio-field-item/radio-field-item.styles.js +4 -0
- package/lib/components/radio-field-item/radio-field-item.styles.js.map +1 -0
- package/lib/components/remove-tag/remove-tag.js +89 -60
- package/lib/components/remove-tag/remove-tag.js.map +1 -0
- package/lib/components/remove-tag/remove-tag.styles.js +4 -0
- package/lib/components/remove-tag/remove-tag.styles.js.map +1 -0
- package/lib/components/section/section.js +46 -27
- package/lib/components/section/section.js.map +1 -0
- package/lib/components/section/section.styles.js +4 -0
- package/lib/components/section/section.styles.js.map +1 -0
- package/lib/components/select/select.js +243 -158
- package/lib/components/select/select.js.map +1 -0
- package/lib/components/select/select.styles.js +4 -0
- package/lib/components/select/select.styles.js.map +1 -0
- package/lib/components/select-tile/select-tile-checkbox-controller.js +60 -0
- package/lib/components/select-tile/select-tile-checkbox-controller.js.map +1 -0
- package/lib/components/select-tile/select-tile-radio-controller.js +167 -0
- package/lib/components/select-tile/select-tile-radio-controller.js.map +1 -0
- package/lib/components/select-tile/select-tile.js +228 -223
- package/lib/components/select-tile/select-tile.js.map +1 -0
- package/lib/components/select-tile/select-tile.styles.js +4 -0
- package/lib/components/select-tile/select-tile.styles.js.map +1 -0
- package/lib/components/select-tile-list/select-tile-list.js +76 -62
- package/lib/components/select-tile-list/select-tile-list.js.map +1 -0
- package/lib/components/select-tile-list/select-tile-list.styles.js +4 -0
- package/lib/components/select-tile-list/select-tile-list.styles.js.map +1 -0
- package/lib/components/skeleton-loader/skeleton-loader.js +68 -39
- package/lib/components/skeleton-loader/skeleton-loader.js.map +1 -0
- package/lib/components/skeleton-loader/skeleton-loader.styles.js +4 -0
- package/lib/components/skeleton-loader/skeleton-loader.styles.js.map +1 -0
- package/lib/components/split-button/split-button.js +51 -46
- package/lib/components/split-button/split-button.js.map +1 -0
- package/lib/components/split-button/split-button.styles.js +4 -0
- package/lib/components/split-button/split-button.styles.js.map +1 -0
- package/lib/components/submenu/submenu.js +19 -16
- package/lib/components/submenu/submenu.js.map +1 -0
- package/lib/components/submenu/submenu.styles.js +4 -0
- package/lib/components/submenu/submenu.styles.js.map +1 -0
- package/lib/components/submenu-item/submenu-item.js +32 -26
- package/lib/components/submenu-item/submenu-item.js.map +1 -0
- package/lib/components/submenu-item/submenu-item.styles.js +4 -0
- package/lib/components/submenu-item/submenu-item.styles.js.map +1 -0
- package/lib/components/tab/tab.js +74 -63
- package/lib/components/tab/tab.js.map +1 -0
- package/lib/components/tab/tab.styles.js +4 -0
- package/lib/components/tab/tab.styles.js.map +1 -0
- package/lib/components/tab-panel/tab-panel.js +49 -43
- package/lib/components/tab-panel/tab-panel.js.map +1 -0
- package/lib/components/tab-panel/tab-panel.styles.js +4 -0
- package/lib/components/tab-panel/tab-panel.styles.js.map +1 -0
- package/lib/components/table/table.js +46 -41
- package/lib/components/table/table.js.map +1 -0
- package/lib/components/table/table.styles.js +4 -0
- package/lib/components/table/table.styles.js.map +1 -0
- package/lib/components/table-body/table-body.js +20 -17
- package/lib/components/table-body/table-body.js.map +1 -0
- package/lib/components/table-body/table-body.styles.js +4 -0
- package/lib/components/table-body/table-body.styles.js.map +1 -0
- package/lib/components/table-cell/table-cell.js +39 -36
- package/lib/components/table-cell/table-cell.js.map +1 -0
- package/lib/components/table-cell/table-cell.styles.js +4 -0
- package/lib/components/table-cell/table-cell.styles.js.map +1 -0
- package/lib/components/table-header/table-header.js +20 -17
- package/lib/components/table-header/table-header.js.map +1 -0
- package/lib/components/table-header/table-header.styles.js +4 -0
- package/lib/components/table-header/table-header.styles.js.map +1 -0
- package/lib/components/table-header-cell/table-header-cell.js +35 -32
- package/lib/components/table-header-cell/table-header-cell.js.map +1 -0
- package/lib/components/table-header-cell/table-header-cell.styles.js +4 -0
- package/lib/components/table-header-cell/table-header-cell.styles.js.map +1 -0
- package/lib/components/table-object/table-object.js +21 -18
- package/lib/components/table-object/table-object.js.map +1 -0
- package/lib/components/table-object/table-object.styles.js +4 -0
- package/lib/components/table-object/table-object.styles.js.map +1 -0
- package/lib/components/table-row/table-row.js +76 -55
- package/lib/components/table-row/table-row.js.map +1 -0
- package/lib/components/table-row/table-row.styles.js +4 -0
- package/lib/components/table-row/table-row.styles.js.map +1 -0
- package/lib/components/tabs/tabs.js +452 -303
- package/lib/components/tabs/tabs.js.map +1 -0
- package/lib/components/tabs/tabs.styles.js +4 -0
- package/lib/components/tabs/tabs.styles.js.map +1 -0
- package/lib/components/tag/tag.js +236 -167
- package/lib/components/tag/tag.js.map +1 -0
- package/lib/components/tag/tag.styles.js +4 -0
- package/lib/components/tag/tag.styles.js.map +1 -0
- package/lib/components/tag-list/tag-list.js +40 -35
- package/lib/components/tag-list/tag-list.js.map +1 -0
- package/lib/components/tag-list/tag-list.styles.js +4 -0
- package/lib/components/tag-list/tag-list.styles.js.map +1 -0
- package/lib/components/tertiary-nav/tertiary-nav.js +40 -33
- package/lib/components/tertiary-nav/tertiary-nav.js.map +1 -0
- package/lib/components/tertiary-nav/tertiary-nav.styles.js +4 -0
- package/lib/components/tertiary-nav/tertiary-nav.styles.js.map +1 -0
- package/lib/components/tertiary-nav-item/tertiary-nav-item.js +52 -43
- package/lib/components/tertiary-nav-item/tertiary-nav-item.js.map +1 -0
- package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.js +4 -0
- package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.js.map +1 -0
- package/lib/components/text-link/text-link.js +45 -41
- package/lib/components/text-link/text-link.js.map +1 -0
- package/lib/components/text-link/text-link.styles.js +4 -0
- package/lib/components/text-link/text-link.styles.js.map +1 -0
- package/lib/components/text-passage/text-passage-light-dom.js +145 -0
- package/lib/components/text-passage/text-passage-light-dom.js.map +1 -0
- package/lib/components/text-passage/text-passage-light-dom.styles.js +4 -0
- package/lib/components/text-passage/text-passage-light-dom.styles.js.map +1 -0
- package/lib/components/text-passage/text-passage.js +72 -44
- package/lib/components/text-passage/text-passage.js.map +1 -0
- package/lib/components/text-passage/text-passage.styles.js +4 -0
- package/lib/components/text-passage/text-passage.styles.js.map +1 -0
- package/lib/components/tooltip/tooltip.js +278 -173
- package/lib/components/tooltip/tooltip.js.map +1 -0
- package/lib/components/tooltip/tooltip.styles.js +4 -0
- package/lib/components/tooltip/tooltip.styles.js.map +1 -0
- package/lib/components/utility-nav/utility-nav.js +40 -33
- package/lib/components/utility-nav/utility-nav.js.map +1 -0
- package/lib/components/utility-nav/utility-nav.styles.js +4 -0
- package/lib/components/utility-nav/utility-nav.styles.js.map +1 -0
- package/lib/components/utility-nav-item/utility-nav-item.js +70 -49
- package/lib/components/utility-nav-item/utility-nav-item.js.map +1 -0
- package/lib/components/utility-nav-item/utility-nav-item.styles.js +4 -0
- package/lib/components/utility-nav-item/utility-nav-item.styles.js.map +1 -0
- package/lib/design-tokens/brands/blue/css/tokens_blue.module.js +737 -0
- package/lib/design-tokens/brands/blue/css/tokens_blue.module.js.map +1 -0
- package/lib/design-tokens/brands/bolt/tokens_bolt.theme.js +756 -0
- package/lib/design-tokens/brands/bolt/tokens_bolt.theme.js.map +1 -0
- package/lib/design-tokens/brands/cre8/css/tokens_cre8.module.js +771 -0
- package/lib/design-tokens/brands/cre8/css/tokens_cre8.module.js.map +1 -0
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_cre8-a2ui.module.js +772 -0
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_cre8-a2ui.module.js.map +1 -0
- package/lib/design-tokens/brands/cre8-legacy/css/tokens_cre8-legacy.module.js +737 -0
- package/lib/design-tokens/brands/cre8-legacy/css/tokens_cre8-legacy.module.js.map +1 -0
- package/lib/design-tokens/brands/femmecubator/css/tokens_femmecubator2.module.js +983 -0
- package/lib/design-tokens/brands/femmecubator/css/tokens_femmecubator2.module.js.map +1 -0
- package/lib/design-tokens/brands/legacy/css/tokens_legacy.module.js +737 -0
- package/lib/design-tokens/brands/legacy/css/tokens_legacy.module.js.map +1 -0
- package/lib/design-tokens/brands/marketing/css/tokens_marketing.module.js +736 -0
- package/lib/design-tokens/brands/marketing/css/tokens_marketing.module.js.map +1 -0
- package/lib/design-tokens/brands/minimalist/css/tokens_minimalist.module.js +737 -0
- package/lib/design-tokens/brands/minimalist/css/tokens_minimalist.module.js.map +1 -0
- package/lib/design-tokens/brands/prisma/tokens_prisma.module.js +771 -0
- package/lib/design-tokens/brands/prisma/tokens_prisma.module.js.map +1 -0
- package/lib/design-tokens/brands/starbucks/tokens.module.js +552 -0
- package/lib/design-tokens/brands/starbucks/tokens.module.js.map +1 -0
- package/lib/design-tokens/brands/starbucks/tokens_starbucks.module.js +776 -0
- package/lib/design-tokens/brands/starbucks/tokens_starbucks.module.js.map +1 -0
- package/lib/design-tokens/brands copy/blue/css/tokens_blue.module.js +253 -0
- package/lib/design-tokens/brands copy/blue/css/tokens_blue.module.js.map +1 -0
- package/lib/design-tokens/core/scss/theming/head.module.js +6 -0
- package/lib/design-tokens/core/scss/theming/head.module.js.map +1 -0
- package/lib/design-tokens/tokens_netflix.theme.js +806 -0
- package/lib/design-tokens/tokens_netflix.theme.js.map +1 -0
- package/lib/directives/if-truthy.js +24 -0
- package/lib/directives/if-truthy.js.map +1 -0
- package/lib/directives/spread.js +29 -0
- package/lib/directives/spread.js.map +1 -0
- package/lib/index.js +84 -168
- package/lib/index.js.map +1 -0
- package/lib/scripts/convert-scss-to-ts.js +25 -0
- package/lib/scripts/convert-scss-to-ts.js.map +1 -0
- package/lib/scripts/extract-tokens.js +120 -0
- package/lib/scripts/extract-tokens.js.map +1 -0
- package/lib/scripts/generate-react-wrappers.js +229 -0
- package/lib/scripts/generate-react-wrappers.js.map +1 -0
- package/lib/scripts/generateWesparkleThemes.js +52 -0
- package/lib/scripts/generateWesparkleThemes.js.map +1 -0
- package/lib/toBeAccessible.js +18 -0
- package/lib/toBeAccessible.js.map +1 -0
- package/lib/utilities/is-mobile.js +10 -0
- package/lib/utilities/is-mobile.js.map +1 -0
- package/lib/utilities/story-helpers.js +14 -0
- package/lib/utilities/story-helpers.js.map +1 -0
- package/lib/vite.config.cdn.js +85 -0
- package/lib/vite.config.cdn.js.map +1 -0
- package/lib/vite.config.js +156 -0
- package/lib/vite.config.js.map +1 -0
- package/package.json +8 -9
|
@@ -1,315 +1,490 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var w = Object.defineProperty, o = (u, i, t, a) => {
|
|
7
|
-
for (var e = void 0, n = u.length - 1, d; n >= 0; n--)
|
|
8
|
-
(d = u[n]) && (e = d(i, t, e) || e);
|
|
9
|
-
return e && w(i, t, e), e;
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
6
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
7
|
+
import { html } from 'lit';
|
|
8
|
+
import { property, state, query } from 'lit/decorators.js';
|
|
9
|
+
import { Cre8Element } from '../cre8-element';
|
|
10
|
+
import { Chart, registerables, } from 'chart.js';
|
|
11
|
+
import styles from './chart.styles.js';
|
|
12
|
+
// Register all Chart.js components
|
|
13
|
+
Chart.register(...registerables);
|
|
14
|
+
/**
|
|
15
|
+
* A flexible chart component built on Chart.js that supports multiple chart types
|
|
16
|
+
* including line, bar, pie, doughnut, radar, polar area, bubble, and scatter charts.
|
|
17
|
+
*
|
|
18
|
+
* ## Features
|
|
19
|
+
* - Supports all major Chart.js chart types
|
|
20
|
+
* - Reactive updates when data or options change
|
|
21
|
+
* - Customizable colors that integrate with cre8 design tokens
|
|
22
|
+
* - Responsive sizing
|
|
23
|
+
* - Loading state indicator
|
|
24
|
+
* - Event callbacks for click and hover interactions
|
|
25
|
+
* - Accessible with ARIA labels
|
|
26
|
+
*
|
|
27
|
+
* ## Usage
|
|
28
|
+
*
|
|
29
|
+
* ```html
|
|
30
|
+
* <cre8-chart
|
|
31
|
+
* type="bar"
|
|
32
|
+
* .data=${{ labels: ['A', 'B', 'C'], datasets: [{ label: 'Sales', data: [10, 20, 30] }] }}
|
|
33
|
+
* .options=${{ responsive: true }}
|
|
34
|
+
* ></cre8-chart>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @fires cre8-chart-click - Fired when a chart element is clicked
|
|
38
|
+
* @fires cre8-chart-hover - Fired when hovering over chart elements
|
|
39
|
+
* @fires cre8-chart-ready - Fired when the chart is initialized
|
|
40
|
+
*/
|
|
41
|
+
export class Cre8Chart extends Cre8Element {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
/**
|
|
45
|
+
* The type of chart to render.
|
|
46
|
+
* @attr type
|
|
47
|
+
*/
|
|
48
|
+
this.type = 'bar';
|
|
49
|
+
/**
|
|
50
|
+
* The chart data including labels and datasets.
|
|
51
|
+
* This should be an object with `labels` array and `datasets` array.
|
|
52
|
+
*/
|
|
53
|
+
this.data = { datasets: [] };
|
|
54
|
+
/**
|
|
55
|
+
* Chart.js configuration options.
|
|
56
|
+
* See Chart.js documentation for all available options.
|
|
57
|
+
*/
|
|
58
|
+
this.options = {};
|
|
59
|
+
/**
|
|
60
|
+
* Height of the chart container in pixels.
|
|
61
|
+
* If not set, defaults to 400px.
|
|
62
|
+
* @attr height
|
|
63
|
+
*/
|
|
64
|
+
this.height = 400;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the chart should maintain aspect ratio when resizing.
|
|
67
|
+
* @attr maintain-aspect-ratio
|
|
68
|
+
*/
|
|
69
|
+
this.maintainAspectRatio = true;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the chart should be responsive to container size.
|
|
72
|
+
* @attr responsive
|
|
73
|
+
*/
|
|
74
|
+
this.responsive = true;
|
|
75
|
+
/**
|
|
76
|
+
* Display a loading indicator instead of the chart.
|
|
77
|
+
* @attr loading
|
|
78
|
+
*/
|
|
79
|
+
this.loading = false;
|
|
80
|
+
/**
|
|
81
|
+
* Accessible label for the chart.
|
|
82
|
+
* @attr aria-label
|
|
83
|
+
*/
|
|
84
|
+
this.ariaLabel = 'Chart';
|
|
85
|
+
/**
|
|
86
|
+
* Whether to show the legend.
|
|
87
|
+
* @attr show-legend
|
|
88
|
+
*/
|
|
89
|
+
this.showLegend = true;
|
|
90
|
+
/**
|
|
91
|
+
* Position of the legend.
|
|
92
|
+
* @attr legend-position
|
|
93
|
+
*/
|
|
94
|
+
this.legendPosition = 'top';
|
|
95
|
+
/**
|
|
96
|
+
* Whether to animate chart updates.
|
|
97
|
+
* @attr enable-animation
|
|
98
|
+
*/
|
|
99
|
+
this.enableAnimation = true;
|
|
100
|
+
/**
|
|
101
|
+
* Animation duration in milliseconds.
|
|
102
|
+
* @attr animation-duration
|
|
103
|
+
*/
|
|
104
|
+
this.animationDuration = 750;
|
|
105
|
+
/**
|
|
106
|
+
* Default colors for datasets (uses cre8 design token colors).
|
|
107
|
+
*/
|
|
108
|
+
this.colors = [
|
|
109
|
+
'#0066B3', // Primary blue
|
|
110
|
+
'#00A3E0', // Accent cyan
|
|
111
|
+
'#059669', // Success green
|
|
112
|
+
'#D97706', // Warning orange
|
|
113
|
+
'#DC2626', // Error red
|
|
114
|
+
'#7C3AED', // Purple
|
|
115
|
+
'#DB2777', // Pink
|
|
116
|
+
'#0891B2', // Teal
|
|
117
|
+
];
|
|
118
|
+
/**
|
|
119
|
+
* Internal chart instance reference.
|
|
120
|
+
*/
|
|
121
|
+
this._chartInstance = null;
|
|
122
|
+
/**
|
|
123
|
+
* Internal state tracking if component is connected.
|
|
124
|
+
*/
|
|
125
|
+
this._isConnected = false;
|
|
46
126
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
(i.has("data") || i.has("options") || i.has("showLegend") || i.has("legendPosition") || i.has("colors")) && this._chartInstance && this._updateChart();
|
|
127
|
+
connectedCallback() {
|
|
128
|
+
super.connectedCallback();
|
|
129
|
+
this._isConnected = true;
|
|
53
130
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
_initializeChart() {
|
|
59
|
-
if (!this._canvas || !this._isConnected)
|
|
60
|
-
return;
|
|
61
|
-
const i = this._canvas.getContext("2d");
|
|
62
|
-
if (!i) {
|
|
63
|
-
console.error("Cre8Chart: Unable to get canvas 2D context");
|
|
64
|
-
return;
|
|
131
|
+
disconnectedCallback() {
|
|
132
|
+
super.disconnectedCallback();
|
|
133
|
+
this._isConnected = false;
|
|
134
|
+
this._destroyChart();
|
|
65
135
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
136
|
+
firstUpdated(_changedProperties) {
|
|
137
|
+
super.firstUpdated(_changedProperties);
|
|
138
|
+
if (!this.loading) {
|
|
139
|
+
this._initializeChart();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
updated(changedProperties) {
|
|
143
|
+
super.updated(changedProperties);
|
|
144
|
+
// If loading state changed to false, initialize chart
|
|
145
|
+
if (changedProperties.has('loading') && !this.loading && !this._chartInstance) {
|
|
146
|
+
this._initializeChart();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// If loading, don't update chart
|
|
150
|
+
if (this.loading) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// Check if we need to recreate the chart (type changed)
|
|
154
|
+
if (changedProperties.has('type') && this._chartInstance) {
|
|
155
|
+
this._destroyChart();
|
|
156
|
+
this._initializeChart();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// Update existing chart if data or options changed
|
|
160
|
+
if ((changedProperties.has('data') ||
|
|
161
|
+
changedProperties.has('options') ||
|
|
162
|
+
changedProperties.has('showLegend') ||
|
|
163
|
+
changedProperties.has('legendPosition') ||
|
|
164
|
+
changedProperties.has('colors')) &&
|
|
165
|
+
this._chartInstance) {
|
|
166
|
+
this._updateChart();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Initialize the Chart.js instance.
|
|
171
|
+
*/
|
|
172
|
+
_initializeChart() {
|
|
173
|
+
if (!this._canvas || !this._isConnected) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const ctx = this._canvas.getContext('2d');
|
|
177
|
+
if (!ctx) {
|
|
178
|
+
console.error('Cre8Chart: Unable to get canvas 2D context');
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const config = this._buildChartConfig();
|
|
182
|
+
this._chartInstance = new Chart(ctx, config);
|
|
183
|
+
this.dispatch({
|
|
184
|
+
eventName: 'cre8-chart-ready',
|
|
185
|
+
detailObj: { chart: this._chartInstance },
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Build the complete Chart.js configuration.
|
|
190
|
+
*/
|
|
191
|
+
_buildChartConfig() {
|
|
192
|
+
const processedData = this._processData();
|
|
96
193
|
return {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
borderWidth: t.borderWidth ?? 2
|
|
194
|
+
type: this.type,
|
|
195
|
+
data: processedData,
|
|
196
|
+
options: this._mergeOptions(),
|
|
101
197
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Merge user options with default options.
|
|
138
|
-
*/
|
|
139
|
-
_mergeOptions() {
|
|
140
|
-
const i = {
|
|
141
|
-
responsive: this.responsive,
|
|
142
|
-
maintainAspectRatio: this.maintainAspectRatio,
|
|
143
|
-
animation: this.enableAnimation ? { duration: this.animationDuration } : !1,
|
|
144
|
-
plugins: {
|
|
145
|
-
legend: {
|
|
146
|
-
display: this.showLegend,
|
|
147
|
-
position: this.legendPosition,
|
|
148
|
-
labels: {
|
|
149
|
-
usePointStyle: !0,
|
|
150
|
-
padding: 16,
|
|
151
|
-
font: {
|
|
152
|
-
family: "Inter, system-ui, sans-serif",
|
|
153
|
-
size: 12
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Process chart data and apply default colors.
|
|
201
|
+
*/
|
|
202
|
+
_processData() {
|
|
203
|
+
if (!this.data || !this.data.datasets) {
|
|
204
|
+
return { labels: [], datasets: [] };
|
|
205
|
+
}
|
|
206
|
+
const processedDatasets = this.data.datasets.map((dataset, index) => {
|
|
207
|
+
const colorIndex = index % this.colors.length;
|
|
208
|
+
const defaultColor = this.colors[colorIndex];
|
|
209
|
+
// For pie/doughnut/polarArea, apply colors to each segment
|
|
210
|
+
if (['pie', 'doughnut', 'polarArea'].includes(this.type)) {
|
|
211
|
+
const dataLength = Array.isArray(dataset.data) ? dataset.data.length : 0;
|
|
212
|
+
const segmentColors = Array.from({ length: dataLength }, (_, i) => this.colors[i % this.colors.length]);
|
|
213
|
+
return {
|
|
214
|
+
...dataset,
|
|
215
|
+
backgroundColor: dataset.backgroundColor || segmentColors,
|
|
216
|
+
borderColor: dataset.borderColor || '#ffffff',
|
|
217
|
+
borderWidth: dataset.borderWidth ?? 2,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// For line charts, add some defaults
|
|
221
|
+
if (this.type === 'line') {
|
|
222
|
+
return {
|
|
223
|
+
...dataset,
|
|
224
|
+
backgroundColor: dataset.backgroundColor || `${defaultColor}20`,
|
|
225
|
+
borderColor: dataset.borderColor || defaultColor,
|
|
226
|
+
borderWidth: dataset.borderWidth ?? 2,
|
|
227
|
+
fill: dataset.fill ?? false,
|
|
228
|
+
tension: dataset.tension ?? 0.4,
|
|
229
|
+
pointRadius: dataset.pointRadius ?? 4,
|
|
230
|
+
pointHoverRadius: dataset.pointHoverRadius ?? 6,
|
|
231
|
+
};
|
|
154
232
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
233
|
+
// For bar charts
|
|
234
|
+
if (this.type === 'bar') {
|
|
235
|
+
return {
|
|
236
|
+
...dataset,
|
|
237
|
+
backgroundColor: dataset.backgroundColor || defaultColor,
|
|
238
|
+
borderColor: dataset.borderColor || defaultColor,
|
|
239
|
+
borderWidth: dataset.borderWidth ?? 0,
|
|
240
|
+
borderRadius: 4,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
// For radar charts
|
|
244
|
+
if (this.type === 'radar') {
|
|
245
|
+
return {
|
|
246
|
+
...dataset,
|
|
247
|
+
backgroundColor: dataset.backgroundColor || `${defaultColor}40`,
|
|
248
|
+
borderColor: dataset.borderColor || defaultColor,
|
|
249
|
+
borderWidth: dataset.borderWidth ?? 2,
|
|
250
|
+
pointBackgroundColor: defaultColor,
|
|
251
|
+
pointBorderColor: '#ffffff',
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
// Default styling for other chart types
|
|
255
|
+
return {
|
|
256
|
+
...dataset,
|
|
257
|
+
backgroundColor: dataset.backgroundColor || defaultColor,
|
|
258
|
+
borderColor: dataset.borderColor || defaultColor,
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
return {
|
|
262
|
+
labels: this.data.labels || [],
|
|
263
|
+
datasets: processedDatasets,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Merge user options with default options.
|
|
268
|
+
*/
|
|
269
|
+
_mergeOptions() {
|
|
270
|
+
const defaultOptions = {
|
|
271
|
+
responsive: this.responsive,
|
|
272
|
+
maintainAspectRatio: this.maintainAspectRatio,
|
|
273
|
+
animation: this.enableAnimation
|
|
274
|
+
? { duration: this.animationDuration }
|
|
275
|
+
: false,
|
|
276
|
+
plugins: {
|
|
277
|
+
legend: {
|
|
278
|
+
display: this.showLegend,
|
|
279
|
+
position: this.legendPosition,
|
|
280
|
+
labels: {
|
|
281
|
+
usePointStyle: true,
|
|
282
|
+
padding: 16,
|
|
283
|
+
font: {
|
|
284
|
+
family: 'Inter, system-ui, sans-serif',
|
|
285
|
+
size: 12,
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
tooltip: {
|
|
290
|
+
enabled: true,
|
|
291
|
+
backgroundColor: '#1F2937',
|
|
292
|
+
titleFont: {
|
|
293
|
+
family: 'Inter, system-ui, sans-serif',
|
|
294
|
+
size: 13,
|
|
295
|
+
},
|
|
296
|
+
bodyFont: {
|
|
297
|
+
family: 'Inter, system-ui, sans-serif',
|
|
298
|
+
size: 12,
|
|
299
|
+
},
|
|
300
|
+
padding: 12,
|
|
301
|
+
cornerRadius: 8,
|
|
302
|
+
callbacks: {
|
|
303
|
+
label: (context) => {
|
|
304
|
+
const label = context.dataset.label || '';
|
|
305
|
+
const value = context.parsed.y ?? context.parsed;
|
|
306
|
+
return `${label}: ${value}`;
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
onClick: (event, elements, chart) => {
|
|
312
|
+
this._handleChartClick(event, elements, chart);
|
|
313
|
+
},
|
|
314
|
+
onHover: (event, elements, chart) => {
|
|
315
|
+
this._handleChartHover(event, elements, chart);
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
// Add scale options for charts that use scales
|
|
319
|
+
if (['line', 'bar', 'scatter', 'bubble'].includes(this.type)) {
|
|
320
|
+
defaultOptions.scales = {
|
|
321
|
+
x: {
|
|
322
|
+
grid: {
|
|
323
|
+
display: true,
|
|
324
|
+
color: '#E5E7EB',
|
|
325
|
+
},
|
|
326
|
+
ticks: {
|
|
327
|
+
font: {
|
|
328
|
+
family: 'Inter, system-ui, sans-serif',
|
|
329
|
+
size: 11,
|
|
330
|
+
},
|
|
331
|
+
color: '#6B7280',
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
y: {
|
|
335
|
+
grid: {
|
|
336
|
+
display: true,
|
|
337
|
+
color: '#E5E7EB',
|
|
338
|
+
},
|
|
339
|
+
ticks: {
|
|
340
|
+
font: {
|
|
341
|
+
family: 'Inter, system-ui, sans-serif',
|
|
342
|
+
size: 11,
|
|
343
|
+
},
|
|
344
|
+
color: '#6B7280',
|
|
345
|
+
},
|
|
346
|
+
beginAtZero: true,
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
// Deep merge user options with defaults
|
|
351
|
+
return this._deepMerge(defaultOptions, this.options);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Deep merge two objects.
|
|
355
|
+
*/
|
|
356
|
+
_deepMerge(target, source) {
|
|
357
|
+
const output = { ...target };
|
|
358
|
+
for (const key in source) {
|
|
359
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
360
|
+
if (source[key] &&
|
|
361
|
+
typeof source[key] === 'object' &&
|
|
362
|
+
!Array.isArray(source[key])) {
|
|
363
|
+
output[key] = this._deepMerge(target[key] || {}, source[key]);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
output[key] = source[key];
|
|
367
|
+
}
|
|
174
368
|
}
|
|
175
|
-
}
|
|
176
369
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return ["line", "bar", "scatter", "bubble"].includes(this.type) && (i.scales = {
|
|
186
|
-
x: {
|
|
187
|
-
grid: {
|
|
188
|
-
display: !0,
|
|
189
|
-
color: "#E5E7EB"
|
|
190
|
-
},
|
|
191
|
-
ticks: {
|
|
192
|
-
font: {
|
|
193
|
-
family: "Inter, system-ui, sans-serif",
|
|
194
|
-
size: 11
|
|
195
|
-
},
|
|
196
|
-
color: "#6B7280"
|
|
370
|
+
return output;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Update the existing chart with new data/options.
|
|
374
|
+
*/
|
|
375
|
+
_updateChart() {
|
|
376
|
+
if (!this._chartInstance) {
|
|
377
|
+
return;
|
|
197
378
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
color: "#E5E7EB"
|
|
203
|
-
},
|
|
204
|
-
ticks: {
|
|
205
|
-
font: {
|
|
206
|
-
family: "Inter, system-ui, sans-serif",
|
|
207
|
-
size: 11
|
|
208
|
-
},
|
|
209
|
-
color: "#6B7280"
|
|
210
|
-
},
|
|
211
|
-
beginAtZero: !0
|
|
212
|
-
}
|
|
213
|
-
}), this._deepMerge(i, this.options);
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Deep merge two objects.
|
|
217
|
-
*/
|
|
218
|
-
_deepMerge(i, t) {
|
|
219
|
-
const a = { ...i };
|
|
220
|
-
for (const e in t)
|
|
221
|
-
Object.prototype.hasOwnProperty.call(t, e) && (t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) ? a[e] = this._deepMerge(
|
|
222
|
-
i[e] || {},
|
|
223
|
-
t[e]
|
|
224
|
-
) : a[e] = t[e]);
|
|
225
|
-
return a;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Update the existing chart with new data/options.
|
|
229
|
-
*/
|
|
230
|
-
_updateChart() {
|
|
231
|
-
if (!this._chartInstance)
|
|
232
|
-
return;
|
|
233
|
-
const i = this._processData();
|
|
234
|
-
this._chartInstance.data = i, this._chartInstance.options = this._mergeOptions(), this._chartInstance.update(this.enableAnimation ? "default" : "none");
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Destroy the chart instance.
|
|
238
|
-
*/
|
|
239
|
-
_destroyChart() {
|
|
240
|
-
this._chartInstance && (this._chartInstance.destroy(), this._chartInstance = null);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Handle chart click events.
|
|
244
|
-
*/
|
|
245
|
-
_handleChartClick(i, t, a) {
|
|
246
|
-
if (t.length > 0) {
|
|
247
|
-
const e = t[0], n = e.datasetIndex, d = e.index, m = this.data.datasets[n]?.data[d], l = this.data.labels?.[d], c = {
|
|
248
|
-
event: i,
|
|
249
|
-
elements: t,
|
|
250
|
-
chart: a,
|
|
251
|
-
dataIndex: d,
|
|
252
|
-
datasetIndex: n,
|
|
253
|
-
value: m,
|
|
254
|
-
label: l
|
|
255
|
-
};
|
|
256
|
-
this.dispatch({ eventName: "cre8-chart-click", detailObj: c });
|
|
379
|
+
const processedData = this._processData();
|
|
380
|
+
this._chartInstance.data = processedData;
|
|
381
|
+
this._chartInstance.options = this._mergeOptions();
|
|
382
|
+
this._chartInstance.update(this.enableAnimation ? 'default' : 'none');
|
|
257
383
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
384
|
+
/**
|
|
385
|
+
* Destroy the chart instance.
|
|
386
|
+
*/
|
|
387
|
+
_destroyChart() {
|
|
388
|
+
if (this._chartInstance) {
|
|
389
|
+
this._chartInstance.destroy();
|
|
390
|
+
this._chartInstance = null;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Handle chart click events.
|
|
395
|
+
*/
|
|
396
|
+
_handleChartClick(event, elements, chart) {
|
|
397
|
+
if (elements.length > 0) {
|
|
398
|
+
const element = elements[0];
|
|
399
|
+
const datasetIndex = element.datasetIndex;
|
|
400
|
+
const dataIndex = element.index;
|
|
401
|
+
const dataset = this.data.datasets[datasetIndex];
|
|
402
|
+
const value = dataset?.data[dataIndex];
|
|
403
|
+
const label = this.data.labels?.[dataIndex];
|
|
404
|
+
const detail = {
|
|
405
|
+
event,
|
|
406
|
+
elements,
|
|
407
|
+
chart,
|
|
408
|
+
dataIndex,
|
|
409
|
+
datasetIndex,
|
|
410
|
+
value,
|
|
411
|
+
label,
|
|
412
|
+
};
|
|
413
|
+
// @ts-expect-error: `dispatch` is not defined on `Cre8Element`
|
|
414
|
+
this.dispatch({ eventName: 'cre8-chart-click', detailObj: detail });
|
|
415
|
+
}
|
|
275
416
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
417
|
+
/**
|
|
418
|
+
* Handle chart hover events.
|
|
419
|
+
*/
|
|
420
|
+
_handleChartHover(event, elements, chart) {
|
|
421
|
+
// Update cursor style
|
|
422
|
+
const canvas = chart.canvas;
|
|
423
|
+
canvas.style.cursor = elements.length > 0 ? 'pointer' : 'default';
|
|
424
|
+
if (elements.length > 0) {
|
|
425
|
+
const element = elements[0];
|
|
426
|
+
const datasetIndex = element.datasetIndex;
|
|
427
|
+
const dataIndex = element.index;
|
|
428
|
+
const dataset = this.data.datasets[datasetIndex];
|
|
429
|
+
const value = dataset?.data[dataIndex];
|
|
430
|
+
const label = this.data.labels?.[dataIndex];
|
|
431
|
+
const detail = {
|
|
432
|
+
event,
|
|
433
|
+
elements,
|
|
434
|
+
chart,
|
|
435
|
+
dataIndex,
|
|
436
|
+
datasetIndex,
|
|
437
|
+
value,
|
|
438
|
+
label,
|
|
439
|
+
};
|
|
440
|
+
// @ts-expect-error: `dispatch` is not defined on `Cre8Element`
|
|
441
|
+
this.dispatch({ eventName: 'cre8-chart-hover', detailObj: detail });
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Public method to get the Chart.js instance.
|
|
446
|
+
*/
|
|
447
|
+
getChartInstance() {
|
|
448
|
+
return this._chartInstance;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Public method to force refresh the chart.
|
|
452
|
+
*/
|
|
453
|
+
refresh() {
|
|
454
|
+
this._destroyChart();
|
|
455
|
+
this._initializeChart();
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Public method to download chart as image.
|
|
459
|
+
*/
|
|
460
|
+
downloadImage(filename = 'chart.png') {
|
|
461
|
+
if (!this._chartInstance) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const url = this._chartInstance.toBase64Image();
|
|
465
|
+
const link = document.createElement('a');
|
|
466
|
+
link.download = filename;
|
|
467
|
+
link.href = url;
|
|
468
|
+
link.click();
|
|
469
|
+
}
|
|
470
|
+
render() {
|
|
471
|
+
const componentClassName = this.componentClassNames('cre8-c-chart', {
|
|
472
|
+
'cre8-c-chart--loading': this.loading,
|
|
473
|
+
});
|
|
474
|
+
const containerStyle = `
|
|
475
|
+
width: ${this.width ? `${this.width}px` : '100%'};
|
|
303
476
|
height: ${this.height}px;
|
|
304
477
|
`;
|
|
305
|
-
|
|
306
|
-
<div class="${
|
|
307
|
-
${this.loading
|
|
478
|
+
return html `
|
|
479
|
+
<div class="${componentClassName}" style="${containerStyle}">
|
|
480
|
+
${this.loading
|
|
481
|
+
? html `
|
|
308
482
|
<div class="cre8-c-chart__loading">
|
|
309
483
|
<div class="cre8-c-chart__spinner"></div>
|
|
310
484
|
<span class="cre8-c-chart__loading-text">Loading chart...</span>
|
|
311
485
|
</div>
|
|
312
|
-
`
|
|
486
|
+
`
|
|
487
|
+
: html `
|
|
313
488
|
<canvas
|
|
314
489
|
role="img"
|
|
315
490
|
aria-label="${this.ariaLabel}"
|
|
@@ -317,63 +492,62 @@ const g = class g extends z {
|
|
|
317
492
|
`}
|
|
318
493
|
</div>
|
|
319
494
|
`;
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
customElements.
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
};
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
Cre8Chart.styles = [styles];
|
|
498
|
+
__decorate([
|
|
499
|
+
property({ type: String })
|
|
500
|
+
], Cre8Chart.prototype, "type", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
property({ type: Object, attribute: false })
|
|
503
|
+
], Cre8Chart.prototype, "data", void 0);
|
|
504
|
+
__decorate([
|
|
505
|
+
property({ type: Object, attribute: false })
|
|
506
|
+
], Cre8Chart.prototype, "options", void 0);
|
|
507
|
+
__decorate([
|
|
508
|
+
property({ type: Number })
|
|
509
|
+
], Cre8Chart.prototype, "width", void 0);
|
|
510
|
+
__decorate([
|
|
511
|
+
property({ type: Number })
|
|
512
|
+
], Cre8Chart.prototype, "height", void 0);
|
|
513
|
+
__decorate([
|
|
514
|
+
property({ type: Boolean, attribute: 'maintain-aspect-ratio' })
|
|
515
|
+
], Cre8Chart.prototype, "maintainAspectRatio", void 0);
|
|
516
|
+
__decorate([
|
|
517
|
+
property({ type: Boolean })
|
|
518
|
+
], Cre8Chart.prototype, "responsive", void 0);
|
|
519
|
+
__decorate([
|
|
520
|
+
property({ type: Boolean, reflect: true })
|
|
521
|
+
], Cre8Chart.prototype, "loading", void 0);
|
|
522
|
+
__decorate([
|
|
523
|
+
property({ type: String, attribute: 'aria-label' })
|
|
524
|
+
], Cre8Chart.prototype, "ariaLabel", void 0);
|
|
525
|
+
__decorate([
|
|
526
|
+
property({ type: Boolean, attribute: 'show-legend' })
|
|
527
|
+
], Cre8Chart.prototype, "showLegend", void 0);
|
|
528
|
+
__decorate([
|
|
529
|
+
property({ type: String, attribute: 'legend-position' })
|
|
530
|
+
], Cre8Chart.prototype, "legendPosition", void 0);
|
|
531
|
+
__decorate([
|
|
532
|
+
property({ type: Boolean, attribute: 'enable-animation' })
|
|
533
|
+
], Cre8Chart.prototype, "enableAnimation", void 0);
|
|
534
|
+
__decorate([
|
|
535
|
+
property({ type: Number, attribute: 'animation-duration' })
|
|
536
|
+
], Cre8Chart.prototype, "animationDuration", void 0);
|
|
537
|
+
__decorate([
|
|
538
|
+
property({ type: Array, attribute: false })
|
|
539
|
+
], Cre8Chart.prototype, "colors", void 0);
|
|
540
|
+
__decorate([
|
|
541
|
+
state()
|
|
542
|
+
], Cre8Chart.prototype, "_chartInstance", void 0);
|
|
543
|
+
__decorate([
|
|
544
|
+
state()
|
|
545
|
+
], Cre8Chart.prototype, "_isConnected", void 0);
|
|
546
|
+
__decorate([
|
|
547
|
+
query('canvas')
|
|
548
|
+
], Cre8Chart.prototype, "_canvas", void 0);
|
|
549
|
+
if (customElements.get('cre8-chart') === undefined) {
|
|
550
|
+
customElements.define('cre8-chart', Cre8Chart);
|
|
551
|
+
}
|
|
552
|
+
export default Cre8Chart;
|
|
553
|
+
//# sourceMappingURL=chart.js.map
|