pxd 0.0.13 → 0.0.15

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 (71) hide show
  1. package/dist/components/active-graph/index.vue +163 -0
  2. package/dist/components/active-graph/index.vue.d.ts +19 -0
  3. package/dist/components/avatar/index.vue +28 -7
  4. package/dist/components/avatar/index.vue.d.ts +9 -1
  5. package/dist/components/button/index.vue +9 -5
  6. package/dist/components/button/index.vue.d.ts +6 -4
  7. package/dist/components/checkbox/index.vue +4 -3
  8. package/dist/components/checkbox/index.vue.d.ts +2 -2
  9. package/dist/components/checkbox-group/index.vue +5 -1
  10. package/dist/components/config-provider/index.vue +3 -1
  11. package/dist/components/config-provider/index.vue.d.ts +1 -0
  12. package/dist/components/description/index.vue +31 -0
  13. package/dist/components/description/index.vue.d.ts +19 -0
  14. package/dist/components/error/index.vue +17 -13
  15. package/dist/components/gauge/index.vue +12 -17
  16. package/dist/components/gauge/index.vue.d.ts +2 -2
  17. package/dist/components/hold-button/index.vue +1 -1
  18. package/dist/components/index.d.ts +4 -1
  19. package/dist/components/index.js +4 -1
  20. package/dist/components/input/index.vue +27 -19
  21. package/dist/components/input/index.vue.d.ts +12 -9
  22. package/dist/components/kbd/index.vue +1 -1
  23. package/dist/components/link-button/index.vue +1 -1
  24. package/dist/components/more-button/index.vue +2 -2
  25. package/dist/components/note/index.vue +14 -7
  26. package/dist/components/note/index.vue.d.ts +35 -7
  27. package/dist/components/progress/index.vue +9 -15
  28. package/dist/components/progress/index.vue.d.ts +2 -2
  29. package/dist/components/radio/index.vue +2 -2
  30. package/dist/components/radio/index.vue.d.ts +2 -2
  31. package/dist/components/radio-group/index.vue.d.ts +2 -2
  32. package/dist/components/scrollable/index.vue +2 -3
  33. package/dist/components/slider/index.vue +35 -27
  34. package/dist/components/slider/index.vue.d.ts +5 -4
  35. package/dist/components/snippet/index.vue +4 -3
  36. package/dist/components/textarea/index.vue +18 -10
  37. package/dist/components/textarea/index.vue.d.ts +16 -5
  38. package/dist/components/{color-scheme → theme-switcher}/index.vue +5 -2
  39. package/dist/components/toggle/index.vue +2 -2
  40. package/dist/components/toggle/index.vue.d.ts +2 -2
  41. package/dist/components/tooltip/index.vue +265 -0
  42. package/dist/components/tooltip/index.vue.d.ts +36 -0
  43. package/dist/composables/useConfigProviderContext.d.ts +1 -0
  44. package/dist/composables/useConfigProviderContext.js +3 -1
  45. package/dist/composables/useModelValue.d.ts +1 -1
  46. package/dist/composables/useRandomValueContext.js +6 -6
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +1 -1
  49. package/dist/locales/en-US.d.ts +32 -0
  50. package/dist/locales/en-US.js +31 -0
  51. package/dist/locales/index.d.ts +2 -0
  52. package/dist/locales/index.js +2 -0
  53. package/dist/locales/zh-CN.d.ts +32 -0
  54. package/dist/locales/zh-CN.js +31 -0
  55. package/dist/styles/dst.css +277 -0
  56. package/dist/styles/styles.css +2 -0
  57. package/dist/styles/tw.css +361 -355
  58. package/dist/utils/colors.d.ts +1 -0
  59. package/dist/utils/colors.js +13 -0
  60. package/dist/utils/date.d.ts +12 -0
  61. package/dist/utils/date.js +40 -0
  62. package/dist/utils/fn.d.ts +1 -0
  63. package/dist/utils/fn.js +17 -0
  64. package/dist/utils/random.d.ts +1 -1
  65. package/dist/utils/random.js +2 -2
  66. package/dist/utils/uid.d.ts +1 -0
  67. package/dist/utils/uid.js +4 -0
  68. package/package.json +27 -7
  69. package/dist/styles/index.css +0 -2
  70. package/dist/styles/tokens.css +0 -238
  71. /package/dist/components/{color-scheme → theme-switcher}/index.vue.d.ts +0 -0
