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,87 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, onMounted } from 'vue'
|
|
3
|
+
import FdsButtonMinor from '@/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue'
|
|
4
|
+
import FdsIcon from '@/components/FdsIcon/FdsIcon.vue'
|
|
5
|
+
import type { FdsCopyButtonProps } from './types'
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<FdsCopyButtonProps>(), {
|
|
8
|
+
value: '',
|
|
9
|
+
label: 'Kopiera',
|
|
10
|
+
copiedLabel: 'Kopierat!',
|
|
11
|
+
timeoutMs: 800,
|
|
12
|
+
disabled: false,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const isCopied = ref(false)
|
|
16
|
+
let resetTimer: ReturnType<typeof setTimeout> | null = null
|
|
17
|
+
|
|
18
|
+
async function copyToClipboard(text: string) {
|
|
19
|
+
try {
|
|
20
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
21
|
+
await navigator.clipboard.writeText(text)
|
|
22
|
+
return true
|
|
23
|
+
}
|
|
24
|
+
} catch {
|
|
25
|
+
// ignore and try fallback
|
|
26
|
+
}
|
|
27
|
+
const textarea = document.createElement('textarea')
|
|
28
|
+
textarea.value = text
|
|
29
|
+
textarea.style.position = 'fixed'
|
|
30
|
+
textarea.style.opacity = '0'
|
|
31
|
+
document.body.appendChild(textarea)
|
|
32
|
+
textarea.focus()
|
|
33
|
+
textarea.select()
|
|
34
|
+
let ok = false
|
|
35
|
+
try {
|
|
36
|
+
ok = document.execCommand('copy')
|
|
37
|
+
} catch {
|
|
38
|
+
ok = false
|
|
39
|
+
}
|
|
40
|
+
document.body.removeChild(textarea)
|
|
41
|
+
return ok
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function onClick() {
|
|
45
|
+
if (props.disabled) return
|
|
46
|
+
let textToCopy = props.value
|
|
47
|
+
if (props.targetId) {
|
|
48
|
+
const el = document.getElementById(props.targetId)
|
|
49
|
+
if (el) {
|
|
50
|
+
textToCopy = (el as HTMLElement).innerText || (el as HTMLElement).textContent || ''
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!textToCopy) return
|
|
54
|
+
const ok = await copyToClipboard(textToCopy)
|
|
55
|
+
if (!ok) return
|
|
56
|
+
isCopied.value = true
|
|
57
|
+
if (resetTimer) clearTimeout(resetTimer)
|
|
58
|
+
resetTimer = setTimeout(() => (isCopied.value = false), props.timeoutMs)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
onMounted(() => {
|
|
62
|
+
if (resetTimer) {
|
|
63
|
+
clearTimeout(resetTimer)
|
|
64
|
+
resetTimer = null
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
defineEmits<{ (e: 'click'): void }>()
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<div
|
|
73
|
+
v-if="isCopied"
|
|
74
|
+
class="flex items-center gap-2 h-7"
|
|
75
|
+
>
|
|
76
|
+
<FdsIcon name="bigSuccess" />
|
|
77
|
+
<span>{{ props.copiedLabel }}</span>
|
|
78
|
+
</div>
|
|
79
|
+
<FdsButtonMinor
|
|
80
|
+
v-else
|
|
81
|
+
type="button"
|
|
82
|
+
:disabled="props.disabled"
|
|
83
|
+
icon="copy"
|
|
84
|
+
:text="isCopied ? props.copiedLabel : props.label"
|
|
85
|
+
@click="onClick"
|
|
86
|
+
/>
|
|
87
|
+
</template>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import FdsButtonDownload from './FdsButtonDownload.vue'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FdsButtonDownload> = {
|
|
5
|
+
title: 'FDS/Buttons/FdsButtonDownload',
|
|
6
|
+
component: FdsButtonDownload,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
source: {
|
|
11
|
+
transform: (_code: string, ctx: { args?: Record<string, unknown> }) => {
|
|
12
|
+
const a = (ctx.args || {}) as Record<string, unknown>
|
|
13
|
+
const attrs: string[] = []
|
|
14
|
+
const push = (s: string) => attrs.push(s)
|
|
15
|
+
if (typeof a.text === 'string') push(`text="${a.text}"`)
|
|
16
|
+
if (typeof a.iconPos === 'string' && a.iconPos !== 'left') push(`icon-pos="${a.iconPos}"`)
|
|
17
|
+
if (a.loading) push(':loading="true"')
|
|
18
|
+
if (a.disabled) push(':disabled="true"')
|
|
19
|
+
if (typeof a.href === 'string' && a.href) push(`href="${a.href}"`)
|
|
20
|
+
const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
|
|
21
|
+
return `<FdsButtonDownload${attrsStr} />`
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
text: {
|
|
28
|
+
control: 'text',
|
|
29
|
+
description: 'Button text',
|
|
30
|
+
},
|
|
31
|
+
href: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'Link URL',
|
|
34
|
+
},
|
|
35
|
+
loading: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: 'Show loading spinner',
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
description: 'Disable button',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
args: {
|
|
45
|
+
text: 'Download',
|
|
46
|
+
href: '#',
|
|
47
|
+
loading: false,
|
|
48
|
+
disabled: false,
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default meta
|
|
53
|
+
type Story = StoryObj<typeof meta>
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
render: (args) => ({
|
|
57
|
+
components: { FdsButtonDownload },
|
|
58
|
+
setup() {
|
|
59
|
+
return { args }
|
|
60
|
+
},
|
|
61
|
+
template: '<FdsButtonDownload v-bind="args" />',
|
|
62
|
+
}),
|
|
63
|
+
args: {
|
|
64
|
+
text: 'Download',
|
|
65
|
+
href: '#',
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const WithText: Story = {
|
|
70
|
+
render: (args) => ({
|
|
71
|
+
components: { FdsButtonDownload },
|
|
72
|
+
setup() {
|
|
73
|
+
return { args }
|
|
74
|
+
},
|
|
75
|
+
template: '<FdsButtonDownload v-bind="args" />',
|
|
76
|
+
}),
|
|
77
|
+
args: {
|
|
78
|
+
text: 'Download file',
|
|
79
|
+
href: '/download.pdf',
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const Loading: Story = {
|
|
84
|
+
render: (args) => ({
|
|
85
|
+
components: { FdsButtonDownload },
|
|
86
|
+
setup() {
|
|
87
|
+
return { args }
|
|
88
|
+
},
|
|
89
|
+
template: '<FdsButtonDownload v-bind="args" />',
|
|
90
|
+
}),
|
|
91
|
+
args: {
|
|
92
|
+
text: 'Download',
|
|
93
|
+
href: '#',
|
|
94
|
+
loading: true,
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const Disabled: Story = {
|
|
99
|
+
render: (args) => ({
|
|
100
|
+
components: { FdsButtonDownload },
|
|
101
|
+
setup() {
|
|
102
|
+
return { args }
|
|
103
|
+
},
|
|
104
|
+
template: '<FdsButtonDownload v-bind="args" />',
|
|
105
|
+
}),
|
|
106
|
+
args: {
|
|
107
|
+
text: 'Download',
|
|
108
|
+
href: '#',
|
|
109
|
+
disabled: true,
|
|
110
|
+
},
|
|
111
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import FdsIcon from '@/components/FdsIcon/FdsIcon.vue'
|
|
4
|
+
import type { FdsButtonBaseProps } from '@/components/Buttons/ButtonBaseProps'
|
|
5
|
+
|
|
6
|
+
defineOptions({
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
interface DownloadOptions {
|
|
11
|
+
token: string
|
|
12
|
+
accept?: string
|
|
13
|
+
headerAuthKey?: string
|
|
14
|
+
headerAuthValuePrefix?: string
|
|
15
|
+
errorHandler?: (error: unknown) => void
|
|
16
|
+
onFinishCallback?: () => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type FdsButtonDownloadProps = Omit<FdsButtonBaseProps, 'as' | 'icon'> & {
|
|
20
|
+
downloadOptions?: DownloadOptions
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<FdsButtonDownloadProps>(), {
|
|
24
|
+
loading: false,
|
|
25
|
+
disabled: false,
|
|
26
|
+
iconPos: 'left',
|
|
27
|
+
href: undefined,
|
|
28
|
+
downloadOptions: undefined,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const emit = defineEmits<{
|
|
32
|
+
(e: 'click', ev: MouseEvent): void
|
|
33
|
+
}>()
|
|
34
|
+
|
|
35
|
+
const isDownloading = ref(false)
|
|
36
|
+
|
|
37
|
+
const rootClasses = computed(() => [
|
|
38
|
+
'inline-block transition-opacity duration-200',
|
|
39
|
+
props.disabled && 'opacity-20 pointer-events-none',
|
|
40
|
+
])
|
|
41
|
+
|
|
42
|
+
const elBase = computed(() => [
|
|
43
|
+
'box-border appearance-none w-full inline-flex items-center justify-center shadow-none p-0.5 text-base',
|
|
44
|
+
'select-none m-0 rounded-md align-middle whitespace-nowrap no-underline',
|
|
45
|
+
'transition-[box-shadow,border-color,background-color] duration-200 font-main text-base',
|
|
46
|
+
'leading-5 tracking-normal',
|
|
47
|
+
])
|
|
48
|
+
|
|
49
|
+
const stateClasses = computed(() => [
|
|
50
|
+
'focus-visible:outline-dashed focus-visible:outline-2 focus-visible:outline-offset-4',
|
|
51
|
+
'focus-visible:outline-blue-500 hover:bg-blue_t-100 active:bg-blue_t-200',
|
|
52
|
+
])
|
|
53
|
+
|
|
54
|
+
const iconOrderClasses = computed(() => (props.iconPos === 'right' ? 'order-2 ml-2 mr-0' : 'mr-2'))
|
|
55
|
+
|
|
56
|
+
const buttonClasses = computed(() => [
|
|
57
|
+
elBase.value,
|
|
58
|
+
stateClasses.value,
|
|
59
|
+
'border-0 font-normal bg-transparent',
|
|
60
|
+
isDownloading.value ? 'cursor-not-allowed text-gray-500' : 'cursor-pointer text-blue-600',
|
|
61
|
+
])
|
|
62
|
+
|
|
63
|
+
const iconFillClass = computed(() => (isDownloading.value ? 'fill-gray-500' : 'fill-blue-500'))
|
|
64
|
+
|
|
65
|
+
async function handleDownload(ev: MouseEvent) {
|
|
66
|
+
if (props.disabled || props.loading || isDownloading.value) {
|
|
67
|
+
ev.preventDefault()
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// If no downloadOptions, just emit click and let default link behavior handle it
|
|
72
|
+
if (!props.downloadOptions || !props.href) {
|
|
73
|
+
emit('click', ev)
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ev.preventDefault()
|
|
78
|
+
|
|
79
|
+
isDownloading.value = true
|
|
80
|
+
|
|
81
|
+
const options = props.downloadOptions
|
|
82
|
+
const authHeader: Record<string, string> = {}
|
|
83
|
+
authHeader[options.headerAuthKey || 'Authorization'] = `${options.headerAuthValuePrefix || 'Bearer '}${options.token}`
|
|
84
|
+
|
|
85
|
+
if (options.accept) {
|
|
86
|
+
authHeader.Accept = options.accept
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
const response = await fetch(props.href, {
|
|
91
|
+
method: 'GET',
|
|
92
|
+
headers: authHeader,
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
if (!response.ok) {
|
|
96
|
+
throw new Error(`Download failed: ${response.status} ${response.statusText}`)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Get blob from response
|
|
100
|
+
const blob = await response.blob()
|
|
101
|
+
const url = URL.createObjectURL(blob)
|
|
102
|
+
const link = document.createElement('a')
|
|
103
|
+
link.href = url
|
|
104
|
+
|
|
105
|
+
// Try to get filename from Content-Disposition header
|
|
106
|
+
const contentDisposition = response.headers.get('content-disposition')
|
|
107
|
+
let fileName = props.href.substring(props.href.lastIndexOf('/') + 1)
|
|
108
|
+
|
|
109
|
+
if (contentDisposition) {
|
|
110
|
+
const fileNameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/)
|
|
111
|
+
if (fileNameMatch && fileNameMatch[1]) {
|
|
112
|
+
fileName = fileNameMatch[1].replace(/['"]/g, '')
|
|
113
|
+
// Decode URL encoding
|
|
114
|
+
fileName = fileName.replace(/\+/g, '%20')
|
|
115
|
+
fileName = decodeURIComponent(fileName)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
link.setAttribute('download', fileName)
|
|
120
|
+
document.body.appendChild(link)
|
|
121
|
+
|
|
122
|
+
link.dispatchEvent(
|
|
123
|
+
new MouseEvent('click', {
|
|
124
|
+
bubbles: true,
|
|
125
|
+
cancelable: true,
|
|
126
|
+
view: window,
|
|
127
|
+
}),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
setTimeout(() => {
|
|
131
|
+
document.body.removeChild(link)
|
|
132
|
+
URL.revokeObjectURL(url)
|
|
133
|
+
}, 100)
|
|
134
|
+
|
|
135
|
+
if (options.onFinishCallback) {
|
|
136
|
+
options.onFinishCallback()
|
|
137
|
+
}
|
|
138
|
+
} catch (error) {
|
|
139
|
+
if (options.errorHandler) {
|
|
140
|
+
options.errorHandler(error)
|
|
141
|
+
} else {
|
|
142
|
+
throw error
|
|
143
|
+
}
|
|
144
|
+
} finally {
|
|
145
|
+
isDownloading.value = false
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function onClick(ev: MouseEvent) {
|
|
150
|
+
if (props.downloadOptions) {
|
|
151
|
+
handleDownload(ev)
|
|
152
|
+
} else {
|
|
153
|
+
if (props.disabled || props.loading) {
|
|
154
|
+
ev.preventDefault()
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
emit('click', ev)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
</script>
|
|
161
|
+
|
|
162
|
+
<template>
|
|
163
|
+
<div
|
|
164
|
+
:class="rootClasses"
|
|
165
|
+
:aria-disabled="disabled ? 'true' : undefined"
|
|
166
|
+
>
|
|
167
|
+
<button
|
|
168
|
+
v-bind="$attrs"
|
|
169
|
+
:class="buttonClasses"
|
|
170
|
+
:disabled="disabled || loading || isDownloading"
|
|
171
|
+
type="button"
|
|
172
|
+
@click="onClick"
|
|
173
|
+
>
|
|
174
|
+
<span
|
|
175
|
+
:class="iconOrderClasses"
|
|
176
|
+
aria-hidden="true"
|
|
177
|
+
>
|
|
178
|
+
<FdsIcon
|
|
179
|
+
:class="iconFillClass"
|
|
180
|
+
name="download"
|
|
181
|
+
:size="24"
|
|
182
|
+
/>
|
|
183
|
+
</span>
|
|
184
|
+
{{ text }}
|
|
185
|
+
</button>
|
|
186
|
+
</div>
|
|
187
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import FdsButtonIcon from './FdsButtonIcon.vue'
|
|
3
|
+
import icons from '@/assets/icons'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof FdsButtonIcon> = {
|
|
6
|
+
title: 'FDS/Buttons/FdsButtonIcon',
|
|
7
|
+
component: FdsButtonIcon,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
source: {
|
|
12
|
+
transform: (_code: string, ctx: { args?: Record<string, unknown> }) => {
|
|
13
|
+
const a = (ctx.args || {}) as Record<string, unknown>
|
|
14
|
+
const attrs: string[] = []
|
|
15
|
+
const push = (s: string) => attrs.push(s)
|
|
16
|
+
if (typeof a.icon === 'string') push(`icon="${a.icon}"`)
|
|
17
|
+
if (typeof a.size === 'number' && a.size !== 24) push(`size="${a.size}"`)
|
|
18
|
+
if (a.loading) push(':loading="true"')
|
|
19
|
+
if (a.disabled) push(':disabled="true"')
|
|
20
|
+
if (typeof a.type === 'string' && a.type !== 'button') push(`type="${a.type}"`)
|
|
21
|
+
if (typeof a.ariaLabel === 'string') push(`aria-label="${a.ariaLabel}"`)
|
|
22
|
+
const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
|
|
23
|
+
return `<FdsButtonIcon${attrsStr} />`
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
icon: { control: { type: 'select' }, options: Object.keys(icons) },
|
|
30
|
+
disabled: { control: { type: 'boolean' } },
|
|
31
|
+
loading: { control: { type: 'boolean' } },
|
|
32
|
+
type: { control: { type: 'select' }, options: ['button', 'submit', 'reset'] },
|
|
33
|
+
ariaLabel: { control: { type: 'text' } },
|
|
34
|
+
size: { control: { type: 'number' } },
|
|
35
|
+
},
|
|
36
|
+
args: {
|
|
37
|
+
icon: 'information',
|
|
38
|
+
size: 24,
|
|
39
|
+
disabled: false,
|
|
40
|
+
loading: false,
|
|
41
|
+
type: 'button',
|
|
42
|
+
ariaLabel: 'More options',
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default meta
|
|
47
|
+
type Story = StoryObj<typeof meta>
|
|
48
|
+
|
|
49
|
+
export const Default: Story = {
|
|
50
|
+
render: (args) => ({
|
|
51
|
+
components: { FdsButtonIcon },
|
|
52
|
+
setup: () => ({ args }),
|
|
53
|
+
template: '<FdsButtonIcon v-bind="args" />',
|
|
54
|
+
}),
|
|
55
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import FdsIcon from '@/components/FdsIcon/FdsIcon.vue'
|
|
4
|
+
import type { FdsIconButtonProps } from './types'
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<FdsIconButtonProps>(), {
|
|
7
|
+
size: 24,
|
|
8
|
+
disabled: false,
|
|
9
|
+
loading: false,
|
|
10
|
+
type: 'button',
|
|
11
|
+
ariaLabel: undefined,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// Remove padding of button (4px) from the size to get the icon size
|
|
15
|
+
const iconSize = computed(() => props.size - 4)
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits<{
|
|
18
|
+
(e: 'click', ev: MouseEvent): void
|
|
19
|
+
}>()
|
|
20
|
+
|
|
21
|
+
const buttonClasses = computed(() => [
|
|
22
|
+
'inline-flex items-center justify-center rounded-md p-[2px] max-w-[48px] max-h-[48px] transition-colors duration-200 fill-blue-500 hover:bg-blue_t-100 active:bg-blue_t-200 focus-visible:outline-dashed focus-visible:outline-2 outline-blue-500',
|
|
23
|
+
props.disabled ? 'opacity-20 cursor-not-allowed' : 'cursor-pointer',
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
function onClick(ev: MouseEvent) {
|
|
27
|
+
if (props.disabled || props.loading) {
|
|
28
|
+
ev.preventDefault()
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
emit('click', ev)
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<button
|
|
37
|
+
:id="id"
|
|
38
|
+
:type="type"
|
|
39
|
+
:disabled="disabled"
|
|
40
|
+
:aria-label="ariaLabel"
|
|
41
|
+
:aria-disabled="ariaDisabled"
|
|
42
|
+
:class="buttonClasses"
|
|
43
|
+
@click="onClick"
|
|
44
|
+
>
|
|
45
|
+
<FdsIcon
|
|
46
|
+
v-if="!loading"
|
|
47
|
+
:size="iconSize"
|
|
48
|
+
:name="icon"
|
|
49
|
+
/>
|
|
50
|
+
<FdsIcon
|
|
51
|
+
v-else
|
|
52
|
+
:size="iconSize"
|
|
53
|
+
name="spinner"
|
|
54
|
+
class="animate-spin"
|
|
55
|
+
/>
|
|
56
|
+
</button>
|
|
57
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FdsIconName } from '@/components/FdsIcon/types'
|
|
2
|
+
|
|
3
|
+
export interface FdsIconButtonProps {
|
|
4
|
+
icon: FdsIconName
|
|
5
|
+
size?: number
|
|
6
|
+
disabled?: boolean
|
|
7
|
+
loading?: boolean
|
|
8
|
+
type?: 'button' | 'submit' | 'reset'
|
|
9
|
+
ariaLabel?: string
|
|
10
|
+
id?: string
|
|
11
|
+
ariaDisabled?: boolean
|
|
12
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import FdsButtonMinor from './FdsButtonMinor.vue'
|
|
3
|
+
import icons from '@/assets/icons'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof FdsButtonMinor> = {
|
|
6
|
+
title: 'FDS/Buttons/FdsButtonMinor',
|
|
7
|
+
component: FdsButtonMinor,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
source: {
|
|
12
|
+
transform: (_code: string, ctx: { args?: Record<string, unknown> }) => {
|
|
13
|
+
const a = (ctx.args || {}) as Record<string, unknown>
|
|
14
|
+
const attrs: string[] = []
|
|
15
|
+
const push = (s: string) => attrs.push(s)
|
|
16
|
+
if (typeof a.text === 'string') push(`text="${a.text}"`)
|
|
17
|
+
if (typeof a.icon === 'string') push(`icon="${a.icon}"`)
|
|
18
|
+
if (typeof a.iconPos === 'string' && a.iconPos !== 'left') push(`icon-pos="${a.iconPos}"`)
|
|
19
|
+
if (a.invert) push(':invert="true"')
|
|
20
|
+
if (a.loading) push(':loading="true"')
|
|
21
|
+
if (a.disabled) push(':disabled="true"')
|
|
22
|
+
if (a.block) push(':block="true"')
|
|
23
|
+
if (typeof a.as === 'string' && a.as !== 'button') push(`as="${a.as}"`)
|
|
24
|
+
if (typeof a.type === 'string' && a.type !== 'button') push(`type="${a.type}"`)
|
|
25
|
+
if (typeof a.href === 'string' && a.href) push(`href="${a.href}"`)
|
|
26
|
+
const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
|
|
27
|
+
return `<FdsButtonMinor${attrsStr} />`
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
argTypes: {
|
|
33
|
+
text: { control: { type: 'text' } },
|
|
34
|
+
icon: { control: { type: 'select' }, options: Object.keys(icons) },
|
|
35
|
+
iconPos: { control: { type: 'inline-radio' }, options: ['left', 'right'] },
|
|
36
|
+
invert: { control: { type: 'boolean' } },
|
|
37
|
+
loading: { control: { type: 'boolean' } },
|
|
38
|
+
disabled: { control: { type: 'boolean' } },
|
|
39
|
+
block: { control: { type: 'boolean' } },
|
|
40
|
+
textSelection: { control: { type: 'boolean' } },
|
|
41
|
+
as: { control: { type: 'select' }, options: ['button', 'a', 'router-link'] },
|
|
42
|
+
type: { control: { type: 'select' }, options: ['button', 'submit', 'reset'] },
|
|
43
|
+
href: { control: { type: 'text' } },
|
|
44
|
+
},
|
|
45
|
+
args: {
|
|
46
|
+
text: 'Minor',
|
|
47
|
+
invert: false,
|
|
48
|
+
loading: false,
|
|
49
|
+
disabled: false,
|
|
50
|
+
block: false,
|
|
51
|
+
textSelection: false,
|
|
52
|
+
icon: undefined,
|
|
53
|
+
iconPos: 'left',
|
|
54
|
+
as: 'button',
|
|
55
|
+
type: 'button',
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default meta
|
|
60
|
+
type Story = StoryObj<typeof meta>
|
|
61
|
+
|
|
62
|
+
export const Default: Story = {
|
|
63
|
+
render: (args) => ({
|
|
64
|
+
components: { FdsButtonMinor },
|
|
65
|
+
setup: () => ({ args }),
|
|
66
|
+
template: '<FdsButtonMinor v-bind="args" />',
|
|
67
|
+
}),
|
|
68
|
+
}
|