odt-ui-rails 2.2.4 → 2.2.6

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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OdtUi
4
- VERSION = "2.2.4"
4
+ VERSION = "2.2.6"
5
5
  end
data/lib/odt_ui.rb CHANGED
@@ -1,3 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "odt-ui-rails"
3
+ require "odt_ui/version"
4
+ require "odt_ui/helper"
5
+ require "odt_ui/engine" if defined?(Rails)
6
+
7
+ module OdtUi
8
+ end
data/sig/odt_ui.rbs CHANGED
@@ -2,41 +2,45 @@ module OdtUi
2
2
  VERSION: String
3
3
 
4
4
  module Helper
5
- type button_variant = :filled | :frosted | :capsule | :ghost | :light | :outline | :outlined | :subtle | String
6
- type button_color = :primary | :secondary | :surface | :muted | :inverse | :success | :warning | :danger | :info | :neutral | String
7
- type button_size = :xs | :sm | :md | :lg | :xl | String
8
- type radius_size = :none | :xs | :sm | :md | :lg | :xl | :"2xl" | :"3xl" | :"4xl" | :full | Symbol | String
9
- type shadow_size = :none | :card | :dropdown | :modal | :popover | Symbol | String
10
-
11
- type badge_variant = :subtle | :filled | :outlined | :outline | String
12
- type badge_color = :primary | :secondary | :success | :warning | :danger | :info | :neutral | String
13
- type badge_size = :sm | :md | String
14
-
15
- type card_variant = :elevated | :outlined | :subtle | :muted | :ghost | :frosted | String
16
- type card_background = :base | :surface | :surface_elevated | :surface_muted | :surface_subtle | :gradient_primary | :gradient_secondary | :gradient_vibrant | :gradient_hero | :frosted | :frosted_muted | :frosted_subtle | :frosted_gradient_primary | :frosted_gradient_secondary | :transparent | Symbol | String
17
- type card_border = :none | :muted | :base | :strong | :primary | :secondary | :danger | :success | bool | Symbol | String
18
- type card_padding = :none | :xs | :sm | :md | :lg | :xl | :"2xl" | Symbol | String
19
- type card_tag = :div | :article | :section | :aside | :main | Symbol | String
20
-
21
- type alert_variant = :success | :warning | :danger | :info | String
22
- type heading_tag = :h1 | :h2 | :h3 | :h4 | :h5 | :h6 | String
23
- type heading_size = :"5xl" | :"4xl" | :"3xl" | :"2xl" | :xl | :lg | Symbol | String
24
- type font_weight = :light | :normal | :medium | :semibold | :bold | :extrabold | Symbol | String
25
- type typography_color = :strong | :default | :muted | :subtle | :disabled | :primary | :secondary | :success | :warning | :danger | :info | Symbol | String
26
-
27
- type text_tag = :p | :span | :div | :label | :small | Symbol | String
28
- type text_size = :xs | :sm | :base | :lg | :xl | :"2xl" | Symbol | String
29
-
30
- type avatar_size = :xs | :sm | :md | :lg | :xl | :"2xl" | String
31
- type avatar_color = :secondary | :primary | :neutral | String
32
-
33
- type input_variant = :outlined | :filled | :frosted | String
34
- type input_size = :sm | :md | :lg | String
35
- type input_resize = :none | :vertical | :horizontal | :both | String
36
- type checkbox_color = :primary | :secondary | :success | :warning | :danger | :dark | :neutral | String
37
- type checkbox_size = :sm | :md | :lg | String
38
-
39
- # Renders an ODT Button component.
5
+ type button_variant = :filled | :frosted | :capsule | :ghost
6
+ type button_color = :primary | :secondary | :surface | :muted | :inverse | :success | :warning | :danger | :info
7
+ type button_size = :sm | :md | :lg
8
+ type radius_size = :none | :xs | :sm | :md | :lg | :xl | :"2xl" | :"3xl" | :"4xl" | :full
9
+ type shadow_size = :none | :card | :dropdown | :modal | :popover
10
+
11
+ type badge_variant = :subtle | :filled | :outlined
12
+ type badge_color = :primary | :secondary | :success | :warning | :danger | :info | :neutral
13
+ type badge_size = :sm | :md
14
+
15
+ type card_variant = :elevated | :outlined | :subtle | :ghost
16
+ type card_background = :base | :surface | :surface_elevated | :"surface-elevated" | :surface_muted | :"surface-muted" | :surface_subtle | :"surface-subtle" | :gradient_primary | :"gradient-primary" | :gradient_secondary | :"gradient-secondary" | :gradient_vibrant | :"gradient-vibrant" | :gradient_hero | :"gradient-hero" | :frosted | :frosted_muted | :"frosted-muted" | :frosted_subtle | :"frosted-subtle" | :frosted_gradient_primary | :"frosted-gradient-primary" | :frosted_gradient_secondary | :"frosted-gradient-secondary" | :transparent
17
+ type card_border = :none | :muted | :base | :strong | :primary | :secondary | :danger | :success | bool
18
+ type card_padding = :none | :xs | :sm | :md | :lg | :xl | :"2xl"
19
+ type card_tag = :div | :article | :section | :aside | :main
20
+
21
+ type alert_variant = :success | :warning | :danger | :info
22
+
23
+ type heading_tag = :h1 | :h2 | :h3 | :h4 | :h5 | :h6
24
+ type heading_size = :"5xl" | :"4xl" | :"3xl" | :"2xl" | :xl | :lg
25
+ type font_weight = :light | :normal | :medium | :semibold | :bold | :extrabold
26
+ type typography_color = :strong | :default | :muted | :subtle | :disabled | :inverse | :"inverse-strong" | :inverse_strong | :"inverse-muted" | :inverse_muted | :"inverse-subtle" | :inverse_subtle | :"inverse-disabled" | :inverse_disabled | :primary | :secondary | :success | :warning | :danger | :info
27
+
28
+ type text_tag = :p | :span | :div | :label | :small
29
+ type text_size = :xs | :sm | :base | :lg | :xl | :"2xl"
30
+
31
+ type avatar_size = :xs | :sm | :md | :lg | :xl | :"2xl"
32
+ type avatar_color = :primary | :secondary | :neutral
33
+
34
+ type input_variant = :outlined | :filled | :frosted | :unstyled
35
+ type input_size = :sm | :md | :lg
36
+ type input_resize = :none | :vertical | :horizontal | :both
37
+
38
+ type checkbox_color = :primary | :secondary | :success | :warning | :danger | :dark
39
+ type checkbox_size = :sm | :md | :lg
40
+ type radio_color = :primary | :secondary | :success | :warning | :danger | :dark
41
+ type radio_size = :sm | :md | :lg
42
+ type radio_orientation = :horizontal | :vertical
43
+
40
44
  def odt_button: (
41
45
  ?String? text,
42
46
  ?variant: button_variant,
@@ -55,7 +59,6 @@ module OdtUi
55
59
  **untyped
56
60
  ) ?{ () -> untyped } -> untyped
