bonkers-ui 1.0.16 → 1.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 (46) hide show
  1. package/package.json +28 -25
  2. package/src/_styles/classTypes/_spacing.json +2 -0
  3. package/src/_styles/variables/spacing.css +2 -0
  4. package/src/components/ui-alert/ui-alert.vue +1 -1
  5. package/src/components/ui-button/ui-button.test.ts +1 -1
  6. package/src/components/ui-card-cta/ui-card-cta.stories.ts +9 -6
  7. package/src/components/ui-card-cta/ui-card-cta.vue +4 -17
  8. package/src/components/ui-card-result/ui-card-result.stories.ts +3 -1
  9. package/src/components/ui-card-simple/ui-card-simple.stories.ts +2 -1
  10. package/src/components/ui-icon/ui-icon.stories.ts +0 -5
  11. package/src/components/ui-icon/ui-icon.vue +0 -2
  12. package/src/components/ui-icon-wrapper/_typings.ts +10 -0
  13. package/src/components/ui-icon-wrapper/index.ts +1 -0
  14. package/src/components/ui-icon-wrapper/ui-icon-wrapper.stories.ts +57 -0
  15. package/src/components/ui-icon-wrapper/ui-icon-wrapper.vue +43 -0
  16. package/src/components/ui-input/ui-input.stories.ts +6 -5
  17. package/src/components/ui-input/ui-input.vue +7 -3
  18. package/src/components/ui-notification-badge/_types.ts +11 -0
  19. package/src/components/ui-notification-badge/index.ts +2 -0
  20. package/src/components/ui-notification-badge/ui-notification-badge.stories.ts +38 -0
  21. package/src/components/ui-notification-badge/ui-notification-badge.vue +28 -0
  22. package/src/components/ui-order-card/_types.ts +4 -0
  23. package/src/components/ui-order-card/index.ts +1 -0
  24. package/src/components/ui-order-card/ui-order-card.stories.ts +51 -0
  25. package/src/components/ui-order-card/ui-order-card.vue +83 -0
  26. package/src/components/ui-radio/ui-radio.vue +9 -9
  27. package/src/components/{ui-radio-list-fancy → ui-radio-fancy}/index.ts +0 -0
  28. package/src/components/ui-radio-fancy/ui-radio-fancy.stories.ts +32 -0
  29. package/src/components/ui-radio-fancy/ui-radio-fancy.vue +59 -0
  30. package/src/components/ui-select/ui-select.stories.ts +10 -4
  31. package/src/components/ui-select/ui-select.vue +13 -18
  32. package/src/components/ui-table/index.ts +4 -0
  33. package/src/components/ui-table/ui-table-cell/index.ts +1 -0
  34. package/src/components/ui-table/ui-table-cell/ui-table-cell.vue +33 -0
  35. package/src/components/ui-table/ui-table-row/_typings.ts +3 -0
  36. package/src/components/ui-table/ui-table-row/index.ts +2 -0
  37. package/src/components/ui-table/ui-table-row/ui-table-row.vue +31 -0
  38. package/src/components/ui-table/ui-table.stories.ts +83 -0
  39. package/src/components/ui-tabs/ui-tabs.vue +17 -15
  40. package/src/components/ui-typography/ui-typography.vue +2 -2
  41. package/src/main.css +4 -4
  42. package/tailwind.config.js +8 -1
  43. package/src/components/ui-radio-list-fancy/ui-radio-item/index.ts +0 -1
  44. package/src/components/ui-radio-list-fancy/ui-radio-item/ui-radio-item.vue +0 -65
  45. package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.stories.ts +0 -32
  46. package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.vue +0 -59
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "bonkers-ui",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
+ "private": false,
4
5
  "scripts": {
5
6
  "storybook": "start-storybook -p 6006",
6
7
  "build-storybook": "build-storybook",
@@ -10,7 +11,8 @@
10
11
  "test": "jest",
11
12
  "deploy": "gh-pages -d storybook-static",
12
13
  "typecheck": "tsc --noEmit && vue-tsc --noEmit",
13
- "i": "yarn install --frozen-lockfile"
14
+ "i": "yarn install --frozen-lockfile",
15
+ "postinstall": "husky install"
14
16
  },
