ariadne_view_components 0.0.58 → 0.0.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +70 -0
- data/LICENSE.txt +661 -49
- data/README.md +52 -4
- data/app/assets/javascripts/ariadne_view_components.js +98 -7
- data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
- data/app/assets/stylesheets/ariadne_view_components.css +1 -7
- data/app/components/ariadne/base_component.rb +79 -27
- data/app/components/ariadne/behaviors/tooltipable.rb +120 -0
- data/app/components/ariadne/conditional_wrapper.rb +21 -0
- data/app/components/ariadne/form/base_component.rb +74 -0
- data/app/components/ariadne/form/base_input_component.rb +60 -0
- data/app/components/ariadne/form/caption/component.html.erb +10 -0
- data/app/components/ariadne/form/caption/component.rb +29 -0
- data/app/components/ariadne/form/form_control/component.html.erb +19 -0
- data/app/components/ariadne/form/form_control/component.rb +27 -0
- data/app/components/ariadne/form/form_reference/component.html.erb +1 -0
- data/app/components/ariadne/form/form_reference/component.rb +18 -0
- data/app/components/ariadne/form/group/component.html.erb +5 -0
- data/app/components/ariadne/form/group/component.rb +27 -0
- data/app/components/ariadne/form/hidden_field/component.html.erb +1 -0
- data/app/components/ariadne/form/hidden_field/component.rb +15 -0
- data/app/components/ariadne/form/separator/component.html.erb +1 -0
- data/app/components/ariadne/form/separator/component.rb +8 -0
- data/app/components/ariadne/form/spacing_wrapper/component.html.erb +3 -0
- data/app/components/ariadne/form/spacing_wrapper/component.rb +8 -0
- data/app/components/ariadne/form/text_field/component.html.erb +25 -0
- data/app/components/ariadne/form/text_field/component.rb +132 -0
- data/app/components/ariadne/form/validation_message/component.html.erb +5 -0
- data/app/components/ariadne/form/validation_message/component.rb +14 -0
- data/app/components/ariadne/layout/narrow/component.html.erb +10 -0
- data/app/components/ariadne/layout/narrow/component.rb +24 -0
- data/app/components/ariadne/layout/nav_bar/component.css +0 -0
- data/app/components/ariadne/layout/nav_bar/component.html.erb +123 -0
- data/app/components/ariadne/layout/nav_bar/component.rb +77 -0
- data/app/components/ariadne/ui/button/component.html.erb +5 -0
- data/app/components/ariadne/ui/button/component.rb +184 -0
- data/app/components/ariadne/ui/clipboard_copy/component.html.erb +8 -0
- data/app/components/ariadne/ui/clipboard_copy/component.rb +102 -0
- data/app/components/ariadne/ui/clipboard_copy/component.ts +54 -0
- data/app/components/ariadne/ui/combobox/component.html.erb +32 -0
- data/app/components/ariadne/ui/combobox/component.rb +83 -0
- data/app/components/ariadne/ui/combobox/component.ts +119 -0
- data/app/components/ariadne/ui/combobox/menu_item/component.html.erb +9 -0
- data/app/components/ariadne/ui/combobox/menu_item/component.rb +53 -0
- data/app/components/ariadne/ui/combobox/option/component.html.erb +11 -0
- data/app/components/ariadne/ui/combobox/option/component.rb +45 -0
- data/app/components/ariadne/ui/heroicon/component.html.erb +3 -0
- data/app/components/ariadne/ui/heroicon/component.rb +141 -0
- data/app/components/ariadne/ui/image/component.rb +69 -0
- data/app/components/ariadne/ui/link/component.html.erb +3 -0
- data/app/components/ariadne/ui/link/component.rb +56 -0
- data/app/components/ariadne/ui/typography/component.html.erb +3 -0
- data/app/components/ariadne/ui/typography/component.rb +41 -0
- data/app/lib/ariadne/attributes_helper.rb +119 -0
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +1 -1
- data/app/lib/ariadne/form.rb +16 -0
- data/app/lib/ariadne/view_helper.rb +2 -5
- data/app/lib/view_components_contrib/html_attrs.rb +64 -0
- data/app/lib/view_components_contrib/style_variants.rb +14 -0
- data/lib/ariadne/forms/acts_as_component.rb +125 -0
- data/lib/ariadne/forms/base.html.erb +8 -0
- data/lib/ariadne/forms/base.rb +132 -0
- data/lib/ariadne/forms/buffer_rewriter.rb +51 -0
- data/lib/ariadne/forms/builder.rb +88 -0
- data/lib/ariadne/forms/dsl/button_input.rb +33 -0
- data/lib/ariadne/forms/dsl/form_object.rb +26 -0
- data/lib/ariadne/forms/dsl/input.rb +322 -0
- data/lib/ariadne/forms/dsl/input_group.rb +34 -0
- data/lib/ariadne/forms/dsl/input_methods.rb +157 -0
- data/lib/ariadne/forms/dsl/submit_button_input.rb +36 -0
- data/lib/ariadne/forms/dsl/text_field_input.rb +73 -0
- data/lib/ariadne/forms/utils.rb +34 -0
- data/lib/ariadne/generate.rb +11 -0
- data/lib/ariadne/view_components/engine.rb +24 -7
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/ariadne/view_components.rb +1 -1
- data/lib/ariadne/yard/backend.rb +24 -0
- data/lib/ariadne/yard/component_manifest.rb +148 -0
- data/lib/ariadne/yard/component_ref.rb +49 -0
- data/lib/ariadne/yard/docs_helper.rb +98 -0
- data/lib/ariadne/yard/info_arch_docs_helper.rb +31 -0
- data/lib/ariadne/yard/lookbook_docs_helper.rb +32 -0
- data/lib/ariadne/yard/lookbook_pages_backend.rb +235 -0
- data/lib/ariadne/yard/registry.rb +136 -0
- data/lib/ariadne/yard/renders_many_handler.rb +23 -0
- data/lib/ariadne/yard/renders_one_handler.rb +23 -0
- data/lib/ariadne/yard.rb +19 -0
- data/static/arguments.yml +141 -48
- data/static/audited_at.json +0 -9
- data/static/classes.yml +210 -209
- data/static/constants.json +2 -209
- data/static/statuses.json +0 -9
- metadata +125 -210
- data/app/assets/builds/ariadne_view_components.css +0 -2202
- data/app/assets/javascripts/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
- data/app/assets/javascripts/components/ariadne/ariadne-form.d.ts +0 -22
- data/app/assets/javascripts/components/ariadne/ariadne.d.ts +0 -2
- data/app/assets/javascripts/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
- data/app/assets/javascripts/components/ariadne/dropdown/menu_component.d.ts +0 -1
- data/app/assets/javascripts/components/ariadne/events_controller/events_controller.d.ts +0 -4
- data/app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts +0 -39
- data/app/assets/javascripts/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
- data/app/assets/javascripts/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
- data/app/assets/javascripts/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
- data/app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
- data/app/assets/javascripts/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
- data/app/assets/javascripts/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
- data/app/assets/javascripts/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
- data/app/assets/javascripts/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
- data/app/assets/javascripts/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
- data/app/assets/stylesheets/dropdown.css +0 -46
- data/app/assets/stylesheets/prosemirror.css +0 -323
- data/app/assets/stylesheets/tooltip-component.css +0 -37
- data/app/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
- data/app/components/ariadne/accumulator_controller/accumulator_controller.js +0 -39
- data/app/components/ariadne/accumulator_controller/accumulator_controller.ts +0 -48
- data/app/components/ariadne/action_card_component.html.erb +0 -13
- data/app/components/ariadne/action_card_component.rb +0 -88
- data/app/components/ariadne/ariadne-form.d.ts +0 -22
- data/app/components/ariadne/ariadne-form.js +0 -85
- data/app/components/ariadne/ariadne.d.ts +0 -2
- data/app/components/ariadne/ariadne.js +0 -24
- data/app/components/ariadne/ariadne.ts +0 -29
- data/app/components/ariadne/avatar_component.rb +0 -81
- data/app/components/ariadne/avatar_stack_component/avatar_stack_component.html.erb +0 -12
- data/app/components/ariadne/avatar_stack_component.rb +0 -75
- data/app/components/ariadne/base_button.rb +0 -70
- data/app/components/ariadne/blankslate_component/blankslate_component.html.erb +0 -26
- data/app/components/ariadne/blankslate_component.rb +0 -148
- data/app/components/ariadne/body_component.rb +0 -30
- data/app/components/ariadne/bottom_tab_component.html.erb +0 -4
- data/app/components/ariadne/bottom_tab_component.rb +0 -44
- data/app/components/ariadne/bottom_tab_nav_component.html.erb +0 -5
- data/app/components/ariadne/bottom_tab_nav_component.rb +0 -33
- data/app/components/ariadne/breadcrumbs_component.html.erb +0 -13
- data/app/components/ariadne/breadcrumbs_component.rb +0 -31
- data/app/components/ariadne/button_component/button_component.html.erb +0 -4
- data/app/components/ariadne/button_component.rb +0 -165
- data/app/components/ariadne/checkbox_component.html.erb +0 -5
- data/app/components/ariadne/checkbox_component.rb +0 -43
- data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
- data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.js +0 -18
- data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.ts +0 -19
- data/app/components/ariadne/clipboard_copy_component/clipboard_copy_component.html.erb +0 -9
- data/app/components/ariadne/clipboard_copy_component.rb +0 -90
- data/app/components/ariadne/close_button_component.html.erb +0 -4
- data/app/components/ariadne/close_button_component.rb +0 -33
- data/app/components/ariadne/combobox_component.html.erb +0 -14
- data/app/components/ariadne/combobox_component.rb +0 -76
- data/app/components/ariadne/component.rb +0 -127
- data/app/components/ariadne/container_component/container_component.html.erb +0 -3
- data/app/components/ariadne/container_component.rb +0 -25
- data/app/components/ariadne/content.rb +0 -12
- data/app/components/ariadne/counter_component.rb +0 -100
- data/app/components/ariadne/details_component/details_component.html.erb +0 -4
- data/app/components/ariadne/details_component.rb +0 -81
- data/app/components/ariadne/dropdown/menu_component.d.ts +0 -1
- data/app/components/ariadne/dropdown/menu_component.html.erb +0 -20
- data/app/components/ariadne/dropdown/menu_component.js +0 -1
- data/app/components/ariadne/dropdown/menu_component.rb +0 -101
- data/app/components/ariadne/dropdown/menu_component.ts +0 -1
- data/app/components/ariadne/dropdown_component/dropdown_component.html.erb +0 -8
- data/app/components/ariadne/dropdown_component.rb +0 -172
- data/app/components/ariadne/events_controller/events_controller.d.ts +0 -4
- data/app/components/ariadne/events_controller/events_controller.js +0 -6
- data/app/components/ariadne/events_controller/events_controller.ts +0 -7
- data/app/components/ariadne/flash_component/flash_component.html.erb +0 -31
- data/app/components/ariadne/flash_component.rb +0 -128
- data/app/components/ariadne/flex_component/flex_component.html.erb +0 -5
- data/app/components/ariadne/flex_component.rb +0 -56
- data/app/components/ariadne/footer_component/footer_component.html.erb +0 -7
- data/app/components/ariadne/footer_component.rb +0 -23
- data/app/components/ariadne/grid_component/grid_component.html.erb +0 -26
- data/app/components/ariadne/grid_component.rb +0 -67
- data/app/components/ariadne/header_component/header_component.html.erb +0 -29
- data/app/components/ariadne/header_component.rb +0 -111
- data/app/components/ariadne/heading_component.rb +0 -49
- data/app/components/ariadne/heroicon_component/heroicon_component.html.erb +0 -4
- data/app/components/ariadne/heroicon_component.rb +0 -166
- data/app/components/ariadne/image_component.rb +0 -53
- data/app/components/ariadne/inline_flex_component/inline_flex_component.html.erb +0 -6
- data/app/components/ariadne/inline_flex_component.rb +0 -72
- data/app/components/ariadne/layout_component.html.erb +0 -21
- data/app/components/ariadne/layout_component.rb +0 -69
- data/app/components/ariadne/link_component.rb +0 -65
- data/app/components/ariadne/list_component/list_component.html.erb +0 -3
- data/app/components/ariadne/list_component.rb +0 -70
- data/app/components/ariadne/modal_component.html.erb +0 -11
- data/app/components/ariadne/modal_component.rb +0 -88
- data/app/components/ariadne/narrow_container_component/narrow_container_component.html.erb +0 -3
- data/app/components/ariadne/narrow_container_component.rb +0 -30
- data/app/components/ariadne/options_controller/options_controller.d.ts +0 -39
- data/app/components/ariadne/options_controller/options_controller.js +0 -89
- data/app/components/ariadne/options_controller/options_controller.ts +0 -122
- data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
- data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.js +0 -237
- data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.ts +0 -278
- data/app/components/ariadne/panel_bar_component/panel_bar_component.html.erb +0 -20
- data/app/components/ariadne/panel_bar_component.rb +0 -80
- data/app/components/ariadne/pill_component/pill_component.html.erb +0 -3
- data/app/components/ariadne/pill_component.rb +0 -44
- data/app/components/ariadne/popover_component.html.erb +0 -10
- data/app/components/ariadne/popover_component.rb +0 -81
- data/app/components/ariadne/progress_bar_component.html.erb +0 -5
- data/app/components/ariadne/progress_bar_component.rb +0 -63
- data/app/components/ariadne/relative_time_component.html.erb +0 -3
- data/app/components/ariadne/relative_time_component.rb +0 -61
- data/app/components/ariadne/show_more_button_component.html.erb +0 -11
- data/app/components/ariadne/show_more_button_component.rb +0 -47
- data/app/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
- data/app/components/ariadne/slideover_component/slideover-component.js +0 -11
- data/app/components/ariadne/slideover_component/slideover-component.ts +0 -17
- data/app/components/ariadne/slideover_component/slideover_component.html.erb +0 -9
- data/app/components/ariadne/slideover_component.rb +0 -66
- data/app/components/ariadne/spinner_component.html.erb +0 -16
- data/app/components/ariadne/spinner_component.rb +0 -45
- data/app/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
- data/app/components/ariadne/string_match_controller/string_match_controller.js +0 -51
- data/app/components/ariadne/string_match_controller/string_match_controller.ts +0 -65
- data/app/components/ariadne/subheader_component.html.erb +0 -11
- data/app/components/ariadne/subheader_component.rb +0 -65
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.js +0 -207
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.ts +0 -256
- data/app/components/ariadne/tab_component/tab_component.html.erb +0 -3
- data/app/components/ariadne/tab_component.rb +0 -98
- data/app/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
- data/app/components/ariadne/tab_container_component/tab-container-component.js +0 -23
- data/app/components/ariadne/tab_container_component/tab-container-component.ts +0 -24
- data/app/components/ariadne/tab_container_component.erb +0 -10
- data/app/components/ariadne/tab_container_component.rb +0 -68
- data/app/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
- data/app/components/ariadne/tab_nav_component/tab-nav-component.js +0 -33
- data/app/components/ariadne/tab_nav_component/tab-nav-component.ts +0 -34
- data/app/components/ariadne/tab_nav_component/tab_nav_component.html.erb +0 -7
- data/app/components/ariadne/tab_nav_component.rb +0 -72
- data/app/components/ariadne/table_nav_component/table_nav_component.html.erb +0 -52
- data/app/components/ariadne/table_nav_component.rb +0 -338
- data/app/components/ariadne/text.rb +0 -25
- data/app/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
- data/app/components/ariadne/time_ago_component/time-ago-component.js +0 -1
- data/app/components/ariadne/time_ago_component/time-ago-component.ts +0 -1
- data/app/components/ariadne/time_ago_component.rb +0 -56
- data/app/components/ariadne/timeline_component/timeline_component.html.erb +0 -19
- data/app/components/ariadne/timeline_component.rb +0 -34
- data/app/components/ariadne/toggle_component/toggle_component.html.erb +0 -15
- data/app/components/ariadne/toggle_component.rb +0 -95
- data/app/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
- data/app/components/ariadne/toggleable_controller/toggleable_controller.js +0 -54
- data/app/components/ariadne/toggleable_controller/toggleable_controller.ts +0 -77
- data/app/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
- data/app/components/ariadne/tooltip_component/tooltip-component.js +0 -43
- data/app/components/ariadne/tooltip_component/tooltip-component.ts +0 -57
- data/app/components/ariadne/tooltip_component/tooltip_component.html.erb +0 -4
- data/app/components/ariadne/tooltip_component.rb +0 -108
- data/app/lib/ariadne/action_view_extensions/form_helper.rb +0 -30
- data/app/lib/ariadne/audited/dsl.rb +0 -32
- data/app/lib/ariadne/form_builder.rb +0 -80
- data/app/lib/ariadne/status/dsl.rb +0 -41
- data/config/importmap.rb +0 -3
- data/exe/tailwindcss +0 -21
- data/lib/rubocop/cop/ariadne/base_cop.rb +0 -26
- data/tailwind.config.js +0 -70
@@ -1,237 +0,0 @@
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
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
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
5
|
-
};
|
6
|
-
var _OutletManagerController_instances, _OutletManagerController_outlets_get;
|
7
|
-
import { Controller } from '@hotwired/stimulus';
|
8
|
-
class OutletManagerController extends Controller {
|
9
|
-
constructor() {
|
10
|
-
super(...arguments);
|
11
|
-
_OutletManagerController_instances.add(this);
|
12
|
-
this.outletEventsLookup = null;
|
13
|
-
this.eventRecords = new Map();
|
14
|
-
}
|
15
|
-
getOutlets() {
|
16
|
-
return null;
|
17
|
-
}
|
18
|
-
outletUpdate(event, data) { } // eslint-disable-line no-unused-vars
|
19
|
-
getState() {
|
20
|
-
return null;
|
21
|
-
}
|
22
|
-
connect() {
|
23
|
-
this.syncOutlets();
|
24
|
-
}
|
25
|
-
syncOutlets() {
|
26
|
-
const event = new Event('init');
|
27
|
-
this.sendToOutlets(event, {
|
28
|
-
data: this.getState(),
|
29
|
-
eventKey: this.getEventKey(event),
|
30
|
-
});
|
31
|
-
}
|
32
|
-
sendToOutlets(event, updateTo = {}) {
|
33
|
-
var _a;
|
34
|
-
const eventKey = (_a = updateTo.eventKey) !== null && _a !== void 0 ? _a : this.getEventKey(event);
|
35
|
-
const outlets = __classPrivateFieldGet(this, _OutletManagerController_instances, "a", _OutletManagerController_outlets_get);
|
36
|
-
if (outlets === null || outlets === void 0 ? void 0 : outlets.length) {
|
37
|
-
for (const index in outlets) {
|
38
|
-
const outlet = outlets[index];
|
39
|
-
if (outlet.isListeningForOutletEvent(eventKey) && !this.hasHeardEvent(event)) {
|
40
|
-
const isSameControllerType = this.identifier === outlet.identifier;
|
41
|
-
outlet.outletUpdate(event, { eventKey, data: isSameControllerType ? updateTo.data : undefined });
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
isListeningForOutletEvent(eventTypes) {
|
47
|
-
const eventTypeNames = eventTypes.split('-');
|
48
|
-
if (!eventTypeNames.length) {
|
49
|
-
return false;
|
50
|
-
}
|
51
|
-
let lookup = this.outletEvents;
|
52
|
-
for (let i = 0; i < eventTypeNames.length; i++) {
|
53
|
-
const name = eventTypeNames[i];
|
54
|
-
if (typeof lookup === 'boolean') {
|
55
|
-
return lookup;
|
56
|
-
}
|
57
|
-
const hasWildCard = lookup['*'] !== undefined;
|
58
|
-
let nextKey = name;
|
59
|
-
if (hasWildCard) {
|
60
|
-
nextKey = '*';
|
61
|
-
}
|
62
|
-
else {
|
63
|
-
const isListeningForDOMEvent = lookup.domEvent !== undefined;
|
64
|
-
if (isListeningForDOMEvent && !this.isDOMEventName(name)) {
|
65
|
-
return false;
|
66
|
-
}
|
67
|
-
else if (isListeningForDOMEvent) {
|
68
|
-
nextKey = 'domEvent';
|
69
|
-
}
|
70
|
-
}
|
71
|
-
if (!lookup[nextKey]) {
|
72
|
-
return false;
|
73
|
-
}
|
74
|
-
lookup = lookup[nextKey];
|
75
|
-
}
|
76
|
-
return true;
|
77
|
-
}
|
78
|
-
isDOMEventName(eventName) {
|
79
|
-
return OutletManagerController.domEvents[eventName];
|
80
|
-
}
|
81
|
-
getEventKey(event) {
|
82
|
-
const pre = this.event_key_prefix;
|
83
|
-
const post = this.event_key_postfix;
|
84
|
-
const maybePreHyphen = pre ? '-' : '';
|
85
|
-
const maybePrefix = pre !== null && pre !== void 0 ? pre : '';
|
86
|
-
const maybePostHyphen = post ? '-' : '';
|
87
|
-
const maybePostfix = post !== null && post !== void 0 ? post : '';
|
88
|
-
return `${this.identifier}-${maybePrefix}${maybePreHyphen}${event.type}${maybePostHyphen}${maybePostfix}`;
|
89
|
-
}
|
90
|
-
hasHeardEvent(event) {
|
91
|
-
if (this.eventRecords.has(event)) {
|
92
|
-
return true;
|
93
|
-
}
|
94
|
-
this.eventRecords.set(event, true);
|
95
|
-
setTimeout(() => this.eventRecords.delete(event));
|
96
|
-
return false;
|
97
|
-
}
|
98
|
-
get event_key_prefix() {
|
99
|
-
return '';
|
100
|
-
}
|
101
|
-
get event_key_postfix() {
|
102
|
-
return '';
|
103
|
-
}
|
104
|
-
get outletEvents() {
|
105
|
-
if (!this.outletEventsLookup && this.hasOutletEventsValue) {
|
106
|
-
this.outletEventsLookup = this.outletEventsValue.reduce((acc, eventType) => {
|
107
|
-
let step = acc;
|
108
|
-
eventType.split('-').forEach((eventTypeName, i, splitArr) => {
|
109
|
-
if (typeof step === 'boolean') {
|
110
|
-
return;
|
111
|
-
}
|
112
|
-
if (i === splitArr.length - 1) {
|
113
|
-
step[eventTypeName] = true;
|
114
|
-
}
|
115
|
-
else if (step[eventTypeName] === undefined) {
|
116
|
-
step[eventTypeName] = {};
|
117
|
-
}
|
118
|
-
step = step[eventTypeName];
|
119
|
-
});
|
120
|
-
return acc;
|
121
|
-
}, {});
|
122
|
-
}
|
123
|
-
else if (!this.outletEventsLookup) {
|
124
|
-
this.outletEventsLookup = { '*': true };
|
125
|
-
}
|
126
|
-
return this.outletEventsLookup;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
_OutletManagerController_instances = new WeakSet(), _OutletManagerController_outlets_get = function _OutletManagerController_outlets_get() {
|
130
|
-
const outlets = this.getOutlets();
|
131
|
-
if (outlets) {
|
132
|
-
return outlets;
|
133
|
-
}
|
134
|
-
const defaultOutlets = [];
|
135
|
-
if (this.hasToggleableOutlet) {
|
136
|
-
defaultOutlets.push(...this.toggleableOutlets);
|
137
|
-
}
|
138
|
-
if (this.hasOptionsOutlet) {
|
139
|
-
defaultOutlets.push(...this.optionsOutlets);
|
140
|
-
}
|
141
|
-
if (this.hasStringMatchOutlet) {
|
142
|
-
defaultOutlets.push(...this.stringMatchOutlets);
|
143
|
-
}
|
144
|
-
return defaultOutlets;
|
145
|
-
};
|
146
|
-
OutletManagerController.values = {
|
147
|
-
outletEvents: Array,
|
148
|
-
};
|
149
|
-
OutletManagerController.outlets = ['toggleable', 'options', 'string-match'];
|
150
|
-
OutletManagerController.domEvents = {
|
151
|
-
abort: true,
|
152
|
-
afterprint: true,
|
153
|
-
animationend: true,
|
154
|
-
animationiteration: true,
|
155
|
-
animationstart: true,
|
156
|
-
beforeprint: true,
|
157
|
-
beforeunload: true,
|
158
|
-
blur: true,
|
159
|
-
canplay: true,
|
160
|
-
canplaythrough: true,
|
161
|
-
change: true,
|
162
|
-
click: true,
|
163
|
-
contextmenu: true,
|
164
|
-
copy: true,
|
165
|
-
cut: true,
|
166
|
-
dblclick: true,
|
167
|
-
drag: true,
|
168
|
-
dragend: true,
|
169
|
-
dragenter: true,
|
170
|
-
dragleave: true,
|
171
|
-
dragover: true,
|
172
|
-
dragstart: true,
|
173
|
-
drop: true,
|
174
|
-
durationchange: true,
|
175
|
-
ended: true,
|
176
|
-
error: true,
|
177
|
-
focus: true,
|
178
|
-
focusin: true,
|
179
|
-
focusout: true,
|
180
|
-
fullscreenchange: true,
|
181
|
-
fullscreenerror: true,
|
182
|
-
hashchange: true,
|
183
|
-
input: true,
|
184
|
-
invalid: true,
|
185
|
-
keydown: true,
|
186
|
-
keypress: true,
|
187
|
-
keyup: true,
|
188
|
-
load: true,
|
189
|
-
loadeddata: true,
|
190
|
-
loadedmetadata: true,
|
191
|
-
loadstart: true,
|
192
|
-
message: true,
|
193
|
-
mousedown: true,
|
194
|
-
mouseenter: true,
|
195
|
-
mouseleave: true,
|
196
|
-
mousemove: true,
|
197
|
-
mouseover: true,
|
198
|
-
mouseout: true,
|
199
|
-
mouseup: true,
|
200
|
-
mousewheel: true,
|
201
|
-
offline: true,
|
202
|
-
online: true,
|
203
|
-
open: true,
|
204
|
-
pagehide: true,
|
205
|
-
pageshow: true,
|
206
|
-
paste: true,
|
207
|
-
pause: true,
|
208
|
-
play: true,
|
209
|
-
playing: true,
|
210
|
-
popstate: true,
|
211
|
-
progress: true,
|
212
|
-
ratechange: true,
|
213
|
-
resize: true,
|
214
|
-
reset: true,
|
215
|
-
scroll: true,
|
216
|
-
search: true,
|
217
|
-
seeked: true,
|
218
|
-
seeking: true,
|
219
|
-
select: true,
|
220
|
-
show: true,
|
221
|
-
stalled: true,
|
222
|
-
storage: true,
|
223
|
-
submit: true,
|
224
|
-
suspend: true,
|
225
|
-
timeupdate: true,
|
226
|
-
toggle: true,
|
227
|
-
touchcancel: true,
|
228
|
-
touchend: true,
|
229
|
-
touchmove: true,
|
230
|
-
touchstart: true,
|
231
|
-
transitionend: true,
|
232
|
-
unload: true,
|
233
|
-
volumechange: true,
|
234
|
-
waiting: true,
|
235
|
-
wheel: true,
|
236
|
-
};
|
237
|
-
export default OutletManagerController;
|
@@ -1,278 +0,0 @@
|
|
1
|
-
import {Controller} from '@hotwired/stimulus'
|
2
|
-
|
3
|
-
type TOutletEventLookup = boolean | {[k: string]: TOutletEventLookup}
|
4
|
-
|
5
|
-
export type TOutletChangeData<T> =
|
6
|
-
| {
|
7
|
-
eventKey?: string
|
8
|
-
data?: T
|
9
|
-
}
|
10
|
-
| undefined
|
11
|
-
|
12
|
-
export default class OutletManagerController<T> extends Controller {
|
13
|
-
static values = {
|
14
|
-
outletEvents: Array,
|
15
|
-
}
|
16
|
-
|
17
|
-
declare readonly outletEventsValue: Array<string>
|
18
|
-
declare readonly hasOutletEventsValue: boolean
|
19
|
-
|
20
|
-
static outlets = ['toggleable', 'options', 'string-match']
|
21
|
-
declare readonly toggleableOutlets: Array<OutletManagerController<T>>
|
22
|
-
declare readonly hasToggleableOutlet: boolean
|
23
|
-
declare readonly optionsOutlets: Array<OutletManagerController<T>>
|
24
|
-
declare readonly hasOptionsOutlet: boolean
|
25
|
-
declare readonly stringMatchOutlets: Array<OutletManagerController<T>>
|
26
|
-
declare readonly hasStringMatchOutlet: boolean
|
27
|
-
|
28
|
-
outletEventsLookup: TOutletEventLookup | null = null
|
29
|
-
|
30
|
-
static domEvents: {[k: string]: boolean} = {
|
31
|
-
abort: true,
|
32
|
-
afterprint: true,
|
33
|
-
animationend: true,
|
34
|
-
animationiteration: true,
|
35
|
-
animationstart: true,
|
36
|
-
beforeprint: true,
|
37
|
-
beforeunload: true,
|
38
|
-
blur: true,
|
39
|
-
canplay: true,
|
40
|
-
canplaythrough: true,
|
41
|
-
change: true,
|
42
|
-
click: true,
|
43
|
-
contextmenu: true,
|
44
|
-
copy: true,
|
45
|
-
cut: true,
|
46
|
-
dblclick: true,
|
47
|
-
drag: true,
|
48
|
-
dragend: true,
|
49
|
-
dragenter: true,
|
50
|
-
dragleave: true,
|
51
|
-
dragover: true,
|
52
|
-
dragstart: true,
|
53
|
-
drop: true,
|
54
|
-
durationchange: true,
|
55
|
-
ended: true,
|
56
|
-
error: true,
|
57
|
-
focus: true,
|
58
|
-
focusin: true,
|
59
|
-
focusout: true,
|
60
|
-
fullscreenchange: true,
|
61
|
-
fullscreenerror: true,
|
62
|
-
hashchange: true,
|
63
|
-
input: true,
|
64
|
-
invalid: true,
|
65
|
-
keydown: true,
|
66
|
-
keypress: true,
|
67
|
-
keyup: true,
|
68
|
-
load: true,
|
69
|
-
loadeddata: true,
|
70
|
-
loadedmetadata: true,
|
71
|
-
loadstart: true,
|
72
|
-
message: true,
|
73
|
-
mousedown: true,
|
74
|
-
mouseenter: true,
|
75
|
-
mouseleave: true,
|
76
|
-
mousemove: true,
|
77
|
-
mouseover: true,
|
78
|
-
mouseout: true,
|
79
|
-
mouseup: true,
|
80
|
-
mousewheel: true,
|
81
|
-
offline: true,
|
82
|
-
online: true,
|
83
|
-
open: true,
|
84
|
-
pagehide: true,
|
85
|
-
pageshow: true,
|
86
|
-
paste: true,
|
87
|
-
pause: true,
|
88
|
-
play: true,
|
89
|
-
playing: true,
|
90
|
-
popstate: true,
|
91
|
-
progress: true,
|
92
|
-
ratechange: true,
|
93
|
-
resize: true,
|
94
|
-
reset: true,
|
95
|
-
scroll: true,
|
96
|
-
search: true,
|
97
|
-
seeked: true,
|
98
|
-
seeking: true,
|
99
|
-
select: true,
|
100
|
-
show: true,
|
101
|
-
stalled: true,
|
102
|
-
storage: true,
|
103
|
-
submit: true,
|
104
|
-
suspend: true,
|
105
|
-
timeupdate: true,
|
106
|
-
toggle: true,
|
107
|
-
touchcancel: true,
|
108
|
-
touchend: true,
|
109
|
-
touchmove: true,
|
110
|
-
touchstart: true,
|
111
|
-
transitionend: true,
|
112
|
-
unload: true,
|
113
|
-
volumechange: true,
|
114
|
-
waiting: true,
|
115
|
-
wheel: true,
|
116
|
-
}
|
117
|
-
|
118
|
-
eventRecords: Map<Event, boolean> = new Map()
|
119
|
-
|
120
|
-
getOutlets(): Array<OutletManagerController<T>> | null | void {
|
121
|
-
return null
|
122
|
-
}
|
123
|
-
|
124
|
-
outletUpdate(event: Event, data: TOutletChangeData<T>): void {} // eslint-disable-line no-unused-vars
|
125
|
-
|
126
|
-
getState(): T {
|
127
|
-
return null as T
|
128
|
-
}
|
129
|
-
|
130
|
-
connect() {
|
131
|
-
this.syncOutlets()
|
132
|
-
}
|
133
|
-
|
134
|
-
syncOutlets() {
|
135
|
-
const event = new Event('init')
|
136
|
-
this.sendToOutlets(event, {
|
137
|
-
data: this.getState(),
|
138
|
-
eventKey: this.getEventKey(event),
|
139
|
-
})
|
140
|
-
}
|
141
|
-
|
142
|
-
sendToOutlets(event: Event, updateTo: TOutletChangeData<T> = {}): void {
|
143
|
-
const eventKey = updateTo.eventKey ?? this.getEventKey(event)
|
144
|
-
const outlets = this.#outlets
|
145
|
-
if (outlets?.length) {
|
146
|
-
for (const index in outlets) {
|
147
|
-
const outlet = outlets[index]
|
148
|
-
if (outlet.isListeningForOutletEvent(eventKey) && !this.hasHeardEvent(event)) {
|
149
|
-
const isSameControllerType = this.identifier === outlet.identifier
|
150
|
-
outlet.outletUpdate(event, {eventKey, data: isSameControllerType ? updateTo.data : undefined})
|
151
|
-
}
|
152
|
-
}
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
isListeningForOutletEvent(eventTypes: string) {
|
157
|
-
const eventTypeNames = eventTypes.split('-')
|
158
|
-
|
159
|
-
if (!eventTypeNames.length) {
|
160
|
-
return false
|
161
|
-
}
|
162
|
-
|
163
|
-
let lookup = this.outletEvents
|
164
|
-
for (let i = 0; i < eventTypeNames.length; i++) {
|
165
|
-
const name = eventTypeNames[i]
|
166
|
-
if (typeof lookup === 'boolean') {
|
167
|
-
return lookup
|
168
|
-
}
|
169
|
-
|
170
|
-
const hasWildCard = lookup['*'] !== undefined
|
171
|
-
let nextKey = name
|
172
|
-
if (hasWildCard) {
|
173
|
-
nextKey = '*'
|
174
|
-
} else {
|
175
|
-
const isListeningForDOMEvent = lookup.domEvent !== undefined
|
176
|
-
if (isListeningForDOMEvent && !this.isDOMEventName(name)) {
|
177
|
-
return false
|
178
|
-
} else if (isListeningForDOMEvent) {
|
179
|
-
nextKey = 'domEvent'
|
180
|
-
}
|
181
|
-
}
|
182
|
-
|
183
|
-
if (!lookup[nextKey]) {
|
184
|
-
return false
|
185
|
-
}
|
186
|
-
|
187
|
-
lookup = lookup[nextKey]
|
188
|
-
}
|
189
|
-
|
190
|
-
return true
|
191
|
-
}
|
192
|
-
|
193
|
-
isDOMEventName(eventName: string) {
|
194
|
-
return OutletManagerController.domEvents[eventName]
|
195
|
-
}
|
196
|
-
|
197
|
-
getEventKey(event: Event) {
|
198
|
-
const pre = this.event_key_prefix
|
199
|
-
const post = this.event_key_postfix
|
200
|
-
|
201
|
-
const maybePreHyphen = pre ? '-' : ''
|
202
|
-
const maybePrefix = pre ?? ''
|
203
|
-
const maybePostHyphen = post ? '-' : ''
|
204
|
-
const maybePostfix = post ?? ''
|
205
|
-
|
206
|
-
return `${this.identifier}-${maybePrefix}${maybePreHyphen}${event.type}${maybePostHyphen}${maybePostfix}`
|
207
|
-
}
|
208
|
-
|
209
|
-
hasHeardEvent(event: Event) {
|
210
|
-
if (this.eventRecords.has(event)) {
|
211
|
-
return true
|
212
|
-
}
|
213
|
-
|
214
|
-
this.eventRecords.set(event, true)
|
215
|
-
setTimeout(() => this.eventRecords.delete(event))
|
216
|
-
|
217
|
-
return false
|
218
|
-
}
|
219
|
-
|
220
|
-
get event_key_prefix() {
|
221
|
-
return ''
|
222
|
-
}
|
223
|
-
|
224
|
-
get event_key_postfix() {
|
225
|
-
return ''
|
226
|
-
}
|
227
|
-
|
228
|
-
get outletEvents() {
|
229
|
-
if (!this.outletEventsLookup && this.hasOutletEventsValue) {
|
230
|
-
this.outletEventsLookup = this.outletEventsValue.reduce((acc, eventType) => {
|
231
|
-
let step = acc
|
232
|
-
eventType.split('-').forEach((eventTypeName, i, splitArr) => {
|
233
|
-
if (typeof step === 'boolean') {
|
234
|
-
return
|
235
|
-
}
|
236
|
-
|
237
|
-
if (i === splitArr.length - 1) {
|
238
|
-
step[eventTypeName] = true
|
239
|
-
} else if (step[eventTypeName] === undefined) {
|
240
|
-
step[eventTypeName] = {}
|
241
|
-
}
|
242
|
-
|
243
|
-
step = step[eventTypeName]
|
244
|
-
})
|
245
|
-
|
246
|
-
return acc
|
247
|
-
}, {} as TOutletEventLookup)
|
248
|
-
} else if (!this.outletEventsLookup) {
|
249
|
-
this.outletEventsLookup = {'*': true}
|
250
|
-
}
|
251
|
-
|
252
|
-
return this.outletEventsLookup
|
253
|
-
}
|
254
|
-
|
255
|
-
get #outlets(): Array<OutletManagerController<T>> | null | void {
|
256
|
-
const outlets = this.getOutlets()
|
257
|
-
|
258
|
-
if (outlets) {
|
259
|
-
return outlets
|
260
|
-
}
|
261
|
-
|
262
|
-
const defaultOutlets: Array<OutletManagerController<T>> = []
|
263
|
-
|
264
|
-
if (this.hasToggleableOutlet) {
|
265
|
-
defaultOutlets.push(...this.toggleableOutlets)
|
266
|
-
}
|
267
|
-
|
268
|
-
if (this.hasOptionsOutlet) {
|
269
|
-
defaultOutlets.push(...this.optionsOutlets)
|
270
|
-
}
|
271
|
-
|
272
|
-
if (this.hasStringMatchOutlet) {
|
273
|
-
defaultOutlets.push(...this.stringMatchOutlets)
|
274
|
-
}
|
275
|
-
|
276
|
-
return defaultOutlets
|
277
|
-
}
|
278
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do |list| %>
|
2
|
-
<% panels.each_with_index do |panel, idx| %>
|
3
|
-
<%= render Ariadne::BaseComponent.new(tag: :li, classes: panel.classes, attributes: panel.attributes) do %>
|
4
|
-
<%= render Ariadne::BaseComponent.new(tag: :div, classes: Ariadne::PanelBarComponent::PanelItem::DEFAULT_WRAPPER_CLASSES) do %>
|
5
|
-
<span class="ariadne-px-6 ariadne-py-4 ariadne-flex ariadne-items-center ariadne-text-sm ariadne-font-medium">
|
6
|
-
<%= panel.icon %>
|
7
|
-
<span class="ariadne-ml-4 ariadne-text-sm ariadne-font-medium ariadne-text-gray-900"><%= panel.label %></span>
|
8
|
-
<!-- TODO: fix this -->
|
9
|
-
<% if idx + 1 < panels.size %>
|
10
|
-
<div class="md:ariadne-block ariadne-hidden ariadne-absolute ariadne-top-0 ariadne-right-0 ariadne-h-full ariadne-w-5" aria-hidden="true">
|
11
|
-
<svg class="ariadne-h-full ariadne-w-full ariadne-text-gray-300" viewBox="0 0 22 80" fill="none" preserveAspectRatio="none">
|
12
|
-
<path d="M0 -2L20 40L0 82" vector-effect="non-scaling-stroke" stroke="currentcolor" stroke-linejoin="round"></path>
|
13
|
-
</svg>
|
14
|
-
</div>
|
15
|
-
<% end %>
|
16
|
-
</span>
|
17
|
-
<% end %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Add a general description of component here
|
5
|
-
# Add additional usage considerations or best practices that may aid the user to use the component correctly.
|
6
|
-
# @accessibility Add any accessibility considerations
|
7
|
-
class PanelBarComponent < Ariadne::Component
|
8
|
-
DEFAULT_TAG = :ol
|
9
|
-
TAG_OPTIONS = [DEFAULT_TAG].freeze
|
10
|
-
|
11
|
-
DEFAULT_CLASSES = "ariadne-border ariadne-border-gray-300 ariadne-rounded-md ariadne-divide-y ariadne-divide-gray-300 md:ariadne-flex md:ariadne-divide-y-0"
|
12
|
-
|
13
|
-
renders_many :panels, "PanelItem"
|
14
|
-
|
15
|
-
# @example Default
|
16
|
-
#
|
17
|
-
# <%= render(Ariadne::PanelBarComponent.new) { "Example" } %>
|
18
|
-
#
|
19
|
-
# @param tag [Symbol, String] The rendered tag name.
|
20
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
21
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
22
|
-
def initialize(classes: "", attributes: {})
|
23
|
-
@tag = DEFAULT_TAG
|
24
|
-
@classes = merge_class_names(
|
25
|
-
DEFAULT_CLASSES,
|
26
|
-
classes,
|
27
|
-
)
|
28
|
-
|
29
|
-
@attributes = attributes
|
30
|
-
@attributes[:role] ||= "list"
|
31
|
-
end
|
32
|
-
|
33
|
-
# def render?
|
34
|
-
# items.any?
|
35
|
-
# end
|
36
|
-
|
37
|
-
# This component is part of `PanelBarComponent` and should not be
|
38
|
-
# used as a standalone component.
|
39
|
-
class PanelItem < Ariadne::Component
|
40
|
-
DEFAULT_ITEM_CLASSES = "ariadne-relative md:ariadne-flex-1 md:ariadne-flex"
|
41
|
-
DEFAULT_WRAPPER_CLASSES = "group ariadne-flex ariadne-items-center ariadne-w-full"
|
42
|
-
|
43
|
-
# TODO: fix this
|
44
|
-
renders_one :icon, lambda { |static_content = nil, &block|
|
45
|
-
next static_content if static_content.present?
|
46
|
-
|
47
|
-
view_context.capture { block&.call }
|
48
|
-
}
|
49
|
-
|
50
|
-
renders_one :label, lambda { |static_content = nil, &block|
|
51
|
-
next static_content if static_content.present?
|
52
|
-
|
53
|
-
view_context.capture { block&.call }
|
54
|
-
}
|
55
|
-
|
56
|
-
attr_reader :link, :classes, :attributes
|
57
|
-
|
58
|
-
def initialize(link: {}, classes: "", attributes: {})
|
59
|
-
@link = link
|
60
|
-
if @link.present?
|
61
|
-
@link["classes"] = merge_class_names(DEFAULT_WRAPPER_CLASSES, @link["classes"])
|
62
|
-
end
|
63
|
-
@classes = merge_class_names(DEFAULT_ITEM_CLASSES, classes)
|
64
|
-
@attributes = attributes
|
65
|
-
end
|
66
|
-
|
67
|
-
def selected?
|
68
|
-
@selected
|
69
|
-
end
|
70
|
-
|
71
|
-
def linked?
|
72
|
-
@link.present?
|
73
|
-
end
|
74
|
-
|
75
|
-
def call
|
76
|
-
render(Ariadne::BaseComponent.new(tag: :div, classes: @classes, attributes: @attributes))
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Creates a ariadne-rounded label that resembles a medicine pill.
|
5
|
-
class PillComponent < Ariadne::Component
|
6
|
-
DEFAULT_TAG = :span
|
7
|
-
TAG_OPTIONS = [DEFAULT_TAG].freeze
|
8
|
-
|
9
|
-
DEFAULT_CLASSES = "ariadne-flex-shrink-0 ariadne-inline-block ariadne-px-2 ariadne-py-1 ariadne-text-xs ariadne-font-medium ariadne-rounded-full ariadne-whitespace-nowrap"
|
10
|
-
|
11
|
-
# @example Default
|
12
|
-
#
|
13
|
-
# <%= render(Ariadne::PillComponent.new(color: [49, 186, 115, 1.0])) { "Admin" } %>
|
14
|
-
#
|
15
|
-
# @param tag [Symbol, String] The rendered tag name.
|
16
|
-
# @param color [String] The rgba color of the pill.
|
17
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
18
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
19
|
-
def initialize(tag: DEFAULT_TAG, color:, classes: "", attributes: {})
|
20
|
-
@tag = check_incoming_tag(DEFAULT_TAG, tag)
|
21
|
-
|
22
|
-
@red = color[0]
|
23
|
-
@green = color[1]
|
24
|
-
@blue = color[2]
|
25
|
-
@alpha = color[3]
|
26
|
-
|
27
|
-
@attributes = attributes
|
28
|
-
@attributes["style"] = "background-color: rgba(#{@red}, #{@green}, #{@blue}, #{@alpha});"
|
29
|
-
@text_color = contrast_of(@red, @green, @blue)
|
30
|
-
|
31
|
-
@classes = merge_class_names(
|
32
|
-
DEFAULT_CLASSES,
|
33
|
-
classes,
|
34
|
-
@text_color,
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
private def contrast_of(red, green, blue)
|
39
|
-
luminance = (0.299 * red + 0.587 * green + 0.114 * blue) / 255
|
40
|
-
|
41
|
-
luminance > 0.5 ? "ariadne-text-black" : "ariadne-text-white"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do |component| %>
|
2
|
-
<div class="<%= @base_classes %>">
|
3
|
-
<%= base %>
|
4
|
-
</div>
|
5
|
-
<div class="<%= @items_wrapper_classes %>" data-action="click->toggleable#toggle">
|
6
|
-
<% items.each do |item| %>
|
7
|
-
<%= item %>
|
8
|
-
<% end %>
|
9
|
-
</div>
|
10
|
-
<% end %>
|