@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,200 +1,243 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "../field-note/field-note.js";
|
|
7
|
-
const y = p`*,::slotted(*),*:before,*:after{box-sizing:border-box}:root{--size-base-unit: 0.5rem}[dir=rtl]{--rtlTranslateX: 50%;--rtlGradientToRight: 270deg;--rtlRotate45Inverse: -45deg}:host{--cre8-z-index-1: 1;--cre8-z-index-50: 50;--cre8-z-index-100: 100;--cre8-z-index-200: 200;--cre8-z-index-1030: 1030;--cre8-anim-fade-quick: 0.35s;--cre8-anim-ease: ease}@keyframes fadeIn{100%{opacity:1}}@keyframes slideIn{100%{transform:translateX(0)}}@keyframes slideInFwd{100%{width:272px;height:272px}}@keyframes slideOutRight{100%{width:272px;height:272px}}@keyframes slideUp{100%{transform:translateY(0)}}@media(width >= 481px){@keyframes slideInFwd{100%{width:417px;height:417px}}@keyframes slideOutRight{100%{width:417px;height:417px}}}@media(width >= 48rem){@keyframes slideInFwd{100%{width:330px;height:330px}}@keyframes slideOutRight{100%{width:330px;height:330px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 60rem){@keyframes slideInFwd{100%{width:460px;height:460px}}@keyframes slideOutRight{100%{width:460px;height:460px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 75rem){@keyframes slideInFwd{100%{width:592px;height:591px}}@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 87.5rem){@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 120px))}}}@media(width >= 2200px){@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 592px))}}}span.ripple{position:absolute;border-radius:50%;transform:scale(0);animation:ripple 600ms linear;background-color:var(--ripple-bg-color)}@keyframes ripple{to{transform:scale(4);opacity:1}}:root{--size-base-unit: 0.5rem}[dir=rtl]{--rtlTranslateX: 50%;--rtlGradientToRight: 270deg;--rtlRotate45Inverse: -45deg}:host{display:inline-flex}.cre8-c-radio-field-item{display:flex;position:relative;align-items:center;margin-bottom:0.5rem;min-height:1.5rem}:host(:last-child) .cre8-c-radio-field-item{margin-bottom:0}.cre8-c-radio-field-item__input{opacity:0;cursor:pointer;position:absolute;top:0;left:0;height:1.5rem;min-width:1.5rem;margin:0;z-index:1}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__input{cursor:not-allowed}.cre8-c-radio-field-item__custom-radio{display:flex;position:absolute;top:0;left:0;height:1.5rem;width:1.5rem;cursor:pointer;align-items:center;justify-content:center;border-radius:var(--cre8-border-radius-round);border-width:var(--cre8-border-width-default);border-style:var(--cre8-border-style-default);background-color:var(--cre8-color-bg-default);border-color:var(--cre8-color-border-strong)}.cre8-c-radio-field-item__input:focus-visible+.cre8-c-radio-field-item__custom-radio{outline:var(--cre8-border-width-focus) solid var(--cre8-color-border-active-outline);outline-offset:0.125rem}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__input:focus-visible+.cre8-c-radio-field-item__custom-radio{outline:var(--cre8-border-width-focus) solid var(--cre8-color-border-error);outline-offset:0.125rem;border-color:var(--cre8-color-border-error)}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__custom-radio{border-color:var(--cre8-color-border-error)}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__custom-radio{cursor:not-allowed;background-color:var(--cre8-color-bg-disabled);border-color:var(--cre8-color-border-disabled)}.cre8-c-radio-field-item__inner-circle{display:none;cursor:pointer;height:0.75rem;width:0.75rem;background:var(--cre8-color-content-brand);border-radius:var(--cre8-border-radius-round)}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__inner-circle{background:var(--cre8-color-bg-error-strong)}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__inner-circle{background:var(--cre8-color-content-disabled)}.cre8-c-radio-field-item__input:checked+.cre8-c-radio-field-item__custom-radio .cre8-c-radio-field-item__inner-circle{display:flex}.cre8-c-radio-field-item__label{margin-left:2rem;font-family:var(--cre8-typography-label-small-font-family);font-size:var(--cre8-typography-label-small-font-size);font-weight:var(--cre8-typography-label-small-font-weight);line-height:var(--cre8-typography-label-small-line-height);text-decoration:var(--cre8-typography-label-small-text-decoration);text-transform:var(--cre8-typography-label-small-text-transform)}`;
|
|
8
|
-
var g = Object.defineProperty, t = (n, e, r, o) => {
|
|
9
|
-
for (var l = void 0, s = n.length - 1, h; s >= 0; s--)
|
|
10
|
-
(h = n[s]) && (l = h(e, r, l) || l);
|
|
11
|
-
return l && g(e, r, l), l;
|
|
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;
|
|
12
6
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
resetField() {
|
|
30
|
-
this._internals.setFormValue(null);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Reset the radio field items tab indeces
|
|
34
|
-
*/
|
|
35
|
-
resetTabIndeces(e) {
|
|
36
|
-
e.forEach((r) => {
|
|
37
|
-
r.shadowRoot.querySelector(".cre8-c-radio-field-item__input").setAttribute("tabindex", "0");
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Remove checked
|
|
42
|
-
* 1) Remove checked property from all items and set tabindex to -1
|
|
43
|
-
* 2) Reset the form field to not checked
|
|
44
|
-
*/
|
|
45
|
-
removeChecked() {
|
|
46
|
-
this.parentNode && this.parentNode.querySelectorAll("cre8-radio-field-item").forEach((r) => {
|
|
47
|
-
r.checked = !1, r.shadowRoot.querySelector(".cre8-c-radio-field-item__input").setAttribute("tabindex", "-1"), r.resetField();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Reset form callback
|
|
52
|
-
* 1) Remove the checked state from all radio elements
|
|
53
|
-
* 2) Set the checked state to the initial checked state
|
|
54
|
-
* 3) Set the radio field input checked attribute to the initial checked state
|
|
55
|
-
*/
|
|
56
|
-
formResetCallback() {
|
|
57
|
-
this.removeChecked(), this.checked = this.initialChecked, this.field.checked = this.initialChecked;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* access role when radio-field-item embedded in radio-field
|
|
61
|
-
*/
|
|
62
|
-
_getRole() {
|
|
63
|
-
return this.closest("cre8-radio-field") ? "listitem" : "";
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Toggle active state of primary nav item
|
|
67
|
-
* 1) Remove isActive state from all sibling elements
|
|
68
|
-
* 2) Toggle active state of element selected
|
|
69
|
-
*/
|
|
70
|
-
_clickHandler() {
|
|
71
|
-
this.removeChecked(), this.checked = !this.checked;
|
|
72
|
-
const e = this.shadowRoot?.querySelector(".cre8-c-radio-field-item__input");
|
|
73
|
-
return e && e.setAttribute("tabindex", "0"), this.checked ? this._internals.setFormValue(this.value || "on") : this._internals.setFormValue(null);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Handle sibling element updates during handleKeyDown function
|
|
77
|
-
* 1) Prevent default keyboard functionality to disable scroll with up/down keys
|
|
78
|
-
* 2) Trigger removeChecked
|
|
79
|
-
* 3) Focus sibling shadowRoot element
|
|
80
|
-
* 4) Click sibling shadowRoot element
|
|
81
|
-
* 5) Set sibling element `tabindex` to `0`
|
|
82
|
-
* 6) Set sibling element `checked` value
|
|
83
|
-
*/
|
|
84
|
-
_updateSibling(e, r, o) {
|
|
85
|
-
e.preventDefault(), this.removeChecked(), o.focus(), o.click(), o.setAttribute("tabindex", "0"), r.setAttribute("checked", "");
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Handle keydown
|
|
89
|
-
* 1) If left or up arrow key is struck and radio field item exists before current item,
|
|
90
|
-
* remove checked from all items and add it to the next item
|
|
91
|
-
* 2) If right or down arrow key is struck and radio field item exists after current item,
|
|
92
|
-
* remove checked from all items and add checked to the next item. Focus on this item
|
|
93
|
-
* and set tabindex for when focusing out of radio field and back onto checked item.
|
|
94
|
-
* 3) If the element is in focused, then for event emission the current
|
|
95
|
-
* focues element should be clicked to emit event.
|
|
96
|
-
* 4) If the Tab key is pressed, and none of the items are checked
|
|
97
|
-
* then jump away from field set to the next tabbable item
|
|
98
|
-
*/
|
|
99
|
-
handleKeyDown(e) {
|
|
100
|
-
if (e.code === "ArrowLeft" || e.code === "ArrowUp") {
|
|
101
|
-
const r = this.previousElementSibling, o = r?.shadowRoot?.querySelector(
|
|
102
|
-
".cre8-c-radio-field-item__input:not([disabled])"
|
|
103
|
-
);
|
|
104
|
-
o && this._updateSibling(e, r, o);
|
|
105
|
-
} else if (e.code === "ArrowRight" || e.code === "ArrowDown") {
|
|
106
|
-
const r = this.nextElementSibling, o = r?.shadowRoot?.querySelector(
|
|
107
|
-
".cre8-c-radio-field-item__input:not([disabled])"
|
|
108
|
-
);
|
|
109
|
-
o && this._updateSibling(e, r, o);
|
|
110
|
-
} else if (e.code === "Tab" && !this.checked) {
|
|
111
|
-
const r = this.parentNode.querySelectorAll("cre8-radio-field-item");
|
|
112
|
-
r.forEach((o) => {
|
|
113
|
-
o.shadowRoot.querySelector(".cre8-c-radio-field-item__input").setAttribute("tabindex", "-1");
|
|
114
|
-
}), setTimeout(this.resetTabIndeces, 100, r);
|
|
7
|
+
import { html, } from 'lit';
|
|
8
|
+
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
9
|
+
import { property, query } from 'lit/decorators.js';
|
|
10
|
+
import { nanoid } from 'nanoid';
|
|
11
|
+
import { Cre8FormElement } from '../cre8-form-element';
|
|
12
|
+
import '../field-note/field-note';
|
|
13
|
+
import styles from './radio-field-item.styles.js';
|
|
14
|
+
/**
|
|
15
|
+
* A Radio Field Item adds a radio button to a Radio Field. Radio buttons let a user choose only one of several
|
|
16
|
+
* options. Do not use a single radio button, because once selected, it cannot be de-selected. If the user can only
|
|
17
|
+
* choose one, none or many options, use Checkbox instead.
|
|
18
|
+
*/
|
|
19
|
+
export class Cre8RadioFieldItem extends Cre8FormElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.type = 'radio';
|
|
115
23
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Connected callback lifecycle
|
|
26
|
+
* 1) Set the initial checked value to the checked property
|
|
27
|
+
* 2) Auto-generate the fieldId if a user doesn't provided so that the form field is accessible
|
|
28
|
+
* 3) If a field note exists, set the aria-describedby attribute to make sure the field note is read out
|
|
29
|
+
*/
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
this.fieldId = this.fieldId || nanoid(); /* 2 */
|
|
33
|
+
if (this.fieldNote) {
|
|
34
|
+
this.ariaDescribedBy = this.ariaDescribedBy || nanoid(); /* 3 */
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Reset the radio field
|
|
39
|
+
*/
|
|
40
|
+
resetField() {
|
|
41
|
+
this._internals.setFormValue(null);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Reset the radio field items tab indeces
|
|
45
|
+
*/
|
|
46
|
+
resetTabIndeces(radioFieldItems) {
|
|
47
|
+
radioFieldItems.forEach((element) => {
|
|
48
|
+
element.shadowRoot.querySelector('.cre8-c-radio-field-item__input').setAttribute('tabindex', '0');
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Remove checked
|
|
53
|
+
* 1) Remove checked property from all items and set tabindex to -1
|
|
54
|
+
* 2) Reset the form field to not checked
|
|
55
|
+
*/
|
|
56
|
+
removeChecked() {
|
|
57
|
+
if (this.parentNode) {
|
|
58
|
+
/* 1 */
|
|
59
|
+
const radioFieldItems = this.parentNode.querySelectorAll('cre8-radio-field-item');
|
|
60
|
+
radioFieldItems.forEach((element) => {
|
|
61
|
+
element.checked = false;
|
|
62
|
+
element.shadowRoot.querySelector('.cre8-c-radio-field-item__input').setAttribute('tabindex', '-1');
|
|
63
|
+
element.resetField(); /* 2 */
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Reset form callback
|
|
69
|
+
* 1) Remove the checked state from all radio elements
|
|
70
|
+
* 2) Set the checked state to the initial checked state
|
|
71
|
+
* 3) Set the radio field input checked attribute to the initial checked state
|
|
72
|
+
*/
|
|
73
|
+
formResetCallback() {
|
|
74
|
+
this.removeChecked();
|
|
75
|
+
this.checked = this.initialChecked;
|
|
76
|
+
this.field.checked = this.initialChecked;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* access role when radio-field-item embedded in radio-field
|
|
80
|
+
*/
|
|
81
|
+
_getRole() {
|
|
82
|
+
const radioFieldContainer = this.closest('cre8-radio-field');
|
|
83
|
+
if (radioFieldContainer) {
|
|
84
|
+
return 'listitem';
|
|
85
|
+
}
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Toggle active state of primary nav item
|
|
90
|
+
* 1) Remove isActive state from all sibling elements
|
|
91
|
+
* 2) Toggle active state of element selected
|
|
92
|
+
*/
|
|
93
|
+
_clickHandler() {
|
|
94
|
+
this.removeChecked();
|
|
95
|
+
this.checked = !this.checked; /* 2 */
|
|
96
|
+
const radioInput = this.shadowRoot?.querySelector('.cre8-c-radio-field-item__input');
|
|
97
|
+
if (radioInput) {
|
|
98
|
+
radioInput.setAttribute('tabindex', '0');
|
|
99
|
+
}
|
|
100
|
+
return this.checked ? this._internals.setFormValue(this.value || 'on') : this._internals.setFormValue(null);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handle sibling element updates during handleKeyDown function
|
|
104
|
+
* 1) Prevent default keyboard functionality to disable scroll with up/down keys
|
|
105
|
+
* 2) Trigger removeChecked
|
|
106
|
+
* 3) Focus sibling shadowRoot element
|
|
107
|
+
* 4) Click sibling shadowRoot element
|
|
108
|
+
* 5) Set sibling element `tabindex` to `0`
|
|
109
|
+
* 6) Set sibling element `checked` value
|
|
110
|
+
*/
|
|
111
|
+
_updateSibling(event, sibling, element) {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
this.removeChecked();
|
|
114
|
+
element.focus();
|
|
115
|
+
element.click();
|
|
116
|
+
element.setAttribute('tabindex', '0');
|
|
117
|
+
sibling.setAttribute('checked', '');
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Handle keydown
|
|
121
|
+
* 1) If left or up arrow key is struck and radio field item exists before current item,
|
|
122
|
+
* remove checked from all items and add it to the next item
|
|
123
|
+
* 2) If right or down arrow key is struck and radio field item exists after current item,
|
|
124
|
+
* remove checked from all items and add checked to the next item. Focus on this item
|
|
125
|
+
* and set tabindex for when focusing out of radio field and back onto checked item.
|
|
126
|
+
* 3) If the element is in focused, then for event emission the current
|
|
127
|
+
* focues element should be clicked to emit event.
|
|
128
|
+
* 4) If the Tab key is pressed, and none of the items are checked
|
|
129
|
+
* then jump away from field set to the next tabbable item
|
|
130
|
+
*/
|
|
131
|
+
handleKeyDown(e) {
|
|
132
|
+
if (e.code === 'ArrowLeft' || e.code === 'ArrowUp') {
|
|
133
|
+
/* 1 */
|
|
134
|
+
const previous = this.previousElementSibling;
|
|
135
|
+
const previousElement = previous?.shadowRoot?.querySelector('.cre8-c-radio-field-item__input:not([disabled])');
|
|
136
|
+
if (previousElement) {
|
|
137
|
+
this._updateSibling(e, previous, previousElement);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (e.code === 'ArrowRight' || e.code === 'ArrowDown') {
|
|
141
|
+
/* 2 */
|
|
142
|
+
const next = this.nextElementSibling;
|
|
143
|
+
const nextElement = next?.shadowRoot?.querySelector('.cre8-c-radio-field-item__input:not([disabled])');
|
|
144
|
+
if (nextElement) {
|
|
145
|
+
this._updateSibling(e, next, nextElement);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if (e.code === 'Tab' && !this.checked) {
|
|
149
|
+
const radioFieldItems = this.parentNode.querySelectorAll('cre8-radio-field-item');
|
|
150
|
+
radioFieldItems.forEach((element) => {
|
|
151
|
+
element.shadowRoot.querySelector('.cre8-c-radio-field-item__input').setAttribute('tabindex', '-1');
|
|
152
|
+
});
|
|
153
|
+
// After making tabbing away from the feildset,
|
|
154
|
+
// reset the items to be tabbable again so the user can come back to the fieldset
|
|
155
|
+
setTimeout(this.resetTabIndeces, 100, radioFieldItems);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
render() {
|
|
159
|
+
const componentClassNames = this.componentClassNames('cre8-c-radio-field-item', {
|
|
160
|
+
'cre8-c-radio-field-item--error': this.isError,
|
|
161
|
+
'cre8-c-radio-field-item--success': this.isSuccess,
|
|
162
|
+
'cre8-c-radio-field-item--disabled': this.disabled,
|
|
163
|
+
});
|
|
164
|
+
const isChecked = this.checked === true || this.initialChecked === true;
|
|
165
|
+
return html `
|
|
166
|
+
<div role=${ifDefined(this._getRole())} class="${componentClassNames}" @keydown=${this.handleKeyDown}>
|
|
125
167
|
<input
|
|
126
168
|
class="cre8-c-radio-field-item__input"
|
|
127
169
|
type="radio"
|
|
128
170
|
@input=${this._clickHandler}
|
|
129
171
|
id=${this.fieldId}
|
|
130
|
-
aria-describedby="${
|
|
131
|
-
required=${
|
|
132
|
-
aria-invalid=${this.required ? !!this.isError :
|
|
172
|
+
aria-describedby="${ifDefined(this.ariaDescribedBy)}"
|
|
173
|
+
required=${ifDefined(this.required)}
|
|
174
|
+
aria-invalid=${this.required ? !!this.isError : ifDefined(this.isError)}
|
|
133
175
|
name=${this.name}
|
|
134
176
|
.value=${this.value}
|
|
135
|
-
disabled="${
|
|
136
|
-
.checked="${
|
|
177
|
+
disabled="${ifDefined(this.disabled)}"
|
|
178
|
+
.checked="${isChecked}"
|
|
137
179
|
/>
|
|
138
180
|
<span class="cre8-c-radio-field-item__custom-radio">
|
|
139
181
|
<div class="cre8-c-radio-field-item__inner-circle"></div>
|
|
140
182
|
</span>
|
|
141
183
|
<label class="cre8-c-radio-field-item__label" for=${this.fieldId}>${this.label}</label>
|
|
142
184
|
</div>
|
|
143
|
-
${this.fieldNote
|
|
185
|
+
${this.fieldNote
|
|
186
|
+
? html `<cre8-field-note
|
|
144
187
|
?inverted=${this.fieldNoteKnockout}
|
|
145
|
-
id=${
|
|
146
|
-
iconName=${
|
|
188
|
+
id=${ifDefined(this.ariaDescribedBy)}
|
|
189
|
+
iconName=${ifDefined(this.fieldNoteIconName)}
|
|
147
190
|
?isSuccess=${this.isSuccess}
|
|
148
191
|
?isError=${this.isError}
|
|
149
192
|
>
|
|
150
193
|
${this.fieldNote}
|
|
151
|
-
</cre8-field-note>`
|
|
194
|
+
</cre8-field-note>`
|
|
195
|
+
: ''}
|
|
152
196
|
`;
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
customElements.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
Cre8RadioFieldItem.styles = [styles];
|
|
200
|
+
__decorate([
|
|
201
|
+
property()
|
|
202
|
+
], Cre8RadioFieldItem.prototype, "ariaDescribedBy", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
property({ type: Boolean, reflect: true })
|
|
205
|
+
], Cre8RadioFieldItem.prototype, "checked", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ type: Boolean, reflect: true })
|
|
208
|
+
], Cre8RadioFieldItem.prototype, "disabled", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
query('input')
|
|
211
|
+
], Cre8RadioFieldItem.prototype, "field", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property()
|
|
214
|
+
], Cre8RadioFieldItem.prototype, "fieldId", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property()
|
|
217
|
+
], Cre8RadioFieldItem.prototype, "fieldNote", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property()
|
|
220
|
+
], Cre8RadioFieldItem.prototype, "fieldNoteIconName", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ type: Boolean, reflect: true })
|
|
223
|
+
], Cre8RadioFieldItem.prototype, "fieldNoteKnockout", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
property({ type: Boolean, reflect: true })
|
|
226
|
+
], Cre8RadioFieldItem.prototype, "fieldNoteIsError", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: Boolean, reflect: true })
|
|
229
|
+
], Cre8RadioFieldItem.prototype, "isError", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
property({ type: Boolean, reflect: true })
|
|
232
|
+
], Cre8RadioFieldItem.prototype, "isSuccess", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
property()
|
|
235
|
+
], Cre8RadioFieldItem.prototype, "label", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
property({ type: Boolean, reflect: true })
|
|
238
|
+
], Cre8RadioFieldItem.prototype, "required", void 0);
|
|
239
|
+
if (customElements.get('cre8-radio-field-item') === undefined) {
|
|
240
|
+
customElements.define('cre8-radio-field-item', Cre8RadioFieldItem);
|
|
241
|
+
}
|
|
242
|
+
export default Cre8RadioFieldItem;
|
|
243
|
+
//# sourceMappingURL=radio-field-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-field-item.js","sourceRoot":"","sources":["../../../components/radio-field-item/radio-field-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,0BAA0B,CAAC;AAClC,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAE9C;;;;GAIG;AAEP,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IAAvD;;QACI,SAAI,GAAG,OAAO,CAAC;IA0SnB,CAAC;IA7LG;;;;;OAKG;IACH,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC,OAAO;QAChD,IAAI,IAAI,CAAC,SAAS,EAA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H,QAAQ,EAAE;qDACY;AASnB;IADH,QAAQ,EAAE;6DACoB;AAQ3B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6DACX;AAQ5B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4DACZ;AAQ3B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACrB;AAQlB;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDACnB;AAMpB;IADH,QAAQ,EAAE;iDACQ;AAQf;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACpB;AAsM3B,IAAI,cAAc,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,SAAS,EAAE,CAAC;IAC5D,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAAC;AACvE,CAAC;AAQD,eAAe,kBAAkB,CAAC","sourcesContent":["import { html, } from 'lit';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\nimport { property, query } from 'lit/decorators.js';\nimport { nanoid } from 'nanoid';\nimport { Cre8FormElement } from '../cre8-form-element';\nimport '../field-note/field-note';\nimport styles from './radio-field-item.styles.js';\n\n /**\n * A Radio Field Item adds a radio button to a Radio Field. Radio buttons let a user choose only one of several\n * options. Do not use a single radio button, because once selected, it cannot be de-selected. If the user can only\n * choose one, none or many options, use Checkbox instead.\n */\n\nexport class Cre8RadioFieldItem extends Cre8FormElement {\n type = 'radio';\n\n static styles = [styles];\n\n /**\n * Identifies the element that provides a detailed, extended description for the object.\n *\n * @attr{string}\n */\n @property()\n ariaDescribedBy?: string;\n\n /**\n * A Boolean attribute which, if present, sets the radio button as selected.\n *\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n checked?: boolean;\n\n /**\n * The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with\n * the form. The user can neither edit nor focus on the control, nor its form control descendants.\n *\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n disabled?: boolean;\n\n /**\n * Get the radio field item input\n */\n @query('input')\n field!: HTMLInputElement;\n\n /**\n * The fieldId attribute is assigned to the HTML input element of the radio button and the for attribute of the\n * corresponding label.\n */\n @property()\n fieldId?: string;\n\n /**\n * A FieldNote can be placed to provide guidance. It's frequently used to in the context of form fields for extra\n * information or validation messages.\n */\n @property()\n fieldNote?: string;\n\n /**\n * Sets the item fieldnote icon.\n *\n * - **check** renders a badge with success state treatment\n * - **error** renders a badge with error state treatment\n */\n @property()\n fieldNoteIconName?: string;\n\n /**\n * Radio item fieldnote knockout\n *\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n fieldNoteKnockout?: boolean;\n\n /**\n * Sets the error state of the fieldnote.\n *\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n fieldNoteIsError?: boolean;\n\n /**\n * The isError attribute is used to indicate an error state related to the radio button.\n *\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isError?: boolean;\n\n /**\n * The isSuccess attribute is used to indicate a success state related to the radio button.\n *\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isSuccess?: boolean;\n\n /**\n * The label attribute is used to assign a value to the label element corresponding to this radio button.\n */\n @property()\n label?: string;\n\n /**\n * Required attribute\n *\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n required?: boolean;\n\n /**\n * Initial checked for initial checked state\n */\n private initialChecked?: boolean;\n\n /**\n * Connected callback lifecycle\n * 1) Set the initial checked value to the checked property\n * 2) Auto-generate the fieldId if a user doesn't provided so that the form field is accessible\n * 3) If a field note exists, set the aria-describedby attribute to make sure the field note is read out\n */\n connectedCallback() {\n super.connectedCallback();\n this.fieldId = this.fieldId || nanoid(); /* 2 */\n if (this.fieldNote) {\n this.ariaDescribedBy = this.ariaDescribedBy || nanoid(); /* 3 */\n }\n }\n\n /**\n * Reset the radio field\n */\n public resetField() {\n this._internals.setFormValue(null);\n }\n\n /**\n * Reset the radio field items tab indeces\n */\n resetTabIndeces(radioFieldItems: Cre8RadioFieldItem[]) {\n radioFieldItems.forEach((element: HTMLElement) => {\n element.shadowRoot.querySelector('.cre8-c-radio-field-item__input').setAttribute('tabindex', '0');\n });\n }\n\n /**\n * Remove checked\n * 1) Remove checked property from all items and set tabindex to -1\n * 2) Reset the form field to not checked\n */\n removeChecked() {\n if (this.parentNode) {\n /* 1 */\n const radioFieldItems = this.parentNode.querySelectorAll('cre8-radio-field-item');\n radioFieldItems.forEach((element: Cre8RadioFieldItem) => {\n element.checked = false;\n element.shadowRoot.querySelector('.cre8-c-radio-field-item__input').setAttribute('tabindex', '-1');\n element.resetField(); /* 2 */\n });\n }\n }\n\n /**\n * Reset form callback\n * 1) Remove the checked state from all radio elements\n * 2) Set the checked state to the initial checked state\n * 3) Set the radio field input checked attribute to the initial checked state\n */\n formResetCallback(): void {\n this.removeChecked();\n this.checked = this.initialChecked;\n this.field.checked = this.initialChecked;\n }\n\n /**\n * access role when radio-field-item embedded in radio-field\n */\n private _getRole() {\n const radioFieldContainer = this.closest('cre8-radio-field');\n if (radioFieldContainer) {\n return 'listitem';\n }\n return '';\n }\n\n /**\n * Toggle active state of primary nav item\n * 1) Remove isActive state from all sibling elements\n * 2) Toggle active state of element selected\n */\n private _clickHandler() {\n this.removeChecked();\n this.checked = !this.checked; /* 2 */\n const radioInput = this.shadowRoot?.querySelector<HTMLInputElement>('.cre8-c-radio-field-item__input');\n if (radioInput) {\n radioInput.setAttribute('tabindex', '0');\n }\n return this.checked ? this._internals.setFormValue(this.value || 'on') : this._internals.setFormValue(null);\n }\n\n /**\n * Handle sibling element updates during handleKeyDown function\n * 1) Prevent default keyboard functionality to disable scroll with up/down keys\n * 2) Trigger removeChecked\n * 3) Focus sibling shadowRoot element\n * 4) Click sibling shadowRoot element\n * 5) Set sibling element `tabindex` to `0`\n * 6) Set sibling element `checked` value\n */\n private _updateSibling(event: KeyboardEvent, sibling: Element, element: HTMLElement) {\n event.preventDefault();\n this.removeChecked();\n element.focus();\n element.click();\n element.setAttribute('tabindex', '0');\n sibling.setAttribute('checked', '');\n }\n\n /**\n * Handle keydown\n * 1) If left or up arrow key is struck and radio field item exists before current item,\n * remove checked from all items and add it to the next item\n * 2) If right or down arrow key is struck and radio field item exists after current item,\n * remove checked from all items and add checked to the next item. Focus on this item\n * and set tabindex for when focusing out of radio field and back onto checked item.\n * 3) If the element is in focused, then for event emission the current\n * focues element should be clicked to emit event.\n * 4) If the Tab key is pressed, and none of the items are checked\n * then jump away from field set to the next tabbable item\n */\n handleKeyDown(e: KeyboardEvent) {\n if (e.code === 'ArrowLeft' || e.code === 'ArrowUp') {\n /* 1 */\n const previous = this.previousElementSibling;\n const previousElement = previous?.shadowRoot?.querySelector<HTMLInputElement>(\n '.cre8-c-radio-field-item__input:not([disabled])'\n );\n\n if (previousElement) {\n this._updateSibling(e, previous, previousElement);\n }\n } else if (e.code === 'ArrowRight' || e.code === 'ArrowDown') {\n /* 2 */\n const next = this.nextElementSibling;\n const nextElement = next?.shadowRoot?.querySelector<HTMLInputElement>(\n '.cre8-c-radio-field-item__input:not([disabled])'\n );\n if (nextElement) {\n this._updateSibling(e, next, nextElement);\n }\n } else if (e.code === 'Tab' && !this.checked) {\n const radioFieldItems = this.parentNode.querySelectorAll('cre8-radio-field-item');\n radioFieldItems.forEach((element: HTMLElement) => {\n element.shadowRoot.querySelector('.cre8-c-radio-field-item__input').setAttribute('tabindex', '-1');\n });\n\n // After making tabbing away from the feildset,\n // reset the items to be tabbable again so the user can come back to the fieldset\n setTimeout(this.resetTabIndeces, 100, radioFieldItems);\n }\n }\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-radio-field-item', {\n 'cre8-c-radio-field-item--error': this.isError,\n 'cre8-c-radio-field-item--success': this.isSuccess,\n 'cre8-c-radio-field-item--disabled': this.disabled,\n });\n\n const isChecked = this.checked === true || this.initialChecked === true;\n\n return html`\n <div role=${ifDefined(this._getRole())} class=\"${componentClassNames}\" @keydown=${this.handleKeyDown}>\n <input\n class=\"cre8-c-radio-field-item__input\"\n type=\"radio\"\n @input=${this._clickHandler}\n id=${this.fieldId}\n aria-describedby=\"${ifDefined(this.ariaDescribedBy)}\"\n required=${ifDefined(this.required)}\n aria-invalid=${this.required ? !!this.isError : ifDefined(this.isError)}\n name=${this.name}\n .value=${this.value}\n disabled=\"${ifDefined(this.disabled)}\"\n .checked=\"${isChecked}\"\n />\n <span class=\"cre8-c-radio-field-item__custom-radio\">\n <div class=\"cre8-c-radio-field-item__inner-circle\"></div>\n </span>\n <label class=\"cre8-c-radio-field-item__label\" for=${this.fieldId}>${this.label}</label>\n </div>\n ${this.fieldNote\n ? html`<cre8-field-note\n ?inverted=${this.fieldNoteKnockout}\n id=${ifDefined(this.ariaDescribedBy)}\n iconName=${ifDefined(this.fieldNoteIconName)}\n ?isSuccess=${this.isSuccess}\n ?isError=${this.isError}\n >\n ${this.fieldNote}\n </cre8-field-note>`\n : ''}\n `;\n }\n}\n\nif (customElements.get('cre8-radio-field-item') === undefined) {\n customElements.define('cre8-radio-field-item', Cre8RadioFieldItem);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-radio-field-item': Cre8RadioFieldItem;\n }\n}\n\nexport default Cre8RadioFieldItem;\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
const styles = css `*,::slotted(*),*:before,*:after{box-sizing:border-box}:root{--size-base-unit: 0.5rem}[dir=rtl]{--rtlTranslateX: 50%;--rtlGradientToRight: 270deg;--rtlRotate45Inverse: -45deg}:host{--cre8-z-index-1: 1;--cre8-z-index-50: 50;--cre8-z-index-100: 100;--cre8-z-index-200: 200;--cre8-z-index-1030: 1030;--cre8-anim-fade-quick: 0.35s;--cre8-anim-ease: ease}@keyframes fadeIn{100%{opacity:1}}@keyframes slideIn{100%{transform:translateX(0)}}@keyframes slideInFwd{100%{width:272px;height:272px}}@keyframes slideOutRight{100%{width:272px;height:272px}}@keyframes slideUp{100%{transform:translateY(0)}}@media(width >= 481px){@keyframes slideInFwd{100%{width:417px;height:417px}}@keyframes slideOutRight{100%{width:417px;height:417px}}}@media(width >= 48rem){@keyframes slideInFwd{100%{width:330px;height:330px}}@keyframes slideOutRight{100%{width:330px;height:330px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 60rem){@keyframes slideInFwd{100%{width:460px;height:460px}}@keyframes slideOutRight{100%{width:460px;height:460px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 75rem){@keyframes slideInFwd{100%{width:592px;height:591px}}@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 87.5rem){@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 120px))}}}@media(width >= 2200px){@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 592px))}}}span.ripple{position:absolute;border-radius:50%;transform:scale(0);animation:ripple 600ms linear;background-color:var(--ripple-bg-color)}@keyframes ripple{to{transform:scale(4);opacity:1}}:root{--size-base-unit: 0.5rem}[dir=rtl]{--rtlTranslateX: 50%;--rtlGradientToRight: 270deg;--rtlRotate45Inverse: -45deg}:host{display:inline-flex}.cre8-c-radio-field-item{display:flex;position:relative;align-items:center;margin-bottom:0.5rem;min-height:1.5rem}:host(:last-child) .cre8-c-radio-field-item{margin-bottom:0}.cre8-c-radio-field-item__input{opacity:0;cursor:pointer;position:absolute;top:0;left:0;height:1.5rem;min-width:1.5rem;margin:0;z-index:1}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__input{cursor:not-allowed}.cre8-c-radio-field-item__custom-radio{display:flex;position:absolute;top:0;left:0;height:1.5rem;width:1.5rem;cursor:pointer;align-items:center;justify-content:center;border-radius:var(--cre8-border-radius-round);border-width:var(--cre8-border-width-default);border-style:var(--cre8-border-style-default);background-color:var(--cre8-color-bg-default);border-color:var(--cre8-color-border-strong)}.cre8-c-radio-field-item__input:focus-visible+.cre8-c-radio-field-item__custom-radio{outline:var(--cre8-border-width-focus) solid var(--cre8-color-border-active-outline);outline-offset:0.125rem}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__input:focus-visible+.cre8-c-radio-field-item__custom-radio{outline:var(--cre8-border-width-focus) solid var(--cre8-color-border-error);outline-offset:0.125rem;border-color:var(--cre8-color-border-error)}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__custom-radio{border-color:var(--cre8-color-border-error)}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__custom-radio{cursor:not-allowed;background-color:var(--cre8-color-bg-disabled);border-color:var(--cre8-color-border-disabled)}.cre8-c-radio-field-item__inner-circle{display:none;cursor:pointer;height:0.75rem;width:0.75rem;background:var(--cre8-color-content-brand);border-radius:var(--cre8-border-radius-round)}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__inner-circle{background:var(--cre8-color-bg-error-strong)}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__inner-circle{background:var(--cre8-color-content-disabled)}.cre8-c-radio-field-item__input:checked+.cre8-c-radio-field-item__custom-radio .cre8-c-radio-field-item__inner-circle{display:flex}.cre8-c-radio-field-item__label{margin-left:2rem;font-family:var(--cre8-typography-label-small-font-family);font-size:var(--cre8-typography-label-small-font-size);font-weight:var(--cre8-typography-label-small-font-weight);line-height:var(--cre8-typography-label-small-line-height);text-decoration:var(--cre8-typography-label-small-text-decoration);text-transform:var(--cre8-typography-label-small-text-transform)}`;
|
|
3
|
+
export default styles;
|
|
4
|
+
//# sourceMappingURL=radio-field-item.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-field-item.styles.js","sourceRoot":"","sources":["../../../components/radio-field-item/radio-field-item.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,MAAM,GAAG,GAAG,CAAA,wvIAAwvI,CAAC;AAC3wI,eAAe,MAAM,CAAC","sourcesContent":["import { css } from 'lit';\nconst styles = css`*,::slotted(*),*:before,*:after{box-sizing:border-box}:root{--size-base-unit: 0.5rem}[dir=rtl]{--rtlTranslateX: 50%;--rtlGradientToRight: 270deg;--rtlRotate45Inverse: -45deg}:host{--cre8-z-index-1: 1;--cre8-z-index-50: 50;--cre8-z-index-100: 100;--cre8-z-index-200: 200;--cre8-z-index-1030: 1030;--cre8-anim-fade-quick: 0.35s;--cre8-anim-ease: ease}@keyframes fadeIn{100%{opacity:1}}@keyframes slideIn{100%{transform:translateX(0)}}@keyframes slideInFwd{100%{width:272px;height:272px}}@keyframes slideOutRight{100%{width:272px;height:272px}}@keyframes slideUp{100%{transform:translateY(0)}}@media(width >= 481px){@keyframes slideInFwd{100%{width:417px;height:417px}}@keyframes slideOutRight{100%{width:417px;height:417px}}}@media(width >= 48rem){@keyframes slideInFwd{100%{width:330px;height:330px}}@keyframes slideOutRight{100%{width:330px;height:330px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 60rem){@keyframes slideInFwd{100%{width:460px;height:460px}}@keyframes slideOutRight{100%{width:460px;height:460px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 75rem){@keyframes slideInFwd{100%{width:592px;height:591px}}@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 45px))}}}@media(width >= 87.5rem){@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 120px))}}}@media(width >= 2200px){@keyframes slideOutRight{100%{width:592px;height:591px;transform:translateX(calc(100vw - 592px))}}}span.ripple{position:absolute;border-radius:50%;transform:scale(0);animation:ripple 600ms linear;background-color:var(--ripple-bg-color)}@keyframes ripple{to{transform:scale(4);opacity:1}}:root{--size-base-unit: 0.5rem}[dir=rtl]{--rtlTranslateX: 50%;--rtlGradientToRight: 270deg;--rtlRotate45Inverse: -45deg}:host{display:inline-flex}.cre8-c-radio-field-item{display:flex;position:relative;align-items:center;margin-bottom:0.5rem;min-height:1.5rem}:host(:last-child) .cre8-c-radio-field-item{margin-bottom:0}.cre8-c-radio-field-item__input{opacity:0;cursor:pointer;position:absolute;top:0;left:0;height:1.5rem;min-width:1.5rem;margin:0;z-index:1}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__input{cursor:not-allowed}.cre8-c-radio-field-item__custom-radio{display:flex;position:absolute;top:0;left:0;height:1.5rem;width:1.5rem;cursor:pointer;align-items:center;justify-content:center;border-radius:var(--cre8-border-radius-round);border-width:var(--cre8-border-width-default);border-style:var(--cre8-border-style-default);background-color:var(--cre8-color-bg-default);border-color:var(--cre8-color-border-strong)}.cre8-c-radio-field-item__input:focus-visible+.cre8-c-radio-field-item__custom-radio{outline:var(--cre8-border-width-focus) solid var(--cre8-color-border-active-outline);outline-offset:0.125rem}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__input:focus-visible+.cre8-c-radio-field-item__custom-radio{outline:var(--cre8-border-width-focus) solid var(--cre8-color-border-error);outline-offset:0.125rem;border-color:var(--cre8-color-border-error)}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__custom-radio{border-color:var(--cre8-color-border-error)}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__custom-radio{cursor:not-allowed;background-color:var(--cre8-color-bg-disabled);border-color:var(--cre8-color-border-disabled)}.cre8-c-radio-field-item__inner-circle{display:none;cursor:pointer;height:0.75rem;width:0.75rem;background:var(--cre8-color-content-brand);border-radius:var(--cre8-border-radius-round)}.cre8-c-radio-field-item--error .cre8-c-radio-field-item__inner-circle{background:var(--cre8-color-bg-error-strong)}.cre8-c-radio-field-item--disabled .cre8-c-radio-field-item__inner-circle{background:var(--cre8-color-content-disabled)}.cre8-c-radio-field-item__input:checked+.cre8-c-radio-field-item__custom-radio .cre8-c-radio-field-item__inner-circle{display:flex}.cre8-c-radio-field-item__label{margin-left:2rem;font-family:var(--cre8-typography-label-small-font-family);font-size:var(--cre8-typography-label-small-font-size);font-weight:var(--cre8-typography-label-small-font-weight);line-height:var(--cre8-typography-label-small-line-height);text-decoration:var(--cre8-typography-label-small-text-decoration);text-transform:var(--cre8-typography-label-small-text-transform)}`;\nexport default styles;\n"]}
|