bonkers-ui 1.0.52 → 1.0.54

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": "v1.0.52",
3
+ "version": "v1.0.54",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "storybook": "storybook dev -p 6006",
@@ -16,16 +16,11 @@ export default {
16
16
  options: Object.values(EBadgeSize),
17
17
  description: "The Element size",
18
18
  },
19
- more: {
20
- control: { type: "boolean" },
21
- description: "The Element more",
22
- }
23
19
  },
24
20
  args: {
25
21
  slot: "default text",
26
22
  kind: EBadgeKind.PRIMARY,
27
23
  size: EBadgeSize.SMALL,
28
- more: false,
29
24
  },
30
25
  };
31
26
 
@@ -1,14 +1,11 @@
1
1
  <template>
2
2
  <div
3
- class="ui-badge relative text-white"
4
- :class="[
5
- more && 'mr-sm',
6
- ]"
3
+ class="ui-badge relative text-white overflow-hidden"
7
4
  >
8
5
  <div class="relative z-[1] flex items-center content-center gap-xxs px-xs py-xxs">
9
6
  <ui-icon
10
7
  v-if="icon"
11
- :size="ESize.SM"
8
+ :size="ESize.XS"
12
9
  :icon-name="icon"
13
10
  />
14
11
 
@@ -26,16 +23,6 @@
26
23
  </ui-typography>
27
24
  </div>
28
25
 
29
- <div
30
- v-if="more"
31
- class="absolute top-0 left-[15px] w-full h-full bg-primary-300 rounded-full border border-white"
32
- />
33
-
34
- <div
35
- v-if="more"
36
- class="absolute top-0 left-xs w-full h-full bg-primary-400 rounded-full border border-white"
37
- />
38
-
39
26
  <div
40
27
  class="absolute rounded-full top-0 left-0 w-full h-full"
41
28
  :class="[
@@ -44,7 +31,6 @@
44
31
  kind === EBadgeKind.ERROR && 'bg-error-600',
45
32
  kind === EBadgeKind.ACCENT && 'bg-accent-600',
46
33
  elipsis && 'max-w-full',
47
- more && 'border border-white',
48
34
  ]"
49
35
  />
50
36
  </div>
@@ -62,7 +48,6 @@
62
48
  kind?: EBadgeKind;
63
49
  icon?: TIconName;
64
50
  elipsis?: boolean;
65
- more?: boolean;
66
51
  }>();
67
52
 
68
53
  const slots = useSlots();
@@ -28,8 +28,8 @@
28
28
  <ui-icon
29
29
  v-if="iconName"
30
30
  :icon-name="iconName"
31
- :size="ESize.MD"
32
- class="text-secondary-700"
31
+ :size="ESize.SM"
32
+ class="text-secondary-400"
33
33
  />
34
34
  </ui-icon-wrapper>
35
35
  </slot>
@@ -39,8 +39,7 @@
39
39
  :class="invertOrder && 'order-first'"
40
40
  >
41
41
  <ui-typography
42
- :kind="EColors.SECONDARY"
43
- :weight="ETextWeight.SEMI_BOLD"
42
+ :kind="EColors.SECONDARY_400"
44
43
  class="mb-xxs"
45
44
  line-height
46
45
  >
@@ -63,7 +62,7 @@
63
62
  import UiTypography from "../ui-typography";
64
63
  import UiIcon from "../ui-icon";
65
64
  import UiIconWrapper from "../ui-icon-wrapper";
66
- import { ETypographySizes, ETextWeight } from "../ui-typography";
65
+ import { ETypographySizes } from "../ui-typography";
67
66
  import { EColors } from "../../_types/colors";
68
67
  import type { TIconName } from "../ui-icon";
69
68
  import { ESize } from "../../_types/sizing";