57
61
 
58
- # Renders an ODT Badge component.
59
62
  def odt_badge: (
60
63
  ?String? text,
61
64
  ?variant: badge_variant,
@@ -67,7 +70,6 @@ module OdtUi
67
70
  **untyped
68
71
  ) ?{ () -> untyped } -> untyped
69
72
 
70
- # Renders an ODT Card component.
71
73
  def odt_card: (
72
74
  ?title: String?,
73
75
  ?subtitle: String?,
@@ -83,7 +85,6 @@ module OdtUi
83
85
  **untyped
84
86
  ) ?{ () -> untyped } -> untyped
85
87
 
86
- # Renders an ODT Alert banner.
87
88
  def odt_alert: (
88
89
  ?String? message,
89
90
  ?variant: alert_variant,
@@ -91,7 +92,6 @@ module OdtUi
91
92
  **untyped
92
93
  ) ?{ () -> untyped } -> untyped
93
94
 
94
- # Renders an ODT Heading element.
95
95
  def odt_heading: (
96
96
  ?String? text,
97
97
  ?as: heading_tag,
@@ -102,7 +102,6 @@ module OdtUi
102
102
  **untyped
103
103
  ) ?{ () -> untyped } -> untyped
104
104
 
105
- # Renders styled body text.
106
105
  def odt_text: (
107
106
  ?String? text,
108
107
  ?as: text_tag,
@@ -113,18 +112,16 @@ module OdtUi
113
112
  **untyped
114
113
  ) ?{ () -> untyped } -> untyped
