iron-cms 0.8.0 → 0.8.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0394a59fdfcd9e2552d9aea3fe48e8b95f7d01813841b0c91a0ba9fb2cc08220'
4
- data.tar.gz: 6b1125a24a88c762fe24b73c6d50b0a0a35f76bc802d89f073c55fb58d4d063d
3
+ metadata.gz: 053e1ac01b6555dad4cb4836c77679aa622e99502ee68bce97ddfa643ee9e074
4
+ data.tar.gz: ccc7b5cff9fa76d856f5ddee5acb1bf2397dfd571715f931b4e72dcbebec18bf
5
5
  SHA512:
6
- metadata.gz: dd37b2e6e68ccbb9993781cce2a0ccfbdf42ecd5247f36f010ff0ee1b97aed3228bc5cb4ac7961614617df8214985a950a8a67c86f904c83d341ce2a270449f0
7
- data.tar.gz: cb47c4a18d861e37001015aeec7eff0f2d90ca7ba8fd7ca7daeb85e03387fbb39ea84e3104e5a4e86e99c1986f3ea6656398f63e4e516582f80b9260655b1dc0
6
+ metadata.gz: ffea75ba7b33b21f0cee47b5d64461bc4691a843f626a697c5a325f521c58d8202709e8992be3d3e6f5e0a7413429b88b38d9f97ccc85e50fccb712d98a87878
7
+ data.tar.gz: 4e421bac5564e54a2a3a34860c81b5ab3e83b818cc899d10b7ab31fe1c2f611f637767524ca6e9a9afb001aabf01ca5b7c1a8af0937708795f8b61222b5e6b78
@@ -708,6 +708,93 @@
708
708
  .visible {
709
709
  visibility: visible;
710
710
  }
