pxd 0.0.25 → 0.0.26
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.
- package/dist/components/active-graph/index.vue.d.ts +0 -1
- package/dist/components/avatar/index.vue +4 -3
- package/dist/components/avatar-group/index.vue +8 -3
- package/dist/components/avatar-group/index.vue.d.ts +3 -12
- package/dist/components/badge/index.vue +9 -9
- package/dist/components/badge/index.vue.d.ts +1 -1
- package/dist/components/book/index.vue +4 -7
- package/dist/components/book/index.vue.d.ts +1 -1
- package/dist/components/browser/index.vue +54 -0
- package/dist/components/browser/index.vue.d.ts +15 -0
- package/dist/components/button/index.vue +30 -23
- package/dist/components/button/index.vue.d.ts +3 -3
- package/dist/components/carousel/index.vue +13 -20
- package/dist/components/carousel-group/index.vue +128 -19
- package/dist/components/carousel-group/index.vue.d.ts +4 -1
- package/dist/components/checkbox/index.vue +11 -14
- package/dist/components/checkbox/index.vue.d.ts +7 -15
- package/dist/components/checkbox-group/index.vue +7 -3
- package/dist/components/checkbox-group/index.vue.d.ts +9 -15
- package/dist/components/chip/index.vue +5 -5
- package/dist/components/chip/index.vue.d.ts +1 -1
- package/dist/components/choicebox/index.vue +6 -5
- package/dist/components/choicebox/index.vue.d.ts +2 -9
- package/dist/components/choicebox-group/index.vue +7 -6
- package/dist/components/choicebox-group/index.vue.d.ts +6 -19
- package/dist/components/collapse/index.vue +3 -2
- package/dist/components/collapse-group/index.vue +7 -5
- package/dist/components/collapse-group/index.vue.d.ts +1 -1
- package/dist/components/config-provider/index.vue.d.ts +2 -2
- package/dist/components/description/index.vue +3 -3
- package/dist/components/drawer/index.vue +14 -29
- package/dist/components/drawer/index.vue.d.ts +6 -8
- package/dist/components/error/index.vue +15 -9
- package/dist/components/error/index.vue.d.ts +5 -2
- package/dist/components/gauge/index.vue +5 -5
- package/dist/components/gauge/index.vue.d.ts +1 -1
- package/dist/components/hold-button/index.vue.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input/index.vue +9 -9
- package/dist/components/input/index.vue.d.ts +1 -1
- package/dist/components/link-button/index.vue +3 -3
- package/dist/components/menu/index.vue +2 -4
- package/dist/components/menu/index.vue.d.ts +2 -1
- package/dist/components/menu-item/index.vue +6 -7
- package/dist/components/menu-item/index.vue.d.ts +1 -1
- package/dist/components/menu-list/index.vue +9 -3
- package/dist/components/menu-list/index.vue.d.ts +3 -1
- package/dist/components/modal/index.vue +3 -2
- package/dist/components/modal/index.vue.d.ts +1 -1
- package/dist/components/more-button/index.vue +11 -5
- package/dist/components/more-button/index.vue.d.ts +3 -4
- package/dist/components/note/index.vue +16 -16
- package/dist/components/note/index.vue.d.ts +8 -8
- package/dist/components/overlay/index.vue +5 -1
- package/dist/components/overlay/index.vue.d.ts +2 -1
- package/dist/components/pagination/index.vue +4 -4
- package/dist/components/pin-input/index.vue +8 -7
- package/dist/components/pin-input/index.vue.d.ts +1 -1
- package/dist/components/popover/index.vue +4 -3
- package/dist/components/popover/index.vue.d.ts +4 -3
- package/dist/components/progress/index.vue +8 -2
- package/dist/components/progress/index.vue.d.ts +1 -1
- package/dist/components/radio/index.vue +10 -13
- package/dist/components/radio/index.vue.d.ts +5 -12
- package/dist/components/radio-group/index.vue +3 -3
- package/dist/components/radio-group/index.vue.d.ts +8 -14
- package/dist/components/resizable/index.vue +18 -27
- package/dist/components/resizable/index.vue.d.ts +2 -2
- package/dist/components/resizable-handle/index.vue +6 -8
- package/dist/components/resizable-panel/index.vue +21 -23
- package/dist/components/scrollable/index.vue +2 -2
- package/dist/components/scrollable/index.vue.d.ts +2 -1
- package/dist/components/skeleton/index.vue +8 -11
- package/dist/components/slider/index.vue +4 -3
- package/dist/components/slider/index.vue.d.ts +1 -1
- package/dist/components/snippet/index.vue +14 -33
- package/dist/components/snippet/index.vue.d.ts +1 -1
- package/dist/components/stack/index.vue +24 -22
- package/dist/components/stack/index.vue.d.ts +2 -2
- package/dist/components/switch/index.vue +12 -15
- package/dist/components/switch/index.vue.d.ts +1 -1
- package/dist/components/switch-group/index.vue +9 -6
- package/dist/components/switch-group/index.vue.d.ts +4 -12
- package/dist/components/text/index.vue +8 -8
- package/dist/components/text/index.vue.d.ts +1 -1
- package/dist/components/textarea/index.vue +9 -9
- package/dist/components/textarea/index.vue.d.ts +1 -1
- package/dist/components/toggle/index.vue +4 -2
- package/dist/components/toggle/index.vue.d.ts +1 -1
- package/dist/components/tooltip/index.vue +4 -5
- package/dist/components/tooltip/index.vue.d.ts +4 -4
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/useConfigProviderContext.d.ts +3 -8
- package/dist/composables/useConfigProviderContext.js +10 -15
- package/dist/composables/useCopyClick.d.ts +5 -0
- package/dist/composables/useCopyClick.js +35 -0
- package/dist/composables/useUniqueIdContext.d.ts +2 -2
- package/dist/composables/useUniqueIdContext.js +4 -4
- package/dist/contexts/avatar.d.ts +2 -0
- package/dist/contexts/avatar.js +5 -0
- package/dist/contexts/carousel.d.ts +13 -0
- package/dist/contexts/carousel.js +5 -0
- package/dist/contexts/checkbox.d.ts +2 -0
- package/dist/contexts/checkbox.js +5 -0
- package/dist/contexts/choicebox.d.ts +4 -0
- package/dist/contexts/choicebox.js +11 -0
- package/dist/contexts/collapse.d.ts +8 -0
- package/dist/contexts/collapse.js +5 -0
- package/dist/contexts/menu.d.ts +8 -0
- package/dist/contexts/menu.js +5 -0
- package/dist/contexts/radio.d.ts +2 -0
- package/dist/contexts/radio.js +5 -0
- package/dist/contexts/resizable.d.ts +33 -0
- package/dist/contexts/resizable.js +5 -0
- package/dist/contexts/switch.d.ts +4 -0
- package/dist/contexts/switch.js +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +29 -17
- package/dist/types/components/avatar.d.ts +11 -0
- package/dist/types/components/button.d.ts +1 -1
- package/dist/types/components/carousel.d.ts +16 -0
- package/dist/types/components/checkbox.d.ts +17 -0
- package/dist/types/components/choicebox.d.ts +22 -0
- package/dist/types/components/menu.d.ts +1 -1
- package/dist/types/components/radio.d.ts +16 -0
- package/dist/types/components/switch.d.ts +10 -0
- package/dist/types/shared/index.d.ts +1 -0
- package/dist/types/shared/props.d.ts +30 -0
- package/dist/utils/context.d.ts +17 -0
- package/dist/utils/context.js +19 -0
- package/dist/utils/fn.js +4 -7
- package/dist/utils/format.d.ts +2 -1
- package/dist/utils/format.js +7 -4
- package/package.json +6 -5
- package/dist/components/carousel-group/constants.d.ts +0 -25
- package/dist/components/carousel-group/constants.js +0 -3
- package/dist/styles/dst.css +0 -351
- package/dist/types/components/index.d.ts +0 -6
- package/dist/types/components/resizable.d.ts +0 -19
- package/dist/types/components/shared.d.ts +0 -18
- package/dist/types/components/shared.js +0 -0
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.js +0 -2
- package/dist/utils/raf.d.ts +0 -2
- package/dist/utils/raf.js +0 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import CheckIcon from "@gdsicon/vue/check";
|
|
3
3
|
import MinusIcon from "@gdsicon/vue/minus";
|
|
4
|
-
import {
|
|
5
|
-
import { computed, inject } from "vue";
|
|
4
|
+
import { computed } from "vue";
|
|
6
5
|
import { useModelValue } from "../../composables/useModelValue";
|
|
6
|
+
import { useCheckboxGroupContext } from "../../contexts/checkbox";
|
|
7
7
|
import { getUniqueId } from "../../utils/uid";
|
|
8
8
|
defineOptions({
|
|
9
9
|
name: "PCheckbox",
|
|
@@ -23,10 +23,7 @@ const props = defineProps({
|
|
|
23
23
|
const emits = defineEmits(["update:modelValue"]);
|
|
24
24
|
const uniqueId = getUniqueId();
|
|
25
25
|
const modelValue = useModelValue(props, emits);
|
|
26
|
-
const
|
|
27
|
-
disabled: false,
|
|
28
|
-
required: false
|
|
29
|
-
});
|
|
26
|
+
const checkboxGroupContext = useCheckboxGroupContext();
|
|
30
27
|
const isChecked = computed(() => {
|
|
31
28
|
if (Array.isArray(modelValue.value)) {
|
|
32
29
|
return modelValue.value.includes(props.value);
|
|
@@ -36,23 +33,23 @@ const isChecked = computed(() => {
|
|
|
36
33
|
}
|
|
37
34
|
return modelValue.value === props.value;
|
|
38
35
|
});
|
|
39
|
-
const computedDisabled = computed(() => props.disabled ||
|
|
40
|
-
const computedRequired = computed(() => props.required ||
|
|
41
|
-
const
|
|
42
|
-
const
|
|
36
|
+
const computedDisabled = computed(() => props.disabled || checkboxGroupContext?.disabled);
|
|
37
|
+
const computedRequired = computed(() => props.required || checkboxGroupContext?.required);
|
|
38
|
+
const computedClass = computed(() => {
|
|
39
|
+
const classes = [
|
|
43
40
|
"pxd-checkbox--inner size-4 shrink-0 inline-flex items-center justify-center peer-focus-ring",
|
|
44
41
|
"rounded-sm border overflow-hidden transform-gpu motion-safe:transition-colors"
|
|
45
42
|
];
|
|
46
43
|
if (isChecked.value) {
|
|
47
|
-
|
|
44
|
+
classes.push(
|
|
48
45
|
computedDisabled.value ? "bg-gray-600 border-gray-600" : "bg-primary border-primary"
|
|
49
46
|
);
|
|
50
47
|
} else {
|
|
51
|
-
|
|
48
|
+
classes.push(
|
|
52
49
|
computedDisabled.value ? "bg-gray-100 border-gray-500" : "bg-background border-gray-alpha-400 group-hover/checkbox:bg-gray-200"
|
|
53
50
|
);
|
|
54
51
|
}
|
|
55
|
-
return
|
|
52
|
+
return classes.join(" ");
|
|
56
53
|
});
|
|
57
54
|
function toggleChecked(isChecked2) {
|
|
58
55
|
if (Array.isArray(modelValue.value)) {
|
|
@@ -94,7 +91,7 @@ defineExpose({
|
|
|
94
91
|
@change="onInputChange"
|
|
95
92
|
>
|
|
96
93
|
|
|
97
|
-
<span aria-hidden="true" :class="
|
|
94
|
+
<span aria-hidden="true" :class="computedClass">
|
|
98
95
|
<CheckIcon v-if="isChecked" class="size-3 text-gray-100" />
|
|
99
96
|
<MinusIcon v-else-if="indeterminate" class="size-3" />
|
|
100
97
|
<span v-else class="size-3" />
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
interface Props {
|
|
3
|
-
label?: ComponentLabel;
|
|
4
|
-
value?: ComponentValue;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
modelValue?: ComponentValue | ComponentValue[];
|
|
8
|
-
indeterminate?: boolean;
|
|
9
|
-
}
|
|
1
|
+
import type { CheckboxProps } from '../../types/components/checkbox';
|
|
10
2
|
declare function getCheckedState(): "indeterminate" | "checked" | "unchecked";
|
|
11
3
|
declare var __VLS_11: {};
|
|
12
4
|
type __VLS_Slots = {} & {
|
|
13
5
|
default?: (props: typeof __VLS_11) => any;
|
|
14
6
|
};
|
|
15
|
-
declare const __VLS_component: import("vue").DefineComponent<
|
|
7
|
+
declare const __VLS_component: import("vue").DefineComponent<CheckboxProps, {
|
|
16
8
|
getCheckedState: typeof getCheckedState;
|
|
17
9
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
-
"update:modelValue": (args_0: NonNullable<ComponentValue | ComponentValue[]>) => any;
|
|
19
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
20
|
-
"onUpdate:modelValue"?: (args_0: NonNullable<ComponentValue | ComponentValue[]>) => any;
|
|
10
|
+
"update:modelValue": (args_0: NonNullable<import("../../types/shared").ComponentValue | import("../../types/shared").ComponentValue[]>) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<CheckboxProps> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: (args_0: NonNullable<import("../../types/shared").ComponentValue | import("../../types/shared").ComponentValue[]>) => any;
|
|
21
13
|
}>, {
|
|
22
|
-
value: ComponentValue;
|
|
23
|
-
modelValue: ComponentValue | ComponentValue[];
|
|
14
|
+
value: import("../../types/shared").ComponentValue;
|
|
15
|
+
modelValue: import("../../types/shared").ComponentValue | import("../../types/shared").ComponentValue[];
|
|
24
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
17
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
26
18
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { provide } from "vue";
|
|
3
2
|
import { useModelValue } from "../../composables/useModelValue";
|
|
3
|
+
import { provideCheckboxGroupContext } from "../../contexts/checkbox";
|
|
4
4
|
import PCheckbox from "../checkbox/index.vue";
|
|
5
5
|
import PStack from "../stack/index.vue";
|
|
6
6
|
defineOptions({
|
|
@@ -20,12 +20,16 @@ const props = defineProps({
|
|
|
20
20
|
const emits = defineEmits(["change", "update:modelValue"]);
|
|
21
21
|
const modelValue = useModelValue(props, emits);
|
|
22
22
|
function isCheckedAll() {
|
|
23
|
-
|
|
23
|
+
const { options = [] } = props;
|
|
24
|
+
if (options.length === 0) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return options.every((option) => modelValue.value.includes(option.value));
|
|
24
28
|
}
|
|
25
29
|
function isCheckedPartial() {
|
|
26
30
|
return modelValue.value.length > 0 && !isCheckedAll();
|
|
27
31
|
}
|
|
28
|
-
|
|
32
|
+
provideCheckboxGroupContext(props);
|
|
29
33
|
defineExpose({
|
|
30
34
|
isCheckedAll,
|
|
31
35
|
isCheckedPartial
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
interface Props {
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
required?: boolean;
|
|
5
|
-
modelValue?: ComponentValue[];
|
|
6
|
-
options?: ComponentOption[];
|
|
7
|
-
}
|
|
1
|
+
import type { CheckboxGroupProps } from '../../types/components/checkbox';
|
|
8
2
|
declare function isCheckedAll(): boolean;
|
|
9
3
|
declare function isCheckedPartial(): boolean;
|
|
10
4
|
declare var __VLS_6: {};
|
|
11
5
|
type __VLS_Slots = {} & {
|
|
12
6
|
default?: (props: typeof __VLS_6) => any;
|
|
13
7
|
};
|
|
14
|
-
declare const __VLS_component: import("vue").DefineComponent<
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<CheckboxGroupProps, {
|
|
15
9
|
isCheckedAll: typeof isCheckedAll;
|
|
16
10
|
isCheckedPartial: typeof isCheckedPartial;
|
|
17
11
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
-
change: (args_0: ComponentValue[]) => any;
|
|
19
|
-
"update:modelValue": (args_0: ComponentValue[]) => any;
|
|
20
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
21
|
-
onChange?: (args_0: ComponentValue[]) => any;
|
|
22
|
-
"onUpdate:modelValue"?: (args_0: ComponentValue[]) => any;
|
|
12
|
+
change: (args_0: import("../../types/shared").ComponentValue[]) => any;
|
|
13
|
+
"update:modelValue": (args_0: import("../../types/shared").ComponentValue[]) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<CheckboxGroupProps> & Readonly<{
|
|
15
|
+
onChange?: (args_0: import("../../types/shared").ComponentValue[]) => any;
|
|
16
|
+
"onUpdate:modelValue"?: (args_0: import("../../types/shared").ComponentValue[]) => any;
|
|
23
17
|
}>, {
|
|
24
|
-
options: ComponentOption[];
|
|
25
|
-
modelValue: ComponentValue[];
|
|
18
|
+
options: import("../../types/shared").ComponentOption[];
|
|
19
|
+
modelValue: import("../../types/shared").ComponentValue[];
|
|
26
20
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
27
21
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
28
22
|
export default _default;
|
|
@@ -16,16 +16,16 @@ const variantPresets = {
|
|
|
16
16
|
secondary: "bg-gray-700 text-background dark:text-gray-1000"
|
|
17
17
|
};
|
|
18
18
|
const computedClass = computed(() => {
|
|
19
|
-
const
|
|
19
|
+
const classes = ["pxd-chip--label absolute border rounded-full border-background text-xs top-0 right-0 motion-safe:transition-all"];
|
|
20
20
|
const { variant, inset, label } = props;
|
|
21
21
|
if (!label) {
|
|
22
|
-
|
|
22
|
+
classes.push("size-(--size)");
|
|
23
23
|
}
|
|
24
24
|
if (!inset) {
|
|
25
|
-
|
|
25
|
+
classes.push("translate-x-1/2 -translate-y-1/3");
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
classes.push(getFallbackValue(variant, variantPresets, "primary"));
|
|
28
|
+
return classes.join(" ");
|
|
29
29
|
});
|
|
30
30
|
</script>
|
|
31
31
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, markRaw } from "vue";
|
|
3
|
+
import { useChoiceboxGroupContext, useChoiceboxGroupModelValue } from "../../contexts/choicebox";
|
|
3
4
|
import PCheckbox from "../checkbox/index.vue";
|
|
4
5
|
import PRadio from "../radio/index.vue";
|
|
5
6
|
defineOptions({
|
|
@@ -12,9 +13,9 @@ const props = defineProps({
|
|
|
12
13
|
required: { type: Boolean, required: false },
|
|
13
14
|
description: { type: String, required: false }
|
|
14
15
|
});
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const renderComponent = computed(() => markRaw(
|
|
16
|
+
const choiceboxModelValue = useChoiceboxGroupModelValue();
|
|
17
|
+
const choiceboxGroupContext = useChoiceboxGroupContext();
|
|
18
|
+
const renderComponent = computed(() => markRaw(choiceboxGroupContext.multiple ? PCheckbox : PRadio));
|
|
18
19
|
const computedAttrs = computed(() => {
|
|
19
20
|
const { disabled, required, value } = props;
|
|
20
21
|
return {
|
|
@@ -27,7 +28,7 @@ const computedAttrs = computed(() => {
|
|
|
27
28
|
</script>
|
|
28
29
|
|
|
29
30
|
<template>
|
|
30
|
-
<component :is="renderComponent" v-model="
|
|
31
|
+
<component :is="renderComponent" v-model="choiceboxModelValue" v-bind="computedAttrs">
|
|
31
32
|
<div class="flex flex-col gap-1">
|
|
32
33
|
<span class="pxd-choicebox--label font-medium">
|
|
33
34
|
<slot name="label">
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
interface Props {
|
|
3
|
-
label?: ComponentLabel;
|
|
4
|
-
value?: ComponentValue;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
description?: string;
|
|
8
|
-
}
|
|
1
|
+
import type { ChoiceboxProps } from '../../types/components/choicebox';
|
|
9
2
|
declare var __VLS_7: {}, __VLS_9: {};
|
|
10
3
|
type __VLS_Slots = {} & {
|
|
11
4
|
label?: (props: typeof __VLS_7) => any;
|
|
12
5
|
} & {
|
|
13
6
|
description?: (props: typeof __VLS_9) => any;
|
|
14
7
|
};
|
|
15
|
-
declare const __VLS_component: import("vue").DefineComponent<
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<ChoiceboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ChoiceboxProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
16
9
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
17
10
|
export default _default;
|
|
18
11
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, markRaw,
|
|
2
|
+
import { computed, markRaw, useAttrs } from "vue";
|
|
3
3
|
import { useModelValue } from "../../composables/useModelValue";
|
|
4
|
+
import { provideChoiceboxGroupContext, provideChoiceboxGroupModelValue } from "../../contexts/choicebox";
|
|
4
5
|
import PCheckboxGroup from "../checkbox-group/index.vue";
|
|
5
6
|
import PRadioGroup from "../radio-group/index.vue";
|
|
6
7
|
defineOptions({
|
|
@@ -12,12 +13,12 @@ defineOptions({
|
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
15
|
const props = defineProps({
|
|
15
|
-
|
|
16
|
-
label: { type: String, required: false },
|
|
16
|
+
label: { type: [String, Number, Array, null], required: false },
|
|
17
17
|
multiple: { type: Boolean, required: false },
|
|
18
18
|
required: { type: Boolean, required: false, default: false },
|
|
19
19
|
disabled: { type: Boolean, required: false, default: false },
|
|
20
|
-
options: { type: Array, required: false }
|
|
20
|
+
options: { type: Array, required: false },
|
|
21
|
+
modelValue: { type: [String, Number, Boolean, Array], required: false, default: "" }
|
|
21
22
|
});
|
|
22
23
|
const emits = defineEmits(["update:modelValue"]);
|
|
23
24
|
const attrs = useAttrs();
|
|
@@ -39,8 +40,8 @@ const computedAttrs = computed(() => {
|
|
|
39
40
|
...rest
|
|
40
41
|
};
|
|
41
42
|
});
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
provideChoiceboxGroupContext(props);
|
|
44
|
+
provideChoiceboxGroupModelValue(modelValue);
|
|
44
45
|
</script>
|
|
45
46
|
|
|
46
47
|
<template>
|
|
@@ -1,31 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
interface Option extends ComponentOption {
|
|
3
|
-
description?: string;
|
|
4
|
-
}
|
|
5
|
-
interface BaseProps {
|
|
6
|
-
label?: string;
|
|
7
|
-
multiple?: boolean;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
options?: Option[];
|
|
11
|
-
}
|
|
12
|
-
interface Props extends BaseProps {
|
|
13
|
-
modelValue?: BaseProps['multiple'] extends true ? ComponentValue[] : ComponentValue;
|
|
14
|
-
}
|
|
1
|
+
import type { ChoiceboxGroupProps } from '../../types/components/choicebox';
|
|
15
2
|
declare var __VLS_1: {}, __VLS_8: {};
|
|
16
3
|
type __VLS_Slots = {} & {
|
|
17
4
|
label?: (props: typeof __VLS_1) => any;
|
|
18
5
|
} & {
|
|
19
6
|
default?: (props: typeof __VLS_8) => any;
|
|
20
7
|
};
|
|
21
|
-
declare const __VLS_component: import("vue").DefineComponent<
|
|
22
|
-
"update:modelValue": (args_0: NonNullable<ComponentValue>) => any;
|
|
23
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
24
|
-
"onUpdate:modelValue"?: (args_0: NonNullable<ComponentValue>) => any;
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<ChoiceboxGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (args_0: NonNullable<import("../../types/shared").ComponentValue | import("../../types/shared").ComponentValue[]>) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<ChoiceboxGroupProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: (args_0: NonNullable<import("../../types/shared").ComponentValue | import("../../types/shared").ComponentValue[]>) => any;
|
|
25
12
|
}>, {
|
|
26
13
|
required: boolean;
|
|
27
14
|
disabled: boolean;
|
|
28
|
-
modelValue:
|
|
15
|
+
modelValue: import("../../types/shared").ComponentValue | import("../../types/shared").ComponentValue[];
|
|
29
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
30
17
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
31
18
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import ChevronDownIcon from "@gdsicon/vue/chevron-down";
|
|
3
|
-
import { computed,
|
|
3
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
4
|
+
import { useCollapseGroupContext } from "../../contexts/collapse";
|
|
4
5
|
import { getUniqueId } from "../../utils/uid";
|
|
5
6
|
defineOptions({
|
|
6
7
|
name: "PCollapse"
|
|
@@ -11,7 +12,7 @@ const props = defineProps({
|
|
|
11
12
|
});
|
|
12
13
|
const uid = getUniqueId();
|
|
13
14
|
const localExpand = ref(props.expand);
|
|
14
|
-
const collapseGroup =
|
|
15
|
+
const collapseGroup = useCollapseGroupContext();
|
|
15
16
|
const isExpanded = computed(() => {
|
|
16
17
|
if (collapseGroup) {
|
|
17
18
|
return collapseGroup.isExpanded(uid);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed,
|
|
3
|
-
import {
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { useConfigProvider } from "../../composables/useConfigProviderContext";
|
|
4
|
+
import { provideCollapseGroupContext } from "../../contexts/collapse";
|
|
5
|
+
import { getFallbackValue } from "../../utils/value";
|
|
4
6
|
defineOptions({
|
|
5
7
|
name: "PCollapseGroup"
|
|
6
8
|
});
|
|
@@ -25,10 +27,10 @@ const SIZES = {
|
|
|
25
27
|
fontWeight: "600"
|
|
26
28
|
}
|
|
27
29
|
};
|
|
30
|
+
const config = useConfigProvider();
|
|
28
31
|
const expandedItems = ref([]);
|
|
29
|
-
const computedSize = useConfigProviderSize(props.size, SIZES);
|
|
30
32
|
const computedStyle = computed(() => {
|
|
31
|
-
const { padding, fontSize, fontWeight } =
|
|
33
|
+
const { padding, fontSize, fontWeight } = getFallbackValue(props.size, SIZES, config.size);
|
|
32
34
|
return {
|
|
33
35
|
"--size": padding,
|
|
34
36
|
"--font-size": fontSize,
|
|
@@ -47,7 +49,7 @@ function toggleItem(id, expanded) {
|
|
|
47
49
|
expandedItems.value = expandedItems.value.filter((item) => item !== id);
|
|
48
50
|
}
|
|
49
51
|
const isExpanded = (id) => expandedItems.value.includes(id);
|
|
50
|
-
|
|
52
|
+
provideCollapseGroupContext({
|
|
51
53
|
multiple: computed(() => props.multiple),
|
|
52
54
|
isExpanded,
|
|
53
55
|
toggleItem
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigProviderProps } from '../../composables/useConfigProviderContext';
|
|
2
|
-
import type { ComponentAs } from '../../types/
|
|
2
|
+
import type { ComponentAs } from '../../types/shared';
|
|
3
3
|
interface Props extends ConfigProviderProps {
|
|
4
4
|
as?: ComponentAs;
|
|
5
5
|
}
|
|
@@ -8,7 +8,7 @@ type __VLS_Slots = {} & {
|
|
|
8
8
|
default?: (props: typeof __VLS_7) => any;
|
|
9
9
|
};
|
|
10
10
|
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
11
|
-
size: import("../../types").ComponentSize;
|
|
11
|
+
size: import("../../types/shared").ComponentSize;
|
|
12
12
|
as: ComponentAs;
|
|
13
13
|
locale: Record<string, any>;
|
|
14
14
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -13,16 +13,16 @@ defineProps({
|
|
|
13
13
|
|
|
14
14
|
<template>
|
|
15
15
|
<dl class="pxd-description">
|
|
16
|
-
<dt
|
|
16
|
+
<dt class="pxd-description--title flex gap-1 items-center text-sm text-foreground-secondary leading-none mb-2 min-h-3.5 capitalize text-nowrap">
|
|
17
17
|
<slot name="title">
|
|
18
18
|
{{ title }}
|
|
19
19
|
</slot>
|
|
20
20
|
|
|
21
21
|
<PTooltip v-if="tooltip" :content="tooltip" enterable>
|
|
22
|
-
<InformationIcon class="text-base" />
|
|
22
|
+
<InformationIcon class="text-base scale-125" />
|
|
23
23
|
</PTooltip>
|
|
24
24
|
</dt>
|
|
25
|
-
<dd
|
|
25
|
+
<dd class="pxd-description--content text-sm text-foreground font-medium leading-4">
|
|
26
26
|
<slot name="content">
|
|
27
27
|
{{ content }}
|
|
28
28
|
</slot>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import CloseIcon from "@gdsicon/vue/cross";
|
|
3
2
|
import { computed, shallowRef, watch } from "vue";
|
|
4
3
|
import { useFocusTrap } from "../../composables/useFocusTrap";
|
|
5
4
|
import { useModelValue } from "../../composables/useModelValue";
|
|
6
5
|
import { getCssUnitValue } from "../../utils/format";
|
|
7
|
-
import PButton from "../button/index.vue";
|
|
8
6
|
import POverlay from "../overlay/index.vue";
|
|
9
7
|
import PScrollable from "../scrollable/index.vue";
|
|
10
8
|
defineOptions({
|
|
@@ -23,7 +21,6 @@ const props = defineProps({
|
|
|
23
21
|
headerStyle: { type: Boolean, required: false, default: false },
|
|
24
22
|
footerStyle: { type: Boolean, required: false, default: true },
|
|
25
23
|
appendToBody: { type: Boolean, required: false, default: true },
|
|
26
|
-
showCloseButton: { type: Boolean, required: false, default: true },
|
|
27
24
|
closeOnPressEscape: { type: Boolean, required: false, default: true },
|
|
28
25
|
closeOnClickOverlay: { type: Boolean, required: false, default: true },
|
|
29
26
|
position: { type: String, required: false, default: "right" }
|
|
@@ -42,25 +39,25 @@ const ensureCorrectPosition = computed(() => {
|
|
|
42
39
|
const transitionName = computed(() => {
|
|
43
40
|
return `pxd-transition--drawer-slide-${ensureCorrectPosition.value}`;
|
|
44
41
|
});
|
|
45
|
-
const
|
|
46
|
-
const
|
|
42
|
+
const computedClass = computed(() => {
|
|
43
|
+
const classes = ["pxd-drawer outline-none translate-z-0 shadow-border-modal fixed bg-background flex flex-col z-10"];
|
|
47
44
|
switch (ensureCorrectPosition.value) {
|
|
48
45
|
case "top":
|
|
49
|
-
|
|
46
|
+
classes.push("top-0", "left-0", "right-0");
|
|
50
47
|
break;
|
|
51
48
|
case "right":
|
|
52
|
-
|
|
49
|
+
classes.push("top-0", "right-0", "bottom-0");
|
|
53
50
|
break;
|
|
54
51
|
case "bottom":
|
|
55
|
-
|
|
52
|
+
classes.push("bottom-0", "left-0", "right-0");
|
|
56
53
|
break;
|
|
57
54
|
case "left":
|
|
58
|
-
|
|
55
|
+
classes.push("top-0", "left-0", "bottom-0");
|
|
59
56
|
break;
|
|
60
57
|
}
|
|
61
|
-
return
|
|
58
|
+
return classes.join(" ");
|
|
62
59
|
});
|
|
63
|
-
const
|
|
60
|
+
const computedStyle = computed(() => {
|
|
64
61
|
const style = {};
|
|
65
62
|
const sizeField = ["left", "right"].includes(ensureCorrectPosition.value) ? "width" : "height";
|
|
66
63
|
style[sizeField] = getCssUnitValue(props.size);
|
|
@@ -100,38 +97,26 @@ watch(() => isVisible.value, (visible) => {
|
|
|
100
97
|
aria-modal="true"
|
|
101
98
|
role="dialog"
|
|
102
99
|
tabindex="-1"
|
|
103
|
-
:class="
|
|
104
|
-
:style="
|
|
100
|
+
:class="computedClass"
|
|
101
|
+
:style="computedStyle"
|
|
105
102
|
>
|
|
106
103
|
<header
|
|
107
|
-
|
|
108
|
-
class="pxd-drawer--header flex gap-2 items-start justify-between px-6 py-4 sm:py-6"
|
|
104
|
+
class="pxd-drawer--header relative shrink-0 px-6 py-4 sm:py-6"
|
|
109
105
|
:class="{ 'border-b bg-background-secondary dark:bg-background': headerStyle }"
|
|
110
106
|
>
|
|
111
107
|
<div class="flex-1 shrink-0">
|
|
112
|
-
<h3 class="text-base sm:text-2xl font-semibold tracking-tight">
|
|
108
|
+
<h3 v-if="$slots.title || title" class="text-base sm:text-2xl font-semibold tracking-tight">
|
|
113
109
|
<slot name="title">
|
|
114
110
|
{{ title }}
|
|
115
111
|
</slot>
|
|
116
112
|
</h3>
|
|
117
113
|
|
|
118
|
-
<div v-if="subtitle" class="mt-4 text-sm text-muted-foreground">
|
|
114
|
+
<div v-if="$slots.subtitle || subtitle" class="mt-4 text-sm text-muted-foreground">
|
|
119
115
|
<slot name="subtitle">
|
|
120
116
|
{{ subtitle }}
|
|
121
117
|
</slot>
|
|
122
118
|
</div>
|
|
123
119
|
</div>
|
|
124
|
-
|
|
125
|
-
<PButton
|
|
126
|
-
v-if="showCloseButton"
|
|
127
|
-
variant="ghost"
|
|
128
|
-
size="sm"
|
|
129
|
-
icon
|
|
130
|
-
class="shrink-0"
|
|
131
|
-
@click="closeDrawer"
|
|
132
|
-
>
|
|
133
|
-
<CloseIcon class="h-4 w-4" />
|
|
134
|
-
</PButton>
|
|
135
120
|
</header>
|
|
136
121
|
|
|
137
122
|
<PScrollable
|
|
@@ -144,7 +129,7 @@ watch(() => isVisible.value, (visible) => {
|
|
|
144
129
|
|
|
145
130
|
<footer
|
|
146
131
|
v-if="$slots.footer"
|
|
147
|
-
class="pxd-drawer--footer
|
|
132
|
+
class="pxd-drawer--footer relative p-4 shrink-0 flex items-center gap-2 justify-between"
|
|
148
133
|
:class="{ 'border-t bg-background-secondary dark:bg-background': footerStyle }"
|
|
149
134
|
>
|
|
150
135
|
<slot name="footer" />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentLabel } from '../../types/
|
|
1
|
+
import type { BasePosition, ComponentLabel } from '../../types/shared';
|
|
2
2
|
interface Props {
|
|
3
3
|
size?: number | string;
|
|
4
4
|
title?: ComponentLabel;
|
|
@@ -7,20 +7,19 @@ interface Props {
|
|
|
7
7
|
headerStyle?: boolean;
|
|
8
8
|
footerStyle?: boolean;
|
|
9
9
|
appendToBody?: boolean;
|
|
10
|
-
showCloseButton?: boolean;
|
|
11
10
|
closeOnPressEscape?: boolean;
|
|
12
11
|
closeOnClickOverlay?: boolean;
|
|
13
|
-
position?:
|
|
12
|
+
position?: BasePosition;
|
|
14
13
|
}
|
|
15
|
-
declare var __VLS_14: {}, __VLS_16: {},
|
|
14
|
+
declare var __VLS_14: {}, __VLS_16: {}, __VLS_22: {}, __VLS_24: {};
|
|
16
15
|
type __VLS_Slots = {} & {
|
|
17
16
|
title?: (props: typeof __VLS_14) => any;
|
|
18
17
|
} & {
|
|
19
18
|
subtitle?: (props: typeof __VLS_16) => any;
|
|
20
19
|
} & {
|
|
21
|
-
default?: (props: typeof
|
|
20
|
+
default?: (props: typeof __VLS_22) => any;
|
|
22
21
|
} & {
|
|
23
|
-
footer?: (props: typeof
|
|
22
|
+
footer?: (props: typeof __VLS_24) => any;
|
|
24
23
|
};
|
|
25
24
|
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
25
|
open: () => any;
|
|
@@ -33,14 +32,13 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {},
|
|
|
33
32
|
"onUpdate:modelValue"?: (args_0: boolean) => any;
|
|
34
33
|
"onClick-outside"?: (args_0: MouseEvent) => any;
|
|
35
34
|
}>, {
|
|
36
|
-
position:
|
|
35
|
+
position: BasePosition;
|
|
37
36
|
size: number | string;
|
|
38
37
|
modelValue: boolean;
|
|
39
38
|
closeOnPressEscape: boolean;
|
|
40
39
|
appendToBody: boolean;
|
|
41
40
|
headerStyle: boolean;
|
|
42
41
|
footerStyle: boolean;
|
|
43
|
-
showCloseButton: boolean;
|
|
44
42
|
closeOnClickOverlay: boolean;
|
|
45
43
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
46
44
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import ExternalIcon from "@gdsicon/vue/external";
|
|
3
3
|
import StopIcon from "@gdsicon/vue/stop";
|
|
4
|
+
import { computed } from "vue";
|
|
4
5
|
import { useConfigProvider } from "../../composables/useConfigProviderContext";
|
|
5
6
|
import { isExternalLink } from "../../utils/format";
|
|
7
|
+
import { getFallbackValue } from "../../utils/value";
|
|
6
8
|
defineOptions({
|
|
7
9
|
name: "PError"
|
|
8
10
|
});
|
|
9
|
-
defineProps({
|
|
10
|
-
size: { type: String, required: false },
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
size: { type: String, required: false, default: "md" },
|
|
11
13
|
label: { type: String, required: false },
|
|
12
14
|
error: { type: Object, required: false }
|
|
13
15
|
});
|
|
14
|
-
const config = useConfigProvider();
|
|
15
16
|
const SIZES = {
|
|
16
|
-
xs: "text-xs",
|
|
17
|
-
sm: "text-
|
|
18
|
-
md: "text-sm",
|
|
19
|
-
lg: "text-base"
|
|
17
|
+
xs: "text-xs [--mt:2px]",
|
|
18
|
+
sm: "text-[13px] [--mt:2px]",
|
|
19
|
+
md: "text-sm [--mt:2px]",
|
|
20
|
+
lg: "text-base [--mt:4px]"
|
|
20
21
|
};
|
|
22
|
+
const config = useConfigProvider();
|
|
23
|
+
const computedClass = computed(() => {
|
|
24
|
+
const classes = ["pxd-error flex text-red-900", getFallbackValue(props.size, SIZES, config.size)];
|
|
25
|
+
return classes.join(" ");
|
|
26
|
+
});
|
|
21
27
|
</script>
|
|
22
28
|
|
|
23
29
|
<template>
|
|
24
|
-
<div
|
|
25
|
-
<StopIcon class="size-4 min-w-4 mr-2 mt-
|
|
30
|
+
<div :class="computedClass">
|
|
31
|
+
<StopIcon class="size-4 min-w-4 mr-2 mt-(--mt)" />
|
|
26
32
|
|
|
27
33
|
<div class="flex-1">
|
|
28
34
|
<b v-if="label || error?.label" class="font-medium whitespace-nowrap">{{ label || error?.label }}:</b>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ErrorType } from '../../types/components/error';
|
|
2
|
+
import type { ComponentSizeWithXs } from '../../types/shared';
|
|
2
3
|
interface Props {
|
|
3
4
|
size?: ComponentSizeWithXs;
|
|
4
5
|
label?: string;
|
|
@@ -8,7 +9,9 @@ declare var __VLS_6: {};
|
|
|
8
9
|
type __VLS_Slots = {} & {
|
|
9
10
|
default?: (props: typeof __VLS_6) => any;
|
|
10
11
|
};
|
|
11
|
-
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
13
|
+
size: ComponentSizeWithXs;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
15
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
13
16
|
export default _default;
|
|
14
17
|
type __VLS_WithSlots<T, S> = T & {
|