css-zero 1.1.14 → 2.0.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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -5
  3. data/app/assets/stylesheets/css-zero/reset.css +30 -14
  4. data/app/assets/stylesheets/css-zero/transitions.css +8 -0
  5. data/app/assets/stylesheets/css-zero/utilities.css +9 -15
  6. data/app/assets/stylesheets/css-zero/variables.css +1 -1
  7. data/lib/css_zero/version.rb +1 -1
  8. data/lib/generators/css_zero/add/USAGE +1 -1
  9. data/lib/generators/css_zero/add/add_generator.rb +7 -1
  10. data/lib/generators/css_zero/add/resources.yml +54 -34
  11. data/lib/generators/css_zero/add/templates/app/assets/images/avatar.svg +1 -0
  12. data/lib/generators/css_zero/add/templates/app/assets/images/camera.svg +1 -1
  13. data/lib/generators/css_zero/add/templates/app/assets/images/chevron-down-zinc-500.svg +1 -0
  14. data/lib/generators/css_zero/add/templates/app/assets/images/chevron-down.svg +1 -1
  15. data/lib/generators/css_zero/add/templates/app/assets/images/chevron-left.svg +1 -1
  16. data/lib/generators/css_zero/add/templates/app/assets/images/chevron-right.svg +1 -1
  17. data/lib/generators/css_zero/add/templates/app/assets/images/chevrons-up-down.svg +1 -0
  18. data/lib/generators/css_zero/add/templates/app/assets/images/copy.svg +1 -1
  19. data/lib/generators/css_zero/add/templates/app/assets/images/download.svg +1 -1
  20. data/lib/generators/css_zero/add/templates/app/assets/images/ellipsis.svg +1 -1
  21. data/lib/generators/css_zero/add/templates/app/assets/images/eye-off.svg +1 -0
  22. data/lib/generators/css_zero/add/templates/app/assets/images/eye.svg +1 -1
  23. data/lib/generators/css_zero/add/templates/app/assets/images/grip-horizontal-zink-500.svg +1 -0
  24. data/lib/generators/css_zero/add/templates/app/assets/images/grip-vertical-zink-500.svg +1 -0
  25. data/lib/generators/css_zero/add/templates/app/assets/images/loading.svg +4 -0
  26. data/lib/generators/css_zero/add/templates/app/assets/images/menu.svg +1 -1
  27. data/lib/generators/css_zero/add/templates/app/assets/images/minus.svg +1 -1
  28. data/lib/generators/css_zero/add/templates/app/assets/images/moon.svg +1 -0
  29. data/lib/generators/css_zero/add/templates/app/assets/images/search.svg +1 -1
  30. data/lib/generators/css_zero/add/templates/app/assets/images/share.svg +1 -1
  31. data/lib/generators/css_zero/add/templates/app/assets/images/sun.svg +1 -0
  32. data/lib/generators/css_zero/add/templates/app/assets/images/x.svg +1 -1
  33. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/accordion.css +4 -8
  34. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/alert.css +8 -11
  35. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/avatar.css +1 -3
  36. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/badge.css +11 -2
  37. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/breadcrumb.css +1 -9
  38. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css +12 -19
  39. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/card.css +4 -4
  40. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/carousel.css +5 -5
  41. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/color_scheme.css +33 -0
  42. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/combobox.css +3 -3
  43. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css +2 -4
  44. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/datepicker.css +1 -1
  45. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/dialog.css +2 -6
  46. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/dropzone.css +14 -13
  47. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/flash.css +3 -4
  48. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/group.css +33 -6
  49. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/icons.css +41 -0
  50. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input-clearable.css +7 -0
  51. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input-copyable.css +4 -0
  52. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input-revealable.css +7 -0
  53. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css +24 -30
  54. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/menu.css +2 -4
  55. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/progress.css +2 -2
  56. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/prose.css +1 -5
  57. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/range.css +27 -0
  58. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/resizable.css +22 -7
  59. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/sheet.css +2 -2
  60. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/sidebar_menu.css +6 -8
  61. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/skeleton.css +1 -0
  62. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/table.css +1 -1
  63. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css +1 -1
  64. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css +8 -10
  65. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/trix.css +24 -3
  66. data/lib/generators/css_zero/add/templates/app/javascript/controllers/autosave_controller.js +10 -16
  67. data/lib/generators/css_zero/add/templates/app/javascript/controllers/back_navigation_controller.js +13 -0
  68. data/lib/generators/css_zero/add/templates/app/javascript/controllers/chart_controller.js +10 -14
  69. data/lib/generators/css_zero/add/templates/app/javascript/controllers/color_scheme_controller.js +26 -0
  70. data/lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js +1 -1
  71. data/lib/generators/css_zero/add/templates/app/javascript/controllers/context_menu_controller.js +5 -5
  72. data/lib/generators/css_zero/add/templates/app/javascript/controllers/datepicker_controller.js +0 -1
  73. data/lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js +4 -4
  74. data/lib/generators/css_zero/add/templates/app/javascript/controllers/dropzone_controller.js +1 -1
  75. data/lib/generators/css_zero/add/templates/app/javascript/controllers/dual_range_controller.js +15 -0
  76. data/lib/generators/css_zero/add/templates/app/javascript/controllers/form_controller.js +13 -9
  77. data/lib/generators/css_zero/add/templates/app/javascript/controllers/{copyable_input_controller.js → input_copyable_controller.js} +4 -4
  78. data/lib/generators/css_zero/add/templates/app/javascript/controllers/{revealable_input_controller.js → input_revealable_controller.js} +2 -2
  79. data/lib/generators/css_zero/add/templates/app/javascript/controllers/inputmask_controller.js +1 -1
  80. data/lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js +42 -7
  81. data/lib/generators/css_zero/add/templates/app/javascript/controllers/popover_controller.js +13 -13
  82. data/lib/generators/css_zero/add/templates/app/javascript/controllers/resizable_controller.js +31 -0
  83. data/lib/generators/css_zero/add/templates/app/javascript/controllers/sortable_controller.js +1 -1
  84. data/lib/generators/css_zero/add/templates/app/javascript/controllers/timezone_cookie_controller.js +11 -0
  85. data/lib/generators/css_zero/add/templates/app/javascript/controllers/turbo_confirm_controller.js +1 -1
  86. data/lib/generators/css_zero/add/templates/app/javascript/controllers/{otp_input_controller.js → web_otp_controller.js} +5 -7
  87. data/lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css +16 -51
  88. metadata +26 -15
  89. data/lib/generators/css_zero/add/templates/app/assets/images/arrow-left.svg +0 -1
  90. data/lib/generators/css_zero/add/templates/app/assets/images/arrow-right.svg +0 -1
  91. data/lib/generators/css_zero/add/templates/app/assets/images/circle-alert.svg +0 -1
  92. data/lib/generators/css_zero/add/templates/app/assets/images/default-picture.webp +0 -0
  93. data/lib/generators/css_zero/add/templates/app/assets/images/loader-circle.svg +0 -1
  94. data/lib/generators/css_zero/add/templates/app/assets/images/off.svg +0 -1
  95. data/lib/generators/css_zero/add/templates/app/assets/images/select-arrow.svg +0 -1
  96. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input_concerns.css +0 -19
  97. data/lib/generators/css_zero/add/templates/app/javascript/controllers/navigation_controller.js +0 -16
  98. /data/lib/generators/css_zero/add/templates/app/javascript/controllers/{clearable_input_controller.js → input_clearable_controller.js} +0 -0
