v-uixy 1.9.0 → 1.9.2

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.
@@ -1,6 +1,8 @@
1
1
  export type UixyChartSeries = {
2
2
  label: string;
3
3
  values: number[];
4
+ color?: string;
5
+ baseColor?: string;
4
6
  };
5
7
 
6
8
  export type UixyChartData = {
@@ -11,8 +13,13 @@ export type UixyChartData = {
11
13
  export interface UixyChartProps {
12
14
  series?: UixyChartSeries[];
13
15
  data?: UixyChartData[];
16
+ labels?: string[];
17
+ axisLabels?: string[];
14
18
  color?: string;
15
19
  baseColor?: string;
16
20
  rows?: number;
17
21
  animate?: boolean;
22
+ axis?: boolean;
23
+ interactive?: boolean;
24
+ format?: (value: number) => string;
18
25
  }
@@ -1,10 +1,25 @@
1
1
  <template>
2
- <div class="flex w-full flex-col gap-1">
3
- <label v-if="props.label" :class="labelStyles({ status })">
2
+ <div :class="['flex flex-col gap-1', $slots.trigger ? 'w-fit' : 'w-full']">
3
+ <label v-if="props.label && !$slots.trigger" :class="labelStyles({ status })">
4
4
  {{ props.label }}
5
5
  </label>
6
6
 
7
7
  <div
8
+ v-if="$slots.trigger"
9
+ ref="triggerRef"
10
+ class="inline-flex w-fit"
11
+ role="button"
12
+ :tabindex="props.disabled ? -1 : 0"
13
+ :aria-expanded="active"
14
+ @click="onTriggerClick"
15
+ @keydown.enter.prevent="onTriggerClick"
16
+ @keydown.space.prevent="onTriggerClick"
17
+ >
18
+ <slot name="trigger" :open="active" :value="model" />
19
+ </div>
20
+
21
+ <div
22
+ v-else
8
23
  ref="triggerRef"
9
24
  role="button"
10
25
  :tabindex="props.disabled ? -1 : 0"
@@ -150,7 +165,12 @@
150
165
 
151
166
  const triggerRef = ref<HTMLElement>();
152
167
 
153
- const draftTime = ref<UixyTimeParts>(timePartsOf(model.value));
168
+ const seedTime = (): UixyTimeParts =>
169
+ model.value
170
+ ? timePartsOf(model.value)
171
+ : { hour: props.defaultHour ?? 0, minute: 0, second: 0 };
172
+
173
+ const draftTime = ref<UixyTimeParts>(seedTime());
154
174
 
155
175
  const status = computed(() => {
156
176
  if (props.disabled) return "disabled";
@@ -209,11 +229,11 @@
209
229
  const clear = () => {
210
230
  model.value = null;
211
231
 
212
- draftTime.value = { hour: 0, minute: 0, second: 0 };
232
+ draftTime.value = { hour: props.defaultHour ?? 0, minute: 0, second: 0 };
213
233
  };
214
234
 
215
235
  watch(active, (isActive) => {
216
- if (isActive) draftTime.value = timePartsOf(model.value);
236
+ if (isActive) draftTime.value = seedTime();
217
237
  });
218
238
 
219
239
  const onDocClick = (event: MouseEvent) => {
@@ -11,6 +11,7 @@ export interface UixyDatePickerProps {
11
11
  icon?: IconName;
12
12
  withTime?: boolean;
13
13
  withSeconds?: boolean;
14
+ defaultHour?: number;
14
15
  startOfWeek?: "Sunday" | "Monday";
15
16
  isDateDisabled?: (date: Date) => boolean;
16
17
  direction?: "top" | "bottom";
@@ -18,14 +18,16 @@ export const inputStyles = styles(
18
18
  xl: "px-3.5 py-2.5 text-base",
19
19
  },
20
20
  icon: {
21
- left: "pl-8",
22
- right: "pr-8",
21
+ left: "",
22
+ right: "",
23
23
  none: "",
24
24
  },
25
25
  },
26
26
  {
27
27
  "size.sm+icon.left": "pl-7",
28
28
  "size.sm+icon.right": "pr-7",
29
+ "size.md+icon.left": "pl-9",
30
+ "size.md+icon.right": "pr-9",
29
31
  "size.xl+icon.left": "pl-9",
30
32
  "size.xl+icon.right": "pr-9",
31
33
  },
@@ -12,6 +12,7 @@
12
12
  :class="modalStyles($attrs.class as string)"
13
13
  :style="{ zIndex }"
14
14
  :[modalAttr]="''"
15
+ :data-uixy-modal-id="id"
15
16
  data-uixy-overlay
16
17
  @click.self="handleClick"
17
18
  >
@@ -35,7 +36,12 @@
35
36
  import type { UixyModalProps } from "./Modal.types";
36
37
  import { modalStyles } from "./Modal.styles";
37
38
  import { AnimatePresence, motion } from "motion-v";
38
- import { useModalLayer, MODAL_ATTR, getTopModalEl } from "~/composables";
39
+ import {
40
+ useModalLayer,
41
+ useGpuAcceleration,
42
+ MODAL_ATTR,
43
+ getTopModalEl,
44
+ } from "~/composables";
39
45
 
40
46
  const props = defineProps<UixyModalProps>();
41
47
 
@@ -48,12 +54,15 @@
48
54
  const rootRef = ref<HTMLElement>();
49
55
 
50
56
  const {
57
+ id,
51
58
  zIndex,
52
59
  isTopModal,
53
60
  open: openLayer,
54
61
  close: closeLayer,
55
62
  } = useModalLayer();
56
63
 
64
+ useGpuAcceleration();
65
+
57
66
  const modalAttr = computed(() => (open.value ? MODAL_ATTR : null));
58
67
 
59
68
  const handleClick = () => {
@@ -1,7 +1,7 @@
1
1
  import styles from "~/utils/styles";
2
2
 
3
3
  const modalStyles = styles(
4
- "fixed left-0 top-0 flex size-full items-center justify-center bg-white/5 backdrop-blur-[2px] dark:bg-gray-900/5"
4
+ "fixed left-0 top-0 flex size-full items-center justify-center bg-white/5 [html[data-uixy-gpu=on]_&]:backdrop-blur-[2px] dark:bg-gray-900/5"
5
5
  );
6
6
 
7
7
  export { modalStyles };