css-zero 0.0.14 → 0.0.16

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: 534451ca0aee9a1bf1b81e3831c6716e7ac071dbf0ec5f0c2e4805ef86cf9638
4
- data.tar.gz: a9a70ae47d1253368e596483adab0134242292465b8b2e4dc20df18b246c7852
3
+ metadata.gz: 25eac2e80a7b075843033e5db405786dd14e9f802cb47ce2fd1f0375e7841565
4
+ data.tar.gz: 52cd0c2ed8d8eb740d44e29210ff8652088cac7509ccf024a957f837ada2cfc2
5
5
  SHA512:
6
- metadata.gz: ffd516034332e7b6092dfa659536321295a5047d7e4ab745725c6ea3e9b03611caf8913a89417f680bf0a660c924eaf93264b29d0b4e57681556b3b87568e380
7
- data.tar.gz: 8104a1a8a350126a5d5dbe74276ffaafd76aa4f85d8156e45aaf4630edf7fc9c0add9972e21c68392deb88666697117d52a01b02f077129910e729578b65b483
6
+ metadata.gz: 39e8b29cb429cf7e8d4d180682c17cef15e5105f51fc9c0b88ece548f688a41558569f2aeda76bf9365df202b6e01f791dd7520b5225ef0357a80e1d0a39ed70
7
+ data.tar.gz: 52d7914ad684c3b27766979afa42834796a361846dc679d2a44300ed1858a92490f1f5c09665b0bb40a0e4671303de8402dc4127eda6ab25d8cebc7df389318c
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CSS Zero
2
2
 
3
- An opinionated CSS starter kit for your application. You can think of it like a "no build" Tailwind CSS.
3
+ An opinionated CSS starter kit for your Ruby on Rails application. You can think of it like a "no build" Tailwind CSS.
4
4
 
5
5
  ## Installation
6
6
 
@@ -227,8 +227,8 @@ Check the [CSS files](app/assets/stylesheets) in the repository to see the avail
227
227
  <summary>Show me the code</summary>
228
228
 
229
229
  ```html+erb
230
- <div>
231
- <dialog id="alert_dialog" class="dialog">
230
+ <div data-controller="dialog">
231
+ <dialog data-dialog-target="box" class="dialog">
232
232
  <h1 class="text-lg font-semibold">Are you absolutely sure?</h1>
233
233
  <p class="text-sm text-subtle mbs-2">This action cannot be undone. This will permanently delete your account and remove your data from our servers.</p>
234
234
 
@@ -238,8 +238,8 @@ Check the [CSS files](app/assets/stylesheets) in the repository to see the avail
238
238
  </div>
239
239
  </dialog>
240
240
 
241
- <button class="btn" data-controller="dialog-control" data-dialog-control-target-value="alert_dialog" data-action="dialog-control#showModal">
242
- Show alert dialog
241
+ <button class="btn" data-action="dialog#showModal">
242
+ Show dialog
243
243
  </button>
244
244
  </div>
245
245
  ```
@@ -247,18 +247,20 @@ Check the [CSS files](app/assets/stylesheets) in the repository to see the avail
247
247
 
248
248
  #### Dismissible Dialog
249
249
 
250
- <img width="400" alt="dismissible dialog" src="https://github.com/lazaronixon/css-zero/assets/2651240/50c8af20-46bb-4bf9-a233-78877f49e086">
250
+ <img width="400" alt="dismissible_dialog" src="https://github.com/lazaronixon/css-zero/assets/2651240/50c8af20-46bb-4bf9-a233-78877f49e086">
251
251
 
252
252
  <details>
253
253
  <summary>Show me the code</summary>
254
254
 
255
255
  ```html+erb
256
- <div>
257
- <dialog id="dismissible_dialog" class="dialog" style="max-inline-size: 430px;" popover>
258
- <button class="btn btn--plain p-0 dialog__close" popovertarget="dismissible_dialog" popovertargetaction="hide">
259
- <%= image_tag "x.svg", aria: { hidden: "true" }, size: 16 %>
260
- <span class="sr-only">Close</span>
261
- </button>
256
+ <div data-controller="dialog">
257
+ <dialog data-dialog-target="box" data-action="click->dialog#closeOnClickOutside" class="dialog" style="max-inline-size: 430px;">
258
+ <form method="dialog">
259
+ <button class="btn btn--plain p-0 dialog__close">
260
+ <%= image_tag "x.svg", aria: { hidden: "true" }, size: 16 %>
261
+ <span class="sr-only">Close</span>
262
+ </button>
263
+ </form>
262
264
 
263
265
  <div class="flex flex-col gap">
264
266
  <div class="flex flex-col gap-sm">
@@ -284,8 +286,8 @@ Check the [CSS files](app/assets/stylesheets) in the repository to see the avail
284
286
  </div>
285
287
  </dialog>
286
288
 
287
- <button class="btn" popovertarget="dismissible_dialog">
288
- Show dismissible dialog
289
+ <button class="btn" data-action="dialog#showModal">
290
+ Show dialog
289
291
  </button>
290
292
  </div>
291
293
  ```
