ariadne_view_components 0.0.79.4 → 0.0.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 191ebf85e699edb8806ba64a8979be20bfc962db6b2f36fcf37fb244ae7bd753
4
- data.tar.gz: 802332bdae038a697836a0f09b8c06cdee7b98fc6bc1947ab35f8918aa3249ef
3
+ metadata.gz: eb0598082bb646f6d5d060f05948ecd9e1c09d242a2a075a785873428c3b9e69
4
+ data.tar.gz: 188baa7407dae8cb953d659b317112deba9f50212499fd11ed1896f9e943ebca
5
5
  SHA512:
6
- metadata.gz: 7bd1b82ed39aef69f710450c25f0c7bc4e96ba9629100f7cbd980d8877ec8e158a87fa9058819efb83c07de57cd89760aa34fefe9c10c02bfb9c53cee453cd51
7
- data.tar.gz: 2b6a746a0c4f6711d00fd5209b941eba4a4a002f3cd16ee443d1c699fb257d03995552d6408d5279f5d0979318eb5d230ea2498ef5ef6b42db57efdb4dfed7d6
6
+ metadata.gz: 1eba52ef4fad4d22da53d095a98cca8e7a10abe8d5710c4440f1ba4d59d38ee00165dba9ea89a0ee6c55fe5a0e1a9bf0b9d0aca6507c8b517a33125d8915131f
7
+ data.tar.gz: da0845c52a8550a7c276b0f7f192358a70e51bf9525d15d6aedb93634eed8f6ec44e02398d8b5d561af4ec26f72834c532287a9be71cd6f18da689b79fd93688
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [v0.0.80] - 08-05-2024\n
2
+ ## What's Changed
3
+ * [auto-browserslist] Update Browserslist db by @sisyphusbot in https://github.com/yettoapp/ariadne/pull/481
4
+ * [auto-browserslist] Update Browserslist db by @sisyphusbot in https://github.com/yettoapp/ariadne/pull/482
5
+ * Fix id gen by @gjtorikian in https://github.com/yettoapp/ariadne/pull/483
6
+
7
+
8
+ **Full Changelog**: https://github.com/yettoapp/ariadne/compare/v0.0.79.2...v0.0.80
1
9
  ## [v0.0.79.2] - 25-04-2024
2
10
  **Full Changelog**: https://github.com/yettoapp/ariadne/compare/v0.0.79.1...v0.0.79.2
3
11
  ## [v0.0.79.1] - 25-04-2024
@@ -1,4 +1,4 @@
1
- <main class="ariadne-bg-background dark:ariadne-bg-background-dark ariadne-text-content dark:ariadne-text-content-dark ariadne-grow ariadne-h-screen ariadne-py-6 ariadne-px-1">
1
+ <main class="<%= html_attrs[:class] %>" <%= html_attributes %>>
2
2
  <div class="ariadne-mt-10 sm:ariadne-mx-auto sm:ariadne-w-full sm:ariadne-max-w-[480px]">
3
3
  <div class="ariadne-bg-foreground dark:ariadne-bg-foreground-dark ariadne-px-6 ariadne-py-12 ariadne-shadow sm:ariadne-rounded-lg sm:ariadne-px-12">
4
4
  <%= content %>
@@ -4,15 +4,22 @@
4
4
  module Ariadne
5
5
  module Layout
6
6
  module Narrow
7
- class Component < BaseComponent
7
+ class Component < Ariadne::BaseComponent
8
8
  renders_one :footer, Ariadne::BaseComponent::ACCEPT_ANYTHING
9
9
 
10
- style do
10
+ accepts_html_attributes do |html_attrs|
11
+ html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style(:container), html_attrs[:class]].join(" "))
12
+ end
13
+
14
+ style(:container) do
11
15
  base do
12
16
  [
17
+ "ariadne-bg-background",
18
+ "dark:ariadne-bg-background-dark",
19
+ "ariadne-text-content",
20
+ "dark:ariadne-text-content-dark",
13
21
  "ariadne-grow",
14
- "ariadne-bg-zinc-50",
15
- "dark:ariadne-bg-zinc-900",
22
+ "ariadne-h-screen",
16
23
  "ariadne-py-6",
17
24
  "ariadne-px-1",
18
25
  ]
@@ -4,7 +4,7 @@
4
4
  module Ariadne
5
5
  module Layout
6
6
  module Wide
7
- class Component < BaseComponent
7
+ class Component < Ariadne::BaseComponent
8
8
  renders_one :footer, Ariadne::BaseComponent::ACCEPT_ANYTHING
