@bethinkpl/design-system 26.15.1 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +9 -0
- package/dist/RadioButton-BWi6jLxx.js +63 -0
- package/dist/RadioButton-BWi6jLxx.js.map +1 -0
- package/dist/RadioButton-DSmKwvPr.js +63 -0
- package/dist/RadioButton-DSmKwvPr.js.map +1 -0
- package/dist/design-system.js +266 -0
- package/dist/design-system.js.map +1 -0
- package/dist/design-system.umd.cjs +18 -18
- package/dist/design-system.umd.cjs.map +1 -1
- package/dist/index-BzPDEKft.js +24356 -0
- package/dist/index-BzPDEKft.js.map +1 -0
- package/dist/index-Oq81NaeJ.js +1388 -0
- package/dist/index-Oq81NaeJ.js.map +1 -0
- package/dist/index-UMXgzRbZ.js +24356 -0
- package/dist/index-UMXgzRbZ.js.map +1 -0
- package/dist/lib/js/components/Banner/Banner.consts.d.ts +4 -4
- package/dist/lib/js/components/Banner/Banner.vue.d.ts +49 -1824
- package/dist/lib/js/components/Buttons/Button/Button.vue.d.ts +41 -443
- package/dist/lib/js/components/Buttons/HelpButton/HelpButton.vue.d.ts +40 -0
- package/dist/lib/js/components/Buttons/HelpButton/index.d.ts +3 -0
- package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +77 -427
- package/dist/lib/js/components/Cards/Card/Card.consts.d.ts +5 -0
- package/dist/lib/js/components/Cards/Card/Card.vue.d.ts +52 -175
- package/dist/lib/js/components/Cards/Card/index.d.ts +1 -0
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +116 -154
- package/dist/lib/js/components/Chip/Chip.vue.d.ts +79 -430
- package/dist/lib/js/components/DatePickers/DateBox/DateBox.vue.d.ts +2 -1
- package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +4 -2
- package/dist/lib/js/components/DatePickers/DateRangePicker/DateRangePicker.vue.d.ts +2 -1
- package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +507 -1557
- package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +1 -0
- package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +77 -426
- package/dist/lib/js/components/Drawer/DrawerTile/DrawerTile.vue.d.ts +1 -0
- package/dist/lib/js/components/Form/Checkbox/Checkbox.vue.d.ts +1 -0
- package/dist/lib/js/components/Form/FormField/FormField.consts.d.ts +9 -0
- package/dist/lib/js/components/Form/FormField/FormField.stories.shared.d.ts +5 -0
- package/dist/lib/js/components/Form/FormField/FormField.types.d.ts +21 -0
- package/dist/lib/js/components/Form/FormField/FormField.utils.d.ts +11 -0
- package/dist/lib/js/components/Form/FormField/FormField.vue.d.ts +20 -0
- package/dist/lib/js/components/Form/FormField/FormFieldMessage/FormFieldMessage.vue.d.ts +30 -0
- package/dist/lib/js/components/Form/FormField/FormFieldMessage/index.d.ts +3 -0
- package/dist/lib/js/components/Form/FormField/index.d.ts +5 -0
- package/dist/lib/js/components/Form/InputField/InputField.types.d.ts +13 -0
- package/dist/lib/js/components/Form/InputField/InputField.vue.d.ts +78 -0
- package/dist/lib/js/components/Form/InputField/index.d.ts +3 -0
- package/dist/lib/js/components/Form/InputField/useInputFieldWithinForm.d.ts +8 -0
- package/dist/lib/js/components/Form/PasswordField/PasswordField.vue.d.ts +76 -0
- package/dist/lib/js/components/Form/PasswordField/index.d.ts +3 -0
- package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +1 -0
- package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +77 -426
- package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +76 -426
- package/dist/lib/js/components/Icons/FeatureIcon/FeatureIcon.consts.d.ts +17 -11
- package/dist/lib/js/components/Icons/FeatureIcon/FeatureIcon.vue.d.ts +22 -138
- package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +1 -0
- package/dist/lib/js/components/Modal/Modal.vue.d.ts +1 -0
- package/dist/lib/js/components/Modals/Modal/Modal.consts.d.ts +8 -4
- package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +281 -1093
- package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +288 -1100
- package/dist/lib/js/components/Outline/OutlineItem/OutlineItem.vue.d.ts +1 -0
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +78 -426
- package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +2 -1
- package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +1 -0
- package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +6 -4
- package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +4 -2
- package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +1 -0
- package/dist/lib/js/components/SelectList/SelectListItemTile/SelectListItemTile.vue.d.ts +1 -0
- package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +1 -0
- package/dist/lib/js/components/SelectionTile/SelectionTile.vue.d.ts +3 -0
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +1 -0
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +1 -0
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +262 -1002
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +268 -1008
- package/dist/lib/js/components/Switch/Switch.vue.d.ts +1 -0
- package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +104 -1806
- package/dist/lib/js/components/Tile/Tile.vue.d.ts +1 -0
- package/dist/lib/js/components/Toast/Toast.vue.d.ts +190 -581
- package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +1 -0
- package/dist/lib/js/icons/fontawesome.d.ts +1 -0
- package/dist/lib/js/index.d.ts +10 -1
- package/dist/lib/js/tests/helpers.d.ts +1 -0
- package/dist/pl-C3BEVRTZ.js +91 -0
- package/dist/pl-C3BEVRTZ.js.map +1 -0
- package/docs/assets/{AccessStatus-plchnY0B.js → AccessStatus-DGd8XBwr.js} +1 -1
- package/docs/assets/{AccessStatus.stories-DIIoog2Q.js → AccessStatus.stories-BUpfD_Uw.js} +1 -1
- package/docs/assets/Avatar-DJEZDpOI.js +1 -0
- package/docs/assets/{Avatar.stories-9Vth29zT.js → Avatar.stories-D40fYcFF.js} +1 -1
- package/docs/assets/{Badge-BbvNKG41.js → Badge-B8eFbzRx.js} +1 -1
- package/docs/assets/{Badge.stories-CKPGT_pt.js → Badge.stories-DxdwaS-k.js} +3 -3
- package/docs/assets/{BadgeScore-BOOWTi6N.js → BadgeScore-ByouU1Eu.js} +1 -1
- package/docs/assets/{BadgeScore.stories-ERFMPhhE.js → BadgeScore.stories-DsodV82W.js} +1 -1
- package/docs/assets/Banner-D5riYdGJ.js +1 -0
- package/docs/assets/Banner.stories-Ch0_NPk4.js +64 -0
- package/docs/assets/BasicRichListItem-NMNh0Xfo.js +1 -0
- package/docs/assets/{BasicRichListItem.stories-BJZo9YF9.js → BasicRichListItem.stories-Gu9n5wvW.js} +2 -2
- package/docs/assets/{BlockadeStatus-D1j0ZWIW.js → BlockadeStatus-Dqr_LSfC.js} +1 -1
- package/docs/assets/{BlockedeStatus.stories-BKi05Ndl.js → BlockedeStatus.stories-BKblKF33.js} +1 -1
- package/docs/assets/Button-XuK8IxnR.js +1 -0
- package/docs/assets/{Button.stories-Da2LsOLk.js → Button.stories-UiGEsaro.js} +5 -3
- package/docs/assets/Card-BhK1CiCP.js +1 -0
- package/docs/assets/Card.stories-BfWbSV_u.js +33 -0
- package/docs/assets/CardExpandable-CPuSx_lW.js +1 -0
- package/docs/assets/{CardExpandable.stories-DtC5egGK.js → CardExpandable.stories-mHnNt6zg.js} +1 -1
- package/docs/assets/Checkbox-g1Bvy8z-.js +1 -0
- package/docs/assets/{Checkbox.stories-BUIzgcCC.js → Checkbox.stories-DdJRLzJy.js} +1 -1
- package/docs/assets/{Chip-BJcjfD8j.js → Chip-CGm2pLPD.js} +1 -1
- package/docs/assets/{Chip.stories-Dgmetn8m.js → Chip.stories-CnHjkDSI.js} +1 -1
- package/docs/assets/Color-ERTF36HU-8BveRk6J.js +1 -0
- package/docs/assets/{Colors.stories-BrNisWwH.js → Colors.stories-BtNgjWxi.js} +1 -1
- package/docs/assets/{ColorsThemes.stories-DvZl0m40.js → ColorsThemes.stories-Ct0Ai41o.js} +1 -1
- package/docs/assets/{ColorsTokensLms.stories-D3nA1ro1.js → ColorsTokensLms.stories-BP-WMJrS.js} +1 -1
- package/docs/assets/{ColorsTokensPrimaryBodywork.stories-w4A7RjpQ.js → ColorsTokensPrimaryBodywork.stories-zdX-tf4x.js} +1 -1
- package/docs/assets/{ColorsTokensPrimaryWnl.stories-CncgXEG5.js → ColorsTokensPrimaryWnl.stories-DFVUj_99.js} +1 -1
- package/docs/assets/{CounterToggle-DKRrZ9t2.js → CounterToggle-B9hjjWpv.js} +1 -1
- package/docs/assets/{CounterToggle.stories-DEP60zRp.js → CounterToggle.stories-BtS63BEz.js} +1 -1
- package/docs/assets/{DateBox.stories-y5_2vs0g.js → DateBox.stories-B7PTVLxc.js} +3 -3
- package/docs/assets/{DatePicker-QHo-i7qh.js → DatePicker-70Dj0lsn.js} +1 -1
- package/docs/assets/{DatePicker.stories-4hPgpb1-.js → DatePicker.stories-DZN51CwX.js} +1 -1
- package/docs/assets/{DateRangePicker-B0NAwdsr.js → DateRangePicker-D5bqKMMk.js} +1 -1
- package/docs/assets/{DateRangePicker.stories-BXQLC6L-.js → DateRangePicker.stories-WhCXoUeh.js} +1 -1
- package/docs/assets/{Divider-9o-i_zKL.js → Divider-NOTDPuJ1.js} +1 -1
- package/docs/assets/{Divider.stories-IQKEznYT.js → Divider.stories-Cjyx7utt.js} +1 -1
- package/docs/assets/{DocsRenderer-CFRXHY34-rC6r6xBG.js → DocsRenderer-CFRXHY34-BThTLMHt.js} +72 -72
- package/docs/assets/{Drawer-ClrSDwUZ.js → Drawer-CrAn35Yo.js} +1 -1
- package/docs/assets/{Drawer.stories-DR-CXra3.js → Drawer.stories-iInS0JV5.js} +1 -1
- package/docs/assets/{DrawerContent-D6Bl5GA-.js → DrawerContent-DAIzyQNz.js} +1 -1
- package/docs/assets/{DrawerContent.stories-BR11egKi.js → DrawerContent.stories-CBpbbVk_.js} +1 -1
- package/docs/assets/{DrawerDivider-DMhjaSPk.js → DrawerDivider-CKRXkKRz.js} +1 -1
- package/docs/assets/{DrawerDivider.stories-DdcVRbtO.js → DrawerDivider.stories-iQ2J_ExP.js} +1 -1
- package/docs/assets/DrawerHeader-DPBlervR.js +1 -0
- package/docs/assets/{DrawerHeader.stories-DnPlkGmI.js → DrawerHeader.stories-ugFv_siA.js} +1 -1
- package/docs/assets/{DrawerListItem-dizQZUbe.js → DrawerListItem-ClOcwiVc.js} +1 -1
- package/docs/assets/{DrawerListItem.stories-pVTEuckG.js → DrawerListItem.stories-BMZ35_qS.js} +1 -1
- package/docs/assets/{DrawerListItemGroup-B5XadRVV.js → DrawerListItemGroup-SEWltKLJ.js} +1 -1
- package/docs/assets/{DrawerListItemGroup.stories-pOGG952w.js → DrawerListItemGroup.stories-Bn2TyQLH.js} +1 -1
- package/docs/assets/DrawerSection-ByJjEPPu.js +1 -0
- package/docs/assets/{DrawerSection.stories-tQT_zWBt.js → DrawerSection.stories-DuLphbcs.js} +1 -1
- package/docs/assets/DrawerTile-BGQvQQSp.js +1 -0
- package/docs/assets/DrawerTile.stories-DCe2L4Tv.js +10 -0
- package/docs/assets/Dropdown-Bdrd2ZIh.js +1 -0
- package/docs/assets/{Dropdown.stories-DLo-4_G3.js → Dropdown.stories-DnkREwa1.js} +2 -2
- package/docs/assets/FeatureIcon-DY5WvpPf.js +1 -0
- package/docs/assets/{FeatureIcon.stories-H_yUD4i4.js → FeatureIcon.stories-BqYqiSzM.js} +1 -1
- package/docs/assets/FormField-BjLFip7T.js +1 -0
- package/docs/assets/FormField.stories-DY8Mz4YE.js +40 -0
- package/docs/assets/FormField.stories.shared-3_36NKi_.js +1 -0
- package/docs/assets/FormFieldMessage-B4Oy2QBT.js +1 -0
- package/docs/assets/FormFieldMessage.stories-BD7JfJNj.js +32 -0
- package/docs/assets/GroupRichListItem-CHiSrcou.js +1 -0
- package/docs/assets/{GroupRichListItem.stories-C25AujXP.js → GroupRichListItem.stories-C3EubvlY.js} +1 -1
- package/docs/assets/HelpButton-BStTtLsz.js +1 -0
- package/docs/assets/HelpButton.stories-C3-CU20F.js +17 -0
- package/docs/assets/Icon-DUeXRUm6.js +761 -0
- package/docs/assets/{Icon.stories-BhnUVRrV.js → Icon.stories-ClzUno-E.js} +1 -1
- package/docs/assets/IconButton-Cn83Zk5-.js +1 -0
- package/docs/assets/{IconButton.stories-B8QjmTyV.js → IconButton.stories-CwZts8kF.js} +6 -6
- package/docs/assets/{IconText-CKJ4jGzm.js → IconText-Colreg4i.js} +1 -1
- package/docs/assets/{IconText.stories-B5zjHqug.js → IconText.stories-DSZffl3k.js} +1 -1
- package/docs/assets/{Image-Dbv2u4ta.js → Image-B7PRENWe.js} +1 -1
- package/docs/assets/{Image.stories-CUWPBT5K.js → Image.stories-DkYrm30P.js} +1 -1
- package/docs/assets/InputField-CplPTgjC.js +5 -0
- package/docs/assets/InputField.stories-K675XZL5.js +44 -0
- package/docs/assets/{ItemsList-CJTCYbgI.js → ItemsList-nTRSgJDP.js} +1 -1
- package/docs/assets/{LoadingBar-Dc_eLNsl.js → LoadingBar-DGNrwKu4.js} +1 -1
- package/docs/assets/{LoadingBar.stories-DWH4VmcD.js → LoadingBar.stories-owR_6Oqy.js} +1 -1
- package/docs/assets/Modal-ByQBkOMU.js +1 -0
- package/docs/assets/{Modal.stories-0zzyLX_Z.js → Modal.stories-DlxDxfN1.js} +1 -1
- package/docs/assets/{ModalDialog-BuO78uuh.js → ModalDialog-Cr21J58H.js} +1 -1
- package/docs/assets/{ModalDialog.stories-lBI09xqp.js → ModalDialog.stories-DP4FjijI.js} +1 -1
- package/docs/assets/{NumberInCircle-DnPE2szs.js → NumberInCircle-CE28_Nsz.js} +1 -1
- package/docs/assets/{NumberInCircle.stories-Tn0v6S_I.js → NumberInCircle.stories-DFdUVSKM.js} +1 -1
- package/docs/assets/OutlineDivider-DJ9pnpJN.js +1 -0
- package/docs/assets/{OutlineDivider.stories-D9Hzkdbe.js → OutlineDivider.stories-Dzpei9KR.js} +1 -1
- package/docs/assets/{OutlineItem-1BOyMbS2.js → OutlineItem-CApzlES7.js} +1 -1
- package/docs/assets/{OutlineItem.stories-DZ_RXCGO.js → OutlineItem.stories-DtEAJjzy.js} +1 -1
- package/docs/assets/{OutlineSectionHeader-LGOAi424.js → OutlineSectionHeader-CSNr7XVB.js} +1 -1
- package/docs/assets/{OutlineSectionHeader.stories-PPIsaHhR.js → OutlineSectionHeader.stories-CuJwkOKg.js} +1 -1
- package/docs/assets/OverlayHeader-B5ajrI4B.js +1 -0
- package/docs/assets/{OverlayHeader.stories-D0TRoa1n.js → OverlayHeader.stories-Zed9WXER.js} +2 -2
- package/docs/assets/{PageHeader-DkHlb7_P.js → PageHeader-Cy-UHuRb.js} +1 -1
- package/docs/assets/{PageHeader.stories-WThxfLse.js → PageHeader.stories-DlW4dler.js} +1 -1
- package/docs/assets/Pagination-D34dUtsQ.js +1 -0
- package/docs/assets/{Pagination.stories-CL9tb6Sx.js → Pagination.stories-IDi5nqa_.js} +2 -2
- package/docs/assets/PasswordField-Bkc6j8ri.js +1 -0
- package/docs/assets/PasswordField.stories-CklmsmJF.js +42 -0
- package/docs/assets/{PopOver-BDVCOkO6.js → PopOver-DVj1_TNg.js} +1 -1
- package/docs/assets/{PopOver.stories-CmDQPumC.js → PopOver.stories-BljOgM3Z.js} +2 -2
- package/docs/assets/{ProgressBar-q_I44DQc.js → ProgressBar-D2hkMeQ0.js} +1 -1
- package/docs/assets/{ProgressBar.stories-Df10tpd-.js → ProgressBar.stories-BDHI6-tO.js} +1 -1
- package/docs/assets/{ProgressDonutChart-DP55sH2Q.js → ProgressDonutChart-CBO-vy-E.js} +1 -1
- package/docs/assets/{ProgressDonutChart.stories-CXJhJ1AH.js → ProgressDonutChart.stories-CGwlVICI.js} +1 -1
- package/docs/assets/RadioButton-Bd-D-2PY.js +1 -0
- package/docs/assets/{RadioButton.stories-NVFxjqN4.js → RadioButton.stories-BkCwnbIp.js} +1 -1
- package/docs/assets/{RichListItem.stories-B3NGpkHT.js → RichListItem.stories-Bls_aY12.js} +2 -2
- package/docs/assets/SectionHeader-isKXGfjn.js +1 -0
- package/docs/assets/{SectionHeader.stories-CTANEOdf.js → SectionHeader.stories-Bj3scOLc.js} +1 -1
- package/docs/assets/{SectionTitle-DLcFKzRH.js → SectionTitle-wTuJZZVS.js} +1 -1
- package/docs/assets/{SectionTitle.stories-Dybq4paM.js → SectionTitle.stories-Dr3KOvIl.js} +1 -1
- package/docs/assets/{SelectList-B323Y2el.js → SelectList-YMQ8rEMc.js} +1 -1
- package/docs/assets/{SelectList.stories-BCS6zdJ9.js → SelectList.stories-ETdEOJ81.js} +1 -1
- package/docs/assets/{SelectListItem-DfLqJR-_.js → SelectListItem-BqKhIPSO.js} +1 -1
- package/docs/assets/{SelectListItem.stories-m8BTHS53.js → SelectListItem.stories-ClyL-djS.js} +1 -1
- package/docs/assets/{SelectListItemDivider-lDLIwtP8.js → SelectListItemDivider-CTU7_4OL.js} +1 -1
- package/docs/assets/{SelectListItemDivider.stories-BZ6_HOBG.js → SelectListItemDivider.stories-rGpk0Yeg.js} +1 -1
- package/docs/assets/{SelectListItemTile-DzAuBa66.js → SelectListItemTile-BhOwBFIO.js} +1 -1
- package/docs/assets/SelectListItemTile.stories-BXFfuX9q.js +19 -0
- package/docs/assets/{SelectListItemToggle-DJ_P6PIB.js → SelectListItemToggle-C0lffqeC.js} +1 -1
- package/docs/assets/{SelectListItemToggle.stories-yej5J6y8.js → SelectListItemToggle.stories-D39XrmtN.js} +1 -2
- package/docs/assets/SelectListSectionTitle-B9Dj10G9.js +1 -0
- package/docs/assets/{SelectListSectionTitle.stories-NKPegok4.js → SelectListSectionTitle.stories-DCZ-Sq6v.js} +1 -1
- package/docs/assets/{SelectionControl-CwdtLuOD.js → SelectionControl-DIC2vtGo.js} +1 -1
- package/docs/assets/{SelectionTile-hjRK7Lwc.js → SelectionTile-D7fhj7-I.js} +2 -2
- package/docs/assets/{SelectionTile.stories-DRdGcDuJ.js → SelectionTile.stories-Cato0iSj.js} +1 -1
- package/docs/assets/{Skeleton-DhyJ4ZKG.js → Skeleton-D5xhZMQa.js} +5 -5
- package/docs/assets/{Skeleton.stories-CsZjBoj1.js → Skeleton.stories-ll-E-sPN.js} +1 -1
- package/docs/assets/SurveyQuestionOpenEnded-DDdPQe2b.js +1 -0
- package/docs/assets/{SurveyQuestionOpenEnded.stories-Is_s49TT.js → SurveyQuestionOpenEnded.stories-mHTUclXK.js} +1 -1
- package/docs/assets/SurveyQuestionScale-BKZbW5q7.js +1 -0
- package/docs/assets/{SurveyQuestionScale.stories-BqOjFThb.js → SurveyQuestionScale.stories-Cczg5QpY.js} +1 -1
- package/docs/assets/SurveyToggle-Sid2a-IO.js +1 -0
- package/docs/assets/{SurveyToggle.stories-DySS4Jzx.js → SurveyToggle.stories-Dv7PJARv.js} +1 -1
- package/docs/assets/Switch-B8xEwHO8.js +1 -0
- package/docs/assets/{Switch.stories-Bq6_6t39.js → Switch.stories-RbY8wA55.js} +1 -1
- package/docs/assets/{TabItem-Bn_qIbPX.js → TabItem-Ci3vrkRH.js} +1 -1
- package/docs/assets/{TabItem.stories-ZPYw1uH1.js → TabItem.stories-relncwaI.js} +1 -1
- package/docs/assets/{TextGroup-AUUBIFJZ.js → TextGroup-dzR19lzs.js} +1 -1
- package/docs/assets/{TextGroup.stories-CqwkdBAO.js → TextGroup.stories-bCLjp0Xb.js} +1 -1
- package/docs/assets/{ThreeColumnLayout-DXA1815_.js → ThreeColumnLayout-LVzDOKfj.js} +1 -1
- package/docs/assets/{ThreeColumnLayout.stories-BA08mTZ7.js → ThreeColumnLayout.stories-CkgbTH3p.js} +1 -1
- package/docs/assets/{Tile-3fvrXM7M.js → Tile-ByL6drhn.js} +1 -1
- package/docs/assets/{Tile.sb.shared-Crj50ugV.js → Tile.sb.shared-D3LxXPDs.js} +1 -1
- package/docs/assets/Tile.stories-BhXwnkKz.js +12 -0
- package/docs/assets/{Toast-CTbKhm1i.js → Toast-ukLuB2Qi.js} +1 -1
- package/docs/assets/{Toast.stories-hUEtnOQn.js → Toast.stories-D3PagUcH.js} +1 -1
- package/docs/assets/{ToggleButton-D-t1sDTL.js → ToggleButton-YUVnfx-x.js} +1 -1
- package/docs/assets/{ToggleButton.stories-CaAweKdC.js → ToggleButton.stories-C18YYEsJ.js} +1 -1
- package/docs/assets/{Tooltip-DZi9yXjr.js → Tooltip-BvaJ_K9_.js} +1 -1
- package/docs/assets/{Tooltip.stories-D-DHfToA.js → Tooltip.stories-o7f8wLv_.js} +4 -4
- package/docs/assets/{TypographyTokensLms.stories-CZpPPUwu.js → TypographyTokensLms.stories-Cm_y52b6.js} +1 -1
- package/docs/assets/{TypographyVariables.stories-B4Lg96R3.js → TypographyVariables.stories-DTHJ_1UO.js} +1 -1
- package/docs/assets/{Well-D1j9q3W3.js → Well-iUOt2HEx.js} +1 -1
- package/docs/assets/{Well.stories-wgg6f6S7.js → Well.stories-4VLIlu-l.js} +3 -3
- package/docs/assets/entry-preview-CAn2_StQ.js +1 -0
- package/docs/assets/{entry-preview-docs-Bz8Se46p.js → entry-preview-docs-Y_6rrjxM.js} +1 -1
- package/docs/assets/{iframe-CKOJ9wC7.js → iframe-D_RvUlhr.js} +18 -15
- package/docs/assets/index-BtMHnMz0.js +1 -0
- package/docs/assets/index-Cpsdq_ip.js +1 -0
- package/docs/assets/preview-B_G3dFbe.js +2 -0
- package/docs/assets/preview-vzvQxRBZ.js +64 -0
- package/docs/assets/string--hkylObx.js +1 -0
- package/docs/assets/vue-popper-m_ujT3wC.js +24 -0
- package/docs/assets/vue.esm-bundler-DcRN7CPI.js +36 -0
- package/docs/iframe.html +1 -1
- package/docs/index.json +1 -1
- package/docs/project.json +1 -1
- package/lib/js/components/Badge/Badge.vue +6 -5
- package/lib/js/components/Banner/Banner.consts.ts +5 -5
- package/lib/js/components/Banner/Banner.spec.ts +148 -0
- package/lib/js/components/Banner/Banner.stories.ts +13 -8
- package/lib/js/components/Banner/Banner.vue +215 -196
- package/lib/js/components/Buttons/Button/Button.spec.ts +18 -3
- package/lib/js/components/Buttons/Button/Button.stories.ts +6 -0
- package/lib/js/components/Buttons/Button/Button.vue +63 -114
- package/lib/js/components/Buttons/HelpButton/HelpButton.spec.ts +87 -0
- package/lib/js/components/Buttons/HelpButton/HelpButton.stories.ts +70 -0
- package/lib/js/components/Buttons/HelpButton/HelpButton.vue +52 -0
- package/lib/js/components/Buttons/HelpButton/index.ts +3 -0
- package/lib/js/components/Cards/Card/Card.consts.ts +7 -0
- package/lib/js/components/Cards/Card/Card.spec.ts +86 -41
- package/lib/js/components/Cards/Card/Card.stories.ts +21 -18
- package/lib/js/components/Cards/Card/Card.vue +128 -88
- package/lib/js/components/Cards/Card/index.ts +1 -0
- package/lib/js/components/Chip/Chip.spec.ts +3 -2
- package/lib/js/components/Chip/Chip.vue +0 -1
- package/lib/js/components/DatePickers/DateBox/DateBox.stories.ts +0 -3
- package/lib/js/components/Form/FormField/FormField.consts.ts +10 -0
- package/lib/js/components/Form/FormField/FormField.spec.ts +138 -0
- package/lib/js/components/Form/FormField/FormField.stories.shared.ts +53 -0
- package/lib/js/components/Form/FormField/FormField.stories.ts +81 -0
- package/lib/js/components/Form/FormField/FormField.types.ts +17 -0
- package/lib/js/components/Form/FormField/FormField.utils.ts +24 -0
- package/lib/js/components/Form/FormField/FormField.vue +192 -0
- package/lib/js/components/Form/FormField/FormFieldMessage/FormFieldMessage.spec.ts +53 -0
- package/lib/js/components/Form/FormField/FormFieldMessage/FormFieldMessage.stories.ts +74 -0
- package/lib/js/components/Form/FormField/FormFieldMessage/FormFieldMessage.vue +89 -0
- package/lib/js/components/Form/FormField/FormFieldMessage/index.ts +2 -0
- package/lib/js/components/Form/FormField/index.ts +6 -0
- package/lib/js/components/Form/InputField/InputField.spec.ts +274 -0
- package/lib/js/components/Form/InputField/InputField.stories.ts +98 -0
- package/lib/js/components/Form/InputField/InputField.types.ts +14 -0
- package/lib/js/components/Form/InputField/InputField.vue +175 -0
- package/lib/js/components/Form/InputField/index.ts +3 -0
- package/lib/js/components/Form/InputField/useInputFieldWithinForm.ts +54 -0
- package/lib/js/components/Form/PasswordField/PasswordField.spec.ts +73 -0
- package/lib/js/components/Form/PasswordField/PasswordField.stories.ts +88 -0
- package/lib/js/components/Form/PasswordField/PasswordField.vue +55 -0
- package/lib/js/components/Form/PasswordField/index.ts +3 -0
- package/lib/js/components/Icons/FeatureIcon/FeatureIcon.consts.ts +10 -2
- package/lib/js/components/Icons/FeatureIcon/FeatureIcon.spec.ts +18 -0
- package/lib/js/components/Icons/FeatureIcon/FeatureIcon.stories.ts +1 -1
- package/lib/js/components/Icons/FeatureIcon/FeatureIcon.vue +44 -58
- package/lib/js/components/Modals/Modal/Modal.consts.ts +8 -2
- package/lib/js/components/Modals/Modal/Modal.vue +12 -5
- package/lib/js/components/Modals/ModalDialog/ModalDialog.vue +2 -2
- package/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.stories.ts +0 -1
- package/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue +43 -47
- package/lib/js/components/TabItem/TabItem.spec.ts +0 -1
- package/lib/js/components/Toast/Toast.vue +0 -2
- package/lib/js/icons/fontawesome.ts +2 -0
- package/lib/js/index.ts +11 -1
- package/lib/js/styles/Borders/BorderSizes.stories.ts +1 -1
- package/lib/js/styles/ItemsList.vue +1 -1
- package/lib/js/tests/helpers.ts +5 -0
- package/package.json +13 -7
- package/tsconfig.base.json +1 -2
- package/tsconfig.build.json +8 -0
- package/tsconfig.json +1 -6
- package/vite.config.ts +11 -8
- package/docs/assets/Avatar-CM7iogZ3.js +0 -1
- package/docs/assets/Banner-DXAd9x-3.js +0 -1
- package/docs/assets/Banner.stories-BC2VxrMC.js +0 -62
- package/docs/assets/BasicRichListItem-quALUWxY.js +0 -1
- package/docs/assets/Button-C5dr6u6F.js +0 -1
- package/docs/assets/Card-KSW_Q55y.js +0 -1
- package/docs/assets/Card.stories-Bqmd77lg.js +0 -49
- package/docs/assets/CardExpandable-yMDr4_fF.js +0 -1
- package/docs/assets/Checkbox-DAOkXx1R.js +0 -1
- package/docs/assets/Color-ERTF36HU-DaHgyI5V.js +0 -1
- package/docs/assets/DrawerHeader-AkG6Jq7W.js +0 -1
- package/docs/assets/DrawerSection-HBM59yvF.js +0 -1
- package/docs/assets/DrawerTile-0-CB5w9j.js +0 -1
- package/docs/assets/DrawerTile.stories-6JDnzzyo.js +0 -10
- package/docs/assets/Dropdown-CYFZ3OvV.js +0 -1
- package/docs/assets/FeatureIcon-BoUhuGOr.js +0 -1
- package/docs/assets/GroupRichListItem-C_Gsy7fK.js +0 -1
- package/docs/assets/Icon-I3Cniv10.js +0 -761
- package/docs/assets/IconButton-BPKB5gT7.js +0 -1
- package/docs/assets/Modal-Cy1kzNhG.js +0 -1
- package/docs/assets/OutlineDivider-UaRb6wKt.js +0 -1
- package/docs/assets/OverlayHeader-u9AeOezr.js +0 -1
- package/docs/assets/Pagination-CgO9MoPY.js +0 -1
- package/docs/assets/RadioButton-DISpvFOt.js +0 -1
- package/docs/assets/SectionHeader-ByewlGaG.js +0 -1
- package/docs/assets/SelectListItemTile.stories-n2MJqr9U.js +0 -19
- package/docs/assets/SelectListSectionTitle-BFbrwNgw.js +0 -1
- package/docs/assets/SurveyQuestionOpenEnded-B_HbDRQs.js +0 -1
- package/docs/assets/SurveyQuestionScale-CiKDA0ax.js +0 -1
- package/docs/assets/SurveyToggle-CCF4WE7n.js +0 -1
- package/docs/assets/Switch-Du-uh84v.js +0 -1
- package/docs/assets/Tile.stories-0SQaiGz7.js +0 -12
- package/docs/assets/_commonjsHelpers-CDR5Xrri.js +0 -1
- package/docs/assets/entry-preview-lHccVHf5.js +0 -1
- package/docs/assets/index-0M4xY6Fw.js +0 -1
- package/docs/assets/index-Be4sB5Yj.js +0 -1
- package/docs/assets/preview-BIPjgpxe.js +0 -2
- package/docs/assets/preview-BQvHXGdy.js +0 -64
- package/docs/assets/string-B1AGRR5v.js +0 -1
- package/docs/assets/vue-popper-DoPHnofs.js +0 -24
- package/docs/assets/vue.esm-bundler-DD4BrEtS.js +0 -36
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import InputField from './InputField.vue';
|
|
4
|
+
import Icon, { ICONS } from '../../Icons/Icon';
|
|
5
|
+
import { ComputedRef, h, Ref } from 'vue';
|
|
6
|
+
import { FORM_FIELD_STATES } from '../FormField';
|
|
7
|
+
import { ComponentProps, ComponentSlots } from 'vue-component-type-helpers';
|
|
8
|
+
import { FormMeta, useForm } from 'vee-validate';
|
|
9
|
+
import { waitForExpectShort } from '../../../tests/helpers';
|
|
10
|
+
|
|
11
|
+
const fieldId = 'form-field-v-0';
|
|
12
|
+
const messageId = `${fieldId}-message`;
|
|
13
|
+
|
|
14
|
+
function setup({
|
|
15
|
+
props,
|
|
16
|
+
slots,
|
|
17
|
+
}: {
|
|
18
|
+
props?: ComponentProps<typeof InputField>;
|
|
19
|
+
slots?: ComponentSlots<typeof InputField>;
|
|
20
|
+
} = {}) {
|
|
21
|
+
return mount(InputField, {
|
|
22
|
+
props,
|
|
23
|
+
slots: {
|
|
24
|
+
action() {
|
|
25
|
+
return [];
|
|
26
|
+
},
|
|
27
|
+
...slots,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe('InputField', () => {
|
|
33
|
+
it('should render', () => {
|
|
34
|
+
const wrapper = setup({
|
|
35
|
+
props: {
|
|
36
|
+
label: 'Label',
|
|
37
|
+
messageText: 'Message text',
|
|
38
|
+
suffixText: 'Suffix text',
|
|
39
|
+
leftIcon: ICONS.FA_TAG,
|
|
40
|
+
},
|
|
41
|
+
slots: {
|
|
42
|
+
action: () => [h('button', { id: 'test-action' }, () => 'Action Button')],
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(wrapper.exists()).toBe(true);
|
|
47
|
+
expect(wrapper.find('.ds-inputField__suffixText').text()).toBe('Suffix text');
|
|
48
|
+
expect(wrapper.findComponent<typeof Icon>('.ds-inputField__leftIcon').props().icon).toEqual(
|
|
49
|
+
ICONS.FA_TAG,
|
|
50
|
+
);
|
|
51
|
+
expect(wrapper.find('#test-action').exists()).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should handle value updates', async () => {
|
|
55
|
+
const onUpdate = vi.fn();
|
|
56
|
+
const wrapper = setup({
|
|
57
|
+
props: {
|
|
58
|
+
label: 'Label',
|
|
59
|
+
modelValue: 'initial value',
|
|
60
|
+
'onUpdate:modelValue': onUpdate,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const input = wrapper.find<HTMLInputElement>('input');
|
|
65
|
+
expect(input.element.value).toBe('initial value');
|
|
66
|
+
|
|
67
|
+
await input.setValue('updated value');
|
|
68
|
+
|
|
69
|
+
expect(onUpdate).toHaveBeenCalledWith('updated value');
|
|
70
|
+
expect(input.element.value).toBe('updated value');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should render with accessible ids', () => {
|
|
74
|
+
const wrapper = setup({
|
|
75
|
+
props: {
|
|
76
|
+
label: 'Label',
|
|
77
|
+
messageText: 'Message text',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
expect(wrapper.exists()).toBe(true);
|
|
81
|
+
expect(wrapper.find('label').attributes('for')).toBe(fieldId);
|
|
82
|
+
|
|
83
|
+
const input = wrapper.find('input');
|
|
84
|
+
|
|
85
|
+
expect(input.attributes('id')).toBe(fieldId);
|
|
86
|
+
expect(input.attributes('aria-describedby')).toBe(messageId);
|
|
87
|
+
expect(wrapper.find(`#${messageId}`).exists()).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should pass inputProps to the input element', () => {
|
|
91
|
+
const inputProps = {
|
|
92
|
+
placeholder: 'Enter text',
|
|
93
|
+
disabled: true,
|
|
94
|
+
'aria-label': 'Input field',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const wrapper = setup({
|
|
98
|
+
props: {
|
|
99
|
+
label: 'Label',
|
|
100
|
+
inputProps,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const input = wrapper.find('input');
|
|
105
|
+
expect(input.attributes('placeholder')).toBe(inputProps.placeholder);
|
|
106
|
+
expect(input.attributes('disabled')).toBeDefined();
|
|
107
|
+
expect(input.attributes('aria-label')).toBe(inputProps['aria-label']);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it.each([
|
|
111
|
+
{
|
|
112
|
+
state: FORM_FIELD_STATES.DISABLED,
|
|
113
|
+
expectedClass: '-ds-disabled',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
state: FORM_FIELD_STATES.ERROR,
|
|
117
|
+
expectedClass: '-ds-error',
|
|
118
|
+
},
|
|
119
|
+
])('should handle state: $state', ({ state, expectedClass }) => {
|
|
120
|
+
const wrapper = setup({
|
|
121
|
+
props: {
|
|
122
|
+
state,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
expect(wrapper.find('.ds-inputField').classes()).toContain(expectedClass);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should make input disabled when state is DISABLED', () => {
|
|
129
|
+
const wrapper = setup({
|
|
130
|
+
props: {
|
|
131
|
+
state: FORM_FIELD_STATES.DISABLED,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
const input = wrapper.find('input');
|
|
135
|
+
expect(input.attributes('disabled')).toBeDefined();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe('with vee-validate', () => {
|
|
139
|
+
const fieldName = 'siema';
|
|
140
|
+
const initialValue = 'siemanko!';
|
|
141
|
+
function setupWithForm(props?: ComponentProps<typeof InputField>) {
|
|
142
|
+
let controlledValuesRef: Ref<{ siema: string }> | undefined;
|
|
143
|
+
let errorsRef: ComputedRef<Partial<Record<'siema', string | undefined>>> | undefined;
|
|
144
|
+
let metaRef: Ref<FormMeta<{ siema: string }>> | undefined;
|
|
145
|
+
|
|
146
|
+
const FormComponent = {
|
|
147
|
+
template: `
|
|
148
|
+
<form>
|
|
149
|
+
<InputField
|
|
150
|
+
v-bind="props"
|
|
151
|
+
:name="name"
|
|
152
|
+
/>
|
|
153
|
+
</form>
|
|
154
|
+
`,
|
|
155
|
+
components: { InputField },
|
|
156
|
+
setup() {
|
|
157
|
+
const { controlledValues, errors, meta } = useForm({
|
|
158
|
+
initialValues: {
|
|
159
|
+
[fieldName]: initialValue,
|
|
160
|
+
},
|
|
161
|
+
validationSchema: {
|
|
162
|
+
siema: (val: string) => (val.length < 5 ? 'Too short' : true),
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
controlledValuesRef = controlledValues;
|
|
167
|
+
errorsRef = errors;
|
|
168
|
+
metaRef = meta;
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
name: fieldName,
|
|
172
|
+
props,
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
wrapper: mount(FormComponent),
|
|
179
|
+
controlledValuesRef,
|
|
180
|
+
errorsRef,
|
|
181
|
+
metaRef,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
it('should bind input value with vee-validate form values', async () => {
|
|
186
|
+
const { wrapper, controlledValuesRef } = setupWithForm();
|
|
187
|
+
|
|
188
|
+
const input = wrapper.find('input');
|
|
189
|
+
|
|
190
|
+
expect(input.element.value).toBe(initialValue);
|
|
191
|
+
expect(controlledValuesRef?.value[fieldName]).toBe(initialValue);
|
|
192
|
+
|
|
193
|
+
const newValue = 'no cześć!';
|
|
194
|
+
await input.setValue(newValue);
|
|
195
|
+
|
|
196
|
+
expect(input.element.value).toBe(newValue);
|
|
197
|
+
expect(controlledValuesRef?.value[fieldName]).toBe(newValue);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('should call onBlur and mark form as touched on blur', async () => {
|
|
201
|
+
const onBlur = vi.fn();
|
|
202
|
+
const { wrapper, metaRef } = setupWithForm({
|
|
203
|
+
inputProps: {
|
|
204
|
+
onBlur,
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
expect(metaRef?.value.touched).toBe(false);
|
|
208
|
+
|
|
209
|
+
const input = wrapper.find('input');
|
|
210
|
+
await input.trigger('blur');
|
|
211
|
+
|
|
212
|
+
expect(onBlur).toHaveBeenCalled();
|
|
213
|
+
expect(metaRef?.value.touched).toBe(true);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('should call onInput and show error message', async () => {
|
|
217
|
+
const onInput = vi.fn();
|
|
218
|
+
const { wrapper, errorsRef } = setupWithForm({
|
|
219
|
+
inputProps: {
|
|
220
|
+
onInput,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const input = wrapper.find('input');
|
|
225
|
+
await input.setValue('test');
|
|
226
|
+
|
|
227
|
+
expect(onInput).toHaveBeenCalled();
|
|
228
|
+
|
|
229
|
+
await input.trigger('blur');
|
|
230
|
+
|
|
231
|
+
await waitForExpectShort(() => {
|
|
232
|
+
expect(errorsRef?.value?.siema).toBeDefined();
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
expect(wrapper.find('.ds-inputField').classes()).toContain('-ds-error');
|
|
236
|
+
expect(wrapper.find(`#${messageId}`).text()).toBe('Too short');
|
|
237
|
+
|
|
238
|
+
await input.setValue('valid value');
|
|
239
|
+
|
|
240
|
+
await waitForExpectShort(() => {
|
|
241
|
+
expect(errorsRef?.value?.siema).toBeUndefined();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('should throw an error if used outside of a form context', () => {
|
|
246
|
+
expect(() => {
|
|
247
|
+
setup({
|
|
248
|
+
props: {
|
|
249
|
+
name: 'siema',
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
}).toThrowError();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('overrides state and message on vee-validate form error', async () => {
|
|
256
|
+
const { wrapper, errorsRef } = setupWithForm({
|
|
257
|
+
state: FORM_FIELD_STATES.SUCCESS,
|
|
258
|
+
messageText: 'Success message',
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
const input = wrapper.find('input');
|
|
262
|
+
await input.setValue('test');
|
|
263
|
+
|
|
264
|
+
await input.trigger('blur');
|
|
265
|
+
|
|
266
|
+
await waitForExpectShort(() => {
|
|
267
|
+
expect(errorsRef?.value?.siema).toBeDefined();
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
expect(wrapper.find(`#${messageId}`).classes()).toContain('-ds-success');
|
|
271
|
+
expect(wrapper.find(`#${messageId}`).text()).toBe('Success message');
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import InputField from './InputField.vue';
|
|
3
|
+
import HelpButton from '../../Buttons/HelpButton/HelpButton.vue';
|
|
4
|
+
import Modal from '../../Modals/Modal';
|
|
5
|
+
import { ICONS } from '../../Icons/Icon';
|
|
6
|
+
import { args, argTypes } from '../FormField/FormField.stories.shared';
|
|
7
|
+
import { FORM_FIELD_STATES } from '../FormField/FormField.consts';
|
|
8
|
+
import { reactive, toRefs } from 'vue';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof InputField> = {
|
|
11
|
+
title: 'Components/Form/InputField',
|
|
12
|
+
component: InputField,
|
|
13
|
+
render: (args) => ({
|
|
14
|
+
components: { InputField, HelpButton, Modal },
|
|
15
|
+
setup() {
|
|
16
|
+
const { help, labelAside, message, fieldStatus, action, ...restRefs } = toRefs(args);
|
|
17
|
+
const props = reactive({ ...restRefs });
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
props,
|
|
21
|
+
labelAside,
|
|
22
|
+
fieldStatus,
|
|
23
|
+
message,
|
|
24
|
+
help,
|
|
25
|
+
action,
|
|
26
|
+
FORM_FIELD_STATES,
|
|
27
|
+
ICONS,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
data: () => ({
|
|
31
|
+
value: '',
|
|
32
|
+
}),
|
|
33
|
+
template: `<InputField v-bind="props" :left-icon="props.leftIcon ? ICONS[props.leftIcon] : null" v-model="value">
|
|
34
|
+
<template v-if="help" #help>
|
|
35
|
+
<HelpButton :is-disabled="props.state === FORM_FIELD_STATES.DISABLED" modal-title="Help modal title">
|
|
36
|
+
<template #modalContent>
|
|
37
|
+
Modal
|
|
38
|
+
</template>
|
|
39
|
+
</HelpButton>
|
|
40
|
+
</template>
|
|
41
|
+
<template #labelAside v-if="labelAside">
|
|
42
|
+
<div v-html="labelAside" />
|
|
43
|
+
</template>
|
|
44
|
+
<template #fieldStatus v-if="fieldStatus">
|
|
45
|
+
<div v-html="fieldStatus" />
|
|
46
|
+
</template>
|
|
47
|
+
<template #message v-if="message">
|
|
48
|
+
<div v-if="message" v-html="message" />
|
|
49
|
+
</template>
|
|
50
|
+
<template #action v-if="action">
|
|
51
|
+
<div v-html="action" />
|
|
52
|
+
</template>
|
|
53
|
+
</InputField>`,
|
|
54
|
+
}),
|
|
55
|
+
argTypes: {
|
|
56
|
+
...argTypes,
|
|
57
|
+
leftIcon: {
|
|
58
|
+
control: 'select',
|
|
59
|
+
options: [null, ...Object.keys(ICONS)],
|
|
60
|
+
},
|
|
61
|
+
suffixText: {
|
|
62
|
+
control: 'text',
|
|
63
|
+
},
|
|
64
|
+
action: {
|
|
65
|
+
control: 'text',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export default meta;
|
|
70
|
+
|
|
71
|
+
type Story = StoryObj<typeof InputField>;
|
|
72
|
+
|
|
73
|
+
export const Interactive: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
...args,
|
|
76
|
+
leftIcon: null,
|
|
77
|
+
suffixText: '%',
|
|
78
|
+
action: 'Action',
|
|
79
|
+
inputProps: {
|
|
80
|
+
placeholder: 'Placeholder',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
parameters: {
|
|
84
|
+
design: {
|
|
85
|
+
type: 'figma',
|
|
86
|
+
url: 'https://www.figma.com/design/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?node-id=13198-38645&t=BlkZV83eerbMSMyv-4',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const Error: Story = {
|
|
92
|
+
...Interactive,
|
|
93
|
+
args: {
|
|
94
|
+
...Interactive.args,
|
|
95
|
+
state: FORM_FIELD_STATES.ERROR,
|
|
96
|
+
messageText: 'Error message text',
|
|
97
|
+
},
|
|
98
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
import { FormFieldProps, FormFieldSlots } from '../FormField';
|
|
3
|
+
import { IconItem } from '../../Icons/Icon';
|
|
4
|
+
|
|
5
|
+
export interface InputFieldProps extends FormFieldProps {
|
|
6
|
+
inputProps?: InputHTMLAttributes;
|
|
7
|
+
leftIcon?: IconItem | null;
|
|
8
|
+
suffixText?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface InputFieldSlots extends Omit<FormFieldSlots, 'field'> {
|
|
13
|
+
action?: () => any;
|
|
14
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-field v-bind="formFieldProps">
|
|
3
|
+
<template #field="{ fieldId, messageId }">
|
|
4
|
+
<div
|
|
5
|
+
:class="[
|
|
6
|
+
'ds-inputField',
|
|
7
|
+
{
|
|
8
|
+
'-ds-error': formFieldProps.state === FORM_FIELD_STATES.ERROR,
|
|
9
|
+
'-ds-disabled': formFieldProps.state === FORM_FIELD_STATES.DISABLED,
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
<icon
|
|
14
|
+
v-if="leftIcon"
|
|
15
|
+
:icon="leftIcon"
|
|
16
|
+
class="ds-inputField__leftIcon"
|
|
17
|
+
:size="ICON_SIZES.X_SMALL"
|
|
18
|
+
/>
|
|
19
|
+
<input
|
|
20
|
+
v-bind="finalInputProps"
|
|
21
|
+
:id="fieldId"
|
|
22
|
+
v-model="value"
|
|
23
|
+
class="ds-inputField__input"
|
|
24
|
+
:aria-describedby="messageId"
|
|
25
|
+
/>
|
|
26
|
+
<div v-if="suffixText" class="ds-inputField__suffixText">
|
|
27
|
+
{{ suffixText }}
|
|
28
|
+
</div>
|
|
29
|
+
<slot name="action" />
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
<!-- begin: FormField slots -->
|
|
33
|
+
<template v-if="$slots.help" #help>
|
|
34
|
+
<slot name="help" />
|
|
35
|
+
</template>
|
|
36
|
+
<template v-if="$slots.labelAside" #labelAside>
|
|
37
|
+
<slot name="labelAside" />
|
|
38
|
+
</template>
|
|
39
|
+
<template v-if="$slots.message" #message="{ messageId }">
|
|
40
|
+
<slot name="message" :message-id="messageId" />
|
|
41
|
+
</template>
|
|
42
|
+
<template v-if="$slots.fieldStatus" #fieldStatus>
|
|
43
|
+
<slot name="fieldStatus" />
|
|
44
|
+
</template>
|
|
45
|
+
<!-- end: FormField slots -->
|
|
46
|
+
</form-field>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<style lang="scss" scoped>
|
|
50
|
+
@import '../../../../styles/settings/spacings';
|
|
51
|
+
@import '../../../../styles/settings/radiuses';
|
|
52
|
+
@import '../../../../styles/settings/borders';
|
|
53
|
+
@import '../../../../styles/settings/colors/tokens';
|
|
54
|
+
@import '../../../../styles/settings/typography/tokens';
|
|
55
|
+
@import '../../../../styles/settings/shadows';
|
|
56
|
+
|
|
57
|
+
.ds-inputField {
|
|
58
|
+
$root: &;
|
|
59
|
+
|
|
60
|
+
align-items: center;
|
|
61
|
+
align-self: stretch;
|
|
62
|
+
background: $color-default-background;
|
|
63
|
+
border: $border-xs solid $color-neutral-border-strong;
|
|
64
|
+
border-radius: $radius-s;
|
|
65
|
+
box-shadow: $shadow-inset-m;
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: $space-2xs;
|
|
68
|
+
height: 32px;
|
|
69
|
+
padding: 0 $space-2xs;
|
|
70
|
+
|
|
71
|
+
&:focus-within {
|
|
72
|
+
border-color: $color-primary-border;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.-ds-error:not(:focus-within) {
|
|
76
|
+
border-color: $color-danger-border;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:hover:not(.-ds-disabled) {
|
|
80
|
+
border-color: $color-neutral-border-strong-hovered;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&.-ds-disabled {
|
|
84
|
+
border-color: $color-neutral-border-strong-disabled;
|
|
85
|
+
box-shadow: none;
|
|
86
|
+
|
|
87
|
+
#{$root}__input {
|
|
88
|
+
color: $color-neutral-text-heavy-disabled;
|
|
89
|
+
|
|
90
|
+
&::placeholder {
|
|
91
|
+
color: $color-neutral-text-weak-disabled;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#{$root}__leftIcon {
|
|
96
|
+
color: $color-neutral-icon-weak-disabled;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&__input {
|
|
101
|
+
@include formText-s-default-regular;
|
|
102
|
+
|
|
103
|
+
background: transparent;
|
|
104
|
+
// hacky solution to override default browser styles for autofill
|
|
105
|
+
background-clip: text !important;
|
|
106
|
+
border: none;
|
|
107
|
+
color: $color-neutral-text-heavy;
|
|
108
|
+
flex: 1;
|
|
109
|
+
height: 100%;
|
|
110
|
+
// override default browser min-width
|
|
111
|
+
min-width: 0;
|
|
112
|
+
outline: none;
|
|
113
|
+
|
|
114
|
+
&::placeholder {
|
|
115
|
+
color: $color-neutral-text-weak;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&__leftIcon {
|
|
120
|
+
color: $color-neutral-icon-weak;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&__suffixText {
|
|
124
|
+
@include formText-s-default-regular;
|
|
125
|
+
|
|
126
|
+
color: $color-neutral-text;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
130
|
+
|
|
131
|
+
<script lang="ts" setup>
|
|
132
|
+
import { computed, InputHTMLAttributes } from 'vue';
|
|
133
|
+
import FormField, { FORM_FIELD_STATES, FormFieldProps } from '../FormField';
|
|
134
|
+
import Icon, { ICON_SIZES } from '../../Icons/Icon';
|
|
135
|
+
import { extractFormFieldProps } from '../FormField/FormField.utils';
|
|
136
|
+
import { InputFieldProps, InputFieldSlots } from './InputField.types';
|
|
137
|
+
import { useInputFieldWithinForm } from './useInputFieldWithinForm';
|
|
138
|
+
|
|
139
|
+
const { inputProps, leftIcon, suffixText, name, ...rest } = defineProps<InputFieldProps>();
|
|
140
|
+
defineSlots<InputFieldSlots>();
|
|
141
|
+
const modelValue = defineModel<string>();
|
|
142
|
+
|
|
143
|
+
const {
|
|
144
|
+
value,
|
|
145
|
+
errors,
|
|
146
|
+
onInput: onFormFieldInput,
|
|
147
|
+
onBlur: onFormFieldBlur,
|
|
148
|
+
} = useInputFieldWithinForm(() => name, modelValue);
|
|
149
|
+
|
|
150
|
+
const formFieldProps = computed<FormFieldProps>(() => {
|
|
151
|
+
// this is needed to avoid passing modelValue to FormField as prop
|
|
152
|
+
const extractedProps = extractFormFieldProps(rest);
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
...extractedProps,
|
|
156
|
+
messageText: extractedProps.messageText ?? errors.value[0],
|
|
157
|
+
state: extractedProps.state ?? (errors.value[0] ? FORM_FIELD_STATES.ERROR : undefined),
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const finalInputProps = computed<InputHTMLAttributes>(() => {
|
|
162
|
+
return {
|
|
163
|
+
disabled: formFieldProps.value.state === FORM_FIELD_STATES.DISABLED,
|
|
164
|
+
...inputProps,
|
|
165
|
+
onInput: (event: Event) => {
|
|
166
|
+
onFormFieldInput();
|
|
167
|
+
inputProps?.onInput?.(event);
|
|
168
|
+
},
|
|
169
|
+
onBlur: (event: FocusEvent) => {
|
|
170
|
+
onFormFieldBlur(event);
|
|
171
|
+
inputProps?.onBlur?.(event);
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { computed, inject, MaybeRefOrGetter, ref, Ref, toValue } from 'vue';
|
|
2
|
+
import { FormContextKey, useField } from 'vee-validate';
|
|
3
|
+
|
|
4
|
+
export function useInputFieldWithinForm(
|
|
5
|
+
name: MaybeRefOrGetter<string | undefined>,
|
|
6
|
+
modelValue: Ref<string | undefined>,
|
|
7
|
+
) {
|
|
8
|
+
const form = inject(FormContextKey, null);
|
|
9
|
+
const nameValue = toValue(name);
|
|
10
|
+
|
|
11
|
+
// this computed property was created only for type safety so we can use it with `useField`
|
|
12
|
+
const nameString = computed(() => {
|
|
13
|
+
const value = toValue(name);
|
|
14
|
+
|
|
15
|
+
if (value === undefined) {
|
|
16
|
+
throw new Error('fieldName is required');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return value;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (nameValue && !form) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`InputField with name "${nameValue}" must be used within a component that provides a FormContext, e.g. by using useForm()`,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const field = nameValue
|
|
29
|
+
? useField(nameString, undefined, {
|
|
30
|
+
validateOnValueUpdate: false,
|
|
31
|
+
})
|
|
32
|
+
: null;
|
|
33
|
+
|
|
34
|
+
const value = field ? field.value : modelValue;
|
|
35
|
+
const blurred = ref(false);
|
|
36
|
+
|
|
37
|
+
const onBlur = (event: Event) => {
|
|
38
|
+
field?.handleBlur(event, true);
|
|
39
|
+
blurred.value = true;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const onInput = () => {
|
|
43
|
+
if (blurred.value) {
|
|
44
|
+
field?.validate();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
onBlur,
|
|
50
|
+
onInput,
|
|
51
|
+
value,
|
|
52
|
+
errors: field?.errors ?? ref<Array<string>>([]),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { h } from 'vue';
|
|
4
|
+
import PasswordField from './PasswordField.vue';
|
|
5
|
+
|
|
6
|
+
const fieldId = 'form-field-v-0';
|
|
7
|
+
const messageId = `${fieldId}-message`;
|
|
8
|
+
|
|
9
|
+
describe('PasswordField', () => {
|
|
10
|
+
it('should switch between password and text input types', async () => {
|
|
11
|
+
const wrapper = mount(PasswordField);
|
|
12
|
+
|
|
13
|
+
expect(wrapper.exists()).toBe(true);
|
|
14
|
+
expect(wrapper.find('input').attributes('type')).toBe('password');
|
|
15
|
+
|
|
16
|
+
const toggleButton = wrapper.find('[data-test-id="password-toggle"]');
|
|
17
|
+
|
|
18
|
+
await toggleButton.trigger('click');
|
|
19
|
+
|
|
20
|
+
expect(wrapper.find('input').attributes('type')).toBe('text');
|
|
21
|
+
|
|
22
|
+
await toggleButton.trigger('click');
|
|
23
|
+
|
|
24
|
+
expect(wrapper.find('input').attributes('type')).toBe('password');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should render InputField and pass props', () => {
|
|
28
|
+
const wrapper = mount(PasswordField, {
|
|
29
|
+
props: {
|
|
30
|
+
label: 'Label',
|
|
31
|
+
messageText: 'Message text',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(wrapper.find('label').text()).toBe('Label');
|
|
36
|
+
expect(wrapper.find(`#${messageId}`).text()).toBe('Message text');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should render InputField with slots', () => {
|
|
40
|
+
const wrapper = mount(PasswordField, {
|
|
41
|
+
slots: {
|
|
42
|
+
labelAside: () => 'Label Aside',
|
|
43
|
+
message: () => 'Message Slot',
|
|
44
|
+
fieldStatus: () => 'Field Status Slot',
|
|
45
|
+
help: () => h('div', { id: 'help-slot' }, 'Help Slot'),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
expect(wrapper.find('.ds-formField__labelAside').text()).toBe('Label Aside');
|
|
50
|
+
expect(wrapper.find('.ds-formField__message').text()).toBe('Message Slot');
|
|
51
|
+
expect(wrapper.find('.ds-formField__fieldStatus').text()).toBe('Field Status Slot');
|
|
52
|
+
expect(wrapper.find('#help-slot').text()).toBe('Help Slot');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should handle value updates', async () => {
|
|
56
|
+
const onUpdate = vi.fn();
|
|
57
|
+
const wrapper = mount(PasswordField, {
|
|
58
|
+
props: {
|
|
59
|
+
label: 'Label',
|
|
60
|
+
modelValue: 'initial value',
|
|
61
|
+
'onUpdate:modelValue': onUpdate,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const input = wrapper.find<HTMLInputElement>('input');
|
|
66
|
+
expect(input.element.value).toBe('initial value');
|
|
67
|
+
|
|
68
|
+
await input.setValue('updated value');
|
|
69
|
+
|
|
70
|
+
expect(onUpdate).toHaveBeenCalledWith('updated value');
|
|
71
|
+
expect(input.element.value).toBe('updated value');
|
|
72
|
+
});
|
|
73
|
+
});
|