ariadne_view_components 0.0.54-x64-mingw-ucrt → 0.0.57-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ class AccumulatorController extends Controller {
5
5
  }
6
6
  accumulate() {
7
7
  let sum = 0;
8
- for (let i in this.sumTargets) {
8
+ for (const i in this.sumTargets) {
9
9
  const target = this.sumTargets[i];
10
10
  const value = Number(target.getAttribute(this.sumAttrValue));
11
11
  if (!isNaN(value)) {
@@ -15,7 +15,7 @@ class AccumulatorController extends Controller {
15
15
  this.setAttributesTo(sum);
16
16
  }
17
17
  setAttributesTo(sum) {
18
- for (let i in this.syncAttrsValue) {
18
+ for (const i in this.syncAttrsValue) {
19
19
  const attr = this.syncAttrsValue[i];
20
20
  this.accumulator.setAttribute(attr, sum.toString());
21
21
  }
@@ -24,7 +24,7 @@ export default class AccumulatorController extends Controller {
24
24
 
25
25
  accumulate() {
26
26
  let sum = 0
27
- for (let i in this.sumTargets) {
27
+ for (const i in this.sumTargets) {
28
28
  const target = this.sumTargets[i]
29
29
  const value = Number(target.getAttribute(this.sumAttrValue))
30
30
  if (!isNaN(value)) {
@@ -36,7 +36,7 @@ export default class AccumulatorController extends Controller {
36
36
  }
37
37
 
38
38
  setAttributesTo(sum: number) {
39
- for (let i in this.syncAttrsValue) {
39
+ for (const i in this.syncAttrsValue) {
40
40
  const attr = this.syncAttrsValue[i]
41
41
  this.accumulator.setAttribute(attr, sum.toString())
42
42
  }
@@ -14,7 +14,7 @@ class OptionsController extends SyncedBooleanAttributesController {
14
14
  select(event, updateTo = {}) {
15
15
  var _a;
16
16
  const activeOptions = updateTo.data;
17
- for (let index in this.optionTargets) {
17
+ for (const index in this.optionTargets) {
18
18
  const target = this.optionTargets[index];
19
19
  const wasSelected = target === event.currentTarget;
20
20
  const isCurrentlyActive = (_a = this.getValueForElement(target)) !== null && _a !== void 0 ? _a : false;
@@ -74,11 +74,14 @@ _OptionsController_instances = new WeakSet(), _OptionsController_shouldChangeSta
74
74
  delete copy[key];
75
75
  this.activeOptionsValue = copy;
76
76
  }, _OptionsController_getElementKey = function _OptionsController_getElementKey(element) {
77
- const elementValue = element.getAttribute('data-option-value');
78
- if (elementValue) {
77
+ const elementValue = element === null || element === void 0 ? void 0 : element.getAttribute('data-option-value');
78
+ if (elementValue)
79
79
  return elementValue;
80
+ const content = element === null || element === void 0 ? void 0 : element.textContent;
81
+ if (content === null) {
82
+ throw new Error(`${element.tagName} was given as an options target without a data-option-value or textContent. One must be provided to identify the target.`);
80
83
  }
81
- return element.innerText.trim();
84
+ return content.trim();
82
85
  };
83
86
  OptionsController.outlets = SyncedBooleanAttributesController.outlets;
84
87
  OptionsController.targets = ['option'];
@@ -31,7 +31,7 @@ export default class OptionsController
31
31
 
32
32
  select(event: Event, updateTo: TOutletChangeData<TActiveOptions> = {}) {
33
33
  const activeOptions = updateTo.data
34
- for (let index in this.optionTargets) {
34
+ for (const index in this.optionTargets) {
35
35
  const target = this.optionTargets[index]
36
36
  const wasSelected = target === event.currentTarget
37
37
  const isCurrentlyActive = this.getValueForElement(target) ?? false
@@ -96,12 +96,17 @@ export default class OptionsController
96
96
  }
97
97
 
98
98
  #getElementKey(element: Element) {
99
- const elementValue = element.getAttribute('data-option-value')
100
- if (elementValue) {
101
- return elementValue
99
+ const elementValue = element?.getAttribute('data-option-value')
100
+ if (elementValue) return elementValue
101
+
102
+ const content = (element as HTMLElement)?.textContent
103
+ if (content === null) {
104
+ throw new Error(
105
+ `${element.tagName} was given as an options target without a data-option-value or textContent. One must be provided to identify the target.`,
106
+ )
102
107
  }
103
108
 
104
- return (element as HTMLElement).innerText.trim()
109
+ return content.trim()
105
110
  }
106
111
 
107
112
  getValueForElement(element: Element) {
@@ -15,7 +15,7 @@ class OutletManagerController extends Controller {
15
15
  getOutlets() {
16
16
  return null;
17
17
  }
18
- outletUpdate(event, data) { }
18
+ outletUpdate(event, data) { } // eslint-disable-line no-unused-vars
19
19
  getState() {
20
20
  return null;
21
21
  }
@@ -121,7 +121,7 @@ export default class OutletManagerController<T> extends Controller {
121
121
  return null
122
122
  }
123
123
 
124
- outletUpdate(event: Event, data: TOutletChangeData<T>): void {}
124
+ outletUpdate(event: Event, data: TOutletChangeData<T>): void {} // eslint-disable-line no-unused-vars
125
125
 
126
126
  getState(): T {
127
127
  return null as T
@@ -23,7 +23,7 @@ class StringMatchController extends SyncedBooleanAttributesController {
23
23
  }
24
24
  getValueForElement(element) {
25
25
  var _a, _b;
26
- return (_b = (_a = element.innerText) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.keywordValue.toLowerCase())) !== null && _b !== void 0 ? _b : false;
26
+ return (_b = (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.keywordValue.toLowerCase())) !== null && _b !== void 0 ? _b : false;
27
27
  }
28
28
  getState() {
29
29
  return this.keywordValue;
@@ -32,7 +32,7 @@ class StringMatchController extends SyncedBooleanAttributesController {
32
32
  _StringMatchController_instances = new WeakSet(), _StringMatchController_compareKeywordToTargets = function _StringMatchController_compareKeywordToTargets() {
33
33
  if (this.hasMatchTarget) {
34
34
  let foundMatch = false;
35
- for (let index in this.matchTargets) {
35
+ for (const index in this.matchTargets) {
36
36
  const target = this.matchTargets[index];
37
37
  const value = this.getValueForElement(target);
38
38
  this.updateAttributesForElement(target, value);
@@ -34,7 +34,7 @@ export default class StringMatchController
34
34
  #compareKeywordToTargets() {
35
35
  if (this.hasMatchTarget) {
36
36
  let foundMatch = false
37
- for (let index in this.matchTargets) {
37
+ for (const index in this.matchTargets) {
38
38
  const target = this.matchTargets[index]
39
39
  const value = this.getValueForElement(target)
40
40
  this.updateAttributesForElement(target, value)
@@ -54,7 +54,7 @@ export default class StringMatchController
54
54
  }
55
55
 
56
56
  getValueForElement(element: Element) {
57
- return (element as HTMLElement).innerText?.toLowerCase().includes(this.keywordValue.toLowerCase()) ?? false
57
+ return (element as HTMLElement).textContent?.toLowerCase().includes(this.keywordValue.toLowerCase()) ?? false
58
58
  }
59
59
 
60
60
  getState() {
@@ -108,7 +108,7 @@ class SyncedBooleanAttributesController extends OutletManagerController {
108
108
  // Essentially just a "sync attrs and anti-attrs on mount" function
109
109
  const elements = this.getElementsToSync();
110
110
  if (elements === null || elements === void 0 ? void 0 : elements.length) {
111
- for (let index in elements) {
111
+ for (const index in elements) {
112
112
  const element = elements[index];
113
113
  const value = (_a = this.getValueForElement(element)) !== null && _a !== void 0 ? _a : false;
114
114
  this.updateAttributesForElement(element, value);
@@ -171,7 +171,7 @@ _SyncedBooleanAttributesController_instances = new WeakSet(), _SyncedBooleanAttr
171
171
  // Attempts to change the attr for an element. However, it'll dispatch an event
172
172
  // first so other controllers get the opportunity to deny it
173
173
  const attrState = JSON.stringify(value);
174
- for (let index in attrs) {
174
+ for (const index in attrs) {
175
175
  const attr = attrs[index];
176
176
  const dispatchEvent = this.dispatch('attrChange', {
177
177
  target: element,
@@ -149,7 +149,7 @@ export default class SyncedBooleanAttributesController<T> extends OutletManagerC
149
149
  const elements = this.getElementsToSync()
150
150
 
151
151
  if (elements?.length) {
152
- for (let index in elements) {
152
+ for (const index in elements) {
153
153
  const element = elements[index]
154
154
  const value = this.getValueForElement(element) ?? false
155
155
  this.updateAttributesForElement(element, value)
@@ -222,7 +222,7 @@ export default class SyncedBooleanAttributesController<T> extends OutletManagerC
222
222
  // Attempts to change the attr for an element. However, it'll dispatch an event
223
223
  // first so other controllers get the opportunity to deny it
224
224
  const attrState = JSON.stringify(value)
225
- for (let index in attrs) {
225
+ for (const index in attrs) {
226
226
  const attr = attrs[index]
227
227
 
228
228
  const dispatchEvent = this.dispatch('attrChange', {
@@ -70,5 +70,11 @@ module Ariadne
70
70
  options[:class] = merge_class_names(DEFAULT_PASSWORD_CLASSES, options.delete(:classes))
71
71
  super(method, **options)
72
72
  end
73
+
74
+ DEFAULT_FILE_FIELD_CLASSES = ""
75
+ def file_field(method, options = {})
76
+ options[:class] = merge_class_names(DEFAULT_FILE_FIELD_CLASSES, options.delete(:classes))
77
+ super(method, **options)
78
+ end
73
79
  end
74
80
  end
@@ -3,6 +3,6 @@
3
3
  # :nocov:
4
4
  module Ariadne
5
5
  module ViewComponents
6
- VERSION = "0.0.54"
6
+ VERSION = "0.0.57"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ariadne_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.54
4
+ version: 0.0.57
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-13 00:00:00.000000000 Z
11
+ date: 2023-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tailwind_merge
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  - !ruby/object:Gem::Version
343
343
  version: '0'
344
344
  requirements: []
345
- rubygems_version: 3.4.16
345
+ rubygems_version: 3.4.17
346
346
  signing_key:
347
347
  specification_version: 4
348
348
  summary: ViewComponents for the Ariadne Design System