711
+ .toggle {
712
+ position: relative;
713
+ display: inline-flex;
714
+ width: calc(var(--spacing) * 11);
715
+ flex-shrink: 0;
716
+ border-radius: calc(infinity * 1px);
717
+ padding: calc(var(--spacing) * 0.5);
718
+ background-color: var(--color-stone-200);
719
+ transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
720
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
721
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
722
+ --tw-duration: 200ms;
723
+ transition-duration: 200ms;
724
+ --tw-ease: var(--ease-in-out);
725
+ transition-timing-function: var(--ease-in-out);
726
+ --tw-inset-ring-shadow: inset 0 0 0 1px var(--tw-inset-ring-color, currentcolor);
727
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
728
+ --tw-inset-ring-color: color-mix(in srgb, oklch(21.6% 0.006 56.043) 5%, transparent);
729
+ @supports (color: color-mix(in lab, red, red)) {
730
+ --tw-inset-ring-color: color-mix(in oklab, var(--color-stone-900) 5%, transparent);
731
+ }
732
+ outline-offset: 2px;
733
+ outline-color: var(--color-sky-600);
734
+ &:has(*:checked) {
735
+ background-color: var(--color-sky-600);
736
+ }
737
+ &:has(*:focus-visible) {
738
+ outline-style: var(--tw-outline-style);
739
+ outline-width: 2px;
740
+ }
741
+ @media (prefers-color-scheme: dark) {
742
+ background-color: color-mix(in srgb, #fff 5%, transparent);
743
+ @supports (color: color-mix(in lab, red, red)) {
744
+ background-color: color-mix(in oklab, var(--color-white) 5%, transparent);
745
+ }
746
+ }
747
+ @media (prefers-color-scheme: dark) {
748
+ --tw-inset-ring-color: color-mix(in srgb, #fff 10%, transparent);
749
+ @supports (color: color-mix(in lab, red, red)) {
750
+ --tw-inset-ring-color: color-mix(in oklab, var(--color-white) 10%, transparent);
751
+ }
752
+ }
753
+ @media (prefers-color-scheme: dark) {
754
+ outline-color: var(--color-sky-500);
755
+ }
756
+ @media (prefers-color-scheme: dark) {
757
+ &:has(*:checked) {
758
+ background-color: var(--color-sky-500);
759
+ }
760
+ }
761
+ & > .knob {
762
+ width: calc(var(--spacing) * 5);
763
+ height: calc(var(--spacing) * 5);
764
+ border-radius: calc(infinity * 1px);
765
+ background-color: var(--color-white);
766
+ --tw-shadow: 0 1px 2px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.05));
767
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
768
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
769
+ --tw-ring-color: color-mix(in oklab, var(--color-stone-900) 5%, transparent);
770
+ transition-property: transform, translate, scale, rotate;
771
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
772
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
773
+ --tw-duration: 200ms;
774
+ transition-duration: 200ms;
775
+ --tw-ease: var(--ease-in-out);
776
+ transition-timing-function: var(--ease-in-out);
777
+ &:is(:where(.group):has(*:checked) *) {
778
+ --tw-translate-x: calc(var(--spacing) * 5);
779
+ translate: var(--tw-translate-x) var(--tw-translate-y);
780
+ }
781
+ }
782
+ & > input[type="checkbox"] {
783
+ position: absolute;
784
+ inset: calc(var(--spacing) * 0);
785
+ width: 100%;
786
+ height: 100%;
787
+ appearance: none;
788
+ &:focus {
789
+ --tw-outline-style: none;
790
+ outline-style: none;
791
+ @media (forced-colors: active) {
792
+ outline: 2px solid transparent;
793
+ outline-offset: 2px;
794
+ }
795
+ }
796
+ }
797
+ }
711
798
  .sr-only {
712
799
  position: absolute;
713
800
  width: 1px;
@@ -1912,9 +1999,6 @@
1912
1999
  .w-5 {
1913
2000
  width: calc(var(--spacing) * 5);
1914
2001
  }
1915
- .w-11 {
1916
- width: calc(var(--spacing) * 11);
1917
- }
1918
2002
  .w-16 {
1919
2003
  width: calc(var(--spacing) * 16);
1920
2004
  }
@@ -2009,9 +2093,6 @@
2009
2093
  .list-disc {
2010
2094
  list-style-type: disc;
2011
2095
  }
2012
- .appearance-none {
2013
- appearance: none;
2014
- }
2015
2096
  .columns-2 {
2016
2097
  columns: 2;
2017
2098
  }
@@ -2313,9 +2394,6 @@
2313
2394
  .bg-stone-50 {
2314
2395
  background-color: var(--color-stone-50);
2315
2396
  }
2316
- .bg-stone-200 {
2317
- background-color: var(--color-stone-200);
2318
- }
2319
2397
  .bg-stone-700 {
2320
2398
  background-color: var(--color-stone-700);
2321
2399
  }
@@ -2379,9 +2457,6 @@
2379
2457
  .object-center {
2380
2458
  object-position: center;
2381
2459
  }
2382
- .p-0\.5 {
2383
- padding: calc(var(--spacing) * 0.5);
2384
- }
2385
2460
  .p-1 {
2386
2461
  padding: calc(var(--spacing) * 1);
2387
2462
  }
@@ -2672,20 +2747,10 @@
2672
2747
  --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
2673
2748
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2674
2749
  }
2675
- .inset-ring {
2676
- --tw-inset-ring-shadow: inset 0 0 0 1px var(--tw-inset-ring-color, currentcolor);
2677
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2678
- }
2679
2750
  .inset-ring-1 {
2680
2751
  --tw-inset-ring-shadow: inset 0 0 0 1px var(--tw-inset-ring-color, currentcolor);
2681
2752
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2682
2753
  }
