barbican-reset 3.12.0 → 3.15.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.
Files changed (47) hide show
  1. package/components/BrFormCheckbox.vue +19 -0
  2. package/components/BrFormCheckboxGroup.vue +33 -0
  3. package/components/BrFormDate.vue +9 -0
  4. package/components/BrFormEdit.vue +38 -0
  5. package/components/BrFormEmail.vue +13 -0
  6. package/components/BrFormFieldset.vue +14 -0
  7. package/components/BrFormInput.vue +20 -0
  8. package/components/BrFormLabel.vue +27 -0
  9. package/components/BrFormPassword.vue +33 -51
  10. package/components/BrFormRadio.vue +19 -0
  11. package/components/BrFormRadioGroup.vue +33 -0
  12. package/components/BrFormRow.vue +17 -45
  13. package/components/BrFormTel.vue +13 -0
  14. package/components/BrFormTextarea.vue +16 -0
  15. package/components/BrFormUpdate.vue +19 -5
  16. package/components/BrFormVisible.vue +32 -0
  17. package/css/index.css +151 -210
  18. package/index.js +60 -8
  19. package/mixins/inputs.js +44 -48
  20. package/package.json +3 -2
  21. package/scss/_br-button.scss +2 -2
  22. package/scss/_br-form-edit.scss +5 -0
  23. package/scss/_br-form-row.scss +0 -37
  24. package/scss/_br-form-textarea.scss +6 -0
  25. package/scss/_br-form-update.scss +7 -6
  26. package/scss/_br-form-visible.scss +5 -0
  27. package/scss/_br-radio.scss +1 -1
  28. package/scss/_input.scss +5 -5
  29. package/scss/helpers/mixins/_br-form-edit.scss +9 -0
  30. package/scss/helpers/mixins/_br-form-row.scss +32 -12
  31. package/scss/helpers/mixins/{_br-form-password.scss → _br-form-visible.scss} +2 -2
  32. package/scss/helpers/mixins/buttons/_custom.scss +8 -7
  33. package/scss/helpers/mixins/index.scss +2 -2
  34. package/scss/helpers/mixins/input/_text.scss +4 -2
  35. package/scss/helpers/mixins/table/_preferences.scss +1 -1
  36. package/scss/index.scss +4 -4
  37. package/scss/lists.scss +10 -0
  38. package/components/BrFormCheckbox/Component.vue +0 -52
  39. package/components/BrFormCheckboxGroup/Component.vue +0 -39
  40. package/components/BrFormGroup/Component.vue +0 -15
  41. package/components/BrFormGroup/Demo.vue +0 -26
  42. package/components/BrFormInput/Component.vue +0 -45
  43. package/components/BrFormRadio/Component.vue +0 -40
  44. package/components/BrFormRadioGroup/Component.vue +0 -38
  45. package/components/BrFormTextarea/Component.vue +0 -26
  46. package/scss/_br-form-password.scss +0 -5
  47. package/scss/helpers/mixins/_br-form-update.scss +0 -17
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="br-checkbox">
3
+ <br-form-input v-bind="$attrs" :value="data" type="checkbox">
4
+ <slot />
5
+ </br-form-input>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import BrFormInput from '#components/BrFormInput.vue'
11
+
12
+ export default {
13
+ props: ['data'],
14
+ inheritAttrs: false,
15
+ components: {
16
+ BrFormInput,
17
+ },
18
+ }
19
+ </script>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div role="group">
3
+ <br-form-checkbox
4
+ v-for="(option, index) in options"
5
+ :data-test="option['data-test']"
6
+ :disabled="option.disabled"
7
+ :key="generateKey(index)"
8
+ :data="option.value"
9
+ v-model="value"
10
+ :name="name">
11
+ <slot v-if="$slots.default" v-bind="option" />
12
+ <template v-else>{{ option.text }}</template>
13
+ </br-form-checkbox>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import inputs from '#mixins/inputs'
19
+ import BrFormCheckbox from '#components/BrFormCheckbox.vue'
20
+
21
+ export default {
22
+ mixins: [inputs],
23
+ props: ['modelValue', 'options', 'name'],
24
+ components: {
25
+ BrFormCheckbox,
26
+ },
27
+ methods: {
28
+ generateKey(index) {
29
+ return 'checkbox-option-' + index
30
+ },
31
+ },
32
+ }
33
+ </script>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <br-form-input v-bind="$attrs" type="date" />
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ inheritAttrs: false,
8
+ }
9
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div :class="generateClasses">
3
+ <slot />
4
+ <br-button
5
+ @click="$emit('edit')"
6
+ variant="edit-input"
7
+ data-test="edit"
8
+ v-if="active">
9
+ <edit-icon />
10
+ </br-button>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import BrButton from '#components/BrButton.vue'
16
+ import EditIcon from '#icons/account/edit.vue'
17
+
18
+ export default {
19
+ props: {
20
+ active: {
21
+ type: Boolean,
22
+ },
23
+ },
24
+ components: {
25
+ BrButton,
26
+ EditIcon,
27
+ },
28
+ computed: {
29
+ generateClasses() {
30
+ let result = ['br-form-edit']
31
+
32
+ if (this.active) result.push('active')
33
+
34
+ return result
35
+ },
36
+ },
37
+ }
38
+ </script>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <br-form-input type="email" />
3
+ </template>
4
+
5
+ <script>
6
+ import BrFormInput from '#components/BrFormInput.vue'
7
+
8
+ export default {
9
+ components: {
10
+ BrFormInput,
11
+ },
12
+ }
13
+ </script>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <fieldset>
3
+ <legend>{{ label }}</legend>
4
+ <slot />
5
+ </fieldset>
6
+ </template>
7
+
8
+ <script>
9
+ // Pass a form "id" as "form" to associate inputs with that form
10
+ // Pass a "disabled" attribute to disable inputs inside the fieldset
11
+ export default {
12
+ props: ['label'],
13
+ }
14
+ </script>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <input
3
+ :autocomplete="generateAutoComplete"
4
+ :data-test="generateDataTest"
5
+ :type="generateType"
6
+ :id="generateID"
7
+ v-model="value"
8
+ v-bind="$attrs" />
9
+ <label v-if="$slots.default" :for="generateID"><slot /></label>
10
+ </template>
11
+
12
+ <script>
13
+ import inputs from '#mixins/inputs'
14
+
15
+ export default {
16
+ props: ['modelValue', 'id', 'type', 'data-test', 'autocomplete'],
17
+ inheritAttrs: false,
18
+ mixins: [inputs],
19
+ }
20
+ </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <label v-if="!disabled" :for="id">
3
+ <strong>
4
+ <slot />
5
+ </strong>
6
+ <span v-if="required"> (required)</span>
7
+ <span v-if="optional"> (optional)</span>
8
+ </label>
9
+ <div v-else class="br-label">
10
+ <strong>
11
+ <slot />
12
+ </strong>
13
+ <span v-if="required"> (required)</span>
14
+ <span v-if="optional"> (optional)</span>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ props: {
21
+ disabled: { type: Boolean },
22
+ required: { type: Boolean },
23
+ optional: { type: Boolean },
24
+ id: { type: String },
25
+ },
26
+ }
27
+ </script>
@@ -1,67 +1,49 @@
1
1
  <template>
