ariadne_view_components 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/ariadne_view_components.css +2355 -0
  3. data/app/components/ariadne/ariadne-form-with.d.ts +20 -0
  4. data/app/components/ariadne/ariadne-form-with.js +85 -0
  5. data/app/components/ariadne/ariadne-form.d.ts +22 -0
  6. data/app/components/ariadne/ariadne-form.js +84 -0
  7. data/app/components/ariadne/ariadne.d.ts +2 -0
  8. data/app/components/ariadne/ariadne.js +16 -0
  9. data/app/components/ariadne/body_component.rb +1 -1
  10. data/app/components/ariadne/clipboard-copy-component.d.ts +4 -0
  11. data/app/components/ariadne/clipboard-copy-component.js +18 -0
  12. data/app/components/ariadne/clipboard_copy_component.d.ts +4 -0
  13. data/app/components/ariadne/clipboard_copy_component.js +18 -0
  14. data/app/components/ariadne/comment-component.d.ts +0 -0
  15. data/app/components/ariadne/comment-component.js +33 -0
  16. data/app/components/ariadne/component.rb +0 -2
  17. data/app/components/ariadne/header_component.rb +1 -1
  18. data/app/components/ariadne/link_component.rb +2 -2
  19. data/app/components/ariadne/rich-text-area-component.d.ts +4 -0
  20. data/app/components/ariadne/rich-text-area-component.js +27 -0
  21. data/app/components/ariadne/slideover-component.d.ts +9 -0
  22. data/app/components/ariadne/slideover-component.js +20 -0
  23. data/app/components/ariadne/slideover_component.d.ts +9 -0
  24. data/app/components/ariadne/slideover_component.js +19 -0
  25. data/app/components/ariadne/tab-component.js +1 -0
  26. data/app/components/ariadne/tab-container-component copy.d.ts +1 -0
  27. data/app/components/ariadne/tab-container-component copy.js +23 -0
  28. data/app/components/ariadne/tab-container-component.d.ts +1 -0
  29. data/app/components/ariadne/tab-container-component.js +23 -0
  30. data/app/components/ariadne/tab-nav-component.d.ts +9 -0
  31. data/app/components/ariadne/tab-nav-component.js +32 -0
  32. data/app/components/ariadne/table_nav_component.html.erb +1 -1
  33. data/app/components/ariadne/tabs-component.d.ts +0 -0
  34. data/app/components/ariadne/tabs-component.js +1 -0
  35. data/app/components/ariadne/time-ago-component.d.ts +1 -0
  36. data/app/components/ariadne/time-ago-component.js +1 -0
  37. data/app/components/ariadne/time_ago_component.d.ts +1 -0
  38. data/app/components/ariadne/time_ago_component.js +1 -0
  39. data/app/components/ariadne/tooltip-component.d.ts +24 -0
  40. data/app/components/ariadne/tooltip-component.js +42 -0
  41. data/app/lib/ariadne/form_builder.rb +2 -2
  42. data/lib/ariadne/view_components/version.rb +1 -1
  43. data/lib/tasks/docs.rake +0 -1
  44. data/static/arguments.yml +0 -11
  45. data/static/audited_at.json +0 -1
  46. data/static/classes.yml +5 -5
  47. data/static/constants.json +3 -6
  48. data/static/statuses.json +0 -1
  49. metadata +40 -7
  50. data/app/components/ariadne/main_component.rb +0 -32