@@ -0,0 +1,163 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useConfigProvider } from "../../composables/useConfigProviderContext";
4
+ import { getStateColor } from "../../utils/colors";
5
+ import { getAllDatesBetween } from "../../utils/date";
6
+ defineOptions({
7
+ name: "PActiveGraph"
8
+ });
9
+ const props = defineProps({
10
+ data: { type: Array, required: false, default: () => [] },
11
+ legend: { type: Boolean, required: false, default: true },
12
+ startDate: { type: [String, Date], required: false, default: () => {
13
+ const date = /* @__PURE__ */ new Date();
14
+ date.setFullYear(date.getFullYear() - 1);
15
+ while (date.getDay() !== 0) {
16
+ date.setDate(date.getDate() + 1);
17
+ }
18
+ return date;
19
+ } },
20
+ endDate: { type: [String, Date], required: false, default: () => /* @__PURE__ */ new Date() },
21
+ colors: { type: Object, required: false, default: () => ({
22
+ 0: "var(--color-gray-alpha-200)",
23
+ 5: "var(--color-green-300)",
24
+ 10: "var(--color-green-500)",
25
+ 15: "var(--color-green-700)",
26
+ 20: "var(--color-green-900)"
27
+ }) }
28
+ });
29
+ const emits = defineEmits(["cellClick"]);
30
+ const config = useConfigProvider();
31
+ const allDates = computed(() => getAllDatesBetween(props.startDate, props.endDate));
32
+ const dataCountsMap = computed(() => {
33
+ const map = props.data.reduce((acc, cur) => {
34
+ acc[cur.date] = (acc[cur.date] || 0) + cur.count;
35
+ return acc;
36
+ }, {});
37
+ return map;
38
+ });
39
+ const formatData = computed(() => {
40
+ const dataMap = dataCountsMap.value;
41
+ const dateList = allDates.value.dates;
42
+ const dateListLength = dateList.length;
43
+ const result = [];
44
+ const firstDayOfWeek = new Date(dateList[0]).getDay();
45
+ for (let i = 0; i < 7; i++) {
46
+ const row = [];
47
+ if (i < firstDayOfWeek) {
48
+ row.push({
49
+ hidden: true,
50
+ date: void 0,
51
+ count: 0,
52
+ color: void 0
53
+ });
54
+ }
55
+ result.push(row);
56
+ }
57
+ for (let i = 0; i < dateListLength; i++) {
58
+ const date = dateList[i];
59
+ const dateCount = dataMap[date] || 0;
60
+ const dayOfWeek = new Date(date).getDay();
61
+ result[dayOfWeek].push({
62
+ hidden: false,
63
+ date,
64
+ count: dateCount,
65
+ color: getStateColor(dateCount, props.colors)
66
+ });
67
+ }
68
+ return result;
69
+ });
70
+ const tableMonths = computed(() => {
71
+ const dates = allDates.value.dates;
72
+ const result = [];
73
+ const colCount = Math.ceil(allDates.value.dates.length / 7);
74
+ for (let i = 0; i < colCount; i++) {
75
+ result.push("");
76
+ }
77
+ const firstDate = new Date(dates[0]);
78
+ result[0] = config.locale.date.month[firstDate.getMonth()];
79
+ const firstDayOfWeek = firstDate.getDay();
80
+ let currentMonth = firstDate.getMonth();
81
+ for (let i = 1; i < dates.length; i++) {
82
+ const date = new Date(dates[i]);
83
+ const month = date.getMonth();
84
+ const day = date.getDate();
85
+ if (month !== currentMonth && day === 1) {
86
+ const colIndex = Math.floor((i + 7 - firstDayOfWeek) / 7);
87
+ if (colIndex < colCount) {
88
+ result[colIndex] = config.locale.date.month[month];
89
+ currentMonth = month;
90
+ }
91
+ }
92
+ }
93
+ return result;
94
+ });
95
+ function onCellClick(event) {
96
+ const target = event.target;
97
+ const date = target.dataset.date;
98
+ if (!date) {
99
+ return;
100
+ }
101
+ emits("cellClick", event, date);
102
+ }
103
+ </script>
104
+
105
+ <template>
106
+ <div class="pxd-active-graph">
107
+ <table
108
+ role="grid"
109
+ aria-readonly="true"
110
+ class="pr-5 overflow-hidden"
111
+ style="border-spacing: 3px; border-collapse: separate"
112
+ >
113
+ <thead class="text-xs">
114
+ <tr class="h-3">
115
+ <th style="width: 30px;min-width: 30px;" />
116
+
117
+ <th
118
+ v-for="col in tableMonths"
119
+ :key="col"
120
+ class="relative font-normal text-gray-900"
121
+ >
122
+ <span class="absolute -top-1 left-0 whitespace-nowrap">{{ col }}</span>
123
+ </th>
124
+ </tr>
125
+ </thead>
126
+
127
+ <tbody class="text-xs" @click="onCellClick">
128
+ <tr v-for="(row, i) of formatData" :key="i" class="h-3">
129
+ <td class="relative leading-none text-gray-900">
130
+ <span class="absolute top-0 right-1">{{ [1, 3, 5].includes(i) ? config.locale.date.day[i] : ' ' }}</span>
131
+ </td>
132
+
133
+ <td
134
+ v-for="col of row"
135
+ :key="col.date"
136
+ class="rounded-xs w-3 min-w-3 motion-safe:transition-colors"
137
+ :data-date="col.date"
138
+ :class="{ 'pointer-events-none opacity-0': col.hidden }"
139
+ :style="`background: ${col.color}`"
140
+ />
141
+ </tr>
142
+
143
+ <template v-if="props.legend">
144
+ <tr class="h-0.5" />
145
+ <tr class="pxd-active-graph--legend select-none">
146
+ <td class="relative h-3 text-gray-700">
147
+ <span class="absolute top-1/2 right-1 -translate-y-1/2">{{ config.locale.compare.less }}</span>
148
+ </td>
149
+
150
+ <td
151
+ v-for="color in props.colors"
152
+ :key="color" class="w-3 h-3 rounded-xs motion-safe:transition-colors" :style="`background-color: ${color}`"
153
+ />
154
+
155
+ <td class="relative h-3 text-gray-700 w-3">
156
+ <span class="absolute top-1/2 left-px -translate-y-1/2" style="width: 30px;min-width: 30px;">{{ config.locale.compare.more }}</span>
157
+ </td>
158
+ </tr>
159
+ </template>
160
+ </tbody>
161
+ </table>
162
+ </div>
163
+ </template>
@@ -0,0 +1,19 @@
1
+ interface Props {
2
+ data?: any[];
3
+ legend?: boolean;
4
+ startDate?: string | Date;
5
+ endDate?: string | Date;
6
+ colors?: Record<string, string>;
7
+ }
8
+ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ cellClick: (args_0: MouseEvent, args_1: string) => any;
10
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
11
+ onCellClick?: (args_0: MouseEvent, args_1: string) => any;
12
+ }>, {
13
+ data: any[];
14
+ legend: boolean;
15
+ startDate: string | Date;
16
+ endDate: string | Date;
17
+ colors: Record<string, string>;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, inject, ref } from "vue";
2
+ import { computed, inject, shallowRef } from "vue";
3
3
  import { getCssUnitValue } from "../../utils/format";
