satis 2.2.2 → 2.3.0

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: 0a216f52695555dd93f0a81cd4bccbfd12a2a35e4c66d27ecb9b9d47a13230ab
4
- data.tar.gz: 2c91093bfbdf423497d7be8cd3f369a7532576b2df54fcacd1819db96c1b24f0
3
+ metadata.gz: e7f45a02909e964bdabe71e07a24befe60acff498e89e92c3ed053e87809cf6b
4
+ data.tar.gz: 68ef0cb6049da0bf0888fb15ee66c330cb8b0c227f48d350baf56f69ff726ae7
5
5
  SHA512:
6
- metadata.gz: 5e5993a3ddbad93c31e40f16020d5fa449414124c8eb2cdd8340d171798a36591d348bd58e431667771e085b7e7163e362840eeb566fa6e40b0fa2a7bd8562ad
7
- data.tar.gz: faf38d6365356096841ac530334082d83bd1088190da0c1560800c174af553fc5ffe8591dfee14d2c3f81c35cd5cd96e10150c538fc44286bcb6030d2f2ebeb9
6
+ metadata.gz: 1c0f3259673f67d0c7fa473f28c2b3c717dc94d297a0541e4c8964638e2ddf468693a8e69171c590f39ed512d8461d8f201819f896e19392bad47d16029173cf
7
+ data.tar.gz: bed89434515a53c1c853d04bc9ead18aa6fc53be3b73d270e00110978cf8717da1dea8b9ebdf05079ef5d64455dfb3a6e442300643d1772ecb50bec106a859e2
data/README.md CHANGED
@@ -12,7 +12,7 @@ We use:
12
12
 
13
13
  ## Upgrade
14
14
 
15
- * From 2.3.0 onwards, we will no longer ship Fontawesome free. It conflicts with Fontawesome Pro. You can easily add the javascript files, you can download them from here: https://fontawesome.com/download. Use the files from the `js` folder. Put these in a folder which is in your manifest and it should just work.
15
+ * From 2.3.0 onwards, we will no longer ship Fontawesome free. It conflicts with Fontawesome Pro. You can add easily add the javascript files, you can download them from here: https://fontawesome.com/download. Use the files from the `js` folder.
16
16
 
17
17
  ## Installation
18
18
 
@@ -5,14 +5,6 @@
5
5
  @apply px-4 py-5 sm:px-6 dark:bg-gray-900 bg-white dark:border-gray-700 dark:text-gray-300;
6
6
  }
7
7
 
