pxd 0.0.17 → 0.0.18

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 (43) hide show
  1. package/dist/components/badge/index.vue +24 -5
  2. package/dist/components/checkbox/index.vue +5 -3
  3. package/dist/components/checkbox/index.vue.d.ts +7 -8
  4. package/dist/components/checkbox-group/index.vue +2 -1
  5. package/dist/components/checkbox-group/index.vue.d.ts +9 -7
  6. package/dist/components/choicebox/index.vue +66 -0
  7. package/dist/components/choicebox/index.vue.d.ts +22 -0
  8. package/dist/components/choicebox-group/index.vue +69 -0
  9. package/dist/components/choicebox-group/index.vue.d.ts +36 -0
  10. package/dist/components/collapse/index.vue +111 -0
  11. package/dist/components/collapse/index.vue.d.ts +21 -0
  12. package/dist/components/collapse-group/index.vue +61 -0
  13. package/dist/components/collapse-group/index.vue.d.ts +19 -0
  14. package/dist/components/index.d.ts +4 -0
  15. package/dist/components/index.js +4 -0
  16. package/dist/components/input/index.vue +2 -1
  17. package/dist/components/input/index.vue.d.ts +1 -0
  18. package/dist/components/popover/index.vue +86 -53
  19. package/dist/components/popover/index.vue.d.ts +2 -0
  20. package/dist/components/radio/index.vue +8 -5
  21. package/dist/components/radio/index.vue.d.ts +5 -5
  22. package/dist/components/radio-group/index.vue +3 -2
  23. package/dist/components/radio-group/index.vue.d.ts +9 -7
  24. package/dist/components/scrollable/index.vue +0 -1
  25. package/dist/components/scrollable/index.vue.d.ts +0 -1
  26. package/dist/components/slider/index.vue +8 -3
  27. package/dist/components/stack/index.vue +8 -4
  28. package/dist/components/switch/index.vue +3 -3
  29. package/dist/components/switch-group/index.vue.d.ts +3 -3
  30. package/dist/components/textarea/index.vue +5 -4
  31. package/dist/components/textarea/index.vue.d.ts +3 -2
  32. package/dist/components/theme-switcher/index.vue +2 -1
  33. package/dist/components/tooltip/index.vue +3 -1
  34. package/dist/composables/index.d.ts +1 -0
  35. package/dist/composables/index.js +1 -0
  36. package/dist/composables/useDelayDestroy.d.ts +13 -0
  37. package/dist/composables/useDelayDestroy.js +29 -0
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.js +1 -1
  40. package/dist/styles/styles.css +1 -1
  41. package/dist/types/components.d.ts +2 -1
  42. package/dist/utils/dom.js +1 -1
  43. package/package.json +1 -1
@@ -35,16 +35,17 @@ const VARIANTS = {
35
35
  "green-subtle": "bg-green-200 text-green-900",
36
36
  "teal-subtle": "bg-teal-200 text-teal-900",
37
37
  "inverted": "bg-gray-1000 text-gray-100",
38
- "vue": "text-gray-100 dark:text-gray-1000 bg-linear-[315deg,#42d392_25%,#647eff]",
39
- "trial": "text-gray-100 dark:text-gray-1000 bg-linear-[135deg,#0070f3,#f81ce5]",
40
- "turborepo": "text-gray-100 dark:text-gray-1000 bg-linear-[135deg,#ff1e56,#0096ff]"
38
+ "vue": "text-gray-100 dark:text-gray-1000",
39
+ "trial": "text-gray-100 dark:text-gray-1000",
40
+ "turborepo": "text-gray-100 dark:text-gray-1000"
41
41
  };
42
42
  const computedSize = useComputedSize(props.size, SIZES);