2683
- .ring-stone-900\/5 {
2684
- --tw-ring-color: color-mix(in srgb, oklch(21.6% 0.006 56.043) 5%, transparent);
2685
- @supports (color: color-mix(in lab, red, red)) {
2686
- --tw-ring-color: color-mix(in oklab, var(--color-stone-900) 5%, transparent);
2687
- }
2688
- }
2689
2754
  .ring-stone-950\/10 {
2690
2755
  --tw-ring-color: color-mix(in srgb, oklch(14.7% 0.004 49.25) 10%, transparent);
2691
2756
  @supports (color: color-mix(in lab, red, red)) {
@@ -2695,12 +2760,6 @@
2695
2760
  .inset-ring-stone-300 {
2696
2761
  --tw-inset-ring-color: var(--color-stone-300);
2697
2762
  }
2698
- .inset-ring-stone-900\/5 {
2699
- --tw-inset-ring-color: color-mix(in srgb, oklch(21.6% 0.006 56.043) 5%, transparent);
2700
- @supports (color: color-mix(in lab, red, red)) {
2701
- --tw-inset-ring-color: color-mix(in oklab, var(--color-stone-900) 5%, transparent);
2702
- }
2703
- }
2704
2763
  .outline {
2705
2764
  outline-style: var(--tw-outline-style);
2706
2765
  outline-width: 1px;
@@ -2712,9 +2771,6 @@
2712
2771
  .-outline-offset-1 {
2713
2772
  outline-offset: calc(1px * -1);
2714
2773
  }
2715
- .outline-offset-2 {
2716
- outline-offset: 2px;
2717
- }
2718
2774
  .outline-black\/\(--ring-opacity\) {
2719
2775
  outline-color: #000;
2720
2776
  @supports (color: color-mix(in lab, red, red)) {
@@ -2727,9 +2783,6 @@
2727
2783
  outline-color: color-mix(in oklab, var(--color-black) 5%, transparent);
2728
2784
  }
2729
2785
  }
2730
- .outline-sky-600 {
2731
- outline-color: var(--color-sky-600);
2732
- }
2733
2786
  .outline-stone-400 {
2734
2787
  outline-color: var(--color-stone-400);
2735
2788
  }
@@ -2781,10 +2834,6 @@
2781
2834
  .transition-discrete {
2782
2835
  transition-behavior: allow-discrete;
2783
2836
  }
2784
- .duration-200 {
2785
- --tw-duration: 200ms;
2786
- transition-duration: 200ms;
2787
- }
2788
2837
  .duration-300 {
2789
2838
  --tw-duration: 300ms;
2790
2839
  transition-duration: 300ms;
@@ -2915,12 +2964,6 @@
2915
2964
  display: none;
2916
2965
  }
2917
2966
  }
2918
- .group-has-checked\:translate-x-5 {
2919
- &:is(:where(.group):has(*:checked) *) {
2920
- --tw-translate-x: calc(var(--spacing) * 5);
2921
- translate: var(--tw-translate-x) var(--tw-translate-y);
2922
- }
2923
- }
2924
2967
  .group-aria-selected\/option\:font-semibold {
2925
2968
  &:is(:where(.group\/option)[aria-selected="true"] *) {
2926
2969
  --tw-font-weight: var(--font-weight-semibold);
@@ -3101,17 +3144,6 @@
3101
3144
  display: none;
3102
3145
  }
3103
3146
  }
3104
- .has-checked\:bg-sky-600 {
3105
- &:has(*:checked) {
3106
- background-color: var(--color-sky-600);
3107
- }
3108
- }
3109
- .has-focus-visible\:outline-2 {
3110
- &:has(*:focus-visible) {
3111
- outline-style: var(--tw-outline-style);
3112
- outline-width: 2px;
3113
- }
3114
- }
3115
3147
  .has-\[\>_\.destroy\:checked\]\:hidden {
3116
3148
  &:has(> .destroy:checked) {
3117
3149
  display: none;
@@ -3497,14 +3529,6 @@
3497
3529
  }
3498
3530
  }
3499
3531
  }
3500
- .dark\:inset-ring-white\/10 {
3501
- @media (prefers-color-scheme: dark) {
3502
- --tw-inset-ring-color: color-mix(in srgb, #fff 10%, transparent);
3503
- @supports (color: color-mix(in lab, red, red)) {
3504
- --tw-inset-ring-color: color-mix(in oklab, var(--color-white) 10%, transparent);
3505
- }
3506
- }
3507
- }
3508
3532
  .dark\:outline {
3509
3533
  @media (prefers-color-scheme: dark) {
3510
3534
  outline-style: var(--tw-outline-style);
@@ -3516,11 +3540,6 @@
3516
3540
  outline-offset: calc(1px * -1);
3517
3541
  }
3518
3542
  }
3519
- .dark\:outline-sky-500 {
3520
- @media (prefers-color-scheme: dark) {
3521
- outline-color: var(--color-sky-500);
3522
- }
3523
- }
3524
3543
  .dark\:outline-white\/\(--ring-opacity\) {
3525
3544
  @media (prefers-color-scheme: dark) {
3526
3545
  outline-color: #fff;
@@ -3788,13 +3807,6 @@
3788
3807
  }
3789
3808
  }
3790
3809
  }
3791
- .dark\:has-checked\:bg-sky-500 {
3792
- @media (prefers-color-scheme: dark) {
3793
- &:has(*:checked) {
3794
- background-color: var(--color-sky-500);
3795
- }
3796
- }
3797
- }
3798
3810
  }
