barbican-reset 3.24.0 → 3.26.0

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.
@@ -1,14 +1,13 @@
1
1
  <template>
2
2
  <component
3
+ :type="defineType(defineComponent)"
3
4
  :class="generateClassnames"
4
5
  :aria-busy="defineAriaBusy"
5
6
  :aria-live="defineAriaLive"
6
7
  @click="emit('click')"
7
8
  :is="defineComponent"
8
- :type="type"
9
9
  :to="to"
10
- ref="button"
11
- >
10
+ ref="button">
12
11
  <template v-if="state == 'default'">
13
12
  <slot name="default">default</slot>
14
13
  </template>
@@ -71,10 +70,18 @@ const defineAriaLive = computed(() => {
71
70
 
72
71
  const focusButton = () => {
73
72
  if (defineComponent.value == 'button' && button) {
74
- button.value.focus();
73
+ button.value.focus()
75
74
  }
76
75
  }
77
76
 
77
+ const defineType = function (component) {
78
+ if (props.type) return props.type
79
+
80
+ if (component == 'button') return 'button'
81
+
82
+ return null
83
+ }
84
+
78
85
  const props = defineProps({
79
86
  state: {
80
87
  type: String,
@@ -109,7 +116,6 @@ const props = defineProps({
109
116
  })
110
117
 
111
118
  defineExpose({
112
- focusButton
119
+ focusButton,
113
120
  })
114
-
115
- </script>
121
+ </script>
@@ -94,7 +94,7 @@ const props = defineProps({
94
94
  default: false,
95
95
  },
96
96
  to: {
97
- type: Object || String,
97
+ type: [Object, String],
98
98
  },
99
99
  disabled: {
100
100
  type: Boolean,
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div class="br-form-checkbox">
3
- <BrFormLabel
3
+ <br-form-label
4
4
  :class="[{ success }, { error }]"
5
5
  :disabled="disabled"
6
6
  :id="generateID">
7
- <BrFormInput
7
+ <br-form-input
8
8
  :class="[{ success }, { error }]"
9
9
  :disabled="disabled"
10
10
  :id="generateID"
@@ -14,7 +14,7 @@
14
14
  <span class="label-text">
15
15
  <slot />
16
16
  </span>
17
- </BrFormLabel>
17
+ </br-form-label>
18
18
  </div>
19
19
  </template>
20
20
 
@@ -29,6 +29,9 @@ defineOptions({
29
29
  })
30
30
 
31
31
  const props = defineProps({
32
+ id: {
33
+ type: String,
34
+ },
32
35
  disabled: {
33
36
  default: false,
34
37
  type: Boolean,
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div class="br-form-radio">
3
- <BrFormLabel
3
+ <br-form-label
4
4
  :class="[{ success }, { error }]"
5
5
  :disabled="disabled"
6
6
  :id="generateID">
7
- <BrFormInput
7
+ <br-form-input
8
8
  :class="[{ success }, { error }]"
9
9
  :disabled="disabled"
10
10
  :id="generateID"
@@ -14,7 +14,7 @@
14
14
  <span class="label-text">
15
15
  <slot />
16
16
  </span>
17
- </BrFormLabel>
17
+ </br-form-label>
18
18
  </div>
19
19
  </template>
20
20
 
@@ -30,6 +30,9 @@ defineOptions({
30
30
  })
31
31
 
32
32
  const props = defineProps({
33
+ id: {
34
+ type: String,
35
+ },
33
36
  disabled: {
34
37
  default: false,
35
38
  type: Boolean,
@@ -1,21 +1,24 @@
1
1
  <template>
2
2
  <div role="radiogroup">
3
- <BrFormRadio
4
- v-for="(option, index) in options"
5
- :data-test="option['data-test']"
6
- :key="'radio-option-' + index"
7
- :disabled="option.disabled"
8
- :value="option.value"
9
- v-model="model"
10
- :name="name">
11
- <slot v-if="$slots.default" v-bind="option" />
12
- <template v-else>{{ option.text }}</template>
13
- </BrFormRadio>
3
+ <br-wrap cluster>
4
+ <br-form-radio
5
+ v-for="(option, index) in options"
6
+ :data-test="option['data-test']"
7
+ :key="'radio-option-' + index"
8
+ :disabled="option.disabled"
9
+ :value="option.value"
10
+ v-model="model"
11
+ :name="name">
12
+ <slot v-if="$slots.default" v-bind="option" />
13
+ <template v-else>{{ option.text }}</template>
14
+ </br-form-radio>
15
+ </br-wrap>
14
16
  </div>
15
17
  </template>
16
18
 
17
19
  <script setup>
18
20
  import BrFormRadio from '#components/BrFormRadio.vue'
21
+ import BrWrap from '#components/BrWrap.vue'
19
22
 
20
23
  const model = defineModel()
21
24
 
@@ -1,12 +1,13 @@
1
1
  <template>
2
2
  <div :class="generateClasses">
3
- <BrFormLabel
3
+ <br-form-label
4
4
  v-if="label"
5
5
  :id="generateFor"
6
6
  :required="required"
7
- v-bind="$attrs">
7
+ v-bind="$attrs"
8
+ row>
8
9
  {{ label }}
9
- </BrFormLabel>
10
+ </br-form-label>
10
11
  <div :class="[`content`, { label }, { submit }, { radios }]">
11
12
  <slot />
12
13
  </div>
@@ -16,7 +16,7 @@ const isExternal = computed(() => typeof props.to == 'string')
16
16
 
17
17
  const props = defineProps({
18
18
  to: {
19
- type: Object || String,
19
+ type: [Object, String],
20
20
  },
21
21
  })
22
22
  </script>
package/package.json CHANGED
@@ -137,5 +137,5 @@
137
137
  "style:patterns": "cd patterns && gulp build:css",
138
138
  "build:patterns": "cd patterns && rm -rf html && pug views --out html"
139
139
  },
140
- "version": "3.24.0"
140
+ "version": "3.26.0"
141
141
  }
package/scss/_form.scss CHANGED
@@ -1,8 +1,3 @@
1
- label {
2
- font-weight: bold;
3
- display: block;
4
- }
5
-
6
1
  .secondary-actions {
7
2
  margin-top: var(--margin-xl);
8
3
 
@@ -176,7 +176,7 @@
176
176
  --padding-xl: 1.5rem;
177
177
  --padding-xxl: 2rem;
178
178
  --padding-xxxl: 2.5rem;
179
- --padding-card-sm: 1rem;
179
+ --padding-card-sm: 1.25rem;
180
180
  --padding-card-md: 1.5rem;
181
181
  --padding-card-lg: 1.75rem;
182
182
  --padding-content: 3.75rem;
@@ -101,9 +101,13 @@
101
101
  }
102
102
 
103
103
  @mixin br-form-radio {
104
- &:not(:last-child) {
105
- margin-bottom: var(--margin-sm);
106
- }
104
+ display: inline-flex;
105
+
106
+ /// @TODO: block variant
107
+
108
+ // &:not(:last-child) {
109
+ // margin-bottom: var(--margin-sm);
110
+ // }
107
111
 
108
112
  .br-form-label {
109
113
  @include br-form-radio--label;
@@ -14,30 +14,36 @@
14
14
  }
15
15
 
16
16
  @mixin br-form-row {
17
+ & {
18
+ row-gap: var(--gap-md);
19
+ display: grid;
20
+ }
21
+
17
22
  &:not(:last-of-type) {
18
23
  margin-bottom: var(--margin-md);
19
24
  }
20
25
 
21
26
  @include small-up {
22
27
  grid-template-columns: 33fr 67fr;
23
- align-items: flex-start;
24
- gap: var(--gap-xl);
25
- display: grid;
28
+ column-gap: var(--gap-xl);
29
+ align-items: start;
30
+
31
+ >.br-form-label {
32
+ margin-top: var(--margin-lg);
33
+ }
26
34
  }
27
35
 
28
- >label,
29
36
  >.br-form-label {
30
- @include br-form-label;
37
+ font-weight: bold;
31
38
  }
32
39
 
33
- .br-form-input[type=email] {
40
+ .br-form-input[type=text],
41
+ .br-form-input[type=email],
42
+ .br-form-input[type=tel],
43
+ .br-form-input[type=date] {
34
44
  width: 100%;
35
45
  }
36
46
 
37
- .content.radios {
38
- margin: var(--margin-wrap-xs);
39
- }
40
-
41
47
  .content>fieldset {
42
48
  margin-top: var(--margin-lg);
43
49
  }
@@ -2,5 +2,5 @@
2
2
  @forward "input/status";
3
3
  @forward "input/checkbox";
4
4
  @forward "input/select";
5
- @forward "input/radio";
5
+ @forward "br-form-radio";
6
6
  @forward "input/text";
@@ -1,112 +0,0 @@
1
- <template>
2
- <component
3
- :class="generateComponentClasses"
4
- :aria-busy="defineAriaBusy"
5
- :aria-live="defineAriaLive"
6
- @click="emit('click')"
7
- :is="defineComponent"
8
- :type="type"
9
- :href="href"
10
- :to="to">
11
- <template v-if="state == 'default'">
12
- <slot name="default">default</slot>
13
- </template>
14
- <template v-else-if="state == 'loading'">
15
- <template v-if="$slots.loading">
16
- <slot name="loading">loading</slot>
17
- </template>
18
- <dot-typing v-else />
19
- </template>
20
- <template v-else-if="state == 'loaded'">
21
- <slot name="loaded">loaded</slot>
22
- </template>
23
- <template v-else-if="state == 'error'">
24
- <slot name="error">error</slot>
25
- </template>
26
- </component>
27
- </template>
28
-
29
- <script setup>
30
- import { computed } from 'vue'
31
- import DotTyping from '#components/BrButton/dot_typing.vue'
32
-
33
- const emit = defineEmits(['click'])
34
-
35
- const props = defineProps({
36
- state: {
37
- type: String,
38
- default: 'default',
39
- },
40
- variant: {
41
- type: String,
42
- default: 'secondary',
43
- },
44
- type: {
45
- type: [String, null],
46
- },
47
- to: {
48
- type: [Object, null],
49
- },
50
- href: {
51
- type: [String, null],
52
- },
53
- inline: {
54
- type: Boolean,
55
- default: false,
56
- },
57
- slim: {
58
- type: Boolean,
59
- default: false,
60
- },
61
- active: {
62
- type: Boolean,
63
- default: false,
64
- },
65
- })
66
-
67
- const generateComponentClasses = computed(() => {
68
- let classnames = ['btn', 'btn-' + props.variant]
69
-
70
- if (props.inline) {
71
- classnames.push('btn-inline')
72
- }
73
-
74
- if (props.slim) {
75
- classnames.push('btn-slim')
76
- }
77
-
78
- if (props.active) {
79
- classnames.push('btn-active')
80
- }
81
-
82
- return classnames
83
- })
84
-
85
- const defineComponent = computed(() => {
86
- if (props.href) {
87
- return 'a'
88
- }
89
-
90
- if (props.to) {
91
- return 'router-link'
92
- }
93
-
94
- return 'button'
95
- })
96
-
97
- const defineAriaBusy = computed(() => {
98
- if (props.to || props.href) {
99
- return
100
- }
101
-
102
- return props.state == 'loading' ? 'true' : 'false'
103
- })
104
-
105
- const defineAriaLive = computed(() => {
106
- if (props.to || props.href) {
107
- return
108
- }
109
-
110
- return 'polite'
111
- })
112
- </script>