43
43
  const computedClass = computed(
44
44
  () => twMerge(
45
- "pxd-badge inline-flex items-center justify-center px-2.5 h-6 text-xs rounded-full font-sans gap-1 !no-underline motion-safe:transition-all",
45
+ "pxd-badge inline-flex items-center justify-center px-2.5 font-medium h-6 text-xs rounded-full font-sans gap-1 !no-underline motion-safe:transition-all",
46
46
  getFallbackVariant(props.variant, VARIANTS, "gray"),
47
- computedSize.value
47
+ computedSize.value,
48
+ props.variant
48
49
  )
49
50
  );
50
51
  const badgeAttrs = computed(() => {
@@ -66,3 +67,21 @@ const badgeAttrs = computed(() => {
66
67
  <slot />
67
68
  </component>
68
69
  </template>
70
+
71
+ <style>
72
+ .pxd-badge.pill {
73
+ box-shadow: 0 0 0 1px var(--color-gray-300);
74
+ }
75
+
76
+ .pxd-badge.vue {
77
+ background: linear-gradient(315deg, #42d392 25%, #647eff);
78
+ }
79
+
80
+ .pxd-badge.trial {
81
+ background: linear-gradient(135deg, #0070f3, #f81ce5);
82
+ }
83
+
84
+ .pxd-badge.turborepo {
85
+ background: linear-gradient(135deg, #ff1e56, #0096ff);
86
+ }
87
+ </style>
@@ -17,7 +17,7 @@ const props = defineProps({
17
17
  value: { type: [String, Number, Boolean], required: false, default: true },
18
18
  disabled: { type: Boolean, required: false },
19
19
  required: { type: Boolean, required: false },
20
- modelValue: { type: [String, Number, Boolean, Array], required: false, default: false },
20
+ modelValue: { type: [String, Number, Boolean, Array], required: false, default: () => [] },
21
21
  indeterminate: { type: Boolean, required: false }
22
22
  });
23
23
  const emits = defineEmits(["update:modelValue"]);
@@ -78,7 +78,8 @@ defineExpose({
78
78
 
79
79
  <template>
80
80
  <label
81
- class="pxd-checkbox inline-flex items-center group/checkbox"
81
+ :aria-checked="isChecked"
82
+ class="pxd-checkbox inline-flex items-center group/checkbox gap-2"
82
83
  :class="{ 'is-disabled cursor-not-allowed text-gray-500': computedDisabled }"
83
84
  :for="uniqueId"
84
85
  >
@@ -92,13 +93,14 @@ defineExpose({
92
93
  :disabled="computedDisabled"
93
94
  @change="onInputChange"
94
95
  >
96
+
95
97
  <span aria-hidden="true" :class="computedInnerClasses">
96
98
  <CheckIcon v-if="isChecked" class="size-3 text-gray-100" />
97
99
  <MinusIcon v-else-if="indeterminate" class="size-3" />
98
100
  <span v-else class="size-3" />
99
101
  </span>
100
102
 
101
- <span class="ml-2 text-sm empty:hidden">
103
+ <span class="flex-1 text-sm empty:hidden">
102
104
  <slot>
103
105
  {{ label }}
104
106
  </slot>
@@ -1,11 +1,10 @@
1
- import type { ComponentLabel } from '../../types/components';
2
- type ValueType = string | number | boolean;
1
+ import type { ComponentLabel, ComponentValue } from '../../types/components';
3
2
  interface Props {
4
3
  label?: ComponentLabel;
5
- value?: ValueType;
4
+ value?: ComponentValue;
6
5
  disabled?: boolean;
7
6
  required?: boolean;
8
- modelValue?: ValueType | ValueType[];
7
+ modelValue?: ComponentValue | ComponentValue[];
9
8
  indeterminate?: boolean;
10
9
  }
11
10
  declare function getCheckedState(): "indeterminate" | "checked" | "unchecked";
@@ -16,12 +15,12 @@ type __VLS_Slots = {} & {
16
15
  declare const __VLS_component: import("vue").DefineComponent<Props, {
17
16
  getCheckedState: typeof getCheckedState;
18
17
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
- "update:modelValue": (args_0: NonNullable<ValueType | ValueType[]>) => any;
18
+ "update:modelValue": (args_0: NonNullable<ComponentValue | ComponentValue[]>) => any;
20
19
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
21
- "onUpdate:modelValue"?: (args_0: NonNullable<ValueType | ValueType[]>) => any;
20
+ "onUpdate:modelValue"?: (args_0: NonNullable<ComponentValue | ComponentValue[]>) => any;
22
21
  }>, {
23
- value: ValueType;
24
- modelValue: ValueType | ValueType[];
22
+ value: ComponentValue;
23
+ modelValue: ComponentValue | ComponentValue[];
25
24
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
25
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
27
26
  export default _default;
@@ -5,6 +5,7 @@ import PCheckbox from "../checkbox/index.vue";
5
5
  import PStack from "../stack/index.vue";
6
6
  defineOptions({
7
7
  name: "PCheckboxGroup",
8
+ inheritAttrs: false,
8
9
  model: {
9
10
  prop: "modelValue",
10
11
  event: "update:modelValue"
@@ -16,7 +17,7 @@ const props = defineProps({
16
17
  modelValue: { type: Array, required: false, default: () => [] },
17
18
  options: { type: Array, required: false, default: () => [] }
18
19
  });
19
- const emits = defineEmits(["update:modelValue"]);
20
+ const emits = defineEmits(["change", "update:modelValue"]);
20
21
  const modelValue = useModelValue(props, emits);
21
22
  function isCheckedAll() {
22
23
  return props.options.every((option) => modelValue.value.includes(option.value));
@@ -1,9 +1,9 @@
1
- import type { ComponentOptions } from '../../types';
1
+ import type { ComponentOption, ComponentValue } from '../../types';
2
2
  interface Props {
3
3
  disabled?: boolean;
4
4
  required?: boolean;
5
- modelValue?: (string | number)[];
6
- options?: ComponentOptions[];
5
+ modelValue?: ComponentValue[];
6
+ options?: ComponentOption[];
7
7
  }
8
8
  declare function isCheckedAll(): boolean;
9
9
  declare function isCheckedPartial(): boolean;
@@ -15,12 +15,14 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {
15
15
  isCheckedAll: typeof isCheckedAll;
16
16
  isCheckedPartial: typeof isCheckedPartial;
17
17
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
- "update:modelValue": (args_0: (string | number)[]) => any;
18
+ change: (args_0: ComponentValue[]) => any;
19
+ "update:modelValue": (args_0: ComponentValue[]) => any;
19
20
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
20
- "onUpdate:modelValue"?: (args_0: (string | number)[]) => any;
21
+ onChange?: (args_0: ComponentValue[]) => any;
22
+ "onUpdate:modelValue"?: (args_0: ComponentValue[]) => any;
21
23
  }>, {
22
- options: ComponentOptions[];
23
- modelValue: (string | number)[];
24
+ options: ComponentOption[];
25
+ modelValue: ComponentValue[];
24
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
25
27
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
26
28
  export default _default;
@@ -0,0 +1,66 @@
1
+ <script setup>
2
+ import { computed, inject, markRaw } from "vue";
3
+ import PCheckbox from "../checkbox/index.vue";
4
+ import PRadio from "../radio/index.vue";
5
+ defineOptions({
6
+ name: "PChoicebox"
7
+ });
8
+ const props = defineProps({
9
+ label: { type: [String, Number, Array, null], required: false },
10
+ value: { type: [String, Number, Boolean], required: false },
11
+ disabled: { type: Boolean, required: false },
12
+ required: { type: Boolean, required: false },
13
+ description: { type: String, required: false }
14
+ });
15
+ const modelValue = inject("choiceboxGroupModelValue");
16
+ const choiceboxGroupProps = inject("choiceboxGroupProps", { multiple: false });
17
+ const renderComponent = computed(() => markRaw(choiceboxGroupProps.multiple ? PCheckbox : PRadio));
18
+ const computedAttrs = computed(() => {
19
+ const { disabled, required, value } = props;
20
+ return {
21
+ value,
22
+ disabled,
23
+ required,
24
+ class: "pxd-choicebox justify-between border rounded-md flex-1 p-3 flex-row-reverse hover:bg-background-hover hover:border-gray-500 motion-safe:transition-colors"
25
+ };
26
+ });
27
+ </script>
28
+
29
+ <template>
30
+ <component :is="renderComponent" v-model="modelValue" v-bind="computedAttrs">
31
+ <div class="flex flex-col gap-1">
32
+ <span class="pxd-choicebox--label font-medium">
33
+ <slot name="label">
34
+ {{ label }}
35
+ </slot>
36
+ </span>
37
+ <span class="pxd-choicebox--description text-sm text-foreground-secondary">
38
+ <slot name="description">
39
+ {{ description }}
40
+ </slot>
41
+ </span>
42
+ </div>
43
+ </component>
44
+ </template>
45
+
46
+ <style lang="postcss">
47
+ .pxd-choicebox[aria-checked="true"] {
48
+ border-color: var(--color-primary);
49
+ background-color: hsla(var(--primary), 0.08);
50
+
51
+ .pxd-choicebox--label,
52
+ .pxd-choicebox--description {
53
+ color: var(--color-primary);
54
+ }
55
+ }
56
+
57
+ .pxd-choicebox.is-disabled {
58
+ background-color: var(--color-background);
59
+ border-color: var(--color-border);
60
+
61
+ .pxd-choicebox--label,
62
+ .pxd-choicebox--description {
63
+ color: var(--color-gray-500);
64
+ }
65
+ }
66
+ </style>
@@ -0,0 +1,22 @@
1
+ import type { ComponentLabel, ComponentValue } from '../../types/components';
2
+ interface Props {
3
+ label?: ComponentLabel;
4
+ value?: ComponentValue;
5
+ disabled?: boolean;
6
+ required?: boolean;
7
+ description?: string;
8
+ }
9
+ declare var __VLS_6: {}, __VLS_8: {};
10
+ type __VLS_Slots = {} & {
11
+ label?: (props: typeof __VLS_6) => any;
12
+ } & {
13
+ description?: (props: typeof __VLS_8) => any;
14
+ };
15
+ 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>;
16
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
17
+ export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,69 @@
1
+ <script setup>
2
+ import { computed, markRaw, provide, useAttrs } from "vue";
3
+ import { useModelValue } from "../../composables/useModelValue";
4
+ import PCheckboxGroup from "../checkbox-group/index.vue";
5
+ import PRadioGroup from "../radio-group/index.vue";
6
+ defineOptions({
7
+ name: "PChoiceboxGroup",
8
+ inheritAttrs: false,
9
+ model: {
10
+ prop: "modelValue",
11
+ event: "update:modelValue"
12
+ }
13
+ });
14
+ const props = defineProps({
15
+ modelValue: { type: null, required: false, default: "" },
16
+ label: { type: String, required: false },
17
+ multiple: { type: Boolean, required: false },
18
+ required: { type: Boolean, required: false, default: false },
19
+ disabled: { type: Boolean, required: false, default: false },
20
+ options: { type: Array, required: false }
21
+ });
22
+ const emits = defineEmits(["update:modelValue"]);
23
+ const attrs = useAttrs();
24
+ const modelValue = useModelValue(props, emits);
25
+ const renderComponent = computed(() => markRaw(props.multiple ? PCheckboxGroup : PRadioGroup));
26
+ const computedAttrs = computed(() => {
27
+ const { disabled, label, multiple, required, options } = props;
28
+ const { class: classes, ...rest } = attrs;
29
+ return {
30
+ "role": multiple ? "group" : "radiogroup",
31
+ "aria-label": label,
32
+ "aria-required": required,
33
+ "aria-multiselectable": multiple,
34
+ "gap": attrs.gap || "3",
35
+ disabled,
36
+ required,
37
+ options,
38
+ label,
39
+ ...rest
40
+ };
41
+ });
42
+ provide("choiceboxGroupProps", props);
43
+ provide("choiceboxGroupModelValue", modelValue);
44
+ </script>
45
+
46
+ <template>
47
+ <div class="pxd-choicebox-group w-full">
48
+ <div v-if="label || $slots.label" class="pxd-form--label">
49
+ <slot name="label">
50
+ {{ label }}
51
+ </slot>
52
+ </div>
53
+
54
+ <component
55
+ :is="renderComponent"
56
+ v-model="modelValue"
57
+ v-bind="computedAttrs"
58
+ >
59
+ <slot>
60
+ <PChoicebox
61
+ v-for="option in options"
62
+ :key="option.value"
63
+ v-model="modelValue"
64
+ v-bind="option"
65
+ />
66
+ </slot>
67
+ </component>
68
+ </div>
69
+ </template>
@@ -0,0 +1,36 @@
1
+ import type { ComponentOption, ComponentValue } from '../../types/components';
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
+ }
15
+ declare var __VLS_1: {}, __VLS_7: {};
16
+ type __VLS_Slots = {} & {
17
+ label?: (props: typeof __VLS_1) => any;
18
+ } & {
19
+ default?: (props: typeof __VLS_7) => any;
20
+ };
21
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
22
+ "update:modelValue": (args_0: NonNullable<ComponentValue>) => any;
23
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
24
+ "onUpdate:modelValue"?: (args_0: NonNullable<ComponentValue>) => any;
25
+ }>, {
26
+ required: boolean;
27
+ disabled: boolean;
28
+ modelValue: BaseProps["multiple"] extends true ? ComponentValue[] : ComponentValue;
29
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
30
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
31
+ export default _default;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -0,0 +1,111 @@
1
+ <script setup>
2
+ import ChevronDownIcon from "@gdsicon/vue/chevron-down";
3
+ import { computed, inject, onMounted, ref, watch } from "vue";
4
+ import { getUniqueId } from "../../utils/uid";
5
+ defineOptions({
6
+ name: "PCollapse"
7
+ });
8
+ const props = defineProps({
9
+ title: { type: String, required: false, default: "" },
10
+ expand: { type: Boolean, required: false, default: false }
11
+ });
12
+ const uid = getUniqueId();
13
+ const localExpand = ref(props.expand);
14
+ const collapseGroup = inject("collapseGroup", null);
15
+ const isExpanded = computed(() => {
16
+ if (collapseGroup) {
17
+ return collapseGroup.isExpanded(uid);
18
+ }
19
+ return localExpand.value;
20
+ });
21
+ if (!collapseGroup) {
22
+ watch(
23
+ () => props.expand,
24
+ (expand) => {
25
+ localExpand.value = expand;
26
+ },
27
+ { immediate: true }
28
+ );
29
+ }
30
+ function onTriggerClick() {
31
+ const newState = !isExpanded.value;
32
+ if (collapseGroup) {
33
+ collapseGroup.toggleItem(uid, newState);
34
+ return;
35
+ }
36
+ localExpand.value = newState;
37
+ }
38
+ function beforeEnter(el) {
39
+ el.style.height = "0";
40
+ el.style.overflow = "hidden";
41
+ }
42
+ function enter(el) {
43
+ void el.offsetHeight;
44
+ el.style.height = `${el.scrollHeight}px`;
45
+ }
46
+ function afterEnter(el) {
47
+ el.style.height = "";
48
+ el.style.overflow = "";
49
+ }
50
+ function beforeLeave(el) {
51
+ el.style.height = `${el.scrollHeight}px`;
52
+ el.style.overflow = "hidden";
53
+ void el.offsetHeight;
54
+ }
55
+ function leave(el) {
56
+ el.style.height = "0";
57
+ }
58
+ onMounted(() => {
59
+ if (props.expand && collapseGroup) {
60
+ collapseGroup.toggleItem(uid, true);
61
+ }
62
+ });
63
+ </script>
64
+
65
+ <template>
66
+ <div class="pxd-collapse border-b">
67
+ <h3 class="pxd-collapse--title">
68
+ <button
69
+ class="pxd-collapse--trigger flex items-center justify-between w-full pr-1 appearance-none group/collapse cursor-pointer outline-none border-none bg-transparent self-focus-ring"
70
+ :data-state="isExpanded ? 'open' : 'closed'"
71
+ @click="onTriggerClick"
72
+ >
73
+ <slot name="title">
74
+ {{ title }}
75
+ </slot>
76
+
77
+ <ChevronDownIcon class="flex-shrink-0 size-4 group-data-[state=open]/collapse:-rotate-180 motion-safe:transition-transform motion-safe:duration-200" />
78
+ </button>
79
+ </h3>
80
+
81
+ <Transition
82
+ name="pxd-transition--collapse"
83
+ @before-enter="beforeEnter"
84
+ @enter="enter"
85
+ @after-enter="afterEnter"
86
+ @before-leave="beforeLeave"
87
+ @leave="leave"
88
+ >
89
+ <div v-show="isExpanded" class="pxd-collapse--content">
90
+ <slot />
91
+ </div>
92
+ </Transition>
93
+ </div>
94
+ </template>
95
+
96
+ <style>
97
+ .pxd-collapse--trigger {
98
+ padding-block: var(--size, 24px);
99
+ font-size: var(--font-size, 24px);
100
+ font-weight: var(--font-weight, 600);
101
+ }
102
+
103
+ .pxd-collapse--content {
104
+ will-change: height;
105
+ }
106
+
107
+ .pxd-transition--collapse-enter-active,
108
+ .pxd-transition--collapse-leave-active {
109
+ transition: height 0.2s cubic-bezier(0.33, 1, 0.68, 1);
110
+ }
111
+ </style>
@@ -0,0 +1,21 @@
1
+ interface Props {
2
+ title?: string;
3
+ expand?: boolean;
4
+ }
5
+ declare var __VLS_1: {}, __VLS_19: {};
6
+ type __VLS_Slots = {} & {
7
+ title?: (props: typeof __VLS_1) => any;
8
+ } & {
9
+ default?: (props: typeof __VLS_19) => any;
10
+ };
11
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
12
+ title: string;
13
+ expand: boolean;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,61 @@
1
+ <script setup>
2
+ import { computed, provide, ref } from "vue";
3
+ import { useComputedSize } from "../../composables/useFallbackProps";
4
+ defineOptions({
5
+ name: "PCollapseGroup"
6
+ });
7
+ const props = defineProps({
8
+ multiple: { type: Boolean, required: false, default: false },
9
+ size: { type: String, required: false }
10
+ });
11
+ const SIZES = {
12
+ sm: {
13
+ padding: "12px",
14
+ fontSize: "16px",
15
+ fontWeight: "500"
16
+ },
17
+ md: {
18
+ padding: "24px",
19
+ fontSize: "24px",
20
+ fontWeight: "600"
21
+ },
22
+ lg: {
23
+ padding: "30px",
24
+ fontSize: "28px",
25
+ fontWeight: "600"
26
+ }
27
+ };
28
+ const expandedItems = ref([]);
29
+ const computedSize = useComputedSize(props.size, SIZES);
30
+ const computedStyle = computed(() => {
31
+ const { padding, fontSize, fontWeight } = computedSize.value;
32
+ return {
33
+ "--size": padding,
34
+ "--font-size": fontSize,
35
+ "--font-weight": fontWeight
36
+ };
37
+ });
38
+ function toggleItem(id, expanded) {
39
+ if (expanded) {
40
+ if (props.multiple) {
41
+ expandedItems.value.push(id);
42
+ } else {
43
+ expandedItems.value = [id];
44
+ }
45
+ return;
46
+ }
47
+ expandedItems.value = expandedItems.value.filter((item) => item !== id);
48
+ }
49
+ const isExpanded = (id) => expandedItems.value.includes(id);
50
+ provide("collapseGroup", {
51
+ multiple: computed(() => props.multiple),
52
+ isExpanded,
53
+ toggleItem
54
+ });
55
+ </script>
56
+
57
+ <template>
58
+ <div class="pxd-collapse-group w-full max-w-full border-t" :style="computedStyle">
59
+ <slot />
60
+ </div>
61
+ </template>
@@ -0,0 +1,19 @@
1
+ import type { ComponentSize } from '../../types/components';
2
+ interface Props {
3
+ multiple?: boolean;
4
+ size?: ComponentSize;
5
+ }
6
+ declare var __VLS_1: {};
7
+ type __VLS_Slots = {} & {
8
+ default?: (props: typeof __VLS_1) => any;
9
+ };
10
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
11
+ multiple: boolean;
12
+ }, {}, {}, {}, 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
+ };
@@ -6,6 +6,10 @@ export { default as Book } from './book/index.vue';
6
6
  export { default as Button } from './button/index.vue';
7
7
  export { default as Checkbox } from './checkbox/index.vue';
8
8
  export { default as CheckboxGroup } from './checkbox-group/index.vue';
9
+ export { default as Choicebox } from './choicebox/index.vue';
10
+ export { default as ChoiceboxGroup } from './choicebox-group/index.vue';
11
+ export { default as Collapse } from './collapse/index.vue';
12
+ export { default as CollapseGroup } from './collapse-group/index.vue';
9
13
  export { default as ConfigProvider } from './config-provider/index.vue';
10
14
  export { default as Description } from './description/index.vue';
11
15
  export { default as Error } from './error/index.vue';
@@ -6,6 +6,10 @@ export { default as Book } from "./book/index.vue";
6
6
  export { default as Button } from "./button/index.vue";
7
7
  export { default as Checkbox } from "./checkbox/index.vue";
8
8
  export { default as CheckboxGroup } from "./checkbox-group/index.vue";
9
+ export { default as Choicebox } from "./choicebox/index.vue";
10
+ export { default as ChoiceboxGroup } from "./choicebox-group/index.vue";
11
+ export { default as Collapse } from "./collapse/index.vue";
12
+ export { default as CollapseGroup } from "./collapse-group/index.vue";
9
13
  export { default as ConfigProvider } from "./config-provider/index.vue";
10
14
  export { default as Description } from "./description/index.vue";
11
15
  export { default as Error } from "./error/index.vue";
@@ -23,6 +23,7 @@ const props = defineProps({
23
23
  disabled: { type: Boolean, required: false },
24
24
  password: { type: Boolean, required: false },
25
25
  required: { type: Boolean, required: false },
26
+ autofocus: { type: Boolean, required: false },
26
27
  minlength: { type: [Number, String], required: false },
27
28
  maxlength: { type: [Number, String], required: false },
28
29
  modelValue: { type: [String, Number, Array, null], required: false, default: "" },
@@ -97,13 +98,13 @@ function clearInputValue() {
97
98
  :type="internalInputType"
98
99
  autocorrect="off"
99
100
  autocomplete="off"
100
- inputmode="numeric"
101
101
  autocapitalize="off"
102
102
  :readonly="readonly"
103
103
  :disabled="disabled"
104
104
  :required="required"
105
105
  :minlength="minlength"
106
106
  :maxlength="maxlength"
107
+ :autofocus="autofocus"
107
108
  :placeholder="placeholder"
108
109
  @change="onInputChange"
109
110
  @focus="onInputFocus"
@@ -7,6 +7,7 @@ interface Props {
7
7
  disabled?: boolean;
8
8
  password?: boolean;
9
9
  required?: boolean;
10
+ autofocus?: boolean;
10
11
  minlength?: number | string;
11
12
  maxlength?: number | string;
12
13
  modelValue?: ComponentLabel;