@@ -1,11 +1,7 @@
1
- .prose {
1
+ :where(.prose) {
2
2
  font-size: var(--text-fluid-base);
3
3
  max-inline-size: 65ch;
4
4
 
5
- /* Antialiased fonts */
6
- -moz-osx-font-smoothing: grayscale;
7
- -webkit-font-smoothing: antialiased;
8
-
9
5
  :is(h1, h2, h3, h4, h5, h6) {
10
6
  font-weight: var(--font-extrabold);
11
7
  hyphens: auto;
@@ -0,0 +1,27 @@
1
+ @import url("https://esm.sh/@stanko/dual-range-input@1.0.0/dist/index.css");
2
+
3
+ .dual-range-input {
4
+ --dri-height: 1rem;
5
+ --dri-thumb-width: var(--dri-height);
6
+ --dri-thumb-height: var(--dri-height);
7
+ --dri-thumb-color: var(--color-primary);
8
+ --dri-thumb-hover-color: var(--dri-thumb-color);
9
+ --dri-thumb-active-color: var(--color-selected-dark);
10
+ --dri-thumb-border-color: var(--dri-thumb-color);
11
+ --dri-thumb-border-hover-color: var(--dri-thumb-border-color);
12
+ --dri-thumb-border-active-color: var(--dri-thumb-border-color);
13
+ --dri-thumb-border-radius: 1rem;
14
+ --dri-thumb-border-width: 1px;
15
+ --dri-track-height: calc(var(--dri-height) * .45);
16
+ --dri-track-border-radius: 1rem;
17
+ --dri-track-color: var(--color-border);
18
+ --dri-track-filled-color: var(--color-primary);
19
+ }
20
+
21
+ .range {
22
+ accent-color: var(--color-primary);
23
+ }
24
+
25
+ .range:focus-visible {
26
+ outline: var(--input-outline-size, 2px) solid var(--color-selected-dark);
27
+ }
@@ -1,12 +1,27 @@
1
- .resizable-inline {
2
- resize: inline;
1
+ .resizable-horizontal {
2
+ display: flex;
3
+ flex-direction: row;
3
4
  }
4
5
 
5
- .resizable-block {
6
- resize: block;
6
+ .resizable-vertical {
7
+ display: flex;
8
+ flex-direction: column;
7
9
  }
8
10
 
9
- :is(.resizable-inline, .resizable-block) {
10
- background-image: linear-gradient(-45deg, var(--color-border) .75rem, transparent 0.75rem);
11
- overflow: hidden;
11
+ .gutter {
12
+ background-position: center;
13
+ background-repeat: no-repeat;
14
+ background-size: contain;
15
+ }
16
+
17
+ .gutter-horizontal {
18
+ background-image: url("grip-vertical-zink-500.svg");
19
+ border-inline-width: var(--border);
20
+ cursor: col-resize;
21
+ }
22
+
23
+ .gutter-vertical {
24
+ background-image: url("grip-horizontal-zink-500.svg");
25
+ border-block-width: var(--border);
26
+ cursor: row-resize;
12
27
  }
@@ -9,10 +9,10 @@
9
9
  max-block-size: unset;
10
10
 
11
11
  &::backdrop {
12
- background-color: rgba(0, 0, 0, .8);
12
+ background-color: rgba(0, 0, 0, .5);
13
13
  }
14
14
 
15
- /* Setup Transition */
15
+ /* Setup transition */
16
16
  transition-behavior: allow-discrete;
17
17
  transition-duration: var(--time-300);
18
18
  transition-property: display, overlay, transform;
@@ -10,30 +10,28 @@
10
10
  --btn-border-color: transparent;
11
11
  --btn-box-shadow: none;
12
12
  --btn-font-weight: var(--font-normal);
13
- --btn-hover-color: var(--color-secondary);
14
13
  --btn-justify-content: start;
15
14
  --btn-outline-size: 0;
16
15
  --btn-inline-size: var(--size-full);
17
16
  --btn-padding: var(--size-1) var(--size-2);
18
- --btn-text-align: start;
19
17
 
20
- &[aria-current=page] {
21
- --btn-background: var(--color-secondary);
18
+ &[aria-current="page"] {
19
+ --btn-background: var(--color-border-light);
22
20
  }
23
21
 
24
22
  &:focus-visible {
25
- --btn-background: var(--color-secondary);
23
+ --btn-background: var(--color-border-light);
26
24
  }
27
25
 
28
26
  &:is(summary) {
29
27
  &::after {
30
- background-image: url("chevron-right.svg");
31
- background-size: cover;
28
+ background-color: currentColor;
32
29
  block-size: var(--size-4);
33
30
  content: "";
34
- filter: var(--color-filter-text);
35
31
  inline-size: var(--size-4);
36
32
  margin-inline-start: auto;
33
+ mask-image: url("chevron-right.svg");
34
+ mask-size: cover;
37
35
  min-inline-size: var(--size-4);
38
36
  transition: transform var(--time-200);
39
37
  }
@@ -1,5 +1,6 @@
1
1
  .skeleton {
2
2
  animation: var(--animate-blink);
3
+ animation-duration: 2s;
3
4
  border-radius: var(--rounded-md);
4
5
  background-color: var(--color-border);
5
6
  }
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  thead {
12
- color: var(--color-text-subtle);
12
+ color: var(--color-text);
13
13
  }
14
14
 
15
15
  tbody tr {
@@ -21,7 +21,7 @@
21
21
  --btn-hover-color: transparent;
22
22
  --btn-inline-size: var(--size-full);
23
23
 
24
- &:is([aria-selected=true], [aria-current=page]) {
24
+ &:is([aria-selected="true"], [aria-current="page"]) {
25
25
  --btn-background: var(--color-bg);
26
26
  --btn-box-shadow: var(--shadow-sm);
27
27
  --btn-hover-color: var(--color-bg);
@@ -1,13 +1,11 @@
1
- .btn--toggle {
2
- [type="checkbox"] {
3
- position: absolute; clip: rect(0, 0, 0, 0);
4
- }
1
+ .btn--toggle [type="checkbox"] {
2
+ position: absolute; clip: rect(0, 0, 0, 0);
3
+ }
5
4
 
6
- &:has(:checked) {
7
- --btn-background: var(--color-secondary);
8
- }
5
+ .btn--toggle:has(:checked) {
6
+ --btn-background: var(--color-border-light);
7
+ }
9
8
 
10
- &:has(:focus-visible) {
11
- outline: var(--border-2) solid var(--color-selected-dark);
12
- }
9
+ .btn--toggle:has(:focus-visible) {
10
+ outline: var(--border-2) solid var(--color-selected-dark);
13
11
  }
@@ -1,4 +1,4 @@
1
- @import url("https://esm.sh/trix@2.1.13/dist/trix.css");
1
+ @import url("https://esm.sh/trix@2.1.15/dist/trix.css");
2
2
 
3
3
  /* Action Text */
4
4
 
@@ -48,17 +48,28 @@ trix-toolbar {
48
48
  color: var(--color-text);
49
49
 
50
50
  &.trix-active {
51
- background-color: var(--color-secondary);
51
+ background-color: var(--color-border-light);
52
52
  }
53
53
 
54
54
  &.trix-button--icon::before {
55
- filter: var(--color-filter-text);
56
55
  opacity: 1;
57
56
  }
58
57
 
59
58
  &.trix-button--icon:disabled::before {
60
59
  opacity: 0.125;
61
60
  }
61
+
62
+ [data-color-scheme="light"] & {
63
+ &.trix-button--icon::before { filter: invert(0); }
64
+ }
65
+
66
+ [data-color-scheme="dark"] & {
67
+ &.trix-button--icon::before { filter: invert(1); }
68
+ }
69
+
70
+ @media (prefers-color-scheme: dark) {
71
+ &.trix-button--icon::before { filter: invert(1); }
72
+ }
62
73
  }
63
74
 
64
75
  .trix-dialog {
@@ -195,3 +206,13 @@ trix-editor {
195
206
  }
196
207
  }
197
208
  }
209
+
210
+ .trix--minimal {
211
+ .trix-button-group--file-tools {
212
+ display: none;
213
+ }
214
+
215
+ .trix-button-group--history-tools {
216
+ display: none;
217
+ }
218
+ }
@@ -1,5 +1,5 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { FetchRequest } from "https://esm.sh/@rails/request.js@0.0.11?standalone"
2
+ import { FetchRequest } from "https://esm.sh/@rails/request.js@0.0.12?standalone"
3
3
 
4
4
  const AUTOSAVE_INTERVAL = 3000
5
5
 
@@ -14,7 +14,7 @@ export default class extends Controller {
14
14
 
15
15
  change() {
16
16
  !this.#dirty && this.#scheduleSave()
17
- !this.#dirty && this.#updateAppearance()
17
+ !this.#dirty && this.#updateAppearance(false)
18
18
  }
19
19
 
20
20
  async #submit() {
@@ -25,24 +25,17 @@ export default class extends Controller {
25
25
  this.#updateAppearance(true)
26
26
  this.#resetTimer()
27
27
  await this.#submitForm(this.element)
28
- this.#updateAppearance()
28
+ this.#updateAppearance(false)
29
29
  }
30
30
 
31
31
  async #submitForm(form) {
32
- const request = new FetchRequest(form.method, form.action, { body: new FormData(form) })
33
- return await request.perform()
32
+ return await new FetchRequest(form.method, form.action, { body: new FormData(form) }).perform()
34
33
  }
35
34
 
36
- #updateAppearance(saving = false) {
37
- if (saving) {
38
- this.element.setAttribute("aria-busy", true)
39
- this.submitterTarget.setAttribute("aria-disabled", true)
40
- this.submitterTarget.disabled = true
41
- } else {
42
- this.element.removeAttribute("aria-busy")
43
- this.submitterTarget.removeAttribute("aria-disabled")
44
- this.submitterTarget.disabled = false
45
- }
35
+ #updateAppearance(saving) {
36
+ this.element.ariaBusy = saving
37
+ this.submitterTarget.ariaDisabled = saving
38
+ this.submitterTarget.disabled = saving
46
39
  }
47
40
 
48
41
  #scheduleSave() {
@@ -50,7 +43,8 @@ export default class extends Controller {
50
43
  }
51
44
 
52
45
  #resetTimer() {
53
- clearTimeout(this.#timer); this.#timer = null
46
+ clearTimeout(this.#timer)
47
+ this.#timer = null
54
48
  }
55
49
 
56
50
  get #dirty() {
@@ -0,0 +1,13 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static values = { fallbackDestination: String }
5
+
6
+ connect() {
7
+ if (history.state.turbo?.restorationIndex > 0) {
8
+ this.element.href = "javascript:history.back()"
9
+ } else {
10
+ this.element.href = this.fallbackDestinationValue
11
+ }
12
+ }
13
+ }
@@ -1,22 +1,18 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { Chart, registerables } from "https://esm.sh/chart.js@4.4.8?standalone"
3
-
4
- Chart.register(...registerables)
5
-
6
- Chart.defaults.backgroundColor = getCssVariableValue("--color-primary")
7
- Chart.defaults.borderColor = getCssVariableValue("--color-border")
8
- Chart.defaults.color = getCssVariableValue("--color-text")
9
-
10
- Chart.defaults.font.family = getCssVariableValue("--font-system-ui")
11
- Chart.defaults.font.size = 12
12
-
13
- function getCssVariableValue(variableName) {
14
- return getComputedStyle(document.documentElement).getPropertyValue(variableName).trim()
15
- }
2
+ import { Chart, registerables } from "https://esm.sh/chart.js@4.5.0?standalone"
16
3
 
17
4
  export default class extends Controller {
18
5
  static values = { type: { type: String, default: "line" }, data: Object, options: Object }
19
6
 
7
+ initialize() {
8
+ Chart.register(...registerables)
9
+ Chart.defaults.backgroundColor = getComputedStyle(document.body).backgroundColor
10
+ Chart.defaults.borderColor = getComputedStyle(document.body).borderColor
11
+ Chart.defaults.color = getComputedStyle(document.body).color
12
+ Chart.defaults.font.family = getComputedStyle(document.body).fontFamily
13
+ Chart.defaults.font.size = 12
14
+ }
15
+
20
16
  connect() {
21
17
  this.chart = new Chart(this.element, this.#settings)
22
18
  }
@@ -0,0 +1,26 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ this.element.dataset.colorScheme = this.#colorScheme
6
+ }
7
+
8
+ setLight() {
9
+ this.element.dataset.colorScheme = "light"
10
+ localStorage.setItem("color_scheme", "light")
11
+ }
12
+
13
+ setDark() {
14
+ this.element.dataset.colorScheme = "dark"
15
+ localStorage.setItem("color_scheme", "dark")
16
+ }
17
+
18
+ setSystem() {
19
+ this.element.dataset.colorScheme = "system"
20
+ localStorage.setItem("color_scheme", "system")
21
+ }
22
+
23
+ get #colorScheme() {
24
+ return localStorage.getItem("color_scheme") || "system"
25
+ }
26
+ }
@@ -1,5 +1,5 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { get } from "https://esm.sh/@rails/request.js@0.0.11?standalone"
2
+ import { get } from "https://esm.sh/@rails/request.js@0.0.12?standalone"
3
3
  import TomSelect from "https://esm.sh/tom-select@2.4.3/base?standalone"
4
4
 
5
5
  export default class extends Controller {
@@ -1,15 +1,15 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "menu" ]
4
+ static targets = [ "content" ]
5
5
 
6
6
  show({ clientX, clientY }) {
7
- this.menuTarget.style.insetInlineStart = `${clientX}px`
8
- this.menuTarget.style.insetBlockStart = `${clientY}px`
9
- this.menuTarget.showPopover()
7
+ this.contentTarget.style.insetInlineStart = `${clientX}px`
8
+ this.contentTarget.style.insetBlockStart = `${clientY}px`
9
+ this.contentTarget.showPopover()
10
10
  }
11
11
 
12
12
  hide({ target }) {
13
- !this.menuTarget.contains(target) && this.menuTarget.hidePopover()
13
+ !this.contentTarget.contains(target) && this.contentTarget.hidePopover()
14
14
  }
15
15
  }
@@ -2,7 +2,6 @@ import { Controller } from "@hotwired/stimulus"
2
2
  import flatpickr from "https://esm.sh/flatpickr@4.6.13?standalone"
3
3
 
4
4
  export default class extends Controller {
5
- static targets = [ "details" ]
6
5
  static values = {
7
6
  type: String, disable: Array,
8
7
  mode: { type: String, default: "single" },
@@ -1,18 +1,18 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "menu" ]
4
+ static targets = [ "content" ]
5
5
 
6
6
  show() {
7
- this.menuTarget.show()
7
+ this.contentTarget.show()
8
8
  }
9
9
 
10
10
  showModal() {
11
- this.menuTarget.showModal()
11
+ this.contentTarget.showModal()
12
12
  }
13
13
 
14
14
  close() {
15
- this.menuTarget.close()
15
+ this.contentTarget.close()
16
16
  }
17
17
 
18
18
  closeOnClickOutside({ target }) {
@@ -1,5 +1,5 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { DirectUpload } from "https://esm.sh/@rails/activestorage@8.0.100?standalone"
2
+ import { DirectUpload } from "https://esm.sh/@rails/activestorage@8.0.200?standalone"
3
3
  import Dropzone from "https://esm.sh/dropzone@6.0.0-beta.2?standalone"
4
4
 
5
5
  export default class extends Controller {
@@ -0,0 +1,15 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import DualRangeInput from "https://esm.sh/@stanko/dual-range-input@1.0.0?standalone"
3
+
4
+ export default class extends Controller {
5
+ static targets = [ "min", "max" ]
6
+ static values = { precision: Number, default: 3 }
7
+
8
+ connect() {
9
+ this.dualRangeInput = new DualRangeInput(this.minTarget, this.maxTarget, this.precisionValue)
10
+ }
11
+
12
+ disconnect() {
13
+ this.dualRangeInput.destroy()
14
+ }
15
+ }
@@ -5,15 +5,15 @@ export default class extends Controller {
5
5
  static targets = [ "cancel" ]
6
6
 
7
7
  initialize() {
8
- this.search = debounce(this.search.bind(this), 500)
8
+ this.debouncedSubmit = debounce(this.submit.bind(this), 300)
9
9
  }
10
10
 
11
- submit({ params }) {
12
- params.submitter ? this.#click(params.submitter) : this.element.requestSubmit()
13
- }
14
-
15
- search({ params }) {
16
- params.submitter ? this.#click(params.submitter) : this.element.requestSubmit()
11
+ submit({ params: { submitter } }) {
12
+ if (submitter) {
13
+ this.element.requestSubmit(this.#find(submitter))
14
+ } else {
15
+ this.element.requestSubmit()
16
+ }
17
17
  }
18
18
 
19
19
  cancel() {
@@ -24,7 +24,11 @@ export default class extends Controller {
24
24
  event.preventDefault()
25
25
  }
26
26
 
27
- #click(selectors) {
28
- this.element.querySelector(selectors).click()
27
+ #find(id) {
28
+ return document.getElementById(id) || this.#notFound(id)
29
+ }
30
+
31
+ #notFound(id) {
32
+ throw new Error(`Submitter with ID "${id}" not found`)
29
33
  }
30
34
  }
@@ -1,7 +1,7 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "input", "button" ]
4
+ static targets = [ "input" ]
5
5
 
6
6
  async copy() {
7
7
  this.#reset()
@@ -11,16 +11,16 @@ export default class extends Controller {
11
11
  async #writeToClipboard() {
12
12
  try {
13
13
  await navigator.clipboard.writeText(this.inputTarget.value)
14
- this.buttonTarget.classList.add("btn--copied")
14
+ this.element.classList.add("input--copied")
15
15
  } catch {}
16
16
  }
17
17
 
18
18
  #reset() {
19
- this.buttonTarget.classList.remove("btn--copied")
19
+ this.element.classList.remove("input--copied")
20
20
  this.#forceReflow()
21
21
  }
22
22
 
23
23
  #forceReflow() {
24
- this.buttonTarget.offsetWidth
24
+ this.element.offsetWidth
25
25
  }
26
26
  }
@@ -1,10 +1,10 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "input", "button" ]
4
+ static targets = [ "input" ]
5
5
 
6
6
  reveal() {
7
- this.buttonTarget.classList.toggle("btn--revealed")
7
+ this.element.classList.toggle("input--revealed")
8
8
  this.inputTarget.type = this.#type
9
9
  }
10
10
 
@@ -1,5 +1,5 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { MaskInput } from "https://esm.sh/maska@3.1.0?standalone"
2
+ import { MaskInput } from "https://esm.sh/maska@3.1.1?standalone"
3
3
 
4
4
  export default class extends Controller {
5
5
  connect() {
@@ -18,25 +18,60 @@ export default class extends Controller {
18
18
  this.#observer.disconnect()
19
19
  }
20
20
 
21
- prev() {
21
+ navigate(event) {
22
+ switch (event.key) {
23
+ case "ArrowUp":
24
+ this.#cancel(event)
25
+ this.#prev()
26
+ break
27
+ case "ArrowDown":
28
+ this.#cancel(event)
29
+ this.#next()
30
+ break
31
+ case "PageUp":
32
+ case "Home":
33
+ this.#cancel(event)
34
+ this.#first()
35
+ break
36
+ case "PageDown":
37
+ case "End":
38
+ this.#cancel(event)
39
+ this.#last()
40
+ break
41
+ }
42
+ }
43
+
44
+ #cancel(event) {
45
+ event.stopPropagation()
46
+ event.preventDefault()
47
+ }
48
+
49
+ #reset([ entry ]) {
50
+ entry.isIntersecting && this.#first()
51
+ }
52
+
53
+ #prev() {
22
54
  if (this.indexValue > 0) {
23
55
  this.indexValue--
24
56
  this.#update()
25
57
  }
26
58
  }
27
59
 
28
- next() {
60
+ #next() {
29
61
  if (this.indexValue < this.#lastIndex) {
30
62
  this.indexValue++
31
63
  this.#update()
32
64
  }
33
65
  }
34
66
 
35
- #reset([ entry ]) {
36
- if (entry.isIntersecting) {
37
- this.indexValue = 0
38
- this.#update()
39
- }
67
+ #first() {
68
+ this.indexValue = 0
69
+ this.#update()
70
+ }
71
+
72
+ #last() {
73
+ this.indexValue = this.#lastIndex
74
+ this.#update()
40
75
  }
41
76
 
42
77
  #update() {
@@ -1,8 +1,8 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { computePosition, flip, shift, offset, autoUpdate } from "https://esm.sh/@floating-ui/dom@1.6.13?standalone"
2
+ import { computePosition, flip, shift, offset, autoUpdate } from "https://esm.sh/@floating-ui/dom@1.7.2?standalone"
3
3
 
4
4
  export default class extends Controller {
5
- static targets = [ "button", "menu" ]
5
+ static targets = [ "trigger", "content" ]
6
6
  static values = { placement: { type: String, default: "bottom" } }
7
7
 
8
8
  #showTimer = null
@@ -13,7 +13,7 @@ export default class extends Controller {
13
13
  }
14
14
 
15
15
  connect() {
16
- this.cleanup = autoUpdate(this.buttonTarget, this.menuTarget, this.orient)
16
+ this.cleanup = autoUpdate(this.triggerTarget, this.contentTarget, this.orient)
17
17
  }
18
18
 
19
19
  disconnect() {
@@ -21,31 +21,31 @@ export default class extends Controller {
21
21
  }
22
22
 
23
23
  show() {
24
- this.menuTarget.showPopover()
24
+ this.contentTarget.showPopover({ source: this.triggerTarget })
25
25
  }
26
26
 
27
27
  hide() {
28
- this.menuTarget.hidePopover()
28
+ this.contentTarget.hidePopover()
29
29
  }
30
30
 
31
31
  toggle() {
32
- this.menuTarget.togglePopover()
32
+ this.contentTarget.togglePopover({ source: this.triggerTarget })
33
33
  }
34
34
 
35
- showLater() {
35
+ debouncedShow() {
36
36
  clearTimeout(this.#hideTimer)
37
- this.#showTimer = setTimeout(() => this.show(), 700)
37
+ this.#showTimer = setTimeout(() => this.show(), 150)
38
38
  }
39
39
 
40
- hideLater() {
40
+ debouncedHide() {
41
41
  clearTimeout(this.#showTimer)
42
- this.#hideTimer = setTimeout(() => this.hide(), 300)
42
+ this.#hideTimer = setTimeout(() => this.hide(), 150)
43
43
  }
44
44
 
45
45
  orient() {
46
- computePosition(this.buttonTarget, this.menuTarget, this.#options).then(({x, y}) => {
47
- this.menuTarget.style.insetInlineStart = `${x}px`
48
- this.menuTarget.style.insetBlockStart = `${y}px`
46
+ computePosition(this.triggerTarget, this.contentTarget, this.#options).then(({x, y}) => {
47
+ this.contentTarget.style.insetInlineStart = `${x}px`
48
+ this.contentTarget.style.insetBlockStart = `${y}px`
49
49
  })
50
50
  }
51
51