bonkers-ui 1.0.35 → 1.0.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bonkers-ui",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "storybook": "start-storybook -p 6006",
@@ -18,28 +18,28 @@
18
18
  "@fortawesome/free-brands-svg-icons": "^6.2.1",
19
19
  "@fortawesome/free-regular-svg-icons": "^6.2.1",
20
20
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
21
- "@fortawesome/vue-fontawesome": "^3.0.2",
22
- "@vueuse/components": "^9.10.0",
23
- "@vueuse/core": "^9.10.0",
24
- "vue": "^3.2.45"
21
+ "@fortawesome/vue-fontawesome": "^3.0.3",
22
+ "@vueuse/components": "^9.12.0",
23
+ "@vueuse/core": "^9.12.0",
24
+ "vue": "^3.2.47"
25
25
  },
26
26
  "devDependencies": {
27
- "@storybook/addon-actions": "^6.5.15",
28
- "@storybook/addon-essentials": "^6.5.15",
29
- "@storybook/addon-links": "^6.5.15",
27
+ "@storybook/addon-actions": "^6.5.16",
28
+ "@storybook/addon-essentials": "^6.5.16",
29
+ "@storybook/addon-links": "^6.5.16",
30
30
  "@storybook/addon-postcss": "^2.0.0",
31
- "@storybook/builder-vite": "^0.2.7",
32
- "@storybook/vue3": "^6.5.15",
33
- "@typescript-eslint/eslint-plugin": "^5.48.1",
34
- "@typescript-eslint/parser": "^5.48.1",
31
+ "@storybook/builder-vite": "^0.4.0",
32
+ "@storybook/vue3": "^6.5.16",
33
+ "@typescript-eslint/eslint-plugin": "^5.50.0",
34
+ "@typescript-eslint/parser": "^5.50.0",
35
35
  "@vitejs/plugin-vue": "^4.0.0",
36
36
  "@vue/eslint-config-typescript": "^11.0.2",
37
- "@vue/test-utils": "^2.2.7",
38
- "eslint": "8.31.0",
39
- "eslint-plugin-vue": "^9.8.0",
40
- "gh-pages": "^4.0.0",
37
+ "@vue/test-utils": "^2.2.9",
38
+ "eslint": "8.33.0",
39
+ "eslint-plugin-vue": "^9.9.0",
40
+ "gh-pages": "^5.0.0",
41
41
  "husky": "4.3.8",
42
- "jsdom": "^21.0.0",
42
+ "jsdom": "^21.1.0",
43
43
  "lint-staged": "^13.1.0",
44
44
  "postcss": "^8.4.21",
45
45
  "postcss-html": "^1.4.1",
@@ -50,9 +50,9 @@
50
50
  "stylelint-config-standard": "^29.0.0",
51
51
  "tailwindcss": "^3.2.4",
52
52
  "ts-node": "^10.9.1",
53
- "typescript": "^4.9.4",
54
- "vite": "^4.0.4",
55
- "vitest": "^0.27.0",
53
+ "typescript": "^4.9.5",
54
+ "vite": "^4.1.0",
55
+ "vitest": "^0.28.3",
56
56
  "vue-eslint-parser": "^9.1.0",
57
57
  "vue-loader": "^17.0.1",
58
58
  "vue-tsc": "^1.0.24"
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "md": "var(--shadow-size-md)",
3
3
  "border-primary": "var(--shadow-border-primary)",
4
+ "border-primary-disabled": "var(--shadow-selected-disabled)",
4
5
  "border-selected": "var(--shadow-border-selected)",
5
6
  "selected-shadow": "var(--shadow-selected-shadow)"
6
7
  }
@@ -5,6 +5,7 @@
5
5
  --shadow-border-primary: 0 0 0 4px rgb(69 158 74 / 50%);
6
6
  --shadow-border-selected: 0 0 0 4px rgb(69 158 74 / 100%);
7
7
  --shadow-selected-shadow: 0 0 0 4px var(--color-primary-500);
8
+ --shadow-selected-disabled: 0 0 0 4px var(--color-primary-300);
8
9
  --shadow-border-secondary: 0 0 0 4px rgb(223 225 233 / 50%);
9
10
  }
10
11
  }