@@ -0,0 +1,20 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import { TemplateResult } from 'lit-html';
3
+ declare type HTMLFormField = HTMLInputElement | HTMLButtonElement | HTMLSelectElement | HTMLTextAreaElement;
4
+ export default class AriadneFormWith extends Controller {
5
+ connect(): void;
6
+ disconnect(): void;
7
+ onBlur: (event: Event) => void;
8
+ onSubmit: (event: Event) => void;
9
+ validateForm(): boolean;
10
+ validateField(field: HTMLFormField): boolean;
11
+ shouldValidateField(field: HTMLFormField): boolean;
12
+ refreshErrorForInvalidField(field: HTMLFormField, isValid: boolean): void;
13
+ removeExistingErrorMessage(field: HTMLFormField): void;
14
+ showErrorForInvalidField(field: HTMLFormField): void;
15
+ buildFieldErrorHtml(field: HTMLFormField): string;
16
+ get formFields(): HTMLFormField[];
17
+ get firstInvalidField(): HTMLFormField | undefined;
18
+ getRenderString: (data: TemplateResult) => string;
19
+ }
20
+ export {};
@@ -0,0 +1,85 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import { html } from 'lit-html';
3
+ export default class AriadneFormWith extends Controller {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.onBlur = (event) => {
7
+ this.validateField(event.target);
8
+ };
9
+ this.onSubmit = (event) => {
10
+ var _a;
11
+ if (!this.validateForm()) {
12
+ event.preventDefault();
13
+ (_a = this.firstInvalidField) === null || _a === void 0 ? void 0 : _a.focus();
14
+ }
15
+ };
16
+ this.getRenderString = (data) => {
17
+ const { strings, values } = data;
18
+ const v = [...values, ''].map(e => (typeof e === 'object' ? this.getRenderString(e) : e));
19
+ return strings.reduce((acc, s, i) => acc + s + v[i], '');
20
+ };
21
+ }
22
+ connect() {
23
+ this.element.setAttribute('novalidate', 'true');
24
+ this.element.addEventListener('blur', this.onBlur, true);
25
+ this.element.addEventListener('submit', this.onSubmit);
26
+ this.element.addEventListener('ajax:beforeSend', this.onSubmit);
27
+ }
28
+ disconnect() {
29
+ this.element.removeEventListener('blur', this.onBlur);
30
+ this.element.removeEventListener('submit', this.onSubmit);
31
+ this.element.removeEventListener('ajax:beforeSend', this.onSubmit);
32
+ }
33
+ validateForm() {
34
+ let isValid = true;
35
+ // Not using `find` because we want to validate all the fields
36
+ for (const field of this.formFields) {
37
+ if (this.shouldValidateField(field) && !this.validateField(field))
38
+ isValid = false;
39
+ }
40
+ return isValid;
41
+ }
42
+ validateField(field) {
43
+ if (!this.shouldValidateField(field))
44
+ return true;
45
+ const isValid = field.checkValidity();
46
+ field.classList.toggle('invalid', !isValid);
47
+ this.refreshErrorForInvalidField(field, isValid);
48
+ return isValid;
49
+ }
50
+ shouldValidateField(field) {
51
+ return !field.disabled && !['file', 'reset', 'submit', 'button'].includes(field.type);
52
+ }
53
+ refreshErrorForInvalidField(field, isValid) {
54
+ this.removeExistingErrorMessage(field);
55
+ if (!isValid)
56
+ this.showErrorForInvalidField(field);
57
+ }
58
+ removeExistingErrorMessage(field) {
59
+ var _a;
60
+ const fieldContainer = field.closest('.field');
61
+ if (!fieldContainer)
62
+ return;
63
+ const existingErrorMessageElement = fieldContainer.querySelector('.error');
64
+ if (existingErrorMessageElement) {
65
+ (_a = existingErrorMessageElement === null || existingErrorMessageElement === void 0 ? void 0 : existingErrorMessageElement.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(existingErrorMessageElement);
66
+ }
67
+ }
68
+ showErrorForInvalidField(field) {
69
+ field.insertAdjacentHTML('afterend', this.buildFieldErrorHtml(field));
70
+ }
71
+ buildFieldErrorHtml(field) {
72
+ const data = html `<p class="error">${field.validationMessage}</p>`;
73
+ return this.getRenderString(data);
74
+ }
75
+ get formFields() {
76
+ return Array.from(this.element.children).filter(node => {
77
+ const data = node.attributes.getNamedItem('data-ariadne-form-field');
78
+ if ((data === null || data === void 0 ? void 0 : data.value) === 'true')
79
+ return true;
80
+ });
81
+ }
82
+ get firstInvalidField() {
83
+ return this.formFields.find(field => !field.checkValidity());
84
+ }
85
+ }
@@ -0,0 +1,22 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import type { TemplateResult } from 'lit-html';
3
+ declare type HTMLFormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
4
+ export default class AriadneFormWith extends Controller {
5
+ static targets: string[];
6
+ readonly formFieldTargets: [HTMLFormField];
7
+ connect(): void;
8
+ disconnect(): void;
9
+ onBlur: (event: Event) => void;
10
+ onSubmit: (event: Event) => void;
11
+ validateForm(): boolean;
12
+ validateField(field: HTMLFormField): boolean;
13
+ shouldValidateField(field: HTMLFormField): boolean;
14
+ refreshErrorForInvalidField(field: HTMLFormField, isValid: boolean): void;
15
+ removeExistingErrorMessage(field: HTMLFormField): void;
16
+ showErrorForInvalidField(field: HTMLFormField): void;
17
+ buildFieldErrorHtml(field: HTMLFormField): string;
18
+ get formFields(): HTMLFormField[];
19
+ get firstInvalidField(): HTMLFormField | undefined;
20
+ getRenderString: (data: TemplateResult) => string;
21
+ }
22
+ export {};
@@ -0,0 +1,84 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import { html } from 'lit-html';
3
+ export default class AriadneFormWith extends Controller {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.onBlur = (event) => {
7
+ this.validateField(event.target);
8
+ };
9
+ this.onSubmit = (event) => {
10
+ var _a;
11
+ if (!this.validateForm()) {
12
+ event.preventDefault();
13
+ (_a = this.firstInvalidField) === null || _a === void 0 ? void 0 : _a.focus();
14
+ }
15
+ };
16
+ this.getRenderString = (data) => {
17
+ const { strings, values } = data;
18
+ const v = [...values, ''].map(e => (typeof e === 'object' ? this.getRenderString(e) : e));
19
+ return strings.reduce((acc, s, i) => acc + s + v[i], '');
20
+ };
21
+ }
22
+ connect() {
23
+ this.element.setAttribute('novalidate', 'true');
24
+ this.element.addEventListener('blur', this.onBlur, true);
25
+ this.element.addEventListener('submit', this.onSubmit);
26
+ this.element.addEventListener('ajax:beforeSend', this.onSubmit);
27
+ }
28
+ disconnect() {
29
+ this.element.removeEventListener('blur', this.onBlur);
30
+ this.element.removeEventListener('submit', this.onSubmit);
31
+ this.element.removeEventListener('ajax:beforeSend', this.onSubmit);
32
+ }
33
+ validateForm() {
34
+ let isValid = true;
35
+ // Not using `find` because we want to validate all the fields
36
+ for (const field of this.formFields) {
37
+ if (this.shouldValidateField(field) && !this.validateField(field))
38
+ isValid = false;
39
+ }
40
+ return isValid;
41
+ }
42
+ validateField(field) {
43
+ if (!this.shouldValidateField(field))
44
+ return true;
45
+ const isValid = field.checkValidity();
46
+ field.classList.toggle('invalid', !isValid);
47
+ this.refreshErrorForInvalidField(field, isValid);
48
+ return isValid;
49
+ }
50
+ shouldValidateField(field) {
51
+ return (!field.disabled &&
52
+ !field.classList.contains('ProseMirror') &&
53
+ !['file', 'reset', 'submit', 'button'].includes(field.type));
54
+ }
55
+ refreshErrorForInvalidField(field, isValid) {
56
+ this.removeExistingErrorMessage(field);
57
+ if (!isValid)
58
+ this.showErrorForInvalidField(field);
59
+ }
60
+ removeExistingErrorMessage(field) {
61
+ var _a;
62
+ const fieldContainer = field.closest('.field');
63
+ if (!fieldContainer)
64
+ return;
65
+ const existingErrorMessageElement = fieldContainer.querySelector('.error');
66
+ if (existingErrorMessageElement) {
67
+ (_a = existingErrorMessageElement === null || existingErrorMessageElement === void 0 ? void 0 : existingErrorMessageElement.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(existingErrorMessageElement);
68
+ }
69
+ }
70
+ showErrorForInvalidField(field) {
71
+ field.insertAdjacentHTML('afterend', this.buildFieldErrorHtml(field));
72
+ }
73
+ buildFieldErrorHtml(field) {
74
+ const data = html `<p class="error">${field.validationMessage}</p>`;
75
+ return this.getRenderString(data);
76
+ }
77
+ get formFields() {
78
+ return Array.from(this.formFieldTargets);
79
+ }
80
+ get firstInvalidField() {
81
+ return this.formFields.find(field => !field.checkValidity());
82
+ }
83
+ }
84
+ AriadneFormWith.targets = ['formField'];
@@ -0,0 +1,2 @@
1
+ import './tab-container-component';
2
+ import './time-ago-component';
@@ -0,0 +1,16 @@
1
+ import { Application } from '@hotwired/stimulus';
2
+ import AriadneForm from './ariadne-form';
3
+ import ClipboardCopyComponent from './clipboard-copy-component';
4
+ import RichTextAreaComponent from './rich-text-area-component';
5
+ import SlideoverComponent from './slideover-component';
6
+ import TabNavComponent from './tab-nav-component';
7
+ import TooltipComponent from './tooltip-component';
8
+ import './tab-container-component';
9
+ import './time-ago-component';
10
+ const application = Application.start();
11
+ application.register('clipboard-copy-component', ClipboardCopyComponent);
12
+ application.register('ariadne-form', AriadneForm);
13
+ application.register('rich-text-area-component', RichTextAreaComponent);
14
+ application.register('slideover-component', SlideoverComponent);
15
+ application.register('tab-nav-component', TabNavComponent);
16
+ application.register('tooltip-component', TooltipComponent);
@@ -5,7 +5,7 @@ module Ariadne
5
5
  # Add additional usage considerations or best practices that may aid the user to use the component correctly.
