protos 0.2.0 → 0.2.1

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: d5597289c15da1a04af0498dfcb056348db536a56920235d860a474766ffff1a
4
- data.tar.gz: 87a9bbe792395f7060befc199de669ee7155d2889b995fbaf8a09961dc2aa65a
3
+ metadata.gz: c5001f5f332c249597cb0f0c40cb8ff83429d7843db7c2f3f6cfc3b3ad6e9b50
4
+ data.tar.gz: 4e0426a89a66cd600cafe5411b02f6b3c5088dcc12bf64148d238bc542878459
5
5
  SHA512:
6
- metadata.gz: 90d1beb6df64bce823af006a5c8c345756f54f5ae8907aebbbc593e00ebfad4873b1fa6ef60080ba645fd81a1e2466f0b1ff93127c5da1fccb7dd080511ebfbc
7
- data.tar.gz: bed5be76a036311d146bcb0742fea11d15d52d0d4a23c5740929b270ebd86187cc79f6c804a2af6263e4c451651c6ddf6d578175a410f6d63161795d6b59384d
6
+ metadata.gz: eab1e457a004e0501c698f22a3c1aefb389a28a7970f864762320d4a4628e3b502d4a70080f05cdafc112d4dedd3d8a79637428ecef2194ccdf98d93111f2312
7
+ data.tar.gz: 3b1325007d6ad4c99bc478213aebf31bc03463308f591de7051d5542a95f1d9fd76d176d8e2a6d1396887b7f997e8bb19f14bde22d8544036144d2633317b98b
@@ -44,7 +44,7 @@ module Protos
44
44
  def default_attrs
45
45
  {
46
46
  data: {
47
- controller: "protos--popover protos--command",
47
+ controller: "protos--popover",
48
48
  "protos--popover-options-value": JSON.generate(options)
49
49
  }
50
50
  }
@@ -9,6 +9,12 @@ module Protos
9
9
 
10
10
  private
11
11
 
12
+ def default_attrs
13
+ {
14
+ data: { controller: "protos--command" }
15
+ }
16
+ end
17
+
12
18
  def theme
13
19
  {
14
20
  container: tokens("menu")
@@ -42,7 +42,7 @@ module Protos
42
42
 
43
43
  def default_attrs
44
44
  {
45
- data: { controller: "protos--command protos--modal" }
45
+ data: { controller: "protos--modal" }
46
46
  }
47
47
  end
48
48
  end
data/lib/protos/swap.rb CHANGED
@@ -4,7 +4,7 @@ module Protos
4
4
  class Swap < Component
5
5
  def template
6
6
  label(**attrs) do
7
- input(type: :checkbox)
7
+ input(type: :checkbox, class: css[:input])
8
8
  yield if block_given?
9
9
  end
10
10
  end
@@ -21,7 +21,8 @@ module Protos
21
21
 
22
22
  def theme
23
23
  {
24
- container: tokens("swap")
24
+ container: tokens("swap"),
25
+ input: tokens("hidden")
25
26
  }
26
27
  end
27
28
  end
data/lib/protos/table.rb CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  module Protos
4
4
  class Table < Component
5
+ option :pin_rows, default: -> { false }, type: Types::Bool
6
+ option :pin_columns, default: -> { false }, type: Types::Bool
7
+ option :striped, default: -> { false }, type: Types::Bool
8
+ option :size,
9
+ default: -> { :md },
10
+ reader: false,
11
+ type: Types::Coercible::Symbol.enum(
12
+ :xs,
13
+ :sm,
14
+ :md,
15
+ :lg
16
+ )
17
+
5
18
  def template(&block)
6
19
  div(**attrs) do
7
20
  table(class: css[:table], &block)
@@ -38,10 +51,25 @@ module Protos
38
51
 
39
52
  private
40
53
 
54
+ def size
55
+ {
56
+ xs: "table-xs",
57
+ sm: "table-sm",
58
+ md: "table-md",
59
+ lg: "table-lg"
60
+ }.fetch(@size)
61
+ end
62
+
41
63
  def theme
42
64
  {
43
65
  container: tokens("w-full", "overflow-x-auto"),
44
- table: tokens("table")
66
+ table: tokens(
67
+ "table",
68
+ size,
69
+ pin_rows: "table-pin-rows",
70
+ pin_columns: "table-pin-columns",
71
+ striped: "table-striped"
72
+ )
45
73
  }
46
74
  end
47
75
  end
data/lib/protos/toast.rb CHANGED
@@ -3,15 +3,21 @@
3
3
  module Protos
4
4
  class Toast < Component
5
5
  Positions = Types::Symbol.enum(
6
- :start,
7
- :center,
8
- :end,
9
- :top,
10
- :middle,
11
- :bottom
6
+ :top_start,
7
+ :top_center,
8
+ :top_end,
9
+ :middle_start,
10
+ :middle_center,
11
+ :middle_end,
12
+ :bottom_start,
13
+ :bottom_center,
14
+ :bottom_end
12
15
  )
13
16
 
14
- option :position, type: Positions, default: -> { :end }
17
+ option :position,
18
+ type: Positions,
19
+ default: -> { :bottom_end },
20
+ reader: false
15
21
 
16
22
  def template(&block)
17
23
  dialog(**attrs, &block)
@@ -29,11 +35,25 @@ module Protos
29
35
  }
30
36
  end
31
37
 
38
+ def position
39
+ {
40
+ top_start: "toast-start toast-top",
41
+ top_center: "toast-center toast-top",
42
+ top_end: "toast-end toast-top",
43
+ middle_start: "toast-start toast-middle",
44
+ middle_center: "toast-center toast-middle",
45
+ middle_end: "toast-end toast-middle",
46
+ bottom_start: "toast-start toast-bottom",
47
+ bottom_center: "toast-center toast-bottom",
48
+ bottom_end: "toast-end toast-bottom"
49
+ }.fetch(@position)
50
+ end
51
+
32
52
  def theme
33
53
  {
34
54
  container: tokens(
35
55
  "toast",
36
- "toast-end",
56
+ position,
37
57
  "[&:not([open])]:hidden",
38
58
  "bg-transparent"
39
59
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Protos
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nolan J Tait
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-07 00:00:00.000000000 Z
11
+ date: 2024-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-core