ariadne_view_components 0.0.50-x86_64-darwin → 0.0.52-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/assets/builds/ariadne_view_components.css +21 -0
- data/app/assets/javascripts/ariadne_view_components.js +1 -1
- data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
- data/app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts +2 -3
- data/app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +1 -0
- data/app/components/ariadne/action_card_component.html.erb +4 -2
- data/app/components/ariadne/action_card_component.rb +52 -9
- data/app/components/ariadne/combobox_component.rb +1 -1
- data/app/components/ariadne/options_controller/options_controller.d.ts +2 -3
- data/app/components/ariadne/options_controller/options_controller.js +13 -27
- data/app/components/ariadne/options_controller/options_controller.ts +12 -30
- data/app/components/ariadne/string_match_controller/string_match_controller.ts +1 -0
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +1 -0
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.js +20 -0
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.ts +23 -0
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +2 -2
- data/lib/ariadne/view_components/linters/autocorrectable.rb +1 -1
- data/lib/ariadne/view_components/linters/base_linter.rb +2 -2
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/rubocop/cop/ariadne/base_cop.rb +1 -1
- data/static/constants.json +18 -3
- metadata +2 -2
@@ -30,10 +30,9 @@ export default class OptionsController extends SyncedBooleanAttributesController
|
|
30
30
|
activeOptionsValue: TActiveOptions;
|
31
31
|
readonly isMultiValue: boolean;
|
32
32
|
readonly toggleableValue: boolean;
|
33
|
-
optionTargetLookup: Map<Element, TOptionKey>;
|
34
|
-
connect(): void;
|
35
33
|
select(event: Event, updateTo?: TOutletChangeData<TActiveOptions>): void;
|
36
|
-
|
34
|
+
optionTargetConnected(element: Element): void;
|
35
|
+
getValueForElement(element: Element): boolean;
|
37
36
|
getState(): TActiveOptions;
|
38
37
|
outletUpdate: (event: Event, updateTo?: TOutletChangeData<TActiveOptions>) => void;
|
39
38
|
}
|
@@ -41,4 +41,5 @@ export default class SyncedBooleanAttributesController<T> extends OutletManagerC
|
|
41
41
|
updateAttributesForElement(element: Element, value: boolean): void;
|
42
42
|
syncElementAttributes(): void;
|
43
43
|
validateAttrChange(dispatchEvent: TStimulusDispatchEvent<TSyncAttrDetail>): void;
|
44
|
+
doesElementHaveOnAttrs(element: Element): boolean;
|
44
45
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do |component| %>
|
2
|
-
<%=
|
3
|
-
|
2
|
+
<%= render Ariadne::LinkComponent.new(tag: @link_tag, href: @href, actionable: @actionable, classes: @link_classes, attributes: @link_attributes) do %>
|
3
|
+
<%= icon %>
|
4
|
+
<%= title %>
|
5
|
+
<% end %>
|
4
6
|
<% if actions? %>
|
5
7
|
<div class="<%= @actions_wrapper_classes %>">
|
6
8
|
<% actions.each do |action| %>
|
@@ -1,27 +1,61 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Ariadne
|
4
|
-
#
|
5
|
-
# Add additional usage considerations or best practices that may aid the user to use the component correctly.
|
6
|
-
# @accessibility Add any accessibility considerations
|
4
|
+
# Card of anchor tags (most likely) that are used to navigate around a similar idea
|
7
5
|
class ActionCardComponent < Ariadne::Component
|
8
6
|
DEFAULT_TAG = :div
|
7
|
+
DEFAULT_TITLE_TAG = :h3
|
8
|
+
DEFAULT_ICON_TAG = :svg
|
9
|
+
DEFAULT_ACTION_TAG = :a
|
9
10
|
TAG_OPTIONS = [DEFAULT_TAG].freeze
|
10
11
|
|
11
12
|
DEFAULT_CLASSES = {
|
12
|
-
wrapper: "ariadne-w-
|
13
|
-
actions_wrapper: "ariadne-flex",
|
13
|
+
wrapper: "ariadne-overflow-hidden ariadne-w-96 ariadne-rounded-lg ariadne-mr-4 [&:last]:ariadne-mr-0",
|
14
|
+
actions_wrapper: "ariadne-flex ariadne-w-full",
|
15
|
+
icon: "",
|
16
|
+
link: "ariadne-flex ariadne-flex-col ariadne-items-center",
|
17
|
+
title: "ariadne-text-center ariadne-mb-4 ariadne-text-xl ariadne-font-bold",
|
18
|
+
action: "ariadne-w-full ariadne-flex ariadne-items-center ariadne-justify-center ariadne-py-6 ariadne-text-sm",
|
14
19
|
}
|
15
20
|
|
16
21
|
DEFAULT_ATTRIBUTES = {
|
17
22
|
wrapper: {},
|
23
|
+
link: {},
|
24
|
+
icon: {},
|
25
|
+
title: {},
|
26
|
+
action: {},
|
18
27
|
}
|
19
28
|
|
20
|
-
renders_one :icon,
|
29
|
+
renders_one :icon, lambda { |tag: DEFAULT_ICON_TAG, icon: :inbox, size: :lg, variant: HeroiconsHelper::Icon::VARIANT_OUTLINE, classes: "", attributes: {}, text_classes: "", text_attributes: {}|
|
30
|
+
Ariadne::HeroiconComponent.new(
|
31
|
+
tag: tag,
|
32
|
+
size: size,
|
33
|
+
variant: variant,
|
34
|
+
classes: merge_class_names(DEFAULT_CLASSES[:icon], classes),
|
35
|
+
attributes: DEFAULT_ATTRIBUTES[:icon].merge(attributes),
|
36
|
+
text_classes: text_classes,
|
37
|
+
text_attributes: text_attributes,
|
38
|
+
icon: icon,
|
39
|
+
)
|
40
|
+
}
|
21
41
|
|
22
|
-
renders_one :title,
|
42
|
+
renders_one :title, lambda { |tag: DEFAULT_TITLE_TAG, classes: "", attributes: {}|
|
43
|
+
Ariadne::HeadingComponent.new(
|
44
|
+
tag: tag,
|
45
|
+
classes: merge_class_names(DEFAULT_CLASSES[:title], classes),
|
46
|
+
attributes: DEFAULT_ATTRIBUTES[:title].merge(attributes),
|
47
|
+
)
|
48
|
+
}
|
23
49
|
|
24
|
-
renders_many :actions,
|
50
|
+
renders_many :actions, lambda { |tag: DEFAULT_ACTION_TAG, href:, actionable: false, classes: "", attributes: {}|
|
51
|
+
Ariadne::LinkComponent.new(
|
52
|
+
tag: tag,
|
53
|
+
href: href,
|
54
|
+
actionable: actionable,
|
55
|
+
classes: merge_class_names(DEFAULT_CLASSES[:action], classes),
|
56
|
+
attributes: DEFAULT_ATTRIBUTES[:action].merge(attributes),
|
57
|
+
)
|
58
|
+
}
|
25
59
|
|
26
60
|
# @example Default
|
27
61
|
#
|
@@ -32,14 +66,23 @@ module Ariadne
|
|
32
66
|
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
33
67
|
def initialize(
|
34
68
|
tag: DEFAULT_TAG,
|
69
|
+
href:,
|
35
70
|
classes: "",
|
36
71
|
attributes: {},
|
37
|
-
actions_wrapper_classes: ""
|
72
|
+
actions_wrapper_classes: "",
|
73
|
+
actionable: false,
|
74
|
+
link_classes: "",
|
75
|
+
link_attributes: {}
|
38
76
|
)
|
39
77
|
@tag = check_incoming_tag(DEFAULT_TAG, tag)
|
78
|
+
@href = href
|
40
79
|
@classes = merge_class_names(DEFAULT_CLASSES[:wrapper], classes)
|
41
80
|
@attributes = DEFAULT_ATTRIBUTES[:wrapper].merge(attributes)
|
42
81
|
@actions_wrapper_classes = merge_class_names(DEFAULT_CLASSES[:actions_wrapper], actions_wrapper_classes)
|
82
|
+
|
83
|
+
@link_classes = merge_class_names(DEFAULT_CLASSES[:link], link_classes)
|
84
|
+
@link_attributes = DEFAULT_ATTRIBUTES[:link].merge(link_attributes)
|
85
|
+
@actionable = actionable
|
43
86
|
end
|
44
87
|
end
|
45
88
|
end
|
@@ -59,7 +59,7 @@ module Ariadne
|
|
59
59
|
"data-options-toggleable-value": toggleable_options,
|
60
60
|
"data-toggleable-close-on-outside-click-value": close_on_outside_click,
|
61
61
|
"data-toggleable-state-value": initially_open,
|
62
|
-
|
62
|
+
"aria-multiselectable": !single_selection,
|
63
63
|
})
|
64
64
|
.merge(attributes)
|
65
65
|
|
@@ -30,10 +30,9 @@ export default class OptionsController extends SyncedBooleanAttributesController
|
|
30
30
|
activeOptionsValue: TActiveOptions;
|
31
31
|
readonly isMultiValue: boolean;
|
32
32
|
readonly toggleableValue: boolean;
|
33
|
-
optionTargetLookup: Map<Element, TOptionKey>;
|
34
|
-
connect(): void;
|
35
33
|
select(event: Event, updateTo?: TOutletChangeData<TActiveOptions>): void;
|
36
|
-
|
34
|
+
optionTargetConnected(element: Element): void;
|
35
|
+
getValueForElement(element: Element): boolean;
|
37
36
|
getState(): TActiveOptions;
|
38
37
|
outletUpdate: (event: Event, updateTo?: TOutletChangeData<TActiveOptions>) => void;
|
39
38
|
}
|
@@ -3,19 +3,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
5
5
|
};
|
6
|
-
var _OptionsController_instances, _OptionsController_shouldChangeState,
|
6
|
+
var _OptionsController_instances, _OptionsController_shouldChangeState, _OptionsController_activateKey, _OptionsController_deactivateKey, _OptionsController_getElementKey;
|
7
7
|
import SyncedBooleanAttributesController from '../synced_boolean_attributes_controller/synced_boolean_attributes_controller';
|
8
8
|
class OptionsController extends SyncedBooleanAttributesController {
|
9
9
|
constructor() {
|
10
10
|
super(...arguments);
|
11
11
|
_OptionsController_instances.add(this);
|
12
|
-
this.optionTargetLookup = new Map();
|
13
12
|
this.outletUpdate = this.select;
|
14
13
|
}
|
15
|
-
connect() {
|
16
|
-
__classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_buildActiveTargets).call(this);
|
17
|
-
this.syncElementAttributes();
|
18
|
-
}
|
19
14
|
select(event, updateTo = {}) {
|
20
15
|
var _a;
|
21
16
|
const activeOptions = updateTo.data;
|
@@ -30,16 +25,22 @@ class OptionsController extends SyncedBooleanAttributesController {
|
|
30
25
|
if (shouldChangeState) {
|
31
26
|
const willBeActive = !isCurrentlyActive;
|
32
27
|
this.updateAttributesForElement(target, willBeActive);
|
33
|
-
willBeActive ? __classPrivateFieldGet(this, _OptionsController_instances, "m",
|
28
|
+
willBeActive ? __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateKey).call(this, optionKey) : __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_deactivateKey).call(this, optionKey);
|
34
29
|
}
|
35
30
|
}
|
36
31
|
this.sendToOutlets(event, Object.assign(Object.assign({}, updateTo), { data: this.activeOptionsValue }));
|
37
32
|
}
|
33
|
+
optionTargetConnected(element) {
|
34
|
+
const key = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, element);
|
35
|
+
if (this.doesElementHaveOnAttrs(element)) {
|
36
|
+
__classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateKey).call(this, key);
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
__classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_deactivateKey).call(this, key);
|
40
|
+
}
|
41
|
+
}
|
38
42
|
getValueForElement(element) {
|
39
43
|
var _a;
|
40
|
-
if (!this.optionTargetLookup.has(element)) {
|
41
|
-
return null;
|
42
|
-
}
|
43
44
|
const optionKey = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, element);
|
44
45
|
return (_a = this.activeOptionsValue[optionKey]) !== null && _a !== void 0 ? _a : false;
|
45
46
|
}
|
@@ -64,9 +65,9 @@ _OptionsController_instances = new WeakSet(), _OptionsController_shouldChangeSta
|
|
64
65
|
// Was selected and it's active but toggling behavior means it should deactivate
|
65
66
|
// Was selected and it's not on, so it just needs to be turned on
|
66
67
|
return true;
|
67
|
-
},
|
68
|
+
}, _OptionsController_activateKey = function _OptionsController_activateKey(key) {
|
68
69
|
this.activeOptionsValue = Object.assign(Object.assign({}, this.activeOptionsValue), { [key]: true });
|
69
|
-
},
|
70
|
+
}, _OptionsController_deactivateKey = function _OptionsController_deactivateKey(key) {
|
70
71
|
const copy = Object.assign({}, this.activeOptionsValue);
|
71
72
|
delete copy[key];
|
72
73
|
this.activeOptionsValue = copy;
|
@@ -76,21 +77,6 @@ _OptionsController_instances = new WeakSet(), _OptionsController_shouldChangeSta
|
|
76
77
|
return elementValue;
|
77
78
|
}
|
78
79
|
return element.innerText.trim();
|
79
|
-
}, _OptionsController_buildActiveTargets = function _OptionsController_buildActiveTargets() {
|
80
|
-
this.optionTargetLookup = new Map();
|
81
|
-
for (let index in this.optionTargets) {
|
82
|
-
const target = this.optionTargets[index];
|
83
|
-
const optionKey = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, target);
|
84
|
-
this.optionTargetLookup.set(target, optionKey);
|
85
|
-
const onSyncAttr = !!this.syncedAttrsValue.find(attr => target.getAttribute(attr) === 'true');
|
86
|
-
if (onSyncAttr) {
|
87
|
-
__classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateIndex).call(this, optionKey);
|
88
|
-
}
|
89
|
-
else {
|
90
|
-
const hasOffAttr = !!this.antiAttrsValue.find(attr => target.getAttribute(attr) === 'false');
|
91
|
-
hasOffAttr && __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateIndex).call(this, optionKey);
|
92
|
-
}
|
93
|
-
}
|
94
80
|
};
|
95
81
|
OptionsController.outlets = SyncedBooleanAttributesController.outlets;
|
96
82
|
OptionsController.targets = ['option'];
|
@@ -29,13 +29,6 @@ export default class OptionsController
|
|
29
29
|
declare readonly isMultiValue: boolean
|
30
30
|
declare readonly toggleableValue: boolean
|
31
31
|
|
32
|
-
optionTargetLookup: Map<Element, TOptionKey> = new Map()
|
33
|
-
|
34
|
-
connect(): void {
|
35
|
-
this.#buildActiveTargets()
|
36
|
-
this.syncElementAttributes()
|
37
|
-
}
|
38
|
-
|
39
32
|
select(event: Event, updateTo: TOutletChangeData<TActiveOptions> = {}) {
|
40
33
|
const activeOptions = updateTo.data
|
41
34
|
for (let index in this.optionTargets) {
|
@@ -51,13 +44,22 @@ export default class OptionsController
|
|
51
44
|
if (shouldChangeState) {
|
52
45
|
const willBeActive = !isCurrentlyActive
|
53
46
|
this.updateAttributesForElement(target, willBeActive)
|
54
|
-
willBeActive ? this.#
|
47
|
+
willBeActive ? this.#activateKey(optionKey) : this.#deactivateKey(optionKey)
|
55
48
|
}
|
56
49
|
}
|
57
50
|
|
58
51
|
this.sendToOutlets(event, {...updateTo, data: this.activeOptionsValue})
|
59
52
|
}
|
60
53
|
|
54
|
+
optionTargetConnected(element: Element) {
|
55
|
+
const key = this.#getElementKey(element)
|
56
|
+
if (this.doesElementHaveOnAttrs(element)) {
|
57
|
+
this.#activateKey(key)
|
58
|
+
} else {
|
59
|
+
this.#deactivateKey(key)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
61
63
|
#shouldChangeState(isCurrentlyActive: boolean, wasSelected: boolean) {
|
62
64
|
if (!wasSelected && !isCurrentlyActive) {
|
63
65
|
// Not currently on and wasn't selected, no reason to change
|
@@ -80,11 +82,11 @@ export default class OptionsController
|
|
80
82
|
return true
|
81
83
|
}
|
82
84
|
|
83
|
-
#
|
85
|
+
#activateKey(key: TOptionKey) {
|
84
86
|
this.activeOptionsValue = {...this.activeOptionsValue, [key]: true}
|
85
87
|
}
|
86
88
|
|
87
|
-
#
|
89
|
+
#deactivateKey(key: TOptionKey) {
|
88
90
|
const copy = {...this.activeOptionsValue}
|
89
91
|
delete copy[key]
|
90
92
|
this.activeOptionsValue = copy
|
@@ -99,27 +101,7 @@ export default class OptionsController
|
|
99
101
|
return (element as HTMLElement).innerText.trim()
|
100
102
|
}
|
101
103
|
|
102
|
-
#buildActiveTargets() {
|
103
|
-
this.optionTargetLookup = new Map()
|
104
|
-
for (let index in this.optionTargets) {
|
105
|
-
const target = this.optionTargets[index]
|
106
|
-
const optionKey = this.#getElementKey(target)
|
107
|
-
this.optionTargetLookup.set(target, optionKey)
|
108
|
-
const onSyncAttr = !!this.syncedAttrsValue.find(attr => target.getAttribute(attr) === 'true')
|
109
|
-
if (onSyncAttr) {
|
110
|
-
this.#activateIndex(optionKey)
|
111
|
-
} else {
|
112
|
-
const hasOffAttr = !!this.antiAttrsValue.find(attr => target.getAttribute(attr) === 'false')
|
113
|
-
hasOffAttr && this.#activateIndex(optionKey)
|
114
|
-
}
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
104
|
getValueForElement(element: Element) {
|
119
|
-
if (!this.optionTargetLookup.has(element)) {
|
120
|
-
return null
|
121
|
-
}
|
122
|
-
|
123
105
|
const optionKey = this.#getElementKey(element)
|
124
106
|
return this.activeOptionsValue[optionKey] ?? false
|
125
107
|
}
|
@@ -41,4 +41,5 @@ export default class SyncedBooleanAttributesController<T> extends OutletManagerC
|
|
41
41
|
updateAttributesForElement(element: Element, value: boolean): void;
|
42
42
|
syncElementAttributes(): void;
|
43
43
|
validateAttrChange(dispatchEvent: TStimulusDispatchEvent<TSyncAttrDetail>): void;
|
44
|
+
doesElementHaveOnAttrs(element: Element): boolean;
|
44
45
|
}
|
@@ -95,6 +95,26 @@ class SyncedBooleanAttributesController extends OutletManagerController {
|
|
95
95
|
}
|
96
96
|
}
|
97
97
|
}
|
98
|
+
doesElementHaveOnAttrs(element) {
|
99
|
+
if (this.hasSyncedAttrsValue) {
|
100
|
+
for (let i = 0; i < this.syncedAttrsValue.length; i++) {
|
101
|
+
const attrName = this.syncedAttrsValue[i];
|
102
|
+
if (element.getAttribute(attrName) === 'true') {
|
103
|
+
return true;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
if (this.hasAntiAttrsValue) {
|
108
|
+
for (let i = 0; i < this.antiAttrsValue.length; i++) {
|
109
|
+
const attrName = this.antiAttrsValue[i];
|
110
|
+
const attrValue = element.getAttribute(attrName);
|
111
|
+
if (attrValue === 'false' || (SyncedBooleanAttributesController.removeOnFalseAttrs[attrName] && !attrValue)) {
|
112
|
+
return true;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
return false;
|
117
|
+
}
|
98
118
|
}
|
99
119
|
_SyncedBooleanAttributesController_instances = new WeakSet(), _SyncedBooleanAttributesController_isSyncedAttr = function _SyncedBooleanAttributesController_isSyncedAttr(attr) {
|
100
120
|
var _a;
|
@@ -131,6 +131,29 @@ export default class SyncedBooleanAttributesController<T> extends OutletManagerC
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
|
134
|
+
doesElementHaveOnAttrs(element: Element) {
|
135
|
+
if (this.hasSyncedAttrsValue) {
|
136
|
+
for (let i = 0; i < this.syncedAttrsValue.length; i++) {
|
137
|
+
const attrName = this.syncedAttrsValue[i]
|
138
|
+
if (element.getAttribute(attrName) === 'true') {
|
139
|
+
return true
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
if (this.hasAntiAttrsValue) {
|
145
|
+
for (let i = 0; i < this.antiAttrsValue.length; i++) {
|
146
|
+
const attrName = this.antiAttrsValue[i]
|
147
|
+
const attrValue = element.getAttribute(attrName)
|
148
|
+
if (attrValue === 'false' || (SyncedBooleanAttributesController.removeOnFalseAttrs[attrName] && !attrValue)) {
|
149
|
+
return true
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
return false
|
155
|
+
}
|
156
|
+
|
134
157
|
#isSyncedAttr(attr: string) {
|
135
158
|
// Helper function to determine if the attr is synced
|
136
159
|
if (this.syncedAttrsLookup === null) {
|
@@ -59,7 +59,7 @@ module Ariadne
|
|
59
59
|
|
60
60
|
unless silence_warnings?
|
61
61
|
message = <<~MSG
|
62
|
-
Ariadne: note that `#{preferred_tag}` is the preferred tag
|
62
|
+
Ariadne: note that `#{preferred_tag}` is the preferred tag for `#{self.class.name}`;
|
63
63
|
you passed `#{given_tag}` (which will still be used)
|
64
64
|
MSG
|
65
65
|
|
@@ -75,7 +75,7 @@ module Ariadne
|
|
75
75
|
|
76
76
|
unless silence_warnings?
|
77
77
|
message = <<~MSG
|
78
|
-
Ariadne: note that `#{preferred_attribute}` is the preferred attribute
|
78
|
+
Ariadne: note that `#{preferred_attribute}` is the preferred attribute for `#{self.class.name}`;
|
79
79
|
you passed `#{given_attribute}` (which will still be used)
|
80
80
|
MSG
|
81
81
|
|
@@ -159,13 +159,13 @@ module ERBLint
|
|
159
159
|
# Unless explicitly set, we don't want to mark correctable offenses if the counter is correct.
|
160
160
|
if !@config.override_ignores_if_correctable? && expected_count == @total_offenses
|
161
161
|
clear_offenses
|
162
|
-
return
|
162
|
+
return false
|
163
163
|
end
|
164
164
|
|
165
165
|
if @offenses_not_corrected.zero?
|
166
166
|
# have to adjust to get `\n` so we delete the whole line
|
167
167
|
add_offense(processed_source.to_source_range(comment_node.loc.adjust(end_pos: 1)), "Unused erblint:count comment for #{rule_name}", "") if comment_node
|
168
|
-
return
|
168
|
+
return false
|
169
169
|
end
|
170
170
|
|
171
171
|
first_offense = @offenses[0]
|
@@ -12,7 +12,7 @@ module RuboCop
|
|
12
12
|
# We only verify SystemArguments if it's a `.new` call on a component or
|
13
13
|
# a ViewHeleper call.
|
14
14
|
def valid_node?(node)
|
15
|
-
return if node.nil?
|
15
|
+
return false if node.nil?
|
16
16
|
|
17
17
|
view_helpers.include?(node.method_name) || (node.method_name == :new && !node.receiver.nil? && ::Ariadne::ViewComponents::STATUSES.key?(node.receiver.const_name))
|
18
18
|
end
|
data/static/constants.json
CHANGED
@@ -1,14 +1,29 @@
|
|
1
1
|
{
|
2
2
|
"Ariadne::ActionCardComponent": {
|
3
|
+
"DEFAULT_ACTION_TAG": "a",
|
3
4
|
"DEFAULT_ATTRIBUTES": {
|
4
5
|
"wrapper": {
|
6
|
+
},
|
7
|
+
"link": {
|
8
|
+
},
|
9
|
+
"icon": {
|
10
|
+
},
|
11
|
+
"title": {
|
12
|
+
},
|
13
|
+
"action": {
|
5
14
|
}
|
6
15
|
},
|
7
16
|
"DEFAULT_CLASSES": {
|
8
|
-
"wrapper": "ariadne-w-
|
9
|
-
"actions_wrapper": "ariadne-flex"
|
10
|
-
|
17
|
+
"wrapper": "ariadne-overflow-hidden ariadne-w-96 ariadne-rounded-lg ariadne-mr-4 [&:last]:ariadne-mr-0",
|
18
|
+
"actions_wrapper": "ariadne-flex ariadne-w-full",
|
19
|
+
"icon": "",
|
20
|
+
"link": "ariadne-flex ariadne-flex-col ariadne-items-center",
|
21
|
+
"title": "ariadne-text-center ariadne-mb-4 ariadne-text-xl ariadne-font-bold",
|
22
|
+
"action": "ariadne-w-full ariadne-flex ariadne-items-center ariadne-justify-center ariadne-py-6 ariadne-text-sm"
|
23
|
+
},
|
24
|
+
"DEFAULT_ICON_TAG": "svg",
|
11
25
|
"DEFAULT_TAG": "div",
|
26
|
+
"DEFAULT_TITLE_TAG": "h3",
|
12
27
|
"TAG_OPTIONS": [
|
13
28
|
"div"
|
14
29
|
]
|
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.
|
4
|
+
version: 0.0.52
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tailwind_merge
|