@@ -60,6 +60,29 @@ const Template: Story<TComponentProps> = (args) => ({
60
60
  </template>
61
61
 
62
62
  <template #default>
63
+
64
+ <div
65
+ class="flex gap-xs items-center mb-xs"
66
+ >
67
+ <ui-icon
68
+ class="text-primary"
69
+ :size="ESize.SM"
70
+ :icon-name="['far', 'face-smile']"
71
+ />
72
+
73
+ <ui-icon
74
+ class="text-primary"
75
+ :size="ESize.SM"
76
+ :icon-name="['far', 'face-smile']"
77
+ />
78
+
79
+ <ui-icon
80
+ class="text-secondary-alt-300"
81
+ :size="ESize.SM"
82
+ :icon-name="['far', 'face-smile']"
83
+ />
84
+ </div>
85
+
63
86
  <div class="flex flex-wrap gap-xs mb-sm">
64
87
  <ui-badge
65
88
  v-for="item in ['Free bank tranfers']"
@@ -75,29 +98,6 @@ const Template: Story<TComponentProps> = (args) => ({
75
98
  >
76
99
  more...
77
100
  </ui-badge>
78
-
79
- <div
80
- class="flex gap-xs items-center justify-center"
81
- :style="{marginLeft: 'auto'}"
82
- >
83
- <ui-icon
84
- class="text-primary"
85
- :size="ESize.SM"
86
- :icon-name="['far', 'face-smile']"
87
- />
88
-
89
- <ui-icon
90
- class="text-primary"
91
- :size="ESize.SM"
92
- :icon-name="['far', 'face-smile']"
93
- />
94
-
95
- <ui-icon
96
- class="text-secondary-alt-300"
97
- :size="ESize.SM"
98
- :icon-name="['far', 'face-smile']"
99
- />
100
- </div>
101
101
  </div>
102
102
 
103
103
  <ul>
@@ -118,12 +118,13 @@ const Template: Story<TComponentProps> = (args) => ({
118
118
  </ui-list-item>
119
119
  </ul>
120
120
 
121
- <ui-typography class="mb-sm" underline :size="ETypographySizes.SM" :kind="EColors.SECONDARY">
122
- Some link
123
- </ui-typography>
121
+ <div :style="{display: 'grid', gridTemplateColumns: '1fr 1fr'}" class="items-center gap-sm mb-sm">
122
+ <ui-typography underline :size="ETypographySizes.SM" :kind="EColors.ACCENT">
123
+ Full Details
124
+ </ui-typography>
124
125
 
125
- <div :style="{display: 'grid', gridTemplateColumns: '1fr 1fr'}" class="items-center gap-sm">
126
126
  <ui-typography
127
+ class="text-right"
127
128
  :weight="ETextWeight.BOLD"
128
129
  :size="ETypographySizes.XL"
129
130
  :kind="EColors.SECONDARY"
@@ -136,9 +137,8 @@ const Template: Story<TComponentProps> = (args) => ({
136
137
  Monthly fee
137
138
  </ui-typography>
138
139
  </ui-typography>
139
-
140
- <ui-button full-width>Some text</ui-button>
141
140
  </div>
141
+ <ui-button full-width>Some text</ui-button>
142
142
  </template>
143
143
  </ui-card-result>
144
144
 
@@ -9,5 +9,6 @@ export enum EInputType {
9
9
  NUMBER = "number",
10
10
  TEL = "tel",
11
11
  PASSWORD = "password",
12
- EMAIL = "email"
12
+ EMAIL = "email",
13
+ DATE = "date",
13
14
  }
@@ -22,7 +22,7 @@
22
22
  <slot name="prefix-icon" />
23
23
 
24
24
  <input
25
- :autocomplete="autocomplete"
25
+ :autocomplete="getAutoComplete()"
26
26
  :value="modelValue"
27
27
  :pattern="pattern"
28
28
  class="bg-transparent border-0 outline-none w-full placeholder:text-secondary-alt placeholder:italic"
@@ -55,7 +55,7 @@
55
55
  import { EInputKinds, EInputType } from "./_typings";
56
56
  import UiTypography, { ETypographySizes, EColors } from "../ui-typography";
57
57
 
58
- withDefaults(defineProps<{
58
+ const props = withDefaults(defineProps<{
59
59
  placeholder?: string;
60
60
  modelValue: string | number;
61
61
  disabled?: boolean;
@@ -71,7 +71,7 @@
71
71
  }>(), {
72
72
  modelValue: "",
73
73
  placeholder: "",
74
- autocomplete: "off",
74
+ autocomplete: "",
75
75
  heading: undefined,
76
76
  subLabel: undefined,
77
77
  pattern: undefined,
@@ -84,4 +84,13 @@
84
84
 
85
85
  defineEmits(["update:modelValue"]);
86
86
 
87
+ const getAutoComplete =()=> {
88
+ if(props.autocomplete !== "") return props.autocomplete;
89
+ switch(props.type) {
90
+ case EInputType.PASSWORD: return "current-password";
91
+ case EInputType.EMAIL: return "email";
92
+ default: return "off";
93
+ }
94
+ };
95
+
87
96
  </script>
@@ -35,8 +35,10 @@ const Template: Story<TComponentProps> = (args) => ({
35
35
 
36
36
  return { args, modelValue };
37
37
  },
38
- template: `
39
- <ui-input-range v-bind="args" v-model:modelValue="modelValue"/>
38
+ template: /*html*/`
39
+ <div :style="{border: '1px solid'}">
40
+ <ui-input-range v-bind="args" v-model:modelValue="modelValue"/>
41
+ </div>
40
42
  <div>{{ modelValue }}</div>
41
43
  `,
42
44
  });
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="ui-input-range relative h-lg mx-xs py-xs box-content"
3
+ class="ui-input-range relative h-lg py-xs box-content"
4
4
  >
5
5
  <input
6
6
  ref="track"
@@ -12,11 +12,13 @@
12
12
  :step="step"
13
13
  @touchmove="moveHandler"
14
14
  >
15
+
15
16
  <div
16
- class="ui-input-range__line h-xs w-full bg-secondary-alt rounded absolute left-0 -z-10 -translate-y-1/2"
17
+ class="h-xs w-full bg-secondary-alt rounded absolute top-1/2 left-0 -translate-y-1/2 pointer-events-none"
17
18
  />
19
+
18
20
  <div
19
- class="ui-input-range__line h-xs bg-primary rounded absolute left-0 -z-10 -translate-y-1/2"
21
+ class="h-xs bg-primary rounded absolute top-1/2 left-0 -translate-y-1/2 pointer-events-none"
20
22
  :style="{
21
23
  width: getPercentage + '%',
22
24
  }"
@@ -42,7 +44,7 @@
42
44
  </template>
43
45
 
44
46
  <script lang="ts" setup>
45
- import { computed, ref } from "vue";
47
+ import { computed, ref, watch } from "vue";
46
48
 
47
49
  const props = defineProps<{
48
50
  modelValue: number;
@@ -64,6 +66,14 @@
64
66
  }
65
67
  });
66
68
 
69
+ watch(()=>[props.min, props.max], () => {
70
+ if(rangeModel.value < +props.min){
71
+ rangeModel.value = +props.min;
72
+ }else if(rangeModel.value > +props.max){
73
+ rangeModel.value = +props.max;
74
+ }
75
+ });
76
+
67
77
  const track = ref();
68
78
 
69
79
  const getPercentage = computed(() => {
@@ -93,7 +103,11 @@
93
103
  };
94
104
 
95
105
  const moveHandler = (e: MouseEvent | TouchEvent) => {
96
- rangeModel.value = parseMouseMove(e) || 0;
106
+ const newValue = parseMouseMove(e);
107
+
108
+ if(newValue){
109
+ rangeModel.value = newValue;
110
+ }
97
111
  };
98
112
 
99
113
  </script>
@@ -116,10 +130,6 @@
116
130
  box-shadow: none;
117
131
  }
118
132
 
119
- .ui-input-range__line {
120
- top: 50%;
121
- }
122
-
123
133
  .ui-input-range__thumb {
124
134
  top: 50%;
125
135
  border-width: 12px;
@@ -86,7 +86,6 @@
86
86
  <ui-typography
87
87
  :size="ETypographySizes.SM"
88
88
  :kind="EColors.SECONDARY"
89
- :weight="ETextWeight.SEMI_BOLD"
90
89
  class="pt-xxs"
91
90
  >
92
91
  <slot />
@@ -14,7 +14,7 @@
14
14
  >
15
15
  <ui-icon
16
16
  v-if="iconName"
17
- class="rounded-full mb-md"
17
+ class="mb-md"
18
18
  :size="ESize.MD"
19
19
  :icon-name="iconName"
20
20
  />
@@ -42,7 +42,7 @@
42
42
  import UiTypography, { ETypographySizes, EColors } from "../ui-typography";
43
43
 
44
44
  const props = defineProps<{
45
- modelValue: string;
45
+ modelValue: string | number;
46
46
  heading?: string;
47
47
  subLabel?: string;
48
48
  disabled?: boolean;
@@ -0,0 +1,5 @@
1
+ export enum ETableKind {
2
+ DEFAULT = "default",
3
+ SECONDARY = "secondary",
4
+ SECONDARY_INVERTED = "secondary-inverted",
5
+ }
@@ -1,18 +1,20 @@
1
- import UiTableRow, { ERowKind } from "./ui-table-row";
1
+ import UiTableRow from "./ui-table-row";
2
2
  import UiTableCell from "./ui-table-cell";
3
3
  import UiTypography, { ETextWeight, ETypographySizes } from "../ui-typography";
4
+ import UiTable from "./ui-table.vue";
5
+ import { ETableKind } from "./_types";
4
6
 
5
7
  export default {
6
8
  title: "Components/ui-table",
7
9
  argTypes: {
8
10
  kind: {
9
11
  control: { type: "select" },
10
- options: ["empty"].concat(Object.values(ERowKind)),
12
+ options: Object.values(ETableKind),
11
13
  description: "The row kind",
12
14
  },
13
15
  },
14
16
  args: {
15
- kind: ERowKind.SECONDARY,
17
+ kind: ETableKind.DEFAULT,
16
18
  },
17
19
  };
18
20
 
@@ -23,7 +25,8 @@ const Template = (args: MyComponentProps) => ({
23
25
  // UiTable,
24
26
  UiTableRow,
25
27
  UiTableCell,
26
- UiTypography
28
+ UiTypography,
29
+ UiTable
27
30
  },
28
31
  setup(){
29
32
 
@@ -48,18 +51,16 @@ const Template = (args: MyComponentProps) => ({
48
51
  return{
49
52
  ETextWeight,
50
53
  ETypographySizes,
51
- ERowKind,
52
54
  args,
53
55
  list
54
56
  };
55
57
  },
56
58
  template:
57
59
  /*html*/`
58
- <table class='w-full'>
60
+ <ui-table class='w-full' :kind="args.kind">
59
61
  <ui-table-row v-for="(row, index) in list"
60
62
  :key="index"
61
- rounded
62
- :kind="index % 2 === 0 && args.kind">
63
+ rounded>
63
64
  <ui-table-cell :weight='ETextWeight.SEMI_BOLD'>
64
65
  {{row.text1}}
65
66
  </ui-table-cell>
@@ -76,7 +77,7 @@ const Template = (args: MyComponentProps) => ({
76
77
  </template>
77
78
  </ui-table-cell>
78
79
  </ui-table-row>
79
- </table>
80
+ </ui-table>
80
81
  `
81
82
  });
82
83
 
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <table
3
+ :class="[
4
+ 'ui-table',
5
+ kind === ETableKind.SECONDARY && 'ui-table__secondary',
6
+ kind === ETableKind.SECONDARY_INVERTED && 'ui-table__secondary-inverted',
7
+ ]"
8
+ >
9
+ <slot />
10
+ </table>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import { ETableKind } from "./_types";
15
+
16
+ withDefaults(defineProps<{
17
+ kind?: ETableKind;
18
+ }>(), {
19
+ kind: ETableKind.SECONDARY_INVERTED,
20
+ });
21
+ </script>
22
+
23
+ <style scoped>
24
+ .ui-table__secondary::v-deep tr:nth-child(odd){
25
+ background-color: var(--color-secondary-alt-200);
26
+ border-radius: var(--xs);
27
+ }
28
+
29
+ .ui-table__secondary-inverted::v-deep tr:nth-child(even){
30
+ background-color: var(--color-secondary-alt-200);
31
+ border-radius: var(--xs);
32
+ }
33
+ </style>
@@ -4,7 +4,6 @@
4
4
  >
5
5
  <slot name="header">
6
6
  <ui-typography
7
- :weight="ETextWeight.BOLD"
8
7
  line-height
9
8
  class="mb-sm"
10
9
  >