8
- &__header--compact {
9
- @apply px-3 py-3 sm:px-4;
10
- }
11
-
12
- &[data-satis-card-collapsible-value="true"] .sts-card__header {
13
- @apply cursor-pointer select-none;
14
- }
15
-
16
8
  &__tabs {
17
9
  @apply bg-white px-4 border-b border-gray-200 sm:px-5 bg-white dark:bg-gray-900 dark:border-gray-700 dark:text-gray-300;
18
10
 
@@ -1,45 +1,38 @@
1
- .sts-card data-controller="satis-card satis-tabs" data-satis-tabs-persist-value=persist data-satis-tabs-key-value=key data-satis-card-collapsible-value=collapsible data-satis-card-collapsed-value=collapsed data-satis-card-identifier-value=identifier id=identifier
1
+ .sts-card data-controller="satis-tabs" data-satis-tabs-persist-value=persist data-satis-tabs-key-value=key id=identifier
2
2
  - if header?
3
- .sts-card__header class=header_classes data-action="#{collapsible ? 'click->satis-card#toggle' : ''}"
3
+ .sts-card__header class="#{tabs? ? '' : 'border-b border-gray-200'}"
4
4
  .-ml-4.-mt-4.flex.justify-between.items-center.flex-wrap.sm:flex-nowrap
5
5
  - if icon
6
6
  .ml-4.mt-4.flex-shrink-0.text-primary-600.dark:text-gray-300
7
7
  i class=icon
8
8
  .ml-4.mt-4.flex-1
9
- h3 class=title_classes
9
+ h3.text-lg.leading-6.font-medium.text-gray-900.dark:text-white
10
10
  = title
11
11
  - if description.present?
12
12
  p.mt-1.text-sm.text-gray-500.dark:text-gray-500
13
13
  = description
14
14
 
15
15
  - if actions.present? || initial_actions.present?
16
- .ml-4.mt-4.flex-shrink-0 data-satis-card-target="actions"
16
+ .ml-4.mt-4.flex-shrink-0
17
17
  .grid.grid-flow-row.gap-1.sm:grid-flow-col
18
18
  - initial_actions.each do |action|
19
19
  = action
20
20
  - actions.each do |action|
21
21
  = action
22
22
 
23
- - if collapsible
24
- .ml-4.mt-4.flex-shrink-0
25
- button.text-gray-400.hover:text-gray-600.dark:hover:text-gray-200.transition-transform.duration-200 type="button" data-satis-card-target="collapseIcon"
26
- i.fas.fa-chevron-down
27
-
28
23
  - if menu
29
24
  .ml-4.mt-2.flex-shrink-0
30
25
  = render(Satis::Menu::Component.new(menu))
31
26
 
32
- div data-satis-card-target="body"
33
- - if tabs?
34
- = render Satis::Tabs::Component.new(custom_link: custom_tabs_link).tap {|c| c.original_view_context = view_context } do |t|
35
- - tabs.each_with_index do |ta, i|
36
- - t.with_tab ta.name, id: ta.id, icon: ta.icon, padding: ta.padding, badge: ta.badge, menu: ta.menu, dirty: ta.dirty, title: ta.title, responsive: ta.responsive, selected_tab_index: ta.selected_tab_index do
37
- = ta
27
+ - if tabs?
28
+ = render Satis::Tabs::Component.new(custom_link: custom_tabs_link).tap {|c| c.original_view_context = view_context } do |t|
29
+ - tabs.each_with_index do |ta, i|
30
+ - t.with_tab ta.name, id: ta.id, icon: ta.icon, padding: ta.padding, badge: ta.badge, menu: ta.menu, dirty: ta.dirty, title: ta.title, responsive: ta.responsive, selected_tab_index: ta.selected_tab_index do
31
+ = ta
38
32
 
39
- - else
40
- div class=content_classes style=content_style
41
- = content
33
+ - else
34
+ div class="#{content_padding ? 'px-6 py-6' : ''}"
35
+ = content
42
36
 
43
37
  - if footer
44
- div data-satis-card-target="footer"
45
- = footer
38
+ = footer
@@ -7,8 +7,7 @@ module Satis
7
7
  renders_many :tabs, Tab::Component
8
8
  renders_one :footer
9
9
 
10
- attr_reader :identifier, :icon, :description, :menu, :content_padding, :header_background_color, :initial_actions, :persist, :key,
11
- :collapsible, :collapsed, :height, :min_height, :max_height, :padding, :compact
10
+ attr_reader :identifier, :icon, :description, :menu, :content_padding, :header_background_color, :initial_actions, :persist, :key
12
11
  attr_writer :scope
13
12
 
14
13
  def initialize(identifier = nil,
@@ -24,14 +23,7 @@ module Satis
24
23
  scope: [],
25
24
  actions: [],
26
25
  key: nil,
27
- persist: true,
28
- collapsible: false,
29
- collapsed: false,
30
- height: nil,
31
- min_height: nil,
32
- max_height: nil,
33
- padding: nil,
34
- compact: false)
26
+ persist: true)
35
27
  super
36
28
 
37
29
  if identifier.blank?
@@ -51,13 +43,6 @@ module Satis
51
43
  @key = key
52
44
  @custom_tabs_link = custom_tabs_link
53
45
  @scope = scope.present? ? scope : identifier
54
- @collapsible = collapsible
55
- @collapsed = collapsed
56
- @height = height
57
- @min_height = min_height
58
- @max_height = max_height
59
- @padding = padding
60
- @compact = compact
61
46
  end
62
47
 
63
48
  # def key
@@ -85,38 +70,6 @@ module Satis
85
70
  def header?