9
9
 
10
10
  style do
@@ -4,7 +4,7 @@
4
4
  module Ariadne
5
5
  module UI
6
6
  module Combobox
7
- class Component < BaseComponent
7
+ class Component < Ariadne::BaseComponent
8
8
  option :placement, default: proc { "bottom" }
9
9
  option :show_search, default: proc { :no }
10
10
  option :size, default: proc { :md }
@@ -5,7 +5,7 @@ module Ariadne
5
5
  module UI
6
6
  module Combobox
7
7
  module Item
8
- class Component < BaseComponent
8
+ class Component < Ariadne::BaseComponent
9
9
  option :label
10
10
  option :as, default: proc { :link } # :button
11
11
 
@@ -5,7 +5,7 @@ module Ariadne
5
5
  module UI
6
6
  module Combobox
7
7
  module Option
8
- class Component < BaseComponent
8
+ class Component < Ariadne::BaseComponent
9
9
  option :as, default: proc { :link } # :button
10
10
 
11
11
  option :type, default: proc { :multiple }
@@ -17,7 +17,7 @@ module Ariadne
17
17
  end
18
18
 
19
19
  def to_component
20
- Ariadne::UI::Button::Component.new.with_caption(@caption).with_block(@block)
20
+ Ariadne::UI::Button::Component.new(**@options).with_content(@label)
21
21
  end
22
22
 
23
23
  # :nocov:
@@ -3,6 +3,6 @@
3
3
  # :nocov:
4
4
  module Ariadne
5
5
  module ViewComponents
6
- VERSION = "0.0.79.4"
6
+ VERSION = "0.0.80"
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.79.4
4
+ version: 0.0.80
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-07 00:00:00.000000000 Z
11
+ date: 2024-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tailwind_merge
@@ -111,7 +111,7 @@ dependencies:
111
111
  - - "~>"
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0.2'
114
- description:
114
+ description:
115
115
  email:
116
116
  - gjtorikian@yetto.app
117
117
  executables: []
@@ -128,9 +128,7 @@ files:
128
128
  - app/assets/stylesheets/ariadne_view_components.css
129
129
  - app/assets/stylesheets/ariadne_view_components.css.br
130
130
  - app/assets/stylesheets/ariadne_view_components.css.gz
131
- - app/components/ariadne/ariadne-form.js
132
131
  - app/components/ariadne/ariadne-form.ts
133
- - app/components/ariadne/ariadne.js
134
132
  - app/components/ariadne/base_component.rb
135
133
  - app/components/ariadne/behaviors/captionable.rb
136
134
  - app/components/ariadne/behaviors/tooltipable.rb
@@ -172,7 +170,6 @@ files:
172
170
  - app/components/ariadne/layout/two_panel/component.rb
173
171
  - app/components/ariadne/layout/wide/component.html.erb
174
172
  - app/components/ariadne/layout/wide/component.rb
175
- - app/components/ariadne/tmp/components/ariadne/ariadne-form.d.ts
176
173
  - app/components/ariadne/turbo/frame/component.html.erb
177
174
  - app/components/ariadne/turbo/frame/component.rb
178
175
  - app/components/ariadne/turbo/stream_action/component.html.erb
@@ -312,7 +309,7 @@ licenses:
312
309
  - AGPL-3.0-or-later
313
310
  metadata:
314
311
  allowed_push_host: https://rubygems.org
315
- post_install_message:
312
+ post_install_message:
316
313
  rdoc_options: []
317
314
  require_paths:
318
315
  - lib
@@ -327,8 +324,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
324
  - !ruby/object:Gem::Version
328
325
  version: '0'
329
326
  requirements: []
330
- rubygems_version: 3.4.21
331
- signing_key:
327
+ rubygems_version: 3.4.6
328
+ signing_key:
332
329
  specification_version: 4
333
330
  summary: ViewComponents + TailwindCSS + Stimulus
334
331
  test_files: []
