@aerogel/core 0.0.0-next.aa6e27a9c197d1ee10c9fe018ee8c0fc6ff77767 → 0.0.0-next.abea39863ad0f7c484b8b1f365870e43e9bdd0ba

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 (97) hide show
  1. package/dist/aerogel-core.css +1 -0
  2. package/dist/aerogel-core.d.ts +683 -579
  3. package/dist/aerogel-core.js +2180 -1828
  4. package/dist/aerogel-core.js.map +1 -1
  5. package/package.json +7 -2
  6. package/src/components/AppLayout.vue +1 -3
  7. package/src/components/AppOverlays.vue +0 -27
  8. package/src/components/contracts/AlertModal.ts +15 -0
  9. package/src/components/contracts/ConfirmModal.ts +12 -5
  10. package/src/components/contracts/DropdownMenu.ts +17 -3
  11. package/src/components/contracts/ErrorReportModal.ts +8 -4
  12. package/src/components/contracts/Input.ts +7 -7
  13. package/src/components/contracts/LoadingModal.ts +12 -4
  14. package/src/components/contracts/Modal.ts +12 -4
  15. package/src/components/contracts/PromptModal.ts +8 -2
  16. package/src/components/contracts/Select.ts +21 -12
  17. package/src/components/contracts/Toast.ts +4 -2
  18. package/src/components/contracts/index.ts +3 -1
  19. package/src/components/headless/HeadlessButton.vue +2 -1
  20. package/src/components/headless/HeadlessInput.vue +3 -3
  21. package/src/components/headless/HeadlessInputInput.vue +6 -6
  22. package/src/components/headless/HeadlessInputTextArea.vue +4 -4
  23. package/src/components/headless/HeadlessModal.vue +22 -51
  24. package/src/components/headless/HeadlessModalContent.vue +11 -5
  25. package/src/components/headless/HeadlessModalDescription.vue +12 -0
  26. package/src/components/headless/HeadlessSelect.vue +34 -19
  27. package/src/components/headless/HeadlessSelectOption.vue +1 -1
  28. package/src/components/headless/HeadlessSelectOptions.vue +16 -4
  29. package/src/components/headless/HeadlessSelectValue.vue +4 -1
  30. package/src/components/headless/HeadlessSwitch.vue +96 -0
  31. package/src/components/headless/index.ts +2 -0
  32. package/src/components/index.ts +2 -1
  33. package/src/components/ui/AdvancedOptions.vue +1 -1
  34. package/src/components/ui/AlertModal.vue +7 -3
  35. package/src/components/ui/Button.vue +33 -16
  36. package/src/components/ui/Checkbox.vue +5 -5
  37. package/src/components/ui/ConfirmModal.vue +12 -4
  38. package/src/components/ui/DropdownMenu.vue +18 -19
  39. package/src/components/ui/DropdownMenuOption.vue +22 -0
  40. package/src/components/ui/DropdownMenuOptions.vue +44 -0
  41. package/src/components/ui/EditableContent.vue +4 -4
  42. package/src/components/ui/ErrorLogs.vue +19 -0
  43. package/src/components/ui/ErrorLogsModal.vue +48 -0
  44. package/src/components/ui/ErrorReportModal.vue +18 -7
  45. package/src/components/ui/Input.vue +4 -4
  46. package/src/components/ui/LoadingModal.vue +6 -4
  47. package/src/components/ui/Markdown.vue +31 -3
  48. package/src/components/ui/Modal.vue +83 -22
  49. package/src/components/ui/ModalContext.vue +2 -1
  50. package/src/components/ui/ProgressBar.vue +9 -8
  51. package/src/components/ui/PromptModal.vue +8 -5
  52. package/src/components/ui/Select.vue +10 -4
  53. package/src/components/ui/SelectLabel.vue +13 -2
  54. package/src/components/ui/SelectOption.vue +29 -0
  55. package/src/components/ui/SelectOptions.vue +24 -20
  56. package/src/components/ui/SelectTrigger.vue +3 -3
  57. package/src/components/ui/SettingsModal.vue +4 -40
  58. package/src/components/ui/Switch.vue +11 -0
  59. package/src/components/ui/Toast.vue +20 -16
  60. package/src/components/ui/index.ts +6 -0
  61. package/src/directives/measure.ts +11 -5
  62. package/src/errors/Errors.ts +18 -15
  63. package/src/errors/index.ts +6 -2
  64. package/src/errors/settings/Debug.vue +39 -0
  65. package/src/errors/settings/index.ts +10 -0
  66. package/src/forms/FormController.test.ts +32 -9
  67. package/src/forms/FormController.ts +23 -22
  68. package/src/forms/index.ts +0 -1
  69. package/src/forms/utils.ts +34 -34
  70. package/src/index.css +37 -5
  71. package/src/lang/index.ts +5 -1
  72. package/src/lang/settings/Language.vue +48 -0
  73. package/src/lang/settings/index.ts +10 -0
  74. package/src/services/App.state.ts +11 -1
  75. package/src/services/App.ts +9 -1
  76. package/src/services/Events.test.ts +8 -8
  77. package/src/services/Events.ts +2 -8
  78. package/src/services/index.ts +5 -2
  79. package/src/testing/index.ts +4 -0
  80. package/src/ui/UI.state.ts +3 -13
  81. package/src/ui/UI.ts +107 -83
  82. package/src/ui/index.ts +16 -17
  83. package/src/utils/classes.ts +41 -0
  84. package/src/utils/composition/events.ts +2 -4
  85. package/src/utils/composition/forms.ts +16 -1
  86. package/src/utils/composition/state.ts +11 -2
  87. package/src/utils/index.ts +3 -1
  88. package/src/utils/markdown.ts +35 -1
  89. package/src/utils/types.ts +3 -0
  90. package/src/utils/vue.ts +28 -125
  91. package/src/components/composition.ts +0 -23
  92. package/src/components/contracts/shared.ts +0 -9
  93. package/src/components/utils.ts +0 -107
  94. package/src/forms/composition.ts +0 -6
  95. package/src/utils/tailwindcss.test.ts +0 -26
  96. package/src/utils/tailwindcss.ts +0 -7
  97. package/src/utils/vdom.ts +0 -31
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <DialogContent>
2
+ <DialogContent ref="$contentRef">
3
3
  <slot />