6
6
  # @accessibility Add any accessibility considerations
7
7
  class BodyComponent < Ariadne::Component
8
- DEFAULT_CLASSES = "ariadne-flex ariadne-flex-col ariadne-min-h-screen"
8
+ DEFAULT_CLASSES = "ariadne-scroll-smooth ariadne-bg-white ariadne-antialiased"
9
9
 
10
10
  # @example Default
11
11
  #
@@ -0,0 +1,4 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class ClipboardCopyComponent extends Controller {
3
+ copy(): void;
4
+ }
@@ -0,0 +1,18 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class ClipboardCopyComponent extends Controller {
3
+ copy() {
4
+ const value = this.element.attributes.getNamedItem('value');
5
+ const forNode = this.element.attributes.getNamedItem('for');
6
+ if (value) {
7
+ navigator.clipboard.writeText(value.value);
8
+ }
9
+ else if (forNode) {
10
+ const node = document.getElementById(forNode.value);
11
+ navigator.clipboard.writeText((node === null || node === void 0 ? void 0 : node.textContent) || '');
12
+ }
13
+ else {
14
+ // just copy inner text
15
+ navigator.clipboard.writeText(this.element.textContent || '');
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,4 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class ClipboardCopyComponent extends Controller {
3
+ copy(): void;
4
+ }
@@ -0,0 +1,18 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class ClipboardCopyComponent extends Controller {
3
+ copy() {
4
+ const value = this.element.attributes.getNamedItem('value');
5
+ const forNode = this.element.attributes.getNamedItem('for');
6
+ if (value) {
7
+ navigator.clipboard.writeText(value.value);
8
+ }
9
+ else if (forNode) {
10
+ const node = document.getElementById(forNode.value);
11
+ navigator.clipboard.writeText((node === null || node === void 0 ? void 0 : node.textContent) || '');
12
+ }
13
+ else {
14
+ // just copy inner text
15
+ navigator.clipboard.writeText(this.element.textContent || '');
16
+ }
17
+ }
18
+ }
File without changes
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // import {Controller} from '@hotwired/stimulus'
3
+ // export default class CommentComponent extends Controller {
4
+ // static targets = ['tab', 'tabBarComponent']
5
+ // declare readonly commentComponentTarget: HTMLDivElement
6
+ // declare readonly tabBarComponentTarget: HTMLElement // technically a `nav but typescript can't find it?
7
+ // declare readonly tabTargets: [HTMLButtonElement]
8
+ // // keep in sync with comment_component.rb
9
+ // SELECTED_TAB_CLASSES = ['ariadne-border-indigo-500', 'ariadne-text-indigo-600']
10
+ // PUBLIC_BACKGROUND_COLOR = 'ariadne-bg-white'
11
+ // INTERNAL_BACKGROUND_COLOR = 'ariadne-bg-internal-message'
12
+ // toggleTab() {
13
+ // for (const tab of this.tabTargets) {
14
+ // if (tab.hasAttribute('aria-selected')) {
15
+ // tab.classList.remove(...this.SELECTED_TAB_CLASSES)
16
+ // this.toggleBackgrounds(tab, false)
17
+ // tab.removeAttribute('aria-selected')
18
+ // } else {
19
+ // tab.setAttribute('aria-selected', 'true')
20
+ // tab.classList.add(...this.SELECTED_TAB_CLASSES)
21
+ // this.toggleBackgrounds(tab, true)
22
+ // }
23
+ // }
24
+ // }
25
+ // toggleBackgrounds(tab: HTMLButtonElement, publicComment: boolean) {
26
+ // if (publicComment) {
27
+ // this.tabBarComponentTarget.classList.add(this.PUBLIC_BACKGROUND_COLOR)
28
+ // this.tabBarComponentTarget.classList.remove(this.INTERNAL_BACKGROUND_COLOR)
29
+ // this.tabBarComponentTarget.classList.remove(this.PUBLIC_BACKGROUND_COLOR)
30
+ // this.tabBarComponentTarget.classList.add(this.INTERNAL_BACKGROUND_COLOR)
31
+ // }
32
+ // }
33
+ // }
@@ -16,8 +16,6 @@ module Ariadne
16
16
  include LoggerHelper
17
17
  include Ariadne::ActionViewExtensions::FormHelper
18
18
 
19
- BASE_HTML_CLASSES = "ariadne-h-full ariadne-scroll-smooth ariadne-bg-white ariadne-antialiased"
20
- BASE_BODY_CLASSES = "ariadne-flex ariadne-h-full ariadne-flex-col"
21
19
  BASE_WRAPPER_CLASSES = "ariadne-flex ariadne-flex-col ariadne-h-screen ariadne-justify-between"
22
20
  BASE_MAIN_CLASSES = "ariadne-flex-auto"
23
21
 
@@ -3,7 +3,7 @@
3
3
  module Ariadne
4
4
  # Represents the top navigation bar on every page.
5
5
  class HeaderComponent < Ariadne::Component
6
- DEFAULT_CLASSES = "ariadne-sticky ariadne-top-0 ariadne-z-50 ariadne-px-4 ariadne-py-5 ariadne-bg-white ariadne-shadow-sm shadow-slate-900/5 ariadne-transition ariadne-duration-500"
6
+ DEFAULT_CLASSES = "ariadne-sticky ariadne-top-0 ariadne-z-50 ariadne-px-4 ariadne-pt-4 ariadne-h-16 ariadne-bg-white ariadne-shadow-sm shadow-slate-900/5 ariadne-transition ariadne-duration-500"
7
7
  # ariadne-flex ariadne-flex-wrap ariadne-items-center ariadne-justify-between ariadne-bg-white dark:ariadne-shadow-none dark:ariadne-bg-transparent
8
8
  LINK_CLASSES = "ariadne-rounded-lg ariadne-py-1 ariadne-px-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900"
9
9
 
@@ -6,8 +6,8 @@ module Ariadne
6
6
  DEFAULT_TAG = :a
7
7
  TAG_OPTIONS = [DEFAULT_TAG, :span].freeze
8
8
 
9
- DEFAULT_CLASSES = "ariadne-cursor-pointer ariadne-font-semibold hover:ariadne-text-button-text-color focus:ariadne-outline-none focus:ariadne-ring-2 focus:ariadne-ring-offset-2 focus:ariadne-ring-purple-500"
10
- DEFAULT_ACTIONABLE_CLASSES = "ariadne-underline ariadne-decoration-double"
9
+ DEFAULT_CLASSES = "ariadne-cursor-pointer hover:ariadne-text-button-text-color focus:ariadne-outline-none focus:ariadne-ring-2 focus:ariadne-ring-offset-2 focus:ariadne-ring-purple-500"
10
+ DEFAULT_ACTIONABLE_CLASSES = "ariadne-cursor-pointer ariadne-font-semibold ariadne-underline ariadne-decoration-double"
11
11
 
12
12
  # `Tooltip` that appears on mouse hover or keyboard focus over the button. Use tooltips sparingly and as a last resort.
13
13
  # **Important:** This tooltip defaults to `type: :description`. In a few scenarios, `type: :label` may be more appropriate.
@@ -0,0 +1,4 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class RichTextArea extends Controller {
3
+ connect(): void;
4
+ }
@@ -0,0 +1,27 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import { Editor } from '@tiptap/core';
3
+ import { StarterKit } from '@tiptap/starter-kit';
4
+ export default class RichTextArea extends Controller {
5
+ connect() {
6
+ const editorElements = document.getElementsByClassName('tiptap-editor');
7
+ for (const editorElement of editorElements) {
8
+ new Editor({
9
+ element: editorElement,
10
+ extensions: [StarterKit],
11
+ content: '',
12
+ editorProps: {
13
+ attributes: {
14
+ class: 'ariadne-m-5 focus:ariadne-outline-none ariadne-block ariadne-w-full ariadne-resize-none ariadne-p-0 ariadne-pb-2 ariadne-border-none focus:ariadne-ring-0 sm:ariadne-text-sm'
15
+ }
16
+ }
17
+ });
18
+ const tiptapValueContainer = document.querySelector('input[data-tiptap-value-container=true]');
19
+ if (tiptapValueContainer) {
20
+ const parentForm = editorElement.closest('form');
21
+ parentForm === null || parentForm === void 0 ? void 0 : parentForm.addEventListener('submit', () => {
22
+ tiptapValueContainer.setAttribute('value', editorElement.textContent || '');
23
+ });
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,9 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class SlideoverComponent extends Controller {
3
+ static targets: string[];
4
+ readonly expandableTarget: HTMLDivElement;
5
+ readonly expandWrapperTarget: HTMLDivElement;
6
+ readonly slidePanelTargets: [HTMLDivElement];
7
+ readonly buttonWrapperTarget: HTMLDivElement;
8
+ toggle(): void;
9
+ }
@@ -0,0 +1,20 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class SlideoverComponent extends Controller {
3
+ toggle() {
4
+ var _a;
5
+ this.expandableTarget.classList.toggle('ariadne-hidden');
6
+ this.expandWrapperTarget.classList.toggle('bg-filter-panel');
7
+ for (const slidePanel of this.slidePanelTargets) {
8
+ slidePanel.classList.toggle('ariadne-hidden');
9
+ }
10
+ this.buttonWrapperTarget.classList.toggle('bg-filter-panel');
11
+ if ((_a = document.getElementById('btnClose')) === null || _a === void 0 ? void 0 : _a.classList.contains('ariadne-hidden')) {
12
+ const formID = this.buttonWrapperTarget.getAttribute('data-slideover-component-form-id');
13
+ if (formID) {
14
+ const form = document.getElementById(formID);
15
+ form === null || form === void 0 ? void 0 : form.submit();
16
+ }
17
+ }
18
+ }
19
+ }
20
+ SlideoverComponent.targets = ['expandable', 'expandWrapper', 'slidePanel', 'buttonWrapper'];
@@ -0,0 +1,9 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class SlideoverComponent extends Controller {
3
+ static targets: string[];
4
+ readonly expandableTarget: HTMLDivElement;
5
+ readonly expandWrapperTarget: HTMLDivElement;
6
+ readonly slidePanelTargets: [HTMLDivElement];
7
+ readonly buttonWrapperTarget: HTMLDivElement;
8
+ toggle(): void;
9
+ }
@@ -0,0 +1,19 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class SlideoverComponent extends Controller {
3
+ toggle() {
4
+ var _a;
5
+ // eslint-disable-next-line no-debugger
6
+ debugger;
7
+ this.expandableTarget.classList.toggle('hidden');
8
+ this.expandWrapperTarget.classList.toggle('bg-filter-panel');
9
+ for (const slidePanel of this.slidePanelTargets) {
10
+ slidePanel.classList.toggle('hidden');
11
+ }
12
+ this.buttonWrapperTarget.classList.toggle('bg-filter-panel');
13
+ if ((_a = document.getElementById('btnClose')) === null || _a === void 0 ? void 0 : _a.classList.contains('hidden')) {
14
+ const form = this.buttonWrapperTarget.closest('form');
15
+ form === null || form === void 0 ? void 0 : form.submit();
16
+ }
17
+ }
18
+ }
19
+ SlideoverComponent.targets = ['expandable', 'expandWrapper', 'slidePanel', 'buttonWrapper'];
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ import '@github/tab-container-element';
@@ -0,0 +1,23 @@
1
+ import '@github/tab-container-element';
2
+ // // keep in sync with tab_container_component.rb
3
+ // const DEFAULT_SELECTED_CLASSES: string[] = ['ariadne-border-indigo-500', 'ariadne-text-indigo-600']
4
+ // const DEFAULT_UNSELECTED_CLASSES: string[] = [
5
+ // 'ariadne-text-gray-500',
6
+ // 'hover:ariadne-text-gray-700',
7
+ // 'hover:ariadne-border-gray-300'
8
+ // ]
9
+ for (const tabContainer of document.getElementsByTagName('tab-container')) {
10
+ tabContainer.addEventListener('tab-container-change', function (event) {
11
+ var _a;
12
+ const newPanel = event.detail.relatedTarget;
13
+ const tabContainer = newPanel.closest('tab-container');
14
+ const tabList = tabContainer.firstElementChild;
15
+ const currentTab = tabList.querySelector('[aria-selected="true"]');
16
+ const tabId = (_a = newPanel.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-').slice(1).join('-');
17
+ const newTab = tabList.querySelector(`#${tabId}`);
18
+ currentTab.classList.remove(...DEFAULT_SELECTED_CLASSES);
19
+ currentTab.classList.add(...DEFAULT_UNSELECTED_CLASSES);
20
+ newTab.classList.add(...DEFAULT_SELECTED_CLASSES);
21
+ newTab.classList.remove(...DEFAULT_UNSELECTED_CLASSES);
22
+ });
23
+ }
@@ -0,0 +1 @@
1
+ import '@github/tab-container-element';
@@ -0,0 +1,23 @@
1
+ import '@github/tab-container-element';
2
+ // keep in sync with tab_container_component.rb
3
+ const DEFAULT_SELECTED_CLASSES = ['ariadne-border-indigo-500', 'ariadne-text-indigo-600'];
4
+ const DEFAULT_UNSELECTED_CLASSES = [
5
+ 'ariadne-text-gray-500',
6
+ 'hover:ariadne-text-gray-700',
7
+ 'hover:ariadne-border-gray-300'
8
+ ];
9
+ for (const tabContainer of document.getElementsByTagName('tab-container')) {
10
+ tabContainer.addEventListener('tab-container-change', function (event) {
11
+ var _a;
12
+ const newPanel = event.detail.relatedTarget;
13
+ const tabContainer = newPanel.closest('tab-container');
14
+ const tabList = tabContainer.firstElementChild;
15
+ const currentTab = tabList.querySelector('[aria-selected="true"]');
16
+ const tabId = (_a = newPanel.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-').slice(1).join('-');
17
+ const newTab = tabList.querySelector(`#${tabId}`);
18
+ currentTab.classList.remove(...DEFAULT_SELECTED_CLASSES);
19
+ currentTab.classList.add(...DEFAULT_UNSELECTED_CLASSES);
20
+ newTab.classList.add(...DEFAULT_SELECTED_CLASSES);
21
+ newTab.classList.remove(...DEFAULT_UNSELECTED_CLASSES);
22
+ });
23
+ }
@@ -0,0 +1,9 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class TabNavComponent extends Controller {
3
+ static targets: string[];
4
+ readonly tabTargets: [HTMLAnchorElement];
5
+ SELECTED_CLASSES: string[];
6
+ UNSELECTED_CLASSES: string[];
7
+ connect(): void;
8
+ toggle(event: Event): void;
9
+ }
@@ -0,0 +1,32 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class TabNavComponent extends Controller {
3
+ constructor() {
4
+ super(...arguments);
5
+ // keep in synch with tab_nav_component
6
+ this.SELECTED_CLASSES = ['ariadne-border-indigo-500', 'ariadne-text-indigo-600'];
7
+ this.UNSELECTED_CLASSES = ['ariadne-text-gray-500', 'hover:ariadne-text-gray-700', 'hover:ariadne-border-gray-300'];
8
+ }
9
+ connect() {
10
+ for (const tab of this.tabTargets) {
11
+ if (tab.hasAttribute('aria-current')) {
12
+ tab.classList.add(...this.SELECTED_CLASSES);
13
+ tab.classList.remove(...this.UNSELECTED_CLASSES);
14
+ }
15
+ }
16
+ }
17
+ toggle(event) {
18
+ for (const tab of this.tabTargets) {
19
+ if (tab === event.target) {
20
+ tab.setAttribute('aria-current', 'page');
21
+ tab.classList.add(...this.SELECTED_CLASSES);
22
+ tab.classList.remove(...this.UNSELECTED_CLASSES);
23
+ }
24
+ else if (tab.hasAttribute('aria-current')) {
25
+ tab.removeAttribute('aria-current');
26
+ tab.classList.add(...this.UNSELECTED_CLASSES);
27
+ tab.classList.remove(...this.SELECTED_CLASSES);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ TabNavComponent.targets = ['tab'];
@@ -1,4 +1,4 @@
1
- <div class="ariadne-inline-block ariadne-min-w-full ariadne-py-2 ariadne-align-middle md:ariadne-px-6 lg:ariadne-px-8">
1
+ <div class="ariadne-inline-block ariadne-min-w-full ariadne-align-middle md:ariadne-px-6 lg:ariadne-px-8">
2
2
  <div class="ariadne-overflow-hidden ariadne-shadow ariadne-ring-1 ariadne-ring-black ariadne-ring-opacity-5 md:ariadne-rounded-lg">
3
3
  <%= render(Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes)) do |table| %>
4
4
  <% if has_header_row? %>
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ import '@github/time-elements';
@@ -0,0 +1 @@
1
+ import '@github/time-elements';
@@ -0,0 +1 @@
1
+ import '@github/time-elements';
@@ -0,0 +1 @@
1
+ import '@github/time-elements';
@@ -0,0 +1,24 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import type { Instance, Placement } from '@popperjs/core';
3
+ export default class TooltipComponent extends Controller {
4
+ static targets: string[];
5
+ readonly triggerTarget: HTMLElement;
6
+ readonly tooltipTarget: HTMLElement;
7
+ static values: {
8
+ placement: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ offset: {
13
+ type: ArrayConstructor;
14
+ default: number[];
15
+ };
16
+ };
17
+ readonly placementValue: Placement;
18
+ readonly offsetValue: Array<number>;
19
+ popperInstance: Instance;
20
+ connect(): void;
21
+ disconnect(): void;
22
+ show(): void;
23
+ hide(): void;
24
+ }