@propelinc/citrus-ui 0.6.0 → 1.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/README.md +54 -60
- package/dist/colors/colors.d.ts +31 -0
- package/dist/colors/theme.d.ts +2 -11
- package/dist/colors/util-classes.d.ts +11 -0
- package/dist/components/CAccordion.vue.d.ts +21 -0
- package/dist/components/CAccordionItem.vue.d.ts +41 -0
- package/dist/components/CAppBar.vue.d.ts +156 -0
- package/dist/components/CBadge.vue.d.ts +52 -0
- package/dist/components/CBottomSheet.vue.d.ts +226 -0
- package/dist/components/CButton/CButton.vue.d.ts +231 -0
- package/dist/components/CButton/types.d.ts +5 -0
- package/dist/components/CButtonStack.vue.d.ts +24 -0
- package/dist/components/CCard.vue.d.ts +107 -0
- package/dist/components/CCardFooter.vue.d.ts +26 -0
- package/dist/components/CCardHeader.vue.d.ts +3 -0
- package/dist/components/CCardSection.vue.d.ts +17 -0
- package/dist/components/CCheckbox.vue.d.ts +145 -0
- package/dist/components/CCol.vue.d.ts +21 -0
- package/dist/components/CDivider.vue.d.ts +17 -0
- package/dist/components/CDobField.vue.d.ts +2109 -0
- package/dist/components/CDobSelect.vue.d.ts +398 -0
- package/dist/components/CEmailField.vue.d.ts +699 -0
- package/dist/components/CExpandTransition.vue.d.ts +19 -0
- package/dist/components/CFadeTransition.vue.d.ts +3 -0
- package/dist/components/CFileInput.vue.d.ts +98 -0
- package/dist/components/CFixedPageFooter.vue.d.ts +106 -0
- package/dist/components/CForm.vue.d.ts +29 -0
- package/dist/components/CFormFieldCounter.vue.d.ts +42 -0
- package/dist/components/CIconButton.vue.d.ts +390 -0
- package/dist/components/CLabel.vue.d.ts +32 -0
- package/dist/components/CListItem.vue.d.ts +208 -0
- package/dist/components/CListItemContent.vue.d.ts +27 -0
- package/dist/components/CListItemIcon.vue.d.ts +54 -0
- package/dist/components/CLoader.vue.d.ts +73 -0
- package/dist/components/CLogo.vue.d.ts +19 -0
- package/dist/components/CMaskedTextField.vue.d.ts +2012 -0
- package/dist/components/CMenu.vue.d.ts +6 -0
- package/dist/components/CMenuItem.vue.d.ts +170 -0
- package/dist/components/CMenuLabel.vue.d.ts +3 -0
- package/dist/components/CModal.vue.d.ts +206 -0
- package/dist/components/CModalLoading.vue.d.ts +230 -0
- package/dist/components/CNotification.vue.d.ts +589 -0
- package/dist/components/CPhoneField.vue.d.ts +2088 -0
- package/dist/components/CPill.vue.d.ts +42 -0
- package/dist/components/CPillGroup.vue.d.ts +70 -0
- package/dist/components/CPopup.vue.d.ts +21 -0
- package/dist/components/CProgressLinear.vue.d.ts +61 -0
- package/dist/components/CProgressRing.vue.d.ts +103 -0
- package/dist/components/CRadio.vue.d.ts +73 -0
- package/dist/components/CRadioGroup.vue.d.ts +123 -0
- package/dist/components/CRebrand.vue.d.ts +28 -0
- package/dist/components/CRow.vue.d.ts +67 -0
- package/dist/components/CSafeArea.vue.d.ts +18 -0
- package/dist/components/CSectionHeader.vue.d.ts +28 -0
- package/dist/components/CSelect.vue.d.ts +293 -0
- package/dist/components/CSkeleton.vue.d.ts +3 -0
- package/dist/components/CSkeletonLoaderCard.vue.d.ts +21 -0
- package/dist/components/CSkeletonLoaderCircle.vue.d.ts +5 -0
- package/dist/components/CSkeletonLoaderText.vue.d.ts +44 -0
- package/dist/components/CSlideFadeTransition.vue.d.ts +58 -0
- package/dist/components/CSplitInput.vue.d.ts +2131 -0
- package/dist/components/CSquaredIcon.vue.d.ts +47 -0
- package/dist/components/CSsnField.vue.d.ts +2083 -0
- package/dist/components/CStatusDot.vue.d.ts +27 -0
- package/dist/components/CSwitch.vue.d.ts +54 -0
- package/dist/components/CSwitchListItem.vue.d.ts +392 -0
- package/dist/components/CTextArea.vue.d.ts +240 -0
- package/dist/components/CTextField.vue.d.ts +647 -0
- package/dist/components/CTextLink.vue.d.ts +55 -0
- package/dist/components/CThirdPartyLogo.vue.d.ts +128 -0
- package/dist/components/CTimeago.vue.d.ts +12 -0
- package/dist/components/CToast.vue.d.ts +458 -0
- package/dist/components/CToastsList.vue.d.ts +430 -0
- package/dist/components/CValidationMessage.vue.d.ts +45 -0
- package/dist/components/CZipcodeField.vue.d.ts +2080 -0
- package/dist/components/index.d.ts +66 -25
- package/dist/components/internal/CCloseButton.vue.d.ts +14 -0
- package/dist/composables/accessibility.d.ts +1 -0
- package/dist/composables/animation.d.ts +12 -0
- package/dist/composables/binding.d.ts +19 -0
- package/dist/composables/colors.d.ts +13 -0
- package/dist/composables/elements.d.ts +3 -0
- package/dist/composables/fields.d.ts +9 -0
- package/dist/composables/gestures.d.ts +53 -0
- package/dist/composables/i18n.d.ts +3 -0
- package/dist/composables/id.d.ts +11 -0
- package/dist/composables/input-mask.d.ts +18 -0
- package/dist/composables/router.d.ts +30 -0
- package/dist/composables/slots.d.ts +2 -0
- package/dist/composables/toast.d.ts +21 -0
- package/dist/composables/validations.d.ts +77 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +11738 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plugin.d.ts +2 -2
- package/dist/services/animation.d.ts +17 -0
- package/dist/services/directives/index.d.ts +2 -0
- package/dist/services/directives/scroll-into-view.d.ts +7 -0
- package/dist/services/directives/tap-animation.d.ts +6 -0
- package/dist/services/id.d.ts +22 -0
- package/dist/services/injections/accordions.d.ts +3 -0
- package/dist/services/injections/animations.d.ts +2 -0
- package/dist/services/injections/buttons.d.ts +4 -0
- package/dist/services/injections/forms.d.ts +6 -0
- package/dist/services/injections/icon-buttons.d.ts +3 -0
- package/dist/services/injections/pills.d.ts +4 -0
- package/dist/services/injections/radio.d.ts +10 -0
- package/dist/styles/main.css +3002 -0
- package/dist/styles/utils.css +2319 -0
- package/dist/theme/icons.d.ts +35 -2
- package/dist/types/CForm.d.ts +12 -0
- package/dist/types/font-awesome.d.ts +5 -0
- package/dist/types.d.ts +12 -0
- package/index.ts +2 -0
- package/package.json +60 -45
- package/src/assets/fonts/grenette-regular.woff2 +0 -0
- package/src/assets/fonts/grenette-semibold.woff2 +0 -0
- package/src/assets/fonts/polymath.woff2 +0 -0
- package/src/assets/logos/propel/icon.svg +15 -0
- package/src/assets/logos/propel/lockup.svg +11 -0
- package/src/colors/colors.ts +173 -0
- package/src/colors/theme.ts +8 -14
- package/src/colors/util-classes.ts +49 -0
- package/src/componentResolver.js +33 -0
- package/src/components/CAccordion.vue +32 -7
- package/src/components/CAccordionItem.vue +109 -36
- package/src/components/CAppBar.vue +237 -0
- package/src/components/CBadge.vue +74 -0
- package/src/components/CBottomSheet.vue +430 -0
- package/src/components/CButton/CButton.vue +347 -0
- package/src/components/CButton/types.ts +5 -0
- package/src/components/CButtonStack.vue +36 -0
- package/src/components/CCard.vue +149 -41
- package/src/components/CCardFooter.vue +11 -27
- package/src/components/CCardHeader.vue +30 -21
- package/src/components/CCardSection.vue +23 -12
- package/src/components/CCheckbox.vue +191 -21
- package/src/components/CCol.vue +55 -0
- package/src/components/CDivider.vue +46 -0
- package/src/components/CDobField.vue +153 -0
- package/src/components/CDobSelect.vue +274 -0
- package/src/components/CEmailField.vue +61 -0
- package/src/components/CExpandTransition.vue +55 -0
- package/src/components/CFadeTransition.vue +23 -0
- package/src/components/CFileInput.vue +186 -0
- package/src/components/CFixedPageFooter.vue +76 -0
- package/src/components/CForm.vue +86 -0
- package/src/components/CFormFieldCounter.vue +40 -0
- package/src/components/CIconButton.vue +175 -59
- package/src/components/CLabel.vue +52 -0
- package/src/components/CListItem.vue +149 -45
- package/src/components/CListItemContent.vue +60 -0
- package/src/components/CListItemIcon.vue +27 -31
- package/src/components/CLoader.vue +156 -0
- package/src/components/CLogo.vue +23 -0
- package/src/components/CMaskedTextField.vue +118 -0
- package/src/components/CMenu.vue +24 -0
- package/src/components/CMenuItem.vue +106 -0
- package/src/components/CMenuLabel.vue +26 -0
- package/src/components/CModal.vue +198 -79
- package/src/components/CModalLoading.vue +27 -9
- package/src/components/CNotification.vue +86 -53
- package/src/components/CPhoneField.vue +69 -0
- package/src/components/CPill.vue +162 -0
- package/src/components/CPillGroup.vue +73 -0
- package/src/components/CPopup.vue +66 -0
- package/src/components/CProgressLinear.vue +52 -0
- package/src/components/CProgressRing.vue +126 -0
- package/src/components/CRadio.vue +138 -0
- package/src/components/CRadioGroup.vue +142 -0
- package/src/components/CRebrand.vue +28 -0
- package/src/components/CRow.vue +62 -0
- package/src/components/CSafeArea.vue +23 -0
- package/src/components/CSectionHeader.vue +50 -0
- package/src/components/CSelect.vue +223 -74
- package/src/components/CSkeleton.vue +65 -0
- package/src/components/CSkeletonLoaderCard.vue +29 -0
- package/src/components/CSkeletonLoaderCircle.vue +18 -14
- package/src/components/CSkeletonLoaderText.vue +127 -17
- package/src/components/CSlideFadeTransition.vue +100 -0
- package/src/components/CSplitInput.vue +111 -0
- package/src/components/CSquaredIcon.vue +83 -0
- package/src/components/CSsnField.vue +86 -0
- package/src/components/CStatusDot.vue +70 -0
- package/src/components/CSwitch.vue +125 -0
- package/src/components/CSwitchListItem.vue +110 -0
- package/src/components/CTextArea.vue +193 -47
- package/src/components/CTextField.vue +450 -93
- package/src/components/CTextLink.vue +48 -38
- package/src/components/CThirdPartyLogo.vue +127 -0
- package/src/components/CTimeago.vue +63 -0
- package/src/components/CToast.vue +259 -0
- package/src/components/CToastsList.vue +32 -0
- package/src/components/CValidationMessage.vue +70 -0
- package/src/components/CZipcodeField.vue +69 -0
- package/src/components/index.ts +66 -25
- package/src/components/internal/CCloseButton.vue +57 -0
- package/src/composables/accessibility.ts +29 -0
- package/src/composables/animation.ts +95 -0
- package/src/composables/binding.ts +34 -0
- package/src/composables/colors.ts +59 -0
- package/src/composables/elements.ts +72 -0
- package/src/composables/fields.ts +19 -0
- package/src/composables/gestures.ts +197 -0
- package/src/composables/i18n.ts +13 -0
- package/src/composables/id.ts +23 -0
- package/src/composables/input-mask.ts +139 -0
- package/src/composables/router.ts +64 -0
- package/src/composables/slots.ts +57 -0
- package/src/composables/toast.ts +64 -0
- package/src/composables/validations.ts +214 -0
- package/src/index.ts +7 -7
- package/src/plugin.ts +13 -6
- package/src/services/animation.ts +101 -0
- package/src/services/directives/index.ts +2 -0
- package/src/services/directives/scroll-into-view.ts +86 -0
- package/src/services/directives/tap-animation.ts +71 -0
- package/src/services/id.ts +31 -0
- package/src/services/injections/accordions.ts +4 -0
- package/src/services/injections/animations.ts +3 -0
- package/src/services/injections/buttons.ts +5 -0
- package/src/services/injections/forms.ts +8 -0
- package/src/services/injections/icon-buttons.ts +4 -0
- package/src/services/injections/pills.ts +7 -0
- package/src/services/injections/radio.ts +12 -0
- package/src/shims-vue.d.ts +6 -3
- package/src/styles/_animation.scss +19 -0
- package/src/styles/_button.scss +61 -0
- package/src/styles/_colors.scss +58 -11
- package/src/styles/_core.scss +248 -87
- package/src/styles/_form-fields.scss +68 -15
- package/src/styles/_grenette.scss +13 -0
- package/src/styles/_polymath.scss +14 -0
- package/src/styles/_reset.scss +105 -0
- package/src/styles/_shoelace.scss +46 -0
- package/src/styles/_typography.scss +40 -10
- package/src/styles/main.scss +6 -3
- package/src/styles/utils/a11y.scss +18 -0
- package/src/styles/utils/typography.scss +13 -0
- package/src/styles/utils.scss +560 -0
- package/src/styles/variables.scss +27 -15
- package/src/theme/icons.ts +16 -5
- package/src/types/CForm.ts +15 -0
- package/src/types/font-awesome.ts +6 -0
- package/src/types.ts +15 -0
- package/.browserslistrc +0 -3
- package/.eslintrc.js +0 -4
- package/.stylelintrc.js +0 -3
- package/babel.config.js +0 -3
- package/dist/citrus-ui.common.js +0 -43434
- package/dist/citrus-ui.common.js.map +0 -1
- package/dist/citrus-ui.css +0 -1
- package/dist/citrus-ui.umd.js +0 -43444
- package/dist/citrus-ui.umd.js.map +0 -1
- package/dist/citrus-ui.umd.min.js +0 -27
- package/dist/citrus-ui.umd.min.js.map +0 -1
- package/dist/demo.html +0 -10
- package/dist/fonts/Blitz-Script.85ed9abe.woff2 +0 -0
- package/dist/fonts/ObjectSans-Bold.5492f3d5.woff2 +0 -0
- package/dist/fonts/ObjectSans-BoldSlanted.29e2a87e.woff2 +0 -0
- package/dist/fonts/ObjectSans-Heavy.d0b2f035.woff2 +0 -0
- package/dist/fonts/ObjectSans-HeavySlanted.45e9c063.woff2 +0 -0
- package/dist/fonts/ObjectSans-Light.f885dec3.woff2 +0 -0
- package/dist/fonts/ObjectSans-LightSlanted.b8eb7c12.woff2 +0 -0
- package/dist/fonts/ObjectSans-Regular.e4ea0b90.woff2 +0 -0
- package/dist/fonts/ObjectSans-Slanted.57a90be9.woff2 +0 -0
- package/dist/fonts/ObjectSans-Thin.86d44227.woff2 +0 -0
- package/dist/fonts/ObjectSans-ThinSlanted.20342160.woff2 +0 -0
- package/jest.config.js +0 -9
- package/plopfile.js +0 -67
- package/project.json +0 -69
- package/src/assets/fonts/Blitz-Script.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-Bold.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-BoldSlanted.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-Heavy.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-HeavySlanted.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-Light.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-LightSlanted.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-Regular.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-Slanted.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-Thin.woff2 +0 -0
- package/src/assets/fonts/ObjectSans-ThinSlanted.woff2 +0 -0
- package/src/components/CAlert.vue +0 -78
- package/src/components/CBanner.vue +0 -47
- package/src/components/CButton.vue +0 -146
- package/src/components/CListItemAction.vue +0 -29
- package/src/components/CSegmentedButton.vue +0 -47
- package/src/components/CSegmentedButtonOption.vue +0 -42
- package/src/components/helpers/FormField.vue +0 -48
- package/src/components/helpers/SelectInput.vue +0 -115
- package/src/shims-scss.d.ts +0 -4
- package/src/shims-vuetify.d.ts +0 -4
- package/src/styles/_blitz.scss +0 -8
- package/src/styles/_object-sans.scss +0 -23
- package/storybook-static/0.799c368cbe88266827ba.manager.bundle.js +0 -1
- package/storybook-static/0.a9f0a9ad.iframe.bundle.js +0 -3
- package/storybook-static/0.a9f0a9ad.iframe.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/0.a9f0a9ad.iframe.bundle.js.map +0 -1
- package/storybook-static/1.0438fd8d.iframe.bundle.js +0 -3
- package/storybook-static/1.0438fd8d.iframe.bundle.js.LICENSE.txt +0 -17
- package/storybook-static/1.0438fd8d.iframe.bundle.js.map +0 -1
- package/storybook-static/1.9ebd2fb519f6726108de.manager.bundle.js +0 -1
- package/storybook-static/10.348d8814.iframe.bundle.js +0 -3
- package/storybook-static/10.348d8814.iframe.bundle.js.LICENSE.txt +0 -30
- package/storybook-static/10.348d8814.iframe.bundle.js.map +0 -1
- package/storybook-static/10.a85ea1a67689be8e19ff.manager.bundle.js +0 -1
- package/storybook-static/11.f4e922583ae35da460f3.manager.bundle.js +0 -2
- package/storybook-static/11.f4e922583ae35da460f3.manager.bundle.js.LICENSE.txt +0 -12
- package/storybook-static/12.1415460941f0bdcb8fa8.manager.bundle.js +0 -1
- package/storybook-static/2.75a17459.iframe.bundle.js +0 -3
- package/storybook-static/2.75a17459.iframe.bundle.js.LICENSE.txt +0 -26
- package/storybook-static/2.75a17459.iframe.bundle.js.map +0 -1
- package/storybook-static/5.f459d151315e6780c20f.manager.bundle.js +0 -2
- package/storybook-static/5.f459d151315e6780c20f.manager.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/6.3bd64d820f3745f262ff.manager.bundle.js +0 -1
- package/storybook-static/6.ce8d99b4.iframe.bundle.js +0 -1
- package/storybook-static/7.3d04765dbf3f1dcd706c.manager.bundle.js +0 -1
- package/storybook-static/7.6633a922.iframe.bundle.js +0 -3
- package/storybook-static/7.6633a922.iframe.bundle.js.LICENSE.txt +0 -12
- package/storybook-static/7.6633a922.iframe.bundle.js.map +0 -1
- package/storybook-static/8.b541eadfcb9164835dfc.manager.bundle.js +0 -1
- package/storybook-static/8.fc5e1ebf.iframe.bundle.js +0 -1
- package/storybook-static/9.411ac8e451bbb10926c7.manager.bundle.js +0 -1
- package/storybook-static/9.724ac3ed.iframe.bundle.js +0 -3
- package/storybook-static/9.724ac3ed.iframe.bundle.js.LICENSE.txt +0 -15
- package/storybook-static/9.724ac3ed.iframe.bundle.js.map +0 -1
- package/storybook-static/css/main.95216119.css +0 -1
- package/storybook-static/css/vendors~main.02dc89bf.css +0 -1
- package/storybook-static/favicon.ico +0 -0
- package/storybook-static/fonts/Blitz-Script.85ed9abe.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-Bold.5492f3d5.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-BoldSlanted.29e2a87e.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-Heavy.d0b2f035.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-HeavySlanted.45e9c063.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-Light.f885dec3.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-LightSlanted.b8eb7c12.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-Regular.e4ea0b90.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-Slanted.57a90be9.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-Thin.86d44227.woff2 +0 -0
- package/storybook-static/fonts/ObjectSans-ThinSlanted.20342160.woff2 +0 -0
- package/storybook-static/iframe.html +0 -348
- package/storybook-static/index.html +0 -51
- package/storybook-static/main.7b4aec9c4352d4bb535b.manager.bundle.js +0 -1
- package/storybook-static/main.9e8c64c7.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.91a0c7330ab317d35c4a.manager.bundle.js +0 -1
- package/storybook-static/runtime~main.e4da100f.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.6660eda6.iframe.bundle.js +0 -7
- package/storybook-static/vendors~main.6660eda6.iframe.bundle.js.LICENSE.txt +0 -80
- package/storybook-static/vendors~main.6660eda6.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.f7f16cebbf3aa96a4f89.manager.bundle.js +0 -2
- package/storybook-static/vendors~main.f7f16cebbf3aa96a4f89.manager.bundle.js.LICENSE.txt +0 -110
- package/tsconfig.dist.json +0 -7
- package/tsconfig.json +0 -24
- package/vue.config.js +0 -5
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="id" class="c-dob-select" :data-test="dataTest">
|
|
3
|
+
<slot name="label">
|
|
4
|
+
<label
|
|
5
|
+
v-if="!hideLabel"
|
|
6
|
+
class="c-dob-select__label"
|
|
7
|
+
:for="`${id}-month`"
|
|
8
|
+
:data-test="`${dataTest}-label`"
|
|
9
|
+
>{{ computedLabel }}</label
|
|
10
|
+
>
|
|
11
|
+
</slot>
|
|
12
|
+
<div class="c-dob-select__container">
|
|
13
|
+
<c-select
|
|
14
|
+
:id="`${id}-month`"
|
|
15
|
+
class="c-dob-select__field"
|
|
16
|
+
hide-label
|
|
17
|
+
hide-details
|
|
18
|
+
:value="localMonth"
|
|
19
|
+
:data-test="`${dataTest}-month`"
|
|
20
|
+
:aria-label="$t('Month')"
|
|
21
|
+
:placeholder="$t('Month')"
|
|
22
|
+
:items="monthOptions"
|
|
23
|
+
:rules="monthRules"
|
|
24
|
+
:required="required"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
@input="(localMonth = $event) && emitDate()"
|
|
27
|
+
@focus="$emit('focus')"
|
|
28
|
+
@blur="$emit('blur')"
|
|
29
|
+
/>
|
|
30
|
+
<c-select
|
|
31
|
+
:id="`${id}-day`"
|
|
32
|
+
class="c-dob-select__field"
|
|
33
|
+
hide-label
|
|
34
|
+
hide-details
|
|
35
|
+
:value="localDay"
|
|
36
|
+
:aria-label="$t('Day')"
|
|
37
|
+
:placeholder="$t('Day')"
|
|
38
|
+
:data-test="`${dataTest}-day`"
|
|
39
|
+
:items="dayOptions"
|
|
40
|
+
:rules="dayRules"
|
|
41
|
+
:required="required"
|
|
42
|
+
:disabled="disabled"
|
|
43
|
+
@input="(localDay = $event) && emitDate()"
|
|
44
|
+
@focus="$emit('focus')"
|
|
45
|
+
@blur="$emit('blur')"
|
|
46
|
+
/>
|
|
47
|
+
<c-select
|
|
48
|
+
:id="`${id}-year`"
|
|
49
|
+
class="c-dob-select__field"
|
|
50
|
+
hide-label
|
|
51
|
+
hide-details
|
|
52
|
+
:value="localYear"
|
|
53
|
+
:aria-label="$t('Year')"
|
|
54
|
+
:placeholder="$t('Year')"
|
|
55
|
+
:data-test="`${dataTest}-year`"
|
|
56
|
+
:items="yearOptions"
|
|
57
|
+
:rules="yearRules"
|
|
58
|
+
:required="required"
|
|
59
|
+
:disabled="disabled"
|
|
60
|
+
@input="(localYear = $event) && emitDate()"
|
|
61
|
+
@focus="$emit('focus')"
|
|
62
|
+
@blur="$emit('blur')"
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
<CValidationMessage
|
|
66
|
+
class="c-dob-select__messages"
|
|
67
|
+
:data-test="`${dataTest}-messages`"
|
|
68
|
+
:validation-message="message"
|
|
69
|
+
:hide="hideDetails"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script lang="ts">
|
|
75
|
+
import dayjs from 'dayjs';
|
|
76
|
+
import { type PropType, computed, defineComponent, ref, watch } from 'vue';
|
|
77
|
+
|
|
78
|
+
import CSelect from '@propelinc/citrus-ui/src/components/CSelect.vue';
|
|
79
|
+
import CValidationMessage from '@propelinc/citrus-ui/src/components/CValidationMessage.vue';
|
|
80
|
+
import { useTranslation } from '@propelinc/citrus-ui/src/composables/i18n';
|
|
81
|
+
import {
|
|
82
|
+
type Rules,
|
|
83
|
+
useFormValidationSupport,
|
|
84
|
+
} from '@propelinc/citrus-ui/src/composables/validations';
|
|
85
|
+
|
|
86
|
+
export default defineComponent({
|
|
87
|
+
name: 'CDobSelect',
|
|
88
|
+
components: { CSelect, CValidationMessage },
|
|
89
|
+
props: {
|
|
90
|
+
dataTest: { type: String, default: 'dob-select' },
|
|
91
|
+
id: { type: String, default: undefined },
|
|
92
|
+
label: { type: String as PropType<string | null>, default: null },
|
|
93
|
+
required: { type: Boolean, default: false },
|
|
94
|
+
rules: { type: Array as PropType<Rules<string>>, default: () => [] },
|
|
95
|
+
hideLabel: { type: Boolean, default: false },
|
|
96
|
+
hideDetails: { type: Boolean, default: false },
|
|
97
|
+
value: { type: String, default: '' },
|
|
98
|
+
disabled: { type: Boolean, default: false },
|
|
99
|
+
},
|
|
100
|
+
emits: ['input', 'focus', 'blur'],
|
|
101
|
+
setup(props, { emit }) {
|
|
102
|
+
const { t } = useTranslation();
|
|
103
|
+
|
|
104
|
+
const computedLabel = computed(() => props.label ?? t('Date of birth'));
|
|
105
|
+
|
|
106
|
+
const localMonth = ref('');
|
|
107
|
+
const localDay = ref('');
|
|
108
|
+
const localYear = ref('');
|
|
109
|
+
|
|
110
|
+
const hasError = ref(props.required && props.value === '');
|
|
111
|
+
const messages = ref<string[]>([]);
|
|
112
|
+
|
|
113
|
+
const localValue = computed(() => {
|
|
114
|
+
if (localDay.value && localMonth.value && localYear.value) {
|
|
115
|
+
return `${localYear.value}-${localMonth.value}-${localDay.value}`;
|
|
116
|
+
}
|
|
117
|
+
return '';
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const monthRules = computed(() => {
|
|
121
|
+
if (!props.required && !localMonth.value) {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
return [(): boolean => localMonth.value !== ''];
|
|
125
|
+
});
|
|
126
|
+
const dayRules = computed(() => {
|
|
127
|
+
if (!props.required && !localDay.value) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
return [(): boolean => localDay.value !== ''];
|
|
131
|
+
});
|
|
132
|
+
const yearRules = computed(() => {
|
|
133
|
+
if (!props.required && !localYear.value) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
return [(): boolean => localYear.value !== ''];
|
|
137
|
+
});
|
|
138
|
+
const message = computed(() => messages.value[0] ?? '');
|
|
139
|
+
|
|
140
|
+
const monthOptions = Array.from({ length: 12 }, (_, i) => ({
|
|
141
|
+
value: (i + 1).toString().padStart(2, '0'),
|
|
142
|
+
label: dayjs().set('month', i).format('MMM'),
|
|
143
|
+
}));
|
|
144
|
+
|
|
145
|
+
const dayOptions = computed(() => {
|
|
146
|
+
const year = Number(localYear.value) || 2000;
|
|
147
|
+
const month = Number(localMonth.value) - 1 || 0;
|
|
148
|
+
const daysInMonth = dayjs().year(year).month(month).daysInMonth();
|
|
149
|
+
return Array.from({ length: daysInMonth }, (_, i) => {
|
|
150
|
+
const day = (i + 1).toString();
|
|
151
|
+
return { value: day.padStart(2, '0'), label: day };
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const currentYear = dayjs().year();
|
|
156
|
+
const yearOptions = Array.from({ length: 120 }, (_, age) => {
|
|
157
|
+
const year = (currentYear - age).toString();
|
|
158
|
+
return { value: year, label: year };
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const validationMessage = t('Please enter a valid {inputLabel}', {
|
|
162
|
+
inputLabel: t('date of birth'),
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const localRules = computed(() => {
|
|
166
|
+
if (!props.required && !localValue.value) {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
const validDateRule = (v: string): boolean | string =>
|
|
170
|
+
dayjs(v, 'YYYY-MM-DD', true).isValid() || validationMessage;
|
|
171
|
+
return [validDateRule, ...props.rules];
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const valid = computed(() => !hasError.value);
|
|
175
|
+
|
|
176
|
+
const validate = (): boolean => {
|
|
177
|
+
messages.value = localRules.value
|
|
178
|
+
.map((validation) => {
|
|
179
|
+
const validationResult = validation(localValue.value);
|
|
180
|
+
return typeof validationResult === 'string' ? validationResult : '';
|
|
181
|
+
})
|
|
182
|
+
.filter((message) => message !== '');
|
|
183
|
+
|
|
184
|
+
hasError.value = (props.required && localValue.value === '') || messages.value.length > 0;
|
|
185
|
+
return !hasError.value;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const emitDate = (): void => {
|
|
189
|
+
if (!localValue.value) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (!validate()) {
|
|
194
|
+
// NOTE(ram): An invalid date can only be caused by the day being invalid.
|
|
195
|
+
localDay.value = '';
|
|
196
|
+
emit('input', '');
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
emit('input', localValue.value);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
watch(
|
|
204
|
+
() => props.value,
|
|
205
|
+
(value) => {
|
|
206
|
+
if (!value || value === localValue.value) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const date = dayjs(value, 'YYYY-MM-DD', true);
|
|
211
|
+
if (!date.isValid()) {
|
|
212
|
+
console.error('Invalid date in CDobSelect', value);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
localMonth.value = date.format('MM');
|
|
217
|
+
localDay.value = date.format('DD');
|
|
218
|
+
localYear.value = date.format('YYYY');
|
|
219
|
+
},
|
|
220
|
+
{ immediate: true }
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
useFormValidationSupport({
|
|
224
|
+
id: props.id,
|
|
225
|
+
valid,
|
|
226
|
+
validate,
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
localDay,
|
|
231
|
+
localMonth,
|
|
232
|
+
localYear,
|
|
233
|
+
dayRules,
|
|
234
|
+
monthRules,
|
|
235
|
+
yearRules,
|
|
236
|
+
dayOptions,
|
|
237
|
+
monthOptions,
|
|
238
|
+
yearOptions,
|
|
239
|
+
|
|
240
|
+
computedLabel,
|
|
241
|
+
hasError,
|
|
242
|
+
messages,
|
|
243
|
+
localValue,
|
|
244
|
+
message,
|
|
245
|
+
|
|
246
|
+
emitDate,
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
</script>
|
|
251
|
+
|
|
252
|
+
<style lang="scss" scoped>
|
|
253
|
+
@import '@propelinc/citrus-ui/src/styles/core';
|
|
254
|
+
|
|
255
|
+
.c-dob-select__label {
|
|
256
|
+
@include body-emphasized;
|
|
257
|
+
|
|
258
|
+
display: inline-block;
|
|
259
|
+
margin-bottom: 4px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.c-dob-select__container {
|
|
263
|
+
display: flex;
|
|
264
|
+
gap: 12px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.c-dob-select__field {
|
|
268
|
+
flex: auto;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.c-dob-select__messages {
|
|
272
|
+
margin-top: 4px;
|
|
273
|
+
}
|
|
274
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<CTextField
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
:id="id"
|
|
5
|
+
:value="value"
|
|
6
|
+
:data-test="dataTest"
|
|
7
|
+
type="email"
|
|
8
|
+
name="email"
|
|
9
|
+
:rules="[...defaultRules, ...rules]"
|
|
10
|
+
:label="label || $t('Email')"
|
|
11
|
+
:placeholder="placeholder || $t('example@email.com')"
|
|
12
|
+
@input="$emit('input', $event)"
|
|
13
|
+
@focus="$emit('focus', $event)"
|
|
14
|
+
@blur="$emit('blur', $event)"
|
|
15
|
+
@change="$emit('change', $event)"
|
|
16
|
+
>
|
|
17
|
+
<template #label>
|
|
18
|
+
<slot name="label" />
|
|
19
|
+
</template>
|
|
20
|
+
<template #message>
|
|
21
|
+
<slot name="message" />
|
|
22
|
+
</template>
|
|
23
|
+
</CTextField>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
import { type PropType, defineComponent } from 'vue';
|
|
28
|
+
|
|
29
|
+
import CTextField from '@propelinc/citrus-ui/src/components/CTextField.vue';
|
|
30
|
+
import { useTranslation } from '@propelinc/citrus-ui/src/composables/i18n';
|
|
31
|
+
import type { Rules } from '@propelinc/citrus-ui/src/composables/validations';
|
|
32
|
+
import { isValidEmail } from '@propelinc/shared-utils';
|
|
33
|
+
|
|
34
|
+
export default defineComponent({
|
|
35
|
+
name: 'CEmailField',
|
|
36
|
+
components: { CTextField },
|
|
37
|
+
props: {
|
|
38
|
+
dataTest: { type: String, default: 'email-field' },
|
|
39
|
+
id: { type: String, default: undefined },
|
|
40
|
+
label: { type: String as PropType<string | null>, default: null },
|
|
41
|
+
placeholder: { type: String as PropType<string | null>, default: null },
|
|
42
|
+
rules: { type: Array as PropType<Rules<string>>, default: () => [] },
|
|
43
|
+
value: { type: String, default: '' },
|
|
44
|
+
},
|
|
45
|
+
emits: ['input', 'focus', 'blur', 'change'],
|
|
46
|
+
setup() {
|
|
47
|
+
const { t } = useTranslation();
|
|
48
|
+
|
|
49
|
+
const defaultRules = [
|
|
50
|
+
(v: string): string | boolean =>
|
|
51
|
+
!v || isValidEmail(v)
|
|
52
|
+
? true
|
|
53
|
+
: t('Please enter a valid {inputLabel}', { inputLabel: t('email') }),
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
defaultRules,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
data-test="expand-transition"
|
|
4
|
+
class="c-expand-transition"
|
|
5
|
+
:class="{ 'c-expand-transition--disabled': isDisabled }"
|
|
6
|
+
:style="{ height: isDisabled ? undefined : height }"
|
|
7
|
+
>
|
|
8
|
+
<div ref="content" class="c-expand-transition__content">
|
|
9
|
+
<slot />
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { computed, defineComponent, inject, ref } from 'vue';
|
|
16
|
+
|
|
17
|
+
import { useResizeObserver } from '@propelinc/citrus-ui/src/composables/elements';
|
|
18
|
+
import { ANIMATIONS_DISABLED } from '@propelinc/citrus-ui/src/services/injections/animations';
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'CExpandTransition',
|
|
22
|
+
props: { disabled: { type: Boolean, default: false } },
|
|
23
|
+
setup(props) {
|
|
24
|
+
const injectedDisabled = inject(ANIMATIONS_DISABLED, ref(false));
|
|
25
|
+
const isDisabled = computed(() => props.disabled || injectedDisabled.value);
|
|
26
|
+
const content = ref<HTMLElement | null>(null);
|
|
27
|
+
const height = ref<string>('auto');
|
|
28
|
+
|
|
29
|
+
useResizeObserver(content, ([entry]) => {
|
|
30
|
+
height.value = `${entry.contentRect.height}px`;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return { content, height, isDisabled };
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style lang="scss" scoped>
|
|
39
|
+
@import '@propelinc/citrus-ui/src/styles/core';
|
|
40
|
+
|
|
41
|
+
.c-expand-transition {
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
transition: height 300ms ease;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.c-expand-transition__content {
|
|
47
|
+
// Create a new block formatting context that includes outer margins of children so
|
|
48
|
+
// CExpandTransition measures the height correctly.
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.c-expand-transition--disabled {
|
|
53
|
+
transition: none;
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Transition mode="out-in" name="fade">
|
|
3
|
+
<slot />
|
|
4
|
+
</Transition>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { defineComponent } from 'vue';
|
|
9
|
+
|
|
10
|
+
export default defineComponent({});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<style lang="scss" scoped>
|
|
14
|
+
.fade-enter-active,
|
|
15
|
+
.fade-leave-active {
|
|
16
|
+
transition: opacity 300ms ease-out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.fade-enter,
|
|
20
|
+
.fade-leave-to {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label class="c-file-input" :class="{ 'c-file-input--disabled': disabled }">
|
|
3
|
+
<p :id="`${idWithFallback}-label`" class="c-file-input__label" :data-test="`${dataTest}-label`">
|
|
4
|
+
<slot name="label">
|
|
5
|
+
{{ label }}
|
|
6
|
+
</slot>
|
|
7
|
+
</p>
|
|
8
|
+
<span :for="idWithFallback" class="c-file-input__prompt" :data-test="`${dataTest}-prompt`">
|
|
9
|
+
<slot name="prompt">
|
|
10
|
+
{{ prompt }}
|
|
11
|
+
</slot>
|
|
12
|
+
</span>
|
|
13
|
+
<input
|
|
14
|
+
:id="idWithFallback"
|
|
15
|
+
:data-test="`${dataTest}-input`"
|
|
16
|
+
class="c-file-input__input"
|
|
17
|
+
type="file"
|
|
18
|
+
:aria-describedby="`${idWithFallback}-files`"
|
|
19
|
+
:multiple="multiple"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
:required="required"
|
|
22
|
+
@change="onFileChange"
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
<div v-if="hasValue" :id="`${idWithFallback}-files`" class="c-file-input__files">
|
|
26
|
+
<span v-if="!Array.isArray(inputValue) && inputValue" class="c-file-input__file">{{
|
|
27
|
+
inputValue.name
|
|
28
|
+
}}</span>
|
|
29
|
+
<template v-if="Array.isArray(inputValue)">
|
|
30
|
+
<span v-for="file in inputValue" :key="file.name" class="c-file-input__file">
|
|
31
|
+
{{ file.name }}
|
|
32
|
+
</span></template
|
|
33
|
+
>
|
|
34
|
+
</div>
|
|
35
|
+
</label>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
import { type PropType, computed, defineComponent, toRefs } from 'vue';
|
|
40
|
+
|
|
41
|
+
import { useInternalValue } from '@propelinc/citrus-ui/src/composables/binding';
|
|
42
|
+
import { useId } from '@propelinc/citrus-ui/src/composables/id';
|
|
43
|
+
|
|
44
|
+
export default defineComponent({
|
|
45
|
+
name: 'CFileInput',
|
|
46
|
+
props: {
|
|
47
|
+
/** The input's label, both visual and screenreader-only */
|
|
48
|
+
label: { type: String, required: true },
|
|
49
|
+
/** Placholder text to display before a user has selected any files */
|
|
50
|
+
prompt: { type: String, required: true },
|
|
51
|
+
/** The input's value. Either one file or an array of files */
|
|
52
|
+
value: { type: [Array, Object, null] as PropType<File[] | File | null>, default: null },
|
|
53
|
+
/** A unique id for the input */
|
|
54
|
+
id: { type: String, required: true },
|
|
55
|
+
/** Allow the user to upload multiple files */
|
|
56
|
+
multiple: { type: Boolean, default: false },
|
|
57
|
+
/** Controls whether the input is disabled */
|
|
58
|
+
disabled: { type: Boolean, default: false },
|
|
59
|
+
/** Controls whether the input is required */
|
|
60
|
+
required: { type: Boolean, default: false },
|
|
61
|
+
/** A custom data-test string applied to the form field, text field and hide icon */
|
|
62
|
+
dataTest: { type: String, default: 'file-input' },
|
|
63
|
+
},
|
|
64
|
+
emits: ['input'],
|
|
65
|
+
setup(props, { emit }) {
|
|
66
|
+
const { id, value } = toRefs(props);
|
|
67
|
+
const idWithFallback = useId(id);
|
|
68
|
+
const inputValue = useInternalValue(value, {
|
|
69
|
+
onChange: (newValue) => {
|
|
70
|
+
emit('input', newValue);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const hasValue = computed(() => {
|
|
74
|
+
if (Array.isArray(inputValue.value)) {
|
|
75
|
+
return inputValue.value.length > 0;
|
|
76
|
+
}
|
|
77
|
+
return !!inputValue.value;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
function onFileChange(event: Event): void {
|
|
81
|
+
const files = (event.target as HTMLInputElement).files;
|
|
82
|
+
if (!files) {
|
|
83
|
+
inputValue.value = null;
|
|
84
|
+
} else {
|
|
85
|
+
inputValue.value = props.multiple ? Array.from(files) : files[0];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
idWithFallback,
|
|
91
|
+
inputValue,
|
|
92
|
+
hasValue,
|
|
93
|
+
onFileChange,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<style lang="scss" scoped>
|
|
100
|
+
@import '@propelinc/citrus-ui/src/styles/core';
|
|
101
|
+
@import '@propelinc/citrus-ui/src/styles/utils/a11y';
|
|
102
|
+
@import '@propelinc/citrus-ui/src/styles/button';
|
|
103
|
+
|
|
104
|
+
.c-file-input {
|
|
105
|
+
align-items: flex-start;
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
position: relative;
|
|
109
|
+
|
|
110
|
+
&:focus-within {
|
|
111
|
+
.c-file-input__prompt {
|
|
112
|
+
outline: var(--sl-focus-ring);
|
|
113
|
+
outline-offset: var(--sl-focus-ring-offset);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.c-file-input--disabled {
|
|
119
|
+
&:hover {
|
|
120
|
+
.c-file-input__prompt {
|
|
121
|
+
@include button-theme($color-gray-300, $color-gray-300, transparent);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.c-file-input__label {
|
|
126
|
+
color: $color-text-disabled;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.c-file-input__prompt {
|
|
130
|
+
@include button-theme($color-gray-300, $color-gray-300, transparent);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.c-file-input__input {
|
|
134
|
+
cursor: not-allowed;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.c-file-input__label {
|
|
139
|
+
@include body-emphasized;
|
|
140
|
+
|
|
141
|
+
margin-bottom: var(--sl-spacing-3x-small);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.c-file-input__prompt {
|
|
145
|
+
// NOTE(slanden): these styles are largely copied from sl-button defaults.
|
|
146
|
+
@include button-theme-secondary;
|
|
147
|
+
|
|
148
|
+
align-items: center;
|
|
149
|
+
border-radius: var(--sl-input-border-radius-medium);
|
|
150
|
+
border-style: solid;
|
|
151
|
+
border-width: $border-width;
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
font-family: var(--sl-input-font-family);
|
|
154
|
+
font-weight: var(--sl-font-weight-semibold);
|
|
155
|
+
height: $button-size-medium;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
padding: 0 20px;
|
|
158
|
+
transition: background-color 0.2s ease-in-out;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.c-file-input__input {
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
height: 100%;
|
|
164
|
+
inset: 0;
|
|
165
|
+
opacity: 0;
|
|
166
|
+
|
|
167
|
+
// NOTE(slanden): Rather than using the sr-only utility, we actually want to have
|
|
168
|
+
// the file input take up the full space of the label. This allows us to support
|
|
169
|
+
// default file input behavior, like drag-and-drop upload.
|
|
170
|
+
position: absolute;
|
|
171
|
+
width: 100%;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.c-file-input__files {
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
gap: var(--sl-spacing-3x-small);
|
|
178
|
+
margin-top: var(--sl-spacing-2x-small);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.c-file-input__file {
|
|
182
|
+
@include caption;
|
|
183
|
+
|
|
184
|
+
word-break: break-word;
|
|
185
|
+
}
|
|
186
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<CButtonStack
|
|
3
|
+
ref="footer"
|
|
4
|
+
data-test="fixed-page-footer"
|
|
5
|
+
:tag="tag"
|
|
6
|
+
large
|
|
7
|
+
class="c-fixed-page-footer"
|
|
8
|
+
>
|
|
9
|
+
<div class="c-fixed-page-footer__content">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</CButtonStack>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { computed, defineComponent, onBeforeUnmount, ref } from 'vue';
|
|
17
|
+
|
|
18
|
+
import CButtonStack from '@propelinc/citrus-ui/src/components/CButtonStack.vue';
|
|
19
|
+
import { useResizeObserver } from '@propelinc/citrus-ui/src/composables/elements';
|
|
20
|
+
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
name: 'CFixedPageFooter',
|
|
23
|
+
components: { CButtonStack },
|
|
24
|
+
props: {
|
|
25
|
+
/** The HTML tag to render as. Avoid changing this if possible. */
|
|
26
|
+
tag: { type: String, default: 'footer' },
|
|
27
|
+
},
|
|
28
|
+
emits: ['change:height'],
|
|
29
|
+
setup(_, { emit }) {
|
|
30
|
+
const footer = ref<InstanceType<typeof CButtonStack> | null>(null);
|
|
31
|
+
const footerElement = computed(() => (footer.value?.$el as HTMLElement) ?? null);
|
|
32
|
+
useResizeObserver(footerElement, ([entry]) => emit('change:height', entry.contentRect.height));
|
|
33
|
+
onBeforeUnmount(() => emit('change:height', 0));
|
|
34
|
+
|
|
35
|
+
return { footer };
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<style lang="scss" scoped>
|
|
41
|
+
@import '@propelinc/citrus-ui/src/styles/core';
|
|
42
|
+
|
|
43
|
+
$gradient-height: 32px;
|
|
44
|
+
|
|
45
|
+
.c-fixed-page-footer {
|
|
46
|
+
bottom: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
position: fixed;
|
|
49
|
+
right: 0;
|
|
50
|
+
|
|
51
|
+
// This places the footer above any Swiper components in the body which have z-index 1.
|
|
52
|
+
z-index: 1;
|
|
53
|
+
|
|
54
|
+
&::before {
|
|
55
|
+
// NOTE(mohan): We use rgba instead of `transparent` to avoid a bug in
|
|
56
|
+
// Safari where the gradient starts as tranparent black and fades into a
|
|
57
|
+
// gray.
|
|
58
|
+
background: linear-gradient(
|
|
59
|
+
to bottom,
|
|
60
|
+
rgba(255, 255, 255, 0) 0,
|
|
61
|
+
var(--fixed-page-footer-color, white) $gradient-height
|
|
62
|
+
);
|
|
63
|
+
content: '';
|
|
64
|
+
inset: -$gradient-height 0 0;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
position: absolute;
|
|
67
|
+
z-index: -1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// NOTE(mohan): ResizeObservers don't measure padding (at least not in all
|
|
72
|
+
// browsers), so we have to add it to a child element.
|
|
73
|
+
.c-fixed-page-footer__content {
|
|
74
|
+
padding: 0 16px max(env(safe-area-inset-bottom, 0), 8px);
|
|
75
|
+
}
|
|
76
|
+
</style>
|