@appscode/design-system 2.2.27 → 2.2.28

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": "@appscode/design-system",
3
- "version": "2.2.27",
3
+ "version": "2.2.28",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -0,0 +1,40 @@
1
+ <script setup lang="ts">
2
+ interface Props {
3
+ options: Array<{
4
+ value: unknown;
5
+ label: string;
6
+ }>;
7
+ name?: string;
8
+ modifierClasses?: string;
9
+ errorMsg?: string;
10
+ }
11
+
12
+ withDefaults(defineProps<Props>(), {
13
+ modifierClasses: "",
14
+ name: "checkbox",
15
+ errorMsg: "",
16
+ });
17
+
18
+ const model = defineModel({ type: Array });
19
+ </script>
20
+
21
+ <template>
22
+ <div v-for="option in options" :key="name + option.label" class="field">
23
+ <input
24
+ class="is-checkradio has-background-color"
25
+ :class="modifierClasses"
26
+ :id="name + option.label"
27
+ :value="option.value"
28
+ type="checkbox"
29
+ v-model="model"
30
+ />
31
+ <label :for="name + option.label">{{ option.label }}</label>
32
+ </div>
33
+ <p v-show="errorMsg" class="is-danger">
34
+ {{ errorMsg }}
35
+ </p>
36
+ </template>
37
+
38
+ <style lang="scss">
39
+ @import "../../../vue-components/styles/components/form-fields/_check-radio-switch.scss";
40
+ </style>
@@ -1,33 +1,42 @@
1
1
  <script setup lang="ts">
2
2
  interface Props {
3
- modifierClasses?: string;
3
+ options: Array<{
4
+ value: unknown;
5
+ label: string;
6
+ }>;
4
7
  name: string;
5
- label?: string;
6
- type?: string;
7
- check?: boolean;
8
+ modifierClasses?: string;
9
+ errorMsg?: string;
8
10
  }
9
11
 
10
12
  withDefaults(defineProps<Props>(), {
11
13
  modifierClasses: "",
12
- name: "checkbox",
13
- label: "Check Radio",
14
- type: "checkbox",
15
- check: false,
14
+ name: "radio",
15
+ errorMsg: "",
16
16
  });
17
+ const model = defineModel();
17
18
  </script>
18
19
 
19
20
  <template>
20
- <div class="field">
21
+ <div v-for="option in options" :key="name + option.label" class="field">
21
22
  <input
23
+ v-model="model"
22
24
  class="is-checkradio"
23
- :class="[type === 'checkbox' ? 'has-background-color' : '', modifierClasses]"
24
- :id="name"
25
- :type="type"
25
+ :class="modifierClasses"
26
+ :id="name + option.label"
27
+ type="radio"
26
28
  :name="name"
27
- :checked="check"
29
+ l
30
+ :value="option.value"
28
31
  />
29
- <label :for="name">{{ label }}</label>
32
+ <label :for="name + option.label">{{ option.label }}</label>
33
+ <p v-show="errorMsg" class="is-danger">
34
+ <slot name="message" />
35
+ </p>
30
36
  </div>
37
+ <p v-show="errorMsg" class="is-danger">
38
+ {{ errorMsg }}
39
+ </p>
31
40
  </template>
32
41
 
33
42
  <style lang="scss">
@@ -1,33 +1,26 @@
1
1
  <script setup lang="ts">
2
2
  interface Props {
3
3
  modifierClasses?: string;
4
- name?: string;
4
+ name: string;
5
5
  label?: string;
6
- type?: string;
7
- check?: boolean;
6
+ errorMsg?: string;
8
7
  }
9
8
 
10
9
  withDefaults(defineProps<Props>(), {
11
10
  modifierClasses: "",
12
- name: "switch",
13
11
  label: "Switch Label",
14
- type: "checkbox",
15
- check: false,
12
+ errorMsg: "",
16
13
  });
17
- const emit = defineEmits(["change"]);
14
+
15
+ const model = defineModel({ type: Boolean });
18
16
  </script>
19
17
 
20
18
  <template>
21
19
  <div class="field">
22
- <input
23
- :id="name"
24
- type="checkbox"
25
- :name="name"
26
- class="switch is-rounded"
27
- :class="modifierClasses"
28
- :checked="check"
29
- @change="$emit('change')"
30
- />
20
+ <input v-model="model" :id="name" type="checkbox" :name="name" class="switch is-rounded" :class="modifierClasses" />
31
21
  <label :for="name">{{ label }}</label>
22
+ <p v-show="errorMsg" class="is-danger">
23
+ {{ errorMsg }}
24
+ </p>
32
25
  </div>
33
26
  </template>
@@ -166,6 +166,7 @@ function handleIsActiveChange(isActive: string) {
166
166
  <li v-if="showAccountSwitcher" :class="`is-${dropDownStatus}`" key="switcher">
167
167
  <a
168
168
  class="ac-dropdown-button is-fullwidth is-flex is-justify-content-space-between is-align-items-center"
169
+ data-testid="switch-account-button"
169
170
  @click="toggleList()"
170
171
  >
171
172
  <div class="is-flex gap-8">