@@ -38,7 +38,7 @@ const Template: Story<TComponentProps> = (args) => ({
38
38
  /*html*/`
39
39
  <ui-card-result
40
40
  v-bind="args"
41
- header="Some header"
41
+ header="Some header Some header Some header Some header Some header Some header"
42
42
  :exclusive-text="args.exclusiveText
43
43
  ? 'Only available on bonkers.ie'
44
44
  : undefined"
@@ -47,7 +47,7 @@ const Template: Story<TComponentProps> = (args) => ({
47
47
  : undefined"
48
48
  >
49
49
  <template #sidebar>
50
- <ui-typography :size='ETypographySizes.XXS' line-height>
50
+ <ui-typography :size='ETypographySizes.XXS' line-height :style="{height: '64px', width: '64px', border: '1px solid black'}" class="flex items-center">
51
51
  Special offer text
52
52
  </ui-typography>
53
53
  </template>
@@ -73,26 +73,26 @@ const Template: Story<TComponentProps> = (args) => ({
73
73
  />
74
74
  </ul>
75
75
 
76
- <ui-typography
77
- :weight="ETextWeight.BOLD"
78
- :size="ETypographySizes.LG"
79
- :align="ETextAlign.RIGHT"
80
- class="mb-xs"
81
- >
82
- €1004.63 p/m
83
- </ui-typography>
76
+ <div :style="{display: 'grid', gridTemplateColumns: '1fr 1fr'}" class="items-center gap-sm">
77
+ <ui-typography
78
+ :weight="ETextWeight.BOLD"
79
+ :size="ETypographySizes.XXL"
80
+ >
81
+ €1004.63 p/m
82
+ </ui-typography>
84
83
 
85
- <div class="flex gap-sm">
86
- <ui-button :kind="EButtonTypes.SECONDARY_OVERLAY">
87
- <template #prefix>
88
- <ui-icon
89
- :icon-name="['far', 'face-smile']"
90
- :size="ESize.SM"
91
- />
92
- </template>
93
- </ui-button>
84
+ <div class="flex gap-sm">
85
+ <ui-button :kind="EButtonTypes.SECONDARY_OVERLAY">
86
+ <template #prefix>
87
+ <ui-icon
88
+ :icon-name="['far', 'face-smile']"
89
+ :size="ESize.SM"
90
+ />
91
+ </template>
92
+ </ui-button>
94
93
 
95
- <ui-button full-width>Some text</ui-button>
94
+ <ui-button full-width>Some text</ui-button>
95
+ </div>
96
96
  </div>
97
97
 
98
98
  </template>
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <div class="ui-card-result__wrapper">
2
+ <div class="ui-card-result">
3
3
  <div
4
4
  v-if="exclusiveText"
5
- class="ui-card-result__exclusive bg-primary rounded-2xl px-sm pb-lg -mb-lg"
5
+ class="bg-primary rounded-2xl px-sm pb-lg -mb-lg"
6
6
  >
7
7
  <ui-typography
8
8
  class="py-xs"
@@ -16,30 +16,29 @@
16
16
  </ui-typography>
17
17
  </div>
18
18
 
19
- <div class="ui-card-result flex border border-secondary-alt rounded-2xl overflow-hidden">
20
- <div
21
- v-if="slots.sidebar"
22
- class="ui-card-result__sidebar bg-secondary-alt-200 p-sm w-xl border-r border-secondary-alt flex items-center justify-center text-center"
23
- >
24
- <slot name="sidebar" />
25
- </div>
26
-
19
+ <div class="flex border border-secondary-alt-400 rounded-2xl overflow-hidden">
27
20
  <main class="p-sm bg-white w-full overflow-hidden">
28
- <ui-typography
29
- v-if="header"
30
- class="mb-xs"
31
- :size="ETypographySizes.SM"
32
- :weight="ETextWeight.SEMI_BOLD"
33
- >
34
- {{ header }}
35
- </ui-typography>
21
+ <div class="flex gap-xs justify-between items-center rounded-lg bg-secondary-alt-200 p-xs mb-sm">
22
+ <ui-typography
23
+ v-if="header"
24
+ line-height
25
+ class="flex-1 truncate"
26
+ :size="ETypographySizes.SM"
27
+ :weight="ETextWeight.SEMI_BOLD"
28
+ >
29
+ {{ header }}
30
+ </ui-typography>
31
+
32
+ <slot name="sidebar" />
33
+ </div>
34
+
36
35
  <slot />
37
36
  </main>
38
37
  </div>
39
38
 
40
39
  <div
41
40
  v-if="exclusiveTextBottom"
42
- class="ui-card-result__exclusive_bottom bg-secondary rounded-2xl px-sm pt-lg -mt-lg"
41
+ class="bg-secondary rounded-2xl px-sm pt-lg -mt-lg"
43
42
  >
44
43
  <ui-typography
45
44
  class="py-xs"
@@ -16,6 +16,7 @@
16
16
  <ui-icon
17
17
  v-if="icon"
18
18
  class="bg-white z-[1] mt-[0.2em]"
19
+ :class="iconClass"
19
20
  :icon-name="icon"
20
21
  :size="ESize.SM"
21
22
  />
@@ -46,10 +47,12 @@
46
47
  title?: string
47
48
  kind?: EListItemTypes
48
49
  size?: EListItemSizes
50
+ iconClass?: string
49
51
  }>(), {
50
52
  kind: EListItemTypes.DEFAULT,
51
53
  size: EListItemSizes.COMPACT,
52
54
  title: "",
55
+ iconClass: "text-secondary-alt",
53
56
  icon: undefined
54
57
  });
55
58
 
@@ -0,0 +1 @@
1
+ export { default } from "./ui-plain-radio.vue";
@@ -0,0 +1,59 @@
1
+ import UiPlainRadio from "./ui-plain-radio.vue";
2
+ import { ETypographySizes } from "../ui-typography";
3
+ import EColors from "../ui-typography";
4
+ import type { Story } from "@storybook/vue3";
5
+ import { ref } from "vue";
6
+
7
+ export default {
8
+ title: "Components/ui-plain-radio",
9
+ component: UiPlainRadio, ETypographySizes, EColors,
10
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
11
+ argTypes: {
12
+ disabled: {
13
+ control: { type: "boolean" },
14
+ },
15
+ header: {
16
+ control: { type: "text" },
17
+ },
18
+ subHeader: {
19
+ control: { type: "text" },
20
+ }
21
+ },
22
+ args: {
23
+ disabled: false,
24
+ header: "Header",
25
+ subHeader: "SubHeader"
26
+ },
27
+ };
28
+
29
+ type TComponentProps = InstanceType<typeof UiPlainRadio>["$props"];
30
+
31
+ const Template: Story<TComponentProps> = (args) => ({
32
+ components: { UiPlainRadio },
33
+
34
+ setup() {
35
+ const modelValue = ref("1");
36
+
37
+ return { modelValue, args, ETypographySizes, EColors };
38
+
39
+ },
40
+
41
+ template: /*html*/ `
42
+ <div :style="{display: 'grid', gridGap: '5px'}">
43
+ <ui-plain-radio
44
+ v-for="item in 2"
45
+ :name="String(item)"
46
+ :key="item"
47
+ :value="String(item)"
48
+ v-model="modelValue"
49
+ :header="args.header"
50
+ :sub-header="args.subHeader"
51
+ title="title"
52
+ :disabled="args.disabled"
53
+ >
54
+ </ui-plain-radio>
55
+ </div>
56
+ `,
57
+ });
58
+
59
+ export const Default = Template.bind({});
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <label
3
+ class="ui-plain-radio relative mb-sm"
4
+ :for="name + value"
5
+ >
6
+
7
+ <input
8
+ :id="name + value"
9
+ v-model="radioModel"
10
+ :value="value"
11
+ name="ui-plain-radio"
12
+ type="radio"
13
+ :disabled="disabled"
14
+ class="appearance-none absolute peer"
15
+ >
16
+
17
+ <div
18
+ class="ui-plain-radio__content
19
+ grid
20
+ grid-flow-col
21
+ justify-start
22
+ items-center
23
+ gap-sm
24
+ box-border
25
+ w-full
26
+ h-full
27
+ py-sm px-sm
28
+ border
29
+ border-secondary-alt-500
30
+ bg-white
31
+ hover:border-secondary-alt-700
32
+ cursor-pointer
33
+ rounded-xl
34
+
35
+ before:absolute
36
+ before:-z-10
37
+ before:box-border
38
+ before:rounded-[16px]
39
+ before:bg-primary-300
40
+
41
+ peer-checked:border-transparent
42
+ peer-checked:active:shadow-border-primary
43
+ peer-checked:active:before:-top-xs
44
+ peer-checked:active:before:-bottom-xs
45
+ peer-checked:active:before:-left-xs
46
+ peer-checked:active:before:-right-xs
47
+
48
+ peer-checked:hover:shadow-border-selected
49
+ peer-checked:shadow-selected-shadow
50
+
51
+ peer-active:before:-top-xxs
52
+ peer-active:before:-bottom-xxs
53
+ peer-active:before:-left-xxs
54
+ peer-active:before:-right-xxs
55
+
56
+ peer-focus:before:-top-xs
57
+ peer-focus:before:-bottom-xs
58
+ peer-focus:before:-left-xs
59
+ peer-focus:before:-right-xs
60
+ "
61
+ :class="disabled && 'pointer-events-none border-secondary-alt-400 peer-checked:shadow-border-primary-disabled'"
62
+ >
63
+ <ui-radio
64
+ v-model="radioModel"
65
+ :value="value"
66
+ :name="name"
67
+ :disabled="disabled"
68
+ class="pointer-events-none"
69
+ />
70
+
71
+ <span>
72
+ <ui-typography
73
+ :size="ETypographySizes.SM"
74
+ :kind="EColors.SECONDARY"
75
+ :weight="ETextWeight.SEMI_BOLD"
76
+ line-height
77
+ >
78
+ {{ header }}
79
+ </ui-typography>
80
+ <ui-typography
81
+ :size="ETypographySizes.XS"
82
+ :kind="EColors.SECONDARY_ALT"
83
+ >
84
+ {{ subHeader }}
85
+ </ui-typography>
86
+ </span>
87
+ </div>
88
+ </label>
89
+ </template>
90
+
91
+ <script lang="ts" setup>
92
+ import { computed } from "vue";
93
+ import UiRadio from "../ui-radio";
94
+ import UiTypography, { ETypographySizes, EColors, ETextWeight } from "../ui-typography";
95
+
96
+ const props = defineProps<{
97
+ modelValue: string;
98
+ header: string;
99
+ subHeader: string;
100
+ name: string;
101
+ value: string;
102
+ disabled?: boolean;
103
+ }>();
104
+
105
+ const emit = defineEmits(["update:modelValue"]);
106
+
107
+ const radioModel = computed({
108
+ get() {
109
+ return props.modelValue;
110
+ },
111
+ set(value) {
112
+ emit ("update:modelValue", value);
113
+ }
114
+ });
115
+ </script>
@@ -0,0 +1,4 @@
1
+ export enum ERadioSizes {
2
+ DEFAULT = "default",
3
+ MINIMAL = "minimal"
4
+ }
@@ -1,5 +1,6 @@
1
+ import { ERadioSizes } from "./_typings";
1
2
  import { ref } from "vue";
2
- import UiRadioFancy from "./ui-radio-fancy.vue";
3
+ import UiRadioFancy from "../ui-radio-fancy";
3
4
  import type { Story } from "@storybook/vue3";
4
5
  import { EIconType } from "../ui-icon/_typings";
5
6
 
@@ -16,11 +17,17 @@ export default {
16
17
  control: { type: "boolean" },
17
18
  description: "The full width size",
18
19
  },
20
+ radioSize: {
21
+ control: { type: "select" },
22
+ options: Object.values(ERadioSizes),
23
+ description: "The radio kinds",
24
+ },
19
25
  },
20
26
  args: {
21
27
  slot: "Description",
22
28
  invertOrder: false,
23
- disabled: false
29
+ disabled: false,
30
+ radioSize: ERadioSizes.DEFAULT
24
31
  },
25
32
  };
26
33
 
@@ -31,18 +38,12 @@ const Template: Story<TComponentProps> = (args) => ({
31
38
  setup() {
32
39
  const modelValue = ref("1");
33
40
 
34
- return { modelValue, EIconType, args };
41
+ return { modelValue, EIconType, args, ERadioSizes };
35
42
  },
36
43
  template: /*html*/`
37
44
  <div class="grid gap-sm" :style="{'grid-template-columns': 'repeat(auto-fit, minmax(160px, 1fr))'}">
38
- <ui-radio-fancy v-bind="args" :key="key" value="1" v-model="modelValue" name="radio" :icon-name="[EIconType.FAR, 'face-smile']">
39
- Banana
40
- </ui-radio-fancy>
41
- <ui-radio-fancy v-bind="args" :key="key" value="2" v-model="modelValue" name="radio" :icon-name="[EIconType.FAR, 'face-smile']">
42
- Apple
43
- </ui-radio-fancy>
44
- <ui-radio-fancy v-bind="args" :key="key" value="3" v-model="modelValue" name="radio" :icon-name="[EIconType.FAR, 'face-smile']">
45
- Orange
45
+ <ui-radio-fancy v-for="item in 2" :key="item" :value="String(item)" v-model="modelValue" name="radio" title="title" :icon-name="[EIconType.FAR, 'face-smile']" :radioSize="args.radioSize" :disabled="args.disabled">
46
+ {{args.slot}}
46
47
  </ui-radio-fancy>
47
48
  </div>
48
49
  `,
@@ -13,6 +13,7 @@
13
13
  :name="name"
14
14
  :value="value"
15
15
  class="peer group appearance-none absolute"
16
+ :disabled="disabled"
16
17
  >
17
18
  <div
18
19
  class="
@@ -54,18 +55,39 @@
54
55
  peer-focus:before:-left-xs
55
56
  peer-focus:before:-right-xs
56
57
  "
57
- :class="disabled && 'pointer-events-none'"
58
+ :class="[disabled && 'pointer-events-none border-secondary-alt-400 peer-checked:shadow-border-primary-disabled',
59
+ radioSize === ERadioSizes.DEFAULT && 'default',
60
+ radioSize === ERadioSizes.MINIMAL && 'flex gap-sm align-middle']"
58
61
  >
59
- <ui-icon
60
- :icon-name="iconName"
61
- :size="ESize.MD"
62
- class="mb-md group-checked:text-primary-500"
63
- :class="value === modelValue && 'text-primary'"
64
- />
62
+ <div
63
+ v-if="radioSize === ERadioSizes.DEFAULT"
64
+ >
65
+ <ui-icon
66
+ :icon-name="iconName"
67
+ :size="ESize.MD"
68
+ class=" mb-md peer-checked:text-primary-500"
69
+ :class="[value === modelValue && 'text-primary',
70
+ disabled && 'text-secondary-alt-400',
71
+ disabled && value === modelValue && 'text-primary-300'
72
+ ]"
73
+ />
74
+ </div>
75
+ <div v-else-if="radioSize === ERadioSizes.MINIMAL">
76
+ <ui-icon
77
+ :icon-name="iconName"
78
+ :size="ESize.MD"
79
+ :class="[value === modelValue && 'text-primary',
80
+ disabled && 'text-secondary-alt-400',
81
+ disabled && value === modelValue && 'text-primary-300'
82
+ ]"
83
+ />
84
+
85
+ </div>
65
86
  <ui-typography
66
87
  :size="ETypographySizes.SM"
67
88
  :kind="EColors.SECONDARY"
68
89
  :weight="ETextWeight.SEMI_BOLD"
90
+ class="pt-xxs"
69
91
  >
70
92
  <slot />
71
93
  </ui-typography>
@@ -76,15 +98,19 @@
76
98
  <script lang="ts" setup>
77
99
  import { computed } from "vue";
78
100
  import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
79
- import UiIcon, { type TIconName } from "../ui-icon";
101
+ import type { TIconName } from "../ui-icon";
80
102
  import { ESize } from "../../_types/sizing";
81
103
  import { EColors } from "../../_types/colors";
104
+ import { ERadioSizes } from "./_typings";
105
+ import uiIcon from "../ui-icon";
106
+
82
107
  const props = defineProps<{
83
108
  modelValue: string;
84
109
  name: string;
85
110
  value: string | number;
86
111
  iconName: TIconName;
87
112
  disabled?: boolean;
113
+ radioSize?: ERadioSizes;
88
114
  }>();
89
115
  const emit = defineEmits(["update:modelValue"]);
90
116
  const radioModel = computed({
@@ -4,6 +4,7 @@
4
4
  class="ui-typography"
5
5
  :class="[
6
6
  size === ETypographySizes.MD && 'text-md',
7
+ size === ETypographySizes.XXS && 'text-xxs',
7
8
  size === ETypographySizes.XS && 'text-xs',
8
9
  size === ETypographySizes.SM && 'text-sm',
9
10
  size === ETypographySizes.LG && 'text-lg',