115
114
 
116
- # Renders an ODT Avatar element.
117
115
  def odt_avatar: (
118
116
  ?name: String?,
119
117
  ?src: String?,
120
118
  ?size: avatar_size,
121
119
  ?color: avatar_color,
122
- ?icon: String,
120
+ ?icon: String?,
123
121
  ?fallback: String?,
124
122
  **untyped
125
123
  ) -> untyped
126
124
 
127
- # Renders a styled input field.
128
125
  def odt_input: (
129
126
  ?label: String?,
130
127
  ?variant: input_variant,
@@ -147,7 +144,6 @@ module OdtUi
147
144
  **untyped
148
145
  ) -> untyped
149
146
 
150
- # Renders a styled textarea field.
151
147
  def odt_textarea: (
152
148
  ?label: String?,
153
149
  ?variant: input_variant,
@@ -164,7 +160,6 @@ module OdtUi
164
160
  **untyped
165
161
  ) ?{ () -> untyped } -> untyped
166
162
 
167
- # Renders a styled native <select> dropdown.
168
163
  def odt_select: (
169
164
  ?label: String?,
170
165
  ?options: untyped,
@@ -181,7 +176,6 @@ module OdtUi
181
176
  **untyped
182
177
  ) -> untyped
183
178
 
184
- # Renders a styled checkbox.
185
179
  def odt_checkbox: (
186
180
  ?label: String?,
187
181
  ?description: String?,
@@ -194,19 +188,17 @@ module OdtUi
194
188
  **untyped
195
189
  ) -> untyped
196
190
 
197
- # Renders a styled radio button.
198
191
  def odt_radio: (
199
192
  ?label: String?,
200
193
  ?description: String?,
201
194
  ?checked: bool,
202
- ?color: checkbox_color,
203
- ?size: checkbox_size,
195
+ ?color: radio_color,
196
+ ?size: radio_size,
204
197
  ?disabled: bool,
205
198
  ?error: String?,
206
199
  **untyped
207
200
  ) -> untyped
208
201
 
209
- # Renders a form field wrapper.
210
202
  def odt_form_group: (
211
203
  ?label: String?,
212
204
  ?error: String?,
@@ -217,48 +209,49 @@ module OdtUi
217
209
  **untyped
218
210
  ) ?{ () -> untyped } -> untyped
219
211
 
220
- type toaster_position = :top_right | :top_center | :top_left | :bottom_right | :bottom_center | :bottom_left | Symbol | String
221
- type toast_variant = :success | :warning | :danger | :error | :info | :loading | :frosted | Symbol | String
212
+ type toaster_position = :top_right | :"top-right" | :top_center | :"top-center" | :top_left | :"top-left" | :bottom_right | :"bottom-right" | :bottom_center | :"bottom-center" | :bottom_left | :"bottom-left"
213
+ type toast_variant = :elevated | :frosted | :subtle | :outlined
214
+ type toast_type = :default | :success | :warning | :danger | :error | :info | :loading
222
215
 
223
- # Renders an ODT Toaster viewport container.
224
216
  def odt_toaster: (
225
217
  ?position: toaster_position,
226
218
  ?id: String,
219
+ ?expand: bool,
227
220
  **untyped
228
221
  ) ?{ () -> untyped } -> untyped
