@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.
Files changed (202) hide show
  1. package/README.md +51 -14
  2. package/dist/citrus-ui.cdn.css +1 -0
  3. package/dist/citrus-ui.css +1 -0
  4. package/dist/colors/colors.d.ts +31 -0
  5. package/dist/colors/theme.d.ts +3 -0
  6. package/dist/colors/util-classes.d.ts +11 -0
  7. package/dist/components/CAccordion.vue.d.ts +34 -0
  8. package/dist/components/CAccordionItem.vue.d.ts +39 -0
  9. package/dist/components/CAppBar.vue.d.ts +59 -0
  10. package/dist/components/CBadge.vue.d.ts +35 -0
  11. package/dist/components/CBottomSheet.vue.d.ts +90 -0
  12. package/dist/components/CButton/CButton.vue.d.ts +97 -0
  13. package/dist/components/CButton/types.d.ts +5 -0
  14. package/dist/components/CButtonStack.vue.d.ts +27 -0
  15. package/dist/components/CCard.vue.d.ts +53 -0
  16. package/dist/components/CCardFooter.vue.d.ts +20 -0
  17. package/dist/components/CCardHeader.vue.d.ts +22 -0
  18. package/dist/components/CCardSection.vue.d.ts +26 -0
  19. package/dist/components/CCheckbox.vue.d.ts +62 -0
  20. package/dist/components/CCol.vue.d.ts +30 -0
  21. package/dist/components/CDivider.vue.d.ts +9 -0
  22. package/dist/components/CDobField.vue.d.ts +60 -0
  23. package/dist/components/CDobSelect.vue.d.ts +50 -0
  24. package/dist/components/CEmailField.vue.d.ts +48 -0
  25. package/dist/components/CExpandTransition.vue.d.ts +29 -0
  26. package/dist/components/CFadeTransition.vue.d.ts +20 -0
  27. package/dist/components/CFileInput.vue.d.ts +50 -0
  28. package/dist/components/CFixedPageFooter.vue.d.ts +153 -0
  29. package/dist/components/CForm.vue.d.ts +44 -0
  30. package/dist/components/CFormFieldCounter.vue.d.ts +15 -0
  31. package/dist/components/CIconButton.vue.d.ts +97 -0
  32. package/dist/components/CLabel.vue.d.ts +36 -0
  33. package/dist/components/CListItem.vue.d.ts +56 -0
  34. package/dist/components/CListItemContent.vue.d.ts +27 -0
  35. package/dist/components/CListItemIcon.vue.d.ts +28 -0
  36. package/dist/components/CLoader.vue.d.ts +23 -0
  37. package/dist/components/CLogo.vue.d.ts +9 -0
  38. package/dist/components/CMaskedTextField.vue.d.ts +511 -0
  39. package/dist/components/CMenu.vue.d.ts +17 -0
  40. package/dist/components/CMenuItem.vue.d.ts +37 -0
  41. package/dist/components/CMenuLabel.vue.d.ts +20 -0
  42. package/dist/components/CModal.vue.d.ts +59 -0
  43. package/dist/components/CModalLoading.vue.d.ts +36 -0
  44. package/dist/components/CNotification.vue.d.ts +64 -0
  45. package/dist/components/CPhoneField.vue.d.ts +792 -0
  46. package/dist/components/CPill.vue.d.ts +41 -0
  47. package/dist/components/CPillGroup.vue.d.ts +39 -0
  48. package/dist/components/CPopup.vue.d.ts +37 -0
  49. package/dist/components/CProgressLinear.vue.d.ts +21 -0
  50. package/dist/components/CProgressRing.vue.d.ts +48 -0
  51. package/dist/components/CRadio.vue.d.ts +40 -0
  52. package/dist/components/CRadioGroup.vue.d.ts +54 -0
  53. package/dist/components/CRebrand.vue.d.ts +28 -0
  54. package/dist/components/CRow.vue.d.ts +41 -0
  55. package/dist/components/CSafeArea.vue.d.ts +18 -0
  56. package/dist/components/CSectionHeader.vue.d.ts +29 -0
  57. package/dist/components/CSelect.vue.d.ts +96 -0
  58. package/dist/components/CSkeleton.vue.d.ts +3 -0
  59. package/dist/components/CSkeletonLoaderCard.vue.d.ts +9 -0
  60. package/dist/components/CSkeletonLoaderCircle.vue.d.ts +3 -0
  61. package/dist/components/CSkeletonLoaderText.vue.d.ts +16 -0
  62. package/dist/components/CSlideFadeTransition.vue.d.ts +36 -0
  63. package/dist/components/CSplitInput.vue.d.ts +56 -0
  64. package/dist/components/CSquaredIcon.vue.d.ts +33 -0
  65. package/dist/components/CSsnField.vue.d.ts +798 -0
  66. package/dist/components/CStatusDot.vue.d.ts +10 -0
  67. package/dist/components/CSwitch.vue.d.ts +39 -0
  68. package/dist/components/CSwitchListItem.vue.d.ts +48 -0
  69. package/dist/components/CTextArea.vue.d.ts +96 -0
  70. package/dist/components/CTextField.vue.d.ts +129 -0
  71. package/dist/components/CTextLink.vue.d.ts +36 -0
  72. package/dist/components/CThirdPartyLogo.vue.d.ts +22 -0
  73. package/dist/components/CTimeago.vue.d.ts +12 -0
  74. package/dist/components/CToast.vue.d.ts +69 -0
  75. package/dist/components/CToastsList.vue.d.ts +3 -0
  76. package/dist/components/CValidationMessage.vue.d.ts +37 -0
  77. package/dist/components/CZipcodeField.vue.d.ts +796 -0
  78. package/dist/components/index.d.ts +66 -0
  79. package/dist/components/internal/CCloseButton.vue.d.ts +14 -0
  80. package/dist/composables/accessibility.d.ts +1 -0
  81. package/dist/composables/animation.d.ts +12 -0
  82. package/dist/composables/binding.d.ts +19 -0
  83. package/dist/composables/colors.d.ts +13 -0
  84. package/dist/composables/elements.d.ts +3 -0
  85. package/dist/composables/fields.d.ts +10 -0
  86. package/dist/composables/gestures.d.ts +53 -0
  87. package/dist/composables/i18n.d.ts +3 -0
  88. package/dist/composables/id.d.ts +11 -0
  89. package/dist/composables/input-mask.d.ts +18 -0
  90. package/dist/composables/router.d.ts +30 -0
  91. package/dist/composables/slots.d.ts +2 -0
  92. package/dist/composables/toast.d.ts +21 -0
  93. package/dist/composables/validations.d.ts +77 -0
  94. package/dist/icons.cdn.mjs +3 -0
  95. package/dist/icons.cdn.mjs.map +1 -0
  96. package/dist/icons.d.ts +1 -0
  97. package/dist/icons.mjs +6 -0
  98. package/dist/icons.mjs.map +1 -0
  99. package/dist/index.cdn.mjs +9328 -12875
  100. package/dist/index.cdn.mjs.map +1 -1
  101. package/dist/index.cdn2.mjs +55255 -0
  102. package/dist/index.cdn2.mjs.map +1 -0
  103. package/dist/index.d.ts +8 -0
  104. package/dist/index.mjs +3946 -0
  105. package/dist/index.mjs.map +1 -0
  106. package/dist/plugin.d.ts +3 -0
  107. package/dist/services/animation.d.ts +17 -0
  108. package/dist/services/directives/index.d.ts +2 -0
  109. package/dist/services/directives/scroll-into-view.d.ts +7 -0
  110. package/dist/services/directives/tap-animation.d.ts +6 -0
  111. package/dist/services/id.d.ts +22 -0
  112. package/dist/services/injections/accordions.d.ts +3 -0
  113. package/dist/services/injections/animations.d.ts +2 -0
  114. package/dist/services/injections/buttons.d.ts +4 -0
  115. package/dist/services/injections/forms.d.ts +6 -0
  116. package/dist/services/injections/icon-buttons.d.ts +3 -0
  117. package/dist/services/injections/pills.d.ts +4 -0
  118. package/dist/services/injections/radio.d.ts +10 -0
  119. package/dist/{styles/main.css → styles.css} +40 -2
  120. package/dist/theme/icons.d.ts +36 -0
  121. package/dist/types/CForm.d.ts +12 -0
  122. package/dist/types/font-awesome.d.ts +5 -0
  123. package/dist/types.d.ts +13 -0
  124. package/package.json +11 -4
  125. package/src/colors/colors.ts +8 -3
  126. package/src/components/CAccordion.vue +31 -24
  127. package/src/components/CAccordionItem.vue +46 -45
  128. package/src/components/CAppBar.vue +108 -101
  129. package/src/components/CBadge.vue +33 -25
  130. package/src/components/CBottomSheet.vue +212 -199
  131. package/src/components/CButton/CButton.vue +135 -147
  132. package/src/components/CButtonStack.vue +21 -13
  133. package/src/components/CCard.vue +72 -69
  134. package/src/components/CCardFooter.vue +5 -5
  135. package/src/components/CCardHeader.vue +9 -7
  136. package/src/components/CCardSection.vue +15 -8
  137. package/src/components/CCheckbox.vue +68 -69
  138. package/src/components/CCol.vue +21 -22
  139. package/src/components/CDivider.vue +9 -8
  140. package/src/components/CDobField.vue +114 -105
  141. package/src/components/CDobSelect.vue +162 -164
  142. package/src/components/CEmailField.vue +39 -27
  143. package/src/components/CExpandTransition.vue +14 -17
  144. package/src/components/CFadeTransition.vue +3 -3
  145. package/src/components/CFileInput.vue +57 -50
  146. package/src/components/CFixedPageFooter.vue +23 -17
  147. package/src/components/CForm.vue +67 -60
  148. package/src/components/CFormFieldCounter.vue +25 -28
  149. package/src/components/CIconButton.vue +84 -65
  150. package/src/components/CLabel.vue +19 -13
  151. package/src/components/CListItem.vue +67 -66
  152. package/src/components/CListItemContent.vue +14 -16
  153. package/src/components/CListItemIcon.vue +18 -14
  154. package/src/components/CLoader.vue +47 -56
  155. package/src/components/CLogo.vue +13 -12
  156. package/src/components/CMaskedTextField.vue +80 -64
  157. package/src/components/CMenu.vue +14 -6
  158. package/src/components/CMenuItem.vue +28 -22
  159. package/src/components/CMenuLabel.vue +6 -5
  160. package/src/components/CModal.vue +76 -71
  161. package/src/components/CModalLoading.vue +24 -15
  162. package/src/components/CNotification.vue +77 -28
  163. package/src/components/CPhoneField.vue +34 -25
  164. package/src/components/CPill.vue +92 -88
  165. package/src/components/CPillGroup.vue +30 -21
  166. package/src/components/CPopup.vue +46 -37
  167. package/src/components/CProgressLinear.vue +17 -11
  168. package/src/components/CProgressRing.vue +33 -33
  169. package/src/components/CRadio.vue +57 -57
  170. package/src/components/CRadioGroup.vue +85 -72
  171. package/src/components/CRow.vue +22 -20
  172. package/src/components/CSectionHeader.vue +20 -12
  173. package/src/components/CSelect.vue +89 -73
  174. package/src/components/CSkeletonLoaderCard.vue +9 -15
  175. package/src/components/CSkeletonLoaderCircle.vue +1 -9
  176. package/src/components/CSkeletonLoaderText.vue +17 -18
  177. package/src/components/CSlideFadeTransition.vue +12 -34
  178. package/src/components/CSplitInput.vue +46 -45
  179. package/src/components/CSquaredIcon.vue +39 -29
  180. package/src/components/CSsnField.vue +48 -36
  181. package/src/components/CStatusDot.vue +16 -16
  182. package/src/components/CSwitch.vue +31 -22
  183. package/src/components/CSwitchListItem.vue +27 -28
  184. package/src/components/CTextArea.vue +116 -83
  185. package/src/components/CTextField.vue +194 -198
  186. package/src/components/CTextLink.vue +28 -25
  187. package/src/components/CThirdPartyLogo.vue +30 -59
  188. package/src/components/CToast.vue +135 -132
  189. package/src/components/CToastsList.vue +2 -15
  190. package/src/components/CValidationMessage.vue +31 -24
  191. package/src/components/CZipcodeField.vue +40 -27
  192. package/src/composables/elements.ts +1 -1
  193. package/src/composables/fields.ts +4 -4
  194. package/src/composables/router.ts +6 -5
  195. package/src/icons.ts +6 -0
  196. package/src/services/injections/buttons.ts +1 -1
  197. package/src/styles/_core.scss +1 -2
  198. package/src/styles/_reset.scss +1 -1
  199. package/src/styles/main.scss +2 -0
  200. package/src/types.ts +2 -0
  201. package/dist/index.cdn.css +0 -1
  202. 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 { type PropType, computed, defineComponent } from 'vue';
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 { type HexColor, isValidColor } from '@propelinc/citrus-ui/src/colors/colors';
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
- export default defineComponent({
36
- props: {
36
+ const props = withDefaults(
37
+ defineProps<{
37
38
  /** Customizes screen reader only text alternative, should be translated */
38
- accessibleText: { type: String, default: undefined },
39
+ accessibleText?: string;
39
40
  /** Selector for testing */
40
- dataTest: { type: String, default: 'c-progress-ring' },
41
+ dataTest?: string;
41
42
  /** The current progress, from 0 to valueMax */
42
- value: { type: [Number, String], default: 0 },
43
+ value?: number | string;
43
44
  /** Total progress */
44
- valueMax: { type: [Number, String], default: 100 },
45
+ valueMax?: number | string;
45
46
  /** The outer diameter of the progress ring, in px */
46
- size: { type: [Number, String], default: 44 },
47
+ size?: number | string;
47
48
  /** The width of the progress ring, in px */
48
- trackWidth: { type: [Number, String], default: 4 },
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
- type: String as PropType<HexColor | keyof typeof Colors>,
58
- default: 'gray-200',
59
- validator: isValidColor,
60
- },
61
- },
62
- setup(props) {
63
- const { cssColor } = useCssColor(() => props.color);
64
- const { cssColor: trackCssColor } = useCssColor(() => props.trackColor);
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
- const percentage = computed(() => (100 * Number(props.value)) / Number(props.valueMax));
71
+ const { cssColor } = useCssColor(() => props.color);
72
+ const { cssColor: trackCssColor } = useCssColor(() => props.trackColor);
67
73
 
68
- return {
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
- type PropType,
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
- export default defineComponent({
46
- name: 'CRadio',
47
- props: {
38
+ const props = withDefaults(
39
+ defineProps<{
48
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- value: { type: null as unknown as PropType<any>, required: true },
50
- id: { type: String as PropType<string | null>, default: null },
51
- label: { type: String as PropType<string | null>, default: null },
52
- dataTest: { type: String, default: 'radio-group-option' },
53
- hideRadio: { type: Boolean, default: false },
54
- },
55
- emits: ['change', 'blur', 'focus'],
56
- setup(props, { emit }) {
57
- const { id } = toRefs(props);
58
- const idWithFallback = useId(id);
59
-
60
- const parentState = inject(
61
- RADIO_STATE,
62
- ref<RadioState>({
63
- value: null,
64
- name: idWithFallback.value,
65
- invalid: false,
66
- update: () => {},
67
- register: () => {},
68
- unregister: () => {},
69
- })
70
- );
71
-
72
- const onChange = (event: Event): void => {
73
- const target = event.target as HTMLInputElement;
74
- parentState.value.update(target.checked ? props.value : null);
75
- emit('change', event);
76
- };
77
-
78
- onMounted((): void => {
79
- parentState.value.register(props.value);
80
- });
81
-
82
- onBeforeUnmount((): void => {
83
- parentState.value.unregister(props.value);
84
- });
85
-
86
- return {
87
- idWithFallback,
88
- parentState,
89
- onChange,
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 { type PropType, computed, defineComponent, provide, ref, toRefs, watch } from 'vue';
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
- export default defineComponent({
45
- name: 'CRadioGroup',
46
- components: { CValidationMessage },
47
- props: {
45
+ const props = withDefaults(
46
+ defineProps<{
48
47
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- value: { type: null as unknown as PropType<any>, default: null },
50
- id: { type: String as PropType<string | null>, default: null },
51
- dataTest: { type: String, default: 'radio-group' },
52
- label: { type: String as PropType<string | null>, default: null },
53
- column: { type: Boolean, default: true },
54
- mandatory: { type: Boolean, default: false },
55
- rules: { type: Array as PropType<Rules<string>>, default: () => [] },
56
- hideDetails: { type: Boolean as PropType<boolean | 'auto'>, default: false },
57
- },
58
- emits: ['change', 'input'],
59
- setup(props, { emit }) {
60
- const { value, rules, id, mandatory } = toRefs(props);
61
- const idWithFallback = useId(id);
62
- const radioGroup = ref<HTMLElement | null>(null);
63
-
64
- const internalValue = useInternalValue(value, {
65
- onChange: (newValue) => {
66
- emit('change', newValue);
67
- emit('input', newValue);
68
- },
69
- });
70
-
71
- const {
72
- startValidating,
73
- message: validationMessage,
74
- valid: isValidationValid,
75
- } = useValidations({
76
- id: idWithFallback,
77
- value: internalValue,
78
- rules,
79
- required: mandatory,
80
- validateOn: 'change',
81
- });
82
-
83
- provide(
84
- RADIO_STATE,
85
- computed(() => ({
86
- invalid: !isValidationValid.value,
87
- value: internalValue.value,
88
- name: idWithFallback.value,
89
- update: (newValue: unknown): void => {
90
- internalValue.value = newValue;
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>
@@ -13,35 +13,37 @@
13
13
  </div>
14
14
  </template>
15
15
 
16
- <script lang="ts">
17
- import { type PropType, defineComponent } from 'vue';
16
+ <script setup lang="ts">
17
+ import type { VNode } from 'vue';
18
18
 
19
- export default defineComponent({
20
- props: {
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: { type: Boolean, default: false },
28
+ dense?: boolean;
35
29
  /** Removes the gutter between c-cols. */
36
- noGutters: { type: Boolean, default: false },
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
- type: String as PropType<'center' | 'start' | 'end' | 'space-between' | 'space-around'>,
41
- default: null,
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 { defineComponent, provide, ref } from 'vue';
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
- export default defineComponent({
16
- props: {
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: { type: String, default: 'h2' },
21
- },
22
- setup(): void {
23
- provide(TERTIARY_ICON_BUTTON, ref(true));
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>