bonkers-ui 1.0.8 → 1.0.11

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.8",
3
+ "version": "1.0.11",
4
4
  "scripts": {
5
5
  "storybook": "start-storybook -p 6006",
6
6
  "build-storybook": "build-storybook",
@@ -13,48 +13,48 @@
13
13
  "i": "yarn install --frozen-lockfile"
14
14
  },
15
15
  "dependencies": {
16
- "@fortawesome/fontawesome-svg-core": "^6.1.1",
17
- "@fortawesome/free-brands-svg-icons": "^6.1.1",
18
- "@fortawesome/free-regular-svg-icons": "^6.1.1",
19
- "@fortawesome/free-solid-svg-icons": "^6.1.1",
16
+ "@fortawesome/fontawesome-svg-core": "^6.2.0",
17
+ "@fortawesome/free-brands-svg-icons": "^6.2.0",
18
+ "@fortawesome/free-regular-svg-icons": "^6.2.0",
19
+ "@fortawesome/free-solid-svg-icons": "^6.2.0",
20
20
  "@fortawesome/vue-fontawesome": "^3.0.1",
21
- "vue": "^3.2.37"
21
+ "vue": "^3.2.38"
22
22
  },
23
23
  "devDependencies": {
24
- "@storybook/addon-actions": "^6.5.9",
25
- "@storybook/addon-essentials": "^6.5.9",
26
- "@storybook/addon-links": "^6.5.9",
24
+ "@storybook/addon-actions": "^6.5.10",
25
+ "@storybook/addon-essentials": "^6.5.10",
26
+ "@storybook/addon-links": "^6.5.10",
27
27
  "@storybook/addon-postcss": "^2.0.0",
28
- "@storybook/builder-vite": "^0.1.36",
29
- "@storybook/vue3": "^6.5.9",
28
+ "@storybook/builder-vite": "^0.2.2",
29
+ "@storybook/vue3": "^6.5.10",
30
30
  "@types/jest": "^28.1.3",
31
- "@typescript-eslint/eslint-plugin": "^5.29.0",
32
- "@typescript-eslint/parser": "^5.29.0",
33
- "@vitejs/plugin-vue": "^2.3.3",
31
+ "@typescript-eslint/eslint-plugin": "^5.36.1",
32
+ "@typescript-eslint/parser": "^5.36.1",
33
+ "@vitejs/plugin-vue": "^3.0.3",
34
34
  "@vue/eslint-config-typescript": "^11.0.0",
35
35
  "@vue/test-utils": "^2.0.0",
36
36
  "@vue/vue3-jest": "^27.0.0",
37
37
  "babel-jest": "27",
38
- "eslint": "^8.18.0",
39
- "eslint-plugin-vue": "^9.1.1",
38
+ "eslint": "^8.23.0",
39
+ "eslint-plugin-vue": "^9.4.0",
40
40
  "gh-pages": "^4.0.0",
41
41
  "husky": "^8.0.1",
42
42
  "jest": "27.3.1",
43
43
  "lint-staged": "^13.0.2",
44
- "postcss": "^8.4.14",
44
+ "postcss": "^8.4.16",
45
45
  "postcss-html": "^1.4.1",
46
- "storybook-tailwind-dark-mode": "^1.0.12",
47
- "stylelint": "^14.9.1",
48
- "stylelint-config-recommended": "^8.0.0",
46
+ "storybook-tailwind-dark-mode": "^1.0.13",
47
+ "stylelint": "^14.11.0",
48
+ "stylelint-config-recommended": "^9.0.0",
49
49
  "stylelint-config-recommended-vue": "^1.4.0",
50
- "stylelint-config-standard": "^26.0.0",
51
- "tailwindcss": "^3.1.4",
50
+ "stylelint-config-standard": "^28.0.0",
51
+ "tailwindcss": "^3.1.8",
52
52
  "ts-jest": "^27.0.7",
53
- "typescript": "^4.7.4",
54
- "vite": "^2.9.12",
53
+ "typescript": "^4.8.2",
54
+ "vite": "^3.0.9",
55
55
  "vue-eslint-parser": "^9.0.3",
56
56
  "vue-loader": "^17.0.0",
57
- "vue-tsc": "^0.39.0"
57
+ "vue-tsc": "^0.40.5"
58
58
  },