3799
3811
  @layer base {
3800
3812
  form {
@@ -5274,6 +5286,29 @@
5274
5286
  inherits: false;
5275
5287
  initial-value: 0 0 #0000;
5276
5288
  }
5289
+ @property --tw-duration {
5290
+ syntax: "*";
5291
+ inherits: false;
5292
+ }
5293
+ @property --tw-ease {
5294
+ syntax: "*";
5295
+ inherits: false;
5296
+ }
5297
+ @property --tw-translate-x {
5298
+ syntax: "*";
5299
+ inherits: false;
5300
+ initial-value: 0;
5301
+ }
5302
+ @property --tw-translate-y {
5303
+ syntax: "*";
5304
+ inherits: false;
5305
+ initial-value: 0;
5306
+ }
5307
+ @property --tw-translate-z {
5308
+ syntax: "*";
5309
+ inherits: false;
5310
+ initial-value: 0;
5311
+ }
5277
5312
  @property --tw-blur {
5278
5313
  syntax: "*";
5279
5314
  inherits: false;
@@ -5363,21 +5398,6 @@
5363
5398
  syntax: "*";
5364
5399
  inherits: false;
5365
5400
  }
5366
- @property --tw-translate-x {
5367
- syntax: "*";
5368
- inherits: false;
5369
- initial-value: 0;
5370
- }
5371
- @property --tw-translate-y {
5372
- syntax: "*";
5373
- inherits: false;
5374
- initial-value: 0;
5375
- }
5376
- @property --tw-translate-z {
5377
- syntax: "*";
5378
- inherits: false;
5379
- initial-value: 0;
5380
- }
5381
5401
  @property --tw-scale-x {
5382
5402
  syntax: "*";
5383
5403
  inherits: false;
@@ -5436,14 +5456,6 @@
5436
5456
  syntax: "*";
5437
5457
  inherits: false;
5438
5458
  }
5439
- @property --tw-duration {
5440
- syntax: "*";
5441
- inherits: false;
5442
- }
5443
- @property --tw-ease {
5444
- syntax: "*";
5445
- inherits: false;
5446
- }
5447
5459
  @property --tw-content {
5448
5460
  syntax: "*";
5449
5461
  initial-value: "";
@@ -5484,6 +5496,11 @@
5484
5496
  --tw-ring-offset-width: 0px;
5485
5497
  --tw-ring-offset-color: #fff;
5486
5498
  --tw-ring-offset-shadow: 0 0 #0000;
5499
+ --tw-duration: initial;
5500
+ --tw-ease: initial;
5501
+ --tw-translate-x: 0;
5502
+ --tw-translate-y: 0;
5503
+ --tw-translate-z: 0;
5487
5504
  --tw-blur: initial;
5488
5505
  --tw-brightness: initial;
5489
5506
  --tw-contrast: initial;
@@ -5506,9 +5523,6 @@
5506
5523
  --tw-backdrop-opacity: initial;
5507
5524
  --tw-backdrop-saturate: initial;
5508
5525
  --tw-backdrop-sepia: initial;
5509
- --tw-translate-x: 0;
5510
- --tw-translate-y: 0;
5511
- --tw-translate-z: 0;
5512
5526
  --tw-scale-x: 1;
5513
5527
  --tw-scale-y: 1;
5514
5528
  --tw-scale-z: 1;
@@ -5522,8 +5536,6 @@
5522
5536
  --tw-divide-y-reverse: 0;
5523
5537
  --tw-leading: initial;
5524
5538
  --tw-tracking: initial;
5525
- --tw-duration: initial;
5526
- --tw-ease: initial;
5527
5539
  --tw-content: "";
5528
5540
  }
5529
5541
  }
@@ -8,6 +8,7 @@
8
8
  @import './components/input.css';
9
9
  @import './components/textarea.css';
10
10
  @import './components/checkbox.css';
11
+ @import './components/toggle.css';
11
12
  @import './components/button.css';
12
13
  @import './components/badge.css';
13
14
  @import './components/dropdown.css';
