css-zero 0.0.93 → 0.0.95

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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -13
  3. data/lib/css_zero/version.rb +1 -1
  4. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/avatar.css +1 -0
  5. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css +3 -4
  6. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/carousel.css +11 -3
  7. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/dialog.css +7 -17
  8. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/popover.css +3 -3
  9. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/sheet.css +7 -17
  10. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/switch.css +3 -3
  11. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css +1 -1
  12. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/zcombobox.css +4 -4
  13. data/lib/generators/css_zero/add/templates/app/javascript/controllers/carousel_controller.js +2 -18
  14. data/lib/generators/css_zero/add/templates/app/javascript/controllers/command_controller.js +2 -2
  15. data/lib/generators/css_zero/add/templates/app/javascript/controllers/datepicker_controller.js +1 -2
  16. data/lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js +4 -0
  17. data/lib/generators/css_zero/add/templates/app/javascript/controllers/otp_input_controller.js +1 -3
  18. data/lib/generators/css_zero/add/templates/app/javascript/controllers/popover_controller.js +9 -1
  19. data/lib/generators/css_zero/add/templates/app/javascript/controllers/revealable_input_controller.js +1 -1
  20. data/lib/generators/css_zero/add/templates/app/javascript/controllers/tabs_controller.js +1 -1
  21. data/lib/generators/css_zero/add/templates/app/javascript/controllers/web_share_controller.js +1 -3
  22. data/lib/generators/css_zero/install/install_generator.rb +1 -1
  23. data/lib/generators/css_zero/scaffold/templates/_form.html.erb.tt +3 -3
  24. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32342c2b786487ee68c9b3a1d894d94b85b89607da1abb1d2f5a75ed9effc53c
4
- data.tar.gz: '02517761054609b9014ef3fb4194a8d4405b7875c87dc42abe000b085577dddc'
3
+ metadata.gz: 7c56f270130722e9912c5271b2700f89b19f1debe15c19a2c2394c9bba4d169c
4
+ data.tar.gz: '0803ceaa8816e61105de7e64b9c31df4063c1b7defde89fffb3162052dd1a5db'
5
5
  SHA512:
6
- metadata.gz: 75bdcf3780aac15921ccead84e9abec3629b6dd9f84751aa21d15e82781050e3cedb924925db75c1a1bd1387986dde849a02734be9e20873dfa44cf2b4f48751
7
- data.tar.gz: 7fd76a723cb4be4d92243f1ed3faa5882fb96f76dfe2e184d7708bf1da9b6141925d0875cf12ccfe8a46bf924daeea117eda7d157ba235ef50a44beaada385e2
6
+ metadata.gz: 0c2d8bf42bb152ae84264e48a190734f9d06d9cc065cb22432c1f0a9c48256d207b06859c6947f820e2c0979443af5e8b71ea0c9746dbd5c9ee08b04ee5ff63f
7
+ data.tar.gz: 0baceaccc306e73770beb3a8bfaff1f2564ef9a3e7b1688e5060654886883ba235f4fb93a2327b869177139ed86ba7203da07fb72e9195a00df07fb8cc86bb4a
data/README.md CHANGED
@@ -22,29 +22,21 @@ Add the additional components you need. (Optional)
22
22
  bin/rails generate css_zero:add --help
