pxd 0.0.45 → 0.0.47

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 (87) hide show
  1. package/dist/components/_internal/fragment-container.d.ts +2 -0
  2. package/dist/components/_internal/fragment-container.js +25 -0
  3. package/dist/components/badge/index.vue +1 -1
  4. package/dist/components/button/index.vue +1 -1
  5. package/dist/components/carousel-group/index.d.vue.ts +1 -2
  6. package/dist/components/carousel-group/index.vue +16 -4
  7. package/dist/components/carousel-group/index.vue.d.ts +1 -2
  8. package/dist/components/choicebox/index.vue +1 -1
  9. package/dist/components/choicebox-group/index.vue +1 -1
  10. package/dist/components/config-provider/index.vue +1 -1
  11. package/dist/components/error/index.d.vue.ts +2 -2
  12. package/dist/components/error/index.vue +1 -1
  13. package/dist/components/error/index.vue.d.ts +2 -2
  14. package/dist/components/fader/index.vue +4 -21
  15. package/dist/components/index.d.ts +1 -1
  16. package/dist/components/index.js +1 -1
  17. package/dist/components/input/index.d.vue.ts +4 -5
  18. package/dist/components/input/index.vue +67 -71
  19. package/dist/components/input/index.vue.d.ts +4 -5
  20. package/dist/components/intersection-observer/index.vue +3 -3
  21. package/dist/components/link-button/index.vue +1 -1
  22. package/dist/components/list-item/index.vue +1 -1
  23. package/dist/components/menu/index.d.vue.ts +3 -3
  24. package/dist/components/menu/index.vue +1 -7
  25. package/dist/components/menu/index.vue.d.ts +3 -3
  26. package/dist/components/noise-background/index.d.vue.ts +19 -0
  27. package/dist/components/noise-background/index.vue +18 -0
  28. package/dist/components/noise-background/index.vue.d.ts +19 -0
  29. package/dist/components/note/index.d.vue.ts +3 -3
  30. package/dist/components/note/index.vue +1 -1
  31. package/dist/components/note/index.vue.d.ts +3 -3
  32. package/dist/components/number-input/index.d.vue.ts +1 -1
  33. package/dist/components/number-input/index.vue +1 -1
  34. package/dist/components/number-input/index.vue.d.ts +1 -1
  35. package/dist/components/pin-input/index.d.vue.ts +3 -14
  36. package/dist/components/pin-input/index.vue +28 -40
  37. package/dist/components/pin-input/index.vue.d.ts +3 -14
  38. package/dist/components/placeholder/index.vue +3 -5
  39. package/dist/components/popover/index.d.vue.ts +6 -16
  40. package/dist/components/popover/index.vue +71 -284
  41. package/dist/components/popover/index.vue.d.ts +6 -16
  42. package/dist/components/progress/index.d.vue.ts +1 -1
  43. package/dist/components/progress/index.vue.d.ts +1 -1
  44. package/dist/components/slider/index.d.vue.ts +1 -1
  45. package/dist/components/slider/index.vue.d.ts +1 -1
  46. package/dist/components/stack/index.vue +1 -1
  47. package/dist/components/status-dot/index.d.vue.ts +3 -2
  48. package/dist/components/status-dot/index.vue +1 -1
  49. package/dist/components/status-dot/index.vue.d.ts +3 -2
  50. package/dist/components/text/index.vue +1 -1
  51. package/dist/components/textarea/index.d.vue.ts +2 -13
  52. package/dist/components/textarea/index.vue +25 -33
  53. package/dist/components/textarea/index.vue.d.ts +2 -13
  54. package/dist/components/time-picker/index.d.vue.ts +7 -0
  55. package/dist/components/time-picker/index.vue +76 -93
  56. package/dist/components/time-picker/index.vue.d.ts +7 -0
  57. package/dist/components/toggle/index.d.vue.ts +4 -7
  58. package/dist/components/toggle/index.vue +32 -41
  59. package/dist/components/toggle/index.vue.d.ts +4 -7
  60. package/dist/components/tooltip/index.vue +1 -1
  61. package/dist/composables/use-outside-click.js +8 -2
  62. package/dist/styles/source.css +4 -3
  63. package/dist/styles/styles.css +1 -1
  64. package/dist/styles/tw.css +4 -3
  65. package/dist/types/components/error.d.ts +1 -1
  66. package/dist/types/components/input.d.ts +1 -1
  67. package/dist/utils/debounce.d.ts +1 -1
  68. package/dist/utils/debounce.js +1 -1
  69. package/dist/utils/get.d.ts +0 -8
  70. package/dist/utils/get.js +0 -125
  71. package/dist/utils/index.d.ts +11 -0
  72. package/dist/utils/index.js +11 -0
  73. package/dist/utils/throttle.d.ts +7 -1
  74. package/dist/utils/throttle.js +16 -1
  75. package/package.json +8 -2
  76. package/volar.d.ts +1 -1
  77. package/dist/components/keep-alive-container/index.d.vue.ts +0 -13
  78. package/dist/components/keep-alive-container/index.vue +0 -11
  79. package/dist/components/keep-alive-container/index.vue.d.ts +0 -13
  80. package/dist/utils/debounce/compat.d.ts +0 -143
  81. package/dist/utils/debounce/compat.js +0 -47
  82. package/dist/utils/debounce/index.d.ts +0 -73
  83. package/dist/utils/debounce/index.js +0 -60
  84. package/dist/utils/throttle/compat.d.ts +0 -79
  85. package/dist/utils/throttle/compat.js +0 -9
  86. package/dist/utils/throttle/index.d.ts +0 -53
  87. package/dist/utils/throttle/index.js +0 -34