229
222
 
230
- # Renders a single ODT Toast card.
231
223
  def odt_toast: (
232
224
  ?String? message,
233
225
  ?title: String?,
234
226
  ?variant: toast_variant,
227
+ ?type: toast_type,
235
228
  ?icon: String?,
236
229
  ?duration: Integer,
237
230
  ?dismissible: bool,
238
231
  ?radius: radius_size?,
232
+ ?rich_colors: bool,
239
233
  **untyped
240
234
  ) ?{ () -> untyped } -> untyped
241
235
 
242
- # Renders active flash messages as ODT Toasts.
243
236
  def odt_flash_toasts: (
244
237
  ?untyped flash_hash,
245
238
  ?duration: Integer
246
239
  ) -> untyped
247
240
 
248
- # Generates a Turbo Stream action for a toast.
249
241
  def odt_toast_stream: (
250
242
  ?String? message,
251
243
  ?title: String?,
252
244
  ?variant: toast_variant,
245
+ ?type: toast_type,
253
246
  ?target: String,
254
247
  ?action: Symbol | String,
255
248
  ?duration: Integer,
249
+ ?rich_colors: bool,
256
250
  **untyped
257
251
  ) -> untyped
258
252
 
259
- type modal_size = :sm | :md | :lg | :xl | :full | Symbol | String
253
+ type modal_size = :sm | :md | :lg | :xl | :full
260
254
 
261
- # Renders an ODT Modal dialog container.
262
255
  def odt_modal: (
263
256
  ?id: String?,
264
257
  ?title: String?,
@@ -271,7 +264,6 @@ module OdtUi
271
264
  **untyped
272
265
  ) ?{ () -> untyped } -> untyped
273
266
 
274
- # Renders an ODT Modal Header subcomponent.
275
267
  def odt_modal_header: (
276
268
  ?title: String?,
277
269
  ?subtitle: String?,
@@ -279,15 +271,81 @@ module OdtUi
279
271
  **untyped
280
272
  ) ?{ () -> untyped } -> untyped
281
273
 
282
- # Renders an ODT Modal Body subcomponent.
283
274
  def odt_modal_body: (
284
275
  **untyped
285
276
  ) ?{ () -> untyped } -> untyped
286
277
 
287
- # Renders an ODT Modal Footer subcomponent.
288
278
  def odt_modal_footer: (
289
279
  **untyped
290
280
  ) ?{ () -> untyped } -> untyped
281
+
282
+ type dropdown_align = :start | :center | :end
283
+ type dropdown_side = :bottom | :top | :left | :right
284
+ type dropdown_variant = :outlined | :filled | :frosted
285
+ type dropdown_size = :sm | :md | :lg
286
+
287
+ def odt_dropdown_menu: (
288
+ ?open: bool,
289
+ ?close_on_click_outside: bool,
290
+ ?close_on_select: bool,
291
+ ?full_width: bool,
292
+ **untyped
293
+ ) ?{ () -> untyped } -> untyped
294
+
295
+ def odt_dropdown_trigger: (
296
+ ?String? text,
297
+ ?label: String?,
298
+ ?helper: String?,
299
+ ?helper_text: String?,
300
+ ?error: String?,
301
+ ?variant: dropdown_variant,
302
+ ?size: dropdown_size,
303
+ ?radius: radius_size?,
304
+ ?chevron: bool,
305
+ ?placeholder: String?,
306
+ ?left_icon: String?,
307
+ ?right_icon: String?,
308
+ ?full_width: bool,
309
+ ?disabled: bool,
310
+ **untyped
311
+ ) ?{ () -> untyped } -> untyped
312
+
313
+ def odt_dropdown_content: (
314
+ ?align: dropdown_align,
315
+ ?side: dropdown_side,
316
+ ?radius: radius_size?,
317
+ ?shadow: shadow_size?,
318
+ ?full_width: bool,
319
+ **untyped
320
+ ) ?{ () -> untyped } -> untyped
321
+
322
+ def odt_dropdown_item: (
323
+ ?String? text,
324
+ ?href: String?,
325
+ ?left_icon: String?,
326
+ ?right_icon: String?,
327
+ ?shortcut: String?,
328
+ ?destructive: bool,
329
+ ?disabled: bool,
330
+ ?inset: bool,
331
+ ?value: String?,
332
+ **untyped
333
+ ) ?{ () -> untyped } -> untyped
334
+
335
+ def odt_dropdown_label: (
336
+ ?String? text,
337
+ ?inset: bool,
338
+ **untyped
339
+ ) ?{ () -> untyped } -> untyped
340
+
341
+ def odt_dropdown_separator: (
342
+ **untyped
343
+ ) -> untyped
344
+
345
+ def odt_dropdown_shortcut: (
346
+ ?String? text,
347
+ **untyped
348
+ ) ?{ () -> untyped } -> untyped
291
349
  end