23
23
  ```
24
24
 
25
- ## Usage
26
-
27
- Check the [CSS files](app/assets/stylesheets) in the repository to see the available variables and utility classes.
28
-
29
25
  ## Components
30
26
 
31
27
  [<img src="https://github.com/user-attachments/assets/3a7fbd1e-5cc8-4476-a60c-52bc28efca29">](https://csszero.lazaronixon.com)
32
28
 
33
- ## Scaffold
34
-
35
- This gem implements custom templates for scaffolds and authentication.
29
+ ## Utility classes and variables
36
30
 
37
- ```
38
- bin/rails generate scaffold contacts name email phone
39
- ```
31
+ Check the [CSS files](app/assets/stylesheets) in the repository to see the available variables and utility classes.
40
32
 
41
33
  ## Icons
42
34
 
43
- Some icons in the examples are not copied to the project. If you are looking for good ones, I recommend [Lucide](https://lucide.dev).
35
+ If you're looking for high-quality icons, I recommend checking out [Lucide](https://lucide.dev).
44
36
 
45
- ## Figma
37
+ ## Scaffold
46
38
 
47
- [shadcn/ui design system](https://www.figma.com/community/file/1203061493325953101) by [Pietro Schirano](https://twitter.com/skirano) - A design companion for shadcn/ui. Each component was painstakingly crafted to perfectly match the code implementation.
39
+ This gem implements custom templates for scaffolds and authentication.
48
40
 
49
41
  ## Development
50
42
 
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.93"
2
+ VERSION = "0.0.95"
3
3
  end
@@ -21,6 +21,7 @@
21
21
  }
22
22
 
23
23
  img {
24
+ align-content: center;
24
25
  aspect-ratio: var(--aspect-square);
25
26
  block-size: var(--size-full);
26
27
  inline-size: var(--size-full);
@@ -1,5 +1,6 @@
1
1
  .btn {
2
2
  --btn-background: var(--color-bg);
3
+ --hover-color: oklch(from var(--btn-background) calc(l * .95) c h);
3
4
 
4
5
  align-items: center;
5
6
  background-color: var(--btn-background);
@@ -24,7 +25,7 @@
24
25
  }
25
26
 
26
27
  &:hover {
27
- background-color: var(--btn-hover-color, oklch(from var(--btn-background) calc(l * .95) c h));
28
+ background-color: var(--btn-hover-color, var(--hover-color));
28
29
  }
29
30
 
30
31
  &:focus-visible {
@@ -84,9 +85,7 @@
84
85
  }
85
86
 
86
87
  [aria-busy] .btn--loading:disabled {
87
- > * {
88
- visibility: hidden;
89
- }
88
+ > * { visibility: hidden; }
90
89
 
91
90
  &::after {
92
91
  filter: var(--btn-icon-color, var(--color-filter-text));
@@ -6,14 +6,22 @@
6
6
 
7
7
  .carousel__content {
8
8
  display: flex;
9
- gap: var(--size-6);
9
+ gap: var(--size-4);
10
10
  inline-size: var(--size-full);
11
- overflow: hidden;
11
+ overflow-x: hidden;
12
+ scroll-behavior: smooth;
12
13
  scroll-snap-type: x mandatory;
14
+
15
+ @supports (-moz-appearance: none) {
16
+ scroll-behavior: auto;
17
+ }
13
18
  }
14
19
 
15
20
  .carousel__item {
16
- flex: 0 0 var(--carousel-item-size, 100%);
21
+ --items: var(--carousel-items, 1);
22
+ --items-gap: calc(100% - 1rem * (var(--items) - 1));
23
+
24
+ flex: 0 0 calc(var(--items-gap) / var(--items));
17
25
  padding: var(--size-1);
18
26
  scroll-snap-stop: always;
19
27
  scroll-snap-align: start;
@@ -12,7 +12,7 @@
12
12
  background-color: rgba(0, 0, 0, .8);
13
13
  }
14
14
 
15
- /* Setup animation */
15
+ /* Final state of exit animation and setup */
16
16
  opacity: 0;
17
17
  transform: var(--scale-95);
18
18
  transition-behavior: allow-discrete;
@@ -26,24 +26,14 @@
26
26
  transition-property: display, overlay, opacity;
27
27
  }
28
28
 
29
- /* Animation end */
30
- &[open] {
31
- opacity: 1; transform: var(--scale-100);
32
- }
33
-
34
- &[open]::backdrop {
35
- opacity: 1;
36
- }
29
+ /* Final state of entry animation */
30
+ &[open] { opacity: 1; transform: var(--scale-100); }
31
+ &[open]::backdrop { opacity: 1; }
37
32
 
38
- /* Animation start */
33
+ /* Initial state of entry animation */
39
34
  @starting-style {
40
- &[open] {
41
- opacity: 0; transform: var(--scale-95);
42
- }
43
-
44
- &[open]::backdrop {
45
- opacity: 0;
46
- }
35
+ &[open] { opacity: 0; transform: var(--scale-95); }
36
+ &[open]::backdrop { opacity: 0; }
47
37
  }
48
38
 
49
39
  /* Drawer component on mobile */
@@ -6,19 +6,19 @@
6
6
  color: var(--color-text);
7
7
  inline-size: var(--popover-size, max-content);
8
8
 
9
- /* Setup animation */
9
+ /* Final state of exit animation and setup */
10
10
  opacity: 0;
11
11
  transform: var(--scale-95);
12
12
  transition-behavior: allow-discrete;
13
13
  transition-duration: var(--time-150);
14
14
  transition-property: display, overlay, opacity, transform;
15
15
 
16
- /* Animation end */
16
+ /* Final state of entry animation */
17
17
  &:popover-open {
18
18
  opacity: 1; transform: var(--scale-100);
19
19
  }
20
20
 
21
- /* Animation start */
21
+ /* Initial state of entry animation */
22
22
  @starting-style {
23
23
  &:popover-open {
24
24
  opacity: 0; transform: var(--scale-95);
@@ -12,7 +12,7 @@
12
12
  background-color: rgba(0, 0, 0, .8);
13
13
  }
14
14
 
15
- /* Setup animation */
15
+ /* Final state of exit animation and setup */
16
16
  transform: var(--sheet-transform);
17
17
  transition-behavior: allow-discrete;
18
18
  transition-duration: var(--time-500);
@@ -25,24 +25,14 @@
25
25
  transition-property: display, overlay, opacity;
26
26
  }
27
27
 
28
- /* Animation end */
29
- &[open] {
30
- transform: translateX(0);
31
- }
32
-
33
- &[open]::backdrop {
34
- opacity: 1;
35
- }
28
+ /* Final state of entry animation */
29
+ &[open] { transform: translateX(0); }
30
+ &[open]::backdrop { opacity: 1; }
36
31
 
37
- /* Animation start */
32
+ /* Initial state of entry animation */
38
33
  @starting-style {
39
- &[open] {
40
- transform: var(--sheet-transform);
41
- }
42
-
43
- &[open]::backdrop {
44
- opacity: 0;
45
- }
34
+ &[open] { transform: var(--sheet-transform); }
35
+ &[open]::backdrop { opacity: 0;}
46
36
  }
47
37
 
48
38
  @media (width >= 40rem) {
@@ -4,9 +4,9 @@
4
4
  border-color: transparent;
5
5
  border-radius: var(--rounded-full);
6
6
  border-width: var(--border-2);
7
- block-size: var(--size-6);
7
+ block-size: var(--size-5);
8
8
  cursor: pointer;
9
- inline-size: var(--size-11);
9
+ inline-size: var(--size-9);
10
10
  transition-duration: var(--time-150);
11
11
  transition-property: var(--transition-colors);
12
12
 
@@ -15,7 +15,7 @@
15
15
  }
16
16
 
17
17
  &:checked::before {
18
- margin-inline-start: var(--size-5);
18
+ margin-inline-start: var(--size-4);
19
19
  }
20
20
 
21
21
  &::before {
@@ -3,7 +3,7 @@
3
3
  position: absolute; clip: rect(0, 0, 0, 0);
4
4
  }
5
5
 
6
- &:has([type="checkbox"]:checked) {
6
+ &:has(:checked) {
7
7
  --btn-background: var(--color-secondary);
8
8
  }
9
9
 
@@ -25,19 +25,19 @@
25
25
  font-size: var(--text-sm);
26
26
  line-height: inherit;
27
27
 
28
- /* Setup animation */
28
+ /* Final state of exit animation and setup */
29
29
  opacity: 0;
30
30
  transform: var(--scale-95);
31
31
  transition-behavior: allow-discrete;
32
32
  transition-duration: var(--time-150);
33
33
  transition-property: display, opacity, transform;
34
34
 
35
- /* Animation end */
35
+ /* Final state of entry animation */
36
36
  .dropdown-active & {
37
37
  opacity: 1; transform: var(--scale-100);
38
38
  }
39
39
 
40
- /* Animation start */
40
+ /* Initial state of entry animation */
41
41
  @starting-style {
42
42
  .dropdown-active & {
43
43
  opacity: 0; transform: var(--scale-95);
@@ -119,6 +119,6 @@
119
119
  border-color: var(--color-negative);
120
120
  }
121
121
 
122
- [data-controller*="combobox"] {
122
+ [data-controller~="combobox"] {
123
123
  clip: rect(0 0 0 0); position: absolute;
124
124
  }
@@ -4,26 +4,10 @@ export default class extends Controller {
4
4
  static targets = [ "content" ]
5
5
 
6
6
  next() {
7
- this.contentTarget.scrollTo({ left: this.#nextPosition, behavior: "smooth" })
7
+ this.contentTarget.scrollBy(100, 0)
8
8
  }
9
9
 
10
10
  prev() {
11
- this.contentTarget.scrollTo({ left: this.#prevPosition, behavior: "smooth" })
12
- }
13
-
14
- get #nextPosition() {
15
- return this.#scrollLeft + this.#slideSize
16
- }
17
-
18
- get #prevPosition() {
19
- return this.#scrollLeft - this.#slideSize
20
- }
21
-
22
- get #scrollLeft() {
23
- return this.contentTarget.scrollLeft
24
- }
25
-
26
- get #slideSize() {
27
- return this.contentTarget.clientWidth
11
+ this.contentTarget.scrollBy(-100, 0)
28
12
  }
29
13
  }
@@ -38,13 +38,13 @@ export default class extends Controller {
38
38
  }
39
39
 
40
40
  #reset() {
41
- this.listTarget.querySelectorAll(`.${this.selectedClass}`).forEach((element) => {
41
+ this.listTarget.querySelectorAll(`.${this.selectedClass}`).forEach(element => {
42
42
  element.classList.remove(this.selectedClass)
43
43
  })
44
44
  }
45
45
 
46
46
  #selectMatches(value) {
47
- this.listTarget.querySelectorAll(`[data-value*="${value.toLowerCase()}"]`).forEach((element) => {
47
+ this.listTarget.querySelectorAll(`[data-value*="${value.toLowerCase()}"]`).forEach(element => {
48
48
  element.classList.add(this.selectedClass)
49
49
  })
50
50
  }
@@ -4,8 +4,7 @@ import flatpickr from "https://esm.sh/flatpickr@4.6.13?standalone"
4
4
  export default class extends Controller {
5
5
  static targets = [ "details" ]
6
6
  static values = {
7
- type: String,
8
- disable: Array,
7
+ type: String, disable: Array,
9
8
  mode: { type: String, default: "single" },
10
9
  dateFormat: { type: String, default: "F d, Y" },
11
10
  dateTimeFormat: { type: String, default: "F d, Y H:i" }
@@ -3,6 +3,10 @@ import { Controller } from "@hotwired/stimulus"
3
3
  export default class extends Controller {
4
4
  static targets = [ "menu" ]
5
5
 
6
+ show() {
7
+ this.menuTarget.show()
8
+ }
9
+
6
10
  showModal() {
7
11
  this.menuTarget.showModal()
8
12
  }
@@ -16,9 +16,7 @@ export default class extends Controller {
16
16
  #requestOTP() {
17
17
  navigator.credentials.get(this.#options).then(otp => {
18
18
  this.element.value = otp.code
19
- }).catch(error => {
20
- console.log(error)
21
- })
19
+ }).catch(error => {})
22
20
  }
23
21
 
24
22
  get #options() {
@@ -24,13 +24,21 @@ export default class extends Controller {
24
24
  }
25
25
 
26
26
  hide() {
27
- clearTimeout(this.#showTimer); this.menuTarget.hidePopover()
27
+ this.menuTarget.hidePopover()
28
+ }
29
+
30
+ toggle() {
31
+ this.menuTarget.togglePopover()
28
32
  }
29
33
 
30
34
  showLater() {
31
35
  this.#showTimer = setTimeout(() => this.show(), 700)
32
36
  }
33
37
 
38
+ hideClear() {
39
+ clearTimeout(this.#showTimer); this.hide();
40
+ }
41
+
34
42
  orient() {
35
43
  computePosition(this.buttonTarget, this.menuTarget, this.#options).then(({x, y}) => {
36
44
  this.menuTarget.style.insetInlineStart = `${x}px`
@@ -13,7 +13,7 @@ export default class extends Controller {
13
13
  }
14
14
 
15
15
  #update() {
16
- this.inputTarget.type = this.#inputType
16
+ this.inputTarget.type = this.#inputType
17
17
  this.showIconTarget.hidden = this.revealedValue
18
18
  this.hideIconTarget.hidden = !this.revealedValue
19
19
  }
@@ -29,7 +29,7 @@ export default class extends Controller {
29
29
  }
30
30
  }
31
31
 
32
- #showCurrentTab(shouldFocus) {
32
+ #showCurrentTab() {
33
33
  this.buttonTargets.forEach((element, index) => {
34
34
  element.ariaSelected = index === this.indexValue
35
35
  element.tabIndex = index === this.indexValue ? 0 : -1
@@ -12,9 +12,7 @@ export default class extends Controller {
12
12
  async share() {
13
13
  try {
14
14
  await navigator.share(await this.#getShareData())
15
- } catch(error) {
16
- console.warn(error.message)
17
- }
15
+ } catch {}
18
16
  }
19
17
 
20
18
  async #getShareData() {
@@ -18,7 +18,7 @@ class CssZero::InstallGenerator < Rails::Generators::Base
18
18
  end
19
19
 
20
20
  def add_basic_components
21
- invoke "css_zero:add", %w(layouts input switch button flash alert)
21
+ invoke "css_zero:add", %w(layouts flash alert input button)
22
22
  end
23
23
 
24
24
  private
@@ -12,13 +12,13 @@
12
12
  <%% end %>
13
13
 
14
14
  <% attributes.each do |attribute| -%>
15
- <div class="flex flex-col gap-half mbe-4">
15
+ <div class="flex flex-col items-start gap-half mbe-4">
16
16
  <% if attribute.password_digest? -%>
17
17
  <%%= form.label :password, class: "text-sm font-medium leading-none" %>
18
18
  <%%= form.password_field :password, class: "input" %>
19
19
  </div>
20
20
 
21
- <div class="flex flex-col gap-half mbe-4">
21
+ <div class="flex flex-col items-start gap-half mbe-4">
22
22
  <%%= form.label :password_confirmation, class: "text-sm font-medium leading-none" %>
23
23
  <%%= form.password_field :password_confirmation, class: "input" %>
24
24
  <% elsif attribute.attachments? -%>
@@ -29,7 +29,7 @@
29
29
  <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: "auto", class: "input" %>
30
30
  <% elsif attribute.field_type == :checkbox -%>
31
31
  <%%= form.label :<%= attribute.column_name %>, class: "text-sm font-medium leading-none" %>
32
- <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "switch" %>
32
+ <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "checkbox" %>
33
33
  <% else -%>
34
34
  <%%= form.label :<%= attribute.column_name %>, class: "text-sm font-medium leading-none" %>
35
35
  <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "input" %>
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.93
4
+ version: 0.0.95
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: 2025-01-17 00:00:00.000000000 Z
11
+ date: 2025-01-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com