fds-vue-core 2.0.88 → 2.1.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/README.md +1 -0
- package/configs/eslint.config.base.js +262 -0
- package/configs/prettier.config.js +13 -0
- package/configs/tsconfig.base.json +17 -0
- package/configs/vscode-settings.json +74 -0
- package/dist/fds-vue-core.cjs.js +5367 -5374
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +5368 -5375
- package/dist/fds-vue-core.es.js.map +1 -1
- package/dist/global-components.d.ts +36 -36
- package/dist/index.d.ts +2 -80
- package/dist/slot-styles.css +1 -1
- package/dist/tokens.css +0 -1
- package/package.json +15 -6
- package/src/.DS_Store +0 -0
- package/src/App.vue +133 -0
- package/src/apply.css +60 -0
- package/src/assets/icons.ts +517 -0
- package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.stories.ts +94 -0
- package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.vue +112 -0
- package/src/components/Blocks/FdsBlockAlert/types.ts +12 -0
- package/src/components/Blocks/FdsBlockContent/FdsBlockContent.stories.ts +110 -0
- package/src/components/Blocks/FdsBlockContent/FdsBlockContent.vue +66 -0
- package/src/components/Blocks/FdsBlockContent/types.ts +6 -0
- package/src/components/Blocks/FdsBlockExpander/FdsBlockExpander.stories.ts +123 -0
- package/src/components/Blocks/FdsBlockExpander/FdsBlockExpander.vue +87 -0
- package/src/components/Blocks/FdsBlockExpander/types.ts +8 -0
- package/src/components/Blocks/FdsBlockInfo/FdsBlockInfo.stories.ts +110 -0
- package/src/components/Blocks/FdsBlockInfo/FdsBlockInfo.vue +98 -0
- package/src/components/Blocks/FdsBlockInfo/types.ts +8 -0
- package/src/components/Blocks/FdsBlockLink/FdsBlockLink.css +9 -0
- package/src/components/Blocks/FdsBlockLink/FdsBlockLink.stories.ts +179 -0
- package/src/components/Blocks/FdsBlockLink/FdsBlockLink.vue +149 -0
- package/src/components/Blocks/FdsBlockLink/types.ts +14 -0
- package/src/components/Buttons/ButtonBaseProps.ts +18 -0
- package/src/components/Buttons/FdsButtonCopy/FdsButtonCopy.stories.ts +53 -0
- package/src/components/Buttons/FdsButtonCopy/FdsButtonCopy.vue +87 -0
- package/src/components/Buttons/FdsButtonCopy/types.ts +8 -0
- package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.stories.ts +111 -0
- package/src/components/Buttons/FdsButtonDownload/FdsButtonDownload.vue +187 -0
- package/src/components/Buttons/FdsButtonIcon/FdsButtonIcon.stories.ts +55 -0
- package/src/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue +57 -0
- package/src/components/Buttons/FdsButtonIcon/types.ts +12 -0
- package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.stories.ts +68 -0
- package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue +126 -0
- package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.stories.ts +86 -0
- package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue +107 -0
- package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.stories.ts +68 -0
- package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue +107 -0
- package/src/components/FdsIcon/FdsIcon.stories.ts +69 -0
- package/src/components/FdsIcon/FdsIcon.vue +34 -0
- package/src/components/FdsIcon/types.ts +9 -0
- package/src/components/FdsModal/FdsModal.stories.ts +241 -0
- package/src/components/FdsModal/FdsModal.vue +261 -0
- package/src/components/FdsModal/types.ts +12 -0
- package/src/components/FdsPagination/FdsPagination.stories.ts +109 -0
- package/src/components/FdsPagination/FdsPagination.vue +193 -0
- package/src/components/FdsPagination/types.ts +6 -0
- package/src/components/FdsSearchSelect/FdsSearchSelect.stories.ts +428 -0
- package/src/components/FdsSearchSelect/FdsSearchSelect.vue +610 -0
- package/src/components/FdsSearchSelect/types.ts +25 -0
- package/src/components/FdsSpinner/FdsSpinner.stories.ts +31 -0
- package/src/components/FdsSpinner/FdsSpinner.vue +90 -0
- package/src/components/FdsSpinner/types.ts +6 -0
- package/src/components/FdsSticker/FdsSticker.stories.ts +148 -0
- package/src/components/FdsSticker/FdsSticker.vue +44 -0
- package/src/components/FdsSticker/types.ts +4 -0
- package/src/components/FdsTreeView/FdsTreeView.stories.ts +136 -0
- package/src/components/FdsTreeView/FdsTreeView.vue +162 -0
- package/src/components/FdsTreeView/TreeNode.vue +383 -0
- package/src/components/FdsTreeView/types.ts +141 -0
- package/src/components/FdsTreeView/useTreeState.ts +607 -0
- package/src/components/FdsTreeView/utils.ts +65 -0
- package/src/components/FdsTruncatedText/FdsTruncatedText.stories.ts +78 -0
- package/src/components/FdsTruncatedText/FdsTruncatedText.vue +85 -0
- package/src/components/FdsTruncatedText/types.ts +6 -0
- package/src/components/Form/FdsCheckbox/FdsCheckbox.stories.ts +275 -0
- package/src/components/Form/FdsCheckbox/FdsCheckbox.vue +155 -0
- package/src/components/Form/FdsCheckbox/types.ts +10 -0
- package/src/components/Form/FdsInput/FdsInput.stories.ts +319 -0
- package/src/components/Form/FdsInput/FdsInput.vue +233 -0
- package/src/components/Form/FdsInput/types.ts +25 -0
- package/src/components/Form/FdsRadio/FdsRadio.stories.ts +63 -0
- package/src/components/Form/FdsRadio/FdsRadio.vue +88 -0
- package/src/components/Form/FdsRadio/types.ts +12 -0
- package/src/components/Form/FdsSelect/FdsSelect.stories.ts +78 -0
- package/src/components/Form/FdsSelect/FdsSelect.vue +136 -0
- package/src/components/Form/FdsSelect/types.ts +13 -0
- package/src/components/Form/FdsTextarea/FdsTextarea.stories.ts +52 -0
- package/src/components/Form/FdsTextarea/FdsTextarea.vue +110 -0
- package/src/components/Form/FdsTextarea/types.ts +12 -0
- package/src/components/Table/FdsTable/FdsTable.stories.ts +221 -0
- package/src/components/Table/FdsTable/FdsTable.vue +25 -0
- package/src/components/Table/FdsTable/types.ts +4 -0
- package/src/components/Table/FdsTableHead/FdsTableHead.stories.ts +151 -0
- package/src/components/Table/FdsTableHead/FdsTableHead.vue +54 -0
- package/src/components/Table/FdsTableHead/types.ts +5 -0
- package/src/components/Tabs/FdsTabs/FdsTabs.stories.ts +247 -0
- package/src/components/Tabs/FdsTabs/FdsTabs.vue +27 -0
- package/src/components/Tabs/FdsTabs/types.ts +4 -0
- package/src/components/Tabs/FdsTabsItem/FdsTabsItem.vue +125 -0
- package/src/components/Tabs/FdsTabsItem/types.ts +16 -0
- package/src/components/Typography/FdsHeading/FdsHeading.stories.ts +93 -0
- package/src/components/Typography/FdsHeading/FdsHeading.vue +51 -0
- package/src/components/Typography/FdsHeading/types.ts +5 -0
- package/src/components/Typography/FdsListHeading/FdsListHeading.stories.ts +58 -0
- package/src/components/Typography/FdsListHeading/FdsListHeading.vue +62 -0
- package/src/components/Typography/FdsListHeading/types.ts +8 -0
- package/src/components/Typography/FdsSeparator/FdsSeparator.stories.ts +31 -0
- package/src/components/Typography/FdsSeparator/FdsSeparator.vue +5 -0
- package/src/components/Typography/FdsText/FdsText.stories.ts +66 -0
- package/src/components/Typography/FdsText/FdsText.vue +28 -0
- package/src/components/Typography/FdsText/types.ts +3 -0
- package/src/composables/useBoldQuery.ts +29 -0
- package/src/composables/useElementFinalSize.ts +24 -0
- package/src/composables/useHasSlots.ts +17 -0
- package/src/composables/useIsPid.ts +48 -0
- package/src/docs/Start/Start.mdx +12 -0
- package/src/docs/Usage.md +117 -0
- package/src/fonts.css +28 -0
- package/src/global-components.ts +38 -0
- package/src/index.ts +180 -0
- package/src/main.ts +7 -0
- package/src/slot-styles.css +93 -0
- package/src/style.css +89 -0
- package/src/tokens.css +252 -0
- package/tsconfig.base.json +4 -0
- package/dist/App.vue.d.ts +0 -3
- package/dist/App.vue.d.ts.map +0 -1
- package/dist/assets/icons.d.ts +0 -5
- package/dist/assets/icons.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockAlert/FdsBlockAlert.stories.d.ts +0 -9
- package/dist/components/Blocks/FdsBlockAlert/FdsBlockAlert.stories.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockAlert/FdsBlockAlert.vue.d.ts +0 -30
- package/dist/components/Blocks/FdsBlockAlert/FdsBlockAlert.vue.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockAlert/types.d.ts +0 -12
- package/dist/components/Blocks/FdsBlockAlert/types.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockContent/FdsBlockContent.stories.d.ts +0 -9
- package/dist/components/Blocks/FdsBlockContent/FdsBlockContent.stories.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockContent/FdsBlockContent.vue.d.ts +0 -19
- package/dist/components/Blocks/FdsBlockContent/FdsBlockContent.vue.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockContent/types.d.ts +0 -7
- package/dist/components/Blocks/FdsBlockContent/types.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockExpander/FdsBlockExpander.stories.d.ts +0 -11
- package/dist/components/Blocks/FdsBlockExpander/FdsBlockExpander.stories.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockExpander/FdsBlockExpander.vue.d.ts +0 -23
- package/dist/components/Blocks/FdsBlockExpander/FdsBlockExpander.vue.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockExpander/types.d.ts +0 -8
- package/dist/components/Blocks/FdsBlockExpander/types.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockInfo/FdsBlockInfo.stories.d.ts +0 -9
- package/dist/components/Blocks/FdsBlockInfo/FdsBlockInfo.stories.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockInfo/FdsBlockInfo.vue.d.ts +0 -20
- package/dist/components/Blocks/FdsBlockInfo/FdsBlockInfo.vue.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockInfo/types.d.ts +0 -8
- package/dist/components/Blocks/FdsBlockInfo/types.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockLink/FdsBlockLink.stories.d.ts +0 -14
- package/dist/components/Blocks/FdsBlockLink/FdsBlockLink.stories.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockLink/FdsBlockLink.vue.d.ts +0 -30
- package/dist/components/Blocks/FdsBlockLink/FdsBlockLink.vue.d.ts.map +0 -1
- package/dist/components/Blocks/FdsBlockLink/types.d.ts +0 -14
- package/dist/components/Blocks/FdsBlockLink/types.d.ts.map +0 -1
- package/dist/components/Buttons/ButtonBaseProps.d.ts +0 -18
- package/dist/components/Buttons/ButtonBaseProps.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonCopy/FdsButtonCopy.stories.d.ts +0 -7
- package/dist/components/Buttons/FdsButtonCopy/FdsButtonCopy.stories.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonCopy/FdsButtonCopy.vue.d.ts +0 -14
- package/dist/components/Buttons/FdsButtonCopy/FdsButtonCopy.vue.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonCopy/types.d.ts +0 -9
- package/dist/components/Buttons/FdsButtonCopy/types.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonDownload/FdsButtonDownload.stories.d.ts +0 -10
- package/dist/components/Buttons/FdsButtonDownload/FdsButtonDownload.stories.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonDownload/FdsButtonDownload.vue.d.ts +0 -25
- package/dist/components/Buttons/FdsButtonDownload/FdsButtonDownload.vue.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonIcon/FdsButtonIcon.stories.d.ts +0 -7
- package/dist/components/Buttons/FdsButtonIcon/FdsButtonIcon.stories.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue.d.ts +0 -14
- package/dist/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonIcon/types.d.ts +0 -12
- package/dist/components/Buttons/FdsButtonIcon/types.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonMinor/FdsButtonMinor.stories.d.ts +0 -7
- package/dist/components/Buttons/FdsButtonMinor/FdsButtonMinor.stories.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue.d.ts +0 -25
- package/dist/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.stories.d.ts +0 -9
- package/dist/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.stories.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue.d.ts +0 -20
- package/dist/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.stories.d.ts +0 -7
- package/dist/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.stories.d.ts.map +0 -1
- package/dist/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue.d.ts +0 -20
- package/dist/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue.d.ts.map +0 -1
- package/dist/components/FdsIcon/FdsIcon.stories.d.ts +0 -8
- package/dist/components/FdsIcon/FdsIcon.stories.d.ts.map +0 -1
- package/dist/components/FdsIcon/FdsIcon.vue.d.ts +0 -7
- package/dist/components/FdsIcon/FdsIcon.vue.d.ts.map +0 -1
- package/dist/components/FdsIcon/types.d.ts +0 -8
- package/dist/components/FdsIcon/types.d.ts.map +0 -1
- package/dist/components/FdsModal/FdsModal.stories.d.ts +0 -13
- package/dist/components/FdsModal/FdsModal.stories.d.ts.map +0 -1
- package/dist/components/FdsModal/FdsModal.vue.d.ts +0 -33
- package/dist/components/FdsModal/FdsModal.vue.d.ts.map +0 -1
- package/dist/components/FdsModal/types.d.ts +0 -13
- package/dist/components/FdsModal/types.d.ts.map +0 -1
- package/dist/components/FdsPagination/FdsPagination.stories.d.ts +0 -11
- package/dist/components/FdsPagination/FdsPagination.stories.d.ts.map +0 -1
- package/dist/components/FdsPagination/FdsPagination.vue.d.ts +0 -21
- package/dist/components/FdsPagination/FdsPagination.vue.d.ts.map +0 -1
- package/dist/components/FdsPagination/types.d.ts +0 -7
- package/dist/components/FdsPagination/types.d.ts.map +0 -1
- package/dist/components/FdsSearchSelect/FdsSearchSelect.stories.d.ts +0 -15
- package/dist/components/FdsSearchSelect/FdsSearchSelect.stories.d.ts.map +0 -1
- package/dist/components/FdsSearchSelect/FdsSearchSelect.vue.d.ts +0 -41
- package/dist/components/FdsSearchSelect/FdsSearchSelect.vue.d.ts.map +0 -1
- package/dist/components/FdsSearchSelect/types.d.ts +0 -29
- package/dist/components/FdsSearchSelect/types.d.ts.map +0 -1
- package/dist/components/FdsSpinner/FdsSpinner.stories.d.ts +0 -7
- package/dist/components/FdsSpinner/FdsSpinner.stories.d.ts.map +0 -1
- package/dist/components/FdsSpinner/FdsSpinner.vue.d.ts +0 -15
- package/dist/components/FdsSpinner/FdsSpinner.vue.d.ts.map +0 -1
- package/dist/components/FdsSpinner/types.d.ts +0 -7
- package/dist/components/FdsSpinner/types.d.ts.map +0 -1
- package/dist/components/FdsSticker/FdsSticker.stories.d.ts +0 -15
- package/dist/components/FdsSticker/FdsSticker.stories.d.ts.map +0 -1
- package/dist/components/FdsSticker/FdsSticker.vue.d.ts +0 -17
- package/dist/components/FdsSticker/FdsSticker.vue.d.ts.map +0 -1
- package/dist/components/FdsSticker/types.d.ts +0 -5
- package/dist/components/FdsSticker/types.d.ts.map +0 -1
- package/dist/components/FdsTreeView/FdsTreeView.stories.d.ts +0 -7
- package/dist/components/FdsTreeView/FdsTreeView.stories.d.ts.map +0 -1
- package/dist/components/FdsTreeView/FdsTreeView.vue.d.ts +0 -29
- package/dist/components/FdsTreeView/FdsTreeView.vue.d.ts.map +0 -1
- package/dist/components/FdsTreeView/TreeNode.vue.d.ts +0 -21
- package/dist/components/FdsTreeView/TreeNode.vue.d.ts.map +0 -1
- package/dist/components/FdsTreeView/types.d.ts +0 -122
- package/dist/components/FdsTreeView/types.d.ts.map +0 -1
- package/dist/components/FdsTreeView/useTreeState.d.ts +0 -48
- package/dist/components/FdsTreeView/useTreeState.d.ts.map +0 -1
- package/dist/components/FdsTreeView/utils.d.ts +0 -4
- package/dist/components/FdsTreeView/utils.d.ts.map +0 -1
- package/dist/components/FdsTruncatedText/FdsTruncatedText.stories.d.ts +0 -9
- package/dist/components/FdsTruncatedText/FdsTruncatedText.stories.d.ts.map +0 -1
- package/dist/components/FdsTruncatedText/FdsTruncatedText.vue.d.ts +0 -26
- package/dist/components/FdsTruncatedText/FdsTruncatedText.vue.d.ts.map +0 -1
- package/dist/components/FdsTruncatedText/types.d.ts +0 -7
- package/dist/components/FdsTruncatedText/types.d.ts.map +0 -1
- package/dist/components/Form/FdsCheckbox/FdsCheckbox.stories.d.ts +0 -12
- package/dist/components/Form/FdsCheckbox/FdsCheckbox.stories.d.ts.map +0 -1
- package/dist/components/Form/FdsCheckbox/FdsCheckbox.vue.d.ts +0 -38
- package/dist/components/Form/FdsCheckbox/FdsCheckbox.vue.d.ts.map +0 -1
- package/dist/components/Form/FdsCheckbox/types.d.ts +0 -11
- package/dist/components/Form/FdsCheckbox/types.d.ts.map +0 -1
- package/dist/components/Form/FdsInput/FdsInput.stories.d.ts +0 -18
- package/dist/components/Form/FdsInput/FdsInput.stories.d.ts.map +0 -1
- package/dist/components/Form/FdsInput/FdsInput.vue.d.ts +0 -39
- package/dist/components/Form/FdsInput/FdsInput.vue.d.ts.map +0 -1
- package/dist/components/Form/FdsInput/types.d.ts +0 -26
- package/dist/components/Form/FdsInput/types.d.ts.map +0 -1
- package/dist/components/Form/FdsRadio/FdsRadio.stories.d.ts +0 -8
- package/dist/components/Form/FdsRadio/FdsRadio.stories.d.ts.map +0 -1
- package/dist/components/Form/FdsRadio/FdsRadio.vue.d.ts +0 -36
- package/dist/components/Form/FdsRadio/FdsRadio.vue.d.ts.map +0 -1
- package/dist/components/Form/FdsRadio/types.d.ts +0 -13
- package/dist/components/Form/FdsRadio/types.d.ts.map +0 -1
- package/dist/components/Form/FdsSelect/FdsSelect.stories.d.ts +0 -10
- package/dist/components/Form/FdsSelect/FdsSelect.stories.d.ts.map +0 -1
- package/dist/components/Form/FdsSelect/FdsSelect.vue.d.ts +0 -45
- package/dist/components/Form/FdsSelect/FdsSelect.vue.d.ts.map +0 -1
- package/dist/components/Form/FdsSelect/types.d.ts +0 -18
- package/dist/components/Form/FdsSelect/types.d.ts.map +0 -1
- package/dist/components/Form/FdsTextarea/FdsTextarea.stories.d.ts +0 -8
- package/dist/components/Form/FdsTextarea/FdsTextarea.stories.d.ts.map +0 -1
- package/dist/components/Form/FdsTextarea/FdsTextarea.vue.d.ts +0 -27
- package/dist/components/Form/FdsTextarea/FdsTextarea.vue.d.ts.map +0 -1
- package/dist/components/Form/FdsTextarea/types.d.ts +0 -13
- package/dist/components/Form/FdsTextarea/types.d.ts.map +0 -1
- package/dist/components/Table/FdsTable/FdsTable.stories.d.ts +0 -10
- package/dist/components/Table/FdsTable/FdsTable.stories.d.ts.map +0 -1
- package/dist/components/Table/FdsTable/FdsTable.vue.d.ts +0 -16
- package/dist/components/Table/FdsTable/FdsTable.vue.d.ts.map +0 -1
- package/dist/components/Table/FdsTable/types.d.ts +0 -5
- package/dist/components/Table/FdsTable/types.d.ts.map +0 -1
- package/dist/components/Table/FdsTableHead/FdsTableHead.stories.d.ts +0 -12
- package/dist/components/Table/FdsTableHead/FdsTableHead.stories.d.ts.map +0 -1
- package/dist/components/Table/FdsTableHead/FdsTableHead.vue.d.ts +0 -24
- package/dist/components/Table/FdsTableHead/FdsTableHead.vue.d.ts.map +0 -1
- package/dist/components/Table/FdsTableHead/types.d.ts +0 -6
- package/dist/components/Table/FdsTableHead/types.d.ts.map +0 -1
- package/dist/components/Tabs/FdsTabs/FdsTabs.stories.d.ts +0 -14
- package/dist/components/Tabs/FdsTabs/FdsTabs.stories.d.ts.map +0 -1
- package/dist/components/Tabs/FdsTabs/FdsTabs.vue.d.ts +0 -17
- package/dist/components/Tabs/FdsTabs/FdsTabs.vue.d.ts.map +0 -1
- package/dist/components/Tabs/FdsTabs/types.d.ts +0 -5
- package/dist/components/Tabs/FdsTabs/types.d.ts.map +0 -1
- package/dist/components/Tabs/FdsTabsItem/FdsTabsItem.vue.d.ts +0 -22
- package/dist/components/Tabs/FdsTabsItem/FdsTabsItem.vue.d.ts.map +0 -1
- package/dist/components/Tabs/FdsTabsItem/types.d.ts +0 -17
- package/dist/components/Tabs/FdsTabsItem/types.d.ts.map +0 -1
- package/dist/components/Typography/FdsHeading/FdsHeading.stories.d.ts +0 -11
- package/dist/components/Typography/FdsHeading/FdsHeading.stories.d.ts.map +0 -1
- package/dist/components/Typography/FdsHeading/FdsHeading.vue.d.ts +0 -6
- package/dist/components/Typography/FdsHeading/FdsHeading.vue.d.ts.map +0 -1
- package/dist/components/Typography/FdsHeading/types.d.ts +0 -6
- package/dist/components/Typography/FdsHeading/types.d.ts.map +0 -1
- package/dist/components/Typography/FdsListHeading/FdsListHeading.stories.d.ts +0 -11
- package/dist/components/Typography/FdsListHeading/FdsListHeading.stories.d.ts.map +0 -1
- package/dist/components/Typography/FdsListHeading/FdsListHeading.vue.d.ts +0 -7
- package/dist/components/Typography/FdsListHeading/FdsListHeading.vue.d.ts.map +0 -1
- package/dist/components/Typography/FdsListHeading/types.d.ts +0 -9
- package/dist/components/Typography/FdsListHeading/types.d.ts.map +0 -1
- package/dist/components/Typography/FdsSeparator/FdsSeparator.stories.d.ts +0 -7
- package/dist/components/Typography/FdsSeparator/FdsSeparator.stories.d.ts.map +0 -1
- package/dist/components/Typography/FdsSeparator/FdsSeparator.vue.d.ts +0 -3
- package/dist/components/Typography/FdsSeparator/FdsSeparator.vue.d.ts.map +0 -1
- package/dist/components/Typography/FdsText/FdsText.stories.d.ts +0 -9
- package/dist/components/Typography/FdsText/FdsText.stories.d.ts.map +0 -1
- package/dist/components/Typography/FdsText/FdsText.vue.d.ts +0 -16
- package/dist/components/Typography/FdsText/FdsText.vue.d.ts.map +0 -1
- package/dist/components/Typography/FdsText/types.d.ts +0 -4
- package/dist/components/Typography/FdsText/types.d.ts.map +0 -1
- package/dist/composables/useBoldQuery.d.ts +0 -10
- package/dist/composables/useBoldQuery.d.ts.map +0 -1
- package/dist/composables/useElementFinalSize.d.ts +0 -3
- package/dist/composables/useElementFinalSize.d.ts.map +0 -1
- package/dist/composables/useHasSlots.d.ts +0 -6
- package/dist/composables/useHasSlots.d.ts.map +0 -1
- package/dist/composables/useIsPid.d.ts +0 -16
- package/dist/composables/useIsPid.d.ts.map +0 -1
- package/dist/global-components.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import FdsButtonPrimary from '@/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue'
|
|
4
|
+
import FdsButtonSecondary from '@/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue'
|
|
5
|
+
import FdsModal from './FdsModal.vue'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof FdsModal> = {
|
|
8
|
+
title: 'FDS/FdsModal',
|
|
9
|
+
component: FdsModal,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
heading: { control: { type: 'text' } },
|
|
13
|
+
size: { control: { type: 'select' }, options: ['sm', 'md', 'lg', 'xl'] },
|
|
14
|
+
alignTop: { control: { type: 'boolean' } },
|
|
15
|
+
alignLeftFooter: { control: { type: 'boolean' } },
|
|
16
|
+
stickyFooter: { control: { type: 'boolean' } },
|
|
17
|
+
strict: { control: { type: 'boolean' } },
|
|
18
|
+
lockScroll: { control: { type: 'boolean' } },
|
|
19
|
+
info: { control: { type: 'select' }, options: ['valid', 'invalid', 'warning'] },
|
|
20
|
+
locale: { control: { type: 'select' }, options: ['sv', 'en'] },
|
|
21
|
+
open: { control: { type: 'boolean' } },
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
heading: 'Modal heading',
|
|
25
|
+
size: 'md',
|
|
26
|
+
alignTop: false,
|
|
27
|
+
alignLeftFooter: false,
|
|
28
|
+
stickyFooter: false,
|
|
29
|
+
strict: false,
|
|
30
|
+
lockScroll: false,
|
|
31
|
+
info: undefined,
|
|
32
|
+
locale: 'sv',
|
|
33
|
+
open: false,
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default meta
|
|
38
|
+
type Story = StoryObj<typeof meta>
|
|
39
|
+
|
|
40
|
+
// Helper to create modal story setup with reactive open state
|
|
41
|
+
const createModalStory = (args: any) => {
|
|
42
|
+
const open = ref(args.open ?? false)
|
|
43
|
+
const handleClose = () => {
|
|
44
|
+
open.value = false
|
|
45
|
+
}
|
|
46
|
+
const handleOpen = () => {
|
|
47
|
+
open.value = true
|
|
48
|
+
}
|
|
49
|
+
return { args, open, handleClose, handleOpen }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const modalTransform = (storyContext: {
|
|
53
|
+
args?: {
|
|
54
|
+
heading?: string
|
|
55
|
+
size?: string
|
|
56
|
+
open?: boolean
|
|
57
|
+
lockScroll?: boolean
|
|
58
|
+
info?: string
|
|
59
|
+
locale?: string
|
|
60
|
+
strict?: boolean
|
|
61
|
+
}
|
|
62
|
+
}) => {
|
|
63
|
+
const args = storyContext?.args || {}
|
|
64
|
+
const attrs = []
|
|
65
|
+
|
|
66
|
+
if (args.heading) attrs.push(`heading="${args.heading}"`)
|
|
67
|
+
if (args.size && args.size !== 'md') attrs.push(`size="${args.size}"`)
|
|
68
|
+
if (args.open) attrs.push(':open="true"')
|
|
69
|
+
if (args.lockScroll) attrs.push('lockScroll')
|
|
70
|
+
if (args.info) attrs.push(`info="${args.info}"`)
|
|
71
|
+
if (args.locale && args.locale !== 'sv') attrs.push(`locale="${args.locale}"`)
|
|
72
|
+
if (args.strict) attrs.push('strict')
|
|
73
|
+
const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
|
|
74
|
+
|
|
75
|
+
return `<FdsModal${attrsStr} @close="handleClose">
|
|
76
|
+
<p>This is the modal content. You can add any content here.</p>
|
|
77
|
+
<template #modal-footer>
|
|
78
|
+
<FdsButtonSecondary text="Cancel" @click="handleClose" />
|
|
79
|
+
<FdsButtonPrimary text="Confirm" />
|
|
80
|
+
</template>
|
|
81
|
+
</FdsModal>`
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Default: Story = {
|
|
85
|
+
render: (args) => ({
|
|
86
|
+
components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
|
|
87
|
+
setup: () => createModalStory(args),
|
|
88
|
+
template: `
|
|
89
|
+
<div>
|
|
90
|
+
<FdsButtonPrimary text="Open Modal" @click="handleOpen" />
|
|
91
|
+
<FdsModal v-bind="args" :open="open" @close="handleClose">
|
|
92
|
+
<p>This is the modal content. You can add any content here.</p>
|
|
93
|
+
<template #modal-footer>
|
|
94
|
+
<FdsButtonSecondary text="Cancel" @click="handleClose" />
|
|
95
|
+
<FdsButtonPrimary text="Confirm" />
|
|
96
|
+
</template>
|
|
97
|
+
</FdsModal>
|
|
98
|
+
</div>
|
|
99
|
+
`,
|
|
100
|
+
}),
|
|
101
|
+
parameters: {
|
|
102
|
+
docs: {
|
|
103
|
+
source: {
|
|
104
|
+
transform: modalTransform,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const WithFooter: Story = {
|
|
111
|
+
render: (args) => ({
|
|
112
|
+
components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
|
|
113
|
+
setup: () => createModalStory(args),
|
|
114
|
+
template: `
|
|
115
|
+
<div>
|
|
116
|
+
<FdsButtonPrimary text="Open Modal" @click="handleOpen" />
|
|
117
|
+
<FdsModal v-bind="args" :open="open" @close="handleClose">
|
|
118
|
+
<p>This is the modal content with a footer.</p>
|
|
119
|
+
<template #modal-footer>
|
|
120
|
+
<FdsButtonSecondary text="Cancel" @click="handleClose" />
|
|
121
|
+
<FdsButtonPrimary text="Confirm" />
|
|
122
|
+
</template>
|
|
123
|
+
</FdsModal>
|
|
124
|
+
</div>
|
|
125
|
+
`,
|
|
126
|
+
}),
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const Strict: Story = {
|
|
130
|
+
render: (args) => ({
|
|
131
|
+
components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
|
|
132
|
+
setup: () => createModalStory(args),
|
|
133
|
+
template: `
|
|
134
|
+
<div>
|
|
135
|
+
<FdsButtonPrimary text="Open Modal" @click="handleOpen" />
|
|
136
|
+
<FdsModal v-bind="args" :open="open" @close="handleClose">
|
|
137
|
+
<p>This is a strict modal. You cannot close it by clicking the backdrop or pressing Escape.</p>
|
|
138
|
+
<template #modal-footer>
|
|
139
|
+
<FdsButtonSecondary text="Close" @click="handleClose" />
|
|
140
|
+
</template>
|
|
141
|
+
</FdsModal>
|
|
142
|
+
</div>
|
|
143
|
+
`,
|
|
144
|
+
}),
|
|
145
|
+
args: {
|
|
146
|
+
strict: true,
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const ValidInfo: Story = {
|
|
151
|
+
render: (args) => ({
|
|
152
|
+
components: { FdsModal, FdsButtonPrimary },
|
|
153
|
+
setup: () => createModalStory(args),
|
|
154
|
+
template: `
|
|
155
|
+
<div>
|
|
156
|
+
<FdsButtonPrimary text="Open Modal" @click="handleOpen" />
|
|
157
|
+
<FdsModal v-bind="args" :open="open" @close="handleClose">
|
|
158
|
+
<p>Your changes have been saved successfully.</p>
|
|
159
|
+
</FdsModal>
|
|
160
|
+
</div>
|
|
161
|
+
`,
|
|
162
|
+
}),
|
|
163
|
+
args: {
|
|
164
|
+
info: 'valid',
|
|
165
|
+
},
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export const WarningInfo: Story = {
|
|
169
|
+
render: (args) => ({
|
|
170
|
+
components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
|
|
171
|
+
setup: () => createModalStory(args),
|
|
172
|
+
template: `
|
|
173
|
+
<div>
|
|
174
|
+
<FdsButtonPrimary text="Open Modal" @click="handleOpen" />
|
|
175
|
+
<FdsModal v-bind="args" :open="open" @close="handleClose">
|
|
176
|
+
<p>Are you sure you want to continue? This action cannot be undone.</p>
|
|
177
|
+
<template #modal-footer>
|
|
178
|
+
<FdsButtonSecondary text="Cancel" @click="handleClose" />
|
|
179
|
+
<FdsButtonPrimary text="Confirm" />
|
|
180
|
+
</template>
|
|
181
|
+
</FdsModal>
|
|
182
|
+
</div>
|
|
183
|
+
`,
|
|
184
|
+
}),
|
|
185
|
+
args: {
|
|
186
|
+
info: 'warning',
|
|
187
|
+
},
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export const LargeSize: Story = {
|
|
191
|
+
render: (args) => ({
|
|
192
|
+
components: { FdsModal, FdsButtonPrimary },
|
|
193
|
+
setup: () => createModalStory(args),
|
|
194
|
+
template: `
|
|
195
|
+
<div>
|
|
196
|
+
<FdsButtonPrimary text="Open Modal" @click="handleOpen" />
|
|
197
|
+
<FdsModal v-bind="args" :open="open" @close="handleClose">
|
|
198
|
+
<p>This is a large modal with more space for content.</p>
|
|
199
|
+
<p>You can add multiple paragraphs and other content here.</p>
|
|
200
|
+
</FdsModal>
|
|
201
|
+
</div>
|
|
202
|
+
`,
|
|
203
|
+
}),
|
|
204
|
+
args: {
|
|
205
|
+
size: 'xl',
|
|
206
|
+
},
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export const LongContentWithStickyFooter: Story = {
|
|
210
|
+
render: (args) => ({
|
|
211
|
+
components: { FdsModal, FdsButtonPrimary, FdsButtonSecondary },
|
|
212
|
+
setup: () => createModalStory(args),
|
|
213
|
+
template: `
|
|
214
|
+
<div>
|
|
215
|
+
<FdsButtonPrimary text="Open Modal" @click="handleOpen" />
|
|
216
|
+
<FdsModal v-bind="args" :open="open" @close="handleClose">
|
|
217
|
+
<p>This is the first paragraph of content.</p>
|
|
218
|
+
<p>This is the second paragraph with more information about the topic at hand.</p>
|
|
219
|
+
<p>Here is a third paragraph that provides additional context and details.</p>
|
|
220
|
+
<p>And yet another paragraph to demonstrate the scrolling behavior.</p>
|
|
221
|
+
<p>This paragraph continues to show how the content flows in the modal.</p>
|
|
222
|
+
<p>More content is added here to make the modal longer and more scrollable.</p>
|
|
223
|
+
<p>Another paragraph to show the sticky footer functionality in action.</p>
|
|
224
|
+
<p>This content should be long enough to require scrolling.</p>
|
|
225
|
+
<p>The footer should remain sticky at the bottom as you scroll through the content.</p>
|
|
226
|
+
<p>This is the final paragraph to complete the long content example.</p>
|
|
227
|
+
<template #modal-footer>
|
|
228
|
+
<FdsButtonSecondary text="Cancel" @click="handleClose" />
|
|
229
|
+
<FdsButtonPrimary text="Save Changes" />
|
|
230
|
+
</template>
|
|
231
|
+
</FdsModal>
|
|
232
|
+
</div>
|
|
233
|
+
`,
|
|
234
|
+
}),
|
|
235
|
+
args: {
|
|
236
|
+
heading: 'Long Content Modal',
|
|
237
|
+
size: 'md',
|
|
238
|
+
stickyFooter: true,
|
|
239
|
+
lockScroll: true,
|
|
240
|
+
},
|
|
241
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import FdsButtonIcon from '@/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue'
|
|
3
|
+
import FdsIcon from '@/components/FdsIcon/FdsIcon.vue'
|
|
4
|
+
import { useHasSlot } from '@/composables/useHasSlots'
|
|
5
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
6
|
+
import type { FdsModalProps } from './types'
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<FdsModalProps>(), {
|
|
9
|
+
open: false,
|
|
10
|
+
heading: '',
|
|
11
|
+
size: 'md',
|
|
12
|
+
alignTop: false,
|
|
13
|
+
alignLeftFooter: false,
|
|
14
|
+
stickyFooter: false,
|
|
15
|
+
strict: false,
|
|
16
|
+
lockScroll: false,
|
|
17
|
+
info: undefined,
|
|
18
|
+
locale: 'sv',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const emit = defineEmits<{
|
|
22
|
+
(e: 'close'): void
|
|
23
|
+
(e: 'update:open', value: boolean): void
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const isOpen = ref(props.open)
|
|
27
|
+
let cleanupFocusTrap: (() => void) | null = null
|
|
28
|
+
const previouslyFocusedElement = ref<HTMLElement | null>(null)
|
|
29
|
+
|
|
30
|
+
const hasFooterSlot = useHasSlot('modal-footer')
|
|
31
|
+
|
|
32
|
+
const modalOuterClasses = computed(() => ['fixed top-0 left-0 w-full h-full overflow-auto z-100'])
|
|
33
|
+
|
|
34
|
+
const modalInnerClasses = computed(() => [
|
|
35
|
+
'relative min-w-[288px] w-[calc(100%-5rem)] bg-white rounded-lg overflow-auto z-[99999] shadow-lg px-6 pt-6.5 left-1/2',
|
|
36
|
+
'max-h-[80%] top-1/2 translate-x-[-50%]',
|
|
37
|
+
props.alignTop ? 'top-[10rem]' : 'translate-y-[-50%]',
|
|
38
|
+
props.stickyFooter ? 'pb-0' : 'pb-8',
|
|
39
|
+
{
|
|
40
|
+
'max-w-[480px]': props.size === 'sm',
|
|
41
|
+
'max-w-[588px]': props.size === 'md',
|
|
42
|
+
'max-w-[768px]': props.size === 'lg',
|
|
43
|
+
'max-w-[1200px]': props.size === 'xl',
|
|
44
|
+
},
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
const headerTitleClasses = computed(() => ['m-0'])
|
|
48
|
+
|
|
49
|
+
const iconName = computed(() => {
|
|
50
|
+
if (props.info === 'valid') return 'check'
|
|
51
|
+
if (props.info === 'invalid' || props.info === 'warning') return 'alert'
|
|
52
|
+
return null
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const iconClasses = computed(() => [
|
|
56
|
+
'inline mr-2 float-left',
|
|
57
|
+
{
|
|
58
|
+
'fill-green-600': props.info === 'valid',
|
|
59
|
+
'fill-red-600': props.info === 'invalid',
|
|
60
|
+
'fill-yellow-600': props.info === 'warning',
|
|
61
|
+
},
|
|
62
|
+
])
|
|
63
|
+
|
|
64
|
+
const closeLabel = computed(() => (props.locale === 'sv' ? 'Stäng dialogruta' : 'Close modal window'))
|
|
65
|
+
|
|
66
|
+
const footerClasses = computed(() => [
|
|
67
|
+
'mt-6 flex flex-col gap-4 left-0 right-0',
|
|
68
|
+
{
|
|
69
|
+
'sm:flex-row sm:justify-end': !props.alignLeftFooter,
|
|
70
|
+
'sm:flex-row sm:justify-start': props.alignLeftFooter,
|
|
71
|
+
'sticky bg-white bottom-0 shadow-[0px_-8px_16px_0px_rgba(255,255,255,0.59)] z-[2] -mx-6 px-6 pb-6':
|
|
72
|
+
props.stickyFooter,
|
|
73
|
+
},
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
const handleBackdropClick = () => {
|
|
77
|
+
handleClose('backdrop')
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const handleClose = (context: 'backdrop' | 'icon' | 'keydown') => {
|
|
81
|
+
if (props.strict && context === 'icon') {
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
isOpen.value = false
|
|
85
|
+
document.getElementsByTagName('html')[0].style.overflow = 'auto'
|
|
86
|
+
|
|
87
|
+
// Restore focus to the element that opened the modal
|
|
88
|
+
nextTick(() => {
|
|
89
|
+
if (previouslyFocusedElement.value) {
|
|
90
|
+
previouslyFocusedElement.value.focus()
|
|
91
|
+
previouslyFocusedElement.value = null
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
emit('close')
|
|
96
|
+
emit('update:open', false)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
100
|
+
if (isOpen.value && e.code === 'Escape') {
|
|
101
|
+
handleClose('keydown')
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const getTabList = (modal: Element) =>
|
|
106
|
+
modal.querySelectorAll(
|
|
107
|
+
'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])',
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
const trapFocus = () => {
|
|
111
|
+
if (!isOpen.value) return
|
|
112
|
+
|
|
113
|
+
nextTick(() => {
|
|
114
|
+
const modal = document.querySelector('.fds-modal-inner')
|
|
115
|
+
if (!modal) return
|
|
116
|
+
|
|
117
|
+
const tabList = getTabList(modal)
|
|
118
|
+
|
|
119
|
+
if (tabList.length > 0) {
|
|
120
|
+
;(tabList[0] as HTMLElement).focus()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const handleTabKey = (e: KeyboardEvent) => {
|
|
124
|
+
if (e.key !== 'Tab') return
|
|
125
|
+
|
|
126
|
+
const currentTabList = getTabList(modal)
|
|
127
|
+
if (currentTabList.length === 0) return
|
|
128
|
+
|
|
129
|
+
const firstFocusableEl = currentTabList[0] as HTMLElement
|
|
130
|
+
const lastFocusableEl = currentTabList[currentTabList.length - 1] as HTMLElement
|
|
131
|
+
const isTabOrderReversed = e.shiftKey
|
|
132
|
+
|
|
133
|
+
// Prevent leaving modal
|
|
134
|
+
if (isTabOrderReversed && document.activeElement === firstFocusableEl) {
|
|
135
|
+
lastFocusableEl.focus()
|
|
136
|
+
e.preventDefault()
|
|
137
|
+
} else if (!isTabOrderReversed && document.activeElement === lastFocusableEl) {
|
|
138
|
+
firstFocusableEl.focus()
|
|
139
|
+
e.preventDefault()
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Add event listener to the modal element
|
|
144
|
+
modal.addEventListener('keydown', handleTabKey as EventListener, true)
|
|
145
|
+
|
|
146
|
+
cleanupFocusTrap = () => {
|
|
147
|
+
modal.removeEventListener('keydown', handleTabKey as EventListener, true)
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
watch(
|
|
153
|
+
() => props.open,
|
|
154
|
+
(newValue) => {
|
|
155
|
+
isOpen.value = newValue
|
|
156
|
+
if (newValue) {
|
|
157
|
+
// Save the currently focused element before opening the modal
|
|
158
|
+
previouslyFocusedElement.value = document.activeElement as HTMLElement
|
|
159
|
+
if (props.lockScroll) {
|
|
160
|
+
document.getElementsByTagName('html')[0].style.overflow = 'hidden'
|
|
161
|
+
}
|
|
162
|
+
trapFocus()
|
|
163
|
+
} else {
|
|
164
|
+
document.getElementsByTagName('html')[0].style.overflow = 'auto'
|
|
165
|
+
if (cleanupFocusTrap) {
|
|
166
|
+
cleanupFocusTrap()
|
|
167
|
+
cleanupFocusTrap = null
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Restore focus to the element that opened the modal
|
|
171
|
+
nextTick(() => {
|
|
172
|
+
if (previouslyFocusedElement.value) {
|
|
173
|
+
previouslyFocusedElement.value.focus()
|
|
174
|
+
previouslyFocusedElement.value = null
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
onMounted(() => {
|
|
182
|
+
document.addEventListener('keydown', handleKeyDown, true)
|
|
183
|
+
|
|
184
|
+
if (props.open) {
|
|
185
|
+
// Save the currently focused element before opening the modal
|
|
186
|
+
previouslyFocusedElement.value = document.activeElement as HTMLElement
|
|
187
|
+
|
|
188
|
+
if (props.lockScroll) {
|
|
189
|
+
document.getElementsByTagName('html')[0].style.overflow = 'hidden'
|
|
190
|
+
}
|
|
191
|
+
trapFocus()
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
onBeforeUnmount(() => {
|
|
196
|
+
document.removeEventListener('keydown', handleKeyDown, true)
|
|
197
|
+
document.getElementsByTagName('html')[0].style.overflow = 'auto'
|
|
198
|
+
if (cleanupFocusTrap) {
|
|
199
|
+
cleanupFocusTrap()
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
<template>
|
|
205
|
+
<Teleport to="body">
|
|
206
|
+
<div
|
|
207
|
+
v-if="isOpen"
|
|
208
|
+
@click="handleBackdropClick"
|
|
209
|
+
:class="modalOuterClasses"
|
|
210
|
+
>
|
|
211
|
+
<!-- Backdrop -->
|
|
212
|
+
<div class="fixed top-0 left-0 w-full h-full bg-black/34 z-99"></div>
|
|
213
|
+
|
|
214
|
+
<!-- Modal Inner -->
|
|
215
|
+
<div
|
|
216
|
+
class="fds-modal-inner"
|
|
217
|
+
:class="modalInnerClasses"
|
|
218
|
+
role="alertdialog"
|
|
219
|
+
aria-modal="true"
|
|
220
|
+
@click.stop
|
|
221
|
+
>
|
|
222
|
+
<!-- Header -->
|
|
223
|
+
<div class="flex justify-between mb-4">
|
|
224
|
+
<h3
|
|
225
|
+
tabindex="-1"
|
|
226
|
+
:class="headerTitleClasses"
|
|
227
|
+
>
|
|
228
|
+
<FdsIcon
|
|
229
|
+
v-if="iconName"
|
|
230
|
+
:name="iconName"
|
|
231
|
+
:size="24"
|
|
232
|
+
:class="iconClasses"
|
|
233
|
+
/>
|
|
234
|
+
{{ heading }}
|
|
235
|
+
</h3>
|
|
236
|
+
<FdsButtonIcon
|
|
237
|
+
v-if="!strict"
|
|
238
|
+
icon="cross"
|
|
239
|
+
:size="28"
|
|
240
|
+
@click="handleClose('icon')"
|
|
241
|
+
:ariaLabel="closeLabel"
|
|
242
|
+
class="ml-4"
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
<!-- Content -->
|
|
247
|
+
<div class="mb-0-last-child">
|
|
248
|
+
<slot />
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
<!-- Footer -->
|
|
252
|
+
<div
|
|
253
|
+
v-if="hasFooterSlot"
|
|
254
|
+
:class="footerClasses"
|
|
255
|
+
>
|
|
256
|
+
<slot name="modal-footer" />
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
</Teleport>
|
|
261
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface FdsModalProps {
|
|
2
|
+
open?: boolean
|
|
3
|
+
heading?: string
|
|
4
|
+
size?: 'sm' | 'md' | 'lg' | 'xl'
|
|
5
|
+
alignTop?: boolean
|
|
6
|
+
alignLeftFooter?: boolean
|
|
7
|
+
stickyFooter?: boolean
|
|
8
|
+
strict?: boolean
|
|
9
|
+
lockScroll?: boolean
|
|
10
|
+
info?: 'valid' | 'invalid' | 'warning'
|
|
11
|
+
locale?: 'sv' | 'en'
|
|
12
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import FdsPagination from './FdsPagination.vue'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof FdsPagination> = {
|
|
6
|
+
title: 'FDS/FdsPagination',
|
|
7
|
+
component: FdsPagination,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
current: { control: { type: 'number' } },
|
|
11
|
+
max: { control: { type: 'number' } },
|
|
12
|
+
loading: { control: { type: 'boolean' } },
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
current: 1,
|
|
16
|
+
max: 10,
|
|
17
|
+
loading: false,
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof meta>
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
render: (args) => ({
|
|
26
|
+
components: { FdsPagination },
|
|
27
|
+
setup: () => {
|
|
28
|
+
const current = ref((args.current ?? 1) as number)
|
|
29
|
+
const handlePaginate = (page: number) => {
|
|
30
|
+
current.value = page
|
|
31
|
+
}
|
|
32
|
+
return { args, current, handlePaginate }
|
|
33
|
+
},
|
|
34
|
+
template: `<FdsPagination :current="current" :max="args.max" :loading="args.loading" @paginate="handlePaginate" />`,
|
|
35
|
+
}),
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const MiddlePage: Story = {
|
|
39
|
+
render: (args) => ({
|
|
40
|
+
components: { FdsPagination },
|
|
41
|
+
setup: () => {
|
|
42
|
+
const current = ref((args.current ?? 1) as number)
|
|
43
|
+
const handlePaginate = (page: number) => {
|
|
44
|
+
current.value = page
|
|
45
|
+
}
|
|
46
|
+
return { args, current, handlePaginate }
|
|
47
|
+
},
|
|
48
|
+
template: `<FdsPagination :current="current" :max="args.max" :loading="args.loading" @paginate="handlePaginate" />`,
|
|
49
|
+
}),
|
|
50
|
+
args: {
|
|
51
|
+
current: 5,
|
|
52
|
+
max: 10,
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const LastPage: Story = {
|
|
57
|
+
render: (args) => ({
|
|
58
|
+
components: { FdsPagination },
|
|
59
|
+
setup: () => {
|
|
60
|
+
const current = ref((args.current ?? 1) as number)
|
|
61
|
+
const handlePaginate = (page: number) => {
|
|
62
|
+
current.value = page
|
|
63
|
+
}
|
|
64
|
+
return { args, current, handlePaginate }
|
|
65
|
+
},
|
|
66
|
+
template: `<FdsPagination :current="current" :max="args.max" :loading="args.loading" @paginate="handlePaginate" />`,
|
|
67
|
+
}),
|
|
68
|
+
args: {
|
|
69
|
+
current: 10,
|
|
70
|
+
max: 10,
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const LargeMax: Story = {
|
|
75
|
+
render: (args) => ({
|
|
76
|
+
components: { FdsPagination },
|
|
77
|
+
setup: () => {
|
|
78
|
+
const current = ref((args.current ?? 1) as number)
|
|
79
|
+
const handlePaginate = (page: number) => {
|
|
80
|
+
current.value = page
|
|
81
|
+
}
|
|
82
|
+
return { args, current, handlePaginate }
|
|
83
|
+
},
|
|
84
|
+
template: `<FdsPagination :current="current" :max="args.max" :loading="args.loading" @paginate="handlePaginate" />`,
|
|
85
|
+
}),
|
|
86
|
+
args: {
|
|
87
|
+
current: 1,
|
|
88
|
+
max: 100,
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const WithLoading: Story = {
|
|
93
|
+
render: (args) => ({
|
|
94
|
+
components: { FdsPagination },
|
|
95
|
+
setup: () => {
|
|
96
|
+
const current = ref((args.current ?? 1) as number)
|
|
97
|
+
const handlePaginate = (page: number) => {
|
|
98
|
+
current.value = page
|
|
99
|
+
}
|
|
100
|
+
return { args, current, handlePaginate }
|
|
101
|
+
},
|
|
102
|
+
template: `<FdsPagination :current="current" :max="args.max" :loading="args.loading" @paginate="handlePaginate" />`,
|
|
103
|
+
}),
|
|
104
|
+
args: {
|
|
105
|
+
current: 1,
|
|
106
|
+
max: 10,
|
|
107
|
+
loading: true,
|
|
108
|
+
},
|
|
109
|
+
}
|