katalyst-koi 4.18.1 → 5.0.0.alpha.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.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/koi/icons/add.svg +3 -0
  3. data/app/assets/images/koi/icons/close.svg +1 -0
  4. data/app/assets/images/koi/koi.png +0 -0
  5. data/app/assets/javascripts/koi/controllers/file_field_controller.js +2 -2
  6. data/app/assets/javascripts/koi/controllers/index.js +0 -3
  7. data/app/assets/javascripts/koi/controllers/koi/modal_controller.js +40 -0
  8. data/app/assets/javascripts/koi/controllers/navigation_controller.js +14 -21
  9. data/app/assets/javascripts/koi/controllers/webauthn_registration_controller.js +4 -1
  10. data/app/assets/stylesheets/koi/blocks/actions.css +8 -0
  11. data/app/assets/stylesheets/koi/blocks/application-header.css +15 -0
  12. data/app/assets/stylesheets/koi/blocks/application-navigation.css +54 -0
  13. data/app/assets/stylesheets/koi/blocks/button.css +90 -0
  14. data/app/assets/stylesheets/koi/blocks/flash.css +19 -0
  15. data/app/assets/stylesheets/koi/blocks/icon.css +15 -0
  16. data/app/assets/stylesheets/koi/blocks/index.css +13 -0
  17. data/app/assets/stylesheets/koi/blocks/modal.css +26 -0
  18. data/app/assets/stylesheets/koi/blocks/navigation.css +23 -0
  19. data/app/assets/stylesheets/koi/blocks/page-header.css +31 -0
  20. data/app/assets/stylesheets/koi/blocks/pagy.css +82 -0
  21. data/app/assets/stylesheets/koi/blocks/prose.css +37 -0
  22. data/app/assets/stylesheets/koi/blocks/tables/index.css +4 -0
  23. data/app/assets/stylesheets/koi/{components/_query.scss → blocks/tables/query.css} +13 -13
  24. data/app/assets/stylesheets/koi/{base/_tables.scss → blocks/tables/table.css} +12 -60
  25. data/app/assets/stylesheets/koi/compositions/cover.css +17 -0
  26. data/app/assets/stylesheets/koi/{base/_flow.scss → compositions/flow.css} +1 -1
  27. data/app/assets/stylesheets/koi/compositions/index.css +4 -0
  28. data/app/assets/stylesheets/koi/compositions/wrapper.css +11 -0
  29. data/app/assets/stylesheets/koi/forms/caption.css +22 -0
  30. data/app/assets/stylesheets/koi/forms/checkboxes.css +153 -0
  31. data/app/assets/stylesheets/koi/forms/date-input.css +12 -0
  32. data/app/assets/stylesheets/koi/{components/_document-field.scss → forms/document-field.css} +20 -15
  33. data/app/assets/stylesheets/koi/forms/errors.css +38 -0
  34. data/app/assets/stylesheets/koi/forms/fieldset.css +73 -0
  35. data/app/assets/stylesheets/koi/forms/file-upload.css +20 -0
  36. data/app/assets/stylesheets/koi/forms/form-group.css +19 -0
  37. data/app/assets/stylesheets/koi/forms/hint.css +11 -0
  38. data/app/assets/stylesheets/koi/forms/image-field.css +96 -0
  39. data/app/assets/stylesheets/koi/forms/index.css +44 -0
  40. data/app/assets/stylesheets/koi/forms/input.css +194 -0
  41. data/app/assets/stylesheets/koi/forms/label.css +43 -0
  42. data/app/assets/stylesheets/koi/forms/password.css +18 -0
  43. data/app/assets/stylesheets/koi/forms/radios.css +162 -0
  44. data/app/assets/stylesheets/koi/forms/select.css +18 -0
  45. data/app/assets/stylesheets/koi/forms/textarea.css +3 -0
  46. data/app/assets/stylesheets/koi/forms/trix.css +33 -0
  47. data/app/assets/stylesheets/koi/global/fonts.css +22 -0
  48. data/app/assets/stylesheets/koi/global/global-styles.css +297 -0
  49. data/app/assets/stylesheets/koi/global/reset.css +98 -0
  50. data/app/assets/stylesheets/koi/global/variables.css +97 -0
  51. data/app/assets/stylesheets/koi/icons.css +14 -0
  52. data/app/assets/stylesheets/koi/index.css +17 -0
  53. data/app/assets/stylesheets/koi/login.css +26 -0
  54. data/app/assets/stylesheets/koi/utilities/index.css +1 -0
  55. data/app/assets/stylesheets/koi/utilities/visually-hidden.css +18 -0
  56. data/app/components/concerns/koi/tables/cells.rb +3 -3
  57. data/app/components/koi/header_component.html.erb +12 -11
  58. data/app/components/koi/header_component.rb +2 -0
  59. data/app/components/koi/table_component.rb +8 -0
  60. data/app/controllers/admin/admin_users_controller.rb +24 -18
  61. data/app/controllers/admin/application_controller.rb +1 -3
  62. data/app/controllers/admin/credentials_controller.rb +18 -14
  63. data/app/controllers/admin/otps_controller.rb +15 -13
  64. data/app/controllers/admin/sessions_controller.rb +12 -1
  65. data/app/controllers/admin/url_rewrites_controller.rb +19 -17
  66. data/app/controllers/admin/well_knowns_controller.rb +20 -18
  67. data/app/controllers/concerns/koi/controller.rb +37 -0
  68. data/app/helpers/koi/form_helper.rb +18 -0
  69. data/app/helpers/koi/header_helper.rb +122 -0
  70. data/app/helpers/koi/index_actions_helper.rb +3 -2
  71. data/app/helpers/koi/modal_helper.rb +71 -0
  72. data/app/models/admin/user.rb +7 -1
  73. data/app/models/url_rewrite.rb +1 -9
  74. data/app/views/admin/admin_users/_form.html+self.erb +8 -0
  75. data/app/views/admin/admin_users/_form.html.erb +8 -0
  76. data/app/views/admin/admin_users/archived.html.erb +7 -4
  77. data/app/views/admin/admin_users/edit.html+self.erb +12 -0
  78. data/app/views/admin/admin_users/edit.html.erb +13 -8
  79. data/app/views/admin/admin_users/index.html.erb +10 -5
  80. data/app/views/admin/admin_users/new.html.erb +8 -8
  81. data/app/views/admin/admin_users/show.html+self.erb +26 -14
  82. data/app/views/admin/admin_users/show.html.erb +22 -20
  83. data/app/views/admin/credentials/_credentials.html+self.erb +8 -6
  84. data/app/views/admin/credentials/_credentials.html.erb +3 -1
  85. data/app/views/admin/credentials/create.turbo_stream.erb +4 -3
  86. data/app/views/admin/credentials/destroy.turbo_stream.erb +4 -2
  87. data/app/views/admin/credentials/new.html.erb +42 -36
  88. data/app/views/admin/dashboards/show.html.erb +13 -1
  89. data/app/views/admin/otps/_form.html.erb +7 -7
  90. data/app/views/admin/otps/create.turbo_stream.erb +3 -3
  91. data/app/views/admin/otps/new.html.erb +5 -3
  92. data/app/views/admin/sessions/new.html.erb +2 -3
  93. data/app/views/admin/sessions/otp.html.erb +1 -3
  94. data/app/views/admin/sessions/password.html.erb +1 -3
  95. data/app/views/admin/tokens/show.html.erb +4 -6
  96. data/app/views/admin/url_rewrites/_form.html.erb +9 -0
  97. data/app/views/admin/url_rewrites/edit.html.erb +13 -9
  98. data/app/views/admin/url_rewrites/index.html.erb +10 -7
  99. data/app/views/admin/url_rewrites/new.html.erb +8 -8
  100. data/app/views/admin/url_rewrites/show.html.erb +17 -12
  101. data/app/views/admin/well_knowns/_form.html.erb +9 -0
  102. data/app/views/admin/well_knowns/edit.html.erb +13 -9
  103. data/app/views/admin/well_knowns/index.html.erb +8 -5
  104. data/app/views/admin/well_knowns/new.html.erb +8 -8
  105. data/app/views/admin/well_knowns/show.html.erb +14 -13
  106. data/app/views/katalyst/content/asides/_aside.html+form.erb +6 -4
  107. data/app/views/katalyst/content/columns/_column.html+form.erb +5 -3
  108. data/app/views/katalyst/content/contents/_content.html+form.erb +8 -6
  109. data/app/views/katalyst/content/figures/_figure.html+form.erb +8 -5
  110. data/app/views/katalyst/content/groups/_group.html+form.erb +5 -3
  111. data/app/views/katalyst/content/items/_item.html+form.erb +5 -3
  112. data/app/views/katalyst/content/sections/_section.html+form.erb +5 -3
  113. data/app/views/katalyst/content/tables/_table.html+form.erb +16 -11
  114. data/app/views/katalyst/navigation/items/_button.html.erb +6 -12
  115. data/app/views/katalyst/navigation/items/_heading.html.erb +3 -10
  116. data/app/views/katalyst/navigation/items/_link.html.erb +6 -11
  117. data/app/views/katalyst/navigation/menus/edit.html.erb +10 -6
  118. data/app/views/katalyst/navigation/menus/index.html.erb +4 -2
  119. data/app/views/katalyst/navigation/menus/new.html.erb +5 -3
  120. data/app/views/katalyst/navigation/menus/show.html.erb +8 -7
  121. data/app/views/layouts/koi/_application_header.html.erb +20 -0
  122. data/app/views/layouts/koi/_application_navigation.html.erb +34 -0
  123. data/app/views/layouts/koi/_flash.html.erb +6 -3
  124. data/app/views/layouts/koi/_navigation_header.html.erb +0 -2
  125. data/app/views/layouts/koi/application.html.erb +22 -27
  126. data/app/views/layouts/koi/frame.html.erb +1 -3
  127. data/app/views/layouts/koi/login.html.erb +12 -5
  128. data/config/locales/koi.en.yml +9 -1
  129. data/config/routes.rb +1 -1
  130. data/lib/generators/koi/admin/admin_generator.rb +3 -13
  131. data/lib/generators/koi/admin_controller/admin_controller_generator.rb +6 -16
  132. data/lib/generators/koi/admin_controller/templates/controller.rb.tt +82 -18
  133. data/lib/generators/koi/admin_controller/templates/controller_spec.rb.tt +113 -47
  134. data/lib/generators/koi/admin_route/admin_route_generator.rb +60 -6
  135. data/lib/generators/koi/admin_views/USAGE +18 -7
  136. data/lib/generators/koi/admin_views/admin_views_generator.rb +19 -11
  137. data/lib/generators/koi/admin_views/templates/_form.html.erb.tt +8 -0
  138. data/lib/generators/koi/admin_views/templates/archived.html.erb.tt +33 -0
  139. data/lib/generators/koi/admin_views/templates/edit.html.erb.tt +17 -9
  140. data/lib/generators/koi/admin_views/templates/index.html.erb.tt +31 -3
  141. data/lib/generators/koi/admin_views/templates/new.html.erb.tt +8 -8
  142. data/lib/generators/koi/admin_views/templates/show.html.erb.tt +15 -18
  143. data/lib/generators/koi/helpers/attribute_helpers.rb +147 -0
  144. data/lib/generators/koi/helpers/attribute_types.rb +218 -0
  145. data/lib/generators/koi/helpers/resource_helpers.rb +121 -0
  146. data/lib/generators/koi/{active_record/active_record_generator.rb → model/model_generator.rb} +1 -1
  147. data/lib/koi/config.rb +3 -1
  148. data/lib/koi/engine.rb +0 -9
  149. data/lib/koi/form/builder.rb +4 -4
  150. data/lib/koi/form/content.rb +55 -0
  151. data/lib/koi/form/elements/document.rb +1 -1
  152. data/lib/koi/form/elements/image.rb +1 -1
  153. data/lib/koi/form_builder.rb +1 -0
  154. data/lib/koi/menu.rb +14 -1
  155. data/spec/factories/admins.rb +1 -1
  156. metadata +90 -103
  157. data/app/assets/builds/koi/admin.css +0 -1
  158. data/app/assets/stylesheets/koi/admin.scss +0 -27
  159. data/app/assets/stylesheets/koi/base/_button.scss +0 -122
  160. data/app/assets/stylesheets/koi/base/_icon.scss +0 -29
  161. data/app/assets/stylesheets/koi/base/_index.scss +0 -21
  162. data/app/assets/stylesheets/koi/base/_input.scss +0 -19
  163. data/app/assets/stylesheets/koi/base/_link.scss +0 -26
  164. data/app/assets/stylesheets/koi/base/_list.scss +0 -11
  165. data/app/assets/stylesheets/koi/base/_typography.scss +0 -160
  166. data/app/assets/stylesheets/koi/components/_actions-group.scss +0 -7
  167. data/app/assets/stylesheets/koi/components/_image-field.scss +0 -95
  168. data/app/assets/stylesheets/koi/components/_index.scss +0 -9
  169. data/app/assets/stylesheets/koi/components/_pagy.scss +0 -29
  170. data/app/assets/stylesheets/koi/components/_summary-list.scss +0 -40
  171. data/app/assets/stylesheets/koi/layouts/_banner.scss +0 -7
  172. data/app/assets/stylesheets/koi/layouts/_content.scss +0 -40
  173. data/app/assets/stylesheets/koi/layouts/_flash.scss +0 -41
  174. data/app/assets/stylesheets/koi/layouts/_header.scss +0 -61
  175. data/app/assets/stylesheets/koi/layouts/_index.scss +0 -48
  176. data/app/assets/stylesheets/koi/layouts/_main.scss +0 -23
  177. data/app/assets/stylesheets/koi/layouts/_navigation.scss +0 -180
  178. data/app/assets/stylesheets/koi/layouts/_stack.scss +0 -13
  179. data/app/assets/stylesheets/koi/pages/_index.scss +0 -1
  180. data/app/assets/stylesheets/koi/pages/_login.scss +0 -46
  181. data/app/assets/stylesheets/koi/themes/_content.scss +0 -62
  182. data/app/assets/stylesheets/koi/themes/_govuk.scss +0 -56
  183. data/app/assets/stylesheets/koi/themes/_index.scss +0 -5
  184. data/app/assets/stylesheets/koi/themes/_kpop.scss +0 -5
  185. data/app/assets/stylesheets/koi/themes/_navigation.scss +0 -5
  186. data/app/assets/stylesheets/koi/themes/_trix.scss +0 -32
  187. data/app/assets/stylesheets/koi/utils/_breakpoints.scss +0 -13
  188. data/app/assets/stylesheets/koi/utils/_hide.scss +0 -11
  189. data/app/assets/stylesheets/koi/utils/_index.scss +0 -2
  190. data/app/assets/stylesheets/koi/utils/_typography.scss +0 -42
  191. data/app/components/koi/content/editor/item_form_component.html.erb +0 -11
  192. data/app/components/koi/content/editor/item_form_component.rb +0 -94
  193. data/app/components/koi/summary_list/attachment_component.rb +0 -47
  194. data/app/components/koi/summary_list/base.rb +0 -59
  195. data/app/components/koi/summary_list/boolean_component.rb +0 -15
  196. data/app/components/koi/summary_list/date_component.rb +0 -17
  197. data/app/components/koi/summary_list/datetime_component.rb +0 -17
  198. data/app/components/koi/summary_list/item_component.rb +0 -26
  199. data/app/components/koi/summary_list/number_component.rb +0 -21
  200. data/app/components/koi/summary_list/rich_text_component.rb +0 -8
  201. data/app/components/koi/summary_list/text_component.rb +0 -8
  202. data/app/components/koi/summary_list_component.html.erb +0 -5
  203. data/app/components/koi/summary_list_component.rb +0 -75
  204. data/app/controllers/concerns/koi/controller/is_admin_controller.rb +0 -66
  205. data/app/helpers/koi/application_helper.rb +0 -7
  206. data/app/helpers/koi/date_helper.rb +0 -26
  207. data/app/helpers/koi/definition_list_helper.rb +0 -10
  208. data/app/views/admin/admin_users/_fields.html+self.erb +0 -3
  209. data/app/views/admin/admin_users/_fields.html.erb +0 -3
  210. data/app/views/admin/url_rewrites/_fields.html.erb +0 -4
  211. data/app/views/admin/well_knowns/_fields.html.erb +0 -6
  212. data/app/views/layouts/koi/_environment.html.erb +0 -4
  213. data/app/views/layouts/koi/_header.html.erb +0 -11
  214. data/app/views/layouts/koi/_navigation.html.erb +0 -23
  215. data/app/views/layouts/koi/_navigation_collapse.html.erb +0 -3
  216. data/lib/generators/koi/admin_views/templates/_fields.html.erb.tt +0 -3
  217. data/lib/generators/koi/helpers/admin_generator_attributes.rb +0 -66
  218. data/lib/koi/extensions/dartsass.rb +0 -23
  219. /data/app/assets/stylesheets/koi/{components/_clipboard.scss → blocks/clipboard.css} +0 -0
  220. /data/app/assets/stylesheets/koi/{components/_index-actions.scss → blocks/index-actions.css} +0 -0
  221. /data/app/assets/stylesheets/koi/{components/_toolbar.scss → blocks/toolbar.css} +0 -0
  222. /data/app/assets/stylesheets/koi/{base/_repel.scss → compositions/repel.css} +0 -0