4
4
 
5
5
  <ModalContext v-if="childModal" :child-index="childIndex + 1" :modal="childModal" />
@@ -7,18 +7,24 @@
7
7
  </template>
8
8
 
9
9
  <script setup lang="ts">
10
- import { computed } from 'vue';
10
+ import { computed, useTemplateRef, watchEffect } from 'vue';
11
11
  import { DialogContent } from 'reka-ui';
12
+ import type { Ref } from 'vue';
12
13
 
13
14
  import ModalContext from '@aerogel/core/components/ui/ModalContext.vue';
14
15
  import UI from '@aerogel/core/ui/UI';
15
- import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
16
- import type { UIModalContext } from '@aerogel/core/ui/UI.state';
16
+ import { injectOrFail, injectReactiveOrFail } from '@aerogel/core/utils/vue';
17
+ import type { UIModalContext } from '@aerogel/core/ui/UI';
18
+ import type { ModalContentInstance } from '@aerogel/core/components/contracts/Modal';
17
19
 
18
20
  const { childIndex = 0 } = injectReactiveOrFail<UIModalContext>(
19
21
  'modal',
20
22
  'could not obtain modal reference from <HeadlessModalContent>, ' +
21
- 'did you render this component manually? Show it using $ui.openModal() instead',
23
+ 'did you render this component manually? Show it using $ui.modal() instead',
22
24
  );
25
+ const $modalContentRef = injectOrFail<Ref<ModalContentInstance>>('$modalContentRef');
26
+ const $content = useTemplateRef('$contentRef');
23
27
  const childModal = computed(() => UI.modals[childIndex] ?? null);
28
+
29
+ watchEffect(() => ($modalContentRef.value = $content.value));
24
30
  </script>
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <DialogDescription v-bind="$props">
3
+ <slot />
4
+ </DialogDescription>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { DialogDescription } from 'reka-ui';
9
+ import type { DialogDescriptionProps } from 'reka-ui';
10
+
11
+ defineProps<DialogDescriptionProps>();
12
+ </script>
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <SelectRoot v-slot="{ open }: ComponentProps" :model-value="acceptableValue" @update:model-value="update($event)">
2
+ <SelectRoot
3
+ v-slot="{ open }"
4
+ :model-value="acceptableValue"
5
+ :by="compareOptions as Closure<[AcceptableValue, AcceptableValue], boolean>"
6
+ @update:model-value="update($event)"
7
+ >
3
8
  <component :is="as" v-bind="$attrs">
