lightning_ui_kit 0.2.1 → 0.3.0

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.
@@ -0,0 +1,22 @@
1
+ <%= tag.div(
2
+ class: classes,
3
+ data: {
4
+ controller: "lui-toast",
5
+ lui_toast_target: "toast",
6
+ lui_toast_autodismiss_value: @autodismiss,
7
+ lui_toast_dismiss_after_value: @dismiss_after,
8
+ }
9
+ ) do %>
10
+ <div class="lui:flex lui:items-center lui:w-full lui:max-w-xs lui:p-4 lui:text-zinc-600 lui:bg-white lui:rounded-lg lui:shadow" role="alert">
11
+ <div class="lui:ml-3 lui:text-sm lui:font-normal"><%= content %></div>
12
+ <button
13
+ type="button"
14
+ class="lui:ml-auto lui:-mx-1.5 lui:-my-1.5 lui:bg-white lui:text-zinc-600 lui:hover:text-zinc-950
15
+ lui:rounded-lg lui:focus:ring-2 lui:focus:ring-zinc-950/10 lui:p-1.5 lui:hover:bg-gray-100 lui:inline-flex
16
+ lui:items-center lui:justify-center lui:h-8 lui:w-8 lui:cursor-pointer" data-action="click->lui-toast#close" aria-label="Close">
17
+ <svg class="lui:w-3 lui:h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
18
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
19
+ </svg>
20
+ </button>
21
+ </div>
22
+ <% end %>
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class LightningUiKit::ToastComponent < LightningUiKit::BaseComponent
4
+ def initialize(autodismiss: true, dismiss_after: 3000, **options)
5
+ @autodismiss = autodismiss
6
+ @dismiss_after = dismiss_after
7
+ @options = options
8
+ end
9
+
10
+ def classes
11
+ merge_classes(["lui:w-full lui:flex lui:justify-center lui:fixed lui:bottom-5", @options[:class]].compact.join(" "))
12
+ end
13
+ end
@@ -0,0 +1,34 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+ import { useTransition } from "stimulus-use"
3
+
4
+ export default class extends Controller {
5
+ static targets = ['toast']
6
+ static values = {
7
+ autodismiss: Boolean,
8
+ dismissAfter: Number
9
+ }
10
+
11
+ connect () {
12
+ if (this.autodismissValue) {
13
+ setTimeout(() => {
14
+ this.close()
15
+ }, this.dismissAfterValue)
16
+ }
17
+
18
+ useTransition(this, {
19
+ element: this.toastTarget,
20
+ enterActive: 'lui:transition lui:ease-in-out lui:duration-150',
21
+ enterFrom: 'lui:transform lui:opacity-0 lui:scale-95',
22
+ enterTo: 'lui:transform lui:opacity-100 lui:scale-100',
23
+ leaveActive: 'lui:transition lui:ease-in-out lui:duration-150',
24
+ leaveFrom: 'lui:transform lui:opacity-100 lui:scale-100',
25
+ leaveTo: 'lui:transform lui:opacity-0 lui:scale-95',
26
+ hiddenClass: "lui:hidden",
27
+ transitioned: true,
28
+ });
29
+ }
30
+
31
+ close () {
32
+ this.leave();
33
+ }
34
+ }
@@ -18,6 +18,7 @@ import RevealController from './controllers/reveal_controller'
18
18
  import SwitchController from './controllers/switch_controller'
19
19
  import DropdownController from './controllers/dropdown_controller'
20
20
  import DropzoneController from './controllers/dropzone_controller'
21
+ import ToastController from './controllers/toast_controller'
21
22
 
22
23
  export function registerLuiControllers(application) {
23
24
  application.register(`${namespace}-clipboard`, ClipboardController)
@@ -30,6 +31,7 @@ export function registerLuiControllers(application) {
30
31
  application.register(`${namespace}-switch`, SwitchController)
31
32
  application.register(`${namespace}-dropdown`, DropdownController)
32
33
  application.register(`${namespace}-dropzone`, DropzoneController)
34
+ application.register(`${namespace}-toast`, ToastController)
33
35
  }
34
36
  registerLuiControllers(application)
35
37
 
data/config/deploy.yml ADDED
@@ -0,0 +1,58 @@
1
+ service: lui_kit
2
+ image: k0va1/lui_kit
3
+
4
+ ssh:
5
+ user: www
6
+
7
+ registry:
8
+ server: ghcr.io
9
+ username: k0va1
10
+ password:
11
+ - KAMAL_REGISTRY_PASSWORD
12
+
13
+ builder:
14
+ arch: amd64
15
+ args:
16
+ RUBY_VERSION: "3.3.5"
17
+ NODE_VERSION: "20.18.1"
18
+ RAILS_ENV: "production"
19
+
20
+ servers:
21
+ web:
22
+ hosts:
23
+ - "49.13.117.76"
24
+ options:
25
+ memory: 512M
26
+
27
+ volumes:
28
+ - ./storage:/rails/lookbook/storage
29
+
30
+ env:
31
+ clear:
32
+ RAILS_LOG_TO_STDOUT: 1
33
+ RAILS_SERVE_STATIC_FILES: 1
34
+ RAILS_ENV: production
35
+ secret:
36
+ - RAILS_MASTER_KEY
37
+
38
+ proxy:
39
+ ssl: false
40
+ app_port: 8000
41
+ host: ui.lightningrails.xyz
42
+ forward_headers: true
43
+ healthcheck:
44
+ interval: 3
45
+ path: /up
46
+ timeout: 3
47
+ logging:
48
+ request_headers:
49
+ - Cache-Control
50
+ - X-Forwarded-Proto
51
+ response_headers:
52
+ - X-Request-ID
53
+ - X-Request-Start
54
+
55
+ aliases:
56
+ console: app exec --interactive --reuse "bin/rails console"
57
+ shell: app exec --interactive --reuse "bash"
58
+ logs: app logs -f
@@ -1,3 +1,3 @@
1
1
  module LightningUiKit
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightning_ui_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Koval
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-09 00:00:00.000000000 Z
11
+ date: 2025-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -161,6 +161,8 @@ files:
161
161
  - app/components/lightning_ui_kit/text_component.rb
162
162
  - app/components/lightning_ui_kit/textarea_component.html.erb
163
163
  - app/components/lightning_ui_kit/textarea_component.rb
164
+ - app/components/lightning_ui_kit/toast_component.html.erb
165
+ - app/components/lightning_ui_kit/toast_component.rb
164
166
  - app/helpers/lightning_ui_kit/application_helper.rb
165
167
  - app/helpers/lightning_ui_kit/heroicon_helper.rb
166
168
  - app/javascript/lightning_ui_kit/controllers/accordion_controller.js
@@ -173,7 +175,9 @@ files:
173
175
  - app/javascript/lightning_ui_kit/controllers/modal_controller.js
174
176
  - app/javascript/lightning_ui_kit/controllers/reveal_controller.js
175
177
  - app/javascript/lightning_ui_kit/controllers/switch_controller.js
178
+ - app/javascript/lightning_ui_kit/controllers/toast_controller.js
176
179
  - app/javascript/lightning_ui_kit/index.js
180
+ - config/deploy.yml
177
181
  - config/initializers/heroicons.rb
178
182
  - config/locales/en.yml
179
183
  - lib/lightning_ui_kit.rb