2
- <div class="br-form-password">
3
- <input
2
+ <br-form-visible
3
+ @visible="showPassword = !showPassword"
4
+ :visible="showPassword"
5
+ v-if="toggle">
6
+ <br-form-input
7
+ :autocomplete="generateAutocomplete"
8
+ :type="generateType"
4
9
  v-bind="$attrs"
5
- :autocomplete="autocomplete"
6
- @input="$emit('update:modelValue', $event.target.value)"
7
- :value="modelValue"
8
- name="password"
9
- :type="type"
10
- required
11
- :id="id"
12
- :data-test="dataTest"
13
- />
14
- <br-button
15
- @click="showPassword = !showPassword"
16
- variant="toggle-password"
17
- data-test="show-password"
18
- >
19
- <span class="sr-only">
20
- {{ showPassword ? "Hide" : "Show" }} password
21
- </span>
22
- <show-password-icon v-if="showPassword" />
23
- <hide-password-icon v-else />
24
- </br-button>
25
- </div>
10
+ required />
11
+ </br-form-visible>
12
+ <br-form-input
13
+ :autocomplete="generateAutocomplete"
14
+ :type="generateType"
15
+ v-bind="$attrs"
16
+ required
17
+ v-else />
26
18
  </template>
27
19
 
28
20
  <script>