4
4
  defineOptions({
5
5
  name: "PAvatar"
@@ -9,11 +9,29 @@ const props = defineProps({
9
9
  size: { type: [Number, String], required: false },
10
10
  loading: { type: Boolean, required: false }
11
11
  });
12
- defineEmits(["error"]);
13
- const isLoadFailed = ref(false);
12
+ const emits = defineEmits(["load", "error", "loadstart"]);
13
+ const loadingStatus = shallowRef("idle");
14
14
  const groupSize = inject("groupSize", 32);
15
15
  const computedSize = computed(() => getCssUnitValue(props.size || groupSize));
16
- const computedLoading = computed(() => props.loading || isLoadFailed.value);
16
+ const computedLoading = computed(() => props.loading || loadingStatus.value === "error");
17
+ function onLoadError(event) {
18
+ loadingStatus.value = "error";
19
+ emits("error", event);
20
+ }
21
+ function onLoadSuccess(event) {
22
+ loadingStatus.value = "loaded";
23
+ emits("load", event);
24
+ }
25
+ function onLoadStart(event) {
26
+ loadingStatus.value = "loading";
27
+ emits("loadstart", event);
28
+ }
29
+ function getLoadingStatus() {
30
+ return loadingStatus.value;
31
+ }
32
+ defineExpose({
33
+ getLoadingStatus
34
+ });
17
35
  </script>
18
36
 
19
37
  <template>
@@ -32,7 +50,10 @@ const computedLoading = computed(() => props.loading || isLoadFailed.value);
32
50
  fetchpriority="low"
33
51
  crossorigin="anonymous"
34
52
  class="relative block rounded-inherit overflow-hidden w-full h-full"
35
- @error="$emit('error', $event)"
53
+ @load="onLoadSuccess"
54
+ @loadstart="onLoadStart"
55
+ @abort="onLoadError"
56
+ @error="onLoadError"
36
57
  >
37
58
  </slot>
38
59
 
@@ -58,12 +79,12 @@ const computedLoading = computed(() => props.loading || isLoadFailed.value);
58
79
  }
59
80
 
60
81
  &::before {
61
- background-image: linear-gradient(270deg, var(--gray-alpha-100), var(--gray-alpha-300), var(--gray-alpha-300), var(--gray-alpha-100));
82
+ background-image: linear-gradient(270deg, var(--color-gray-alpha-100), var(--color-gray-alpha-400), var(--color-gray-alpha-400), var(--color-gray-alpha-100));
62
83
  background-size: 400% 100%;
63
84
  }
64
85
 
65
86
  &::after {
66
- border: 1px solid var(--gray-alpha-400)
87
+ border: 1px solid var(--color-gray-alpha-400)
67
88
  }
68
89
  }