59
59
  "jest": {
60
60
  "preset": "ts-jest",
@@ -0,0 +1,6 @@
1
+ export enum EAlertTypes {
2
+ PRIMARY = "PRIMARY",
3
+ SECONDARY = "SECONDARY",
4
+ ERROR = "ERROR",
5
+ WARNING = "WARNING",
6
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from "./ui-alert.vue";
2
+ export { EAlertTypes } from "./_types";
@@ -0,0 +1,38 @@
1
+ import UiAlert from "./ui-alert.vue";
2
+ import type { Story } from "@storybook/vue3";
3
+ import { EAlertTypes } from "./_types";
4
+
5
+ export default {
6
+ title: "Components/ui-alert",
7
+ component: UiAlert,
8
+ argTypes: {
9
+ kind: {
10
+ control: { type: "select" },
11
+ options: Object.values(EAlertTypes),
12
+ description: "The button kinds",
13
+ },
14
+ },
15
+ args: {
16
+ slot: "some description text: lorem",
17
+ kind: EAlertTypes.WARNING
18
+ }
19
+ };
20
+
21
+ type TComponentProps = InstanceType<typeof UiAlert>["$props"];
22
+
23
+ const Template: Story<TComponentProps> = (args) => ({
24
+ components: { UiAlert },
25
+ setup() {
26
+ return { args };
27
+ },
28
+ template: `
29
+ <ui-alert
30
+ :kind="args.kind"
31
+ :icon="['far', 'face-smile']"
32
+ >
33
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
34
+ </ui-alert>
35
+ `
36
+ });
37
+
38
+ export const Default = Template.bind({});
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <div
3
+ class="ui-alert flex gap-sm p-sm border rounded-lg"
4
+ :class="[
5
+ (!kind || kind === EAlertTypes.PRIMARY) && 'border-primary',
6
+ kind === EAlertTypes.WARNING && 'border-warning',
7
+ kind === EAlertTypes.ERROR && 'border-error',
8
+ kind === EAlertTypes.SECONDARY && 'border-secondary',
9
+ ]"
10
+ >
11
+ <ui-icon
12
+ :icon-name="icon"
13
+ :size="ESize.SM"
14
+ :class="[
15
+ (!kind || kind === EAlertTypes.PRIMARY) && 'text-primary',
16
+ kind === EAlertTypes.WARNING && 'text-warning',
17
+ kind === EAlertTypes.ERROR && 'text-error',
18
+ kind === EAlertTypes.SECONDARY && 'text-secondary',
19
+ ]"
20
+ />
21
+ <ui-typography
22
+ :size="ETypographySizes.XS"
23
+ line-height
24
+ >
25
+ <slot />
26
+ </ui-typography>
27
+ </div>
28
+ </template>
29
+
30
+ <script lang="ts" setup>
31
+ import UiTypography, { ETypographySizes } from "../ui-typography";
32
+ import UiIcon, { type TIconName } from "../ui-icon";
33
+ import { ESize } from "../../_types/sizing";
34
+ import { EAlertTypes } from "./_types";
35
+
36
+ defineProps<{
37
+ icon: TIconName
38
+ kind?: EAlertTypes
39
+ }>();
40
+ </script>
@@ -32,7 +32,7 @@ const Template: Story<TComponentProps> = (args) => ({
32
32
  return { args };
33
33
  },
34
34
  template: `
35
- <ui-badge :icon="['far', 'face-smile']" v-bind="args">
35
+ <ui-badge :icon="['far', 'face-smile']" v-bind="args" class="inline-flex">
36
36
  {{ args.slot }}
37
37
  </ui-badge>
38
38
  `,
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <span
3
- class="ui-badge rounded-full inline-flex items-center"
2
+ <div
3
+ class="ui-badge rounded-full flex items-center content-center gap-xxs"
4
4
  :class="[
5
5
  (!size || size === EBadgeSize.SMALL) && 'px-xs py-xxs',
6
6
  (!kind || kind === EBadgeKind.PRIMARY) && 'bg-primary-alt-300 text-primary-alt-700',
@@ -14,24 +14,23 @@
14
14
  >
15
15
  <ui-icon
16
16
  v-if="icon"
17
- class="mr-xxs"
18
17
  :size="ESize.SM"
19
18
  :icon-name="icon"
20
19
  />
21
20
 
22
21
  <ui-typography
23
- is="span"
22
+ v-if="slots.default"
24
23
  :size="getBadgeSize"
25
24
  :weight="ETextWeight.SEMI_BOLD"
26
25
  class="whitespace-nowrap"
27
26
  >
28
27
  <slot />
29
28
  </ui-typography>
30
- </span>
29
+ </div>
31
30
  </template>
32
31
 
33
32
  <script lang="ts" setup>
34
- import { computed } from "vue";
33
+ import { computed, useSlots } from "vue";
35
34
  import { EBadgeKind, EBadgeSize } from "./_typings";
36
35
  import UiIcon, { type TIconName } from "../ui-icon";
37
36
  import { ESize } from "../../_types/sizing";
@@ -43,6 +42,8 @@
43
42
  icon?: TIconName;
44
43
  }>();
