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,383 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject, nextTick, reactive, ref, watch } from 'vue'
|
|
3
|
+
import FdsButtonIcon from '@/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue'
|
|
4
|
+
import FdsCheckbox from '@/components/Form/FdsCheckbox/FdsCheckbox.vue'
|
|
5
|
+
import FdsRadio from '@/components/Form/FdsRadio/FdsRadio.vue'
|
|
6
|
+
import type { FdsTreeViewProps } from './types'
|
|
7
|
+
import useTreeState from './useTreeState'
|
|
8
|
+
import { getTitleFromProperties } from './utils'
|
|
9
|
+
|
|
10
|
+
type Props<T = Record<string, unknown>> = FdsTreeViewProps<T>
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
13
|
+
nodes: () => [],
|
|
14
|
+
depth: 0,
|
|
15
|
+
showNodeDescription: false,
|
|
16
|
+
showChildrenCount: false,
|
|
17
|
+
expandChildrenOnSelect: false,
|
|
18
|
+
showIndeterminate: false,
|
|
19
|
+
expandChildrenOnParentCheck: false,
|
|
20
|
+
expandAllChildrenOnParentCheck: true,
|
|
21
|
+
showIndeterminateOnlyOnChildrenSelection: false,
|
|
22
|
+
searchEnabled: false,
|
|
23
|
+
searchExpandNodes: false,
|
|
24
|
+
horizontalScroll: false,
|
|
25
|
+
searchMatchParams: () => ['title', 'nodeId'],
|
|
26
|
+
searchHighlighting: false,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
defineOptions({
|
|
30
|
+
name: 'TreeNode',
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const injectedTreeState = inject<ReturnType<typeof useTreeState> | null>('treeState', null)
|
|
34
|
+
const treeState = injectedTreeState!
|
|
35
|
+
const expandedNodes = treeState?.expandedNodes ?? reactive(new Set())
|
|
36
|
+
|
|
37
|
+
const childrenToggleAriaLabel = (title: string) => {
|
|
38
|
+
const hasChildren = hasChildrenNodes.value
|
|
39
|
+
const isExpanded = expandedNodes.has(props.nodeId)
|
|
40
|
+
if (hasChildren && isExpanded) {
|
|
41
|
+
return `Fäll ihop ${title}`
|
|
42
|
+
}
|
|
43
|
+
return `Fäll ut ${title}`
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const hasChildrenNodes = computed(() => {
|
|
47
|
+
const nodesToCheck = props.searchEnabled && treeState?.searchTerm?.value ? filteredNodes.value : props.nodes
|
|
48
|
+
return Array.isArray(nodesToCheck) && nodesToCheck.length > 0
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const indentValue = props.depth * props.indentation
|
|
52
|
+
|
|
53
|
+
const indent = computed(() => ({
|
|
54
|
+
flexDirection: 'row' as const,
|
|
55
|
+
alignItems: 'center' as const,
|
|
56
|
+
paddingLeft: `${indentValue + (hasChildrenNodes.value ? 0 : 4)}px`,
|
|
57
|
+
}))
|
|
58
|
+
|
|
59
|
+
const filteredNodes = computed(() => {
|
|
60
|
+
const t = String(treeState?.searchTerm?.value || '').trim()
|
|
61
|
+
if (!props.searchEnabled || !t || t.length < (treeState?.triggerLength ?? 1)) {
|
|
62
|
+
return props.nodes
|
|
63
|
+
}
|
|
64
|
+
return treeState.filterNodes(props.nodes, t, props.searchMatchParams)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const trimmedSearchTerm = computed(() => String(treeState?.searchTerm?.value || '').trim())
|
|
68
|
+
const meetsSearchTrigger = computed(() => trimmedSearchTerm.value.length >= (treeState?.triggerLength ?? 1))
|
|
69
|
+
const isSearchActive = computed(() => props.searchEnabled && meetsSearchTrigger.value)
|
|
70
|
+
const shouldHighlightSearch = computed(() => props.searchHighlighting && isSearchActive.value)
|
|
71
|
+
const childCount = computed(() => {
|
|
72
|
+
if (!props.showChildrenCount || !hasChildrenNodes.value) return null
|
|
73
|
+
return isSearchActive.value ? (filteredNodes.value?.length ?? 0) : props.nodes.length
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// Auto-expand current node if search is active and it has matching children
|
|
77
|
+
watch(
|
|
78
|
+
() => ({
|
|
79
|
+
enabled: props.searchEnabled,
|
|
80
|
+
expandOnSearch: props.searchExpandNodes,
|
|
81
|
+
term: treeState?.searchTerm?.value,
|
|
82
|
+
count: (filteredNodes.value || []).length,
|
|
83
|
+
}),
|
|
84
|
+
({ enabled, expandOnSearch, term, count }) => {
|
|
85
|
+
if (!enabled || !expandOnSearch) return
|
|
86
|
+
const t = String(term || '').trim()
|
|
87
|
+
if (!t || t.length < (treeState?.triggerLength ?? 1)) return
|
|
88
|
+
if (typeof count === 'number' && count > 0) {
|
|
89
|
+
expandedNodes.add(props.nodeId)
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
const isOpen = ref(false)
|
|
95
|
+
const triggerRef = ref<HTMLElement | null>(null)
|
|
96
|
+
const popoverPanelRef = ref<HTMLElement | null>(null)
|
|
97
|
+
const popoverCoords = reactive({ bottom: 0, right: 0, left: 0, top: 0 })
|
|
98
|
+
|
|
99
|
+
const popoverWidth = 327
|
|
100
|
+
const popoverHeight = 80
|
|
101
|
+
|
|
102
|
+
const computePopoverCoords = () => {
|
|
103
|
+
const componentInstance = triggerRef.value
|
|
104
|
+
if (!componentInstance) return
|
|
105
|
+
// Get the actual DOM element from the Vue component instance
|
|
106
|
+
const triggerEl = '$el' in componentInstance ? (componentInstance as { $el: HTMLElement }).$el : componentInstance
|
|
107
|
+
if (!(triggerEl instanceof HTMLElement)) return
|
|
108
|
+
const rect = triggerEl.getBoundingClientRect()
|
|
109
|
+
popoverCoords.bottom = Math.round(rect.bottom)
|
|
110
|
+
popoverCoords.right = Math.round(rect.right)
|
|
111
|
+
popoverCoords.left = Math.round(rect.left)
|
|
112
|
+
popoverCoords.top = Math.round(rect.top)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const openPopover = async () => {
|
|
116
|
+
computePopoverCoords()
|
|
117
|
+
isOpen.value = true
|
|
118
|
+
window.addEventListener('scroll', computePopoverCoords, true)
|
|
119
|
+
window.addEventListener('resize', computePopoverCoords)
|
|
120
|
+
document.addEventListener('pointerdown', handleGlobalPointerDown, { passive: true })
|
|
121
|
+
document.addEventListener('keydown', handleGlobalKeydown)
|
|
122
|
+
|
|
123
|
+
// Focus first radio inside the popover for immediate keyboard use
|
|
124
|
+
await nextTick()
|
|
125
|
+
const firstRadio = popoverPanelRef.value?.querySelector('input[type="radio"]') as HTMLInputElement | null
|
|
126
|
+
firstRadio?.focus()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const closePopover = () => {
|
|
130
|
+
isOpen.value = false
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const onAfterPopoverLeave = () => {
|
|
134
|
+
window.removeEventListener('scroll', computePopoverCoords, true)
|
|
135
|
+
window.removeEventListener('resize', computePopoverCoords)
|
|
136
|
+
document.removeEventListener('pointerdown', handleGlobalPointerDown)
|
|
137
|
+
document.removeEventListener('keydown', handleGlobalKeydown)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const togglePopover = () => {
|
|
141
|
+
if (isOpen.value) closePopover()
|
|
142
|
+
else openPopover()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const handleGlobalPointerDown = (event: PointerEvent) => {
|
|
146
|
+
if (!isOpen.value) return
|
|
147
|
+
|
|
148
|
+
const hasComposedPath = (ev: Event): ev is Event & { composedPath: () => EventTarget[] } =>
|
|
149
|
+
typeof (ev as { composedPath?: () => EventTarget[] }).composedPath === 'function'
|
|
150
|
+
|
|
151
|
+
const clickedPath = hasComposedPath(event) ? event.composedPath() : ([] as EventTarget[])
|
|
152
|
+
const contains = (el: HTMLElement | null) => (el ? clickedPath.includes(el) : false)
|
|
153
|
+
|
|
154
|
+
// Extract DOM element from component instance if needed
|
|
155
|
+
const getTriggerElement = (): HTMLElement | null => {
|
|
156
|
+
const instance = triggerRef.value
|
|
157
|
+
if (!instance) return null
|
|
158
|
+
return '$el' in instance
|
|
159
|
+
? (instance as { $el: HTMLElement }).$el
|
|
160
|
+
: instance instanceof HTMLElement
|
|
161
|
+
? instance
|
|
162
|
+
: null
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (!contains(getTriggerElement()) && !contains(popoverPanelRef.value)) {
|
|
166
|
+
closePopover()
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const handleGlobalKeydown = (event: KeyboardEvent) => {
|
|
171
|
+
if (event.key === 'Escape' && isOpen.value) {
|
|
172
|
+
closePopover()
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const onPanelFocusOut = (event: FocusEvent) => {
|
|
177
|
+
const next = event.relatedTarget as HTMLElement | null
|
|
178
|
+
const panelEl = popoverPanelRef.value
|
|
179
|
+
if (!panelEl) return
|
|
180
|
+
|
|
181
|
+
const triggerVal = triggerRef.value as unknown
|
|
182
|
+
const triggerEl =
|
|
183
|
+
triggerVal && typeof triggerVal === 'object' && '$el' in (triggerVal as Record<string, unknown>)
|
|
184
|
+
? (triggerVal as { $el: HTMLElement }).$el
|
|
185
|
+
: (triggerVal as HTMLElement | null)
|
|
186
|
+
|
|
187
|
+
const isButton = next?.tagName === 'BUTTON' && next?.id !== 'tree-popover-close-button'
|
|
188
|
+
const isInsidePanel = !!next && panelEl.contains(next)
|
|
189
|
+
const isTrigger = !!next && !!triggerEl && triggerEl.contains(next)
|
|
190
|
+
|
|
191
|
+
const leavingPanel = !next || (!isInsidePanel && !isTrigger) || isButton
|
|
192
|
+
if (leavingPanel) closePopover()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const options = [
|
|
196
|
+
{ label: props.popoverLabels?.parentAndChildren, value: 'parent_and_children' },
|
|
197
|
+
{ label: props.popoverLabels?.parent, value: 'parent' },
|
|
198
|
+
]
|
|
199
|
+
|
|
200
|
+
const currentOption = computed(() => {
|
|
201
|
+
if (treeState?.isParentAndAllChildrenSelected(props.nodeId)) return 'parent_and_children'
|
|
202
|
+
if (treeState?.isParentOnlySelected(props.nodeId)) return 'parent'
|
|
203
|
+
return ''
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
// Ref for v-model on radio group - matches FdsRadio v-model type (string | number)
|
|
207
|
+
const selectedOption = ref<string | number>(currentOption.value)
|
|
208
|
+
|
|
209
|
+
// Sync selectedOption when currentOption changes externally
|
|
210
|
+
watch(
|
|
211
|
+
currentOption,
|
|
212
|
+
(newValue) => {
|
|
213
|
+
selectedOption.value = newValue
|
|
214
|
+
},
|
|
215
|
+
{ immediate: true },
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
// Watch selectedOption to handle changes
|
|
219
|
+
watch(selectedOption, (newValue) => {
|
|
220
|
+
if (newValue) {
|
|
221
|
+
handleOptionClick(newValue as (typeof options)[number]['value'])
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
const handleOptionClick = (option: (typeof options)[number]['value']) => {
|
|
226
|
+
if (option === 'parent_and_children') {
|
|
227
|
+
treeState?.selectNodeAndAllChildren(props.nodeId)
|
|
228
|
+
} else if (option === 'parent') {
|
|
229
|
+
treeState?.deselectChildrenOnly(props.nodeId)
|
|
230
|
+
}
|
|
231
|
+
closePopover()
|
|
232
|
+
}
|
|
233
|
+
</script>
|
|
234
|
+
|
|
235
|
+
<template>
|
|
236
|
+
<div :class="props?.style?.container">
|
|
237
|
+
<div
|
|
238
|
+
:style="indent"
|
|
239
|
+
:class="'pt-2 pb-2'"
|
|
240
|
+
>
|
|
241
|
+
<div class="flex items-start">
|
|
242
|
+
<FdsButtonIcon
|
|
243
|
+
v-if="hasChildrenNodes"
|
|
244
|
+
@click="treeState?.toggleExpandNode(props.nodeId)"
|
|
245
|
+
:ariaLabel="props.title ? childrenToggleAriaLabel(props.title) : undefined"
|
|
246
|
+
:icon="
|
|
247
|
+
treeState?.getNodeIcon(props.nodeId, props.nodeExpandIcon, props.nodeCollapseIcon) ?? props.nodeExpandIcon
|
|
248
|
+
"
|
|
249
|
+
:size="24"
|
|
250
|
+
class="fill-blue-500 mr-3 items-center"
|
|
251
|
+
/>
|
|
252
|
+
<div
|
|
253
|
+
v-if="!hasChildrenNodes"
|
|
254
|
+
:style="{ minWidth: `${indentation}px` }"
|
|
255
|
+
/>
|
|
256
|
+
<div class="flex-1 flex">
|
|
257
|
+
<FdsCheckbox
|
|
258
|
+
:id="`checkbox-${props.nodeId}`"
|
|
259
|
+
:checked="treeState?.isNodeSelected(props.nodeId)"
|
|
260
|
+
:indeterminate="showIndeterminate && (treeState?.isNodeIndeterminateById(props.nodeId) ?? false)"
|
|
261
|
+
@change="treeState?.toggleSelectNode(props.nodeId, props.title, props.data)"
|
|
262
|
+
>
|
|
263
|
+
<span>
|
|
264
|
+
<span
|
|
265
|
+
v-if="shouldHighlightSearch && title"
|
|
266
|
+
v-html="treeState?.highlightText(title, treeState?.searchTerm?.value)"
|
|
267
|
+
/>
|
|
268
|
+
<span v-else>{{ title }}</span>
|
|
269
|
+
</span>
|
|
270
|
+
<span v-if="childCount !== null"> (+{{ childCount }})</span>
|
|
271
|
+
</FdsCheckbox>
|
|
272
|
+
</div>
|
|
273
|
+
<div
|
|
274
|
+
class="items-center max-h-[28px]"
|
|
275
|
+
v-if="
|
|
276
|
+
treeState?.isParentOrChildrenSelected(props.nodeId) &&
|
|
277
|
+
!(treeState?.isNodeIndeterminateById(props.nodeId) ?? false)
|
|
278
|
+
"
|
|
279
|
+
>
|
|
280
|
+
<FdsButtonIcon
|
|
281
|
+
ref="triggerRef"
|
|
282
|
+
icon="more"
|
|
283
|
+
:size="24"
|
|
284
|
+
@click="togglePopover"
|
|
285
|
+
:ariaLabel="`Fler val för ${title}`"
|
|
286
|
+
class="items-center"
|
|
287
|
+
/>
|
|
288
|
+
<!-- <teleport to="body"> -->
|
|
289
|
+
<Transition
|
|
290
|
+
enter-active-class="transition-opacity duration-200 ease-in-out"
|
|
291
|
+
enter-from-class="opacity-0"
|
|
292
|
+
enter-to-class="opacity-100"
|
|
293
|
+
leave-active-class="transition-opacity duration-500 ease-in-out"
|
|
294
|
+
leave-from-class="opacity-100"
|
|
295
|
+
leave-to-class="opacity-0"
|
|
296
|
+
@after-leave="onAfterPopoverLeave"
|
|
297
|
+
>
|
|
298
|
+
<div
|
|
299
|
+
v-if="isOpen"
|
|
300
|
+
class="fixed z-9999"
|
|
301
|
+
:style="{
|
|
302
|
+
top: popoverCoords.top + 'px',
|
|
303
|
+
left: popoverCoords.right - popoverWidth - (popoverCoords.right - popoverCoords.left) + 'px',
|
|
304
|
+
}"
|
|
305
|
+
>
|
|
306
|
+
<div
|
|
307
|
+
ref="popoverPanelRef"
|
|
308
|
+
class="bg-white border border-blue-500 rounded-md p-4 shadow-lg flex flex-row justify-between items-start gap-3"
|
|
309
|
+
:style="{
|
|
310
|
+
width: popoverWidth + 'px',
|
|
311
|
+
minHeight: popoverHeight + 'px',
|
|
312
|
+
}"
|
|
313
|
+
@click.stop
|
|
314
|
+
@focusout="onPanelFocusOut"
|
|
315
|
+
>
|
|
316
|
+
<div class="flex flex-col gap-2">
|
|
317
|
+
<div
|
|
318
|
+
v-for="option in options"
|
|
319
|
+
:key="option.value"
|
|
320
|
+
@click="
|
|
321
|
+
(e) => {
|
|
322
|
+
if ((e.target as HTMLElement).tagName !== 'INPUT') {
|
|
323
|
+
handleOptionClick(option.value)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
"
|
|
327
|
+
class="cursor-pointer"
|
|
328
|
+
>
|
|
329
|
+
<FdsRadio
|
|
330
|
+
v-model="selectedOption"
|
|
331
|
+
:id="`tree-popover-${props.nodeId}-${option.value}`"
|
|
332
|
+
:name="`tree-popover-${props.nodeId}`"
|
|
333
|
+
:value="option.value"
|
|
334
|
+
@blur="closePopover"
|
|
335
|
+
:label="option.label"
|
|
336
|
+
/>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
<FdsButtonIcon
|
|
340
|
+
icon="cross"
|
|
341
|
+
id="tree-popover-close-button"
|
|
342
|
+
:size="24"
|
|
343
|
+
@click="closePopover()"
|
|
344
|
+
class="fill-blue-500"
|
|
345
|
+
ariaLabel="Stäng"
|
|
346
|
+
/>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
</Transition>
|
|
350
|
+
<!-- </teleport> -->
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
|
|
355
|
+
<div v-if="expandedNodes.has(props.nodeId)">
|
|
356
|
+
<TreeNode
|
|
357
|
+
v-for="child in filteredNodes"
|
|
358
|
+
:key="child.nodeId"
|
|
359
|
+
:nodes="child.children || []"
|
|
360
|
+
:title="getTitleFromProperties(child, props.titleTemplate)"
|
|
361
|
+
:nodeId="child.nodeId"
|
|
362
|
+
:data="child.data"
|
|
363
|
+
:depth="props.depth + 1"
|
|
364
|
+
:indentation="props.indentation"
|
|
365
|
+
:nodeExpandIcon="props.nodeExpandIcon"
|
|
366
|
+
:nodeCollapseIcon="props.nodeCollapseIcon"
|
|
367
|
+
:showNodeDescription="showNodeDescription"
|
|
368
|
+
:showChildrenCount="showChildrenCount"
|
|
369
|
+
:expandChildrenOnSelect="expandChildrenOnSelect"
|
|
370
|
+
:showIndeterminate="showIndeterminate"
|
|
371
|
+
:showIndeterminateOnlyOnChildrenSelection="showIndeterminateOnlyOnChildrenSelection"
|
|
372
|
+
:expandChildrenOnParentCheck="expandChildrenOnParentCheck"
|
|
373
|
+
:expandAllChildrenOnParentCheck="expandAllChildrenOnParentCheck"
|
|
374
|
+
:searchEnabled="searchEnabled"
|
|
375
|
+
:searchExpandNodes="searchExpandNodes"
|
|
376
|
+
:searchMatchParams="searchMatchParams"
|
|
377
|
+
:searchHighlighting="searchHighlighting"
|
|
378
|
+
:titleTemplate="props.titleTemplate"
|
|
379
|
+
:popoverLabels="props.popoverLabels"
|
|
380
|
+
/>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
</template>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { FdsIconName } from '@/components/FdsIcon/types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single node in the tree structure
|
|
5
|
+
* @template T - The type of data associated with the node
|
|
6
|
+
*/
|
|
7
|
+
export interface FdsTreeNode<T = Record<string, unknown>> {
|
|
8
|
+
/** Unique identifier for the node */
|
|
9
|
+
nodeId: string
|
|
10
|
+
/** Display title for the node */
|
|
11
|
+
title?: string
|
|
12
|
+
/** Child nodes of this node */
|
|
13
|
+
children?: FdsTreeNode<T>[]
|
|
14
|
+
/** Optional data object associated with the node */
|
|
15
|
+
data?: T
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Array of tree nodes
|
|
20
|
+
*/
|
|
21
|
+
export type FdsTreeNodeArray = FdsTreeNode<Record<string, unknown>>[]
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Single tree node item
|
|
25
|
+
*/
|
|
26
|
+
export type FdsTreeNodeItem = FdsTreeNode<Record<string, unknown>>
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Minimal node shape used for selected nodes array
|
|
30
|
+
*/
|
|
31
|
+
export type FdsNodeShape<T = Record<string, unknown>> = Pick<FdsTreeNode<T>, 'nodeId' | 'title' | 'data' | 'children'>
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Styles for the tree view
|
|
35
|
+
*/
|
|
36
|
+
export interface FdsTreeViewStyles {
|
|
37
|
+
/** Styles for the outer container */
|
|
38
|
+
container?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Props for the FdsTreeView component
|
|
43
|
+
* @template T - The type of data associated with tree nodes
|
|
44
|
+
*/
|
|
45
|
+
export interface FdsTreeViewProps<T = Record<string, unknown>> {
|
|
46
|
+
/** The tree data structure containing nodes and their children */
|
|
47
|
+
nodes: FdsTreeNode<T>[]
|
|
48
|
+
/** The current depth level in the tree (used internally for indentation) */
|
|
49
|
+
depth?: number
|
|
50
|
+
/** Icon name to display when a node is collapsed */
|
|
51
|
+
nodeExpandIcon: FdsIconName
|
|
52
|
+
/** Icon name to display when a node is expanded */
|
|
53
|
+
nodeCollapseIcon: FdsIconName
|
|
54
|
+
/** Number of pixels to indent each level of the tree */
|
|
55
|
+
indentation: number
|
|
56
|
+
/** Unique identifier for the current node */
|
|
57
|
+
nodeId: string
|
|
58
|
+
/** Optional data object associated with the node */
|
|
59
|
+
data?: T
|
|
60
|
+
/** Display title for the node */
|
|
61
|
+
title?: string
|
|
62
|
+
/** Show the node description (nodeId) below the title */
|
|
63
|
+
showNodeDescription?: boolean
|
|
64
|
+
/** Show the count of children next to the node title */
|
|
65
|
+
showChildrenCount?: boolean
|
|
66
|
+
/** Expand children when a node is selected */
|
|
67
|
+
expandChildrenOnSelect?: boolean
|
|
68
|
+
/** Show indeterminate state for partially selected nodes */
|
|
69
|
+
showIndeterminate?: boolean
|
|
70
|
+
/** Only show indeterminate when parent is not selected but children are */
|
|
71
|
+
showIndeterminateOnlyOnChildrenSelection?: boolean
|
|
72
|
+
/** Expand children when parent is checked */
|
|
73
|
+
expandChildrenOnParentCheck?: boolean
|
|
74
|
+
/** Expand all children recursively when parent is checked */
|
|
75
|
+
expandAllChildrenOnParentCheck?: boolean
|
|
76
|
+
/** Enable horizontal scroll for the tree view */
|
|
77
|
+
horizontalScroll?: boolean
|
|
78
|
+
/** Show the count of nodes matching the search term */
|
|
79
|
+
popoverLabels?: {
|
|
80
|
+
parentAndChildren: string
|
|
81
|
+
parent: string
|
|
82
|
+
}
|
|
83
|
+
/** Styles for the tree view */
|
|
84
|
+
style?: FdsTreeViewStyles
|
|
85
|
+
/** Enable search functionality */
|
|
86
|
+
searchEnabled?: boolean
|
|
87
|
+
/** Label for the search input */
|
|
88
|
+
searchLabel?: string
|
|
89
|
+
/** Parameters to match when searching -
|
|
90
|
+
* Defaults to ['title', 'nodeId']
|
|
91
|
+
* */
|
|
92
|
+
searchMatchParams?: string[]
|
|
93
|
+
/** The length of the search before it starts filtering nodes */
|
|
94
|
+
searchInputTriggerLength?: number
|
|
95
|
+
/** Expand nodes automatically when searching */
|
|
96
|
+
searchExpandNodes?: boolean
|
|
97
|
+
/** Highlight (bold text) the search term in the node title and nodeId */
|
|
98
|
+
searchHighlighting?: boolean
|
|
99
|
+
|
|
100
|
+
/** Title for the search result no matches */
|
|
101
|
+
searchResultNoMatchesTitle?: string
|
|
102
|
+
/** Body for the search result no matches */
|
|
103
|
+
searchResultNoMatchesBody?: string
|
|
104
|
+
/** Send a string with ${count} to display the count of nodes matching the search term
|
|
105
|
+
* Example: 'Found ${filteredNodes} of ${totalNodes} organizations'
|
|
106
|
+
*/
|
|
107
|
+
searchCountTemplate?: string
|
|
108
|
+
/** Send a string with ${count} to display the count of nodes matching the search term
|
|
109
|
+
* Example: '${totalNodes} organizations'
|
|
110
|
+
*/
|
|
111
|
+
searchCountTemplateUnfiltered?: string
|
|
112
|
+
/** Template for the node title - You can pass in a template string with '${title} (${nodeId})'
|
|
113
|
+
* for example to display the title and nodeId in the node title
|
|
114
|
+
*/
|
|
115
|
+
titleTemplate?: string
|
|
116
|
+
|
|
117
|
+
/** Get the height of the search container */
|
|
118
|
+
getSearchContainerHeight?: () => number | undefined
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Options for tree state configuration
|
|
123
|
+
* Picks relevant properties from FdsTreeViewProps
|
|
124
|
+
*/
|
|
125
|
+
export type TreeStateOptions = Pick<
|
|
126
|
+
FdsTreeViewProps,
|
|
127
|
+
| 'expandChildrenOnParentCheck'
|
|
128
|
+
| 'expandAllChildrenOnParentCheck'
|
|
129
|
+
| 'showIndeterminateOnlyOnChildrenSelection'
|
|
130
|
+
| 'searchExpandNodes'
|
|
131
|
+
| 'titleTemplate'
|
|
132
|
+
>
|
|
133
|
+
|
|
134
|
+
/** Wrapper props used by FdsTreeView.vue */
|
|
135
|
+
export type WrapperProps<T = Record<string, unknown>> = Omit<
|
|
136
|
+
FdsTreeViewProps<T>,
|
|
137
|
+
'nodes' | 'depth' | 'data' | 'nodeId' | 'title'
|
|
138
|
+
> & {
|
|
139
|
+
data: FdsTreeNode<T>
|
|
140
|
+
selectedNodes?: FdsNodeShape<T>[]
|
|
141
|
+
}
|