@@ -1,180 +0,0 @@
1
- $heading: rgba(255, 255, 255, 0.6);
2
- $separator: rgba(255, 255, 255, 0.2);
3
-
4
- %subheading {
5
- color: $heading;
6
- font-size: 0.8rem;
7
- font-weight: 400;
8
- margin: 0;
9
- }
10
-
11
- @mixin header {
12
- display: grid;
13
- grid-template-areas: "icon primary" "icon secondary";
14
- grid-template-rows: 1fr 1fr;
15
- grid-template-columns: 3rem 1fr;
16
- padding: 1rem;
17
-
18
- .site-name {
19
- grid-area: primary;
20
- padding-left: 1rem;
21
- font-size: 1.25rem;
22
- font-weight: unset;
23
- color: var(--site-primary);
24
- margin: 0;
25
- white-space: nowrap;
26
- overflow-x: hidden;
27
- text-overflow: ellipsis;
28
- }
29
-
30
- .admin-name {
31
- grid-area: secondary;
32
- color: white;
33
- padding-left: 1rem;
34
- @extend %subheading;
35
- opacity: 0.75;
36
- white-space: nowrap;
37
- overflow-x: hidden;
38
- text-overflow: ellipsis;
39
- }
40
-
41
- .site-icon {
42
- grid-area: icon;
43
- display: flex;
44
- background-color: var(--site-primary);
45
- color: var(--site-on-primary);
46
- width: 3rem;
47
- height: 3rem;
48
- align-items: center;
49
- justify-content: space-around;
50
- text-transform: capitalize;
51
- font-size: 2rem;
52
- border-radius: 0.25rem;
53
- }
54
- }
55
-
56
- %navigation {
57
- background: black;
58
- color: white;
59
- padding-bottom: 2rem;
60
- --site-link: white;
61
-
62
- > * {
63
- transition: opacity 0.25s;
64
- }
65
-
66
- &:not([aria-expanded]) {
67
- > * {
68
- opacity: 0;
69
- }
70
- }
71
-
72
- header {
73
- @include header;
74
- border-bottom: 1px solid $separator;
75
- }
76
-
77
- ul,
78
- li {
79
- padding: 0;
80
- list-style: none;
81
- font-size: var(--heading--h6);
82
- }
83
-
84
- .filter {
85
- margin: 1rem calc(1rem - 5px) 0;
86
- position: relative;
87
-
88
- input {
89
- width: 100%;
90
- border: none;
91
- border-radius: 1px;
92
- }
93
-
94
- // keyboard shortcut
95
- &::after {
96
- content: "G";
97
- position: absolute;
98
- display: block;
99
- top: 4px;
100
- bottom: 4px;
101
- right: 4px;
102
- width: auto;
103
- border-radius: 2px;
104
- border: 1px solid #aaa;
105
- color: #888;
106
- padding: 6px 0.3rem 0 0.3rem;
107
- font-size: 0.8rem;
108
- pointer-events: none;
109
- }
110
-
111
- &:has(input:focus),
112
- &:has(input:hover) {
113
- &::after {
114
- opacity: 0;
115
- }
116
- }
117
- }
118
-
119
- li > span {
120
- display: block;
121
- padding: 1.25rem 1rem 0.25rem;
122
- color: $heading;
123
- }
124
-
125
- > ul > li > span {
126
- border-top: 1px solid $separator;
127
- margin-top: 1rem;
128
- padding: 1.25rem 1rem 0.25rem;
129
- @extend %subheading;
130
- }
131
-
132
- li li li > a[href] {
133
- padding-left: 2.5rem;
134
- }
135
-
136
- li > a[href] {
137
- display: block;
138
- padding: 0.75rem 1rem;
139
- white-space: nowrap;
140
- overflow: hidden;
141
- text-overflow: ellipsis;
142
- }
143
-
144
- li > a[href]:hover,
145
- li > a[href]:focus {
146
- background: rgba(255, 255, 255, 0.2);
147
- text-decoration: none;
148
- }
149
- }
150
-
151
- .navigation-collapse {
152
- width: 2rem;
153
- border-radius: 50%;
154
- margin-top: 1rem;
155
- justify-self: right;
156
- align-self: start;
157
- background-color: white;
158
- box-shadow: 0px 1px 7px 2px rgba(0, 0, 0, 0.1);
159
- visibility: hidden;
160
- opacity: 0;
161
- transform: translateX(50%);
162
- transition:
163
- opacity 0.25s,
164
- background-color 0.25s;
165
- cursor: pointer;
166
-
167
- nav[aria-expanded] + & {
168
- transform: translateX(50%) rotate(180deg);
169
- }
170
-
171
- nav:hover + &,
172
- &:hover {
173
- visibility: visible;
174
- opacity: 1;
175
- }
176
-
177
- &:hover {
178
- background-color: var(--site-primary);
179
- }
180
- }
@@ -1,13 +0,0 @@
1
- .stack {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: flex-start;
5
- }
6
-
7
- .stack > * {
8
- margin-block: 0;
9
- }
10
-
11
- .stack > * + * {
12
- margin-block-start: var(--space, 1.5rem);
13
- }
@@ -1 +0,0 @@
1
- @use "login";
@@ -1,46 +0,0 @@
1
- @use "../layouts/navigation" as nav;
2
- @use "../layouts/flash";
3
-
4
- .admin-login {
5
- display: flex;
6
- flex-direction: row;
7
- align-items: center;
8
- justify-content: center;
9
- background: var(--site-primary);
10
- }
11
-
12
- .admin-login > main {
13
- flex: 1 1 auto;
14
- max-width: 24rem;
15
- background: white;
16
- border-radius: 0.25rem;
17
- height: unset;
18
- }
19
-
20
- .admin-login header {
21
- @include nav.header;
22
- width: 100%;
23
-
24
- .admin-name {
25
- color: #555;
26
- }
27
- }
28
-
29
- .admin-login form {
30
- padding: 0 1rem 1rem;
31
- }
32
-
33
- .admin-login .actions-group {
34
- display: flex;
35
- flex-direction: row;
36
- justify-content: stretch;
37
- }
38
-
39
- .admin-login .button--primary {
40
- flex: 1;
41
- }
42
-
43
- .admin-login .govuk-error-summary {
44
- padding: 15px;
45
- margin-bottom: 30px;
46
- }
@@ -1,62 +0,0 @@
1
- @use "katalyst/content/editor/variables" as variables;
2
- @use "katalyst/content";
3
-
4
- [data-controller="content--editor--container"] {
5
- --heading--h4: 1rem;
6
- }
7
-
8
- [data-controller="content--editor--table"] {
9
- .content--editor--table-editor {
10
- // ensure the table editor is easy to target when empty
11
- &:not(:has(table)) {
12
- min-height: 4rem !important;
13
- }
14
-
15
- // tight wrap the table editor around the table and use table borders
16
- &:has(table) {
17
- border: none !important;
18
- padding: 0 !important;
19
- }
20
-
21
- table {
22
- width: 100%;
23
- }
24
-
25
- table,
26
- th,
27
- td {
28
- border: 2px solid black;
29
- }
30
- }
31
-
32
- // restore webkit spinners, hidden by govuk
33
- // these are not ideal, but spinners are much easier to work with for this
34
- // use case than the default number input, because we submit the form on
35
- // change to implement the live preview
36
- input[type="number"]::-webkit-inner-spin-button {
37
- position: relative;
38
- right: -1px;
39
- margin-top: -2px;
40
- margin-bottom: -4px;
41
- -webkit-appearance: inner-spin-button !important;
42
- opacity: 1 !important;
43
- }
44
- }
45
-
46
- [data-enum="state"][data-value="published"] {
47
- --tag-background-color: #{variables.$status-published-background-color};
48
- --tag-color: #{variables.$status-published-color};
49
- border: 1px solid variables.$status-published-border-color;
50
- }
51
-
52
- [data-enum="state"][data-value="draft"] {
53
- --tag-background-color: #{variables.$status-draft-background-color};
54
- --tag-color: #{variables.$status-draft-color};
55
- border: 1px solid variables.$status-draft-border-color;
56
- }
57
-
58
- [data-enum="state"][data-value="unpublished"] {
59
- --tag-background-color: #{variables.$status-draft-background-color};
60
- --tag-color: #{variables.$status-draft-color};
61
- border: 1px solid variables.$status-draft-border-color;
62
- }
@@ -1,56 +0,0 @@
1
- @use "../utils/typography" as *;
2
-
3
- @use "katalyst/govuk/formbuilder" with (
4
- $govuk-font-family: "Inter",
5
- $govuk-text-colour: #{var(--site-text-color)},
6
- $govuk-typography-scale: (
7
- 80: govuk-definition(h1),
8
- 48: govuk-definition(h2),
9
- 36: govuk-definition(h3),
10
- 27: govuk-definition(h4),
11
- 24: govuk-definition(h5),
12
- 19: govuk-definition(h6),
13
- 16: govuk-definition(paragraph),
14
- 14: govuk-definition(small),
15
- ),
16
- $govuk-input-border-colour: #{var(--site-text-color)}
17
- );
18
-
19
- .govuk-input,
20
- .govuk-textarea {
21
- color: var(--site-text-color);
22
- }
23
-
24
- .govuk-hint {
25
- max-width: var(--text-width);
26
- }
27
-
28
- // in the context of Koi admin forms, hang the error border in the gutter
29
- // not a generally applicable style
30
- .govuk-form-group--error:not(.govuk-form-group .govuk-form-group--error) {
31
- position: relative;
32
- margin-left: -18px;
33
- padding-left: 13px;
34
- }
35
-
36
- // add some koi styling to the govuk show/hide password button
37
- [data-govuk-password-input-init] {
38
- max-width: var(--text-width);
39
-
40
- .govuk-password-input__wrapper {
41
- gap: 0.5rem;
42
- }
43
-
44
- .govuk-button {
45
- min-width: 4em;
46
- background: none;
47
- cursor: pointer;
48
- border: 2px solid var(--site-text-color);
49
- }
50
-
51
- .govuk-button:focus-visible,
52
- .govuk-button:hover {
53
- color: var(--site-primary);
54
- border-color: var(--site-primary);
55
- }
56
- }
@@ -1,5 +0,0 @@
1
- @use "content";
2
- @use "govuk";
3
- @use "kpop";
4
- @use "navigation";
5
- @use "trix";
@@ -1,5 +0,0 @@
1
- @use "katalyst/kpop";
2
-
3
- .kpop-content {
4
- padding: 1rem 1.5rem;
5
- }
@@ -1,5 +0,0 @@
1
- @use "katalyst/navigation/editor";
2
-
3
- [data-controller="navigation--editor--menu"] {
4
- --heading--h4: 1rem;
5
- }
@@ -1,32 +0,0 @@
1
- // navigation and content already load trix, ensure they are loaded first
2
- @use "content";
3
- @use "navigation";
4
-
5
- // overrides for default trix styles to match our button styles
6
- trix-toolbar {
7
- .trix-button-group {
8
- border: 1px solid var(--site-text-color);
9
- border-radius: 0;
10
- }
11
-
12
- .trix-button {
13
- color: var(--site-secondary);
14
- border-bottom: none;
15
- }
16
-
17
- .trix-button:not(:first-child) {
18
- border-left: 1px solid var(--site-text-color);
19
- }
20
-
21
- .trix-button.trix-active {
22
- background-color: var(--site-secondary-light);
23
- color: var(--site-on-secondary);
24
- border-bottom: none;
25
- }
26
- }
27
-
28
- // set a maximim width for the text editor and toolbar to match other inputs
29
- trix-toolbar,
30
- trix-editor {
31
- max-width: var(--text-width);
32
- }
@@ -1,13 +0,0 @@
1
- // At a 16px base font size this will be 640px (to match govuk)
2
- @mixin tablet-breakpoint {
3
- @media screen and (max-width: 40rem) {
4
- @content;
5
- }
6
- }
7
-
8
- // At a 16px base font size this will be 1120px
9
- @mixin laptop-breakpoint {
10
- @media screen and (max-width: 70rem) {
11
- @content;
12
- }
13
- }
@@ -1,11 +0,0 @@
1
- .hidden,
2
- [hidden],
3
- [data-hide] {
4
- display: none !important;
5
- }
6
-
7
- [data-collapsed] {
8
- max-height: 0;
9
- overflow: hidden;
10
- margin-bottom: 0 !important;
11
- }
@@ -1,2 +0,0 @@
1
- @use "breakpoints";
2
- @use "hide";
@@ -1,42 +0,0 @@
1
- @use "sass:map";
2
- @use "sass:math";
3
-
4
- $-font-sizes: () !default;
5
- $-line-heights: () !default;
6
-
7
- @function font-size($size, $breakpoint: null, $unit: rem) {
8
- $font-size: map.get($-font-sizes, $size);
9
-
10
- @if $unit == rem {
11
- @return $font-size;
12
- } @else if $unit == px {
13
- @return math.div($font-size, 1rem) * 16px;
14
- }
15
- }
16
-
17
- @function line-height($size, $breakpoint: null, $unit: em) {
18
- $line-height: map.get($-line-heights, $size);
19
-
20
- @if $unit == em {
21
- @return $line-height;
22
- } @else if $unit == px {
23
- @return math.div($line-height, 1em) * 16px;
24
- }
25
- }
26
-
27
- @function govuk-definition($size) {
28
- @return (
29
- null: (
30
- font-size: font-size($size, mobile, px),
31
- line-height: line-height($size, mobile, px),
32
- ),
33
- tablet: (
34
- font-size: font-size($size, tablet, px),
35
- line-height: line-height($size, tablet, px),
36
- ),
37
- print: (
38
- font-size: font-size($size, print, px),
39
- line-height: line-height($size, print, px),
40
- )
41
- );
42
- }
@@ -1,11 +0,0 @@
1
- <%= form_with model:, scope: :item, url:, builder:, **html_attributes do |form| %>
2
- <%= form.hidden_field :container_type %>
3
- <%= form.hidden_field :container_id %>
4
- <%= form.hidden_field :type %>
5
-
6
- <%= content %>
7
-
8
- <%= form.content_background_field %>
9
- <%= form.content_visible_field %>
10
- <%= form.content_buttons %>
11
- <% end %>
@@ -1,94 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Koi
4
- module Content
5
- module Editor
6
- class ItemFormComponent < ViewComponent::Base
7
- include Katalyst::HtmlAttributes
8
-
9
- attr_reader :model, :url, :builder, :form
10
-
11
- def initialize(model:, url:, builder: Koi::FormBuilder, **)
12
- super(**)
13
-
14
- @model = model
15
- @url = url
16
- @builder = builder
17
- end
18
-
19
- def form_with(**options, &block)
20
- view_context.form_with(**options) do |form|
21
- @form = form
22
- form.extend(ContentFormHelper)
23
- capture(form, &block)
24
- end
25
- end
26
-
27
- def content
28
- @__vc_content_evaluated = true
29
- return @__vc_content if defined?(@__vc_content)
30
-
31
- @__vc_content = view_context.capture(@form, &@__vc_render_in_block)
32
- end
33
-
34
- def inspect
35
- "#<#{self.class.name} model: #{model.inspect} url: #{url.inspect}>"
36
- end
37
-
38
- module ContentFormHelper
39
- def content_heading_fieldset
40
- govuk_fieldset(legend: { text: "Heading", size: "m" }) do
41
- concat(content_heading_field(label: nil))
42
- concat(content_heading_style_field)
43
- end
44
- end
45
-
46
- def content_heading_field(args = {})
47
- govuk_text_field :heading,
48
- **{ label: { text: "Heading", size: "s" } }.deep_merge(args)
49
- end
50
-
51
- def content_heading_style_field(args = {})
52
- govuk_collection_radio_buttons :heading_style,
53
- Katalyst::Content.config.heading_styles,
54
- :itself,
55
- :itself,
56
- **{ small: true, legend: { text: "Style", size: "s" } }.deep_merge(args)
57
- end
58
-
59
- def content_url_field(args = {})
60
- govuk_text_field :url,
61
- **{ label: { text: "URL", size: "s" } }.deep_merge(args)
62
- end
63
-
64
- def content_http_method_field(methods, args = {})
65
- govuk_select :http_method, methods,
66
- **{ label: { text: "HTTP method", size: "s" } }.deep_merge(args)
67
- end
68
-
69
- def content_target_field(targets, args = {})
70
- govuk_select :target, targets,
71
- **{ label: { text: "HTTP target", size: "s" } }.deep_merge(args)
72
- end
73
-
74
- def content_background_field(args = {})
75
- govuk_select :background, Katalyst::Content.config.backgrounds,
76
- **{ label: { size: "s" } }.deep_merge(args)
77
- end
78
-
79
- def content_visible_field(args = {})
80
- govuk_check_box_field :visible,
81
- **{ label: { text: "Visible? ", size: "s" }, small: true }.deep_merge(args)
82
- end
83
-
84
- def content_buttons
85
- tag.div(class: "actions") do
86
- concat(admin_save("Done"))
87
- concat(admin_discard(data: { action: "click->kpop--frame#dismiss:prevent" }))
88
- end
89
- end
90
- end
91
- end
92
- end
93
- end
94
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Koi
4
- module SummaryList
5
- class AttachmentComponent < Base
6
- def initialize(model, attribute, variant: :thumb, **attributes)
7
- super(model, attribute, **attributes)
8
-
9
- @variant = variant
10
- end
11
-
12
- def attribute_value
13
- representation
14
- end
15
-
16
- def representation
17
- if raw_value.try(:variable?) && named_variant.present?
18
- image_tag(raw_value.variant(@variant))
19
- elsif raw_value.try(:attached?)
20
- filename.to_s
21
- else
22
- ""
23
- end
24
- end
25
-
26
- def filename
27
- raw_value.blob.filename
28
- end
29
-
30
- # Utility for accessing the path Rails provides for retrieving the
31
- # attachment for use in cells. Example:
32
- # <% row.attachment :file do |cell| %>
33
- # <%= link_to "Download", cell.internal_path %>
34
- # <% end %>
35
- def internal_path
36
- rails_blob_path(raw_value, disposition: :attachment)
37
- end
38
-
39
- private
40
-
41
- # Find the reflective variant by name (i.e. :thumb by default)
42
- def named_variant
43
- @model.attachment_reflections[@attribute.to_s].named_variants[@variant.to_sym]
44
- end
45
- end
46
- end
47
- end
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Koi
4
- module SummaryList
5
- class Base < ViewComponent::Base
6
- include Katalyst::HtmlAttributes
7
-
8
- define_html_attribute_methods :term_attributes, default: {}
9
- define_html_attribute_methods :description_attributes, default: {}
10
-
11
- def initialize(model, attribute, label: nil, skip_blank: true)
12
- super()
13
-
14
- @model = model
15
- @attribute = attribute
16
- @label = label
17
- @skip_blank = skip_blank
18
- end
19
-
20
- def call
21
- tag.dt(attribute_name, **term_attributes) +
22
- tag.dd(content_or_value, **description_attributes)
23
- end
24
-
25
- def render?
26
- raw_value.present? || !@skip_blank
27
- end
28
-
29
- def attribute_name
30
- @label&.dig(:text) || @model.class.human_attribute_name(@attribute)
31
- end
32
-
33
- def attribute_value
34
- raw_value.to_s
35
- end
36
-
37
- def raw_value
38
- @model.public_send(@attribute)
39
- end
40
-
41
- def inspect
42
- "#<#{self.class.name} #{@attribute.inspect}>"
43
- end
44
-
45
- # Convenience method for rendering the content of the cell
46
- # <% dl.text(:name) { |cell| tag.em(cell) } %>
47
- # => <dt>Name</dt><dd><em>Jamie Banks</em></dd>
48
- def to_s
49
- attribute_value
50
- end
51
-
52
- private
53
-
54
- def content_or_value
55
- content? ? content : attribute_value
56
- end
57
- end
58
- end
59
- end