bonkers-ui 1.0.34 → 1.0.36

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.34",
3
+ "version": "1.0.36",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "storybook": "start-storybook -p 6006",
@@ -8,9 +8,9 @@
8
8
  "lint:script": "eslint --fix './src/**/*.{ts,tsx,vue}'",
9
9
  "lint:style": "stylelint --fix './src/**/*.{css,scss,vue}'",
10
10
  "lint:markup": "vue-tsc --noEmit",
11
- "test": "jest",
12
11
  "deploy": "gh-pages -d storybook-static",
13
12
  "typecheck": "tsc --noEmit && vue-tsc --noEmit",
13
+ "test": "vitest run",
14
14
  "i": "yarn install --frozen-lockfile"
15
15
  },
16
16
  "dependencies": {
@@ -18,9 +18,9 @@
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.0-5",
22
- "@vueuse/components": "^9.8.2",
23
- "@vueuse/core": "^9.8.2",
21
+ "@fortawesome/vue-fontawesome": "^3.0.2",
22
+ "@vueuse/components": "^9.10.0",
23
+ "@vueuse/core": "^9.10.0",
24
24
  "vue": "^3.2.45"
25
25
  },
26
26
  "devDependencies": {
@@ -28,55 +28,34 @@
28
28
  "@storybook/addon-essentials": "^6.5.15",
29
29
  "@storybook/addon-links": "^6.5.15",
30
30
  "@storybook/addon-postcss": "^2.0.0",
31
- "@storybook/builder-vite": "^0.2.6",
31
+ "@storybook/builder-vite": "^0.2.7",
32
32
  "@storybook/vue3": "^6.5.15",
33
- "@types/jest": "^29.2.4",
34
- "@typescript-eslint/eslint-plugin": "^5.47.0",
35
- "@typescript-eslint/parser": "^5.47.0",
33
+ "@typescript-eslint/eslint-plugin": "^5.48.1",
34
+ "@typescript-eslint/parser": "^5.48.1",
36
35
  "@vitejs/plugin-vue": "^4.0.0",
37
36
  "@vue/eslint-config-typescript": "^11.0.2",
38
- "@vue/test-utils": "^2.2.6",
39
- "@vue/vue3-jest": "^29.2.2",
40
- "babel-jest": "29.3.1",
41
- "eslint": "8.30.0",
37
+ "@vue/test-utils": "^2.2.7",
38
+ "eslint": "8.31.0",
42
39
  "eslint-plugin-vue": "^9.8.0",
43
40
  "gh-pages": "^4.0.0",
44
41
  "husky": "4.3.8",
45
- "jest": "27.3.1",
42
+ "jsdom": "^21.0.0",
46
43
  "lint-staged": "^13.1.0",
47
- "postcss": "^8.4.20",
44
+ "postcss": "^8.4.21",
48
45
  "postcss-html": "^1.4.1",
49
46
  "storybook-tailwind-dark-mode": "^1.0.15",
50
- "stylelint": "^14.16.0",
47
+ "stylelint": "^14.16.1",
51
48
  "stylelint-config-recommended": "^9.0.0",
52
49
  "stylelint-config-recommended-vue": "^1.4.0",
53
50
  "stylelint-config-standard": "^29.0.0",
54
51
  "tailwindcss": "^3.2.4",
55
- "ts-jest": "^27.0.7",
56
52
  "ts-node": "^10.9.1",
57
53
  "typescript": "^4.9.4",
58
- "vite": "^4.0.2",
54
+ "vite": "^4.0.4",
55
+ "vitest": "^0.27.0",
59
56
  "vue-eslint-parser": "^9.1.0",
60
57
  "vue-loader": "^17.0.1",
61
- "vue-tsc": "^1.0.16"
62
- },
63
- "jest": {
64
- "preset": "ts-jest",
65
- "moduleFileExtensions": [
66
- "vue",
67
- "js",
68
- "jsx",
69
- "ts"
70
- ],
71
- "testEnvironment": "jsdom",
72
- "moduleNameMapper": {
73
- "^@/(.*)$": "<rootDir>/src/$1"
74
- },
75
- "transform": {
76
- ".*\\.(js)$": "babel-jest",
77
- "^.+\\.tsx?$": "ts-jest",
78
- ".*\\.(vue)$": "@vue/vue3-jest"
79
- }
58
+ "vue-tsc": "^1.0.24"
80
59
  },
81
60
  "lint-staged": {
82
61
  "*.{ts,tsx,vue}": [
@@ -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
  }
@@ -1,7 +1,10 @@
1
1
  import { mount } from "@vue/test-utils";
2
2
  import UiButton from "./ui-button.vue";
3
+ import { test, expect } from "vitest";
4
+
5
+ test("VButton.test.ts", async () => {
6
+ expect(UiButton).toBeTruthy();
3
7
 
4
- describe("VButton.test.ts", () => {
5
8
  it("renders props.msg when passed", () => {
6
9
  const className = "message";
7
10
  const wrapper = mount(UiButton, {
@@ -12,4 +15,5 @@ describe("VButton.test.ts", () => {
12
15
 
13
16
  expect(wrapper.classes()).toContain(className);
14
17
  });
18
+
15
19
  });
@@ -5,7 +5,7 @@ export enum EIconType {
5
5
  FAL = "fal",
6
6
  FAD = "fad",
7
7
  FAT = "fat",
8
- BRANDS = "brands",
8
+ BRANDS = "fa-brands",
9
9
  }
10
10
 
11
11
  export type TIconName = [EIconType, string];
@@ -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',
package/tsconfig.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "types": [
4
4
  "vite/client",
5
- "jest"
5
+ "vitest/globals"
6
6
  ],
7
7
  "target": "esnext",
8
8
  "module": "esnext",
@@ -0,0 +1,17 @@
1
+
2
+ import { defineConfig, UserConfig } from "vite";
3
+ import type { InlineConfig } from "vitest";
4
+
5
+ import Vue from "@vitejs/plugin-vue";
6
+
7
+ interface VitestConfigExport extends UserConfig {
8
+ test: InlineConfig;
9
+ }
10
+
11
+ export default defineConfig({
12
+ plugins: [Vue()],
13
+ test: {
14
+ globals: true,
15
+ environment: "jsdom",
16
+ },
17
+ } as VitestConfigExport);