@dpa-id-components/dpa-shared-components 22.1.0 → 22.2.0

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.
@@ -15,7 +15,6 @@ type __VLS_Props = {
15
15
  to?: RouteLocationRaw;
16
16
  size?: keyof typeof BUTTON_SIZE_CLASSES;
17
17
  appearance?: "fill-emphasis" | "fill-subtle" | "outline-emphasis" | "outline-subtle" | "ghost";
18
- disabled?: boolean;
19
18
  };
20
19
  declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
21
20
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1983,11 +1983,7 @@ var an = { key: 0 }, on = /* @__PURE__ */ h({
1983
1983
  props: {
1984
1984
  to: { default: () => void 0 },
1985
1985
  size: { default: "md" },
1986
- appearance: { default: "fill-emphasis" },
1987
- disabled: {
1988
- type: Boolean,
1989
- default: !1
1990
- }
1986
+ appearance: { default: "fill-emphasis" }
1991
1987
  },
1992
1988
  setup(e) {
1993
1989
  let t = {
@@ -1997,7 +1993,7 @@ var an = { key: 0 }, on = /* @__PURE__ */ h({
1997
1993
  lg: "h-12 text-base [&:has(>svg:only-child)]:w-12 [&:not(:has(>svg:only-child))]:px-4 [&>svg]:size-5 [&:has(>svg:only-child)>svg]:size-6"
1998
1994
  }, r = o(() => {
1999
1995
  let t = {};
2000
- return typeof e.to == "string" ? t.href = e.to : e.to ? t.to = e.to : (t.disabled = e.disabled, t.type = "button"), t;
1996
+ return typeof e.to == "string" ? t.href = e.to : e.to ? t.to = e.to : t.type = "button", t;
2001
1997
  }), a = o(() => ({
2002
1998
  "fill-emphasis": "border-transparent bg-primary text-neutral not-disabled:hover:bg-primary-hover disabled:bg-neutral-faint disabled:text-neutral-soft",
2003
1999
  "outline-emphasis": "border-neutral-faint bg-transparent text-primary-emphasis not-disabled:hover:border-neutral-subtle not-disabled:hover:text-primary-hover disabled:text-neutral-faint",
@@ -39,13 +39,13 @@ import { UiButton } from "@dpa-id-components/dpa-shared-components";
39
39
  ## API
40
40
 
41
41
  ### Props
42
+ Note: This component binds all non-prop attributes on its principal element (either a button or a element). This allows you to add arbitrary HTML attributes (and event listeners) on the principal element without them being explicitly supported by the component.
42
43
 
43
44
  | Name | Type | Default | Description |
44
45
  |--------------|--------------------------------------------------------------------------------------------|-------------|----------------------------------|
45
46
  | `to` | `RouteLocationRaw` | `undefined` | `RouterLink` `to` prop |
46
47
  | `size` | `"xs"`, `"sm"`, `"md"`, or `"lg"` | `"md"` | |
47
48
  | `appearance` | `"fill-emphasis"`, `"fill-subtle"`, `"outline-emphasis"`, `"outline-subtle"`, or `"ghost"` | `"primary"` | |
48
- | `disabled` | `boolean` | `false` | Whether the `button` is disabled |
49
49
 
50
50
  ### Slots
51
51
 
@@ -5,16 +5,24 @@ import UiIcon from "../UiIcon/UiIcon.vue";
5
5
 
6
6
  import UiButton from "./UiButton.vue";
7
7
 
8
+ type UiButtonArgs = InstanceType<typeof UiButton>["$props"] & {
9
+ disabled?: boolean;
10
+ };
8
11
  const meta = {
9
12
  title: "Ui/UiButton",
10
13
  component: UiButton,
11
14
  args: {
12
- disabled: false,
13
15
  appearance: "fill-emphasis",
14
16
  size: "md",
15
17
  to: undefined,
16
18
  },
17
- } satisfies Meta<typeof UiButton>;
19
+ argTypes: {
20
+ disabled: {
21
+ control: "boolean",
22
+ description: "Native disabled attribute",
23
+ },
24
+ },
25
+ } satisfies Meta<UiButtonArgs>;
18
26
 
19
27
  export default meta;
20
28
  type Story = StoryObj<typeof meta>;
@@ -43,7 +43,6 @@ const {
43
43
  to = undefined,
44
44
  size = "md",
45
45
  appearance = "fill-emphasis",
46
- disabled = false,
47
46
  } = defineProps<{
48
47
  to?: RouteLocationRaw;
49
48
  size?: keyof typeof BUTTON_SIZE_CLASSES;
@@ -53,18 +52,15 @@ const {
53
52
  | "outline-emphasis"
54
53
  | "outline-subtle"
55
54
  | "ghost";
56
- disabled?: boolean;
57
55
  }>();
58
56
 
59
57
  const attributes = computed(() => {
60
58
  const attrs: Record<string, unknown> = {};
61
-
62
59
  if (typeof to === "string") {
63
60
  attrs.href = to;
64
61
  } else if (to) {
65
62
  attrs.to = to;
66
63
  } else {
67
- attrs.disabled = disabled;
68
64
  attrs.type = "button";
69
65
  }
70
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpa-id-components/dpa-shared-components",
3
- "version": "22.1.0",
3
+ "version": "22.2.0",
4
4
  "description": "Shared Vue components library for dpa projects",
5
5
  "files": [
6
6
  "src",
@@ -39,13 +39,13 @@ import { UiButton } from "@dpa-id-components/dpa-shared-components";
39
39
  ## API
40
40
 
41
41
  ### Props
42
+ Note: This component binds all non-prop attributes on its principal element (either a button or a element). This allows you to add arbitrary HTML attributes (and event listeners) on the principal element without them being explicitly supported by the component.
42
43
 
43
44
  | Name | Type | Default | Description |
44
45
  |--------------|--------------------------------------------------------------------------------------------|-------------|----------------------------------|
45
46
  | `to` | `RouteLocationRaw` | `undefined` | `RouterLink` `to` prop |
46
47
  | `size` | `"xs"`, `"sm"`, `"md"`, or `"lg"` | `"md"` | |
47
48
  | `appearance` | `"fill-emphasis"`, `"fill-subtle"`, `"outline-emphasis"`, `"outline-subtle"`, or `"ghost"` | `"primary"` | |
48
- | `disabled` | `boolean` | `false` | Whether the `button` is disabled |
49
49
 
50
50
  ### Slots
51
51
 
@@ -43,7 +43,6 @@ const {
43
43
  to = undefined,
44
44
  size = "md",
45
45
  appearance = "fill-emphasis",
46
- disabled = false,
47
46
  } = defineProps<{
48
47
  to?: RouteLocationRaw;
49
48
  size?: keyof typeof BUTTON_SIZE_CLASSES;
@@ -53,18 +52,15 @@ const {
53
52
  | "outline-emphasis"
54
53
  | "outline-subtle"
55
54
  | "ghost";
56
- disabled?: boolean;
57
55
  }>();
58
56
 
59
57
  const attributes = computed(() => {
60
58
  const attrs: Record<string, unknown> = {};
61
-
62
59
  if (typeof to === "string") {
63
60
  attrs.href = to;
64
61
  } else if (to) {
65
62
  attrs.to = to;
66
63
  } else {
67
- attrs.disabled = disabled;
68
64
  attrs.type = "button";
69
65
  }
70
66