86
71
  icon.present? || title.present? || description.present? || menu
87
72
  end
88
-
89
- def content_style
90
- styles = []
91
- styles << "height: #{height}" if height
92
- styles << "min-height: #{min_height}" if min_height
93
- styles << "max-height: #{max_height}; overflow-y: auto" if max_height
94
- styles.join('; ')
95
- end
96
-
97
- def content_classes
98
- classes = []
99
- if padding
100
- classes << padding
101
- elsif content_padding
102
- classes << (compact ? 'px-4 py-3' : 'px-6 py-6')
103
- end
104
- classes.join(' ')
105
- end
106
-
107
- def header_classes
108
- base = tabs? ? '' : 'border-b border-gray-200'
109
- base += ' sts-card__header--compact' if compact
110
- base
111
- end
112
-
113
- def title_classes
114
- if compact
115
- 'text-sm leading-5 font-medium text-gray-900 dark:text-white'
116
- else
117
- 'text-lg leading-6 font-medium text-gray-900 dark:text-white'
118
- end
119
- end
120
73
  end
121
74
  end
122
75
  end
@@ -9,10 +9,10 @@ div.satis-dropdown data-action="keydown->satis-dropdown#dispatch" data-controlle
9
9
  div.hidden.py-1 data-satis-dropdown-target="pills"
10
10
  .flex.flex-col.items-center
11
11
  .w-full.sts-dropdown class=input_class
12
- div class=input_wrapper_classes
12
+ .h-12.p-1.flex.rounded
13
13
  .flex.flex-auto.flex-wrap.sts-dropdown-input
14
14
  / Input where you can search
15
- input class=search_input_classes data-action="input->satis-dropdown#search" data-satis-dropdown-target="searchInput" placeholder=placeholder autofocus=options[:autofocus]
15
+ input.focus:ring-0.border-none.p-1.px-2.appearance-none.w-full.sts-dropdown-input.text-gray-800.dark:text-gray-300 data-action="input->satis-dropdown#search" data-satis-dropdown-target="searchInput" placeholder=placeholder autofocus=options[:autofocus]
16
16
  div
17
17
  / Reset button
18
18
  - unless @reset_button == false
@@ -28,7 +28,7 @@ div.satis-dropdown data-action="keydown->satis-dropdown#dispatch" data-controlle
28
28
  template data-satis-dropdown-target="selectedItemsTemplate"
29
29
 
30
30
  / Container for results
31
- div class=results_classes style=results_style data-satis-dropdown-target="results" data-action="scroll->satis-dropdown#scroll" tabindex="-1"
31
+ .hidden.container.sts-dropdown-results.shadow.dark:text-gray-300.z-10.rounded.max-h-select.overflow-y-auto.w-full data-satis-dropdown-target="results" data-action="scroll->satis-dropdown#scroll" tabindex="-1"
32
32
  .flex.flex-col.w-full data-satis-dropdown-target="items"
33
33
  - options[:collection]&.each do |item|
34
34
  - data_attrs = item.try(:third) ? item.third : {}
@@ -3,7 +3,7 @@
3
3
  module Satis
4
4
  module Dropdown
5
5
  class Component < ViewComponent::Base
6
- attr_reader :url, :form, :attribute, :title, :options, :dropdown_max_height, :dropdown_min_height, :dropdown_width, :dropdown_height, :compact
6
+ attr_reader :url, :form, :attribute, :title, :options
7
7
 
8
8
  def initialize(form:, attribute:, **options, &block)
9
9
  super
@@ -18,11 +18,6 @@ module Satis
18
18
  @needs_exact_match = options[:needs_exact_match]
19
19
  @reset_button = options[:reset_button] || options[:include_blank]
20
20
  @toggle_button = options[:toggle_button] != false
21
- @dropdown_max_height = options[:max_height]
22
- @dropdown_min_height = options[:min_height]
23
- @dropdown_width = options[:width]
24
- @dropdown_height = options[:height]
25
- @compact = options[:compact] || false
26
21
 
27
22
  options[:input_html] ||= {}
28
23
 