4
9
  <slot :model-value :open>
5
10
  <HeadlessSelectTrigger />
@@ -9,16 +14,16 @@
9
14
  </SelectRoot>
10
15
  </template>
11
16
 
12
- <script setup lang="ts">
17
+ <script setup lang="ts" generic="T extends Nullable<FormFieldValue>">
13
18
  import { computed, inject, provide, readonly } from 'vue';
14
19
  import { value as evaluate, toString, uuid } from '@noeldemartin/utils';
15
20
  import { SelectRoot } from 'reka-ui';
16
21
  import type { AcceptableValue } from 'reka-ui';
22
+ import type { Closure, Nullable } from '@noeldemartin/utils';
17
23
 
18
24
  import { translateWithDefault } from '@aerogel/core/lang';
19
25
  import { hasSelectOptionLabel } from '@aerogel/core/components/contracts/Select';
20
26
  import type FormController from '@aerogel/core/forms/FormController';
21
- import type { ComponentProps } from '@aerogel/core/utils/vue';
22
27
  import type { SelectEmits, SelectExpose, SelectProps } from '@aerogel/core/components/contracts/Select';
23
28
  import type { FormFieldValue } from '@aerogel/core/forms/FormController';
24
29
 
@@ -29,17 +34,29 @@ defineOptions({ inheritAttrs: false });
29
34
 
30
35
  const {
31
36
  name,
32
- as = 'template',
37
+ as = 'div',
33
38
  label,
34
39
  options,
40
+ labelClass,
41
+ optionsClass,
35
42
  renderOption,
43
+ compareOptions = (a, b) => a === b,
36
44
  description,
37
45
  placeholder,
38
46
  modelValue,
39
- } = defineProps<SelectProps>();
40
- const emit = defineEmits<SelectEmits>();
47
+ align,
48
+ side,
49
+ } = defineProps<SelectProps<T>>();
50
+ const emit = defineEmits<SelectEmits<T>>();
41
51
  const form = inject<FormController | null>('form', null);
42
- const acceptableValue = computed(() => modelValue as AcceptableValue);
52
+ const computedValue = computed(() => {
53
+ if (form && name) {
54
+ return form.getFieldValue(name) as T;
55
+ }
56
+
57
+ return modelValue as T;
58
+ });
59
+ const acceptableValue = computed(() => computedValue.value as AcceptableValue);
43
60
  const errors = computed(() => {
44
61
  if (!form || !name) {
45
62
  return null;
@@ -62,7 +79,12 @@ const computedOptions = computed(() => {
62
79
  value: option as AcceptableValue,
63
80
  }));
64
81
  });