@@ -0,0 +1,17 @@
1
+ @utility toggle {
2
+ @apply relative inline-flex w-11 shrink-0 rounded-full p-0.5;
3
+ @apply bg-stone-200 transition-colors duration-200 ease-in-out;
4
+ @apply inset-ring inset-ring-stone-900/5 outline-offset-2 outline-sky-600;
5
+ @apply has-checked:bg-sky-600 has-focus-visible:outline-2;
6
+ @apply dark:bg-white/5 dark:inset-ring-white/10 dark:outline-sky-500 dark:has-checked:bg-sky-500;
7
+
8
+ & > .knob {
9
+ @apply size-5 rounded-full bg-white shadow-xs ring-1 ring-stone-900/5;
10
+ @apply transition-transform duration-200 ease-in-out;
11
+ @apply group-has-checked:translate-x-5;
12
+ }
13
+
14
+ & > input[type="checkbox"] {
15
+ @apply absolute inset-0 size-full appearance-none focus:outline-hidden;
16
+ }
17
+ }
@@ -13,7 +13,7 @@ module Iron
13
13
  Iron::PasswordsMailer.reset(user).deliver_later
14
14
  end
15
15
 
16
- redirect_to new_session_url, notice: "Password reset instructions sent (if user with that email address exists)."
16
+ redirect_to sign_in_url, notice: "Password reset instructions sent."
17
17
  end
18
18
 
19
19
  def edit
@@ -21,7 +21,7 @@ module Iron
21
21
 
22
22
  def update
23
23
  if @user.update(params.permit(:password, :password_confirmation))
24
- redirect_to new_session_url, notice: "Password has been reset."
24
+ redirect_to sign_in_url, notice: "Password has been reset."
25
25
  else
26
26
  redirect_to edit_password_url(params[:token]), alert: "Passwords did not match."
27
27
  end
@@ -47,6 +47,26 @@ module Iron
47
47
  end
48
48
  end
49
49
 
50
+ def toggle(method, options = {})
51
+ value = object&.send(method)
52
+ checked = ActiveModel::Type::Boolean.new.cast(value)
53
+
54
+ hidden = @template.hidden_field_tag(field_name(method), "0", id: nil)
55
+ toggle_html = @template.content_tag(:div, class: "group toggle") do
56
+ @template.content_tag(:span, nil, class: "knob") +
57
+ @template.tag(:input,
58
+ type: "checkbox",
59
+ name: field_name(method),
60
+ id: field_id(method),
61
+ value: "1",
62
+ checked: checked,
63
+ **options
64
+ )
65
+ end
66
+
67
+ hidden + toggle_html
68
+ end
69
+
50
70
  def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
51
71
  selected_value = object.send(method) rescue nil
52
72
 
@@ -31,10 +31,7 @@
31
31
  <% end %>
32
32
  </span>
33
33
  </span>
34
- <div class="group relative inline-flex w-11 shrink-0 rounded-full bg-stone-200 p-0.5 inset-ring inset-ring-stone-900/5 outline-offset-2 outline-sky-600 transition-colors duration-200 ease-in-out has-checked:bg-sky-600 has-focus-visible:outline-2 dark:bg-white/5 dark:inset-ring-white/10 dark:outline-sky-500 dark:has-checked:bg-sky-500">
35
- <span class="size-5 rounded-full bg-white shadow-xs ring-1 ring-stone-900/5 transition-transform duration-200 ease-in-out group-has-checked:translate-x-5"></span>
36
- <%= form.check_box :use_as_index, class: "absolute inset-0 appearance-none focus:outline-hidden" %>
37
- </div>
34
+ <%= form.toggle :use_as_index, "aria-label": "Use as index page" %>
38
35
  </div>
39
36
 
40
37
  <div class="field group-has-checked:hidden">
data/lib/iron/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iron
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Massimo De Marchi
@@ -230,6 +230,7 @@ files:
230
230
  - app/assets/tailwind/iron/components/page.css
231
231
  - app/assets/tailwind/iron/components/sidebar.css
232
232
  - app/assets/tailwind/iron/components/textarea.css
233
+ - app/assets/tailwind/iron/components/toggle.css
233
234
  - app/assets/tailwind/iron/lexxy.css
234
235
  - app/controllers/concerns/iron/authentication.rb
235
236
  - app/controllers/concerns/iron/authorization.rb