@@ -68,5 +68,5 @@ const computedClass = computed(() => {
68
68
  <template>
69
69
  <Component :is="as" :class="computedClass" :style="computedStyle">
70
70
  <slot />
71
- </component>
71
+ </Component>
72
72
  </template>
@@ -1,8 +1,7 @@
1
1
  import type { ComponentLabel, ComponentSizeWithXs } from '../../types/shared';
2
2
  interface Props {
3
3
  size?: ComponentSizeWithXs;
4
- error?: string;
5
- label?: ComponentLabel;
4
+ error?: boolean | string;
6
5
  readonly?: boolean;
7
6
  disabled?: boolean;
8
7
  required?: boolean;
@@ -12,11 +11,7 @@ interface Props {
12
11
  modelValue?: ComponentLabel;
13
12
  placeholder?: string;
14
13
  }
15
- declare var __VLS_1: {};
16
- type __VLS_Slots = {} & {
17
- label?: (props: typeof __VLS_1) => any;
18
- };
19
- declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
15
  blur: (args_0: FocusEvent) => any;
21
16
  change: (args_0: Event) => any;
22
17
  focus: (args_0: FocusEvent) => any;
@@ -29,11 +24,5 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
29
24
  }>, {
30
25
  modelValue: ComponentLabel;
31
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
27
  declare const _default: typeof __VLS_export;
34
28
  export default _default;
35
- type __VLS_WithSlots<T, S> = T & {
36
- new (): {
37
- $slots: S;
38
- };
39
- };
@@ -4,7 +4,6 @@ import { useConfigProvider } from "../../composables/use-config-provider-context
4
4
  import { useModelValue } from "../../composables/use-model-value";
5
5
  import { getFallbackValue } from "../../utils/get";
6
6
  import { getUniqueId } from "../../utils/uid";
7
- import PError from "../error/index.vue";
8
7
  defineOptions({
9
8
  name: "PTextarea",
10
9
  model: {
@@ -14,8 +13,7 @@ defineOptions({
14
13
  });
15
14
  const props = defineProps({
16
15
  size: { type: String, required: false },
17
- error: { type: String, required: false },
18
- label: { type: [String, Number, Array, null], required: false },
16
+ error: { type: [Boolean, String], required: false },
19
17
  readonly: { type: Boolean, required: false },
20
18
  disabled: { type: Boolean, required: false },
21
19
  required: { type: Boolean, required: false },
@@ -36,7 +34,7 @@ const SIZES = {
36
34
  const modelValue = useModelValue(props, emits);
37
35
  const config = useConfigProvider();
38
36
  const computedClass = computed(() => {
39
- const classes = ["pxd-input--border flex h-full min-h-[inherit] items-center justify-center overflow-hidden rounded-md bg-background-100 motion-safe:transition-all"];
37
+ const classes = [];
40
38
  classes.push(getFallbackValue(props.size, SIZES, config.size));
41
39
  if (props.disabled) {
42
40
  classes.push("is-disabled");
@@ -61,34 +59,28 @@ function onInputChange(event) {
61
59
  </script>
62
60
 
63
61
  <template>
64
- <label class="pxd-textarea block w-full max-w-full" :for="uniqueId">
65
- <div v-if="label || $slots.label" class="pxd-form--label">
66
- <slot name="label">{{ label }}</slot>
67
- </div>
68
-
69
- <div :class="computedClass">
70
- <textarea
71
- :id="uniqueId"
72
- v-model="modelValue"
73
- class="py-2.5 px-3 size-full min-h-[inherit] resize-none appearance-none rounded-inherit border-none bg-transparent font-inherit outline-none placeholder:text-gray-600 placeholder:select-none disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-700 disabled:placeholder:text-gray-400"
74
- autocorrect="off"
75
- autocomplete="off"
76
- autocapitalize="off"
77
- :readonly="readonly"
78
- :disabled="disabled"
79
- :required="required"
80
- :autofocus="autofocus"
81
- :minlength="minlength"
82
- :maxlength="maxlength"
83
- :placeholder="placeholder"
84
- @change="onInputChange"
85
- @focus="onInputFocus"
86
- @blur="onInputBlur"
87
- />
88
- </div>
89
-
90
- <PError v-if="error" class="mt-1.5" :size="size">
91
- {{ error }}
92
- </PError>
62
+ <label
63
+ :for="uniqueId"
64
+ class="pxd-textarea pxd-input--border flex size-full min-h-[inherit] max-w-full items-center justify-center overflow-hidden rounded-md bg-background-100 motion-safe:transition-all"
65
+ :class="computedClass"
66
+ >
67
+ <textarea
68
+ :id="uniqueId"
69
+ v-model="modelValue"
70
+ class="py-2.5 px-3 size-full min-h-[inherit] resize-none appearance-none rounded-inherit border-none bg-transparent font-inherit outline-none placeholder:text-gray-600 placeholder:select-none disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-700 disabled:placeholder:text-gray-400"
71
+ autocorrect="off"
72
+ autocomplete="off"
73
+ autocapitalize="off"
74
+ :readonly="readonly"
75
+ :disabled="disabled"
76
+ :required="required"
77
+ :autofocus="autofocus"
78
+ :minlength="minlength"
79
+ :maxlength="maxlength"
80
+ :placeholder="placeholder"
81
+ @change="onInputChange"
82
+ @focus="onInputFocus"
83
+ @blur="onInputBlur"
84
+ />
93
85
  </label>
94
86
  </template>
@@ -1,8 +1,7 @@
1
1
  import type { ComponentLabel, ComponentSizeWithXs } from '../../types/shared';
2
2
  interface Props {
3
3
  size?: ComponentSizeWithXs;
4
- error?: string;
5
- label?: ComponentLabel;
4
+ error?: boolean | string;
6
5
  readonly?: boolean;
7
6
  disabled?: boolean;
8
7
  required?: boolean;
@@ -12,11 +11,7 @@ interface Props {
12
11
  modelValue?: ComponentLabel;
13
12
  placeholder?: string;
14
13
  }
15
- declare var __VLS_1: {};
16
- type __VLS_Slots = {} & {
17
- label?: (props: typeof __VLS_1) => any;
18
- };
19
- declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
15
  blur: (args_0: FocusEvent) => any;
21
16
  change: (args_0: Event) => any;
22
17
  focus: (args_0: FocusEvent) => any;
@@ -29,11 +24,5 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
29
24
  }>, {
30
25
  modelValue: ComponentLabel;
31
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
27
  declare const _default: typeof __VLS_export;
34
28
  export default _default;
35
- type __VLS_WithSlots<T, S> = T & {
36
- new (): {
37
- $slots: S;
38
- };
39
- };
@@ -1,5 +1,8 @@
1
1
  import type { DateTimePreset } from '../../types/components/time-picker';
2
+ import type { ComponentSize } from '../../types/shared/props';
2
3
  interface Props {
4
+ size?: ComponentSize;
5
+ error?: boolean | string;
3
6
  allowClear?: boolean;
4
7
  presets?: DateTimePreset[];
5
8
  disabled?: boolean;
@@ -7,6 +10,8 @@ interface Props {
7
10
  prefixIcon?: boolean;
8
11
  placeholder?: string;
9
12
  closeOnPressEscape?: boolean;
13
+ format?: string;
14
+ valueFormat?: string;
10
15
  }
11
16
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
17
  select: (args_0: MouseEvent) => any;
@@ -19,8 +24,10 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
19
24
  }>, {
20
25
  modelValue: Date | string | number;
21
26
  closeOnPressEscape: boolean;
27
+ format: string;
22
28
  presets: DateTimePreset[];
23
29
  prefixIcon: boolean;
30
+ valueFormat: string;
24
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
32
  declare const _default: typeof __VLS_export;
26
33
  export default _default;
@@ -1,9 +1,8 @@
1
1
  <script setup>
2
2
  import CalendarIcon from "@gdsicon/vue/calendar";
3
- import { computed, ref, shallowRef, watch } from "vue";
3
+ import { computed, shallowRef, watch } from "vue";
4
4
  import { useConfigProvider } from "../../composables/use-config-provider-context";
5
5
  import { dayjs } from "../../utils/date";
6
- import { sleep } from "../../utils/event";
7
6
  import { clampValue } from "../../utils/format";
8
7
  import PInput from "../input/index.vue";
9
8
  import PPopover from "../popover/index.vue";
@@ -16,31 +15,34 @@ defineOptions({
16
15
  }
17
16
  });
18
17
  const props = defineProps({
18
+ size: { type: String, required: false },
19
+ error: { type: [Boolean, String], required: false },
19
20
  allowClear: { type: Boolean, required: false },
20
21
  presets: { type: Array, required: false, default: () => [] },
21
22
  disabled: { type: Boolean, required: false },
22
23
  modelValue: { type: [Date, String, Number], required: false, default: "" },
23
24
  prefixIcon: { type: Boolean, required: false, default: true },
24
25
  placeholder: { type: String, required: false },
25
- closeOnPressEscape: { type: Boolean, required: false, default: true }
26
+ closeOnPressEscape: { type: Boolean, required: false, default: true },
27
+ format: { type: String, required: false, default: "HH:mm:ss" },
28
+ valueFormat: { type: String, required: false, default: "HH:mm:ss" }
26
29
  });
27
30
  const emits = defineEmits(["change", "select", "update:modelValue"]);
28
31
  const HEIGHT = 32;
29
32
  const VALUE_POSITION_MAP = {
30
- hours: 0,
31
- minutes: 1,
32
- seconds: 2
33
+ hour: 0,
34
+ minute: 1,
35
+ second: 2
33
36
  };
34
37
  const config = useConfigProvider();
35
- const inputRef = shallowRef();
36
38
  const timeHoursRef = shallowRef();
37
39
  const timeMinutesRef = shallowRef();
38
40
  const timeSecondsRef = shallowRef();
39
41
  const popoverVisible = shallowRef(false);
40
- const modelValueList = ref([]);
42
+ const dayjsDateTime = shallowRef(null);
41
43
  const modelValue = computed({
42
44
  get() {
43
- return modelValueList.value.join(":");
45
+ return dayjsDateTime.value ? dayjsDateTime.value.format(props.format) : "";
44
46
  },
45
47
  set(value) {
46
48
  emits("update:modelValue", value);
@@ -52,14 +54,14 @@ function onTimeListScroll(ev) {
52
54
  const value = Math.round(target.scrollTop / HEIGHT);
53
55
  const type = target.dataset.type;
54
56
  const index = VALUE_POSITION_MAP[type];
55
- const clampedValue = clampValue(value, 0, type === "hours" ? 23 : 59);
57
+ const clampedValue = clampValue(value, 0, type === "hour" ? 23 : 59);
56
58
  clearTimeout(scrollTimers[index]);
57
59
  scrollTimers[index] = setTimeout(() => {
58
60
  target.scrollTo({
59
61
  top: clampedValue * HEIGHT,
60
62
  behavior: "smooth"
61
63
  });
62
- modelValueList.value[index] = padStringZero(clampedValue);
64
+ dayjsDateTime.value = dayjsDateTime.value ? dayjsDateTime.value.set(type, clampedValue) : null;
63
65
  }, 100);
64
66
  }
65
67
  function padStringZero(value) {
@@ -68,26 +70,15 @@ function padStringZero(value) {
68
70
  function onVisibleChange(visible) {
69
71
  popoverVisible.value = visible;
70
72
  }
71
- function showPopover() {
72
- onVisibleChange(true);
73
- setTimesScrollTop();
74
- }
75
73
  function hidePopover() {
76
74
  onVisibleChange(false);
77
75
  }
78
- function parseTimeValue(value, max) {
79
- const numberValue = value ? Number.parseInt(value.slice(0, 2)) : 0;
80
- if (!numberValue) {
81
- return "00";
82
- }
83
- return clampValue(numberValue, 0, max).toString();
84
- }
85
76
  function updateValueList(value) {
86
- modelValueList.value = getFormattedValue(value).split(":");
77
+ dayjsDateTime.value = getFormattedValue(value);
87
78
  }
88
79
  function getFormattedValue(value) {
89
80
  if (value == null || value === "") {
90
- return "";
81
+ return dayjs();
91
82
  }
92
83
  let _value;
93
84
  if (typeof value === "string") {
@@ -98,13 +89,16 @@ function getFormattedValue(value) {
98
89
  } else {
99
90
  _value = new Date(value);
100
91
  }
101
- return dayjs(_value).format("HH:mm:ss");
92
+ return dayjs(_value);
102
93
  }
103
94
  async function setTimesScrollTop() {
104
- await sleep(10);
95
+ if (!dayjsDateTime.value) {
96
+ return;
97
+ }
105
98
  const elList = [timeHoursRef.value, timeMinutesRef.value, timeSecondsRef.value];
99
+ const modelValueList = [dayjsDateTime.value.hour(), dayjsDateTime.value.minute(), dayjsDateTime.value.second()];
106
100
  elList.forEach((el, i) => {
107
- const scrollTop = Number(modelValueList.value[i] || 0) * HEIGHT;
101
+ const scrollTop = modelValueList[i] * HEIGHT;
108
102
  el?.scrollTo({ top: scrollTop });
109
103
  });
110
104
  }
@@ -133,35 +127,27 @@ function onCancelClick() {
133
127
  hidePopover();
134
128
  }
135
129
  function onConfirmClick() {
136
- updateValueList(modelValueList.value.join(":"));
137
- modelValue.value = modelValueList.value.join(":");
138
- hidePopover();
130
+ modelValue.value = dayjsDateTime.value ? dayjsDateTime.value.format(props.valueFormat) : "";
139
131
  }
140
- function onNowBtnClick(date) {
141
- const newValue = getFormattedValue(date ?? /* @__PURE__ */ new Date());
142
- modelValue.value = newValue;
143
- modelValueList.value = newValue.split(":");
132
+ function onPresetTimeClick(date) {
133
+ onInputValueChange(date ?? /* @__PURE__ */ new Date());
144
134
  hidePopover();
145
135
  }
146
136
  function onInputValueChange(value) {
147
137
  if (!value) {
148
138
  modelValue.value = "";
149
- modelValueList.value = [];
139
+ dayjsDateTime.value = null;
150
140
  return;
151
141
  }
152
- const [h, m, s] = value.split(":");
153
- const hh = parseTimeValue(h, 23);
154
- const mm = parseTimeValue(m, 59);
155
- const ss = parseTimeValue(s, 59);
156
- modelValue.value = getFormattedValue(`${hh}:${mm}:${ss}`);
157
- modelValueList.value = [padStringZero(hh), padStringZero(mm), padStringZero(ss)];
142
+ dayjsDateTime.value = getFormattedValue(value);
143
+ onConfirmClick();
158
144
  }
159
145
  function onUpdateModelValue(value) {
160
146
  if (value) {
161
147
  return;
162
148
  }
163
149
  modelValue.value = "";
164
- modelValueList.value = [];
150
+ dayjsDateTime.value = null;
165
151
  }
166
152
  function onPresetClick(ev) {
167
153
  const target = ev.target;
@@ -176,7 +162,7 @@ function onPresetClick(ev) {
176
162
  if (!presetValue) {
177
163
  return;
178
164
  }
179
- onNowBtnClick(presetValue);
165
+ onPresetTimeClick(presetValue);
180
166
  }
181
167
  watch(() => props.modelValue, updateValueList, { immediate: true });
182
168
  </script>
@@ -184,89 +170,86 @@ watch(() => props.modelValue, updateValueList, { immediate: true });
184
170
  <template>
185
171
  <PPopover
186
172
  enterable
187
- close-on-scroll
188
- trigger="manual"
173
+ trigger="click"
189
174
  :show-delay="0"
190
- :hide-delay="100"
175
+ :hide-delay="0"
191
176
  :disabled="disabled"
192
177
  :class="$attrs.class"
193
178
  :style="$attrs.style"
194
- :show-transition="false"
195
179
  :visible="popoverVisible"
196
180
  :close-on-press-escape="closeOnPressEscape"
181
+ content-class="bg-background-100 shadow-border-menu rounded-xl"
197
182
  class="pxd-time-picker w-full"
198
183
  @escape="onCancelClick"
199
- @trigger-click="showPopover"
184
+ @show="setTimesScrollTop"
200
185
  @outside-click="onConfirmClick"
201
186
  @visible-change="onVisibleChange"
202
187
  >
203
188
  <PInput
204
- ref="inputRef"
189
+ :size="size"
190
+ :error="error"
205
191
  :disabled="disabled"
206
192
  :allow-clear="allowClear"
207
193
  :model-value="modelValue"
208
194
  :placeholder="placeholder"
209
195
  :prefix-style="false"
210
196
  v-bind="$attrs"
211
- @click.stop="showPopover"
212
197
  @change="onInputValueChange"
213
198
  @keydown.enter="onConfirmClick"
214
199
  @update:model-value="onUpdateModelValue"
215
200
  >
216
201
  <template v-if="prefixIcon" #prefix>
217
- <CalendarIcon class="ml-3 pointer-events-none" />
202
+ <CalendarIcon class="pointer-events-none" />
218
203
  </template>
219
204
  </PInput>
220
205
 
221
206
  <template #content>
222
- <div class="rounded-xl bg-background-100 shadow-border-menu">
223
- <div class="text-sm flex max-w-full transform-gpu tabular-nums outline-none select-none" @click.stop="onTimeListClick">
224
- <div class="p-2 gap-1 relative flex items-center">
225
- <div class="pxd-time-picker--list relative">
226
- <ul ref="timeHoursRef" data-type="hours" class="w-8 h-40 px-0 m-0 py-16 scrollbar-hidden list-none overflow-x-hidden overflow-y-scroll overscroll-contain text-center outline-none" @scroll.stop="onTimeListScroll">
227
- <li v-for="_, i of 24" :key="i" class="h-8 leading-8 cursor-pointer">
228
- {{ padStringZero(i) }}
229
- </li>
230
- </ul>
231
- </div>
232
- <div class="pxd-time-picker--list relative">
233
- <ul ref="timeMinutesRef" data-type="minutes" class="w-8 h-40 px-0 m-0 py-16 scrollbar-hidden list-none overflow-x-hidden overflow-y-scroll overscroll-contain text-center outline-none" @scroll.stop="onTimeListScroll">
234
- <li v-for="_, i of 60" :key="i" class="h-8 leading-8 cursor-pointer">
235
- {{ padStringZero(i) }}
236
- </li>
237
- </ul>
238
- </div>
239
- <div class="pxd-time-picker--list relative">
240
- <ul ref="timeSecondsRef" data-type="seconds" class="w-8 h-40 px-0 m-0 py-16 scrollbar-hidden list-none overflow-x-hidden overflow-y-scroll overscroll-contain text-center outline-none" @scroll.stop="onTimeListScroll">
241
- <li v-for="_, i of 60" :key="i" class="h-8 leading-8 cursor-pointer">
242
- {{ padStringZero(i) }}
243
- </li>
244
- </ul>
245
- </div>
207
+ <div class="text-sm flex max-w-full transform-gpu tabular-nums outline-none select-none" @click.stop="onTimeListClick">
208
+ <div class="p-2 gap-1 relative flex items-center">
209
+ <div class="pxd-time-picker--list relative">
210
+ <ul ref="timeHoursRef" data-type="hour" class="w-8 h-40 px-0 m-0 py-16 scrollbar-hidden list-none overflow-x-hidden overflow-y-scroll overscroll-contain text-center outline-none" @scroll.stop="onTimeListScroll">
211
+ <li v-for="_, i of 24" :key="i" class="h-8 leading-8 cursor-pointer">
212
+ {{ padStringZero(i) }}
213
+ </li>
214
+ </ul>
246
215
  </div>
247
-
248
- <div v-if="presets?.length" class="w-26 p-2 h-44 gap-1 scrollbar-hidden flex flex-wrap content-start overflow-auto border-l outline-none" @click="onPresetClick">
249
- <button
250
- v-for="preset, i in presets"
251
- :key="preset.label"
252
- :data-index="i"
253
- class="h-5 px-1.5 cursor-pointer appearance-none rounded-sm bg-gray-300 text-13px whitespace-nowrap text-foreground self-focus-ring outline-none motion-safe:transition-all"
254
- >
255
- {{ preset.label }}
256
- </button>
216
+ <div class="pxd-time-picker--list relative">
217
+ <ul ref="timeMinutesRef" data-type="minute" class="w-8 h-40 px-0 m-0 py-16 scrollbar-hidden list-none overflow-x-hidden overflow-y-scroll overscroll-contain text-center outline-none" @scroll.stop="onTimeListScroll">
218
+ <li v-for="_, i of 60" :key="i" class="h-8 leading-8 cursor-pointer">
219
+ {{ padStringZero(i) }}
220
+ </li>
221
+ </ul>
222
+ </div>
223
+ <div class="pxd-time-picker--list relative">
224
+ <ul ref="timeSecondsRef" data-type="second" class="w-8 h-40 px-0 m-0 py-16 scrollbar-hidden list-none overflow-x-hidden overflow-y-scroll overscroll-contain text-center outline-none" @scroll.stop="onTimeListScroll">
225
+ <li v-for="_, i of 60" :key="i" class="h-8 leading-8 cursor-pointer">
226
+ {{ padStringZero(i) }}
227
+ </li>
228
+ </ul>
257
229
  </div>
258
230
  </div>
259
231
 
260
- <div class="p-2 gap-1 flex items-center justify-between border-t" @click.stop>
261
- <PButton size="xs" variant="ghost" class="px-0! text-13px" @click="onNowBtnClick()">
262
- {{ config.locale.date.now }}
263
- </PButton>
264
-
265
- <PButton size="xs" variant="ghost" class="px-0! text-13px" @click="onCancelClick">
266
- {{ config.locale.confirm.cancel }}
267
- </PButton>
232
+ <div v-if="presets?.length" class="w-26 p-2 h-44 gap-1 scrollbar-hidden flex flex-wrap content-start overflow-auto border-l outline-none" @click="onPresetClick">
233
+ <button
234
+ v-for="preset, i in presets"
235
+ :key="preset.label"
236
+ :data-index="i"
237
+ class="h-5 px-1.5 cursor-pointer appearance-none rounded-sm bg-gray-300 text-13px whitespace-nowrap text-foreground self-focus-ring outline-none motion-safe:transition-all"
238
+ >
239
+ {{ preset.label }}
240
+ </button>
268
241
  </div>
269
242
  </div>
243
+
244
+ <div class="p-2 gap-1 flex items-center justify-between border-t" @click.stop>
245
+ <PButton size="xs" variant="ghost" class="px-0! text-13px" @click="onPresetTimeClick()">
246
+ {{ config.locale.date.now }}
247
+ </PButton>
248
+
249
+ <PButton size="xs" variant="ghost" class="px-0! text-13px" @click="onCancelClick">
250
+ {{ config.locale.confirm.cancel }}
251
+ </PButton>
252
+ </div>
270
253
  </template>
271
254
  </PPopover>
272
255
  </template>
@@ -1,5 +1,8 @@
1
1
  import type { DateTimePreset } from '../../types/components/time-picker';
2
+ import type { ComponentSize } from '../../types/shared/props';
2
3
  interface Props {
4
+ size?: ComponentSize;
5
+ error?: boolean | string;
3
6
  allowClear?: boolean;
4
7
  presets?: DateTimePreset[];
5
8
  disabled?: boolean;
@@ -7,6 +10,8 @@ interface Props {
7
10
  prefixIcon?: boolean;
8
11
  placeholder?: string;
9
12
  closeOnPressEscape?: boolean;
13
+ format?: string;
14
+ valueFormat?: string;
10
15
  }
11
16
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
17
  select: (args_0: MouseEvent) => any;
@@ -19,8 +24,10 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
19
24
  }>, {
20
25
  modelValue: Date | string | number;
21
26
  closeOnPressEscape: boolean;
27
+ format: string;
22
28
  presets: DateTimePreset[];
23
29
  prefixIcon: boolean;
30
+ valueFormat: string;
24
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
32
  declare const _default: typeof __VLS_export;
26
33
  export default _default;
@@ -1,8 +1,7 @@
1
- import type { ComponentBeforeChange, ComponentLabel, ComponentSize } from '../../types/shared';
1
+ import type { ComponentBeforeChange, ComponentSize } from '../../types/shared';
2
2
  type ValueType = boolean | number | string;
3
3
  interface Props {
4
4
  size?: ComponentSize;
5
- label?: ComponentLabel;
6
5
  loading?: boolean;
7
6
  disabled?: boolean;
8
7
  modelValue?: ValueType;
@@ -14,13 +13,11 @@ interface Props {
14
13
  activeLabel?: string;
15
14
  inactiveLabel?: string;
16
15
  }
17
- declare var __VLS_1: {}, __VLS_14: {}, __VLS_16: {};
16
+ declare var __VLS_12: {}, __VLS_14: {};
18
17
  type __VLS_Slots = {} & {
19
- label?: (props: typeof __VLS_1) => any;
18
+ checked?: (props: typeof __VLS_12) => any;
20
19
  } & {
21
- checked?: (props: typeof __VLS_14) => any;
22
- } & {
23
- unchecked?: (props: typeof __VLS_16) => any;
20
+ unchecked?: (props: typeof __VLS_14) => any;
24
21
  };
25
22
  declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
23
  change: (args_0: NonNullable<ValueType | undefined>) => any;
@@ -14,7 +14,6 @@ defineOptions({
14
14
  });
15
15
  const props = defineProps({
16
16
  size: { type: String, required: false },
17
- label: { type: [String, Number, Array, null], required: false },
18
17
  loading: { type: Boolean, required: false },
19
18
  disabled: { type: Boolean, required: false },
20
19
  modelValue: { type: [Boolean, Number, String], required: false },
@@ -59,58 +58,50 @@ async function onCheckboxChange(e) {
59
58
  <template>
60
59
  <label
61
60
  role="switch"
62
- class="pxd-toggle group/toggle inline-flex cursor-pointer touch-manipulation flex-col select-none"
61
+ :for="uniqueId"
62
+ class="pxd-toggle group/toggle inline-flex cursor-pointer touch-manipulation items-center select-none"
63
63
  :aria-label="modelValue ? activeLabel : inactiveLabel"
64
64
  :style="{
65
65
  '--ac': activeColor,
66
66
  '--ic': inactiveColor
67
67
  }"
68
- :for="uniqueId"
69
68
  >
70
- <div v-if="label || $slots.label" class="pxd-form--label">
71
- <slot name="label">{{ label }}</slot>
72
- </div>
73
-
74
- <div class="flex items-center">
75
- <input
76
- :id="uniqueId"
77
- type="checkbox"
78
- :disabled="disabled || loading"
79
- :checked="isChecked"
80
- class="pxd-toggle--input peer smallest"
81
- @change.prevent="onCheckboxChange"
82
- >
69
+ <input
70
+ :id="uniqueId"
71
+ type="checkbox"
72
+ :disabled="disabled || loading"
73
+ :checked="isChecked"
74
+ class="pxd-toggle--input peer smallest"
75
+ @change.prevent="onCheckboxChange"
76
+ >
83
77
 
84
- <span
85
- v-if="inactiveLabel"
86
- class="pxd-toggle--label text-sm mr-1.5 pl-0.5 opacity-100 peer-checked:opacity-50 motion-safe:transition-opacity"
87
- >{{ inactiveLabel }}</span>
78
+ <span
79
+ v-if="inactiveLabel"
80
+ class="pxd-toggle--label text-sm mr-1.5 pl-0.5 opacity-100 peer-checked:opacity-50 motion-safe:transition-opacity"
81
+ >{{ inactiveLabel }}</span>
88
82
 
89
- <div
90
- class="pxd-toggle--handle rounded-full border border-input bg-(--ic) p-px peer-focus-ring [--tx:0] peer-checked:bg-(--ac) peer-checked:[--tx:100%] peer-disabled:cursor-not-allowed motion-safe:transition-all"
91
- :class="computedSize"
92
- >
93
- <div class="pxd-toggle--handle-icon text-xs shadow-sm relative flex aspect-square h-full translate-x-(--tx) transform-gpu items-center justify-center overflow-hidden rounded-full bg-background-100 text-foreground-secondary motion-safe:transition-transform">
94
- <div class="inset-0 absolute flex items-center justify-center">
95
- <Transition name="pxd-transition--fade" mode="out-in">
96
- <LoaderCircleIcon v-if="loading" class="motion-safe:animate-spin" />
97
- <slot v-else-if="modelValue" name="checked" />
98
- <slot v-else name="unchecked" />
99
- </Transition>
100
- </div>
83
+ <div
84
+ class="pxd-toggle--handle rounded-full border border-input bg-(--ic) p-px peer-focus-ring [--tx:0] peer-checked:bg-(--ac) peer-checked:[--tx:100%] peer-disabled:cursor-not-allowed motion-safe:transition-all"
85
+ :class="computedSize"
86
+ >
87
+ <div class="pxd-toggle--handle-icon text-xs shadow-sm relative flex aspect-square h-full translate-x-(--tx) transform-gpu items-center justify-center overflow-hidden rounded-full bg-background-100 text-foreground-secondary motion-safe:transition-transform">
88
+ <div class="inset-0 absolute flex items-center justify-center">
89
+ <Transition name="pxd-transition--fade" mode="out-in">
90
+ <LoaderCircleIcon v-if="loading" class="motion-safe:animate-spin" />
91
+ <slot v-else-if="modelValue" name="checked" />
92
+ <slot v-else name="unchecked" />
93
+ </Transition>
101
94
  </div>
102
95
  </div>
103
-
104
- <span
105
- v-if="activeLabel"
106
- class="pxd-toggle--label text-sm ml-1.5 pr-0.5 opacity-50 peer-checked:opacity-100 motion-safe:transition-opacity"
107
- >{{ activeLabel }}</span>
108
96
  </div>
97
+
98
+ <span
99
+ v-if="activeLabel"
100
+ class="pxd-toggle--label text-sm ml-1.5 pr-0.5 opacity-50 peer-checked:opacity-100 motion-safe:transition-opacity"
101
+ >{{ activeLabel }}</span>
109
102
  </label>
110
103
  </template>
111
104
 
112
- <style lang="postcss">
113
- .pxd-toggle--input:checked:disabled + .pxd-toggle--handle {
114
- background-color: var(--color-gray-300)
115
- }
105
+ <style>
106
+ .pxd-toggle--input:checked:disabled+.pxd-toggle--handle{background-color:var(--color-gray-300)}
116
107
  </style>