45
44
 
45
+ const slots = useSlots();
46
+
46
47
  const getBadgeSize = computed(()=>{
47
48
  switch (props.size) {
48
49
  case EBadgeSize.MEDIUM:
@@ -10,6 +10,7 @@ export enum EButtonTypes {
10
10
  LINK = "link",
11
11
  }
12
12
  export enum EButtonSizes {
13
+ DEFAULT = "default",
13
14
  SMALL = "sm",
14
15
  MEDIUM = "md",
15
16
  LARGE = "lg"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <button
3
- class="ui-button justify-center grid text-base rounded-lg whitespace-nowrap font-bold leading-none touch-manipulation"
3
+ class="ui-button justify-center grid text-base rounded-lg whitespace-nowrap font-bold leading-none touch-manipulation items-center"
4
4
  :disabled="disabled"
5
5
  :class="[
6
6
  (!kind || kind === EButtonTypes.PRIMARY) && [primaryColor, primaryColorHover, primaryColorActive].join(' '),
@@ -16,8 +16,9 @@
16
16
  kind === EButtonTypes.ERROR_OVERLAY
17
17
  && 'text-error border border-error hover:bg-error-600 hover:border-transparent hover:text-white active:bg-error-700 active:border-transparent active:text-white disabled:text-error-300 disabled:border-error-300',
18
18
  kind === EButtonTypes.LINK && 'text-accent-alt hover:text-accent-alt-600 active:text-accent-alt-700 disabled:text-accent-alt-300',
19
- (!size || size === EButtonSizes.MEDIUM) && 'py-sm px-md',
19
+ (!size || size === EButtonSizes.DEFAULT) && 'py-sm px-md',
20
20
  size === EButtonSizes.SMALL && 'py-xs px-md',
21
+ size === EButtonSizes.MEDIUM && 'py-sm px-sm',
21
22
  size === EButtonSizes.LARGE && 'py-md px-md',
22
23
  fullWidth && 'w-full',
23
24
  disabled && 'pointer-events-none',
@@ -68,9 +68,8 @@ const Template: Story<TComponentProps> = (args) => ({
68
68
  class="mb-xs"
69
69
  :key="item"
70
70
  :icon="['far', 'face-smile']"
71
- >
72
- Feature item {{ item }}
73
- </ui-list-item>
71
+ :title="'Feature item ' + item"
72
+ />
74
73
  </ul>
75
74
 
76
75
  <ui-typography
@@ -49,7 +49,7 @@ const Template: Story<TComponentProps> = (args) => ({
49
49
  },
50
50
  // And then the `args` are bound to your component with `v-bind="args"`
51
51
  template: `
52
- <ui-checkbox v-bind="args" v-model:modelValue="args.modelValue">
52
+ <ui-checkbox v-bind="args" v-model="modelValue">
53
53
  ${args.slot}
54
54
  </ui-checkbox>
55
55
  `,
@@ -13,11 +13,11 @@
13
13
  ]"
14
14
  >
15
15
  <input
16
- :checked="modelValue"
16
+ v-model="checkboxModel"
17
17
  class="appearance-none absolute"
18
18
  type="checkbox"
19
+ :value="value"
19
20
  :disabled="disabled"
20
- @input="$emit('update:modelValue', !!($event.target as HTMLInputElement)?.value)"
21
21
  >
22
22
  <span
23
23
  class="ui-checkbox_custom w-md h-md flex items-center justify-center border border-secondary-alt-500 rounded relative hover:border-secondary-alt-700"
@@ -50,21 +50,32 @@
50
50
  </template>
51
51
 
52
52
  <script lang="ts" setup>
53
- import { useSlots } from "vue";
53
+ import { useSlots, computed } from "vue";
54
54
  import { EJustify } from "../../_types/align";
55
55
 
56
56
  const slots = useSlots();
57
57
 
58
- defineProps<{
59
- modelValue: boolean;
58
+ const props = defineProps<{
59
+ modelValue: boolean | unknown[];
60
60
  justify?: EJustify;
61
61
  invertOrder?: boolean;
62
62
  disabled?: boolean;
63
+ value?: string;
63
64
  }>();
64
65
 
65
- defineEmits<{
66
- (e: "update:modelValue", state: boolean): void
66
+ const emit = defineEmits<{
67
+ (e: "update:modelValue", state: unknown): void
67
68
  }>();
69
+
70
+ const checkboxModel = computed({
71
+ get() {
72
+ return props.modelValue;
73
+ },
74
+ set(value) {
75
+ emit("update:modelValue", value);
76
+ }
77
+ });
78
+
68
79
  </script>
69
80
 
70
81
  <style scoped>
@@ -18,10 +18,6 @@ export default {
18
18
  options: Object.values(EInputTypes),
19
19
  description: "The input kinds",
20
20
  },
21
- fullWidth: {
22
- control: { type: "boolean" },
23
- description: "The full width size",
24
- },
25
21
  disabled: {
26
22
  control: { type: "boolean" },
27
23
  description: "The Element disabled state",
@@ -29,7 +25,6 @@ export default {
29
25
  },
30
26
  args: {
31
27
  placeholder: "Placeholder",
32
- fullWidth: false,
33
28
  kind: undefined,
34
29
  disabled: false,
35
30
  }
@@ -8,30 +8,26 @@
8
8
  {{ heading }}
9
9
  </ui-typography>
10
10
  <div
11
- class="ui-input__wrapper grid rounded-lg border bg-white max-w-xs items-center p-sm gap-xs"
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',
14
14
  kind === EInputTypes.PRIMARY && 'border-primary',
15
15
  kind === EInputTypes.ERROR && 'border-error',
16
16
 
17
17
  disabled && 'border-secondary-alt-300 bg-secondary-alt-200',
18
-
19
- fullWidth && 'max-w-full',
20
18
  ]"
21
19
  >
22
- <div class="icon-wrapper">
23
- <slot name="prefix-icon" />
24
- </div>
20
+ <slot name="prefix-icon" />
21
+
25
22
  <input
26
- class="bg-transparent border-0 outline-none"
23
+ class="bg-transparent border-0 outline-none w-full"
27
24
  type="text"
28
25
  :placeholder="placeholder"
29
26
  :value="modelValue"
30
27
  @input="$emit('update:modelValue', ($event.target as HTMLTextAreaElement)?.value)"
31
28
  >
32
- <div class="icon-wrapper">
33
- <slot name="postfix-icon" />
34
- </div>
29
+
30
+ <slot name="postfix-icon" />
35
31
  </div>
36
32
  <ui-typography
37
33
  v-if="subLabel"
@@ -51,7 +47,6 @@
51
47
  placeholder?: string;
52
48
  modelValue: string;
53
49
  disabled?: boolean;
54
- fullWidth?: boolean;
55
50
  kind?: EInputTypes;
56
51
  heading?: string;
57
52
  subLabel?: string;
@@ -61,10 +56,6 @@
61
56
  </script>
62
57
 
63
58
  <style scoped>
64
- .ui-input__wrapper {
65
- grid-template-columns: auto 1fr auto;
66
- }
67
-
68
59
  .ui-input__wrapper input::placeholder {
69
60
  color: var(--color-secondary-alt-500);
70
61
  font-style: italic;
@@ -1,33 +1,37 @@
1
- import UiIconList from "./ui-list-item.vue";
1
+ import UiListItem from "./ui-list-item.vue";
2
2
  import type { Story } from "@storybook/vue3";
3
3
 
4
4
  export default {
5
5
  title: "Components/ui-list-item",
6
- component: UiIconList,
7
- argTypes: {},
6
+ component: UiListItem,
7
+ argTypes: {
8
+ description: {
9
+ control: { type: "text" },
10
+ title: "The Element title",
11
+ }
12
+ },
8
13
  args: {
9
- slot: "default text",
14
+ slot: "some description text: lorem",
15
+ title: "default text",
10
16
  }
11
17
  };
12
18
 
13
- type TComponentProps = InstanceType<typeof UiIconList>["$props"];
19
+ type TComponentProps = InstanceType<typeof UiListItem>["$props"];
14
20
 
15
21
  const Template: Story<TComponentProps> = (args) => ({
16
- components: { UiIconList },
22
+ components: { UiListItem },
17
23
  setup() {
18
24
  return { args };
19
25
  },
20
26
  template: `
21
- <ul>
22
- <ui-icon-list :icon="['far', 'face-smile']">
23
- {{args.slot}}
24
- </ui-icon-list>
25
- <ui-icon-list :icon="['far', 'face-smile']">
26
- {{args.slot}}
27
- </ui-icon-list>
28
- <ui-icon-list :icon="['far', 'face-smile']">
27
+ <ul class="grid gap-sm">
28
+ <ui-list-item :icon="['far', 'face-smile']" :title="args.title">
29
+ </ui-list-item>
30
+ <ui-list-item :icon="['far', 'face-smile']" :title="args.title">
29
31
  {{args.slot}}
30
- </ui-icon-list>
32
+ </ui-list-item>
33
+ <ui-list-item :icon="['far', 'face-smile']" :title="args.title">
34
+ </ui-list-item>
31
35
  </ul>
32
36
  `
33
37
  });
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <li class="ui-icon-list">
2
+ <li class="ui-icon-list flex">
3
3
  <ui-icon
4
4
  v-if="icon"
5
5
  class="mr-xs"
@@ -7,23 +7,30 @@
7
7
  :icon-name="icon"
8
8
  />
9
9
 
10
- <ui-typography
11
- is="span"
12
- :weight="ETextWeight.SEMI_BOLD"
13
- :size="ETypographySizes.SM"
14
- >
15
- <slot />
16
- </ui-typography>
10
+ <div>
11
+ <ui-typography
12
+ :weight="ETextWeight.SEMI_BOLD"
13
+ >
14
+ {{ title }}
15
+ </ui-typography>
16
+ <p
17
+ v-if="$slots.default"
18
+ class="mt-xs"
19
+ >
20
+ <slot />
21
+ </p>
22
+ </div>
17
23
  </li>
18
24
  </template>
19
25
 
20
26
  <script lang="ts" setup>
21
27
  import UiIcon, { type TIconName } from "../ui-icon";
22
28
  import { ESize } from "../../_types/sizing";
23
- import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
29
+ import UiTypography, { ETextWeight } from "../ui-typography";
24
30
 
25
31
  defineProps<{
26
32
  icon?: TIconName;
33
+ title?: string;
27
34
  }>();
28
35
 
29
36
  </script>
@@ -10,6 +10,10 @@ export default {
10
10
  control: { type: "boolean" },
11
11
  description: "The Element disabled state",
12
12
  },
13
+ alignCenter: {
14
+ control: { type: "boolean" },
15
+ description: "The Elements center align state",
16
+ },
13
17
  invertOrder: {
14
18
  control: { type: "boolean" },
15
19
  description: "The Element order state",
@@ -19,6 +23,7 @@ export default {
19
23
  slot: "default text",
20
24
  disabled: false,
21
25
  invertOrder: false,
26
+ alignCenter: false,
22
27
  },
23
28
  };
24
29
 
@@ -32,7 +37,7 @@ const Template: Story<TComponentProps> = (args) => ({
32
37
  return { args, modelValue };
33
38
  },
34
39
  template: `
35
- <ui-toggle v-bind="args" v-model:model-value="modelValue" header="Header" :title="args.slot" />
40
+ <ui-toggle v-bind="args" v-model="modelValue" header="Header" :title="args.slot" />
36
41
  `,
37
42
  });
38
43
 
@@ -14,14 +14,17 @@
14
14
  :class="[
15
15
  disabled && 'pointer-events-none ui-toggle_disabled',
16
16
  invertOrder && 'flex-row-reverse',
17
+ alignCenter && 'items-center'
17
18
  ]"
18
19
  >
19
- <span class="ui-input__input-wrapper block relative h-md">
20
+ <span
21
+ class="ui-input__input-wrapper block relative h-md"
22
+ >
20
23
  <input
24
+ v-model="checkboxModel"
21
25
  type="checkbox"
22
26
  class="appearance-none absolute w-0 h-0 border-0"
23
- :checked="modelValue"
24
- @input="$emit('update:modelValue', !!($event.target as HTMLInputElement)?.value)"
27
+ :value="value"
25
28
  >
26
29
 
27
30
  <span class="ui-toggle__bg-block w-lg h-md bg-secondary-alt block rounded-full" />
@@ -57,18 +60,30 @@
57
60
 
58
61
  <script lang="ts" setup>
59
62
  import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
63
+ import { computed } from "vue";
60
64
 
61
- defineProps<{
65
+ const props = defineProps<{
62
66
  header?: string;
63
67
  title?: string;
64
- modelValue: boolean;
68
+ modelValue: boolean | unknown[];
65
69
  disabled?: boolean;
66
70
  invertOrder?: boolean;
71
+ alignCenter?: boolean;
72
+ value?: string;
67
73
  }>();
68
74
 
69
- defineEmits<{
70
- (e: "update:modelValue", state: boolean): void
75
+ const emit = defineEmits<{
76
+ (e: "update:modelValue", state: unknown): void
71
77
  }>();
78
+
79
+ const checkboxModel = computed({
80
+ get() {
81
+ return props.modelValue;
82
+ },
83
+ set(value) {
84
+ emit("update:modelValue", value);
85
+ }
86
+ });
72
87
  </script>
73
88
 
74
89
  <style scoped>