design_system 0.13.2 → 0.14.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 +4 -4
- data/README.md +34 -1
- data/app/helpers/design_system_helper.rb +2 -2
- data/lib/design_system/generic/builders/notification.rb +22 -9
- data/lib/design_system/version.rb +1 -1
- metadata +2 -2
- /data/public/design_system/static/{design_system-0.13.2 → design_system-0.14.0}/design_system.js +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e985fe0cfcfbfc619222a57c2501acff5e4172e0eb8b3767069c0f1f66f8541d
|
|
4
|
+
data.tar.gz: 72436a314d93ae0f3f35089969cb0e2a1524c156373dedbd059112e11340a1be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9eeff12697761fdf1542041c31b4b85acdfc29bd01682da6cb06a3a711482ed532271837328faf7ee2f2cd552349a73d481e7a6f5717a2207d267584e6ddc14
|
|
7
|
+
data.tar.gz: 7c19fed7bbfee92c6e585615bfb8d956d1ac8ff38c2938b32d634dac0125084a3756b43d5cc81c143491c5eeae62f7320705bfab6d283ae88fb791099315691b
|
data/README.md
CHANGED
|
@@ -80,7 +80,40 @@ bundle exec rake js:build
|
|
|
80
80
|
|
|
81
81
|
## Contributing
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
### Setting up
|
|
84
|
+
|
|
85
|
+
This project uses [mise](https://mise.jdx.dev/) to manage Ruby. With mise installed, run `mise install` from the project root to install the Ruby version pinned in `.ruby-version`. Then install the gems:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
bundle install
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
To run the dummy app or the accessibility workflows locally, also install the dummy app's Node packages:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
cd test/dummy && npm install
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Running the tests
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
bin/rails test
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The suite runs against the dummy app at `test/dummy`. On a fresh checkout the test helper compiles Dart Sass automatically on the first run; subsequent runs are fast.
|
|
104
|
+
|
|
105
|
+
### Running the dummy app
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cd test/dummy
|
|
109
|
+
bin/dev
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This starts the Rails server alongside `dartsass:watch`, so styles rebuild as you edit.
|
|
113
|
+
|
|
114
|
+
### CI
|
|
115
|
+
|
|
116
|
+
`bin/rails test` runs on every push and pull request via the `Test` workflow. Accessibility (`wcag2aa`, `wcag2aaa`) and inclusive-language checks run separately.
|
|
84
117
|
|
|
85
118
|
Created using:
|
|
86
119
|
|
|
@@ -78,8 +78,8 @@ module DesignSystemHelper
|
|
|
78
78
|
DesignSystem::Registry.builder(brand, 'notification', self).render_alert(message, &)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
def ds_notice(message = nil,
|
|
82
|
-
DesignSystem::Registry.builder(brand, 'notification', self).render_notice(message,
|
|
81
|
+
def ds_notice(message = nil, type: :information, content_heading: { text: nil, tag: :h3 }, &)
|
|
82
|
+
DesignSystem::Registry.builder(brand, 'notification', self).render_notice(message, type:, content_heading:, &)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def ds_heading(text, level: 2, **options)
|
|
@@ -5,6 +5,7 @@ module DesignSystem
|
|
|
5
5
|
module Builders
|
|
6
6
|
# This class provides generic methods to display notifications.
|
|
7
7
|
class Notification < Base
|
|
8
|
+
include ActionView::Helpers::OutputSafetyHelper
|
|
8
9
|
include ActionView::Helpers::SanitizeHelper
|
|
9
10
|
|
|
10
11
|
def render_alert(msg = nil, &)
|
|
@@ -16,19 +17,22 @@ module DesignSystem
|
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
|
|
19
|
-
def render_notice(msg = nil,
|
|
20
|
+
def render_notice(msg = nil, type: :information, content_heading: { text: nil, tag: :h3 }, &)
|
|
20
21
|
@context.instance_variable_set(:@link_context, :notification_banner)
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
unless notification_type_hash.key?(type)
|
|
24
|
+
raise ArgumentError,
|
|
25
|
+
"Invalid notification type: #{type}. Must be one of: #{notification_type_hash.keys.join(', ')}"
|
|
26
|
+
end
|
|
24
27
|
|
|
25
|
-
header
|
|
28
|
+
header = notification_type_hash.dig(type, :header)
|
|
29
|
+
|
|
30
|
+
content_body = block_given? ? capture(&) : msg
|
|
26
31
|
|
|
27
|
-
content_to_display = block_given? ? capture(&) : msg
|
|
28
32
|
content_tag(:div, class: notification_type_hash.dig(type, :class), role: notification_type_hash.dig(type, :role),
|
|
29
33
|
'aria-labelledby': "#{brand}-notification-banner-title",
|
|
30
34
|
'data-module': "#{brand}-notification-banner") do
|
|
31
|
-
banner_tile(header) + banner_content(
|
|
35
|
+
banner_tile(header) + banner_content(content_body, content_heading:)
|
|
32
36
|
end
|
|
33
37
|
end
|
|
34
38
|
|
|
@@ -41,10 +45,19 @@ module DesignSystem
|
|
|
41
45
|
end
|
|
42
46
|
end
|
|
43
47
|
|
|
44
|
-
def banner_content(
|
|
48
|
+
def banner_content(content_body, content_heading: {})
|
|
45
49
|
content_tag(:div, class: "#{brand}-notification-banner__content") do
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
content = []
|
|
51
|
+
|
|
52
|
+
if content_heading.present? && content_heading[:text].present?
|
|
53
|
+
tag = content_heading[:tag] || :h3
|
|
54
|
+
raise ArgumentError, "Invalid content_heading tag: #{tag}.}" unless tag.in?(%i[h3 p])
|
|
55
|
+
|
|
56
|
+
content << content_tag(tag, content_heading[:text], class: "#{brand}-notification-banner__heading")
|
|
57
|
+
end
|
|
58
|
+
content << content_body if content_body.present?
|
|
59
|
+
|
|
60
|
+
safe_join(content)
|
|
48
61
|
end
|
|
49
62
|
end
|
|
50
63
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: design_system
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Filis Liu
|
|
@@ -479,7 +479,7 @@ files:
|
|
|
479
479
|
- lib/tasks/design_system_tasks.rake
|
|
480
480
|
- lib/tasks/govuk.rake
|
|
481
481
|
- lib/tasks/nhsuk.rake
|
|
482
|
-
- public/design_system/static/design_system-0.
|
|
482
|
+
- public/design_system/static/design_system-0.14.0/design_system.js
|
|
483
483
|
- public/design_system/static/govuk-frontend-5.11.1/fonts/bold-affa96571d-v2.woff
|
|
484
484
|
- public/design_system/static/govuk-frontend-5.11.1/fonts/bold-b542beb274-v2.woff2
|
|
485
485
|
- public/design_system/static/govuk-frontend-5.11.1/fonts/light-94a07e06a1-v2.woff2
|
/data/public/design_system/static/{design_system-0.13.2 → design_system-0.14.0}/design_system.js
RENAMED
|
File without changes
|