@@ -118,31 +113,6 @@ module Satis
118
113
  def input_class
119
114
  [@options.fetch(:input_html, {}).fetch(:class, ""), form.has_error?(attribute) ? "is-invalid" : ""].join(" ")
120
115
  end
121
-
122
- def results_style
123
- styles = []
124
- styles << "max-height: #{dropdown_max_height}" if dropdown_max_height
125
- styles << "min-height: #{dropdown_min_height}" if dropdown_min_height
126
- styles << "width: #{dropdown_width}" if dropdown_width
127
- styles << "height: #{dropdown_height}" if dropdown_height
128
- styles.join('; ')
129
- end
130
-
131
- def results_classes
132
- classes = "hidden container sts-dropdown-results shadow dark:text-gray-300 z-10 rounded overflow-y-auto w-full"
133
- classes += " max-h-select" unless dropdown_max_height
134
- classes
135
- end
136
-
137
- def input_wrapper_classes
138
- compact ? 'h-9 p-1 flex rounded' : 'h-12 p-1 flex rounded'
139
- end
140
-
141
- def search_input_classes
142
- base = 'focus:ring-0 border-none p-1 px-2 appearance-none w-full sts-dropdown-input text-gray-800 dark:text-gray-300'
143
- base += ' text-sm' if compact
144
- base
145
- end
146
116
  end
147
117
  end
148
118
  end
@@ -20,14 +20,14 @@ export default class DropdownComponentController extends ApplicationController {
20
20
  ]
21
21
 
22
22
  static values = {
23
- chainTo: String,
24
- freeText: Boolean,
25
- needsExactMatch: Boolean,
26
- pageSize: Number,
27
- url: String,
28
- urlParams: Object,
29
- isMultiple: Boolean,
30
- minSearchQueryLength: Number
23
+ chainTo: String,
24
+ freeText: Boolean,
25
+ needsExactMatch: Boolean,
26
+ pageSize: Number,
27
+ url: String,
28
+ urlParams: Object,
29
+ isMultiple: Boolean,
30
+ minSearchQueryLength: Number
31
31
  }
32
32
 
