css-zero 0.0.37 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d03cbc1032455ed1426a832bd3f71fcc6091275b6a6a75fa1d2111cf0105f24
4
- data.tar.gz: e4aae85c8fdcea540a262ae0de03546c367afabb6a3bbb0e769eceff328e3a2b
3
+ metadata.gz: 609a6d11cfe6b31670eda63d7104d2d76069f0fe352bc4b6f7b0d00e5e7c2ea1
4
+ data.tar.gz: b118ad5a3842de5ab4df410b5516e62d52b9e241d559ec88f9146cdcc729b68a
5
5
  SHA512:
6
- metadata.gz: eae8de16d7008f3c47960c19a90840e236b9846505b3e988d20c10c41f21e5319200bb10b1fd0154d9dc61072bddb479efd8369597c9051bd1724ac32b64ecb0
7
- data.tar.gz: 8fcecce58a61bfa94b08879bd9338357988cb217da22c3398f6832b2a2842fc2d0802c9403502b70f80531dc7100b6d8fd591d0dc10211c4ba2185f994494c6e
6
+ metadata.gz: 4dafa265f72d212202676d56ae7e3b5d20ee92516829c802a78794c43d3786aa68a7ed274361a2e3077df2e893cd75d298610f3a420e83de2703c0498419771f
7
+ data.tar.gz: fd08c640bdc6b4409b046e86a8e817dd916fef129c28cc8cb8f0a04c77080bb27c4f372fec509897d17706473e7ef334c081fce1d0e7157717189e7c864a5f95
data/README.md CHANGED
@@ -19,7 +19,7 @@ bin/rails generate css_zero:install
19
19
  Add only the components you need. (Optional)
20
20
 
21
21
  ```
22
- bin/rails generate css_zero:add accordion alert avatar badge breadcrumb button card carousel collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
22
+ bin/rails generate css_zero:add accordion alert avatar badge breadcrumb button card carousel collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
23
23
  ```
24
24
 
25
25
  ### Requirements
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.37"
2
+ VERSION = "0.0.38"
3
3
  end
@@ -2,7 +2,7 @@ Description:
2
2
  This will add components into your project.
3
3
 
4
4
  Components:
5
- accordion alert avatar badge breadcrumb button card carousel collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
5
+ accordion alert avatar badge breadcrumb button card carousel collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
6
6
 
7
7
  Example:
8
8
  bin/rails generate css_zero:add [components...]
@@ -44,6 +44,7 @@ input_concerns:
44
44
  - app/javascript/controllers/clearable_input_controller.js
45
45
  - app/javascript/controllers/revealable_input_controller.js
46
46
  - app/assets/images/copy.svg
47
+ - app/assets/images/check.svg
47
48
  - app/assets/images/eye.svg
48
49
  - app/assets/images/eye-off.svg
49
50
  - app/assets/images/x.svg
@@ -53,9 +54,12 @@ layouts:
53
54
  lightbox:
54
55
  - app/assets/stylesheets/lightbox.css
55
56
  - app/javascript/controllers/lightbox_controller.js
57
+ - app/javascript/controllers/web_share_controller.js
56
58
  - app/assets/images/download.svg
57
59
  - app/assets/images/share.svg
58
60
  - app/assets/images/x.svg
61
+ local_time:
62
+ - app/javascript/controllers/local_time_controller.js
59
63
  pagination:
60
64
  - app/assets/images/chevron-right.svg
61
65
  - app/assets/images/chevron-left.svg
@@ -70,9 +74,9 @@ sheet:
70
74
  - app/assets/images/x.svg
71
75
  skeleton:
72
76
  - app/assets/stylesheets/skeleton.css
73
- - app/javascript/controllers/form_controller.js
74
77
  switch:
75
78
  - app/assets/stylesheets/switch.css
79
+ - app/javascript/controllers/form_controller.js
76
80
  table:
77
81
  - app/assets/stylesheets/table.css
78
82
  tabs:
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check"><path d="M20 6 9 17l-5-5"/></svg>
@@ -66,18 +66,14 @@
66
66
  .btn--plain {
67
67
  --btn-background: transparent;
68
68
  --btn-border-color: transparent;
69
+ --btn-filter-hover: none;
69
70
  --btn-padding: 0;
70
71
  }
71
72
 
72
73
  .btn--rounded {
73
- --btn-padding: var(--size-2);
74
74
  --btn-radius: var(--rounded-full);
75
75
  }
76
76
 