15
17
  "dependencies": {
16
18
  "@fortawesome/fontawesome-svg-core": "^6.2.0",
@@ -18,43 +20,44 @@
18
20
  "@fortawesome/free-regular-svg-icons": "^6.2.0",
19
21
  "@fortawesome/free-solid-svg-icons": "^6.2.0",
20
22
  "@fortawesome/vue-fontawesome": "^3.0.1",
21
- "vue": "^3.2.38"
23
+ "vue": "^3.2.41"
22
24
  },
23
25
  "devDependencies": {
24
- "@storybook/addon-actions": "^6.5.10",
25
- "@storybook/addon-essentials": "^6.5.10",
26
- "@storybook/addon-links": "^6.5.10",
26
+ "@storybook/addon-actions": "^6.5.13",
27
+ "@storybook/addon-essentials": "^6.5.13",
28
+ "@storybook/addon-links": "^6.5.13",
27
29
  "@storybook/addon-postcss": "^2.0.0",
28
- "@storybook/builder-vite": "^0.2.2",
29
- "@storybook/vue3": "^6.5.10",
30
- "@types/jest": "^28.1.3",
31
- "@typescript-eslint/eslint-plugin": "^5.36.1",
32
- "@typescript-eslint/parser": "^5.36.1",
33
- "@vitejs/plugin-vue": "^3.0.3",
34
- "@vue/eslint-config-typescript": "^11.0.0",
35
- "@vue/test-utils": "^2.0.0",
30
+ "@storybook/builder-vite": "^0.2.4",
31
+ "@storybook/vue3": "^6.5.13",
32
+ "@types/jest": "^29.2.0",
33
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
34
+ "@typescript-eslint/parser": "^5.41.0",
35
+ "@vitejs/plugin-vue": "^3.2.0",
36
+ "@vue/eslint-config-typescript": "^11.0.2",
37
+ "@vue/test-utils": "^2.2.0",
36
38
  "@vue/vue3-jest": "^27.0.0",
37
39
  "babel-jest": "27",
38
- "eslint": "8.22.0",
39
- "eslint-plugin-vue": "^9.4.0",
40
+ "eslint": "8.26.0",
41
+ "eslint-plugin-vue": "^9.6.0",
40
42
  "gh-pages": "^4.0.0",
41
43
  "husky": "^8.0.1",
42
44
  "jest": "27.3.1",
43
45
  "lint-staged": "^13.0.2",
44
- "postcss": "^8.4.16",
46
+ "postcss": "^8.4.18",
45
47
  "postcss-html": "^1.4.1",
46
- "storybook-tailwind-dark-mode": "^1.0.13",
47
- "stylelint": "^14.11.0",
48
+ "storybook-tailwind-dark-mode": "^1.0.15",
49
+ "stylelint": "^14.14.0",
48
50
  "stylelint-config-recommended": "^9.0.0",
49
51
  "stylelint-config-recommended-vue": "^1.4.0",
50
- "stylelint-config-standard": "^28.0.0",
51
- "tailwindcss": "^3.1.8",
52
+ "stylelint-config-standard": "^29.0.0",
53
+ "tailwindcss": "^3.2.1",
52
54
  "ts-jest": "^27.0.7",
53
- "typescript": "^4.8.2",
54
- "vite": "^3.0.9",
55
- "vue-eslint-parser": "^9.0.3",
55
+ "ts-node": "^10.9.1",
56
+ "typescript": "^4.8.4",
57
+ "vite": "^3.2.0",
58
+ "vue-eslint-parser": "^9.1.0",
56
59
  "vue-loader": "^17.0.0",
57
- "vue-tsc": "^0.40.5"
60
+ "vue-tsc": "^1.0.9"
58
61
  },