33
33
  connect() {
@@ -355,9 +355,6 @@ export default class DropdownComponentController extends ApplicationController {
355
355
  }
356
356
 
357
357
  setHiddenSelect() {
358
- if (this.element.querySelector('select[name*="[TEMPLATE]"]')) {
359
- return
360
- }
361
358
  if (this.hiddenSelectTarget.options.length === 0) {
362
359
  this.searchInputTarget.value = ""
363
360
  this.pillsTarget.innerHTML = ""
@@ -545,7 +542,7 @@ export default class DropdownComponentController extends ApplicationController {
545
542
  // auto select if there is only one match and we are not in freetext mode
546
543
  if (!this.freeTextValue) {
547
544
  if (matches.length === 1) {
548
- if (this.filteredSearchQuery?.length >= this.minSearchQueryLengthValue &&
545
+ if (this.filteredSearchQuery.length >= this.minSearchQueryLengthValue &&
549
546
  matches[0].getAttribute("data-satis-dropdown-item-text").toLowerCase().indexOf(this.lastSearch.toLowerCase()) >= 0) {
550
547
  const dataDiv = matches[0].closest('[data-satis-dropdown-target="item"]')
551
548
  this.selectItem(dataDiv)
@@ -604,14 +601,15 @@ export default class DropdownComponentController extends ApplicationController {
604
601
  this.fetchResultsWith(ourUrl).then((itemCount) => {
605
602
  if (this.hasResults) {
606
603
  this.filterResultsChainTo()
607
- if (!this.resultsShown) {
604
+
605
+ if (!this.resultsShown && !this.chainToValue) {
608
606
  this.showResultsList()
609
607
  }
610
608
 
611
609
  // auto select when there is only 1 value
612
- if (this.filteredSearchQuery?.length >= this.minSearchQueryLengthValue && this.nrOfItems === 1 && !this.freeTextValue) {
610
+ if (this.filteredSearchQuery.length >= this.minSearchQueryLengthValue && this.nrOfItems === 1 && !this.freeTextValue) {
613
611
  const dataDiv = this.itemTargets[0].closest('[data-satis-dropdown-target="item"]')
614
- this.selectItem(dataDiv, true)
612
+ this.selectItem(dataDiv)
615
613
  this.setSelectedItem(dataDiv.getAttribute("data-satis-dropdown-item-value"))
616
614
  this.searchQueryValue = ""
617
615
  } else if (this.searchQueryValue?.length > 0) {
@@ -620,12 +618,8 @@ export default class DropdownComponentController extends ApplicationController {
620
618
  let matches = []
621
619
  this.itemTargets.forEach((item) => {
622
620
  const text = item.getAttribute("data-satis-dropdown-item-text")
623
- let matched
624
- if (this.needsExactMatchValue) {
625
- matched = searchValue.localeCompare(text, undefined, { sensitivity: "base" }) === 0
626
- } else {
627
- matched = searchValue.split(" ").every((term) => { return text?.toLowerCase().includes(term.toLowerCase()) })
628
- }
621
+ const matched = this.needsExactMatchValue
622
+ ? searchValue.localeCompare(text, undefined, { sensitivity: "base" }) === 0 : text?.toLowerCase().includes(searchValue.toLowerCase())
629
623
 
630
624
  const isHidden = item.classList.contains("hidden")
631
625
  if (!isHidden) {
@@ -1,4 +1,3 @@
1
- /* ── Sidebar container ── */
2
1
  .h-screen.flex .sidebar {
3
2
  @apply dark:bg-gray-700 bg-white;
4
3
  width: 260px;
@@ -7,44 +6,77 @@
7
6
  left: 0;
8
7
  margin-top: 4rem;
9
8
  position: absolute;
10
- overflow-x: hidden;
11
- overflow-y: auto;
9
+ overflow: visible;
10
+ overflow-y: scroll;
12
11
  scrollbar-width: none;
13
12
  z-index: 999;
14
- transition: width 0.3s ease-in-out;
13
+ transition: backdrop-filter 0.3s ease-in-out, transform 0.3s ease-in-out;
14
+
15
+ }
16
+
17
+ .h-screen.flex .sidebar.close .icon-link .sts-sidebar-menu-item{
18
+ z-index: 1100;
19
+ position: relative;
20
+ opacity: 0.99;
21
+ margin-left: 10px;
22
+ transition: backdrop-filter 0.3s ease-in-out, transform 0.3s ease-in-out;
15
23
  }
16
24
 
25
+
17
26
  .h-screen.flex .sidebar.close {
18
- width: 60px;
27
+ position: absolute;
19
28
  overflow: visible;
29
+ top: 0;
30
+ left: 0;
31
+ height: calc(100% - 4rem);
32
+ margin-top: 4rem;
33
+ width: 60px;
34
+ z-index: 999;
35
+ scrollbar-width: none;
20
36
  }
21
37
 
22
38
  .sidebar::-webkit-scrollbar {
23
39
  display: none;
24
40
  }
25
41
 
26
- .dark .h-screen.flex .sidebar {
27
- @apply bg-gray-800;
28
- }
29
42
 
30
- /* ── Topbar ── */
31
43
  .h-screen.flex .topbar {
32
44
  @apply bg-white dark:bg-gray-800;
33
45
  height: 4rem;
34
46
  display: flex;
35
47
  max-width: 100%;
48
+ left:0;
49
+ margin-left: 0;
36
50
  position: relative;
37
- z-index: 1000;
51
+ z-index: 10000;
52
+ transition: backdrop-filter 0.3s ease-in-out, transform 0.3s ease-in-out;
38
53
  }
39
54
 
40
- /* ── Page body ── */
41
55
  .page_body.close {
42
- margin-left: 60px;
43
- max-width: calc(100% - 60px);
56
+ margin-left: 50px;
57
+ max-width: 97%;
58
+ }
59
+
60
+ .h-screen.flex .sidebar .boxture-logo{
61
+ margin-top: 30px;
62
+ }
63
+
64
+ .sidebar.close .boxture-logo {
65
+ opacity: 0;
66
+ }
67
+
68
+ .h-screen.flex .sidebar.close .icon-link {
69
+ margin-top: 0;
70
+ transition: 0.3s ease;
71
+ transition-delay: 0.1s;
44
72
  }
45
73
 
46
- /* ── Logo ── */
47
- .h-screen.flex .sidebar .boxture-logo {
74
+
75
+ .sidebar.close .sts-sidebar-menu-item{
76
+ margin-left: 2px;
77
+ }
78
+
79
+ .sidebar .boxture-logo {
48
80
  height: 52px;
49
81
  width: 52px;
50
82
  opacity: 0.5;
@@ -52,76 +84,66 @@
52
84
  border-radius: 16px;
53
85
  font-size: 30px;
54
86
  color: #fff;
55
- margin-top: 30px;
87
+ margin-top: 80px;
56
88
  mix-blend-mode: multiply;
57
- transition: opacity 0.3s ease-in-out;
58
89
  }
59
90
 
60
91
  .dark .sidebar .boxture-logo {
61
92
  mix-blend-mode: normal;
62
93
  }
63
94
 
64
- .sidebar.close .boxture-logo {
65
- opacity: 0;
66
- pointer-events: none;
67
- }
68
-
69
- .sidebar .logo_name {
70
- font-size: 10px;
71
- opacity: 0.5;
72
- text-align: center;
73
- display: block;
95
+ .sidebar.close .profile-logo {
96
+ display: none;
74
97
  }
75
98
 
76
- .sidebar.close .logo_name {
77
- display: none;
99
+ .sidebar .arrow:hover {
100
+ color: #555555;
101
+ cursor: pointer;
78
102
  }
79
103
 
80
- .dark .sidebar .logo_name {
81
- color: #edecec;
104
+ .dark .sidebar .arrow:hover {
105
+ color: #c0c0c0;
82
106
  }
83
107
 
84
- .sidebar.close .profile-logo {
85
- display: none;
108
+ .dark .sidebar .arrow {
109
+ color: #ffffff;
110
+ opacity: 1;
111
+ margin-top: 20px;
86
112
  }
87
113
 
88
- /* ── Collapse arrow ── */
89
114
  .h-screen.flex .sidebar .arrow {
90
115
  margin-top: 20px;
91
116
  font-size: 20px;
92
117
  opacity: 0.5;
118
+ left: 0;
93
119
  margin-left: 10px;
94
120
  margin-right: 10px;
95
121
  transform: scaleX(-1);
96
- transition: transform 0.3s ease-in-out;
122
+ transition: backdrop-filter 0.3s ease-in-out, transform 0.3s ease-in-out;
97
123
  }
98
124
 
99
- .h-screen.flex .sidebar.close .arrow {
125
+ .h-screen.flex .sidebar.close .arrow{
100
126
  margin-left: 15px;
127
+ left: 0;
101
128
  transform: scaleX(1);
102
129
  }
103
130
 
104
- .sidebar .arrow:hover {
105
- color: #555555;
106
- cursor: pointer;
131
+ .sidebar .logo_name {
132
+ font-size: 10px;
133
+ opacity: 0.5;
134
+ text-align: center;
135
+ display: block;
107
136
  }
108
137
 
109
- .dark .sidebar .arrow {
110
- color: #ffffff;
111
- opacity: 1;
112
- margin-top: 20px;
138
+ .sidebar.close .logo_name {
139
+ display: none;
113
140
  }
114
141
 
115
- .dark .sidebar .arrow:hover {
116
- color: #c0c0c0;
142
+ .dark .h-screen.flex .sidebar {
143
+ @apply bg-gray-800;
117
144
  }
118
145
 
119
- .h-screen.flex .sidebar.close .icon-link {
120
- margin-top: 0;
121
- transition: 0.3s ease;
122
- transition-delay: 0.1s;
146
+ .dark .sidebar .logo_name {
147
+ color: #edecec;
123
148
  }
124
149
 
125
- .sidebar.close .sts-sidebar-menu-item {
126
- margin-left: 2px;
127
- }