@bethinkpl/design-system 26.15.1 → 26.16.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/design-system.umd.cjs +18 -18
- package/dist/design-system.umd.cjs.map +1 -1
- 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/Chip/Chip.vue.d.ts +14 -15
- package/dist/lib/js/components/DatePickers/DateBox/DateBox.vue.d.ts +1 -1
- package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +2 -2
- package/dist/lib/js/components/DatePickers/DateRangePicker/DateRangePicker.vue.d.ts +1 -1
- 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 +12 -0
- package/dist/lib/js/components/Form/InputField/InputField.vue.d.ts +72 -0
- package/dist/lib/js/components/Form/InputField/index.d.ts +3 -0
- package/dist/lib/js/components/Form/PasswordField/PasswordField.vue.d.ts +70 -0
- package/dist/lib/js/components/Form/PasswordField/index.d.ts +3 -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 +15 -14
- package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +18 -18
- package/dist/lib/js/components/Toast/Toast.vue.d.ts +2 -2
- package/dist/lib/js/index.d.ts +7 -0
- package/docs/assets/{AccessStatus-plchnY0B.js → AccessStatus-DW-L4l_0.js} +1 -1
- package/docs/assets/{AccessStatus.stories-DIIoog2Q.js → AccessStatus.stories-DwCxxAOP.js} +1 -1
- package/docs/assets/Avatar-CRVC-fPA.js +1 -0
- package/docs/assets/{Avatar.stories-9Vth29zT.js → Avatar.stories-D7i8UwP9.js} +1 -1
- package/docs/assets/{Badge-BbvNKG41.js → Badge-h4Z2ZKD4.js} +1 -1
- package/docs/assets/{Badge.stories-CKPGT_pt.js → Badge.stories-Bl04pHS_.js} +1 -1
- package/docs/assets/{BadgeScore-BOOWTi6N.js → BadgeScore-CuteYyZb.js} +1 -1
- package/docs/assets/{BadgeScore.stories-ERFMPhhE.js → BadgeScore.stories-BvHEI0pW.js} +1 -1
- package/docs/assets/{Banner-DXAd9x-3.js → Banner-sTfmX99M.js} +1 -1
- package/docs/assets/{Banner.stories-BC2VxrMC.js → Banner.stories-qhUSAG8g.js} +1 -1
- package/docs/assets/BasicRichListItem-C93Qb4K6.js +1 -0
- package/docs/assets/{BasicRichListItem.stories-BJZo9YF9.js → BasicRichListItem.stories-B2smX5s7.js} +2 -2
- package/docs/assets/{BlockadeStatus-D1j0ZWIW.js → BlockadeStatus-B0FY65_h.js} +1 -1
- package/docs/assets/{BlockedeStatus.stories-BKi05Ndl.js → BlockedeStatus.stories-DZ1mfq2q.js} +1 -1
- package/docs/assets/{Button-C5dr6u6F.js → Button-CRTJWjWJ.js} +1 -1
- package/docs/assets/{Button.stories-Da2LsOLk.js → Button.stories-BOpQOZ6x.js} +1 -1
- package/docs/assets/Card-C2-UB9KC.js +1 -0
- package/docs/assets/{Card.stories-Bqmd77lg.js → Card.stories-CI8H4t9g.js} +1 -1
- package/docs/assets/CardExpandable-BMUVeR31.js +1 -0
- package/docs/assets/{CardExpandable.stories-DtC5egGK.js → CardExpandable.stories-CPAZ4mof.js} +1 -1
- package/docs/assets/Checkbox-CIfSektM.js +1 -0
- package/docs/assets/{Checkbox.stories-BUIzgcCC.js → Checkbox.stories-Dt5C89R2.js} +1 -1
- package/docs/assets/{Chip-BJcjfD8j.js → Chip-Bi-iKYH0.js} +1 -1
- package/docs/assets/{Chip.stories-Dgmetn8m.js → Chip.stories-BukfI_wY.js} +1 -1
- package/docs/assets/{Color-ERTF36HU-DaHgyI5V.js → Color-ERTF36HU-Cor5XXAu.js} +1 -1
- package/docs/assets/{Colors.stories-BrNisWwH.js → Colors.stories-yICh_E96.js} +1 -1
- package/docs/assets/{ColorsThemes.stories-DvZl0m40.js → ColorsThemes.stories-CKiphr3E.js} +1 -1
- package/docs/assets/{ColorsTokensLms.stories-D3nA1ro1.js → ColorsTokensLms.stories-C_hRq1fa.js} +1 -1
- package/docs/assets/{ColorsTokensPrimaryBodywork.stories-w4A7RjpQ.js → ColorsTokensPrimaryBodywork.stories-TzJMcnGg.js} +1 -1
- package/docs/assets/{ColorsTokensPrimaryWnl.stories-CncgXEG5.js → ColorsTokensPrimaryWnl.stories-CCArJaTw.js} +1 -1
- package/docs/assets/{CounterToggle-DKRrZ9t2.js → CounterToggle-D3jTLdlU.js} +1 -1
- package/docs/assets/{CounterToggle.stories-DEP60zRp.js → CounterToggle.stories-BZAgprZf.js} +1 -1
- package/docs/assets/{DateBox.stories-y5_2vs0g.js → DateBox.stories-CNTaIflE.js} +3 -3
- package/docs/assets/{DatePicker-QHo-i7qh.js → DatePicker-aMS5YOMW.js} +1 -1
- package/docs/assets/{DatePicker.stories-4hPgpb1-.js → DatePicker.stories-DnojtGGT.js} +1 -1
- package/docs/assets/{DateRangePicker-B0NAwdsr.js → DateRangePicker-B25oMOoU.js} +1 -1
- package/docs/assets/{DateRangePicker.stories-BXQLC6L-.js → DateRangePicker.stories-CaIkM98h.js} +1 -1
- package/docs/assets/{Divider-9o-i_zKL.js → Divider-BNN8PhWF.js} +1 -1
- package/docs/assets/{Divider.stories-IQKEznYT.js → Divider.stories-DQGq5WIM.js} +1 -1
- package/docs/assets/{DocsRenderer-CFRXHY34-rC6r6xBG.js → DocsRenderer-CFRXHY34-DsMNfqFA.js} +5 -5
- package/docs/assets/{Drawer-ClrSDwUZ.js → Drawer-CgEP8-bU.js} +1 -1
- package/docs/assets/{Drawer.stories-DR-CXra3.js → Drawer.stories-CetCbwOV.js} +1 -1
- package/docs/assets/{DrawerContent-D6Bl5GA-.js → DrawerContent-Dna0k_5V.js} +1 -1
- package/docs/assets/{DrawerContent.stories-BR11egKi.js → DrawerContent.stories-BqJ3zitz.js} +1 -1
- package/docs/assets/{DrawerDivider-DMhjaSPk.js → DrawerDivider-BjBlvEOJ.js} +1 -1
- package/docs/assets/{DrawerDivider.stories-DdcVRbtO.js → DrawerDivider.stories-BN_G8JML.js} +1 -1
- package/docs/assets/DrawerHeader-CYgh5yLP.js +1 -0
- package/docs/assets/{DrawerHeader.stories-DnPlkGmI.js → DrawerHeader.stories-CsM4PkKY.js} +1 -1
- package/docs/assets/{DrawerListItem-dizQZUbe.js → DrawerListItem-BOEqjnvB.js} +1 -1
- package/docs/assets/{DrawerListItem.stories-pVTEuckG.js → DrawerListItem.stories-Br_BBZTl.js} +1 -1
- package/docs/assets/{DrawerListItemGroup-B5XadRVV.js → DrawerListItemGroup-qG_7CJ2Z.js} +1 -1
- package/docs/assets/{DrawerListItemGroup.stories-pOGG952w.js → DrawerListItemGroup.stories-Dj7XnOfZ.js} +1 -1
- package/docs/assets/{DrawerSection-HBM59yvF.js → DrawerSection-Bk-qjO-U.js} +1 -1
- package/docs/assets/{DrawerSection.stories-tQT_zWBt.js → DrawerSection.stories-bac3ulNN.js} +1 -1
- package/docs/assets/DrawerTile-3UrW0AGT.js +1 -0
- package/docs/assets/{DrawerTile.stories-6JDnzzyo.js → DrawerTile.stories-AeySW4m1.js} +1 -1
- package/docs/assets/Dropdown-vkyblifO.js +1 -0
- package/docs/assets/{Dropdown.stories-DLo-4_G3.js → Dropdown.stories-Bvkxpx3n.js} +1 -1
- package/docs/assets/{FeatureIcon-BoUhuGOr.js → FeatureIcon-DClL1vj4.js} +1 -1
- package/docs/assets/{FeatureIcon.stories-H_yUD4i4.js → FeatureIcon.stories-D1igtEZB.js} +1 -1
- package/docs/assets/FormField-u4PxhF2k.js +1 -0
- package/docs/assets/FormField.stories-DXTo4Z_Y.js +40 -0
- package/docs/assets/FormField.stories.shared-D4ktxakv.js +1 -0
- package/docs/assets/FormFieldMessage-JNi0OUbH.js +1 -0
- package/docs/assets/FormFieldMessage.stories-lK_yWKrc.js +32 -0
- package/docs/assets/GroupRichListItem-D8nu5Fv9.js +1 -0
- package/docs/assets/{GroupRichListItem.stories-C25AujXP.js → GroupRichListItem.stories-DKL_YGxk.js} +1 -1
- package/docs/assets/HelpButton-Lb2k2yp9.js +1 -0
- package/docs/assets/HelpButton.stories-D4-sk1wV.js +17 -0
- package/docs/assets/{Icon-I3Cniv10.js → Icon-BxW-ny3A.js} +5 -5
- package/docs/assets/{Icon.stories-BhnUVRrV.js → Icon.stories-DaFYO7BK.js} +1 -1
- package/docs/assets/IconButton-C0_vxVJn.js +1 -0
- package/docs/assets/{IconButton.stories-B8QjmTyV.js → IconButton.stories-BB9x50r9.js} +1 -1
- package/docs/assets/{IconText-CKJ4jGzm.js → IconText-Bl-DK5dv.js} +1 -1
- package/docs/assets/{IconText.stories-B5zjHqug.js → IconText.stories-BbDEYbhY.js} +1 -1
- package/docs/assets/{Image-Dbv2u4ta.js → Image-DXVGtCU-.js} +1 -1
- package/docs/assets/{Image.stories-CUWPBT5K.js → Image.stories-CmX0xWLp.js} +1 -1
- package/docs/assets/InputField-CjqHh5Cm.js +1 -0
- package/docs/assets/InputField.stories-B6VUcIZA.js +44 -0
- package/docs/assets/{ItemsList-CJTCYbgI.js → ItemsList-BT-ch5Ki.js} +1 -1
- package/docs/assets/{LoadingBar-Dc_eLNsl.js → LoadingBar-CoXHVlvM.js} +1 -1
- package/docs/assets/{LoadingBar.stories-DWH4VmcD.js → LoadingBar.stories-B_l4HaQT.js} +1 -1
- package/docs/assets/Modal-xuXnp0B3.js +1 -0
- package/docs/assets/{Modal.stories-0zzyLX_Z.js → Modal.stories-BSYz4NUn.js} +1 -1
- package/docs/assets/{ModalDialog-BuO78uuh.js → ModalDialog-D6jipNV9.js} +1 -1
- package/docs/assets/{ModalDialog.stories-lBI09xqp.js → ModalDialog.stories-y0DTZLJ9.js} +1 -1
- package/docs/assets/{NumberInCircle-DnPE2szs.js → NumberInCircle-iJQYZsfG.js} +1 -1
- package/docs/assets/{NumberInCircle.stories-Tn0v6S_I.js → NumberInCircle.stories-BL7R6Ey9.js} +1 -1
- package/docs/assets/OutlineDivider-DpgF_2B_.js +1 -0
- package/docs/assets/{OutlineDivider.stories-D9Hzkdbe.js → OutlineDivider.stories-CoI8u05k.js} +1 -1
- package/docs/assets/{OutlineItem-1BOyMbS2.js → OutlineItem-COSzRi1t.js} +1 -1
- package/docs/assets/{OutlineItem.stories-DZ_RXCGO.js → OutlineItem.stories-DPbUVNt7.js} +1 -1
- package/docs/assets/{OutlineSectionHeader-LGOAi424.js → OutlineSectionHeader-C7vAvTfl.js} +1 -1
- package/docs/assets/{OutlineSectionHeader.stories-PPIsaHhR.js → OutlineSectionHeader.stories-DTI32viO.js} +1 -1
- package/docs/assets/OverlayHeader-DYU6A8e-.js +1 -0
- package/docs/assets/{OverlayHeader.stories-D0TRoa1n.js → OverlayHeader.stories-Daj1gEMT.js} +1 -1
- package/docs/assets/{PageHeader-DkHlb7_P.js → PageHeader-BKDJxn58.js} +1 -1
- package/docs/assets/{PageHeader.stories-WThxfLse.js → PageHeader.stories-BRdESIfF.js} +1 -1
- package/docs/assets/{Pagination-CgO9MoPY.js → Pagination-CruPXU6i.js} +1 -1
- package/docs/assets/{Pagination.stories-CL9tb6Sx.js → Pagination.stories-pk1h1NdC.js} +1 -1
- package/docs/assets/PasswordField-D2k9x-t0.js +1 -0
- package/docs/assets/PasswordField.stories-BMwEm_DO.js +42 -0
- package/docs/assets/{PopOver-BDVCOkO6.js → PopOver-BjBlXVwF.js} +1 -1
- package/docs/assets/{PopOver.stories-CmDQPumC.js → PopOver.stories-3QX4Ga4o.js} +1 -1
- package/docs/assets/{ProgressBar-q_I44DQc.js → ProgressBar-VrWJHC2p.js} +1 -1
- package/docs/assets/{ProgressBar.stories-Df10tpd-.js → ProgressBar.stories-CrZ2zJwI.js} +1 -1
- package/docs/assets/{ProgressDonutChart-DP55sH2Q.js → ProgressDonutChart-CJlokRW-.js} +1 -1
- package/docs/assets/{ProgressDonutChart.stories-CXJhJ1AH.js → ProgressDonutChart.stories-BRxY2dWI.js} +1 -1
- package/docs/assets/RadioButton-DO6I2WfN.js +1 -0
- package/docs/assets/{RadioButton.stories-NVFxjqN4.js → RadioButton.stories-C80hUDbi.js} +1 -1
- package/docs/assets/{RichListItem.stories-B3NGpkHT.js → RichListItem.stories-_8Hp41y-.js} +2 -2
- package/docs/assets/{SectionHeader-ByewlGaG.js → SectionHeader-BvZF_uZR.js} +1 -1
- package/docs/assets/{SectionHeader.stories-CTANEOdf.js → SectionHeader.stories-BjccJa_1.js} +1 -1
- package/docs/assets/{SectionTitle-DLcFKzRH.js → SectionTitle-DElPh1Y0.js} +1 -1
- package/docs/assets/{SectionTitle.stories-Dybq4paM.js → SectionTitle.stories-BOEziRr6.js} +1 -1
- package/docs/assets/{SelectList-B323Y2el.js → SelectList-IYj9X3z5.js} +1 -1
- package/docs/assets/{SelectList.stories-BCS6zdJ9.js → SelectList.stories-B0jlx1dv.js} +1 -1
- package/docs/assets/{SelectListItem-DfLqJR-_.js → SelectListItem-DxlYAAqR.js} +1 -1
- package/docs/assets/{SelectListItem.stories-m8BTHS53.js → SelectListItem.stories-Cbgqd3q6.js} +1 -1
- package/docs/assets/{SelectListItemDivider-lDLIwtP8.js → SelectListItemDivider-Bt5LuCh6.js} +1 -1
- package/docs/assets/{SelectListItemDivider.stories-BZ6_HOBG.js → SelectListItemDivider.stories-BFdzCK8L.js} +1 -1
- package/docs/assets/{SelectListItemTile-DzAuBa66.js → SelectListItemTile-Ci7UUkBi.js} +1 -1
- package/docs/assets/{SelectListItemTile.stories-n2MJqr9U.js → SelectListItemTile.stories-D53QYgoj.js} +1 -1
- package/docs/assets/{SelectListItemToggle-DJ_P6PIB.js → SelectListItemToggle-uyZKP9l-.js} +1 -1
- package/docs/assets/{SelectListItemToggle.stories-yej5J6y8.js → SelectListItemToggle.stories-CHKImbbO.js} +1 -2
- package/docs/assets/SelectListSectionTitle-CytprfLI.js +1 -0
- package/docs/assets/{SelectListSectionTitle.stories-NKPegok4.js → SelectListSectionTitle.stories-CHaM0ezF.js} +1 -1
- package/docs/assets/{SelectionControl-CwdtLuOD.js → SelectionControl-D6-Q7FjJ.js} +1 -1
- package/docs/assets/{SelectionTile-hjRK7Lwc.js → SelectionTile-BXjJtuZK.js} +2 -2
- package/docs/assets/{SelectionTile.stories-DRdGcDuJ.js → SelectionTile.stories-Cdv1DqAb.js} +1 -1
- package/docs/assets/{Skeleton-DhyJ4ZKG.js → Skeleton-a6juZJ74.js} +3 -3
- package/docs/assets/{Skeleton.stories-CsZjBoj1.js → Skeleton.stories-CU_bwj6g.js} +1 -1
- package/docs/assets/SurveyQuestionOpenEnded-CU362h7V.js +1 -0
- package/docs/assets/{SurveyQuestionOpenEnded.stories-Is_s49TT.js → SurveyQuestionOpenEnded.stories-DTfe-q_l.js} +1 -1
- package/docs/assets/SurveyQuestionScale-BFW9EZtg.js +1 -0
- package/docs/assets/{SurveyQuestionScale.stories-BqOjFThb.js → SurveyQuestionScale.stories-I6PfDZOp.js} +1 -1
- package/docs/assets/{SurveyToggle-CCF4WE7n.js → SurveyToggle-BeOR_ZKx.js} +1 -1
- package/docs/assets/{SurveyToggle.stories-DySS4Jzx.js → SurveyToggle.stories-DJz0MG-Y.js} +1 -1
- package/docs/assets/Switch-DsNVsFhH.js +1 -0
- package/docs/assets/{Switch.stories-Bq6_6t39.js → Switch.stories-C1-OEnaq.js} +1 -1
- package/docs/assets/{TabItem-Bn_qIbPX.js → TabItem-KyXcr_5Z.js} +1 -1
- package/docs/assets/{TabItem.stories-ZPYw1uH1.js → TabItem.stories-BfCXfirX.js} +1 -1
- package/docs/assets/{TextGroup-AUUBIFJZ.js → TextGroup-BGFapzPu.js} +1 -1
- package/docs/assets/{TextGroup.stories-CqwkdBAO.js → TextGroup.stories-WgHYdmrz.js} +1 -1
- package/docs/assets/{ThreeColumnLayout-DXA1815_.js → ThreeColumnLayout-DLj9ww3X.js} +1 -1
- package/docs/assets/{ThreeColumnLayout.stories-BA08mTZ7.js → ThreeColumnLayout.stories-BD0ZEOam.js} +1 -1
- package/docs/assets/{Tile-3fvrXM7M.js → Tile-CV9qCJCf.js} +1 -1
- package/docs/assets/{Tile.sb.shared-Crj50ugV.js → Tile.sb.shared-CYs-5pZ0.js} +1 -1
- package/docs/assets/{Tile.stories-0SQaiGz7.js → Tile.stories-32aU_anv.js} +1 -1
- package/docs/assets/{Toast-CTbKhm1i.js → Toast-p9LnCPmL.js} +1 -1
- package/docs/assets/{Toast.stories-hUEtnOQn.js → Toast.stories-zF82pwwv.js} +1 -1
- package/docs/assets/{ToggleButton-D-t1sDTL.js → ToggleButton-D_HZ-8jw.js} +1 -1
- package/docs/assets/{ToggleButton.stories-CaAweKdC.js → ToggleButton.stories-CV-iGLoy.js} +1 -1
- package/docs/assets/{Tooltip-DZi9yXjr.js → Tooltip-DKqXTPwf.js} +1 -1
- package/docs/assets/{Tooltip.stories-D-DHfToA.js → Tooltip.stories-D_SR7U8f.js} +1 -1
- package/docs/assets/{TypographyTokensLms.stories-CZpPPUwu.js → TypographyTokensLms.stories-qRJAJdvd.js} +1 -1
- package/docs/assets/{TypographyVariables.stories-B4Lg96R3.js → TypographyVariables.stories-B6W3MuIN.js} +1 -1
- package/docs/assets/{Well-D1j9q3W3.js → Well-Di8wsKpw.js} +1 -1
- package/docs/assets/{Well.stories-wgg6f6S7.js → Well.stories-D3CQkZun.js} +1 -1
- package/docs/assets/entry-preview-B1UVjA37.js +1 -0
- package/docs/assets/{entry-preview-docs-Bz8Se46p.js → entry-preview-docs-Cs1P1b8z.js} +1 -1
- package/docs/assets/{iframe-CKOJ9wC7.js → iframe-BH6Q2yq5.js} +11 -8
- package/docs/assets/{index-Be4sB5Yj.js → index-7TY-LtbS.js} +1 -1
- package/docs/assets/{index-0M4xY6Fw.js → index-BncE9pY5.js} +1 -1
- package/docs/assets/{preview-BIPjgpxe.js → preview-CQnQ4kXS.js} +2 -2
- package/docs/assets/preview-RZnfww4F.js +64 -0
- package/docs/assets/{string-B1AGRR5v.js → string-DZMRm3DC.js} +1 -1
- package/docs/assets/{vue-popper-DoPHnofs.js → vue-popper-CgJSQDC2.js} +1 -1
- package/docs/assets/vue.esm-bundler-CC_vsnCp.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/Buttons/Button/Button.spec.ts +3 -3
- 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/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 +135 -0
- package/lib/js/components/Form/InputField/InputField.stories.ts +98 -0
- package/lib/js/components/Form/InputField/InputField.types.ts +13 -0
- package/lib/js/components/Form/InputField/InputField.vue +151 -0
- package/lib/js/components/Form/InputField/index.ts +3 -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/Modals/Modal/Modal.consts.ts +8 -2
- package/lib/js/components/Modals/Modal/Modal.vue +10 -3
- 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/index.ts +7 -0
- package/lib/js/styles/Borders/BorderSizes.stories.ts +1 -1
- package/lib/js/styles/ItemsList.vue +1 -1
- package/package.json +5 -5
- package/tsconfig.base.json +1 -2
- package/tsconfig.build.json +8 -0
- package/tsconfig.json +1 -6
- package/vite.config.ts +9 -1
- package/docs/assets/Avatar-CM7iogZ3.js +0 -1
- package/docs/assets/BasicRichListItem-quALUWxY.js +0 -1
- package/docs/assets/Card-KSW_Q55y.js +0 -1
- package/docs/assets/CardExpandable-yMDr4_fF.js +0 -1
- package/docs/assets/Checkbox-DAOkXx1R.js +0 -1
- package/docs/assets/DrawerHeader-AkG6Jq7W.js +0 -1
- package/docs/assets/DrawerTile-0-CB5w9j.js +0 -1
- package/docs/assets/Dropdown-CYFZ3OvV.js +0 -1
- package/docs/assets/GroupRichListItem-C_Gsy7fK.js +0 -1
- 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/RadioButton-DISpvFOt.js +0 -1
- 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/Switch-Du-uh84v.js +0 -1
- package/docs/assets/entry-preview-lHccVHf5.js +0 -1
- package/docs/assets/preview-BQvHXGdy.js +0 -64
- package/docs/assets/vue.esm-bundler-DD4BrEtS.js +0 -36
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { h } from 'vue';
|
|
4
|
+
import FormField from './FormField.vue';
|
|
5
|
+
import { ComponentProps, ComponentSlots } from 'vue-component-type-helpers';
|
|
6
|
+
import FormFieldMessage from './FormFieldMessage/FormFieldMessage.vue';
|
|
7
|
+
|
|
8
|
+
const fieldId = 'form-field-v-0';
|
|
9
|
+
const messageId = 'form-field-v-0-message';
|
|
10
|
+
|
|
11
|
+
function setup(
|
|
12
|
+
props: ComponentProps<typeof FormField> = {},
|
|
13
|
+
slots: Partial<ComponentSlots<typeof FormField>> = {},
|
|
14
|
+
) {
|
|
15
|
+
return mount(FormField, {
|
|
16
|
+
props,
|
|
17
|
+
slots: {
|
|
18
|
+
field() {
|
|
19
|
+
return [h('input')];
|
|
20
|
+
},
|
|
21
|
+
...slots,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('FormField', () => {
|
|
27
|
+
it('should render', () => {
|
|
28
|
+
const wrapper = setup(
|
|
29
|
+
{
|
|
30
|
+
label: 'Label',
|
|
31
|
+
labelInfo: 'Label info',
|
|
32
|
+
subLabel: 'Sub Label',
|
|
33
|
+
hasRequiredIndicator: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
labelAside: () => [h('span', 'Label aside')],
|
|
37
|
+
message: () => [
|
|
38
|
+
h(
|
|
39
|
+
FormFieldMessage,
|
|
40
|
+
{
|
|
41
|
+
messageId,
|
|
42
|
+
},
|
|
43
|
+
() => 'Message',
|
|
44
|
+
),
|
|
45
|
+
],
|
|
46
|
+
fieldStatus: () => [h('span', 'Field status')],
|
|
47
|
+
help: () => [h('span', 'Help')],
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(wrapper.exists()).toBe(true);
|
|
52
|
+
expect(wrapper.find('.ds-formField__label').attributes('for')).toBe(fieldId);
|
|
53
|
+
expect(wrapper.find('.ds-formField__labelText').text()).toBe('Label');
|
|
54
|
+
expect(wrapper.find('.ds-formField__labelRequired').text()).toBe('*');
|
|
55
|
+
expect(wrapper.find('.ds-formField__labelInfo').text()).toBe('Label info');
|
|
56
|
+
expect(wrapper.find('.ds-formField__subLabelRow').text()).toBe('Sub Label');
|
|
57
|
+
expect(wrapper.find('.ds-formField__field input').exists()).toBe(true);
|
|
58
|
+
expect(wrapper.find('.ds-formField__labelAside').text()).toBe('Label aside');
|
|
59
|
+
expect(wrapper.find(`#${messageId}`).text()).toBe('Message');
|
|
60
|
+
expect(wrapper.find('.ds-formField__fieldStatus').text()).toBe('Field status');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it.each([
|
|
64
|
+
{
|
|
65
|
+
name: 'only label',
|
|
66
|
+
props: {
|
|
67
|
+
label: 'Label',
|
|
68
|
+
},
|
|
69
|
+
slots: {},
|
|
70
|
+
expected: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'only label aside',
|
|
74
|
+
props: {},
|
|
75
|
+
slots: {
|
|
76
|
+
labelAside: () => [h('span', 'Label aside')],
|
|
77
|
+
},
|
|
78
|
+
expected: true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'only subLabel',
|
|
82
|
+
props: {
|
|
83
|
+
subLabel: 'Sub Label',
|
|
84
|
+
},
|
|
85
|
+
slots: {},
|
|
86
|
+
expected: true,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'no labels wrapper',
|
|
90
|
+
props: {},
|
|
91
|
+
slots: {},
|
|
92
|
+
expected: false,
|
|
93
|
+
},
|
|
94
|
+
])(`should render labels wrapper: $name`, ({ props, slots, expected }) => {
|
|
95
|
+
const wrapper = setup(props, slots);
|
|
96
|
+
|
|
97
|
+
expect(wrapper.find('.ds-formField__labels').exists()).toBe(expected);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it.each([
|
|
101
|
+
{
|
|
102
|
+
name: 'only message',
|
|
103
|
+
props: {},
|
|
104
|
+
slots: {
|
|
105
|
+
message: () => [h(FormFieldMessage, { messageId }, () => 'Message')],
|
|
106
|
+
},
|
|
107
|
+
expected: true,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'only field status',
|
|
111
|
+
props: {},
|
|
112
|
+
slots: {
|
|
113
|
+
fieldStatus: () => [h('span', 'Field status')],
|
|
114
|
+
},
|
|
115
|
+
expected: true,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'no footer row',
|
|
119
|
+
props: {},
|
|
120
|
+
slots: {},
|
|
121
|
+
expected: false,
|
|
122
|
+
},
|
|
123
|
+
])('should render footer row: $name', ({ props, slots, expected }) => {
|
|
124
|
+
const wrapper = setup(props, slots);
|
|
125
|
+
|
|
126
|
+
expect(wrapper.find('.ds-formField__footerRow').exists()).toBe(expected);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should render message', () => {
|
|
130
|
+
const messageText = 'Message text';
|
|
131
|
+
const wrapper = setup({
|
|
132
|
+
messageText,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
expect(wrapper.find('.ds-formField__message').exists()).toBe(true);
|
|
136
|
+
expect(wrapper.find(`#${messageId}`).text()).toBe(messageText);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FORM_FIELD_STATES } from './FormField.consts';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
3
|
+
import FormField from './FormField.vue';
|
|
4
|
+
|
|
5
|
+
export const argTypes: Meta<typeof FormField>['argTypes'] = {
|
|
6
|
+
label: {
|
|
7
|
+
control: 'text',
|
|
8
|
+
},
|
|
9
|
+
state: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: Object.values(FORM_FIELD_STATES),
|
|
12
|
+
},
|
|
13
|
+
hasRequiredIndicator: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
},
|
|
16
|
+
labelInfo: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
},
|
|
19
|
+
subLabel: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
},
|
|
22
|
+
fieldId: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
},
|
|
25
|
+
labelAside: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
},
|
|
28
|
+
message: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
},
|
|
31
|
+
fieldStatus: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
},
|
|
34
|
+
help: {
|
|
35
|
+
control: 'boolean',
|
|
36
|
+
},
|
|
37
|
+
messageText: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const args: StoryObj<typeof FormField>['args'] = {
|
|
43
|
+
label: 'Label',
|
|
44
|
+
state: FORM_FIELD_STATES.DEFAULT,
|
|
45
|
+
hasRequiredIndicator: false,
|
|
46
|
+
labelInfo: '(opcjonalne)',
|
|
47
|
+
subLabel: 'Sublabel write here',
|
|
48
|
+
labelAside: 'Label aside',
|
|
49
|
+
message: '',
|
|
50
|
+
help: true,
|
|
51
|
+
fieldStatus: 'Field status',
|
|
52
|
+
messageText: '',
|
|
53
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import FormField from './FormField.vue';
|
|
3
|
+
import HelpButton from '../../Buttons/HelpButton/HelpButton.vue';
|
|
4
|
+
import { FORM_FIELD_STATES } from './FormField.consts';
|
|
5
|
+
import { args, argTypes } from './FormField.stories.shared';
|
|
6
|
+
import { reactive, toRefs } from 'vue';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof FormField> = {
|
|
9
|
+
title: 'Components/Form/FormField',
|
|
10
|
+
component: FormField,
|
|
11
|
+
render: (args) => ({
|
|
12
|
+
components: { FormField, HelpButton },
|
|
13
|
+
setup() {
|
|
14
|
+
const { field, help, labelAside, message, fieldStatus, ...restRefs } = toRefs(args);
|
|
15
|
+
const props = reactive({ ...restRefs });
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
props,
|
|
19
|
+
labelAside,
|
|
20
|
+
fieldStatus,
|
|
21
|
+
message,
|
|
22
|
+
help,
|
|
23
|
+
field,
|
|
24
|
+
FORM_FIELD_STATES,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
template: `<FormField v-bind="props">
|
|
28
|
+
<template #field="{fieldId, messageId}">
|
|
29
|
+
<input v-if="!field" :id="fieldId" :aria-describedby="messageId" />
|
|
30
|
+
<div v-else v-html="field" />
|
|
31
|
+
</template>
|
|
32
|
+
<template v-if="help" #help>
|
|
33
|
+
<HelpButton :is-disabled="props.state === FORM_FIELD_STATES.DISABLED" modal-title="Help modal title">
|
|
34
|
+
<template #modalContent>
|
|
35
|
+
Modal
|
|
36
|
+
</template>
|
|
37
|
+
</HelpButton>
|
|
38
|
+
</template>
|
|
39
|
+
<template v-if="labelAside" #labelAside>
|
|
40
|
+
<div v-html="labelAside" />
|
|
41
|
+
</template>
|
|
42
|
+
<template v-if="fieldStatus" #fieldStatus>
|
|
43
|
+
<div v-html="fieldStatus" />
|
|
44
|
+
</template>
|
|
45
|
+
<template v-if="message" #message>
|
|
46
|
+
<div v-html="message" />
|
|
47
|
+
</template>
|
|
48
|
+
</FormField>`,
|
|
49
|
+
}),
|
|
50
|
+
argTypes: {
|
|
51
|
+
...argTypes,
|
|
52
|
+
field: {
|
|
53
|
+
control: 'text',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export default meta;
|
|
58
|
+
|
|
59
|
+
type Story = StoryObj<typeof FormField>;
|
|
60
|
+
|
|
61
|
+
export const Interactive: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
...args,
|
|
64
|
+
field: '',
|
|
65
|
+
},
|
|
66
|
+
parameters: {
|
|
67
|
+
design: {
|
|
68
|
+
type: 'figma',
|
|
69
|
+
url: 'https://www.figma.com/design/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?node-id=13267-86654&t=ezos5nMsGrZyaqmC-4',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Error: Story = {
|
|
75
|
+
...Interactive,
|
|
76
|
+
args: {
|
|
77
|
+
...Interactive.args,
|
|
78
|
+
state: FORM_FIELD_STATES.ERROR,
|
|
79
|
+
messageText: 'Error message text',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface FormFieldProps {
|
|
2
|
+
label?: string;
|
|
3
|
+
state?: 'default' | 'disabled' | 'error' | 'success';
|
|
4
|
+
hasRequiredIndicator?: boolean;
|
|
5
|
+
labelInfo?: string;
|
|
6
|
+
subLabel?: string;
|
|
7
|
+
fieldId?: string;
|
|
8
|
+
messageText?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface FormFieldSlots {
|
|
12
|
+
labelAside?: () => any;
|
|
13
|
+
help?: () => any;
|
|
14
|
+
field: (props: { fieldId: string; messageId: string }) => any;
|
|
15
|
+
message?: (props: { messageId: string }) => any;
|
|
16
|
+
fieldStatus?: () => any;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FormFieldProps } from './FormField.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extracts the properties needed for a form field component only
|
|
5
|
+
*/
|
|
6
|
+
export function extractFormFieldProps({
|
|
7
|
+
label,
|
|
8
|
+
state,
|
|
9
|
+
hasRequiredIndicator,
|
|
10
|
+
labelInfo,
|
|
11
|
+
subLabel,
|
|
12
|
+
fieldId,
|
|
13
|
+
messageText,
|
|
14
|
+
}: FormFieldProps) {
|
|
15
|
+
return {
|
|
16
|
+
label,
|
|
17
|
+
state,
|
|
18
|
+
hasRequiredIndicator,
|
|
19
|
+
labelInfo,
|
|
20
|
+
subLabel,
|
|
21
|
+
fieldId,
|
|
22
|
+
messageText,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
'ds-formField',
|
|
5
|
+
{
|
|
6
|
+
'-ds-disabled': state === FORM_FIELD_STATES.DISABLED,
|
|
7
|
+
},
|
|
8
|
+
]"
|
|
9
|
+
>
|
|
10
|
+
<div v-if="label || subLabel || $slots.labelAside" class="ds-formField__labels">
|
|
11
|
+
<div class="ds-formField__labelRow">
|
|
12
|
+
<div class="ds-formField__labelWrapper">
|
|
13
|
+
<label v-if="label" class="ds-formField__label" :for="id">
|
|
14
|
+
<span class="ds-formField__labelText">{{ label }}</span>
|
|
15
|
+
<span
|
|
16
|
+
v-if="hasRequiredIndicator"
|
|
17
|
+
class="ds-formField__labelRequired"
|
|
18
|
+
aria-hidden="true"
|
|
19
|
+
>*</span
|
|
20
|
+
>
|
|
21
|
+
<span v-if="labelInfo" class="ds-formField__labelInfo">{{
|
|
22
|
+
labelInfo
|
|
23
|
+
}}</span>
|
|
24
|
+
</label>
|
|
25
|
+
<slot name="help"></slot>
|
|
26
|
+
</div>
|
|
27
|
+
<div v-if="$slots.labelAside" class="ds-formField__labelAside">
|
|
28
|
+
<slot name="labelAside"></slot>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div v-if="subLabel" class="ds-formField__subLabelRow">{{ subLabel }}</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="ds-formField__field">
|
|
34
|
+
<slot name="field" :field-id="id" :message-id="messageId"></slot>
|
|
35
|
+
</div>
|
|
36
|
+
<div v-if="hasMessage || $slots.fieldStatus" class="ds-formField__footerRow">
|
|
37
|
+
<div class="ds-formField__message">
|
|
38
|
+
<slot name="message" :message-id="messageId">
|
|
39
|
+
<form-field-message v-if="messageText" :state="state" :message-id="messageId">
|
|
40
|
+
{{ messageText }}
|
|
41
|
+
</form-field-message>
|
|
42
|
+
</slot>
|
|
43
|
+
</div>
|
|
44
|
+
<div v-if="$slots.fieldStatus" class="ds-formField__fieldStatus">
|
|
45
|
+
<slot name="fieldStatus"></slot>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<style scoped lang="scss">
|
|
52
|
+
@import '../../../../styles/settings/spacings';
|
|
53
|
+
@import '../../../../styles/settings/typography/tokens';
|
|
54
|
+
@import '../../../../styles/settings/colors/tokens';
|
|
55
|
+
|
|
56
|
+
.ds-formField {
|
|
57
|
+
$root: &;
|
|
58
|
+
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
gap: $space-5xs;
|
|
62
|
+
|
|
63
|
+
&__labelRow {
|
|
64
|
+
align-items: flex-start;
|
|
65
|
+
display: flex;
|
|
66
|
+
gap: $space-xs;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&__subLabelRow {
|
|
70
|
+
@include formLabel-s-default-regular;
|
|
71
|
+
|
|
72
|
+
color: $color-neutral-text;
|
|
73
|
+
padding-bottom: $space-2xs;
|
|
74
|
+
|
|
75
|
+
#{$root}.-ds-disabled & {
|
|
76
|
+
color: $color-neutral-text-disabled;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&__labelWrapper {
|
|
81
|
+
align-items: flex-start;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex: 1 0 0;
|
|
84
|
+
gap: $space-5xs;
|
|
85
|
+
padding: $space-4xs 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__label {
|
|
89
|
+
@include formLabel-m-default-bold;
|
|
90
|
+
|
|
91
|
+
margin: $space-5xs 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__labelText {
|
|
95
|
+
color: $color-neutral-text-strong;
|
|
96
|
+
|
|
97
|
+
#{$root}.-ds-disabled & {
|
|
98
|
+
color: $color-neutral-text-strong-disabled;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&__labelRequired {
|
|
103
|
+
@include formLabel-m-default-regular;
|
|
104
|
+
|
|
105
|
+
color: $color-danger-text;
|
|
106
|
+
margin-left: $space-5xs;
|
|
107
|
+
|
|
108
|
+
#{$root}.-ds-disabled & {
|
|
109
|
+
color: $color-danger-text-disabled;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&__labelInfo {
|
|
114
|
+
@include formLabel-s-default-regular-italic;
|
|
115
|
+
|
|
116
|
+
color: $color-neutral-text;
|
|
117
|
+
margin-left: $space-5xs;
|
|
118
|
+
|
|
119
|
+
#{$root}.-ds-disabled & {
|
|
120
|
+
color: $color-neutral-text-disabled;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__labelAside {
|
|
125
|
+
align-items: center;
|
|
126
|
+
display: flex;
|
|
127
|
+
gap: $space-4xs;
|
|
128
|
+
min-height: 28px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&__field {
|
|
132
|
+
align-items: flex-start;
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
justify-content: center;
|
|
136
|
+
min-height: 28px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&__footerRow {
|
|
140
|
+
align-items: flex-start;
|
|
141
|
+
display: flex;
|
|
142
|
+
gap: $space-2xs;
|
|
143
|
+
padding-top: $space-4xs;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&__message {
|
|
147
|
+
flex: 1 0 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&__fieldStatus {
|
|
151
|
+
align-items: flex-start;
|
|
152
|
+
display: flex;
|
|
153
|
+
gap: $space-4xs;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
157
|
+
|
|
158
|
+
<script lang="ts" setup>
|
|
159
|
+
import { computed, useId } from 'vue';
|
|
160
|
+
import FormFieldMessage from './FormFieldMessage/FormFieldMessage.vue';
|
|
161
|
+
import { FORM_FIELD_STATES } from './FormField.consts';
|
|
162
|
+
import { FormFieldProps, FormFieldSlots } from './FormField.types';
|
|
163
|
+
|
|
164
|
+
const {
|
|
165
|
+
label,
|
|
166
|
+
hasRequiredIndicator = false,
|
|
167
|
+
subLabel,
|
|
168
|
+
labelInfo,
|
|
169
|
+
fieldId,
|
|
170
|
+
messageText,
|
|
171
|
+
state = FORM_FIELD_STATES.DEFAULT,
|
|
172
|
+
} = defineProps<FormFieldProps>();
|
|
173
|
+
|
|
174
|
+
const slots = defineSlots<FormFieldSlots>();
|
|
175
|
+
|
|
176
|
+
const baseId = useId();
|
|
177
|
+
const id = computed(() => fieldId || `form-field-${baseId}`);
|
|
178
|
+
const { hasMessage, messageId } = useMessage();
|
|
179
|
+
|
|
180
|
+
function useMessage() {
|
|
181
|
+
const hasMessage = computed(() => {
|
|
182
|
+
return !!(slots.message || messageText);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const messageId = computed(() => `${id.value}-message`);
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
hasMessage,
|
|
189
|
+
messageId,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import FormFieldMessage from './FormFieldMessage.vue';
|
|
3
|
+
import { mount } from '@vue/test-utils';
|
|
4
|
+
import Icon, { ICONS } from '../../../Icons/Icon';
|
|
5
|
+
import { ComponentProps } from 'vue-component-type-helpers';
|
|
6
|
+
import { FORM_FIELD_STATES } from '../FormField.consts';
|
|
7
|
+
|
|
8
|
+
const id = 'message-id';
|
|
9
|
+
|
|
10
|
+
function setup(
|
|
11
|
+
props: ComponentProps<typeof FormFieldMessage> = {
|
|
12
|
+
messageId: id,
|
|
13
|
+
},
|
|
14
|
+
) {
|
|
15
|
+
return mount(FormFieldMessage, {
|
|
16
|
+
props,
|
|
17
|
+
slots: {
|
|
18
|
+
default: () => 'Test message',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe('FormFieldMessage', () => {
|
|
24
|
+
it('should render', () => {
|
|
25
|
+
const wrapper = setup();
|
|
26
|
+
|
|
27
|
+
expect(wrapper.exists()).toBe(true);
|
|
28
|
+
expect(wrapper.text()).toBe('Test message');
|
|
29
|
+
expect(wrapper.attributes('id')).toBe(id);
|
|
30
|
+
expect(wrapper.findComponent(Icon).exists()).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it.each([
|
|
34
|
+
{
|
|
35
|
+
state: FORM_FIELD_STATES.ERROR,
|
|
36
|
+
expectedIcon: ICONS.FA_CIRCLE_EXCLAMATION,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
state: FORM_FIELD_STATES.SUCCESS,
|
|
40
|
+
expectedIcon: ICONS.FA_CIRCLE_CHECK,
|
|
41
|
+
},
|
|
42
|
+
])('should render icon for state: $state', ({ state, expectedIcon }) => {
|
|
43
|
+
const wrapper = setup({
|
|
44
|
+
state,
|
|
45
|
+
messageId: id,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
expect(wrapper.exists()).toBe(true);
|
|
49
|
+
expect(wrapper.text()).toBe('Test message');
|
|
50
|
+
expect(wrapper.findComponent(Icon).exists()).toBe(true);
|
|
51
|
+
expect(wrapper.findComponent(Icon).props().icon).toEqual(expectedIcon);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import FormFieldMessage from './FormFieldMessage.vue';
|
|
3
|
+
import { ComponentProps, ComponentSlots } from 'vue-component-type-helpers';
|
|
4
|
+
import { FORM_FIELD_STATES } from '../FormField.consts';
|
|
5
|
+
import Icon, { ICONS, ICON_SIZES } from '../../../Icons/Icon';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<
|
|
8
|
+
ComponentProps<typeof FormFieldMessage> & ComponentSlots<typeof FormFieldMessage>
|
|
9
|
+
> = {
|
|
10
|
+
title: 'Components/Form/FormFieldMessage',
|
|
11
|
+
component: FormFieldMessage,
|
|
12
|
+
render: (args) => ({
|
|
13
|
+
components: { FormFieldMessage },
|
|
14
|
+
setup() {
|
|
15
|
+
return {
|
|
16
|
+
args,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
template: `<FormFieldMessage v-bind="args">
|
|
20
|
+
<div v-html="args.default" />
|
|
21
|
+
</FormFieldMessage>`,
|
|
22
|
+
}),
|
|
23
|
+
argTypes: {
|
|
24
|
+
state: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: Object.values(FORM_FIELD_STATES),
|
|
27
|
+
},
|
|
28
|
+
messageId: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
},
|
|
31
|
+
default: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'Default slot content for the message.',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
type Story = StoryObj<typeof FormFieldMessage>;
|
|
40
|
+
|
|
41
|
+
export const Interactive: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
default: 'Message',
|
|
44
|
+
messageId: 'message-id',
|
|
45
|
+
state: FORM_FIELD_STATES.DEFAULT,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Interactive.parameters = {
|
|
50
|
+
design: {
|
|
51
|
+
type: 'figma',
|
|
52
|
+
url: 'https://www.figma.com/design/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?node-id=13364-13669&m=dev',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const WithInlineIcons: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
messageId: 'message-id',
|
|
59
|
+
state: FORM_FIELD_STATES.DEFAULT,
|
|
60
|
+
},
|
|
61
|
+
render: (args) => ({
|
|
62
|
+
components: { FormFieldMessage, Icon },
|
|
63
|
+
setup() {
|
|
64
|
+
return {
|
|
65
|
+
args,
|
|
66
|
+
ICONS,
|
|
67
|
+
ICON_SIZES,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
template: `<FormFieldMessage v-bind="args">
|
|
71
|
+
Message with inline <Icon :icon="ICONS.FA_ADDRESS_CARD" :size="ICON_SIZES.XX_SMALL" /> icon
|
|
72
|
+
</FormFieldMessage>`,
|
|
73
|
+
}),
|
|
74
|
+
};
|