@@ -1,83 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus';
2
- import { html } from 'lit-html';
3
- class AriadneFormWith extends Controller {
4
- constructor() {
5
- super(...arguments);
6
- this.onBlur = (event) => {
7
- this.validateField(event.target);
8
- };
9
- this.onSubmit = (event) => {
10
- if (!this.validateForm()) {
11
- event.preventDefault();
12
- this.firstInvalidField?.focus();
13
- }
14
- };
15
- this.getRenderString = (data) => {
16
- const { strings, values } = data;
17
- const v = [...values, ''].map(e => (typeof e === 'object' ? this.getRenderString(e) : e));
18
- return strings.reduce((acc, s, i) => acc + s + v[i], '');
19
- };
20
- }
21
- connect() {
22
- this.element.setAttribute('novalidate', 'true');
23
- this.element.addEventListener('blur', this.onBlur, true);
24
- this.element.addEventListener('submit', this.onSubmit);
25
- this.element.addEventListener('ajax:beforeSend', this.onSubmit);
26
- }
27
- disconnect() {
28
- this.element.removeEventListener('blur', this.onBlur);
29
- this.element.removeEventListener('submit', this.onSubmit);
30
- this.element.removeEventListener('ajax:beforeSend', this.onSubmit);
31
- }
32
- validateForm() {
33
- let isValid = true;
34
- // Not using `find` because we want to validate all the fields
35
- for (const field of this.formFields) {
36
- if (this.shouldValidateField(field) && !this.validateField(field))
37
- isValid = false;
38
- }
39
- return isValid;
40
- }
41
- validateField(field) {
42
- if (!this.shouldValidateField(field))
43
- return true;
44
- const isValid = field.checkValidity();
45
- field.classList.toggle('invalid', !isValid);
46
- this.refreshErrorForInvalidField(field, isValid);
47
- return isValid;
48
- }
49
- shouldValidateField(field) {
50
- return (!field.disabled &&
51
- !field.classList.contains('ProseMirror') &&
52
- !['file', 'reset', 'submit', 'button'].includes(field.type));
53
- }
54
- refreshErrorForInvalidField(field, isValid) {
55
- this.removeExistingErrorMessage(field);
56
- if (!isValid)
57
- this.showErrorForInvalidField(field);
58
- }
59
- removeExistingErrorMessage(field) {
60
- const fieldContainer = field.closest('.field');
61
- if (!fieldContainer)
62
- return;
63
- const existingErrorMessageElement = fieldContainer.querySelector('.error');
64
- if (existingErrorMessageElement) {
65
- existingErrorMessageElement?.parentNode?.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.formFieldTargets);
77
- }
78
- get firstInvalidField() {
79
- return this.formFields.find(field => !field.checkValidity());
80
- }
81
- }
82
- AriadneFormWith.targets = ['formField'];
83
- export default AriadneFormWith;
@@ -1,40 +0,0 @@
1
- import { Application } from '@hotwired/stimulus';
2
- const application = Application.start();
3
- application.debug = import.meta.env.DEV;
4
- window.Stimulus = application;
5
- const componentModules = import.meta.glob(['../../components/**/component.ts'], { eager: true });
6
- for (const [path, module] of Object.entries(componentModules)) {
7
- const dirs = path.split('/');
8
- // Dropping ../../components and component.ts parts
9
- const name = dirs
10
- .slice(3, dirs.length - 1)
11
- .join('-')
12
- .replaceAll('_', '-')
13
- .toLocaleLowerCase();
14
- application.register(
15
- // @tag stimulus-id
16
- `ui-cmp-${name}`, module.default);
17
- }
18
- // import AriadneForm from './ariadne-form'
19
- // import StringMatchController from './string_match_controller/string_match_controller'
20
- // import EventsController from './events_controller/events_controller'
21
- // import OptionsController from './options_controller/options_controller'
22
- // import AccumulatorController from './accumulator_controller/accumulator_controller'
23
- // import ToggleableController from './toggleable_controller/toggleable_controller'
24
- // import ClipboardCopyComponent from './clipboard_copy_component/clipboard-copy-component'
25
- // import SlideoverComponent from './slideover_component/slideover-component'
26
- // import TabNavComponent from './tab_nav_component/tab-nav-component'
27
- // import TooltipComponent from './tooltip_component/tooltip-component'
28
- // import './tab_container_component/tab-container-component'
29
- // import './time_ago_component/time-ago-component'
30
- // const application = Application.start()
31
- // application.register('clipboard-copy-component', ClipboardCopyComponent)
32
- // application.register('ariadne-form', AriadneForm)
33
- // application.register('slideover-component', SlideoverComponent)
34
- // application.register('tab-nav-component', TabNavComponent)
35
- // application.register('tooltip-component', TooltipComponent)
36
- // application.register('toggleable', ToggleableController)
37
- // application.register('accumulator', AccumulatorController)
38
- // application.register('options', OptionsController)
39
- // application.register('string-match', StringMatchController)
40
- // application.register('events', EventsController)
@@ -1,22 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus';
2
- import type { TemplateResult } from 'lit-html';
3
- 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 {};