@@ -411,6 +413,8 @@ Check the [CSS files](app/assets/stylesheets) in the repository to see the avail
411
413
  ```
412
414
  </details>
413
415
 
416
+ ### More components soon...
417
+
414
418
  ## Development
415
419
 
416
420
  To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -60,7 +60,7 @@ body {
60
60
  */
61
61
 
62
62
  hr {
63
- height: 0; /* 1 */
63
+ block-size: 0; /* 1 */
64
64
  color: inherit; /* 2 */
65
65
  border-block-start-width: 1px; /* 3 */
66
66
  }
@@ -155,11 +155,11 @@ sup {
155
155
  }
156
156
 
157
157
  sub {
158
- bottom: -0.25em;
158
+ inset-block-end: -0.25em;
159
159
  }
160
160
 
161
161
  sup {
162
- top: -0.5em;
162
+ inset-block-start: -0.5em;
163
163
  }
164
164
 
165
165
  /*
@@ -242,7 +242,7 @@ progress {
242
242
 
243
243
  ::-webkit-inner-spin-button,
244
244
  ::-webkit-outer-spin-button {
245
- height: auto;
245
+ block-size: auto;
246
246
  }
247
247
 
248
248
  /*
@@ -321,8 +321,8 @@ object {
321
321
 
322
322
  img,
323
323
  video {
324
- max-width: 100%;
325
- height: auto;
324
+ max-inline-size: 100%;
325
+ block-size: auto;
326
326
  }
327
327
 
328
328
  /*
@@ -16,6 +16,9 @@
16
16
  .items-center { align-items: center; }
17
17
 
18
18
  .grow { flex-grow: 1; }
19
+ .grow-0 { flex-grow: 0; }
20
+
21
+ .shrink { flex-shrink: 1; }
19
22
  .shrink-0 { flex-shrink: 0; }
20
23
 
21
24
  .self-start { align-self: start; }
@@ -85,6 +88,7 @@
85
88
  .bg-main { background-color: var(--color-bg); }
86
89
  .bg-black { background-color: var(--color-text); }
87
90
  .bg-white { background-color: var(--color-text-reversed); }
91
+ .bg-shade { background-color: var(--color-secondary); }
88
92
  .bg-transparent { background-color: transparent; }
89
93
 
90
94
  /****************************************************************
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -13,7 +13,7 @@ card:
13
13
  dialog:
14
14
  - app/assets/stylesheets/dialog.css
15
15
  - app/assets/images/x.svg
16
- - app/javascript/controllers/dialog_control_controller.js
16
+ - app/javascript/controllers/dialog_controller.js
17
17
  input:
18
18
  - app/assets/stylesheets/input.css
19
19
  - app/assets/images/select-arrow.svg
@@ -11,9 +11,9 @@
11
11
  font-weight: var(--font-medium);
12
12
  gap: var(--size-2);
13
13
  justify-content: center;
14
+ min-inline-size: fit-content;
14
15
  padding: var(--size-2) var(--size-4);
15
16
  text-align: center;
16
- white-space: nowrap;
17
17
 
18
18
  img:not([class]) {
19
19
  filter: var(--btn-icon-color, var(--color-filter-text-reversed));
@@ -18,31 +18,31 @@
18
18
  transform: var(--scale-95);
19
19
  transition-behavior: allow-discrete;
20
20
  transition-duration: var(--time-150);
21
- transition-property: display overlay opacity transform;
21
+ transition-property: display, overlay, opacity, transform;
22
22
 
23
23
  &::backdrop {
24
24
  opacity: 0;
25
25
  transition-behavior: allow-discrete;
26
26
  transition-duration: var(--time-150);
27
- transition-property: display overlay opacity;
27
+ transition-property: display, overlay, opacity;
28
28
  }
29
29
 
30
30
  /* In animation */
31
- &:is([open], :popover-open) {
31
+ &[open] {
32
32
  opacity: 1; transform: var(--scale-100);
33
33
  }
34
34
 
35
- &:is([open], :popover-open)::backdrop {
35
+ &[open]::backdrop {
36
36
  opacity: 1;
37
37
  }
38
38
 
39
39
  /* Out animation */
40
40
  @starting-style {
41
- &:is([open], :popover-open) {
41
+ &[open] {
42
42
  opacity: 0; transform: var(--scale-95);
43
43
  }
44
44
 
45
- &:is([open], :popover-open)::backdrop {
45
+ &[open]::backdrop {
46
46
  opacity: 0;
47
47
  }
48
48
  }
@@ -54,11 +54,12 @@
54
54
  }
55
55
 
56
56
  .dialog__close {
57
+ inset-block-start: var(--size-4);
58
+ inset-inline-end: var(--size-4);
57
59
  position: absolute;
58
- inset: var(--size-4) var(--size-4) auto auto;
59
60
  }
60
61
 
61
62
  /* Prevent page scroll when dialog is open */
62
- html:has(.dialog:is([open], :popover-open)) {
63
+ html:has(.dialog[open]) {
63
64
  overflow: hidden;
64
65
  }
@@ -12,7 +12,7 @@
12
12
 
13
13
  th {
14
14
  font-weight: var(--font-medium);
15
- text-align: left;
15
+ text-align: start;
16
16
  }
17
17
 
18
18
  th, td {
@@ -0,0 +1,21 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static targets = [ "box" ]
5
+
6
+ show() {
7
+ this.boxTarget.show()
8
+ }
9
+
10
+ showModal() {
11
+ this.boxTarget.showModal()
12
+ }
13
+
14
+ close() {
15
+ this.boxTarget.close()
16
+ }
17
+
18
+ closeOnClickOutside({ target }) {
19
+ if (target.nodeName === "DIALOG") this.close()
20
+ }
21
+ }
@@ -1,20 +1,17 @@
1
1
  :root {
2
- /* Color Scheme */
3
- color-scheme: light dark;
4
-
5
2
  /* Abstractions */
6
- --color-bg: light-dark(white, var(--zinc-950));
7
- --color-text: light-dark(black, white);
8
- --color-text-reversed: light-dark(white, black);
9
- --color-text-subtle: light-dark(var(--zinc-500), var(--zinc-400));
10
- --color-border: light-dark(var(--zinc-200), var(--zinc-800));
11
- --color-border-darker: light-dark(var(--zinc-400), var(--zinc-300));
3
+ --color-bg: white;
4
+ --color-text: black;
5
+ --color-text-reversed: white;
6
+ --color-text-subtle: var(--zinc-500);
7
+ --color-border: var(--zinc-200);
8
+ --color-border-darker: var(--zinc-400);
12
9
 
13
10
  /* Accent colors */
14
- --color-primary: light-dark(var(--zinc-900), var(--zinc-50));
15
- --color-secondary: light-dark(var(--zinc-100), var(--zinc-800));
16
- --color-negative: light-dark(var(--red-600), var(--red-900));
17
- --color-positive: light-dark(var(--green-600), var(--green-900));
11
+ --color-primary: var(--zinc-900);
12
+ --color-secondary: var(--zinc-100);
13
+ --color-negative: var(--red-600);
14
+ --color-positive: var(--green-600);
18
15
 
19
16
  /* SVG color values */
20
17
  --color-filter-text: invert(0);
@@ -23,6 +20,21 @@
23
20
  --color-filter-positive: invert(48%) sepia(74%) saturate(520%) hue-rotate(90deg) brightness(89%) contrast(90%);
24
21
 
25
22
  @media (prefers-color-scheme: dark) {
23
+ /* Abstractions */
24
+ --color-bg: var(--zinc-950);
25
+ --color-text: white;
26
+ --color-text-reversed: black;
27
+ --color-text-subtle: var(--zinc-400);
28
+ --color-border: var(--zinc-800);
29
+ --color-border-darker: var(--zinc-300);
30
+
31
+ /* Accent colors */
32
+ --color-primary: var(--zinc-50);
33
+ --color-secondary: var(--zinc-800);
34
+ --color-negative: var(--red-900);
35
+ --color-positive: var(--green-900);
36
+
37
+ /* SVG color values */
26
38
  --color-filter-text: invert(100%);
27
39
  --color-filter-text-reversed: invert(0);
28
40
  --color-filter-negative: invert(15%) sepia(83%) saturate(2066%) hue-rotate(345deg) brightness(87%) contrast(88%);
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.14
4
+ version: 0.0.16
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-07-02 00:00:00.000000000 Z
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com
@@ -51,7 +51,7 @@ files:
51
51
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/progress.css
52
52
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/switch.css
53
53
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/table.css
54
- - lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_control_controller.js
54
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js
55
55
  - lib/generators/css_zero/install/USAGE
56
56
  - lib/generators/css_zero/install/install_generator.rb
57
57
  - lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css
@@ -1,17 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static values = { target: String }
5
-
6
- close() {
7
- document.getElementById(this.targetValue).close()
8
- }
9
-
10
- show() {
11
- document.getElementById(this.targetValue).show()
12
- }
13
-
14
- showModal() {
15
- document.getElementById(this.targetValue).showModal()
16
- }
17
- }