59
62
  "jest": {
60
63
  "preset": "ts-jest",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "0": "var(--zero)",
3
+ "px": "var(--px)",
4
+ "auto": "var(--auto)",
3
5
  "xxs": "var(--xxs)",
4
6
  "xs": "var(--xs)",
5
7
  "sm": "var(--sm)",
@@ -1,7 +1,9 @@
1
1
  @layer base {
2
2
  :root {
3
3
  /* spacing */
4
+ --auto: auto;
4
5
  --zero: 0;
6
+ --px: 1px;
5
7
  --xxs: 4px;
6
8
  --xs: 8px;
7
9
  --sm: 16px;
@@ -5,7 +5,7 @@
5
5
  (!kind || kind === EAlertTypes.PRIMARY) && 'border-primary',
6
6
  kind === EAlertTypes.WARNING && 'border-warning',
7
7
  kind === EAlertTypes.ERROR && 'border-error',
8
- kind === EAlertTypes.SECONDARY && 'border-secondary',
8
+ kind === EAlertTypes.SECONDARY && 'border-secondary'
9
9
  ]"
10
10
  >
11
11
  <ui-icon
@@ -1,4 +1,4 @@
1
- import { mount, } from "@vue/test-utils";
1
+ import { mount } from "@vue/test-utils";
2
2
  import UiButton from "./ui-button.vue";
3
3
 
4
4
  describe("VButton.test.ts", () => {
@@ -1,5 +1,6 @@
1
1
  import UiCardCta from "../ui-card-cta";
2
2
  import UiIcon from "../ui-icon";
3
+ import UiIconWrapper from "../ui-icon-wrapper";
3
4
  import { ESize } from "../../_types/sizing";
4
5
  import UiTypography from "../ui-typography";
5
6
  import type { Story } from "@storybook/vue3";
@@ -28,21 +29,23 @@ export default {
28
29
  type TComponentProps = InstanceType<typeof UiCardCta>["$props"];
29
30
 
30
31
  const Template: Story<TComponentProps> = (args) => ({
31
- components: { UiCardCta, UiIcon, UiTypography },
32
+ components: { UiCardCta, UiIcon, UiTypography, UiIconWrapper },
32
33
  setup() {
33
34
  return { args, ESize };
34
35
  },
35
- template: `
36
+ template: /*html*/ `
36
37
  <ui-card-cta v-bind="args">
37
- <template v-slot:icon>
38
- <ui-icon :size="ESize.MD" has-wrapper class="text-white" :icon-name="['far', 'fa-face-smile']" />
38
+ <template #icon>
39
+ <ui-icon-wrapper>
40
+ <ui-icon :icon-name="['far', 'fa-face-smile']" :size=ESize.MD />
41
+ </ui-icon-wrapper>
39
42
  </template>
40
43
 
41
- <template v-slot:title>
44
+ <template #title>
42
45
  Title
43
46
  </template>
44
47
 
45
- <template v-slot:description>
48
+ <template #description>
46
49
  {{args.slot}}
47
50
  </template>
48
51
  </ui-card-cta>
@@ -1,18 +1,18 @@
1
1
  <template>
2
2
  <button
3
- class="ui-card-cta outline-0 border border-secondary-alt-500 rounded-2xl p-sm shadow-md hover:border-secondary-700 focus:shadow-border-primary active:bg-secondary-alt-200 disabled:bg-secondary-alt-200"
3
+ class="ui-card-cta w-full outline-0 border border-secondary-alt-500 rounded-2xl p-sm shadow-md hover:border-secondary-700 focus:shadow-border-primary active:bg-secondary-alt-200 disabled:bg-secondary-alt-200 disabled:pointer-events-none"
4
4
  :disabled="disabled"
5
5
  >
6
6
  <span
7
- class="ui-card-cta__wrapper grid gap-sm items-center"
7
+ class="ui-card-cta__wrapper w-full grid gap-sm items-center"
8
8
  :class="[
9
9
  invertOrder && 'ui-card-cta_inverted',
10
10
  ]"
11
11
  >
12
12
  <slot name="icon" />
13
13
  <span
14
- v-if="slots.title && slots.description"
15
- class="ui-card-cta__text-wrapper"
14
+ v-if="$slots.title && $slots.description"
15
+ class="w-full"
16
16
  :class="invertOrder && 'order-first'"
17
17
  >
18
18
  <ui-typography
@@ -35,13 +35,10 @@
35
35
  </template>
36
36
 
37
37
  <script lang="ts" setup>
38
- import { useSlots } from "vue";
39
38
  import UiTypography from "../ui-typography";
40
39
  import { ETypographySizes, ETextWeight } from "../ui-typography";
41
40
  import { EColors } from "../../_types/colors";
42
41
 
43
- const slots = useSlots();
44
-
45
42
  defineProps<{
46
43
  invertOrder?: boolean;
47
44
  disabled?: boolean;
@@ -52,26 +49,16 @@
52
49
  <style scoped>
53
50
  .ui-card-cta {
54
51
  text-align: unset;
55
- width: 100%;
56
- }
57
-
58
- .ui-card-cta:disabled {
59
- pointer-events: none;
60
52
  }
61
53
 
62
54
  .ui-card-cta__wrapper {
63
55
  grid-template-columns: auto 1fr;
64
- width: 100%;
65
56
  }
66
57
 
67
58
  .ui-card-cta:disabled .ui-card-cta__wrapper {
68
59
  opacity: 0.5;
69
60
  }
70
61
 
71
- .ui-card-cta__text-wrapper {
72
- width: 100%;
73
- }
74
-
75
62
  .ui-card-cta_inverted {
76
63
  grid-template-columns: 1fr auto;
77
64
  }
@@ -34,7 +34,8 @@ const Template: Story<TComponentProps> = (args) => ({
34
34
  setup() {
35
35
  return { args, ETypographySizes, ETextWeight, ETextAlign, EButtonTypes, ESize };
36
36
  },
37
- template: `
37
+ template:
38
+ /*html*/`
38
39
  <ui-card-result
39
40
  v-bind="args"
40
41
  header="Some header"
@@ -96,6 +97,7 @@ const Template: Story<TComponentProps> = (args) => ({
96
97
 
97
98
  </template>
98
99
  </ui-card-result>
100
+
99
101
  `,
100
102
  });
101
103
 
@@ -17,7 +17,8 @@ const Template: Story<TComponentProps> = (args) => ({
17
17
  setup() {
18
18
  return { args };
19
19
  },
20
- template: `
20
+ template: /*html*/`
21
+
21
22
  <ui-card-simple>
22
23
  <template v-slot:title>
23
24
  I want to borrow for
@@ -7,10 +7,6 @@ export default {
7
7
  component: UiIcon,
8
8
  // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
9
9
  argTypes: {
10
- hasWrapper:{
11
- control: { type: "boolean" },
12
- description: "The Icon show wrapper",
13
- },
14
10
  size: {
15
11
  control: { type: "select" },
16
12
  options: Object.values(ESize),
@@ -20,7 +16,6 @@ export default {
20
16
  },
21
17
  args: {
22
18
  size: ESize.LG,
23
- hasWrapper: false,
24
19
  },
25
20
  };
26
21
 
@@ -10,7 +10,6 @@
10
10
  size === ESize.LG && 'h-lg w-lg',
11
11
  size === ESize.XL && 'h-xl w-xl',
12
12
  size === ESize.XXL && 'h-xxl w-xxl',
13
- hasWrapper && 'p-sm bg-primary rounded-2xl',
14
13
  ]"
15
14
  />
16
15
  </template>
@@ -20,7 +19,6 @@
20
19
  import type { TIconName } from "./_typings";
21
20
 
22
21
  defineProps<{
23
- hasWrapper?: boolean;
24
22
  size: ESize;
25
23
  iconName: TIconName;
26
24
  }>();
@@ -0,0 +1,10 @@
1
+ export enum EIconWrapperTypes {
2
+ PRIMARY = "primary",
3
+ SECONDARY = "secondary",
4
+ }
5
+ export enum EIconWrapperSizes {
6
+ DEFAULT = "default",
7
+ SMALL = "sm",
8
+ MEDIUM = "md",
9
+ LARGE = "lg"
10
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./ui-icon-wrapper.vue";
@@ -0,0 +1,57 @@
1
+ import UiIconWrapper from "../ui-icon-wrapper";
2
+ import UiIcon from "../ui-icon";
3
+ import UiNotificationBadge, { EBadgeOrigin } from "../ui-notification-badge";
4
+ import { EIconWrapperSizes, EIconWrapperTypes } from "./_typings";
5
+ import { ESize } from "../../_types/sizing";
6
+ import type { Story } from "@storybook/vue3";
7
+
8
+ export default {
9
+ title: "Components/ui-icon-wrapper",
10
+ component: UiIconWrapper,
11
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
12
+ argTypes: {
13
+ kind: {
14
+ control: { type: "select" },
15
+ options: Object.values(EIconWrapperTypes),
16
+ description: "The Icon Wrapper kinds",
17
+ },
18
+ size: {
19
+ control: { type: "select" },
20
+ options: Object.values(EIconWrapperSizes),
21
+ description: "The Icon Wrapper sizes",
22
+ }
23
+ },
24
+ args: {
25
+ slot: "icon",
26
+ },
27
+ };
28
+
29
+ type TComponentProps = InstanceType<typeof UiIconWrapper>["$props"];
30
+
31
+ const Template: Story<TComponentProps> = (args) => ({
32
+ components: { UiIconWrapper, UiIcon, UiNotificationBadge },
33
+ setup() {
34
+ return { args, ESize, EBadgeOrigin };
35
+ },
36
+ template: /*html*/`
37
+ <ui-icon-wrapper kind="primary" v-bind="args" class="mb-sm">
38
+ <p> ${args.slot} </p>
39
+ <UiNotificationBadge :origin=EBadgeOrigin.OFFSET_TOP_RIGHT>
40
+ 1
41
+ </UiNotificationBadge>
42
+ </ui-icon-wrapper>
43
+
44
+ <ui-icon-wrapper kind="secondary" v-bind="args" class="mb-sm">
45
+ <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Emblem-person-blue.svg/640px-Emblem-person-blue.svg.png" width="20" height="20" />
46
+ </ui-icon-wrapper>
47
+
48
+ <ui-icon-wrapper kind="primary" v-bind="args">
49
+ <ui-icon :icon-name="['far', 'fa-face-smile']" :size=ESize.LG />
50
+ <UiNotificationBadge slot="badge" :origin=EBadgeOrigin.DEFAULT>
51
+ 2
52
+ </UiNotificationBadge>
53
+ </ui-icon-wrapper>
54
+ `
55
+ });
56
+
57
+ export const Default = Template.bind({});
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <div
3
+ class="icon-wrapper w-fit h-fit grid place-items-center relative rounded-3xl"
4
+ :class="[
5
+ kind === EIconWrapperTypes.PRIMARY && 'text-white bg-primary',
6
+ kind === EIconWrapperTypes.SECONDARY && 'text-black bg-secondary-alt-200',
7
+ size === EIconWrapperSizes.DEFAULT && 'py-sm px-sm',
8
+ size === EIconWrapperSizes.SMALL && 'py-xs px-xs',
9
+ size === EIconWrapperSizes.MEDIUM && 'py-md px-md icon-wrapper_offset-md',
10
+ size === EIconWrapperSizes.LARGE && 'py-lg px-lg icon-wrapper_offset-lg',
11
+ ]"
12
+ >
13
+ <slot />
14
+ </div>
15
+ </template>
16
+
17
+ <script lang="ts" setup>
18
+ import { EIconWrapperSizes, EIconWrapperTypes } from "./_typings";
19
+
20
+ type TProps = {
21
+ kind?: EIconWrapperTypes;
22
+ size?: EIconWrapperSizes;
23
+ }
24
+
25
+ withDefaults(defineProps<TProps>(),{
26
+ kind: EIconWrapperTypes.PRIMARY,
27
+ size: EIconWrapperSizes.DEFAULT,
28
+ });
29
+
30
+ </script>
31
+
32
+ <style scoped>
33
+ .icon-wrapper_offset-md :deep(.notification-badge) {
34
+ top: 4px;
35
+ right: 4px;
36
+ }
37
+
38
+ .icon-wrapper_offset-lg :deep(.notification-badge) {
39
+ top: 8px;
40
+ right: 8px;
41
+ }
42
+
43
+ </style>
@@ -49,8 +49,9 @@ const Template: Story<MyComponentProps> = (args: MyComponentProps) => ({
49
49
  valueModel
50
50
  };
51
51
  },
52
- template: `
53
- <ui-input v-bind="args" v-model="valueModel" heading="heading" sub-label="subLabel" />
52
+ template: /*html*/`
53
+ <ui-input v-bind="args" v-model="valueModel" heading="heading" sub-label="subLabel" pattern="[\\d]{9}"
54
+ />
54
55
  `
55
56
  });
56
57
 
@@ -67,7 +68,7 @@ const TemplateAll: Story<MyComponentProps> = (args: MyComponentProps) => ({
67
68
  valueModel
68
69
  };
69
70
  },
70
- template: `
71
+ template: /*html*/`
71
72
  <div :style="{
72
73
  display: 'grid',
73
74
  gridGap: '12px'
@@ -77,12 +78,12 @@ const TemplateAll: Story<MyComponentProps> = (args: MyComponentProps) => ({
77
78
  </ui-input>
78
79
  <ui-input v-bind="args" v-model="valueModel">
79
80
  <template v-slot:prefix-icon>
80
- <icon :size="16" />
81
+ <Icon :size="16" />
81
82
  </template>
82
83
  </ui-input>
83
84
  <ui-input v-bind="args" v-model="valueModel">
84
85
  <template v-slot:postfix-icon>
85
- <icon :size="16" />
86
+ <Icon :size="16" />
86
87
  </template>
87
88
  </ui-input>
88
89
  </div>
@@ -1,4 +1,4 @@
1
- EInputKinds<template>
1
+ <template>
2
2
  <div class="ui-input">
3
3
  <ui-typography
4
4
  v-if="heading"
@@ -7,7 +7,7 @@ EInputKinds<template>
7
7
  >
8
8
  {{ heading }}
9
9
  </ui-typography>
10
- <div
10
+ <label
11
11
  class="ui-input__wrapper flex w-full rounded-lg border bg-white items-center p-sm gap-xs"
12
12
  :class="[
13
13
  !kind && 'border-secondary-alt-500 hover:border-secondary-alt-700',
@@ -25,11 +25,13 @@ EInputKinds<template>
25
25
  :placeholder="placeholder"
26
26
  :value="modelValue"
27
27
  :pattern="pattern"
28
+ :maxlength="maxlength"
29
+ :minlength="minlength"
28
30
  @input="$emit('update:modelValue', ($event.target as HTMLTextAreaElement)?.value)"
29
31
  >
30
32
 
31
33
  <slot name="postfix-icon" />
32
- </div>
34
+ </label>
33
35
  <ui-typography
34
36
  v-if="subLabel"
35
37
  :size="ETypographySizes.SM"
@@ -53,6 +55,8 @@ EInputKinds<template>
53
55
  subLabel?: string;
54
56
  type?: EInputType;
55
57
  pattern?: string;
58
+ maxlength?: string;
59
+ minlength?: string;
56
60
  }>();
57
61
 
58
62
  defineEmits(["update:modelValue"]);
@@ -0,0 +1,11 @@
1
+ export enum EBadgeOrigin {
2
+ DEFAULT = "default",
3
+ OFFSET_TOP_RIGHT = "offset-top-right"
4
+ }
5
+
6
+ export enum ENotificationBadgeSizes {
7
+ DEFAULT = "default",
8
+ SMALL = "sm",
9
+ MEDIUM = "md",
10
+ LARGE = "lg"
11
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from "./ui-notification-badge.vue";
2
+ export { EBadgeOrigin } from "./_types";
@@ -0,0 +1,38 @@
1
+ import UiNotificationBadge from ".";
2
+ import type { Story } from "@storybook/vue3";
3
+ import { EBadgeOrigin } from "./_types";
4
+
5
+ export default {
6
+ title: "Components/ui-notification-badge",
7
+ component: UiNotificationBadge,
8
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
9
+ argTypes: {
10
+ origin: {
11
+ control: { type: "select" },
12
+ options: Object.values(EBadgeOrigin),
13
+ description: "The Element origin",
14
+ }
15
+ },
16
+ args: {
17
+ slot: "1",
18
+ origin: EBadgeOrigin.OFFSET_TOP_RIGHT,
19
+ },
20
+ };
21
+
22
+ type TComponentProps = InstanceType<typeof UiNotificationBadge>["$props"];
23
+
24
+ const Template: Story<TComponentProps> = (args) => ({
25
+ components: { UiNotificationBadge },
26
+ setup() {
27
+ return { args };
28
+ },
29
+ template: /*html*/`
30
+ <div class="relative rounded-full bg-primary w-lg h-lg">
31
+ <ui-notification-badge :origin="args.origin">
32
+ {{args.slot}}
33
+ </ui-notification-badge>
34
+ </div>
35
+ `
36
+ });
37
+
38
+ export const Default = Template.bind({});
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div
3
+ class="notification-badge absolute min-w-sm h-sm font-bold text-xxs rounded-full border border-white text-white bg-error text-center leading-none"
4
+ :class="[
5
+ origin === EBadgeOrigin.DEFAULT && 'top-0 right-0',
6
+ origin === EBadgeOrigin.OFFSET_TOP_RIGHT && '-top-xxs -right-xxs',
7
+ ]"
8
+ >
9
+ <slot />
10
+ </div>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import { EBadgeOrigin } from "./_types";
15
+
16
+ withDefaults(defineProps<{
17
+ origin?: EBadgeOrigin,
18
+ }>(),{
19
+ origin: EBadgeOrigin.DEFAULT,
20
+ });
21
+
22
+ </script>
23
+
24
+ <style>
25
+ .notification-badge {
26
+ padding: 2px;
27
+ }
28
+ </style>
@@ -0,0 +1,4 @@
1
+ export enum EOrderCardTypes {
2
+ DEFAULT = "DEFAULT",
3
+ WARNING = "WARNING"
4
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./ui-order-cards.vue";
@@ -0,0 +1,51 @@
1
+ import UiOrderCard from "./ui-order-card.vue";
2
+ import type { Story } from "@storybook/vue3";
3
+ import { EOrderCardTypes } from "./_types";
4
+
5
+ export default {
6
+ title: "Components/ui-order-card",
7
+ component: UiOrderCard,
8
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
9
+ argTypes: {
10
+ kind: {
11
+ control: { type: "select" },
12
+ options: Object.values(EOrderCardTypes),
13
+ description: "The Element kinds",
14
+ },
15
+ },
16
+
17
+ args: {
18
+ slot: "But we still need your gas and electricity meter readings before processing it.",
19
+ kind: EOrderCardTypes.DEFAULT
20
+ },
21
+ };
22
+
23
+ type TComponentProps = InstanceType<typeof UiOrderCard>["$props"];
24
+
25
+ const Template: Story<TComponentProps> = (args) => ({
26
+ components: { UiOrderCard },
27
+ setup() {
28
+
29
+ return { args };
30
+ },
31
+
32
+ template: /*html*/`
33
+ <ui-order-card v-bind="args" :iconName="['far', 'fa-face-smile']">
34
+ <template #title>
35
+ Thank you for your order!
36
+ </template>
37
+
38
+ <template #textBody>
39
+ {{args.slot}}
40
+ </template>
41
+
42
+ <template #footer>
43
+ We’ll send a confirmation email to william.moran@bonkers.ie
44
+ </template>
45
+ </ui-order-card>
46
+
47
+
48
+ `,
49
+ });
50
+
51
+ export const Default = Template.bind({});