29
- import BrButton from "#components/BrButton.vue";
30
- import HidePasswordIcon from "#icons/password/hide.vue";
31
- import ShowPasswordIcon from "#icons/password/show.vue";
21
+ import BrFormInput from '#components/BrFormInput.vue'
22
+ import BrFormVisible from '#components/BrFormVisible.vue'
32
23
 
33
24
  export default {
34
- inheritAttrs: false, // Allow us to put attributes on the input.
35
- emits: ["update:modelValue"],
36
- data() {
37
- return {
38
- password: "",
39
- showPassword: false,
40
- };
25
+ inheritAttrs: false,
26
+ props: {
27
+ toggle: {
28
+ type: Boolean,
29
+ },
41
30
  },
42
31
  components: {
43
- HidePasswordIcon,
44
- ShowPasswordIcon,
45
- BrButton,
32
+ BrFormInput,
33
+ BrFormVisible,
46
34
  },
47
- props: {
48
- modelValue: {},
49
- id: {
50
- type: String,
51
- default: "password",
52
- },
53
- dataTest: {
54
- type: String,
55
- default: "password-field",
56
- },
35
+ data() {
36
+ return {
37
+ showPassword: false,
38
+ }
57
39
  },
58
40
  computed: {
59
- type() {
60
- return this.showPassword ? "text" : "password";
41
+ generateType() {
42
+ return this.showPassword ? 'text' : 'password'
61
43
  },
62
- autocomplete() {
63
- return this.showPassword ? "off" : "current-password";
44
+ generateAutocomplete() {
45
+ return this.showPassword ? 'off' : 'current-password'
64
46
  },
65
47
  },
66
- };
48
+ }
67
49
  </script>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="br-radio">
3
+ <br-form-input v-bind="$attrs" :value="data" type="radio">
4
+ <slot />
5
+ </br-form-input>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import BrFormInput from '#components/BrFormInput.vue'
11
+
12
+ export default {
13
+ props: ['data'],
14
+ inheritAttrs: false,
15
+ components: {
16
+ BrFormInput,
17
+ },
18
+ }
19
+ </script>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div role="radiogroup">
3
+ <br-form-radio
4
+ v-for="(option, index) in options"
5
+ :data-test="option['data-test']"
6
+ :disabled="option.disabled"
7
+ :key="generateKey(index)"
8
+ :data="option.value"
9
+ v-model="value"
10
+ :name="name">
11
+ <slot v-if="$slots.default" v-bind="option" />
12
+ <template v-else>{{ option.text }}</template>
13
+ </br-form-radio>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import inputs from '#mixins/inputs'
19
+ import BrFormRadio from '#components/BrFormRadio.vue'
20
+
21
+ export default {
22
+ mixins: [inputs],
23
+ props: ['modelValue', 'options', 'name'],
24
+ components: {
25
+ BrFormRadio,
26
+ },
27
+ methods: {
28
+ generateKey(index) {
29
+ return 'radio-option-' + index
30
+ },
31
+ },
32
+ }
33
+ </script>
@@ -1,76 +1,48 @@
1
1
  <template>
2
- <div :class="styleRow">
3
- <template v-if="label">
4
- <label v-if="input_active" :for="generateInputID">
5
- <strong>{{ label }}</strong>
6
- <span v-if="required"> (required)</span>
7
- <span v-if="optional"> (optional)</span>
8
- </label>
9
- <div class="fake-label" v-else>
10
- <strong>
11
- {{ label }}
12
- </strong>
13
- </div>
14
- </template>
15
- <div :class="[`content`, { editable }, { label }, { submit }, { radios }]">
16
- <br-button v-if="editable" variant="input-edit" @click="$emit('edit')">
17
- <edit-icon />
18
- </br-button>
2
+ <div :class="generateClasses">
3
+ <br-form-label :id="generateFor" v-bind="$attrs" v-if="label">
4
+ {{ label }}
5
+ </br-form-label>
6
+ <div :class="[`content`, { label }, { submit }, { radios }]">
19
7
  <slot />
20
8
  </div>
21
9
  </div>
22
10
  </template>
23
11
 
24
12
  <script>
25
- import BrButton from '#components/BrButton.vue'
26
- import EditIcon from '#icons/account/edit.vue'
27
- import mixins from '#mixins/inputs'
13
+ import inputs from '#mixins/inputs'
14
+ import BrFormLabel from '#components/BrFormLabel.vue'
28
15
 
29
16
  export default {
30
- mixins: [mixins],
17
+ inheritAttrs: false,
18
+ mixins: [inputs],
31
19
  components: {
32
- BrButton,
33
- EditIcon,
20
+ BrFormLabel,
34
21
  },
35
22
  props: {
36
23
  label: {
37
24
  type: String,
38
25
  },
39
- input_id: {
26
+ id: {
40
27
  type: String,
41
28
  },
42
- input_active: {
43
- type: Boolean,
44
- default: true,
45
- },
46
- required: {
47
- type: Boolean,
48
- },
49
- optional: {
50
- type: Boolean,
51
- },
52
29
  submit: {
53
30
  type: Boolean,
54
31
  },
55
- editable: {
56
- type: Boolean,
32
+ class: {
33
+ type: String,
57
34
  },
58
35
  radios: {
59
36
  type: Boolean,
60
37
  },
61
- class: {
62
- type: String,
63
- },
64
38
  },
65
39
  computed: {
66
- styleRow() {
67
- let styles = ['br-form-row']
40
+ generateClasses() {
41
+ let result = ['br-form-row']
68
42
 
69
- if (this.class) {
70
- styles.push(this.class)
71
- }
43
+ if (this.class) result.push(this.class)
72
44
 
73
- return styles.join(' ')
45
+ return result
74
46
  },
75
47
  },
76
48
  }
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <br-form-input autocomplete="tel" inputmode="tel" type="tel" />
3
+ </template>
4
+
5
+ <script>
6
+ import BrFormInput from '#components/BrFormInput.vue'
7
+
8
+ export default {
9
+ components: {
10
+ BrFormInput,
11
+ },
12
+ }
13
+ </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <textarea
3
+ class="br-form-textarea"
4
+ :id="generateID"
5
+ v-model="value"
6
+ wrap="soft" />
7
+ </template>
8
+
9
+ <script>
10
+ import inputs from '#mixins/inputs'
11
+
12
+ export default {
13
+ mixins: [inputs],
14
+ props: ['modelValue', 'id'],
15
+ }
16
+ </script>
@@ -1,18 +1,32 @@
1
1
  <template>
2
- <div class="br-form-update">
3
- <div class="br-form-update--input" data-test="email"><slot /></div>
4
- <br-button @click="$emit('update')" data-test="update">
2
+ <div :class="generateClasses">
3
+ <slot />
4
+ <br-button v-if="active" @click="$emit('update')" data-test="update">
5
5
  update
6
6
  </br-button>
7
7
  </div>
8
8
  </template>
9
9
 
10
10
  <script>
11
- import BrButton from "#components/BrButton.vue";
11
+ import BrButton from '#components/BrButton.vue'
12
12
 
13
13
  export default {
14
+ props: {
15
+ active: {
16
+ type: Boolean,
17
+ },
18
+ },
14
19
  components: {
15
20
  BrButton,
16
21
  },
17
- };
22
+ computed: {
23
+ generateClasses() {
24
+ let result = ['br-form-update']
25
+
26
+ if (this.active) result.push('active')
27
+
28
+ return result
29
+ },
30
+ },
31
+ }
18
32
  </script>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div class="br-form-visible">
3
+ <slot />
4
+ <br-button
5
+ @click="$emit('visible')"
6
+ data-test="show-password"
7
+ variant="toggle-password">
8
+ <span class="sr-only">{{ visible ? 'Hide' : 'Show' }} password</span>
9
+ <show-password-icon v-if="visible" />
10
+ <hide-password-icon v-else />
11
+ </br-button>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import BrButton from '#components/BrButton.vue'
17
+ import HidePasswordIcon from '#icons/password/hide.vue'
18
+ import ShowPasswordIcon from '#icons/password/show.vue'
19
+
20
+ export default {
21
+ props: {
22
+ visible: {
23
+ type: Boolean,
24
+ },
25
+ },
26
+ components: {
27
+ BrButton,
28
+ HidePasswordIcon,
29
+ ShowPasswordIcon,
30
+ },
31
+ }
32
+ </script>