69
90
 
@@ -3,16 +3,24 @@ interface Props {
3
3
  size?: number | string;
4
4
  loading?: boolean;
5
5
  }
6
+ type LoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
7
+ declare function getLoadingStatus(): LoadingStatus;
6
8
  declare var __VLS_1: {}, __VLS_3: {};
7
9
  type __VLS_Slots = {} & {
8
10
  default?: (props: typeof __VLS_1) => any;
9
11
  } & {
10
12
  badge?: (props: typeof __VLS_3) => any;
11
13
  };
12
- declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ declare const __VLS_component: import("vue").DefineComponent<Props, {
15
+ getLoadingStatus: typeof getLoadingStatus;
16
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
17
  error: (args_0: Event) => any;
18
+ load: (args_0: Event) => any;
19
+ loadstart: (args_0: Event) => any;
14
20
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
15
21
  onError?: (args_0: Event) => any;
22
+ onLoad?: (args_0: Event) => any;
23
+ onLoadstart?: (args_0: Event) => any;
16
24
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
17
25
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
18
26
  export default _default;
@@ -15,7 +15,7 @@ const props = defineProps({
15
15
  loading: { type: Boolean, required: false },
16
16
  disabled: { type: Boolean, required: false }
17
17
  });
18
- const emits = defineEmits(["click"]);
18
+ const emits = defineEmits(["click", "dblclick"]);
19
19
  const SIZES = {
20
20
  xs: "h-6 px-1 rounded-md",
21
21
  sm: "h-7.5 px-1.5 rounded-md",
@@ -32,10 +32,10 @@ const VARIANTS = {
32
32
  simple: "",
33
33
  default: "bg-background text-foreground hover:bg-background-hover active:bg-background-active border-input",
34
34
  ghost: "bg-transparent text-foreground hover:bg-gray-alpha-200 active:bg-gray-alpha-300 border-transparent",
35
- primary: "bg-primary text-gray-100 hover:bg-primary/80 active:bg-primary border-transparent",
36
- error: "bg-red-800 text-white hover:bg-red-700 active:bg-red-800 border-transparent",
37
- warning: "bg-amber-800 text-black hover:bg-amber-700 active:bg-amber-800 border-transparent",
38
- success: "bg-green-800 text-white hover:bg-green-700 active:bg-green-800 border-transparent"
35
+ primary: "bg-primary text-gray-100 hover:bg-primary/80 active:bg-gray-900 border-transparent",
36
+ error: "bg-red-800 text-white hover:bg-red-700 active:bg-red-900 border-transparent",
37
+ warning: "bg-amber-800 text-black hover:bg-amber-700 active:bg-amber-900 border-transparent",
38
+ success: "bg-green-800 text-white hover:bg-green-700 active:bg-green-900 border-transparent"
39
39
  };
40
40
  const DISABLED_CLASS_NAMES = "is-disabled bg-gray-100 hover:bg-gray-100 active:bg-gray-100 cursor-not-allowed text-gray-700 border-gray-300";
41
41
  const computedSize = useComputedSize(props.size, SIZES);
@@ -63,6 +63,9 @@ const computedClasses = computed(() => {
63
63
  function onButtonClick(event) {
64
64
  emits("click", event);
65
65
  }
66
+ function onButtonDblClick(event) {
67
+ emits("dblclick", event);
68
+ }
66
69
  </script>
67
70
 
68
71
  <template>
@@ -72,6 +75,7 @@ function onButtonClick(event) {
72
75
  :class="computedClasses"
73
76
  :disabled="computedDisabled"
74
77
  @click="onButtonClick"
78
+ @dblclick.prevent="onButtonDblClick"
75
79
  >
76
80
  <Spinner v-if="loading" />
77
81
 
@@ -1,16 +1,18 @@
1
1
  import type { ButtonProps } from '../../types/components';
2
- declare var __VLS_13: {}, __VLS_15: {}, __VLS_17: {};
2
+ declare var __VLS_14: {}, __VLS_16: {}, __VLS_18: {};
3
3
  type __VLS_Slots = {} & {
4
- prefix?: (props: typeof __VLS_13) => any;
4
+ prefix?: (props: typeof __VLS_14) => any;
5
5
  } & {
6
- default?: (props: typeof __VLS_15) => any;
6
+ default?: (props: typeof __VLS_16) => any;
7
7
  } & {
8
- suffix?: (props: typeof __VLS_17) => any;
8
+ suffix?: (props: typeof __VLS_18) => any;
9
9
  };
10
10
  declare const __VLS_component: import("vue").DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
11
  click: (args_0: MouseEvent) => any;
12
+ dblclick: (args_0: MouseEvent) => any;
12
13
  }, string, import("vue").PublicProps, Readonly<ButtonProps> & Readonly<{
13
14
  onClick?: (args_0: MouseEvent) => any;
15
+ onDblclick?: (args_0: MouseEvent) => any;
14
16
  }>, {
15
17
  variant: import("../../types/components").ComponentVariantWithDefault | "ghost" | "simple";
16
18
  as: import("../../types/components").ComponentAs;
@@ -1,9 +1,10 @@
1
1
  <script setup>
2
- import { CheckIcon, MinusIcon } from "gdsi/vue";
2
+ import CheckIcon from "@gdsicon/vue/check";
3
+ import MinusIcon from "@gdsicon/vue/minus";
3
4
  import { twMerge } from "tailwind-merge";
4
5
  import { computed, inject } from "vue";
5
6
  import { useModelValue } from "../../composables/useModelValue";
6
- import { getRandomId } from "../../utils/random";
7
+ import { getUniqueId } from "../../utils/uid";
7
8
  defineOptions({
8
9
  name: "PCheckbox",
9
10
  model: {
@@ -20,7 +21,7 @@ const props = defineProps({
20
21
  indeterminate: { type: Boolean, required: false }
21
22
  });
22
23
  const emits = defineEmits(["update:modelValue"]);
23
- const randomId = getRandomId();
24
+ const randomId = getUniqueId();
24
25
  const modelValue = useModelValue(props, emits);
25
26
  const checkboxGroupProps = inject("checkboxGroupProps", {
26
27
  disabled: false,
@@ -15,9 +15,9 @@ type __VLS_Slots = {} & {
15
15
  declare const __VLS_component: import("vue").DefineComponent<Props, {
16
16
  getCheckedState: typeof getCheckedState;
17
17
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
- "update:modelValue": (args_0: ValueType | ValueType[]) => any;
18
+ "update:modelValue": (args_0: NonNullable<ValueType | ValueType[]>) => any;
19
19
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
20
- "onUpdate:modelValue"?: (args_0: ValueType | ValueType[]) => any;
20
+ "onUpdate:modelValue"?: (args_0: NonNullable<ValueType | ValueType[]>) => any;
21
21
  }>, {
22
22
  value: ValueType;
23
23
  modelValue: ValueType | ValueType[];
@@ -4,7 +4,11 @@ import { useModelValue } from "../../composables/useModelValue";
4
4
  import Checkbox from "../checkbox/index.vue";
5
5
  import Stack from "../stack/index.vue";
6
6
  defineOptions({
7
- name: "PCheckboxGroup"
7
+ name: "PCheckboxGroup",
8
+ model: {
9
+ prop: "modelValue",
10
+ event: "update:modelValue"
11
+ }
8
12
  });
9
13
  const props = defineProps({
10
14
  disabled: { type: Boolean, required: false },
@@ -1,11 +1,13 @@
1
1
  <script setup>
2
2
  import { provideConfigProvider } from "../../composables/useConfigProviderContext";
3
+ import enUS from "../../locales/en-US";
3
4
  defineOptions({
4
5
  name: "PConfigProvider"
5
6
  });
6
7
  const props = defineProps({
7
8
  as: { type: null, required: false, default: "div" },
8
- size: { type: String, required: false, default: "md" }
9
+ size: { type: String, required: false, default: "md" },
10
+ locale: { type: Object, required: false, default: () => enUS }
9
11
  });
10
12
  provideConfigProvider(props);
11
13
  </script>
@@ -10,6 +10,7 @@ type __VLS_Slots = {} & {
10
10
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
11
11
  size: import("../../types/components").ComponentSize;
12
12
  as: ComponentAs;
13
+ locale: Record<string, any>;
13
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
15
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
15
16
  export default _default;
@@ -0,0 +1,31 @@
1
+ <script setup>
2
+ import InformationIcon from "@gdsicon/vue/information-fill-small";
3
+ import Tooltip from "../tooltip/index.vue";
4
+ defineOptions({
5
+ name: "PDescription"
6
+ });
7
+ defineProps({
8
+ title: { type: String, required: false },
9
+ content: { type: String, required: false },
10
+ tooltip: { type: String, required: false }
11
+ });
12
+ </script>
13
+
14
+ <template>
15
+ <dl class="pxd-description">
16
+ <dt data-pxd-description-title class="flex items-center text-sm text-foreground-secondary leading-none mb-2 min-h-3.5 capitalize text-nowrap">
17
+ <slot name="title">
18
+ {{ title }}
19
+ </slot>
20
+
21
+ <Tooltip v-if="tooltip" :content="tooltip">
22
+ <InformationIcon class="ml-1" />
23
+ </Tooltip>
24
+ </dt>
25
+ <dd data-pxd-description-content class="text-sm text-foreground font-medium leading-4">
26
+ <slot name="content">
27
+ {{ content }}
28
+ </slot>
29
+ </dd>
30
+ </dl>
31
+ </template>
@@ -0,0 +1,19 @@
1
+ interface Props {
2
+ title?: string;
3
+ content?: string;
4
+ tooltip?: string;
5
+ }
6
+ declare var __VLS_1: {}, __VLS_10: {};
7
+ type __VLS_Slots = {} & {
8
+ title?: (props: typeof __VLS_1) => any;
9
+ } & {
10
+ content?: (props: typeof __VLS_10) => any;
11
+ };
12
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
- import { ExternalIcon, StopIcon } from "gdsi/vue";
2
+ import ExternalIcon from "@gdsicon/vue/external";
3
+ import StopIcon from "@gdsicon/vue/stop";
3
4
  import { useConfigProvider } from "../../composables/useConfigProviderContext";
4
5
  import { isExternalLink } from "../../utils/format";
5
6
  defineOptions({
@@ -20,20 +21,23 @@ const SIZES = {
20
21
  </script>
21
22
 
22
23
  <template>
23
- <div class="pxd-error flex items-center gap-1.5 text-red-900" :class="SIZES[size || config.size]">
24
- <StopIcon class="size-4" />
25
- <b v-if="label || error?.label" class="font-medium">{{ label || error?.label }}:</b>
24
+ <div class="pxd-error flex text-red-900" :class="SIZES[size || config.size]">
25
+ <StopIcon class="size-4 min-w-4 mr-2 mt-0.5" :class="{ 'mt-1': size === 'lg' || config.size === 'lg' }" />
26
26
 
27
- <slot>
28
- {{ error?.message }}
27
+ <div class="flex-1">
28
+ <b v-if="label || error?.label" class="font-medium whitespace-nowrap">{{ label || error?.label }}:</b>
29
29
 
30
- <span v-if="error?.action && error?.link">
31
- <a :href="error.link" class="text-red-900 font-medium inline-flex items-center gap-1 underline" :target="isExternalLink(error.link) ? '_blank' : '_self'">
32
- {{ error.action }}
30
+ <slot>
31
+ {{ error?.message }}
33
32
 
34
- <ExternalIcon v-if="isExternalLink(error.link)" class="text-sm" />
35
- </a>
36
- </span>
37
- </slot>
33
+ <span v-if="error?.action && error?.link">
34
+ <a :href="error.link" class="text-red-900 font-medium inline-flex items-center gap-1 underline" :target="isExternalLink(error.link) ? '_blank' : '_self'">
35
+ {{ error.action }}
36
+
37
+ <ExternalIcon v-if="isExternalLink(error.link)" class="text-sm" />
38
+ </a>
39
+ </span>
40
+ </slot>
41
+ </div>
38
42
  </div>
39
43
  </template>
@@ -1,12 +1,17 @@
1
1
  <script setup>
2
- import { ChartActivityIcon } from "gdsi/vue";
2
+ import ChartActivityIcon from "@gdsicon/vue/chart-activity";
3
3
  import { computed } from "vue";
4
4
  import { useComputedSize } from "../../composables/useComputedSize";
5
+ import { getStateColor } from "../../utils/colors";
5
6
  defineOptions({
6
- name: "PGauge"
7
+ name: "PGauge",
8
+ model: {
9
+ prop: "modelValue",
10
+ event: "update:modelValue"
11
+ }
7
12
  });
8
13
  const props = defineProps({
9
- modelValue: { type: Number, required: false, default: 60 },
14
+ modelValue: { type: [Number, null], required: false, default: 60 },
10
15
  showValue: { type: Boolean, required: false, default: false },
11
16
  indeterminate: { type: Boolean, required: false },
12
17
  size: { type: String, required: false },
@@ -69,25 +74,15 @@ const trackOffset = computed(() => {
69
74
  return 0;
70
75
  return -progressArc.value - GAP_LENGTH;
71
76
  });
72
- const sortedColorKeys = computed(() => Object.keys(props.colors || defaultColors).map(Number).sort((a, b) => a - b));
73
77
  const progressColors = computed(() => {
74
78
  const colors = props.colors || defaultColors;
75
79
  let primaryColor = colors.primary;
76
- let secondaryColor = colors.secondary || "hsl(var(--gray-200-value))";
80
+ let secondaryColor = colors.secondary || "hsl(var(--color-gray-200-value))";
77
81
  if (props.indeterminate) {
78
- primaryColor = "hsl(var(--gray-200-value))";
79
- secondaryColor = "hsl(var(--gray-200-value))";
82
+ primaryColor = "hsl(var(--color-gray-200-value))";
83
+ secondaryColor = "hsl(var(--color-gray-200-value))";
80
84
  } else if (!primaryColor) {
81
- const sortedKeys = sortedColorKeys.value;
82
- for (let i = 0; i < sortedKeys.length; i++) {
83
- if (progress.value < sortedKeys[i]) {
84
- primaryColor = colors[sortedKeys[i - 1]];
85
- break;
86
- }
87
- }
88
- if (!primaryColor && sortedKeys.length > 0) {
89
- primaryColor = colors[sortedKeys.at(-1)];
90
- }
85
+ primaryColor = getStateColor(progress.value, colors) || colors.primary;
91
86
  }
92
87
  return {
93
88
  primary: primaryColor,
@@ -1,13 +1,13 @@
1
1
  import type { ComponentSizeWithXs } from '../../types/components';
2
2
  interface Props {
3
- modelValue?: number;
3
+ modelValue?: number | null;
4
4
  showValue?: boolean;
5
5
  indeterminate?: boolean;
6
6
  size?: ComponentSizeWithXs;
7
7
  colors?: Record<string, string>;
8
8
  }
9
9
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
10
- modelValue: number;
10
+ modelValue: number | null;
11
11
  showValue: boolean;
12
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
13
  export default _default;
@@ -7,7 +7,7 @@ defineOptions({
7
7
  const props = defineProps({
8
8
  scalable: { type: Boolean, required: false, default: true },
9
9
  durations: { type: [Number, String], required: false, default: 2 },
10
- maskColor: { type: String, required: false, default: "var(--gray-alpha-600)" },
10
+ maskColor: { type: String, required: false, default: "var(--color-gray-alpha-600)" },
11
11
  cancelable: { type: Boolean, required: false },
12
12
  variant: { type: String, required: false },
13
13
  size: { type: String, required: false },
@@ -1,11 +1,12 @@
1
+ export { default as ActiveGraph } from './active-graph/index.vue';
1
2
  export { default as Avatar } from './avatar/index.vue';
2
3
  export { default as AvatarGroup } from './avatar-group/index.vue';
3
4
  export { default as Badge } from './badge/index.vue';
4
5
  export { default as Button } from './button/index.vue';
5
6
  export { default as Checkbox } from './checkbox/index.vue';
6
7
  export { default as CheckboxGroup } from './checkbox-group/index.vue';
7
- export { default as ColorScheme } from './color-scheme/index.vue';
8
8
  export { default as ConfigProvider } from './config-provider/index.vue';
9
+ export { default as Description } from './description/index.vue';
9
10
  export { default as Error } from './error/index.vue';
10
11
  export { default as Gauge } from './gauge/index.vue';
11
12
  export { default as HoldButton } from './hold-button/index.vue';
@@ -25,4 +26,6 @@ export { default as Spinner } from './spinner/index.vue';
25
26
  export { default as Stack } from './stack/index.vue';
26
27
  export { default as StatusDot } from './status-dot/index.vue';
27
28
  export { default as Textarea } from './textarea/index.vue';
29
+ export { default as ThemeSwitcher } from './theme-switcher/index.vue';
28
30
  export { default as Toggle } from './toggle/index.vue';
31
+ export { default as Tooltip } from './tooltip/index.vue';
@@ -1,11 +1,12 @@
1
+ export { default as ActiveGraph } from "./active-graph/index.vue";
1
2
  export { default as Avatar } from "./avatar/index.vue";
2
3
  export { default as AvatarGroup } from "./avatar-group/index.vue";
3
4
  export { default as Badge } from "./badge/index.vue";
4
5
  export { default as Button } from "./button/index.vue";
5
6
  export { default as Checkbox } from "./checkbox/index.vue";
6
7
  export { default as CheckboxGroup } from "./checkbox-group/index.vue";
7
- export { default as ColorScheme } from "./color-scheme/index.vue";
8
8
  export { default as ConfigProvider } from "./config-provider/index.vue";
9
+ export { default as Description } from "./description/index.vue";
9
10
  export { default as Error } from "./error/index.vue";
10
11
  export { default as Gauge } from "./gauge/index.vue";
11
12
  export { default as HoldButton } from "./hold-button/index.vue";
@@ -25,4 +26,6 @@ export { default as Spinner } from "./spinner/index.vue";
25
26
  export { default as Stack } from "./stack/index.vue";
26
27
  export { default as StatusDot } from "./status-dot/index.vue";
27
28
  export { default as Textarea } from "./textarea/index.vue";
29
+ export { default as ThemeSwitcher } from "./theme-switcher/index.vue";
28
30
  export { default as Toggle } from "./toggle/index.vue";
31
+ export { default as Tooltip } from "./tooltip/index.vue";