65
- const context = {
82
+ const expose = {
83
+ labelClass,
84
+ optionsClass,
85
+ align,
86
+ side,
87
+ value: computedValue,
66
88
  id: `select-${uuid()}`,
67
89
  name: computed(() => name),
68
90
  label: computed(() => label),
@@ -70,13 +92,6 @@ const context = {
70
92
  placeholder: computed(() => placeholder ?? translateWithDefault('ui.select', 'Select an option')),
71
93
  options: computedOptions,
72
94
  selectedOption: computed(() => computedOptions.value?.find((option) => option.value === modelValue)),
73
- value: computed(() => {
74
- if (form && name) {
75
- return form.getFieldValue(name);
76
- }
77
-
78
- return modelValue;
79
- }),
80
95
  errors: readonly(errors),
81
96
  required: computed(() => {
82
97
  if (!name || !form) {
@@ -94,12 +109,12 @@ const context = {
94
109
 
95
110
  emit('update:modelValue', value);
96
111
  },
97
- } satisfies SelectExpose;
112
+ } satisfies SelectExpose<T>;
98
113
 
99
114
  function update(value: AcceptableValue) {
100
- context.update(value as FormFieldValue);
115
+ expose.update(value as T);
101
116
  }
102
117
 
103
- provide('select', context);
104
- defineExpose(context);
118
+ provide('select', expose);
119
+ defineExpose(expose);
105
120
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <SelectItem v-bind="$props">
3
- <SelectItemText class="the-text">
3
+ <SelectItemText>
4
4
  <slot>
5
5
  {{ renderedLabel }}
6
6
  </slot>
@@ -1,7 +1,13 @@
1
1
  <template>
2
2
  <SelectPortal>
3
- <SelectContent :class="classes">
4
- <SelectViewport>
3
+ <SelectContent
4
+ position="popper"
5
+ :class="renderedClasses"
6
+ :align="select.align"
7
+ :side="select.side"
8
+ :side-offset="4"
9
+ >
10
+ <SelectViewport :class="innerClass">
5
11
  <slot>
6
12
  <HeadlessSelectOption
7
13
  v-for="option in select.options ?? []"
@@ -16,15 +22,21 @@
16
22
 
17
23
  <script setup lang="ts">
18
24
  import { SelectContent, SelectPortal, SelectViewport } from 'reka-ui';
25
+ import { computed } from 'vue';
26
+ import type { HTMLAttributes } from 'vue';
19
27
 
20
- import { injectReactiveOrFail } from '@aerogel/core/utils';
28
+ import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
29
+ import { classes } from '@aerogel/core/utils/classes';
21
30
  import type { SelectExpose } from '@aerogel/core/components/contracts/Select';
22
31
 
23
32
  import HeadlessSelectOption from './HeadlessSelectOption.vue';
24
33
 
25
- const { class: classes } = defineProps<{ class?: string }>();
34
+ const { class: rootClass } = defineProps<{ class?: HTMLAttributes['class']; innerClass?: HTMLAttributes['class'] }>();
35
+
26
36
  const select = injectReactiveOrFail<SelectExpose>(
27
37
  'select',
28
38
  '<HeadlessSelectOptions> must be a child of a <HeadlessSelect>',
29
39
  );
40
+ const renderedClasses = computed(() =>
41
+ classes('min-w-(--reka-select-trigger-width) max-h-(--reka-select-content-available-height)', rootClass));
30
42
  </script>
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <SelectValue :placeholder="select.placeholder" />
2
+ <SelectValue v-if="$slots.default" :placeholder="select.placeholder">
3
+ <slot />
4
+ </SelectValue>
5
+ <SelectValue v-else :placeholder="select.placeholder" />
3
6
  </template>
4
7
 
5
8
  <script setup lang="ts">
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <div :class="rootClass">
3
+ <label v-if="label" :for="expose.id" :class="labelClass">
4
+ {{ label }}
5
+ </label>
6
+ <SwitchRoot
7
+ :id="expose.id"
8
+ :name
9
+ :model-value="expose.value.value"
10
+ v-bind="$attrs"
11
+ :class="inputClass"
12
+ @update:model-value="$emit('update:modelValue', $event)"
13
+ >
14
+ <SwitchThumb :class="thumbClass" />
15
+ </SwitchRoot>
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts" generic="T extends boolean = boolean">
20
+ import { SwitchRoot, SwitchThumb } from 'reka-ui';
21
+ import { computed, inject, readonly, watchEffect } from 'vue';
22
+ import { uuid } from '@noeldemartin/utils';
23
+ import type { HTMLAttributes } from 'vue';
24
+
25
+ import type FormController from '@aerogel/core/forms/FormController';
26
+ import type { FormFieldValue } from '@aerogel/core/forms/FormController';
27
+ import type { InputEmits, InputExpose, InputProps } from '@aerogel/core/components/contracts/Input';
28
+
29
+ defineOptions({ inheritAttrs: false });
30
+
31
+ const {
32
+ name,
33
+ label,
34
+ description,
35
+ modelValue,
36
+ class: rootClass,
37
+ } = defineProps<
38
+ InputProps<T> & {
39
+ class?: HTMLAttributes['class'];
40
+ labelClass?: HTMLAttributes['class'];
41
+ inputClass?: HTMLAttributes['class'];
42
+ thumbClass?: HTMLAttributes['class'];
43
+ }
44
+ >();
45
+ const emit = defineEmits<InputEmits>();
46
+ const form = inject<FormController | null>('form', null);
47
+ const errors = computed(() => {
48
+ if (!form || !name) {
49
+ return null;
50
+ }
51
+
52
+ return form.errors[name] ?? null;
53
+ });
54
+
55
+ const expose = {
56
+ id: `switch-${uuid()}`,
57
+ name: computed(() => name),
58
+ label: computed(() => label),
59
+ description: computed(() => description),
60
+ value: computed(() => {
61
+ if (form && name) {
62
+ return form.getFieldValue(name) as boolean;
63
+ }
64
+
65
+ return modelValue;
66
+ }),
67
+ errors: readonly(errors),
68
+ required: computed(() => {
69
+ if (!name || !form) {
70
+ return;
71
+ }
72
+
73
+ return form.getFieldRules(name).includes('required');
74
+ }),
75
+ update(value) {
76
+ if (form && name) {
77
+ form.setFieldValue(name, value as FormFieldValue);
78
+
79
+ return;
80
+ }
81
+
82
+ emit('update:modelValue', value);
83
+ },
84
+ } satisfies InputExpose;
85
+
86
+ defineExpose(expose);
87
+
88
+ watchEffect(() => {
89
+ if (!description && !errors.value) {
90
+ return;
91
+ }
92
+
93
+ // eslint-disable-next-line no-console
94
+ console.warn('Errors and description not implemented in <HeadlessSwitch>');
95
+ });
96
+ </script>
@@ -7,6 +7,7 @@ export { default as HeadlessInputLabel } from './HeadlessInputLabel.vue';
7
7
  export { default as HeadlessInputTextArea } from './HeadlessInputTextArea.vue';
8
8
  export { default as HeadlessModal } from './HeadlessModal.vue';
9
9
  export { default as HeadlessModalContent } from './HeadlessModalContent.vue';
10
+ export { default as HeadlessModalDescription } from './HeadlessModalDescription.vue';
10
11
  export { default as HeadlessModalOverlay } from './HeadlessModalOverlay.vue';
11
12
  export { default as HeadlessModalTitle } from './HeadlessModalTitle.vue';
12
13
  export { default as HeadlessSelect } from './HeadlessSelect.vue';
@@ -15,4 +16,5 @@ export { default as HeadlessSelectOption } from './HeadlessSelectOption.vue';
15
16
  export { default as HeadlessSelectOptions } from './HeadlessSelectOptions.vue';
16
17
  export { default as HeadlessSelectTrigger } from './HeadlessSelectTrigger.vue';
17
18
  export { default as HeadlessSelectValue } from './HeadlessSelectValue.vue';
19
+ export { default as HeadlessSwitch } from './HeadlessSwitch.vue';
18
20
  export { default as HeadlessToast } from './HeadlessToast.vue';
@@ -1,7 +1,8 @@
1
1
  export { default as AppLayout } from './AppLayout.vue';
2
+ export { default as AppModals } from './AppModals.vue';
2
3
  export { default as AppOverlays } from './AppOverlays.vue';
4
+ export { default as AppToasts } from './AppToasts.vue';
3
5
 
4
- export * from './composition';
5
6
  export * from './contracts';
6
7
  export * from './headless';
7
8
  export * from './ui';
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <details class="group">
3
3
  <summary
4
- class="-ml-2 flex w-[max-content] cursor-pointer items-center rounded-lg py-2 pr-3 pl-1 hover:bg-gray-100 focus-visible:outline focus-visible:outline-gray-700"
4
+ class="-ml-2 flex w-[max-content] items-center rounded-lg py-2 pr-3 pl-1 hover:bg-gray-100 focus-visible:outline focus-visible:outline-gray-700"
5
5
  >
6
6
  <IconCheveronRight class="size-6 transition-transform group-open:rotate-90" />
7
7
  <span>{{ $td('ui.advancedOptions', 'Advanced options') }}</span>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Modal :title>
2
+ <Modal :title="renderedTitle" :title-hidden="titleHidden">
3
3
  <Markdown :text="message" />
4
4
  </Modal>
5
5
  </template>
@@ -7,7 +7,11 @@
7
7
  <script setup lang="ts">
8
8
  import Modal from '@aerogel/core/components/ui/Modal.vue';
9
9
  import Markdown from '@aerogel/core/components/ui/Markdown.vue';
10
- import type { AlertModalProps } from '@aerogel/core/components/contracts/AlertModal';
10
+ import { useAlertModal } from '@aerogel/core/components/contracts/AlertModal';
11
+ import type { AlertModalExpose, AlertModalProps } from '@aerogel/core/components/contracts/AlertModal';
11
12
 
12
- defineProps<AlertModalProps>();
13
+ const props = defineProps<AlertModalProps>();
14
+ const { renderedTitle, titleHidden } = useAlertModal(props);
15
+
16
+ defineExpose<AlertModalExpose>();
13
17
  </script>
@@ -5,32 +5,34 @@
5
5
  </template>
6
6
 
7
7
  <script setup lang="ts">
8
+ import { computed } from 'vue';
9
+
8
10
  import HeadlessButton from '@aerogel/core/components/headless/HeadlessButton.vue';
9
- import { computedVariantClasses } from '@aerogel/core/components/utils';
11
+ import { variantClasses } from '@aerogel/core/utils/classes';
10
12
  import type { ButtonProps } from '@aerogel/core/components/contracts/Button';
11
- import type { Variants } from '@aerogel/core/components/utils';
13
+ import type { Variants } from '@aerogel/core/utils/classes';
12
14
 
13
15
  const { class: baseClasses, size, variant, disabled, ...props } = defineProps<ButtonProps>();
14
16
 
15
17
  /* eslint-disable vue/max-len */
16
18
  // prettier-ignore
17
- const renderedClasses = computedVariantClasses<Variants<Pick<ButtonProps, 'size' | 'variant' | 'disabled'>>>(
19
+ const renderedClasses = computed(() => variantClasses<Variants<Pick<ButtonProps, 'size' | 'variant' | 'disabled'>>>(
18
20
  { baseClasses, variant, size, disabled },
19
21
  {
20
- baseClasses: 'flex items-center justify-center gap-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2',
22
+ baseClasses: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2',
21
23
  variants: {
22
24
  variant: {
23
- default: 'bg-primary text-white focus-visible:outline-primary',
25
+ default: 'bg-primary-600 text-white focus-visible:outline-primary-600',
24
26
  secondary: 'bg-background text-gray-900 ring-gray-300',
25
- danger: 'bg-danger text-white focus-visible:outline-danger',
27
+ danger: 'bg-red-600 text-white focus-visible:outline-red-600',
26
28
  ghost: 'bg-transparent',
27
- outline: 'bg-transparent text-primary ring-primary',
28
- link: 'text-primary',
29
+ outline: 'bg-transparent text-primary-600 ring-primary-600',
30
+ link: 'text-links',
29
31
  },
30
32
  size: {
31
- small: 'text-xs',
32
- default: 'text-sm',
33
- large: 'text-base',
33
+ small: 'text-xs min-h-6',
34
+ default: 'text-sm min-h-8',
35
+ large: 'text-base min-h-10',
34
36
  icon: 'rounded-full p-2.5',
35
37
  },
36
38
  disabled: {
@@ -41,7 +43,7 @@ const renderedClasses = computedVariantClasses<Variants<Pick<ButtonProps, 'size'
41
43
  compoundVariants: [
42
44
  {
43
45
  variant: ['default', 'secondary', 'danger', 'ghost', 'outline'],
44
- class: 'font-medium',
46
+ class: 'flex items-center justify-center gap-1 font-medium',
45
47
  },
46
48
  {
47
49
  variant: ['default', 'danger'],
@@ -69,23 +71,38 @@ const renderedClasses = computedVariantClasses<Variants<Pick<ButtonProps, 'size'
69
71
  {
70
72
  variant: 'default',
71
73
  disabled: false,
72
- class: 'hover:bg-primary/90',
74
+ class: 'hover:bg-primary-500',
73
75
  },
74
76
  {
75
77
  variant: ['secondary', 'ghost', 'outline'],
76
78
  disabled: false,
77
- class: 'hover:bg-accent',
79
+ class: 'hover:bg-gray-50',
78
80
  },
79
81
  {
80
82
  variant: 'danger',
81
83
  disabled: false,
82
- class: 'hover:bg-danger/80',
84
+ class: 'hover:bg-red-500',
83
85
  },
84
86
  {
85
87
  variant: 'link',
86
88
  disabled: false,
87
89
  class: 'hover:underline',
88
90
  },
91
+ {
92
+ variant: 'link',
93
+ size: 'small',
94
+ class: 'leading-6',
95
+ },
96
+ {
97
+ variant: 'link',
98
+ size: 'default',
99
+ class: 'leading-8',
100
+ },
101
+ {
102
+ variant: 'link',
103
+ size: 'large',
104
+ class: 'leading-10',
105
+ },
89
106
  ],
90
107
  defaultVariants: {
91
108
  variant: 'default',
@@ -93,6 +110,6 @@ const renderedClasses = computedVariantClasses<Variants<Pick<ButtonProps, 'size'
93
110
  disabled: false,
94
111
  },
95
112
  },
96
- );
113
+ ));
97
114
  /* eslint-enable vue/max-len */
98
115
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <HeadlessInput
3
- ref="$input"
3
+ ref="$inputRef"
4
4
  :class="renderedClasses"
5
5
  v-bind="props"
6
6
  @update:model-value="$emit('update:modelValue', $event)"
@@ -29,7 +29,7 @@ import HeadlessInput from '@aerogel/core/components/headless/HeadlessInput.vue';
29
29
  import HeadlessInputError from '@aerogel/core/components/headless/HeadlessInputError.vue';
30
30
  import HeadlessInputInput from '@aerogel/core/components/headless/HeadlessInputInput.vue';
31
31
  import HeadlessInputLabel from '@aerogel/core/components/headless/HeadlessInputLabel.vue';
32
- import { classes } from '@aerogel/core/components/utils';
32
+ import { classes } from '@aerogel/core/utils/classes';
33
33
  import { useInputAttrs } from '@aerogel/core/utils/composition/forms';
34
34
  import type { InputEmits, InputProps } from '@aerogel/core/components/contracts/Input';
35
35
 
@@ -40,14 +40,14 @@ const { inputClass, labelClass, ...props } = defineProps<
40
40
  InputProps & { inputClass?: HTMLAttributes['class']; labelClass?: HTMLAttributes['class'] }
41
41
  >();
42
42
 
43
- const $input = useTemplateRef('$input');
43
+ const $input = useTemplateRef('$inputRef');
44
44
  const [inputAttrs, rootClasses] = useInputAttrs();
45
45
  const renderedClasses = computed(() => classes('relative flex items-start', rootClasses.value));
46
46
  const renderedInputClasses = computed(() =>
47
47
  classes(
48
- 'size-4 rounded text-primary hover:bg-gray-200 checked:hover:bg-primary/80 checked:border-0',
48
+ 'size-4 rounded text-primary-600 not-checked:hover:bg-gray-200 checked:hover:text-primary-500 checked:border-0',
49
49
  {
50
- 'border-gray-300 focus:ring-primary': !$input.value?.errors,
50
+ 'border-gray-300 focus:ring-primary-600': !$input.value?.errors,
51
51
  'border-red-400 border-2 focus:ring-red-600': $input.value?.errors,
52
52
  },
53
53
  inputClass,
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <Modal v-slot="{ close }" :title persistent>
2
+ <!-- @vue-generic {import('@aerogel/core/ui/UI').ModalExposeResult<ConfirmModalExpose>} -->
3
+ <Modal
4
+ v-slot="{ close }"
5
+ :title="renderedTitle"
6
+ :title-hidden="titleHidden"
7
+ persistent
8
+ >
3
9
  <Form :form @submit="close([true, form.data()])">
4
10
  <Markdown :text="message" :actions />
5
11
 
@@ -10,7 +16,7 @@
10
16
  v-model="form[name]"
11
17
  type="checkbox"
12
18
  :required="checkbox.required"
13
- class="border-primary text-primary hover:bg-primary/10 hover:checked:bg-primary/80 focus:ring-primary focus-visible:ring-primary rounded border-2"
19
+ class="border-primary-600 text-primary-600 hover:bg-primary-50 hover:checked:bg-primary-500 focus:ring-primary-600 focus-visible:ring-primary-600 rounded border-2"
14
20
  >
15
21
  <span class="ml-1.5">{{ checkbox.label }}</span>
16
22
  </label>
@@ -35,8 +41,10 @@ import Markdown from '@aerogel/core/components/ui/Markdown.vue';
35
41
  import Button from '@aerogel/core/components/ui/Button.vue';
36
42
  import Modal from '@aerogel/core/components/ui/Modal.vue';
37
43
  import { useConfirmModal } from '@aerogel/core/components/contracts/ConfirmModal';
38
- import type { ConfirmModalProps } from '@aerogel/core/components/contracts/ConfirmModal';
44
+ import type { ConfirmModalExpose, ConfirmModalProps } from '@aerogel/core/components/contracts/ConfirmModal';
39
45
 
40
46
  const { cancelVariant = 'secondary', ...props } = defineProps<ConfirmModalProps>();
41
- const { form, renderedAcceptText, renderedCancelText } = useConfirmModal(props);
47
+ const { form, renderedTitle, titleHidden, renderedAcceptText, renderedCancelText } = useConfirmModal(props);
48
+
49
+ defineExpose<ConfirmModalExpose>();
42
50
  </script>
@@ -4,30 +4,29 @@
4
4
  <slot />
5
5
  </DropdownMenuTrigger>
6
6
  <DropdownMenuPortal>
7
- <DropdownMenuContent class="gap-y-0.5 rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-black/5" :align>
8
- <DropdownMenuItem
9
- v-for="(option, key) in options"
10
- :key
11
- class="flex w-full items-center rounded-lg px-2 py-2 text-sm text-gray-900 data-[highlighted]:bg-gray-100"
12
- @select="option.click"
13
- >
14
- {{ option.label }}
15
- </DropdownMenuItem>
16
- </DropdownMenuContent>
7
+ <slot name="options">
8
+ <DropdownMenuOptions />
9
+ </slot>
17
10
  </DropdownMenuPortal>
18
11
  </DropdownMenuRoot>
19
12
  </template>
20
13
 
21
14
  <script setup lang="ts">
22
- import {
23
- DropdownMenuContent,
24
- DropdownMenuItem,
25
- DropdownMenuPortal,
26
- DropdownMenuRoot,
27
- DropdownMenuTrigger,
28
- } from 'reka-ui';
15
+ import { DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger } from 'reka-ui';
16
+ import { computed, provide } from 'vue';
17
+ import type { AcceptRefs } from '@aerogel/core/utils';
29
18
 
30
- import type { DropdownMenuProps } from '@aerogel/core/components/contracts/DropdownMenu';
19
+ import type { DropdownMenuExpose, DropdownMenuProps } from '@aerogel/core/components/contracts/DropdownMenu';
31
20
 
32
- defineProps<DropdownMenuProps>();
21
+ import DropdownMenuOptions from './DropdownMenuOptions.vue';
22
+
23
+ const { align, side, options } = defineProps<DropdownMenuProps>();
24
+ const expose = {
25
+ align,
26
+ side,
27
+ options: computed(() => options?.filter(Boolean)),
28
+ } satisfies AcceptRefs<DropdownMenuExpose>;
29
+
30
+ provide('dropdown-menu', expose);
31
+ defineExpose(expose);
33
32
  </script>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <DropdownMenuItem :class="renderedClasses" v-bind="props" @select="$emit('select')">
3
+ <slot />
4
+ </DropdownMenuItem>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { classes } from '@aerogel/core/utils';
9
+ import { computed } from 'vue';
10
+ import { DropdownMenuItem } from 'reka-ui';
11
+ import type { HTMLAttributes } from 'vue';
12
+ import type { PrimitiveProps } from 'reka-ui';
13
+
14
+ defineEmits<{ select: [] }>();
15
+
16
+ const { class: rootClass, ...props } = defineProps<{ class?: HTMLAttributes['class'] } & PrimitiveProps>();
17
+ const renderedClasses = computed(() =>
18
+ classes(
19
+ 'flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-gray-900 data-[highlighted]:bg-gray-100',
20
+ rootClass,
21
+ ));
22
+ </script>