292
350
  end
293
351
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odt-ui-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pixel
@@ -47,14 +47,13 @@ files:
47
47
  - README.md
48
48
  - app/assets/stylesheets/odt_ui.css
49
49
  - app/assets/stylesheets/odt_ui/styles.css
50
- - app/assets/stylesheets/odt_ui/theme.css
51
50
  - app/assets/stylesheets/odt_ui/tokens.css
52
- - app/javascript/controllers/odt_modal_controller.js
53
- - app/javascript/controllers/odt_toast_controller.js
54
51
  - lib/generators/odt/install_generator.rb
52
+ - lib/generators/odt/templates/odt_dropdown_controller.js
55
53
  - lib/generators/odt/templates/odt_modal_controller.js
56
54
  - lib/generators/odt/templates/odt_theme.css
57
55
  - lib/generators/odt/templates/odt_toast_controller.js
56
+ - lib/generators/odt/templates/odt_toaster_controller.js
58
57
  - lib/generators/odt/templates/odt_ui.rbs
59
58
  - lib/odt-ui-rails.rb
60
59
  - lib/odt_ui.rb
@@ -1,126 +0,0 @@
1
- /*
2
- * odt_ui/theme.css
3
- *
4
- * Tailwind CSS v4 @theme configuration for ODT Design Tokens.
5
- *
6
- * Usage in application.tailwind.css / application.css:
7
- * @import "tailwindcss";
8
- * @import "odt_ui/tokens.css";
9
- * @import "odt_ui/styles.css";
10
- * @import "odt_ui/theme.css";
11
- */
12
-
13
- @theme {
14
- /* Primary Colors */
15
- --color-primary-0: hsl(240 78.3% 100%);
16
- --color-primary-50: hsl(240 78.3% 95%);
17
- --color-primary-100: hsl(240 78.3% 90%);
18
- --color-primary-200: hsl(240 78.3% 85%);
19
- --color-primary-300: hsl(240 78.3% 80%);
20
- --color-primary-400: hsl(240 78.3% 75%);
21
- --color-primary-500: hsl(240 78.3% 65%);
22
- --color-primary-600: hsl(240 78.3% 60%);
23
- --color-primary-700: hsl(240 78.3% 55%);
24
- --color-primary-800: hsl(240 78.3% 45%);
25
- --color-primary-900: hsl(240 78.3% 34.3%);
26
-
27
- /* Secondary Colors */
28
- --color-secondary-0: hsl(47 100% 100%);
29
- --color-secondary-50: hsl(47 100% 95%);
30
- --color-secondary-100: hsl(47 100% 85%);
31
- --color-secondary-200: hsl(47 100% 80%);
32
- --color-secondary-300: hsl(47 100% 75%);
33
- --color-secondary-400: hsl(47 100% 70%);
34
- --color-secondary-500: hsl(47 100% 65%);
35
- --color-secondary-600: hsl(47 100% 60%);
36
- --color-secondary-700: hsl(47 100% 55%);
37
- --color-secondary-800: hsl(47 100% 50%);
38
- --color-secondary-900: hsl(47 100% 45%);
39
-
40
- /* Neutral Palette */
41
- --color-neutral-0: hsl(0 0% 100%);
42
- --color-neutral-50: hsl(240 10% 98%);
43
- --color-neutral-100: hsl(240 10% 96%);
44
- --color-neutral-200: hsl(240 9% 90%);
45
- --color-neutral-300: hsl(240 8% 82%);
46
- --color-neutral-400: hsl(240 8% 64%);
47
- --color-neutral-500: hsl(240 7% 46%);
48
- --color-neutral-600: hsl(240 7% 32%);
49
- --color-neutral-700: hsl(240 8% 25%);
50
- --color-neutral-800: hsl(240 10% 15%);
51
- --color-neutral-900: hsl(240 12% 9%);
52
- --color-neutral-950: hsl(240 14% 4%);
53
-
54
- /* Semantic Colors */
55
- --color-success: hsl(142 71% 45%);
56
- --color-success-subtle: hsl(142 71% 96%);
57
- --color-warning: hsl(38 92% 50%);
58
- --color-warning-subtle: hsl(38 92% 96%);
59
- --color-danger: hsl(0 84% 60%);
60
- --color-danger-subtle: hsl(0 84% 97%);
61
- --color-info: hsl(217 91% 60%);
62
- --color-info-subtle: hsl(217 91% 97%);
63
-
64
- /* Surfaces & Backgrounds */
65
- --color-surface-base: hsl(0 0% 100%);
66
- --color-surface: hsl(0 0% 100%);
67
- --color-surface-muted: hsl(240 10% 98%);
68
- --color-surface-subtle: hsl(240 10% 96%);
69
- --color-surface-elevated: hsl(240 10% 98%);
70
- --color-surface-primary: hsl(240 78.3% 65%);
71
- --color-surface-secondary: hsl(47 100% 65%);
72
- --color-surface-success: hsl(142 71% 96%);
73
- --color-surface-warning: hsl(38 92% 96%);
74
- --color-surface-danger: hsl(0 84% 97%);
75
- --color-surface-info: hsl(217 91% 97%);
76
-
77
- /* Foregrounds */
78
- --color-fg-strong: hsl(240 10% 15%);
79
- --color-fg: hsl(240 8% 25%);
80
- --color-fg-muted: hsl(240 7% 46%);
81
- --color-fg-subtle: hsl(240 8% 64%);
82
- --color-fg-disabled: hsl(240 8% 82%);
83
-
84
- --color-fg-inverse-strong: hsl(0 0% 100%);
85
- --color-fg-inverse: hsl(240 10% 98%);
86
- --color-fg-inverse-muted: hsl(240 10% 96%);
87
- --color-fg-inverse-subtle: hsl(240 8% 82%);
88
- --color-fg-inverse-disabled: hsl(240 8% 64%);
89
-
90
- --color-fg-primary: hsl(240 78.3% 34.3%);
91
- --color-fg-secondary: hsl(47 100% 45%);
92
-
93
- --color-fg-success: hsl(142 71% 45%);
94
- --color-fg-warning: hsl(38 92% 50%);
95
- --color-fg-danger: hsl(0 84% 60%);
96
- --color-fg-info: hsl(217 91% 60%);
97
-
98
- --color-ring: hsl(240 78.3% 65%);
99
-
100
- /* Lines & Borders */
101
- --color-line: hsl(240 9% 90%);
102
- --color-line-muted: hsl(240 10% 96%);
103
- --color-line-strong: hsl(240 8% 82%);
104
- --color-line-primary: hsl(240 78.3% 65%);
105
- --color-line-success: hsl(142 71% 45%);
106
- --color-line-warning: hsl(38 92% 50%);
107
- --color-line-danger: hsl(0 84% 60%);
108
-
109
- /* Radius */
110
- --radius-xs: 0.125rem;
111
- --radius-sm: 0.25rem;
112
- --radius-md: 0.375rem;
113
- --radius-lg: 0.5rem;
114
- --radius-xl: 0.75rem;
115
- --radius-2xl: 1rem;
116
- --radius-3xl: 1.5rem;
117
- --radius-4xl: 2rem;
118
- --radius-full: 9999px;
119
-
120
- /* Shadows */
121
- --color-shadow: hsl(240 78.3% 70%);
122
- --shadow-card: 0 8px 26px hsl(240 78.3% 70% / 0.10);
123
- --shadow-dropdown: 0 8px 24px hsl(240 78.3% 70% / 0.12);
124
- --shadow-modal: 0 16px 40px hsl(240 78.3% 70% / 0.16);
125
- --shadow-popover: 0 24px 64px hsl(240 78.3% 70% / 0.20);
126
- }
@@ -1,61 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static targets = ["dialog"]
5
- static values = {
6
- open: { type: Boolean, default: false },
7
- preventBackdropClose: { type: Boolean, default: false }
8
- }
9
-
10
- connect() {
11
- if (this.openValue) {
12
- this.open()
13
- }
14
- }
15
-
16
- open(event) {
17
- if (event) event.preventDefault()
18
-
19
- this.element.classList.remove("hidden")
20
- this.element.setAttribute("aria-hidden", "false")
21
- this.element.classList.remove("odt-modal-overlay--exiting")
22
- if (this.hasDialogTarget) {
23
- this.dialogTarget.classList.remove("odt-modal--exiting")
24
- }
25
-
26
- document.body.style.overflow = "hidden"
27
- this.element.dispatchEvent(new CustomEvent("odt-modal:opened", { bubbles: true }))
28
- }
29
-
30
- close(event) {
31
- if (event) event.preventDefault()
32
-
33
- this.element.classList.add("odt-modal-overlay--exiting")
34
- if (this.hasDialogTarget) {
35
- this.dialogTarget.classList.add("odt-modal--exiting")
36
- }
37
-
38
- document.body.style.overflow = ""
39
-
40
- setTimeout(() => {
41
- this.element.classList.add("hidden")
42
- this.element.classList.remove("odt-modal-overlay--exiting")
43
- if (this.hasDialogTarget) {
44
- this.dialogTarget.classList.remove("odt-modal--exiting")
45
- }
46
- this.element.setAttribute("aria-hidden", "true")
47
- this.element.dispatchEvent(new CustomEvent("odt-modal:closed", { bubbles: true }))
48
- }, 200)
49
- }
50
-
51
- backdropClose(event) {
52
- if (this.preventBackdropCloseValue) return
53
- if (event.target === this.element) {
54
- this.close(event)
55
- }
56
- }
57
-
58
- disconnect() {
59
- document.body.style.overflow = ""
60
- }
61
- }
@@ -1,40 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static values = {
5
- duration: { type: Number, default: 4000 }
6
- }
7
-
8
- connect() {
9
- this.startTimer()
10
- }
11
-
12
- startTimer() {
13
- if (this.durationValue > 0) {
14
- this.timeout = setTimeout(() => this.dismiss(), this.durationValue)
15
- }
16
- }
17
-
18
- pauseTimer() {
19
- if (this.timeout) {
20
- clearTimeout(this.timeout)
21
- this.timeout = null
22
- }
23
- }
24
-
25
- resumeTimer() {
26
- this.startTimer()
27
- }
28
-
29
- dismiss() {
30
- this.pauseTimer()
31
- this.element.classList.add("odt-toast--exiting")
32
- setTimeout(() => {
33
- this.element.remove()
34
- }, 250)
35
- }
36
-
37
- disconnect() {
38
- this.pauseTimer()
39
- }
40
- }