@supersoniks/concorde 2.0.6 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-infos.json +1 -0
- package/index.html +44 -0
- package/notes de migration.md +21 -0
- package/package.json +23 -287
- package/scripts/prebuild.mjs +22 -0
- package/{components.js → src/components.ts} +5 -2
- package/src/concorde-loaded.ts +3 -0
- package/src/core/_types/types.ts +55 -0
- package/src/core/components/functional/date/date.md +290 -0
- package/src/core/components/functional/date/date.ts +206 -0
- package/src/core/components/functional/example/example.ts +11 -0
- package/src/core/components/functional/fetch/fetch.md +117 -0
- package/{core/components/functional/fetch/fetch.js → src/core/components/functional/fetch/fetch.ts} +33 -37
- package/src/core/components/functional/if/if.md +16 -0
- package/src/core/components/functional/if/if.test.ts +40 -0
- package/src/core/components/functional/if/if.ts +23 -0
- package/src/core/components/functional/list/list.md +194 -0
- package/src/core/components/functional/list/list.ts +236 -0
- package/src/core/components/functional/mix/mix.md +41 -0
- package/src/core/components/functional/mix/mix.ts +95 -0
- package/src/core/components/functional/queue/queue.md +87 -0
- package/src/core/components/functional/queue/queue.ts +279 -0
- package/src/core/components/functional/router/redirect.ts +44 -0
- package/src/core/components/functional/router/router.md +112 -0
- package/src/core/components/functional/router/router.ts +108 -0
- package/src/core/components/functional/sdui/SDUIDescriptorTransformer.ts +229 -0
- package/{core → src/core}/components/functional/sdui/default-library.json +13 -13
- package/src/core/components/functional/sdui/example.json +99 -0
- package/src/core/components/functional/sdui/sdui-utils.ts +62 -0
- package/src/core/components/functional/sdui/sdui.md +356 -0
- package/src/core/components/functional/sdui/sdui.ts +230 -0
- package/src/core/components/functional/sdui/types.ts +34 -0
- package/src/core/components/functional/sonic-scope/sonic-scope.ts +13 -0
- package/src/core/components/functional/states/states.md +87 -0
- package/src/core/components/functional/states/states.ts +121 -0
- package/src/core/components/functional/submit/submit.md +48 -0
- package/src/core/components/functional/submit/submit.ts +265 -0
- package/src/core/components/functional/subscriber/subscriber.md +91 -0
- package/src/core/components/functional/subscriber/subscriber.ts +28 -0
- package/src/core/components/functional/value/value.md +35 -0
- package/src/core/components/functional/value/value.ts +18 -0
- package/{core/components/ui/_css/scroll.js → src/core/components/ui/_css/scroll.ts} +3 -2
- package/{core/components/ui/_css/size.js → src/core/components/ui/_css/size.ts} +5 -2
- package/{core/components/ui/_css/type.js → src/core/components/ui/_css/type.ts} +5 -3
- package/src/core/components/ui/alert/alert.md +121 -0
- package/src/core/components/ui/alert/alert.ts +177 -0
- package/src/core/components/ui/badge/badge.md +102 -0
- package/{core/components/ui/badge/badge.js → src/core/components/ui/badge/badge.ts} +36 -51
- package/src/core/components/ui/button/button.md +184 -0
- package/{core/components/ui/button/button.js → src/core/components/ui/button/button.ts} +258 -302
- package/src/core/components/ui/captcha/captcha.md +12 -0
- package/src/core/components/ui/captcha/captcha.ts +88 -0
- package/src/core/components/ui/card/card-footer.ts +19 -0
- package/src/core/components/ui/card/card-header-descripton.ts +24 -0
- package/{core/components/ui/card/card-header.js → src/core/components/ui/card/card-header.ts} +28 -38
- package/src/core/components/ui/card/card-main.ts +24 -0
- package/src/core/components/ui/card/card.md +96 -0
- package/{core/components/ui/card/card.js → src/core/components/ui/card/card.ts} +23 -34
- package/src/core/components/ui/divider/divider.md +35 -0
- package/{core/components/ui/divider/divider.js → src/core/components/ui/divider/divider.ts} +35 -65
- package/src/core/components/ui/form/checkbox/checkbox.md +96 -0
- package/{core/components/ui/form/checkbox/checkbox.js → src/core/components/ui/form/checkbox/checkbox.ts} +79 -98
- package/{core/components/ui/form/css/form-control.js → src/core/components/ui/form/css/form-control.ts} +9 -5
- package/src/core/components/ui/form/fieldset/fieldset.md +129 -0
- package/src/core/components/ui/form/fieldset/fieldset.ts +96 -0
- package/src/core/components/ui/form/fieldset/legend-description.ts +23 -0
- package/src/core/components/ui/form/fieldset/legend.ts +90 -0
- package/src/core/components/ui/form/form-actions/form-actions.md +77 -0
- package/src/core/components/ui/form/form-actions/form-actions.ts +32 -0
- package/src/core/components/ui/form/form-layout/form-layout.md +43 -0
- package/src/core/components/ui/form/form-layout/form-layout.ts +71 -0
- package/src/core/components/ui/form/input/input.md +168 -0
- package/src/core/components/ui/form/input/input.ts +227 -0
- package/src/core/components/ui/form/input/password-helper.ts +68 -0
- package/src/core/components/ui/form/input/same-value-helper.ts +48 -0
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +285 -0
- package/src/core/components/ui/form/radio/radio.md +86 -0
- package/src/core/components/ui/form/radio/radio.ts +44 -0
- package/src/core/components/ui/form/select/select.md +99 -0
- package/src/core/components/ui/form/select/select.ts +310 -0
- package/src/core/components/ui/form/textarea/textarea.md +66 -0
- package/src/core/components/ui/form/textarea/textarea.ts +119 -0
- package/src/core/components/ui/group/group.md +75 -0
- package/src/core/components/ui/group/group.ts +101 -0
- package/src/core/components/ui/icon/icon.md +125 -0
- package/src/core/components/ui/icon/icon.stories.ts +100 -0
- package/src/core/components/ui/icon/icon.ts +106 -0
- package/src/core/components/ui/icon/icons.json +1 -0
- package/src/core/components/ui/icon/icons.ts +130 -0
- package/src/core/components/ui/icon/svgs/cancel.svg +3 -0
- package/src/core/components/ui/icon/svgs/check-circled-outline.svg +4 -0
- package/src/core/components/ui/icon/svgs/check.svg +3 -0
- package/src/core/components/ui/icon/svgs/emoji-puzzled.svg +1 -0
- package/src/core/components/ui/icon/svgs/info-empty.svg +5 -0
- package/src/core/components/ui/icon/svgs/loader.svg +1 -0
- package/src/core/components/ui/icon/svgs/minus-small.svg +3 -0
- package/src/core/components/ui/icon/svgs/more-horiz.svg +5 -0
- package/src/core/components/ui/icon/svgs/more-vert.svg +5 -0
- package/src/core/components/ui/icon/svgs/nav-arrow-down.svg +3 -0
- package/src/core/components/ui/icon/svgs/warning-circled-outline.svg +5 -0
- package/src/core/components/ui/image/image.md +107 -0
- package/src/core/components/ui/image/image.ts +117 -0
- package/src/core/components/ui/link/link.md +43 -0
- package/src/core/components/ui/link/link.ts +108 -0
- package/src/core/components/ui/loader/loader.md +37 -0
- package/src/core/components/ui/loader/loader.stories.ts +25 -0
- package/src/core/components/ui/loader/loader.ts +81 -0
- package/{core/components/ui/loader/styles/fixed.js → src/core/components/ui/loader/styles/fixed.ts} +2 -1
- package/{core/components/ui/loader/styles/inline.js → src/core/components/ui/loader/styles/inline.ts} +3 -2
- package/src/core/components/ui/menu/menu-item.ts +30 -0
- package/src/core/components/ui/menu/menu.md +288 -0
- package/src/core/components/ui/menu/menu.ts +292 -0
- package/src/core/components/ui/modal/modal-actions.ts +35 -0
- package/src/core/components/ui/modal/modal-close.ts +36 -0
- package/src/core/components/ui/modal/modal-content.ts +19 -0
- package/src/core/components/ui/modal/modal-subtitle.ts +23 -0
- package/src/core/components/ui/modal/modal-title.ts +22 -0
- package/src/core/components/ui/modal/modal.md +123 -0
- package/src/core/components/ui/modal/modal.stories.ts +140 -0
- package/src/core/components/ui/modal/modal.ts +386 -0
- package/src/core/components/ui/pop/pop.md +79 -0
- package/src/core/components/ui/pop/pop.ts +291 -0
- package/src/core/components/ui/progress/progress.md +65 -0
- package/{core/components/ui/progress/progress.js → src/core/components/ui/progress/progress.ts} +31 -50
- package/src/core/components/ui/table/table-caption.ts +21 -0
- package/src/core/components/ui/table/table-tbody.ts +32 -0
- package/src/core/components/ui/table/table-td.ts +47 -0
- package/src/core/components/ui/table/table-tfoot.ts +20 -0
- package/src/core/components/ui/table/table-th.ts +56 -0
- package/src/core/components/ui/table/table-thead.ts +18 -0
- package/src/core/components/ui/table/table-tr.ts +48 -0
- package/src/core/components/ui/table/table.md +467 -0
- package/{core/components/ui/table/table.js → src/core/components/ui/table/table.ts} +32 -53
- package/{core/components/ui/theme/theme-collection/core-variables.js → src/core/components/ui/theme/theme-collection/core-variables.ts} +3 -2
- package/{core/components/ui/theme/theme-collection/dark.js → src/core/components/ui/theme/theme-collection/dark.ts} +5 -3
- package/{core/components/ui/theme/theme-collection/light.js → src/core/components/ui/theme/theme-collection/light.ts} +3 -2
- package/src/core/components/ui/theme/theme.ts +118 -0
- package/src/core/components/ui/toast/message-subscriber.stories.ts +43 -0
- package/src/core/components/ui/toast/message-subscriber.ts +37 -0
- package/{core/components/ui/toast/toast-item.js → src/core/components/ui/toast/toast-item.ts} +86 -113
- package/src/core/components/ui/toast/toast.ts +237 -0
- package/src/core/components/ui/toast/types.ts +14 -0
- package/src/core/components/ui/tooltip/tooltip.md +37 -0
- package/{core/components/ui/tooltip/tooltip.js → src/core/components/ui/tooltip/tooltip.ts} +26 -47
- package/{core/components/ui/ui.js → src/core/components/ui/ui.ts} +2 -0
- package/src/core/core.ts +22 -0
- package/src/core/decorators/Subscriber.ts +187 -0
- package/src/core/directives/DataProvider.ts +113 -0
- package/src/core/directives/Wording.ts +220 -0
- package/src/core/mixins/Fetcher.ts +258 -0
- package/src/core/mixins/FormCheckable.ts +287 -0
- package/src/core/mixins/FormElement.ts +275 -0
- package/src/core/mixins/FormInput.ts +135 -0
- package/src/core/mixins/Subscriber.ts +352 -0
- package/src/core/mixins/TemplatesContainer.ts +70 -0
- package/{core/mixins/mixins.d.ts → src/core/mixins/mixins.ts} +1 -1
- package/src/core/utils/Arrays.ts +161 -0
- package/src/core/utils/DataBindObserver.ts +286 -0
- package/src/core/utils/Electron.ts +15 -0
- package/src/core/utils/Format.ts +58 -0
- package/src/core/utils/HTML.ts +126 -0
- package/src/core/utils/LocationHandler.ts +139 -0
- package/src/core/utils/Objects.ts +103 -0
- package/src/core/utils/PublisherProxy.ts +786 -0
- package/src/core/utils/Utils.ts +12 -0
- package/src/core/utils/api.ts +456 -0
- package/{core/utils/url-pattern.d.ts → src/core/utils/url-pattern.ts} +1 -0
- package/{decorators.js → src/decorators.ts} +6 -2
- package/{directives.js → src/directives.ts} +11 -6
- package/src/docs/_core-concept/overview.md +57 -0
- package/src/docs/_core-concept/subscriber.md +76 -0
- package/src/docs/_getting-started/concorde-outside.md +141 -0
- package/src/docs/_getting-started/create-a-component.md +137 -0
- package/src/docs/_getting-started/pubsub.md +150 -0
- package/src/docs/_getting-started/start.md +37 -0
- package/src/docs/_getting-started/theming.md +91 -0
- package/src/docs/code.ts +281 -0
- package/src/docs/docs.ts +6 -0
- package/src/docs/example/users.ts +64 -0
- package/src/docs/navigation/navigation.ts +101 -0
- package/src/docs/prism/index.ts +6 -0
- package/src/docs/prism/prism.css +158 -0
- package/src/docs/prism/prism.js +1022 -0
- package/src/docs/search/docs-search.json +3767 -0
- package/src/docs/search/markdown-renderer.ts +40 -0
- package/src/docs/search/page.ts +40 -0
- package/src/docs/search/search.ts +184 -0
- package/src/docs.ts +2 -0
- package/src/index.ts +7 -0
- package/{mixins.js → src/mixins.ts} +10 -6
- package/src/tag-list.json +1 -0
- package/src/test-utils/TestUtils.ts +13 -0
- package/src/tsconfig.json +113 -0
- package/{utils.js → src/utils.ts} +15 -11
- package/test-utils/TestUtils.ts +13 -0
- package/vite/config.js +136 -0
- package/vite.config.mts +87 -0
- package/README.md +0 -27
- package/cli.js +0 -74
- package/components.d.ts +0 -4
- package/concorde-core.bundle.js +0 -3427
- package/concorde-core.es.js +0 -14199
- package/core/_types/types.d.ts +0 -28
- package/core/_types/types.js +0 -2
- package/core/components/functional/date/date.d.ts +0 -45
- package/core/components/functional/date/date.js +0 -243
- package/core/components/functional/example/example.d.ts +0 -7
- package/core/components/functional/example/example.js +0 -26
- package/core/components/functional/fetch/fetch.d.ts +0 -93
- package/core/components/functional/functional.js +0 -15
- package/core/components/functional/if/if.d.ts +0 -12
- package/core/components/functional/if/if.js +0 -38
- package/core/components/functional/if/if.test.d.ts +0 -1
- package/core/components/functional/if/if.test.js +0 -35
- package/core/components/functional/list/list.d.ts +0 -117
- package/core/components/functional/list/list.js +0 -214
- package/core/components/functional/mix/mix.d.ts +0 -22
- package/core/components/functional/mix/mix.js +0 -102
- package/core/components/functional/queue/queue.d.ts +0 -67
- package/core/components/functional/queue/queue.js +0 -310
- package/core/components/functional/router/redirect.d.ts +0 -18
- package/core/components/functional/router/redirect.js +0 -53
- package/core/components/functional/router/router.d.ts +0 -27
- package/core/components/functional/router/router.js +0 -119
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -58
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +0 -215
- package/core/components/functional/sdui/sdui-utils.d.ts +0 -5
- package/core/components/functional/sdui/sdui-utils.js +0 -63
- package/core/components/functional/sdui/sdui.d.ts +0 -136
- package/core/components/functional/sdui/sdui.js +0 -254
- package/core/components/functional/sdui/types.d.ts +0 -37
- package/core/components/functional/sdui/types.js +0 -1
- package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -5
- package/core/components/functional/sonic-scope/sonic-scope.js +0 -21
- package/core/components/functional/states/states.d.ts +0 -29
- package/core/components/functional/states/states.js +0 -134
- package/core/components/functional/submit/submit.d.ts +0 -30
- package/core/components/functional/submit/submit.js +0 -236
- package/core/components/functional/subscriber/subscriber.d.ts +0 -12
- package/core/components/functional/subscriber/subscriber.js +0 -38
- package/core/components/functional/value/value.d.ts +0 -7
- package/core/components/functional/value/value.js +0 -27
- package/core/components/ui/_css/scroll.d.ts +0 -1
- package/core/components/ui/_css/size.d.ts +0 -2
- package/core/components/ui/_css/type.d.ts +0 -2
- package/core/components/ui/alert/alert.d.ts +0 -34
- package/core/components/ui/alert/alert.js +0 -202
- package/core/components/ui/badge/badge.d.ts +0 -26
- package/core/components/ui/button/button.d.ts +0 -171
- package/core/components/ui/captcha/captcha.d.ts +0 -30
- package/core/components/ui/captcha/captcha.js +0 -93
- package/core/components/ui/card/card-footer.d.ts +0 -4
- package/core/components/ui/card/card-footer.js +0 -24
- package/core/components/ui/card/card-header-descripton.d.ts +0 -5
- package/core/components/ui/card/card-header-descripton.js +0 -32
- package/core/components/ui/card/card-header.d.ts +0 -8
- package/core/components/ui/card/card-main.d.ts +0 -4
- package/core/components/ui/card/card-main.js +0 -28
- package/core/components/ui/card/card.d.ts +0 -12
- package/core/components/ui/divider/divider.d.ts +0 -15
- package/core/components/ui/form/checkbox/checkbox.d.ts +0 -181
- package/core/components/ui/form/css/form-control.d.ts +0 -4
- package/core/components/ui/form/fieldset/fieldset.d.ts +0 -23
- package/core/components/ui/form/fieldset/fieldset.js +0 -118
- package/core/components/ui/form/fieldset/legend-description.d.ts +0 -5
- package/core/components/ui/form/fieldset/legend-description.js +0 -30
- package/core/components/ui/form/fieldset/legend.d.ts +0 -16
- package/core/components/ui/form/fieldset/legend.js +0 -112
- package/core/components/ui/form/form-actions/form-actions.d.ts +0 -7
- package/core/components/ui/form/form-actions/form-actions.js +0 -46
- package/core/components/ui/form/form-layout/form-layout.d.ts +0 -12
- package/core/components/ui/form/form-layout/form-layout.js +0 -83
- package/core/components/ui/form/input/input.d.ts +0 -106
- package/core/components/ui/form/input/input.js +0 -268
- package/core/components/ui/form/input/password-helper.d.ts +0 -25
- package/core/components/ui/form/input/password-helper.js +0 -119
- package/core/components/ui/form/input/same-value-helper.d.ts +0 -16
- package/core/components/ui/form/input/same-value-helper.js +0 -77
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +0 -136
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +0 -296
- package/core/components/ui/form/radio/radio.d.ts +0 -12
- package/core/components/ui/form/radio/radio.js +0 -50
- package/core/components/ui/form/select/select.d.ts +0 -58
- package/core/components/ui/form/select/select.js +0 -298
- package/core/components/ui/form/textarea/textarea.d.ts +0 -84
- package/core/components/ui/form/textarea/textarea.js +0 -150
- package/core/components/ui/group/group.d.ts +0 -16
- package/core/components/ui/group/group.js +0 -118
- package/core/components/ui/icon/icon.d.ts +0 -26
- package/core/components/ui/icon/icon.js +0 -113
- package/core/components/ui/icon/icons.d.ts +0 -10
- package/core/components/ui/icon/icons.js +0 -126
- package/core/components/ui/icon/icons.json +0 -1
- package/core/components/ui/image/image.d.ts +0 -15
- package/core/components/ui/image/image.js +0 -153
- package/core/components/ui/link/link.d.ts +0 -29
- package/core/components/ui/link/link.js +0 -124
- package/core/components/ui/loader/loader.d.ts +0 -23
- package/core/components/ui/loader/loader.js +0 -97
- package/core/components/ui/loader/styles/fixed.d.ts +0 -1
- package/core/components/ui/loader/styles/inline.d.ts +0 -1
- package/core/components/ui/menu/menu-item.d.ts +0 -5
- package/core/components/ui/menu/menu-item.js +0 -34
- package/core/components/ui/menu/menu.d.ts +0 -41
- package/core/components/ui/menu/menu.js +0 -313
- package/core/components/ui/modal/modal-actions.d.ts +0 -7
- package/core/components/ui/modal/modal-actions.js +0 -42
- package/core/components/ui/modal/modal-close.d.ts +0 -7
- package/core/components/ui/modal/modal-close.js +0 -43
- package/core/components/ui/modal/modal-content.d.ts +0 -5
- package/core/components/ui/modal/modal-content.js +0 -26
- package/core/components/ui/modal/modal-subtitle.d.ts +0 -5
- package/core/components/ui/modal/modal-subtitle.js +0 -30
- package/core/components/ui/modal/modal-title.d.ts +0 -5
- package/core/components/ui/modal/modal-title.js +0 -29
- package/core/components/ui/modal/modal.d.ts +0 -58
- package/core/components/ui/modal/modal.js +0 -401
- package/core/components/ui/pop/pop.d.ts +0 -37
- package/core/components/ui/pop/pop.js +0 -299
- package/core/components/ui/progress/progress.d.ts +0 -10
- package/core/components/ui/table/table-caption.d.ts +0 -5
- package/core/components/ui/table/table-caption.js +0 -28
- package/core/components/ui/table/table-tbody.d.ts +0 -5
- package/core/components/ui/table/table-tbody.js +0 -39
- package/core/components/ui/table/table-td.d.ts +0 -12
- package/core/components/ui/table/table-td.js +0 -68
- package/core/components/ui/table/table-tfoot.d.ts +0 -5
- package/core/components/ui/table/table-tfoot.js +0 -27
- package/core/components/ui/table/table-th.d.ts +0 -11
- package/core/components/ui/table/table-th.js +0 -73
- package/core/components/ui/table/table-thead.d.ts +0 -5
- package/core/components/ui/table/table-thead.js +0 -25
- package/core/components/ui/table/table-tr.d.ts +0 -13
- package/core/components/ui/table/table-tr.js +0 -66
- package/core/components/ui/table/table.d.ts +0 -17
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -1
- package/core/components/ui/theme/theme-collection/dark.d.ts +0 -1
- package/core/components/ui/theme/theme-collection/light.d.ts +0 -1
- package/core/components/ui/theme/theme.d.ts +0 -19
- package/core/components/ui/theme/theme.js +0 -124
- package/core/components/ui/toast/message-subscriber.d.ts +0 -18
- package/core/components/ui/toast/message-subscriber.js +0 -40
- package/core/components/ui/toast/toast-item.d.ts +0 -19
- package/core/components/ui/toast/toast.d.ts +0 -25
- package/core/components/ui/toast/toast.js +0 -226
- package/core/components/ui/toast/types.d.ts +0 -11
- package/core/components/ui/toast/types.js +0 -1
- package/core/components/ui/tooltip/tooltip.d.ts +0 -10
- package/core/components/ui/ui.d.ts +0 -32
- package/core/core.d.ts +0 -4
- package/core/core.js +0 -19
- package/core/decorators/Subscriber.d.ts +0 -4
- package/core/decorators/Subscriber.js +0 -166
- package/core/directives/DataProvider.d.ts +0 -23
- package/core/directives/DataProvider.js +0 -102
- package/core/directives/Wording.d.ts +0 -42
- package/core/directives/Wording.js +0 -202
- package/core/mixins/Fetcher.d.ts +0 -90
- package/core/mixins/Fetcher.js +0 -242
- package/core/mixins/FormCheckable.d.ts +0 -88
- package/core/mixins/FormCheckable.js +0 -306
- package/core/mixins/FormElement.d.ts +0 -32
- package/core/mixins/FormElement.js +0 -272
- package/core/mixins/FormInput.d.ts +0 -70
- package/core/mixins/FormInput.js +0 -81
- package/core/mixins/Subscriber.d.ts +0 -36
- package/core/mixins/Subscriber.js +0 -333
- package/core/mixins/TemplatesContainer.d.ts +0 -13
- package/core/mixins/TemplatesContainer.js +0 -69
- package/core/mixins/mixins.js +0 -6
- package/core/utils/Arrays.d.ts +0 -97
- package/core/utils/Arrays.js +0 -140
- package/core/utils/DataBindObserver.d.ts +0 -83
- package/core/utils/DataBindObserver.js +0 -264
- package/core/utils/Electron.d.ts +0 -7
- package/core/utils/Electron.js +0 -11
- package/core/utils/Format.d.ts +0 -12
- package/core/utils/Format.js +0 -38
- package/core/utils/HTML.d.ts +0 -42
- package/core/utils/HTML.js +0 -119
- package/core/utils/LocationHandler.d.ts +0 -46
- package/core/utils/LocationHandler.js +0 -133
- package/core/utils/Objects.d.ts +0 -28
- package/core/utils/Objects.js +0 -102
- package/core/utils/PublisherProxy.d.ts +0 -176
- package/core/utils/PublisherProxy.js +0 -709
- package/core/utils/Utils.d.ts +0 -4
- package/core/utils/Utils.js +0 -12
- package/core/utils/api.d.ts +0 -139
- package/core/utils/api.js +0 -391
- package/core/utils/url-pattern.js +0 -2
- package/decorators.d.ts +0 -3
- package/directives.d.ts +0 -40
- package/img/concorde-logo.svg +0 -1
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +0 -181
- package/svg/regular/plane.svg +0 -1
- package/svg/solid/plane.svg +0 -1
- package/test-utils/TestUtils.d.ts +0 -4
- package/test-utils/TestUtils.js +0 -12
- package/utils.d.ts +0 -20
- /package/{core/components/functional/functional.d.ts → src/core/components/functional/functional.ts} +0 -0
- /package/{core → src/core}/components/ui/theme/css/tailwind.css +0 -0
- /package/{core → src/core}/components/ui/theme/css/tailwind.d.ts +0 -0
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
import { html, LitElement, css } from "lit";
|
|
8
|
-
import { customElement, property } from "lit/decorators.js";
|
|
9
|
-
import { styleMap } from "lit/directives/style-map.js";
|
|
10
|
-
import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
1
|
+
import {html, LitElement, css} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
3
|
+
import {styleMap} from "lit/directives/style-map.js";
|
|
4
|
+
import {customScroll} from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
5
|
+
|
|
11
6
|
import "@supersoniks/concorde/core/components/ui/table/table-tr";
|
|
12
7
|
import "@supersoniks/concorde/core/components/ui/table/table-th";
|
|
13
8
|
import "@supersoniks/concorde/core/components/ui/table/table-td";
|
|
@@ -15,32 +10,15 @@ import "@supersoniks/concorde/core/components/ui/table/table-thead";
|
|
|
15
10
|
import "@supersoniks/concorde/core/components/ui/table/table-tbody";
|
|
16
11
|
import "@supersoniks/concorde/core/components/ui/table/table-tfoot";
|
|
17
12
|
import "@supersoniks/concorde/core/components/ui/table/table-caption";
|
|
18
|
-
import {
|
|
13
|
+
import {fontSize} from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
14
|
+
|
|
19
15
|
const tagName = "sonic-table";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.bordered = false;
|
|
24
|
-
this.rounded = false;
|
|
25
|
-
this.noCustomScroll = false;
|
|
26
|
-
}
|
|
27
|
-
render() {
|
|
28
|
-
const containerStyles = {
|
|
29
|
-
maxHeight: this.maxHeight,
|
|
30
|
-
};
|
|
31
|
-
return html `
|
|
32
|
-
<div class="table-container ${!this.noCustomScroll ? "custom-scroll" : ""}" style=${styleMap(containerStyles)}>
|
|
33
|
-
<div class="table">
|
|
34
|
-
<slot></slot>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
Table.styles = [
|
|
16
|
+
@customElement(tagName)
|
|
17
|
+
export class Table extends LitElement {
|
|
18
|
+
static styles = [
|
|
41
19
|
customScroll,
|
|
42
20
|
fontSize,
|
|
43
|
-
css
|
|
21
|
+
css`
|
|
44
22
|
:host {
|
|
45
23
|
--sc-table-fw: var(--sc-font-weight-base);
|
|
46
24
|
--sc-table-fst: var(--sc-font-style-base);
|
|
@@ -81,23 +59,24 @@ Table.styles = [
|
|
|
81
59
|
--sc-table-td-border-b: var(--sc-border-width) solid var(--sc-table-border-color);
|
|
82
60
|
}
|
|
83
61
|
`,
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
@property({type: String, reflect: true}) size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
65
|
+
@property({type: Boolean, reflect: true}) bordered = false;
|
|
66
|
+
@property({type: Boolean, reflect: true}) rounded = false;
|
|
67
|
+
@property({type: Boolean, reflect: true}) noCustomScroll = false;
|
|
68
|
+
@property({type: String}) maxHeight?: string;
|
|
69
|
+
|
|
70
|
+
render() {
|
|
71
|
+
const containerStyles = {
|
|
72
|
+
maxHeight: this.maxHeight,
|
|
73
|
+
};
|
|
74
|
+
return html`
|
|
75
|
+
<div class="table-container ${!this.noCustomScroll ? "custom-scroll" : ""}" style=${styleMap(containerStyles)}>
|
|
76
|
+
<div class="table">
|
|
77
|
+
<slot></slot>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {css} from "lit";
|
|
2
|
+
|
|
3
|
+
export const coreVariables = css`
|
|
3
4
|
:host {
|
|
4
5
|
/* polices*/
|
|
5
6
|
--sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {css} from "lit";
|
|
2
|
+
|
|
3
|
+
const darkCss = css`
|
|
3
4
|
--sc-primary: var(--sc-dark-primary, var(--sc-base-700));
|
|
4
5
|
--sc-info: var(--sc-dark-info, #3abff8);
|
|
5
6
|
--sc-danger: var(--sc-dark-danger, #f87272);
|
|
@@ -25,7 +26,8 @@ const darkCss = css `
|
|
|
25
26
|
--sc-base-900: var(--sc-dark-base-900, #e5e7eb);
|
|
26
27
|
--sc-base-content: var(--sc-dark-base-content, #e5e7eb);
|
|
27
28
|
`;
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
export const dark = css`
|
|
29
31
|
:host([theme="dark"]) {
|
|
30
32
|
${darkCss}
|
|
31
33
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {html, LitElement, css} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
3
|
+
import {coreVariables} from "@supersoniks/concorde/core/components/ui/theme/theme-collection/core-variables";
|
|
4
|
+
import {light} from "@supersoniks/concorde/core/components/ui/theme/theme-collection/light";
|
|
5
|
+
import {dark} from "@supersoniks/concorde/core/components/ui/theme/theme-collection/dark";
|
|
6
|
+
import {PublisherManager} from "@supersoniks/concorde/utils";
|
|
7
|
+
|
|
8
|
+
const tagName = "sonic-theme";
|
|
9
|
+
|
|
10
|
+
@customElement(tagName)
|
|
11
|
+
export class Theme extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
light,
|
|
14
|
+
dark,
|
|
15
|
+
coreVariables,
|
|
16
|
+
css`
|
|
17
|
+
:host([color]) {
|
|
18
|
+
color: var(--sc-base-content);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([font]) {
|
|
22
|
+
font-family: var(--sc-font-family-base), sans-serif;
|
|
23
|
+
font-weight: var(--sc-font-weight-base);
|
|
24
|
+
font-style: var(--sc-font-style-base);
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
static instance: Theme | undefined;
|
|
30
|
+
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
Theme.instance = this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* retourne le conteneur de tout ce qui pop : popups / modale / tooltip? / dropdown / ...
|
|
38
|
+
*/
|
|
39
|
+
public static getPopContainer() {
|
|
40
|
+
return Theme.instance || document.body;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@property({type: String, reflect: true})
|
|
44
|
+
theme = "light";
|
|
45
|
+
|
|
46
|
+
@property({type: Boolean, reflect: true}) background = false;
|
|
47
|
+
@property({type: Boolean, reflect: true}) color = false;
|
|
48
|
+
@property({type: Boolean, reflect: true}) font = false;
|
|
49
|
+
|
|
50
|
+
connectedCallback(): void {
|
|
51
|
+
super.connectedCallback();
|
|
52
|
+
window.addEventListener("message", (e) => this.receiveMessage(e), false);
|
|
53
|
+
window.dispatchEvent(new CustomEvent("SonicThemeReady"));
|
|
54
|
+
this.postCSSVars();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
postCSSVars() {
|
|
58
|
+
const stylesheets = document.styleSheets;
|
|
59
|
+
const ssLength = stylesheets.length;
|
|
60
|
+
const fontUrls: string[] = [];
|
|
61
|
+
for (let i = 0; i < ssLength; i++) {
|
|
62
|
+
const ss = stylesheets[i];
|
|
63
|
+
if (ss.href && (ss.href.includes("googleapis") || ss.href.includes("typekit.net"))) fontUrls.push(ss.href);
|
|
64
|
+
}
|
|
65
|
+
const theme = {
|
|
66
|
+
variables: this.getCssVariables(),
|
|
67
|
+
fonts: fontUrls,
|
|
68
|
+
};
|
|
69
|
+
PublisherManager.get("sonic-theme")?.set(theme);
|
|
70
|
+
document.querySelectorAll("iframe").forEach(
|
|
71
|
+
(elt) =>
|
|
72
|
+
elt.contentWindow?.postMessage(
|
|
73
|
+
{
|
|
74
|
+
type: "SonicTheme",
|
|
75
|
+
...theme,
|
|
76
|
+
},
|
|
77
|
+
"*"
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
receiveMessage(event: MessageEvent) {
|
|
83
|
+
const data = event.data;
|
|
84
|
+
if (!data.type || data.type != "GetSonicTheme") return;
|
|
85
|
+
this.postCSSVars();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getCssVariables() {
|
|
89
|
+
const names: Array<string> = [];
|
|
90
|
+
const stylesheets = [...Theme.styles.map((s) => s.styleSheet), ...Array.from(document.styleSheets)] as {
|
|
91
|
+
cssRules: {style: string[]}[] | CSSRuleList;
|
|
92
|
+
}[];
|
|
93
|
+
for (const stylesheet of stylesheets) {
|
|
94
|
+
try {
|
|
95
|
+
if (!stylesheet) continue;
|
|
96
|
+
const rules = stylesheet.cssRules;
|
|
97
|
+
for (const rule of rules) {
|
|
98
|
+
if (!("style" in rule)) continue;
|
|
99
|
+
const style = rule.style;
|
|
100
|
+
for (const name of style) {
|
|
101
|
+
if (names.includes(name) || name.indexOf("--sc") !== 0) continue;
|
|
102
|
+
names.push(name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} catch (e) {
|
|
106
|
+
console.log("Erreur lors de la récupération des variables CSS");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const style = window.getComputedStyle(this);
|
|
110
|
+
const result: Record<string, string> = {};
|
|
111
|
+
names.forEach((name) => (result[name] = style.getPropertyValue(name)));
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
render() {
|
|
116
|
+
return html`<slot></slot>`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {SonicToast} from "./toast";
|
|
2
|
+
import "./message-subscriber";
|
|
3
|
+
import "@supersoniks/concorde/core/components/ui/button/button";
|
|
4
|
+
import {PublisherManager} from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
5
|
+
import {html} from "lit";
|
|
6
|
+
|
|
7
|
+
// More on default export: https://storybook.js.org/docs/web-components/writing-stories/introduction#default-export
|
|
8
|
+
export default {
|
|
9
|
+
component: "sonic-toast-message-subscriber",
|
|
10
|
+
title: "core/components/ui/MessageSubscriber",
|
|
11
|
+
argTypes: {
|
|
12
|
+
status: {control: "select", options: ["success", "error", "warning", "info"]},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Template: any = (conf: any) => {
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
SonicToast.removeAll();
|
|
19
|
+
PublisherManager.get("toast-message-exemple").messages = [
|
|
20
|
+
{content: "Chargé via un message", status: conf.status, type: "public"},
|
|
21
|
+
];
|
|
22
|
+
}, 1);
|
|
23
|
+
return html`
|
|
24
|
+
<sonic-toast-message-subscriber dataProvider="toast-message-exemple"></sonic-toast-message-subscriber>
|
|
25
|
+
<!--
|
|
26
|
+
Cet exemple éxécute :
|
|
27
|
+
PublisherManager.get("toast-message-exemple").messages=
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
content:"Chargé via un message",
|
|
31
|
+
status:conf.status,
|
|
32
|
+
type:"public"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
-->
|
|
36
|
+
`;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Example = Template.bind({
|
|
40
|
+
title: "SonicToast",
|
|
41
|
+
text: "The modern web is here!",
|
|
42
|
+
status: "success",
|
|
43
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
4
|
+
import { SonicToast } from "@supersoniks/concorde/core/components/ui/toast/toast";
|
|
5
|
+
import { Message } from "@supersoniks/concorde/core/_types/types";
|
|
6
|
+
|
|
7
|
+
type APIResult = {
|
|
8
|
+
data?: object | string;
|
|
9
|
+
message?: string;
|
|
10
|
+
public_message?: string;
|
|
11
|
+
success?: boolean;
|
|
12
|
+
messages?: Message[];
|
|
13
|
+
status?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const tagName = "sonic-toast-message-subscriber";
|
|
17
|
+
|
|
18
|
+
//Superbe mix de multples versions d'api.
|
|
19
|
+
@customElement(tagName)
|
|
20
|
+
export class MessageSubscriber extends Subscriber(LitElement, {} as APIResult) {
|
|
21
|
+
_messages: Array<Message> = [];
|
|
22
|
+
@property({ type: Array }) get messages() {
|
|
23
|
+
return this._messages;
|
|
24
|
+
}
|
|
25
|
+
set messages(value) {
|
|
26
|
+
this._messages = value;
|
|
27
|
+
if (!this.messages) return;
|
|
28
|
+
value.forEach((message) => {
|
|
29
|
+
if (message.type == "public")
|
|
30
|
+
SonicToast.add({ text: message.content || "", status: message.status });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
return nothing;
|
|
36
|
+
}
|
|
37
|
+
}
|
package/{core/components/ui/toast/toast-item.js → src/core/components/ui/toast/toast-item.ts}
RENAMED
|
@@ -1,89 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
6
|
-
};
|
|
7
|
-
import { html, LitElement, css, nothing } from "lit";
|
|
8
|
-
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
-
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
1
|
+
import {html, LitElement, css, nothing} from "lit";
|
|
2
|
+
import {customElement, property, state} from "lit/decorators.js";
|
|
3
|
+
import {unsafeHTML} from "lit/directives/unsafe-html.js";
|
|
10
4
|
import "@supersoniks/concorde/core/components/ui/toast/types";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
import {ToastStatus} from "@supersoniks/concorde/core/components/ui/toast/types";
|
|
6
|
+
import {customScroll} from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
7
|
+
|
|
8
|
+
const icon: Record<string, string> = {
|
|
9
|
+
warning: "warning-circled-outline",
|
|
10
|
+
success: "check-circled-outline",
|
|
11
|
+
error: "warning-circled-outline",
|
|
12
|
+
info: "info-empty",
|
|
17
13
|
};
|
|
18
14
|
const tagName = "sonic-toast-item";
|
|
19
|
-
let SonicToastItem = class SonicToastItem extends LitElement {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.title = "";
|
|
23
|
-
this.id = "";
|
|
24
|
-
this.text = "";
|
|
25
|
-
this.status = "";
|
|
26
|
-
this.ghost = false;
|
|
27
|
-
this.preserve = false;
|
|
28
|
-
this.dismissForever = false;
|
|
29
|
-
this.maxHeight = "10rem";
|
|
30
|
-
this.visible = true;
|
|
31
|
-
}
|
|
32
|
-
// @queryAssignedElements({flatten: true, slot: main"})
|
|
33
|
-
// textSlot!: HTMLElement[];
|
|
34
|
-
render() {
|
|
35
|
-
// check if the toast is dismissed
|
|
36
|
-
if (this.dismissForever) {
|
|
37
|
-
const dismissed = localStorage.getItem("sonic-toast-dismissed") || "{}";
|
|
38
|
-
const dismissedObj = JSON.parse(dismissed);
|
|
39
|
-
if (dismissedObj[this.id]) {
|
|
40
|
-
return nothing;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (!this.visible) {
|
|
44
|
-
return nothing;
|
|
45
|
-
}
|
|
46
|
-
return html `<div class="sonic-toast ${this.status} ${this.ghost ? "ghost" : ""}">
|
|
47
|
-
<button aria-label="Close" class="sonic-toast-close" @click=${() => this.hide()}>
|
|
48
|
-
<sonic-icon name="cancel" size="lg"></sonic-icon>
|
|
49
|
-
</button>
|
|
50
|
-
<div class="sonic-toast-content custom-scroll" style="max-height: ${this.maxHeight} ;">
|
|
51
|
-
${this.status && html `<sonic-icon name=${icon[this.status]} class="sonic-toast-icon" size="2xl"></sonic-icon>`}
|
|
52
|
-
|
|
53
|
-
<div class="sonic-toast-text">
|
|
54
|
-
${this.title ? html `<div class="sonic-toast-title">${this.title}</div>` : ""} ${this.text ? unsafeHTML(this.text) : ""}
|
|
55
|
-
<slot></slot>
|
|
56
|
-
</div>
|
|
57
15
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
hide() {
|
|
63
|
-
if (!this.closest("sonic-toast")) {
|
|
64
|
-
this.visible = false;
|
|
65
|
-
}
|
|
66
|
-
if (this.dismissForever) {
|
|
67
|
-
// set in local Storage an Object with the id as key and if it's dismissed as value
|
|
68
|
-
const dismissed = localStorage.getItem("sonic-toast-dismissed") || "{}";
|
|
69
|
-
const dismissedObj = JSON.parse(dismissed);
|
|
70
|
-
dismissedObj[this.id] = true;
|
|
71
|
-
localStorage.setItem("sonic-toast-dismissed", JSON.stringify(dismissedObj));
|
|
72
|
-
}
|
|
73
|
-
this.dispatchEvent(new CustomEvent("hide", { bubbles: true }));
|
|
74
|
-
}
|
|
75
|
-
show() {
|
|
76
|
-
this.visible = true;
|
|
77
|
-
}
|
|
78
|
-
autoHide() {
|
|
79
|
-
setTimeout(() => {
|
|
80
|
-
this.hide();
|
|
81
|
-
}, 6000);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
SonicToastItem.styles = [
|
|
16
|
+
@customElement(tagName)
|
|
17
|
+
export class SonicToastItem extends LitElement {
|
|
18
|
+
static styles = [
|
|
85
19
|
customScroll,
|
|
86
|
-
css
|
|
20
|
+
css`
|
|
87
21
|
* {
|
|
88
22
|
box-sizing: border-box;
|
|
89
23
|
}
|
|
@@ -261,35 +195,74 @@ SonicToastItem.styles = [
|
|
|
261
195
|
pointer-events: none;
|
|
262
196
|
}
|
|
263
197
|
`,
|
|
264
|
-
];
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
198
|
+
];
|
|
199
|
+
|
|
200
|
+
@property({type: String}) title = "";
|
|
201
|
+
@property({type: String}) id = "";
|
|
202
|
+
@property({type: String}) text = "";
|
|
203
|
+
@property({type: String}) status: ToastStatus = "";
|
|
204
|
+
@property({type: Boolean}) ghost = false;
|
|
205
|
+
@property({type: Boolean}) preserve = false;
|
|
206
|
+
@property({type: Boolean}) dismissForever = false;
|
|
207
|
+
@property({type: String}) maxHeight = "10rem";
|
|
208
|
+
@state() visible = true;
|
|
209
|
+
|
|
210
|
+
// @queryAssignedElements({flatten: true, slot: main"})
|
|
211
|
+
// textSlot!: HTMLElement[];
|
|
212
|
+
|
|
213
|
+
render() {
|
|
214
|
+
// check if the toast is dismissed
|
|
215
|
+
if (this.dismissForever) {
|
|
216
|
+
const dismissed = localStorage.getItem("sonic-toast-dismissed") || "{}";
|
|
217
|
+
const dismissedObj = JSON.parse(dismissed);
|
|
218
|
+
if (dismissedObj[this.id]) {
|
|
219
|
+
return nothing;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (!this.visible) {
|
|
224
|
+
return nothing;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return html`<div class="sonic-toast ${this.status} ${this.ghost ? "ghost" : ""}">
|
|
228
|
+
<button aria-label="Close" class="sonic-toast-close" @click=${() => this.hide()}>
|
|
229
|
+
<sonic-icon name="cancel" size="lg"></sonic-icon>
|
|
230
|
+
</button>
|
|
231
|
+
<div class="sonic-toast-content custom-scroll" style="max-height: ${this.maxHeight} ;">
|
|
232
|
+
${this.status && html`<sonic-icon name=${icon[this.status]} class="sonic-toast-icon" size="2xl"></sonic-icon>`}
|
|
233
|
+
|
|
234
|
+
<div class="sonic-toast-text">
|
|
235
|
+
${this.title ? html`<div class="sonic-toast-title">${this.title}</div>` : ""} ${this.text ? unsafeHTML(this.text) : ""}
|
|
236
|
+
<slot></slot>
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
${!this.preserve ? this.autoHide() : ""}
|
|
240
|
+
</div>
|
|
241
|
+
</div>`;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
hide() {
|
|
245
|
+
if (!this.closest("sonic-toast")) {
|
|
246
|
+
this.visible = false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (this.dismissForever) {
|
|
250
|
+
// set in local Storage an Object with the id as key and if it's dismissed as value
|
|
251
|
+
const dismissed = localStorage.getItem("sonic-toast-dismissed") || "{}";
|
|
252
|
+
const dismissedObj = JSON.parse(dismissed);
|
|
253
|
+
dismissedObj[this.id] = true;
|
|
254
|
+
localStorage.setItem("sonic-toast-dismissed", JSON.stringify(dismissedObj));
|
|
255
|
+
}
|
|
256
|
+
this.dispatchEvent(new CustomEvent("hide", {bubbles: true}));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
show() {
|
|
260
|
+
this.visible = true;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
autoHide() {
|
|
264
|
+
setTimeout(() => {
|
|
265
|
+
this.hide();
|
|
266
|
+
}, 6000);
|
|
267
|
+
}
|
|
268
|
+
}
|