@ditojs/ui 2.71.0 → 2.72.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/ui",
3
- "version": "2.71.0",
3
+ "version": "2.72.0",
4
4
  "type": "module",
5
5
  "description": "Dito.js UI is a simple UI library, built with Vue.js for use in Dito.js Admin and elsewhere",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/ui",
@@ -41,12 +41,12 @@
41
41
  "ie_mob >= 11"
42
42
  ],
43
43
  "dependencies": {
44
- "@ditojs/utils": "^2.71.0",
44
+ "@ditojs/utils": "^2.72.0",
45
45
  "@soda/get-current-script": "^1.0.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@ditojs/build": "^2.71.0",
49
- "vite": "^7.3.0"
48
+ "@ditojs/build": "^2.72.0",
49
+ "vite": "^7.3.1"
50
50
  },
51
- "gitHead": "e5a095c7c44de8b6c84994d744612f0fce19eae2"
51
+ "gitHead": "6af5f5bad3ff155436e4344d9c422933ff5ee7d8"
52
52
  }
@@ -16,8 +16,7 @@ Trigger.dito-date-picker(
16
16
  ref="input"
17
17
  v-model="currentText"
18
18
  type="text"
19
- :class="{ 'dito-focus': focused }"
20
- v-bind="{ placeholder, disabled, ...$attrs }"
19
+ v-bind="{ placeholder, disabled, focused, ...$attrs }"
21
20
  @focus="onFocus(true)"
22
21
  @blur="onFocus(false)"
23
22
  @keydown="onKeyDown"
@@ -1,12 +1,13 @@
1
1
  <template lang="pug">
2
2
  .dito-date-time-picker(ref="picker")
3
- .dito-date-time-picker__inner(:class="{ 'dito-focus': focused }")
3
+ .dito-date-time-picker__inner(
4
+ :class="{ 'dito-date-time-picker__inner--focus': focused }"
5
+ )
4
6
  InputField.dito-date-time-picker__input(
5
7
  ref="input"
6
8
  v-model="currentText"
7
9
  type="text"
8
- :class="{ 'dito-focus': focused }"
9
- v-bind="{ placeholder, disabled, ...$attrs }"
10
+ v-bind="{ placeholder, disabled, focused, ...$attrs }"
10
11
  @focus="onFocus(true)"
11
12
  @blur="onFocus(false)"
12
13
  @keydown="onKeyDown"
@@ -33,21 +33,25 @@ export default {
33
33
  disabled: { type: Boolean, default: false },
34
34
  readonly: { type: Boolean, default: false },
35
35
  autofocus: { type: Boolean, default: false },
36
+ focused: { type: Boolean, default: false },
36
37
  placeholder: { type: String, default: null },
37
38
  autocomplete: { type: String, default: 'off' }
38
39
  },
39
40
 
40
41
  data() {
41
42
  return {
42
- currentValue: this.modelValue,
43
- hovering: false,
44
- focused: false
43
+ currentValue: this.modelValue
45
44
  }
46
45
  },
47
46
 
48
47
  computed: {
49
48
  classes() {
50
- return this.$attrs.class
49
+ return [
50
+ this.$attrs.class,
51
+ {
52
+ 'dito-input--focus': this.focused
53
+ }
54
+ ]
51
55
  },
52
56
 
53
57
  attributes() {
@@ -7,7 +7,7 @@
7
7
  template(
8
8
  v-if="total > 0"
9
9
  ) {{ first }} – {{ last }} / {{ total }}
10
- .dito-buttons.dito-buttons-round(
10
+ .dito-buttons.dito-buttons--round(
11
11
  v-if="numPages > 1"
12
12
  )
13
13
  button.dito-button(
@@ -136,13 +136,11 @@ export default {
136
136
 
137
137
  methods: {
138
138
  getButtonClasses(button) {
139
- const classes = {
140
- 'dito-selected': button.active
139
+ const prefix = 'dito-button'
140
+ return {
141
+ [`${prefix}--${button.type}`]: button.type,
142
+ [`${prefix}--active`]: button.active
141
143
  }
142
- if (button.type) {
143
- classes[`dito-button-${button.type}`] = true
144
- }
145
- return classes
146
144
  },
147
145
 
148
146
  onClickButton(button) {
@@ -180,19 +178,19 @@ export default {
180
178
  font-variant-numeric: tabular-nums;
181
179
  padding: 0 0.5em;
182
180
 
183
- &-prev,
184
- &-next {
181
+ &--prev,
182
+ &--next {
185
183
  &::before {
186
184
  @extend %icon-arrow;
187
185
  }
188
186
  }
189
187
 
190
- &-prev::before {
188
+ &--prev::before {
191
189
  transform: scaleX(-1);
192
190
  }
193
191
 
194
- &-ellipsis-prev,
195
- &-ellipsis-next {
192
+ &--ellipsis-prev,
193
+ &--ellipsis-next {
196
194
  background: none;
197
195
  border: 0;
198
196
  padding: 0;
@@ -216,7 +214,7 @@ export default {
216
214
  }
217
215
  }
218
216
 
219
- &-ellipsis-prev::before {
217
+ &--ellipsis-prev::before {
220
218
  transform: scaleX(-1);
221
219
  }
222
220
  }
@@ -3,7 +3,7 @@
3
3
  :class="classes"
4
4
  :style="styles"
5
5
  )
6
- .dito-switch-pane
6
+ .dito-switch__pane
7
7
  input(
8
8
  :id="id"
9
9
  ref="input"
@@ -13,8 +13,8 @@
13
13
  :name="name"
14
14
  :disabled="disabled"
15
15
  )
16
- .dito-switch-button
17
- span.dito-switch-label(
16
+ .dito-switch__button
17
+ span.dito-switch__label(
18
18
  v-if="labels"
19
19
  )
20
20
  slot(
@@ -48,11 +48,12 @@ export default {
48
48
 
49
49
  computed: {
50
50
  classes() {
51
+ const prefix = 'dito-switch'
51
52
  return [
52
53
  this.$attrs.class,
53
54
  {
54
- 'dito-checked': this.checked,
55
- 'dito-disabled': this.disabled
55
+ [`${prefix}--checked`]: this.checked,
56
+ [`${prefix}--disabled`]: this.disabled
56
57
  }
57
58
  ]
58
59
  },
@@ -97,6 +98,8 @@ export default {
97
98
  @import '../styles/_imports';
98
99
 
99
100
  .dito-switch {
101
+ $self: &;
102
+
100
103
  // Use whole multiples of `rem` for sizes and `px` margins/padding along
101
104
  // with `calc()` to end up with even pixel sizes.
102
105
  --switch-width: 4em;
@@ -116,14 +119,14 @@ export default {
116
119
  vertical-align: bottom;
117
120
  @include user-select(none);
118
121
 
119
- .dito-switch-pane {
122
+ &__pane {
120
123
  position: relative;
121
124
  width: var(--width);
122
125
  height: var(--height);
123
126
  }
124
127
 
125
- .dito-switch-pane,
126
- .dito-switch-label {
128
+ &__pane,
129
+ &__label {
127
130
  top: 50%;
128
131
  transform: translateY(-50%);
129
132
  }
@@ -140,7 +143,7 @@ export default {
140
143
  background-color 0.3s;
141
144
  }
142
145
 
143
- .dito-switch-button {
146
+ &__button {
144
147
  --size: calc(var(--height) - 2 * var(--switch-padding));
145
148
 
146
149
  position: absolute;
@@ -155,39 +158,39 @@ export default {
155
158
  transform: translateX(0);
156
159
  }
157
160
 
158
- .dito-switch-button,
159
- .dito-switch-label {
161
+ &__button,
162
+ &__label {
160
163
  pointer-events: none;
161
164
  }
162
165
 
163
- .dito-switch-label {
166
+ &__label {
164
167
  position: absolute;
165
168
  right: var(--label-margin);
166
169
  text-transform: uppercase;
167
170
  color: $color-white;
168
171
  }
169
172
 
170
- &.dito-checked {
173
+ &--checked {
171
174
  input {
172
175
  background: $color-active;
173
176
  }
174
177
 
175
- .dito-switch-button {
178
+ #{$self}__button {
176
179
  transform: translateX(var(--offset));
177
180
  }
178
181
 
179
- .dito-switch-label {
182
+ #{$self}__label {
180
183
  left: var(--label-margin);
181
184
  right: unset;
182
185
  }
183
186
  }
184
187
 
185
- &.dito-disabled {
188
+ &--disabled {
186
189
  @extend %button-disabled;
187
190
  }
188
191
 
189
192
  &:focus-within:not(:hover) {
190
- .dito-switch-button {
193
+ #{$self}__button {
191
194
  box-shadow: $shadow-focus;
192
195
  }
193
196
  }
@@ -16,8 +16,7 @@ Trigger.dito-time-picker(
16
16
  ref="input"
17
17
  v-model="currentText"
18
18
  type="text"
19
- :class="{ 'dito-focus': focused }"
20
- v-bind="{ placeholder, disabled, ...$attrs }"
19
+ v-bind="{ placeholder, disabled, focused, ...$attrs }"
21
20
  @focus="onFocus(true)"
22
21
  @blur="onFocus(false)"
23
22
  @keydown="onKeyDown"
@@ -31,7 +31,7 @@
31
31
  box-shadow: inset 0 1px 2px 0 $color-shadow;
32
32
  }
33
33
 
34
- &.dito-selected {
34
+ &--selected {
35
35
  background: $button-color-active;
36
36
 
37
37
  &:hover {
@@ -39,7 +39,7 @@
39
39
  }
40
40
  }
41
41
 
42
- &.dito-active,
42
+ &--active,
43
43
  &[type='submit'] {
44
44
  color: $color-text-inverted;
45
45
  background: $color-active;
@@ -58,7 +58,7 @@
58
58
  }
59
59
  }
60
60
 
61
- &.dito-disabled,
61
+ &--disabled,
62
62
  &[disabled] {
63
63
  @extend %button-disabled;
64
64
  }
@@ -72,7 +72,7 @@
72
72
  white-space: nowrap;
73
73
 
74
74
  &,
75
- .dito-button-group {
75
+ &__group {
76
76
  > * {
77
77
  margin-left: var(--button-margin);
78
78
 
@@ -82,11 +82,11 @@
82
82
  }
83
83
  }
84
84
 
85
- .dito-button-group + .dito-button-group {
85
+ &__group + &__group {
86
86
  margin-left: 1.5em;
87
87
  }
88
88
 
89
- &.dito-buttons-round {
89
+ &--round {
90
90
  .dito-button {
91
91
  padding: $button-round-padding;
92
92
  min-width: $input-height;
@@ -95,16 +95,16 @@
95
95
  }
96
96
  }
97
97
 
98
- &.dito-buttons-small {
98
+ &--small {
99
99
  --button-margin: 1px;
100
100
  }
101
101
 
102
- &.dito-buttons-round,
103
- &.dito-buttons-small {
102
+ &--round,
103
+ &--small {
104
104
  line-height: 1em;
105
105
  }
106
106
 
107
- &.dito-buttons-toolbar {
107
+ &--toolbar {
108
108
  justify-content: flex-start;
109
109
 
110
110
  .dito-button {
@@ -12,7 +12,7 @@
12
12
  transition: transform 0.1s ease;
13
13
  }
14
14
 
15
- &.dito-open::before {
15
+ &--open::before {
16
16
  transform: rotate(90deg);
17
17
  }
18
18
 
@@ -6,12 +6,12 @@
6
6
  padding: $input-padding;
7
7
  background: $color-white;
8
8
 
9
- .dito-has-errors & {
9
+ .dito-container--has-errors & {
10
10
  border-color: $color-error;
11
11
  }
12
12
 
13
13
  &:disabled,
14
- .dito-disabled & {
14
+ .dito-container--disabled & {
15
15
  color: $color-disabled;
16
16
  pointer-events: none;
17
17
  cursor: text;
@@ -9,11 +9,8 @@
9
9
 
10
10
  &:focus,
11
11
  &:focus-within,
12
- &.dito-focus {
13
- &,
14
- .dito-inherit-focus {
15
- border-color: $color-active;
16
- }
12
+ &.dito-input--focus {
13
+ border-color: $color-active;
17
14
  }
18
15
  }
19
16