@schukai/monster 3.100.5 → 3.100.7

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 (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/dataset.mjs +10 -5
  4. package/source/components/datatable/datasource.mjs +0 -1
  5. package/source/components/datatable/datatable.mjs +2 -0
  6. package/source/components/datatable/filter.mjs +4 -5
  7. package/source/components/datatable/style/datatable.pcss +1 -1
  8. package/source/components/datatable/util.mjs +2 -2
  9. package/source/components/form/api-bar.mjs +1 -1
  10. package/source/components/form/api-button.mjs +1 -1
  11. package/source/components/form/button.mjs +21 -1
  12. package/source/components/form/confirm-button.mjs +0 -45
  13. package/source/components/form/context-help.mjs +1 -1
  14. package/source/components/form/form.mjs +165 -164
  15. package/source/components/form/message-state-button.mjs +21 -7
  16. package/source/components/form/popper-button.mjs +25 -57
  17. package/source/components/form/select.mjs +2142 -2164
  18. package/source/components/form/state-button.mjs +24 -14
  19. package/source/components/form/style/button.pcss +2 -0
  20. package/source/components/form/style/message-state-button.pcss +1 -2
  21. package/source/components/form/style/state-button.pcss +1 -0
  22. package/source/components/form/stylesheet/button.mjs +1 -1
  23. package/source/components/form/stylesheet/field-set.mjs +14 -7
  24. package/source/components/form/stylesheet/message-state-button.mjs +7 -14
  25. package/source/components/form/stylesheet/state-button.mjs +7 -14
  26. package/source/components/layout/collapse.mjs +1 -1
  27. package/source/components/layout/details.mjs +1 -1
  28. package/source/components/style/accessibility.css +27 -0
  29. package/source/components/style/accessibility.pcss +31 -0
  30. package/source/components/stylesheet/accessibility.mjs +38 -0
@@ -20,7 +20,7 @@ import {
20
20
  } from "../../dom/customelement.mjs";
21
21
  import { isArray, isString } from "../../types/is.mjs";
22
22
  import { validateString } from "../../types/validate.mjs";
23
- import { Popper } from "./popper.mjs";
23
+ import { Popper } from "../layout/popper.mjs";
24
24
  import { MessageStateButtonStyleSheet } from "./stylesheet/message-state-button.mjs";
25
25
  import { StateButtonStyleSheet } from "./stylesheet/state-button.mjs";
26
26
  import "./state-button.mjs";
@@ -95,9 +95,15 @@ class MessageStateButton extends Popper {
95
95
  *
96
96
  * @property {Object} templates Template definitions
97
97
  * @property {string} templates.main Main template
98
- * @property {Object} labels Label definitions
98
+ * @property {Object} message Message definition
99
+ * @property {string|HTMLElement} message.content The message content
100
+ * @property {string} message.title The message title
101
+ * @property {string} message.icon The message icon
102
+ * @property {string} mode The mode of the button
99
103
  * @property {string} labels.button Button label
100
- * @property {Object} mode Mode definitions (manual, submit)
104
+ * @property {boolean} features.disableButton Disable the button
105
+ * @property {Object} aria Aria attributes
106
+ * @property {string} aria.role Aria role, only if the button is not a button
101
107
  */
102
108
  get defaults() {
103
109
  return Object.assign({}, super.defaults, {
@@ -122,10 +128,16 @@ class MessageStateButton extends Popper {
122
128
  features: {
123
129
  disableButton: false,
124
130
  },
131
+
132
+ aria: {
133
+ role: null,
134
+ label: null,
135
+ },
125
136
  });
126
137
  }
127
138
 
128
139
  /**
140
+ * @return {void}
129
141
  */
130
142
  [assembleMethodSymbol]() {
131
143
  super[assembleMethodSymbol]();
@@ -150,7 +162,6 @@ class MessageStateButton extends Popper {
150
162
  initEventHandlerByMode.call(this, mode);
151
163
  }
152
164
 
153
- return this;
154
165
  }
155
166
 
156
167
  /**
@@ -286,7 +297,7 @@ class MessageStateButton extends Popper {
286
297
 
287
298
  /**
288
299
  *
289
- * @return {Array<CSSStyleSheet>}
300
+ * @return {CSSStyleSheet[]}
290
301
  */
291
302
  static getCSSStyleSheet() {
292
303
  const styles = Popper.getCSSStyleSheet();
@@ -391,14 +402,17 @@ function getTemplate() {
391
402
  <div data-monster-role="control" part="control">
392
403
 
393
404
  <monster-state-button exportparts="button:button-button,control:button-control"
394
- data-monster-attributes="data-monster-option-classes-button path:classes.button, disabled path:features.disableButton | if:true"
405
+ data-monster-attributes="
406
+ data-monster-option-classes-button path:classes.button,
407
+ data-monster-option-aria-role path:aria.role,
408
+ data-monster-option-aria-label path:aria.label,
409
+ disabled path:features.disableButton | if:true"
395
410
  part="button"
396
411
  name="button"
397
412
  data-monster-role="button">
398
413
  <span data-monster-replace="path:labels.button"></span>
399
414
  </monster-state-button>
400
415
 
401
-
402
416
  <div data-monster-role="popper" part="popper" tabindex="-1" class="monster-color-primary-1">
403
417
  <div data-monster-role="arrow"></div>
404
418
  <div data-monster-role="message" part="message" class="flex"
@@ -13,9 +13,7 @@
13
13
  */
14
14
 
15
15
  import { instanceSymbol } from "../../constants.mjs";
16
- import { addAttributeToken } from "../../dom/attributes.mjs";
17
16
  import {
18
- ATTRIBUTE_ERRORMESSAGE,
19
17
  ATTRIBUTE_ROLE,
20
18
  } from "../../dom/constants.mjs";
21
19
  import {
@@ -25,7 +23,7 @@ import {
25
23
  import { getDocument } from "../../dom/util.mjs";
26
24
  import { isFunction } from "../../types/is.mjs";
27
25
  import { DeadMansSwitch } from "../../util/deadmansswitch.mjs";
28
- import { Popper } from "./popper.mjs";
26
+ import { Popper } from "../layout/popper.mjs";
29
27
  import { STYLE_DISPLAY_MODE_BLOCK } from "./constants.mjs";
30
28
  import { PopperButtonStyleSheet } from "./stylesheet/popper-button.mjs";
31
29
  import { positionPopper } from "./util/floating-ui.mjs";
@@ -80,51 +78,6 @@ const popperElementSymbol = Symbol("popperElement");
80
78
  */
81
79
  const arrowElementSymbol = Symbol("arrowElement");
82
80
 
83
- /**
84
- * This action callback executes the actions when a button is clicked.
85
- *
86
- * @callback Monster.Components.Form~exampleActionCallback
87
- * @param {Event} e Event
88
- * @this {CustomControl}
89
- */
90
-
91
- /**
92
- * The PopperButton is a button that opens a popper element.
93
- *
94
- * <img src="./images/popper-button.png">
95
- *
96
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
97
- * as well as [pooperjs](https://popper.js.org/docs/v2/).
98
- *
99
- * You can create this control either by specifying the HTML tag <monster-popper-button />` directly in the HTML or using
100
- * Javascript via the `document.createElement('monster-popper-button');` method.
101
- *
102
- * ```html
103
- * <monster-popper-button></monster-popper-button>
104
- * ```
105
- *
106
- * Or you can create this CustomControl directly in Javascript:
107
- *
108
- * ```js
109
- * import {PopperButton} from '@schukai/component-form/source/popper-button.js';
110
- * document.createElement('monster-popper-button');
111
- * ```
112
- *
113
- * The `data-monster-option-classes-button` attribute can be used to change the CSS class of the button.
114
- *
115
- * @startuml popper-button.png
116
- * skinparam monochrome true
117
- * skinparam shadowing false
118
- * HTMLElement <|-- CustomElement
119
- * CustomElement <|-- CustomControl
120
- * CustomControl <|-- Popper
121
- * Popper <|-- PopperButton
122
- * @enduml
123
- *
124
- * @copyright schukai GmbH
125
- * @summary A popper button
126
- */
127
-
128
81
  /**
129
82
  * A beautiful popper button that can make your life easier and also looks good.
130
83
  *
@@ -158,13 +111,19 @@ class PopperButton extends Popper {
158
111
  *
159
112
  * The individual configuration values can be found in the table.
160
113
  *
161
- * @property {Object} templates - The templates for the control.
162
- * @property {string} templates.main - The main template.
163
- * @property {object} labels - The labels for the control.
164
- * @property {string} labels.button - The label for the button.
165
- * @property {string} content - The content of the popper.
166
- * @property {object} popper - The popper options.
167
- * @extends {Button.defaults}
114
+ * @property {Object} templates The templates for the control.
115
+ * @property {string} templates.main The main template.
116
+ * @property {Object} actions The actions for the control.
117
+ * @property {Function} actions.click The click action.
118
+ * @property {Object} classes The classes for the control.
119
+ * @property {string} classes.button The button class.
120
+ * @property {Object} labels The labels for the control.
121
+ * @property {string} labels.button The button label.
122
+ * @property {string} mode The mode of the control.
123
+ * @property {string} value The value of the control.
124
+ * @property {Object} aria The aria attributes for the control.
125
+ * @property {string} aria.role The role of the control, only if the control is not a button.
126
+ * @property {string} aria.label The label of the control.
168
127
  */
169
128
  get defaults() {
170
129
  return Object.assign({}, super.defaults, {
@@ -184,19 +143,25 @@ class PopperButton extends Popper {
184
143
  },
185
144
  mode: "click",
186
145
  value: null,
146
+
147
+ aria: {
148
+ role: null,
149
+ label: null,
150
+ },
151
+
187
152
  });
188
153
  }
189
154
 
190
155
  /**
191
156
  *
192
- * @return {Monster.Components.Form.PopperButton}
157
+ * @return {void}
193
158
  */
194
159
  [assembleMethodSymbol]() {
195
160
  super[assembleMethodSymbol]();
196
161
  initControlReferences.call(this);
197
162
  initEventHandler.call(this);
198
163
 
199
- return this;
164
+ return;
200
165
  }
201
166
 
202
167
  /**
@@ -443,7 +408,10 @@ function getTemplate() {
443
408
  <button data-monster-attributes="disabled path:disabled | if:true, class path:classes.button"
444
409
  data-monster-role="button"
445
410
  part="button"
411
+ aria-labelledby="monster-popper-button-aria-label"
446
412
  data-monster-replace="path:labels.button"></button>
413
+ <div id="monster-popper-button-aria-label"
414
+ class="visually-hidden" data-monster-replace="path:aria.label">click me</div>
447
415
 
448
416
  <div data-monster-role="popper" part="popper" tabindex="-1" class="monster-color-primary-1">
449
417
  <div data-monster-role="arrow"></div>