77
- .btn--pressed:active {
78
- opacity: var(--opacity-50);
79
- }
80
-
81
77
  [aria-busy] .btn--loading:disabled {
82
78
  > * {
83
79
  visibility: hidden;
@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
3
3
  export default class extends Controller {
4
4
  static targets = [ "dependent" ]
5
5
 
6
- check({target}) {
6
+ check({ target }) {
7
7
  this.dependentTargets.forEach(element => element.checked = target.checked)
8
8
  }
9
9
  }
@@ -1,13 +1,36 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "input" ]
4
+ static targets = [ "input", "copyIcon", "successIcon" ]
5
+ static values = { copied: Boolean }
5
6
 
6
- async copy() {
7
+ #copiedTimeout = null
8
+
9
+ copiedValueChanged() {
10
+ this.#update()
11
+ }
12
+
13
+ copy() {
14
+ this.#copyToClipboard()
15
+ this.#reset()
16
+ }
17
+
18
+ #copyToClipboard() {
7
19
  try {
8
- await navigator.clipboard.writeText(this.inputTarget.value)
20
+ navigator.clipboard.writeText(this.inputTarget.value)
21
+ this.copiedValue = true
9
22
  } catch (error) {
10
23
  console.warn(error.message);
11
24
  }
12
25
  }
26
+
27
+ #reset() {
28
+ clearTimeout(this.#copiedTimeout)
29
+ this.#copiedTimeout = setTimeout(() => { this.copiedValue = false }, 3000)
30
+ }
31
+
32
+ #update() {
33
+ this.copyIconTarget.hidden = this.copiedValue
34
+ this.successIconTarget.hidden = !this.copiedValue
35
+ }
13
36
  }
@@ -2,9 +2,7 @@ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
  click(event) {
5
- if (this.#isClickable && !this.#shouldIgnore(event)) {
6
- this.element.click()
7
- }
5
+ if (this.#isClickable && !this.#shouldIgnore(event)) this.element.click()
8
6
  }
9
7
 
10
8
  #shouldIgnore(event) {
@@ -0,0 +1,29 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static targets = [ "time", "date", "datetime" ]
5
+
6
+ initialize() {
7
+ this.timeFormatter = new Intl.DateTimeFormat(undefined, { timeStyle: "short" })
8
+ this.dateFormatter = new Intl.DateTimeFormat(undefined, { dateStyle: "long" })
9
+ this.dateTimeFormatter = new Intl.DateTimeFormat(undefined, { timeStyle: "short", dateStyle: "short" })
10
+ }
11
+
12
+ timeTargetConnected(target) {
13
+ this.#formatTime(this.timeFormatter, target)
14
+ }
15
+
16
+ dateTargetConnected(target) {
17
+ this.#formatTime(this.dateFormatter, target)
18
+ }
19
+
20
+ datetimeTargetConnected(target) {
21
+ this.#formatTime(this.dateTimeFormatter, target)
22
+ }
23
+
24
+ #formatTime(formatter, target) {
25
+ const dt = new Date(target.getAttribute("datetime"))
26
+ target.textContent = formatter.format(dt)
27
+ target.title = this.dateTimeFormatter.format(dt)
28
+ }
29
+ }
@@ -1,19 +1,24 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "input", "image" ]
5
- static values = { showImage: String, hideImage: String }
4
+ static targets = [ "input", "showIcon", "hideIcon" ]
5
+ static values = { revealed: Boolean }
6
+
7
+ revealedValueChanged() {
8
+ this.#update()
9
+ }
6
10
 
7
11
  reveal() {
8
- this.inputTarget.type = this.#inputType
9
- this.imageTarget.src = this.#imageSrc
12
+ this.revealedValue = !this.revealedValue
10
13
  }
11
14
 
12
- get #inputType() {
13
- return this.inputTarget.type === "text" ? "password" : "text"
15
+ #update() {
16
+ this.inputTarget.type = this.#inputType
17
+ this.showIconTarget.hidden = this.revealedValue
18
+ this.hideIconTarget.hidden = !this.revealedValue
14
19
  }
15
20
 
16
- get #imageSrc() {
17
- return this.inputTarget.type === "text" ? this.hideImageValue : this.showImageValue
21
+ get #inputType() {
22
+ return this.revealedValue ? "text" : "password"
18
23
  }
19
24
  }
@@ -2,7 +2,7 @@ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
  static targets = [ "button", "tab" ]
5
- static values = { index: Number, default: 0 }
5
+ static values = { index: Number }
6
6
 
7
7
  indexValueChanged() {
8
8
  this.#showSelectedTab()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.37
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lázaro Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-23 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com
@@ -38,6 +38,7 @@ files:
38
38
  - lib/generators/css_zero/add/templates/app/assets/images/arrow-left.svg
39
39
  - lib/generators/css_zero/add/templates/app/assets/images/arrow-right.svg
40
40
  - lib/generators/css_zero/add/templates/app/assets/images/camera.svg
41
+ - lib/generators/css_zero/add/templates/app/assets/images/check.svg
41
42
  - lib/generators/css_zero/add/templates/app/assets/images/chevron-down.svg
42
43
  - lib/generators/css_zero/add/templates/app/assets/images/chevron-left.svg
43
44
  - lib/generators/css_zero/add/templates/app/assets/images/chevron-right.svg
@@ -88,6 +89,7 @@ files:
88
89
  - lib/generators/css_zero/add/templates/app/javascript/controllers/fullscreen_controller.js
89
90
  - lib/generators/css_zero/add/templates/app/javascript/controllers/hotkey_controller.js
90
91
  - lib/generators/css_zero/add/templates/app/javascript/controllers/lightbox_controller.js
92
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/local_time_controller.js
91
93
  - lib/generators/css_zero/add/templates/app/javascript/controllers/revealable_input_controller.js
92
94
  - lib/generators/css_zero/add/templates/app/javascript/controllers/tabs_controller.js
93
95
  - lib/generators/css_zero/add/templates/app/javascript/controllers/upload_preview_controller.js