@propelinc/citrus-ui 1.0.4 → 1.3.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 +51 -14
- package/dist/citrus-ui.cdn.css +1 -0
- package/dist/citrus-ui.css +1 -0
- package/dist/colors/colors.d.ts +31 -0
- package/dist/colors/theme.d.ts +3 -0
- package/dist/colors/util-classes.d.ts +11 -0
- package/dist/components/CAccordion.vue.d.ts +34 -0
- package/dist/components/CAccordionItem.vue.d.ts +39 -0
- package/dist/components/CAppBar.vue.d.ts +59 -0
- package/dist/components/CBadge.vue.d.ts +35 -0
- package/dist/components/CBottomSheet.vue.d.ts +90 -0
- package/dist/components/CButton/CButton.vue.d.ts +97 -0
- package/dist/components/CButton/types.d.ts +5 -0
- package/dist/components/CButtonStack.vue.d.ts +27 -0
- package/dist/components/CCard.vue.d.ts +53 -0
- package/dist/components/CCardFooter.vue.d.ts +20 -0
- package/dist/components/CCardHeader.vue.d.ts +22 -0
- package/dist/components/CCardSection.vue.d.ts +26 -0
- package/dist/components/CCheckbox.vue.d.ts +62 -0
- package/dist/components/CCol.vue.d.ts +30 -0
- package/dist/components/CDivider.vue.d.ts +9 -0
- package/dist/components/CDobField.vue.d.ts +60 -0
- package/dist/components/CDobSelect.vue.d.ts +50 -0
- package/dist/components/CEmailField.vue.d.ts +48 -0
- package/dist/components/CExpandTransition.vue.d.ts +29 -0
- package/dist/components/CFadeTransition.vue.d.ts +20 -0
- package/dist/components/CFileInput.vue.d.ts +50 -0
- package/dist/components/CFixedPageFooter.vue.d.ts +153 -0
- package/dist/components/CForm.vue.d.ts +44 -0
- package/dist/components/CFormFieldCounter.vue.d.ts +15 -0
- package/dist/components/CIconButton.vue.d.ts +97 -0
- package/dist/components/CLabel.vue.d.ts +36 -0
- package/dist/components/CListItem.vue.d.ts +56 -0
- package/dist/components/CListItemContent.vue.d.ts +27 -0
- package/dist/components/CListItemIcon.vue.d.ts +28 -0
- package/dist/components/CLoader.vue.d.ts +23 -0
- package/dist/components/CLogo.vue.d.ts +9 -0
- package/dist/components/CMaskedTextField.vue.d.ts +511 -0
- package/dist/components/CMenu.vue.d.ts +17 -0
- package/dist/components/CMenuItem.vue.d.ts +37 -0
- package/dist/components/CMenuLabel.vue.d.ts +20 -0
- package/dist/components/CModal.vue.d.ts +59 -0
- package/dist/components/CModalLoading.vue.d.ts +36 -0
- package/dist/components/CNotification.vue.d.ts +64 -0
- package/dist/components/CPhoneField.vue.d.ts +792 -0
- package/dist/components/CPill.vue.d.ts +41 -0
- package/dist/components/CPillGroup.vue.d.ts +39 -0
- package/dist/components/CPopup.vue.d.ts +37 -0
- package/dist/components/CProgressLinear.vue.d.ts +21 -0
- package/dist/components/CProgressRing.vue.d.ts +48 -0
- package/dist/components/CRadio.vue.d.ts +40 -0
- package/dist/components/CRadioGroup.vue.d.ts +54 -0
- package/dist/components/CRebrand.vue.d.ts +28 -0
- package/dist/components/CRow.vue.d.ts +41 -0
- package/dist/components/CSafeArea.vue.d.ts +18 -0
- package/dist/components/CSectionHeader.vue.d.ts +29 -0
- package/dist/components/CSelect.vue.d.ts +96 -0
- package/dist/components/CSkeleton.vue.d.ts +3 -0
- package/dist/components/CSkeletonLoaderCard.vue.d.ts +9 -0
- package/dist/components/CSkeletonLoaderCircle.vue.d.ts +3 -0
- package/dist/components/CSkeletonLoaderText.vue.d.ts +16 -0
- package/dist/components/CSlideFadeTransition.vue.d.ts +36 -0
- package/dist/components/CSplitInput.vue.d.ts +56 -0
- package/dist/components/CSquaredIcon.vue.d.ts +33 -0
- package/dist/components/CSsnField.vue.d.ts +798 -0
- package/dist/components/CStatusDot.vue.d.ts +10 -0
- package/dist/components/CSwitch.vue.d.ts +39 -0
- package/dist/components/CSwitchListItem.vue.d.ts +48 -0
- package/dist/components/CTextArea.vue.d.ts +96 -0
- package/dist/components/CTextField.vue.d.ts +129 -0
- package/dist/components/CTextLink.vue.d.ts +36 -0
- package/dist/components/CThirdPartyLogo.vue.d.ts +22 -0
- package/dist/components/CTimeago.vue.d.ts +12 -0
- package/dist/components/CToast.vue.d.ts +69 -0
- package/dist/components/CToastsList.vue.d.ts +3 -0
- package/dist/components/CValidationMessage.vue.d.ts +37 -0
- package/dist/components/CZipcodeField.vue.d.ts +796 -0
- package/dist/components/index.d.ts +66 -0
- 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 +10 -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/icons.cdn.mjs +3 -0
- package/dist/icons.cdn.mjs.map +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.mjs +6 -0
- package/dist/icons.mjs.map +1 -0
- package/dist/index.cdn.mjs +9328 -12875
- package/dist/index.cdn.mjs.map +1 -1
- package/dist/index.cdn2.mjs +55255 -0
- package/dist/index.cdn2.mjs.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +3946 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plugin.d.ts +3 -0
- 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 → styles.css} +40 -2
- package/dist/theme/icons.d.ts +36 -0
- package/dist/types/CForm.d.ts +12 -0
- package/dist/types/font-awesome.d.ts +5 -0
- package/dist/types.d.ts +13 -0
- package/package.json +11 -4
- package/src/colors/colors.ts +8 -3
- package/src/components/CAccordion.vue +31 -24
- package/src/components/CAccordionItem.vue +46 -45
- package/src/components/CAppBar.vue +108 -101
- package/src/components/CBadge.vue +33 -25
- package/src/components/CBottomSheet.vue +212 -199
- package/src/components/CButton/CButton.vue +135 -147
- package/src/components/CButtonStack.vue +21 -13
- package/src/components/CCard.vue +72 -69
- package/src/components/CCardFooter.vue +5 -5
- package/src/components/CCardHeader.vue +9 -7
- package/src/components/CCardSection.vue +15 -8
- package/src/components/CCheckbox.vue +68 -69
- package/src/components/CCol.vue +21 -22
- package/src/components/CDivider.vue +9 -8
- package/src/components/CDobField.vue +114 -105
- package/src/components/CDobSelect.vue +162 -164
- package/src/components/CEmailField.vue +39 -27
- package/src/components/CExpandTransition.vue +14 -17
- package/src/components/CFadeTransition.vue +3 -3
- package/src/components/CFileInput.vue +57 -50
- package/src/components/CFixedPageFooter.vue +23 -17
- package/src/components/CForm.vue +67 -60
- package/src/components/CFormFieldCounter.vue +25 -28
- package/src/components/CIconButton.vue +84 -65
- package/src/components/CLabel.vue +19 -13
- package/src/components/CListItem.vue +67 -66
- package/src/components/CListItemContent.vue +14 -16
- package/src/components/CListItemIcon.vue +18 -14
- package/src/components/CLoader.vue +47 -56
- package/src/components/CLogo.vue +13 -12
- package/src/components/CMaskedTextField.vue +80 -64
- package/src/components/CMenu.vue +14 -6
- package/src/components/CMenuItem.vue +28 -22
- package/src/components/CMenuLabel.vue +6 -5
- package/src/components/CModal.vue +76 -71
- package/src/components/CModalLoading.vue +24 -15
- package/src/components/CNotification.vue +77 -28
- package/src/components/CPhoneField.vue +34 -25
- package/src/components/CPill.vue +92 -88
- package/src/components/CPillGroup.vue +30 -21
- package/src/components/CPopup.vue +46 -37
- package/src/components/CProgressLinear.vue +17 -11
- package/src/components/CProgressRing.vue +33 -33
- package/src/components/CRadio.vue +57 -57
- package/src/components/CRadioGroup.vue +85 -72
- package/src/components/CRow.vue +22 -20
- package/src/components/CSectionHeader.vue +20 -12
- package/src/components/CSelect.vue +89 -73
- package/src/components/CSkeletonLoaderCard.vue +9 -15
- package/src/components/CSkeletonLoaderCircle.vue +1 -9
- package/src/components/CSkeletonLoaderText.vue +17 -18
- package/src/components/CSlideFadeTransition.vue +12 -34
- package/src/components/CSplitInput.vue +46 -45
- package/src/components/CSquaredIcon.vue +39 -29
- package/src/components/CSsnField.vue +48 -36
- package/src/components/CStatusDot.vue +16 -16
- package/src/components/CSwitch.vue +31 -22
- package/src/components/CSwitchListItem.vue +27 -28
- package/src/components/CTextArea.vue +116 -83
- package/src/components/CTextField.vue +194 -198
- package/src/components/CTextLink.vue +28 -25
- package/src/components/CThirdPartyLogo.vue +30 -59
- package/src/components/CToast.vue +135 -132
- package/src/components/CToastsList.vue +2 -15
- package/src/components/CValidationMessage.vue +31 -24
- package/src/components/CZipcodeField.vue +40 -27
- package/src/composables/elements.ts +1 -1
- package/src/composables/fields.ts +4 -4
- package/src/composables/router.ts +6 -5
- package/src/icons.ts +6 -0
- package/src/services/injections/buttons.ts +1 -1
- package/src/styles/_core.scss +1 -2
- package/src/styles/_reset.scss +1 -1
- package/src/styles/main.scss +2 -0
- package/src/types.ts +2 -0
- package/dist/index.cdn.css +0 -1
- package/dist/styles/utils.css +0 -2709
|
@@ -25,53 +25,53 @@
|
|
|
25
25
|
</span>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
|
-
<script lang="ts">
|
|
29
|
-
import {
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { computed } from 'vue';
|
|
30
|
+
import type { VNode } from 'vue';
|
|
30
31
|
|
|
31
32
|
import type Colors from '@propelinc/citrus-ui/src/colors/colors';
|
|
32
|
-
import {
|
|
33
|
+
import type { HexColor } from '@propelinc/citrus-ui/src/colors/colors';
|
|
33
34
|
import { useCssColor } from '@propelinc/citrus-ui/src/composables/colors';
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const props = withDefaults(
|
|
37
|
+
defineProps<{
|
|
37
38
|
/** Customizes screen reader only text alternative, should be translated */
|
|
38
|
-
accessibleText
|
|
39
|
+
accessibleText?: string;
|
|
39
40
|
/** Selector for testing */
|
|
40
|
-
dataTest
|
|
41
|
+
dataTest?: string;
|
|
41
42
|
/** The current progress, from 0 to valueMax */
|
|
42
|
-
value
|
|
43
|
+
value?: number | string;
|
|
43
44
|
/** Total progress */
|
|
44
|
-
valueMax
|
|
45
|
+
valueMax?: number | string;
|
|
45
46
|
/** The outer diameter of the progress ring, in px */
|
|
46
|
-
size
|
|
47
|
+
size?: number | string;
|
|
47
48
|
/** The width of the progress ring, in px */
|
|
48
|
-
trackWidth
|
|
49
|
+
trackWidth?: number | string;
|
|
49
50
|
/** Sets the indicator color */
|
|
50
|
-
color
|
|
51
|
-
type: String as PropType<HexColor | keyof typeof Colors>,
|
|
52
|
-
default: 'blue-500',
|
|
53
|
-
validator: isValidColor,
|
|
54
|
-
},
|
|
51
|
+
color?: HexColor | keyof typeof Colors;
|
|
55
52
|
/** Sets the track color underneath the indicator */
|
|
56
|
-
trackColor
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
trackColor?: HexColor | keyof typeof Colors;
|
|
54
|
+
}>(),
|
|
55
|
+
{
|
|
56
|
+
accessibleText: undefined,
|
|
57
|
+
dataTest: 'c-progress-ring',
|
|
58
|
+
value: 0,
|
|
59
|
+
valueMax: 100,
|
|
60
|
+
size: 44,
|
|
61
|
+
trackWidth: 4,
|
|
62
|
+
color: 'blue-500',
|
|
63
|
+
trackColor: 'gray-200',
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
defineSlots<{
|
|
68
|
+
default?: () => VNode[];
|
|
69
|
+
}>();
|
|
65
70
|
|
|
66
|
-
|
|
71
|
+
const { cssColor } = useCssColor(() => props.color);
|
|
72
|
+
const { cssColor: trackCssColor } = useCssColor(() => props.trackColor);
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
percentage,
|
|
70
|
-
cssColor,
|
|
71
|
-
trackCssColor,
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
});
|
|
74
|
+
const percentage = computed(() => (100 * Number(props.value)) / Number(props.valueMax));
|
|
75
75
|
</script>
|
|
76
76
|
|
|
77
77
|
<style lang="scss" scoped>
|
|
@@ -27,68 +27,68 @@
|
|
|
27
27
|
</label>
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
|
-
<script lang="ts">
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
defineComponent,
|
|
34
|
-
inject,
|
|
35
|
-
onBeforeUnmount,
|
|
36
|
-
onMounted,
|
|
37
|
-
ref,
|
|
38
|
-
toRefs,
|
|
39
|
-
} from 'vue';
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import type { VNode } from 'vue';
|
|
32
|
+
import { inject, onBeforeUnmount, onMounted, ref, toRefs } from 'vue';
|
|
40
33
|
|
|
41
34
|
import { useId } from '@propelinc/citrus-ui/src/composables/id';
|
|
42
|
-
import { RADIO_STATE } from '@propelinc/citrus-ui/src/services/injections/radio';
|
|
43
35
|
import type { RadioState } from '@propelinc/citrus-ui/src/services/injections/radio';
|
|
36
|
+
import { RADIO_STATE } from '@propelinc/citrus-ui/src/services/injections/radio';
|
|
44
37
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
props: {
|
|
38
|
+
const props = withDefaults(
|
|
39
|
+
defineProps<{
|
|
48
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
value:
|
|
50
|
-
id
|
|
51
|
-
label
|
|
52
|
-
dataTest
|
|
53
|
-
hideRadio
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
41
|
+
value: any;
|
|
42
|
+
id?: string | null;
|
|
43
|
+
label?: string | null;
|
|
44
|
+
dataTest?: string;
|
|
45
|
+
hideRadio?: boolean;
|
|
46
|
+
}>(),
|
|
47
|
+
{
|
|
48
|
+
id: null,
|
|
49
|
+
label: null,
|
|
50
|
+
dataTest: 'radio-group-option',
|
|
51
|
+
hideRadio: false,
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const emit = defineEmits<{
|
|
56
|
+
(e: 'change', event: Event): void;
|
|
57
|
+
(e: 'blur'): void;
|
|
58
|
+
(e: 'focus'): void;
|
|
59
|
+
}>();
|
|
60
|
+
|
|
61
|
+
defineSlots<{
|
|
62
|
+
label?: () => VNode[];
|
|
63
|
+
}>();
|
|
64
|
+
|
|
65
|
+
const { id } = toRefs(props);
|
|
66
|
+
const idWithFallback = useId(id);
|
|
67
|
+
|
|
68
|
+
const parentState = inject(
|
|
69
|
+
RADIO_STATE,
|
|
70
|
+
ref<RadioState>({
|
|
71
|
+
value: null,
|
|
72
|
+
name: idWithFallback.value,
|
|
73
|
+
invalid: false,
|
|
74
|
+
update: () => {},
|
|
75
|
+
register: () => {},
|
|
76
|
+
unregister: () => {},
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const onChange = (event: Event): void => {
|
|
81
|
+
const target = event.target as HTMLInputElement;
|
|
82
|
+
parentState.value.update(target.checked ? props.value : null);
|
|
83
|
+
emit('change', event);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
onMounted((): void => {
|
|
87
|
+
parentState.value.register(props.value);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
onBeforeUnmount((): void => {
|
|
91
|
+
parentState.value.unregister(props.value);
|
|
92
92
|
});
|
|
93
93
|
</script>
|
|
94
94
|
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
</fieldset>
|
|
32
32
|
</template>
|
|
33
33
|
|
|
34
|
-
<script lang="ts">
|
|
35
|
-
import
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import type { VNode } from 'vue';
|
|
36
|
+
import { computed, provide, ref, toRefs, watch } from 'vue';
|
|
36
37
|
|
|
37
38
|
import CValidationMessage from '@propelinc/citrus-ui/src/components/CValidationMessage.vue';
|
|
38
39
|
import { useInternalValue } from '@propelinc/citrus-ui/src/composables/binding';
|
|
@@ -41,79 +42,91 @@ import type { Rules } from '@propelinc/citrus-ui/src/composables/validations';
|
|
|
41
42
|
import { useValidations } from '@propelinc/citrus-ui/src/composables/validations';
|
|
42
43
|
import { RADIO_STATE } from '@propelinc/citrus-ui/src/services/injections/radio';
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
components: { CValidationMessage },
|
|
47
|
-
props: {
|
|
45
|
+
const props = withDefaults(
|
|
46
|
+
defineProps<{
|
|
48
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
value
|
|
50
|
-
id
|
|
51
|
-
dataTest
|
|
52
|
-
label
|
|
53
|
-
column
|
|
54
|
-
mandatory
|
|
55
|
-
rules
|
|
56
|
-
hideDetails
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
register: (value: unknown): void => {
|
|
93
|
-
if (props.mandatory && internalValue.value === null) {
|
|
94
|
-
internalValue.value = value;
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
unregister: (value: unknown): void => {
|
|
98
|
-
if (internalValue.value === value) {
|
|
99
|
-
internalValue.value = null;
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
}))
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
watch(internalValue, () => {
|
|
106
|
-
startValidating();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
idWithFallback,
|
|
111
|
-
isValidationValid,
|
|
112
|
-
radioGroup,
|
|
113
|
-
validationMessage,
|
|
114
|
-
};
|
|
48
|
+
value?: any;
|
|
49
|
+
id?: string | null;
|
|
50
|
+
dataTest?: string;
|
|
51
|
+
label?: string | null;
|
|
52
|
+
column?: boolean;
|
|
53
|
+
mandatory?: boolean;
|
|
54
|
+
rules?: Rules<string>;
|
|
55
|
+
hideDetails?: boolean | 'auto';
|
|
56
|
+
}>(),
|
|
57
|
+
{
|
|
58
|
+
value: null,
|
|
59
|
+
id: null,
|
|
60
|
+
dataTest: 'radio-group',
|
|
61
|
+
label: null,
|
|
62
|
+
column: true,
|
|
63
|
+
mandatory: false,
|
|
64
|
+
rules: () => [],
|
|
65
|
+
hideDetails: false,
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const emit = defineEmits<{
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
+
(e: 'change', value: any): void;
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
(e: 'input', value: any): void;
|
|
74
|
+
}>();
|
|
75
|
+
|
|
76
|
+
defineSlots<{
|
|
77
|
+
label?: () => VNode[];
|
|
78
|
+
default?: () => VNode[];
|
|
79
|
+
message?: () => VNode[];
|
|
80
|
+
}>();
|
|
81
|
+
|
|
82
|
+
const { value, rules, id, mandatory } = toRefs(props);
|
|
83
|
+
const idWithFallback = useId(id);
|
|
84
|
+
const radioGroup = ref<HTMLElement | null>(null);
|
|
85
|
+
|
|
86
|
+
const internalValue = useInternalValue(value, {
|
|
87
|
+
onChange: (newValue) => {
|
|
88
|
+
emit('change', newValue);
|
|
89
|
+
emit('input', newValue);
|
|
115
90
|
},
|
|
116
91
|
});
|
|
92
|
+
|
|
93
|
+
const {
|
|
94
|
+
startValidating,
|
|
95
|
+
message: validationMessage,
|
|
96
|
+
valid: isValidationValid,
|
|
97
|
+
} = useValidations({
|
|
98
|
+
id: idWithFallback,
|
|
99
|
+
value: internalValue,
|
|
100
|
+
rules,
|
|
101
|
+
required: mandatory,
|
|
102
|
+
validateOn: 'change',
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
provide(
|
|
106
|
+
RADIO_STATE,
|
|
107
|
+
computed(() => ({
|
|
108
|
+
invalid: !isValidationValid.value,
|
|
109
|
+
value: internalValue.value,
|
|
110
|
+
name: idWithFallback.value,
|
|
111
|
+
update: (newValue: unknown): void => {
|
|
112
|
+
internalValue.value = newValue;
|
|
113
|
+
},
|
|
114
|
+
register: (value: unknown): void => {
|
|
115
|
+
if (props.mandatory && internalValue.value === null) {
|
|
116
|
+
internalValue.value = value;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
unregister: (value: unknown): void => {
|
|
120
|
+
if (internalValue.value === value) {
|
|
121
|
+
internalValue.value = null;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
}))
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
watch(internalValue, () => {
|
|
128
|
+
startValidating();
|
|
129
|
+
});
|
|
117
130
|
</script>
|
|
118
131
|
|
|
119
132
|
<style lang="scss" scoped>
|
package/src/components/CRow.vue
CHANGED
|
@@ -13,35 +13,37 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
|
-
<script lang="ts">
|
|
17
|
-
import
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import type { VNode } from 'vue';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
withDefaults(
|
|
20
|
+
defineProps<{
|
|
21
21
|
/** Applies the align-items css property.
|
|
22
22
|
* Available options are: start, center, end and stretch. */
|
|
23
|
-
align
|
|
24
|
-
type: String as PropType<'center' | 'start' | 'end' | 'stretch'>,
|
|
25
|
-
default: null,
|
|
26
|
-
},
|
|
23
|
+
align?: 'center' | 'start' | 'end' | 'stretch' | null;
|
|
27
24
|
/** Applies the align-content css property.
|
|
28
25
|
* Available options are: start, center, end, and stretch. */
|
|
29
|
-
alignContent
|
|
30
|
-
type: String as PropType<'center' | 'start' | 'end' | 'stretch'>,
|
|
31
|
-
default: null,
|
|
32
|
-
},
|
|
26
|
+
alignContent?: 'center' | 'start' | 'end' | 'stretch' | null;
|
|
33
27
|
/** Reduces the gutter between c-cols. */
|
|
34
|
-
dense
|
|
28
|
+
dense?: boolean;
|
|
35
29
|
/** Removes the gutter between c-cols. */
|
|
36
|
-
noGutters
|
|
30
|
+
noGutters?: boolean;
|
|
37
31
|
/** Applies the justify-content css property.
|
|
38
32
|
* Available options are: start, center, end, space-between and space-around. */
|
|
39
|
-
justify
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
justify?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | null;
|
|
34
|
+
}>(),
|
|
35
|
+
{
|
|
36
|
+
align: null,
|
|
37
|
+
alignContent: null,
|
|
38
|
+
dense: false,
|
|
39
|
+
noGutters: false,
|
|
40
|
+
justify: null,
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
defineSlots<{
|
|
45
|
+
default?: () => VNode[];
|
|
46
|
+
}>();
|
|
45
47
|
</script>
|
|
46
48
|
|
|
47
49
|
<style lang="scss" scoped>
|
|
@@ -7,22 +7,30 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script lang="ts">
|
|
11
|
-
import {
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import type { VNode } from 'vue';
|
|
12
|
+
import { provide, ref } from 'vue';
|
|
12
13
|
|
|
13
14
|
import { TERTIARY as TERTIARY_ICON_BUTTON } from '@propelinc/citrus-ui/src/services/injections/icon-buttons';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/** The title text to display. */
|
|
18
|
-
title: { type: String, default: '' },
|
|
16
|
+
withDefaults(
|
|
17
|
+
defineProps<{
|
|
19
18
|
/** The tag used for the title text. */
|
|
20
|
-
tag
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
tag?: string;
|
|
20
|
+
/** The title text to display. */
|
|
21
|
+
title?: string;
|
|
22
|
+
}>(),
|
|
23
|
+
{
|
|
24
|
+
tag: 'h2',
|
|
25
|
+
title: '',
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
defineSlots<{
|
|
30
|
+
append?: () => VNode[];
|
|
31
|
+
}>();
|
|
32
|
+
|
|
33
|
+
provide(TERTIARY_ICON_BUTTON, ref(true));
|
|
26
34
|
</script>
|
|
27
35
|
|
|
28
36
|
<style lang="scss" scoped>
|