playbook_ui_docs 16.7.0 → 16.8.0.pre.alpha.PLAY2935formbuilderrequiredindicatorbug16780

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +6 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.jsx +57 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.md +66 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.html.erb +62 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.md +7 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +12 -4
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +4 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +16 -2
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +4 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.jsx +68 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.md +7 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +16 -2
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +12 -5
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +4 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +5 -3
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +180 -5839
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +5 -30
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_column_definitions_styling.json +4 -1
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
  23. data/app/pb_kits/playbook/pb_date/docs/_playground.json +13 -17
  24. data/app/pb_kits/playbook/pb_date/docs/_playground.overrides.json +13 -16
  25. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dialog_submission.jsx +2 -2
  26. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -2
  27. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -2
  28. data/app/pb_kits/playbook/pb_date_picker/docs/_playground.json +136 -42
  29. data/app/pb_kits/playbook/pb_date_picker/docs/_playground.overrides.json +113 -45
  30. data/app/pb_kits/playbook/pb_date_range_inline/docs/_playground.json +48 -6
  31. data/app/pb_kits/playbook/pb_date_range_inline/docs/_playground.overrides.json +57 -0
  32. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_playground.json +28 -5
  33. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_playground.overrides.json +38 -0
  34. data/app/pb_kits/playbook/pb_date_stacked/docs/_playground.json +1 -1
  35. data/app/pb_kits/playbook/pb_date_stacked/docs/_playground.overrides.json +1 -1
  36. data/app/pb_kits/playbook/pb_date_time/docs/_playground.json +16 -3
  37. data/app/pb_kits/playbook/pb_date_time/docs/_playground.overrides.json +16 -3
  38. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_playground.json +11 -15
  39. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_playground.overrides.json +11 -15
  40. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_playground.json +4 -4
  41. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_playground.overrides.json +4 -4
  42. data/app/pb_kits/playbook/pb_detail/docs/_playground.json +12 -18
  43. data/app/pb_kits/playbook/pb_detail/docs/_playground.overrides.json +13 -12
  44. data/app/pb_kits/playbook/pb_dialog/docs/_playground.json +108 -42
  45. data/app/pb_kits/playbook/pb_dialog/docs/_playground.overrides.json +88 -40
  46. data/app/pb_kits/playbook/pb_distribution_bar/docs/_playground.json +65 -7
  47. data/app/pb_kits/playbook/pb_distribution_bar/docs/_playground.overrides.json +45 -0
  48. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +2 -0
  49. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_react.md +1 -0
  50. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +2 -0
  51. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_react.md +3 -1
  52. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +3 -1
  53. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_react.md +3 -1
  54. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +318 -21
  55. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +192 -19
  56. data/app/pb_kits/playbook/pb_empty_state/docs/_playground.json +77 -12
  57. data/app/pb_kits/playbook/pb_empty_state/docs/_playground.overrides.json +79 -0
  58. data/app/pb_kits/playbook/pb_file_upload/docs/_playground.json +98 -13
  59. data/app/pb_kits/playbook/pb_file_upload/docs/_playground.overrides.json +99 -0
  60. data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +20 -19
  61. data/app/pb_kits/playbook/pb_icon/docs/example.yml +0 -2
  62. data/app/pb_kits/playbook/pb_icon/docs/index.js +0 -1
  63. data/app/pb_kits/playbook/pb_link/docs/_playground.json +81 -40
  64. data/app/pb_kits/playbook/pb_link/docs/_playground.overrides.json +88 -30
  65. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.html.erb +90 -0
  66. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.jsx +100 -0
  67. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.md +1 -0
  68. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
  69. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +2 -0
  70. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +2 -1
  71. data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +4 -2
  72. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_default.html.erb +1 -0
  73. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_default.md +12 -0
  74. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_simple.html.erb +9 -0
  75. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_simple.md +8 -0
  76. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -0
  77. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb +85 -83
  78. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx +88 -86
  79. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +3 -1
  80. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +1 -1
  81. data/app/pb_kits/playbook/pb_title/docs/_playground.json +72 -23
  82. data/app/pb_kits/playbook/pb_title/docs/_playground.overrides.json +80 -16
  83. metadata +21 -6
  84. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.html.erb +0 -1
  85. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.jsx +0 -21
  86. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.md +0 -7
@@ -0,0 +1,99 @@
1
+ {
2
+ "defaults": {
3
+ "accept": {},
4
+ "dark": false
5
+ },
6
+ "hiddenProps": [
7
+ "fileRejections",
8
+ "getInputProps",
9
+ "getRootProps",
10
+ "isDragActive",
11
+ "onFilesAccepted",
12
+ "onFilesRejected"
13
+ ],
14
+ "groups": [
15
+ {
16
+ "name": "Guidance",
17
+ "props": ["customMessage", "accept", "acceptedFilesDescription", "maxSize"]
18
+ },
19
+ {
20
+ "name": "State",
21
+ "props": ["error", "dark"]
22
+ }
23
+ ],
24
+ "presets": [
25
+ {
26
+ "name": "Default",
27
+ "props": {}
28
+ },
29
+ {
30
+ "name": "Accepted Types",
31
+ "props": {
32
+ "accept": {
33
+ "image/svg+xml": [".svg", ".xml"]
34
+ }
35
+ }
36
+ },
37
+ {
38
+ "name": "Custom Description",
39
+ "props": {
40
+ "accept": {
41
+ "application/pdf": [".pdf"],
42
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"]
43
+ },
44
+ "acceptedFilesDescription": "Adobe (.pdf) and Microsoft (.xlsx)"
45
+ }
46
+ },
47
+ {
48
+ "name": "Custom Message",
49
+ "props": {
50
+ "customMessage": "Playbook is awesome!"
51
+ }
52
+ },
53
+ {
54
+ "name": "Max File Size",
55
+ "props": {
56
+ "accept": {
57
+ "application/pdf": [".pdf"]
58
+ },
59
+ "maxSize": 1000000
60
+ }
61
+ },
62
+ {
63
+ "name": "Error State",
64
+ "props": {
65
+ "error": "Please upload a valid file"
66
+ }
67
+ }
68
+ ],
69
+ "conditionals": {
70
+ "acceptedFilesDescription": { "requires": "accept" }
71
+ },
72
+ "hints": {
73
+ "accepted_types_info": {
74
+ "presetName": "Accepted Types",
75
+ "message": "Use MIME-type keys with extension arrays for accept, for example { image/svg+xml: ['.svg', '.xml'] }.",
76
+ "type": "info"
77
+ },
78
+ "custom_description_info": {
79
+ "presetName": "Custom Description",
80
+ "message": "acceptedFilesDescription only changes the helper copy. File validation still comes from the accept object.",
81
+ "type": "info"
82
+ },
83
+ "custom_message_info": {
84
+ "presetName": "Custom Message",
85
+ "message": "customMessage replaces the built-in guidance, including accepted types and max file size text.",
86
+ "type": "info"
87
+ },
88
+ "max_size_info": {
89
+ "presetName": "Max File Size",
90
+ "message": "maxSize is measured in bytes. In app code, pair it with onFilesRejected to surface rejection details.",
91
+ "type": "warning"
92
+ },
93
+ "error_state_info": {
94
+ "presetName": "Error State",
95
+ "message": "Use the error prop for validation or server feedback below the dropzone.",
96
+ "type": "info"
97
+ }
98
+ }
99
+ }
@@ -131,23 +131,24 @@
131
131
  %>
132
132
 
133
133
  <%= pb_form_with(scope: :example, url: "", method: :get, validate: true) do |form| %>
134
- <%= form.typeahead :example_typeahead_field, props: { label: true, required: true, required_indicator: true } %>
135
- <%= form.text_field :example_text_field, props: { label: true, required: true, required_indicator: true } %>
136
- <%= form.text_field :example_text_field_2, props: { label: "Text Field Custom Label", required: true, required_indicator: true } %>
137
- <%= form.phone_number_field :example_phone_number_field, props: { label: true, required: true, required_indicator: true } %>
138
- <%= form.email_field :example_email_field, props: { label: true, required: true, required_indicator: true } %>
139
- <%= form.number_field :example_number_field, props: { label: true, required: true, required_indicator: true } %>
140
- <%= form.search_field :example_search_field, props: { label: true, required: true, required_indicator: true } %>
141
- <%= form.password_field :example_password_field, props: { label: true, required: true, required_indicator: true } %>
142
- <%= form.url_field :example_url_field, props: { label: true, required: true, required_indicator: true } %>
143
- <%= form.text_area :example_text_area, props: { label: true, required: true, required_indicator: true } %>
144
- <%= form.text_area :example_text_area_2, props: { label: "Textarea Custom Label", required: true, required_indicator: true } %>
145
- <%# form.check_box :example_checkbox, props: { label: true, text: "Checkbox Label", required: true, required_indicator: true } %>
146
- <%= form.time_picker :example_time_picker_required_indicator, props: { label: true, required: true, required_indicator: true } %>
147
- <%= form.date_picker :example_date_picker_required_indicator, props: { label: true, required: true, required_indicator: true } %>
148
- <%= form.date_picker :example_date_picker_required_indicator_custom, props: { label: "Custom Date Picker Label", required: true, required_indicator: true } %>
134
+ <%= form.typeahead :example_typeahead_required_indicator, props: { label: true, required: true, required_indicator: true } %>
135
+ <%= form.text_field :example_text_field_required_indicator, props: { label: true, required: true, required_indicator: true } %>
136
+ <%= form.text_field :example_text_field_required_indicator_custom, props: { label: "Text Field Custom Label", required: true, required_indicator: true } %>
137
+ <%= form.phone_number_field :example_phone_number_field_required_indicator, props: { label: true, required: true, required_indicator: true } %>
138
+ <%= form.email_field :example_email_field_required_indicator, props: { label: true, required: true, required_indicator: true } %>
139
+ <%= form.number_field :example_number_field_required_indicator, props: { label: true, required: true, required_indicator: true } %>
140
+ <%= form.search_field :example_search_field_required_indicator, props: { label: true, required: true, required_indicator: true } %>
141
+ <%= form.password_field :example_password_field_required_indicator, props: { label: true, required: true, required_indicator: true } %>
142
+ <%= form.url_field :example_url_field_required_indicator, props: { label: true, required: true, required_indicator: true } %>
143
+ <%= form.text_area :example_text_area_required_indicator, props: { label: true, required: true, required_indicator: true } %>
144
+ <%= form.text_area :example_text_area_required_indicator_custom, props: { label: "Textarea Custom Label", required: true, required_indicator: true } %>
145
+ <%= form.dropdown_field :example_dropdown_required_indicator, props: { label: true, options: example_dropdown_options, required: true, required_indicator: true } %>
146
+ <%= form.dropdown_field :example_dropdown_required_indicator_multi, props: { label: "Dropdown Custom Label", options: example_dropdown_options, multi_select: true, required: true, required_indicator: true } %>
149
147
  <%= form.select :example_select_required_indicator, [["Yes", 1], ["No", 2]], props: { label: true, required: true, required_indicator: true } %>
150
- <%= form.select :example_select_required_indicator_2, [["Yes", 1], ["No", 2]], props: { label: "Example Select Field", required: true, required_indicator: true } %>
148
+ <%= form.select :example_select_required_indicator_custom, [["Yes", 1], ["No", 2]], props: { label: "Example Select Field", required: true, required_indicator: true } %>
149
+ <%# form.check_box :example_checkbox_required_indicator, props: { label: true, text: "Checkbox Label", required: true, required_indicator: true } %>
150
+ <%= form.date_picker :example_date_picker_required_indicator, props: { label: true, required: true, required_indicator: true } %>
151
+ <%= form.date_picker :example_date_picker_required_indicator_custom, props: { label: "Date Picker Custom Label", required: true, required_indicator: true } %>
151
152
  <%= form.multi_level_select :example_multi_level_select_required_indicator, props: {
152
153
  label: true,
153
154
  margin_y: 'sm',
@@ -156,14 +157,14 @@
156
157
  tree_data: tree_data
157
158
  } %>
158
159
  <%= form.multi_level_select :example_multi_level_select_required_indicator_custom, props: {
159
- label: "Custom Multi Level Select Label",
160
+ label: "Multi Level Select Custom Label",
160
161
  margin_y: 'sm',
161
162
  required: true,
162
163
  required_indicator: true,
163
164
  tree_data: tree_data
164
165
  } %>
165
- <%= form.dropdown_field :example_dropdown, props: { label: true, options: example_dropdown_options, required: true, required_indicator: true } %>
166
- <%= form.dropdown_field :example_dropdown_2, props: { label: "Dropdown Custom Label", options: example_dropdown_options, required: true, required_indicator: true } %>
166
+ <%= form.time_picker :example_time_picker_required_indicator, props: { label: true, required: true, required_indicator: true } %>
167
+ <%= form.time_picker :example_time_picker_required_indicator_custom, props: { label: "Time Picker Custom Label", required: true, required_indicator: true } %>
167
168
 
168
169
  <%= form.actions do |action| %>
169
170
  <%= action.submit %>
@@ -8,7 +8,6 @@ examples:
8
8
  - icon_border: Icon Border
9
9
  - icon_sizes: Icon Sizes
10
10
  - icon_custom: Icon Custom
11
- - icon_fa_kit: Icon with FontAwesome Kit
12
11
  - icon_color: Icon Color
13
12
 
14
13
  react:
@@ -20,7 +19,6 @@ examples:
20
19
  - icon_border: Icon Border
21
20
  - icon_sizes: Icon Sizes
22
21
  - icon_custom: Icon Custom
23
- - icon_fa_kit: Icon with FontAwesome Kit
24
22
  - icon_color: Icon Color
25
23
 
26
24
  swift:
@@ -6,5 +6,4 @@ export { default as IconPull } from './_icon_pull.jsx'
6
6
  export { default as IconBorder } from './_icon_border.jsx'
7
7
  export { default as IconSizes } from './_icon_sizes.jsx'
8
8
  export { default as IconCustom } from './_icon_custom.jsx'
9
- export { default as IconFaKit} from './_icon_fa_kit.jsx'
10
9
  export { default as IconColor } from './_icon_color.jsx'
@@ -5,7 +5,9 @@
5
5
  "color": "default",
6
6
  "disabled": false,
7
7
  "tag": "a",
8
- "underline": false
8
+ "underline": false,
9
+ "href": "#link-example",
10
+ "text": "Link text"
9
11
  },
10
12
  "children": {
11
13
  "editable": true,
@@ -28,6 +30,7 @@
28
30
  "props": [
29
31
  "href",
30
32
  "target",
33
+ "disabled",
31
34
  "tabIndex"
32
35
  ]
33
36
  },
@@ -36,78 +39,95 @@
36
39
  "props": [
37
40
  "color",
38
41
  "underline",
39
- "disabled",
40
- "tag"
42
+ "tag",
43
+ "dark"
41
44
  ]
42
45
  }
43
46
  ],
44
47
  "presets": [
45
48
  {
46
49
  "name": "Default",
47
- "props": {},
48
- "children": "Link text"
50
+ "props": {
51
+ "href": "#link-example",
52
+ "text": "Link text"
53
+ }
49
54
  },
50
55
  {
51
- "name": "Muted underline",
56
+ "name": "Body color",
52
57
  "props": {
53
- "color": "muted",
54
- "underline": true
55
- },
56
- "children": "Secondary link"
58
+ "color": "body",
59
+ "href": "#body-link",
60
+ "text": "Inline body link"
61
+ }
57
62
  },
58
63
  {
59
- "name": "Body color",
64
+ "name": "Muted underline",
60
65
  "props": {
61
- "color": "body"
62
- },
63
- "children": "Inline body link"
66
+ "color": "muted",
67
+ "href": "#secondary-link",
68
+ "underline": true,
69
+ "text": "Secondary link"
70
+ }
64
71
  },
65
72
  {
66
73
  "name": "Destructive",
67
74
  "props": {
68
- "color": "destructive"
69
- },
70
- "children": "Delete account"
75
+ "color": "destructive",
76
+ "href": "#delete-account",
77
+ "text": "Delete account"
78
+ }
71
79
  },
72
80
  {
73
- "name": "With icon",
81
+ "name": "Leading icon",
74
82
  "props": {
75
83
  "color": "default",
76
- "icon": "arrow-up-right-from-square"
77
- },
78
- "children": "Continue"
84
+ "href": "#continue",
85
+ "icon": "arrow-up-right-from-square",
86
+ "text": "Continue"
87
+ }
79
88
  },
80
89
  {
81
- "name": "Icon both sides",
90
+ "name": "Trailing icon",
82
91
  "props": {
92
+ "href": "#details",
83
93
  "icon": "plus",
84
- "iconRight": "chevron-right"
85
- },
86
- "children": "Open document"
94
+ "iconRight": "chevron-right",
95
+ "text": "Open document"
96
+ }
87
97
  },
88
98
  {
89
- "name": "As heading tag",
99
+ "name": "Disabled",
90
100
  "props": {
91
- "tag": "span"
92
- },
93
- "children": "Styled as link"
101
+ "disabled": true,
102
+ "href": "#disabled",
103
+ "text": "Disabled link"
104
+ }
94
105
  },
95
106
  {
96
- "name": "With href",
107
+ "name": "Heading tag",
97
108
  "props": {
98
- "href": "/dashboard",
99
- "color": "default"
100
- },
101
- "children": "Go to dashboard"
109
+ "href": "#heading-link",
110
+ "icon": "arrow-up-right-from-square",
111
+ "tag": "h3",
112
+ "text": "Heading link"
113
+ }
102
114
  },
103
115
  {
104
116
  "name": "External new tab",
105
117
  "props": {
106
118
  "href": "https://example.com",
107
119
  "target": "_blank",
108
- "icon": "arrow-up-right-from-square"
109
- },
110
- "children": "Example.com"
120
+ "icon": "arrow-up-right-from-square",
121
+ "text": "Example.com"
122
+ }
123
+ },
124
+ {
125
+ "name": "Span tag",
126
+ "props": {
127
+ "href": "#span-link",
128
+ "tag": "span",
129
+ "text": "Span link example"
130
+ }
111
131
  }
112
132
  ],
113
133
  "conditionals": {
@@ -119,11 +139,32 @@
119
139
  }
120
140
  },
121
141
  "hints": {
122
- "target_needs_href": {
142
+ "external_target_info": {
143
+ "when": {
144
+ "target": "_blank"
145
+ },
146
+ "message": "Use target=\"_blank\" for external destinations that should open in a new tab.",
147
+ "type": "info"
148
+ },
149
+ "icon_pairing_info": {
150
+ "when": {
151
+ "iconRight": "chevron-right"
152
+ },
153
+ "message": "iconRight is available only when icon is also set, so the link can render a balanced icon treatment.",
154
+ "type": "info"
155
+ },
156
+ "disabled_info": {
157
+ "when": {
158
+ "disabled": true
159
+ },
160
+ "message": "Disabled links keep their visual treatment but should not be the only way to reach important actions.",
161
+ "type": "info"
162
+ },
163
+ "tag_semantics_info": {
123
164
  "when": {
124
- "target": true
165
+ "tag": "h3"
125
166
  },
126
- "message": "The target attribute only applies when href is set.",
167
+ "message": "Use tag to borrow link styling on semantic headings or inline text, but keep href when the element should still navigate.",
127
168
  "type": "info"
128
169
  }
129
170
  }
@@ -2,6 +2,14 @@
2
2
  "children": {
3
3
  "default": "Link text"
4
4
  },
5
+ "defaults": {
6
+ "color": "default",
7
+ "disabled": false,
8
+ "href": "#link-example",
9
+ "tag": "a",
10
+ "text": "Link text",
11
+ "underline": false
12
+ },
5
13
  "groups": [
6
14
  {
7
15
  "name": "Content",
@@ -9,62 +17,97 @@
9
17
  },
10
18
  {
11
19
  "name": "Behavior",
12
- "props": ["href", "target", "tabIndex"]
20
+ "props": ["href", "target", "disabled", "tabIndex"]
13
21
  },
14
22
  {
15
23
  "name": "Appearance",
16
- "props": ["color", "underline", "disabled", "tag"]
24
+ "props": ["color", "underline", "tag", "dark"]
17
25
  }
18
26
  ],
19
27
  "presets": [
20
28
  {
21
29
  "name": "Default",
22
- "props": {},
23
- "children": "Link text"
30
+ "props": {
31
+ "href": "#link-example",
32
+ "text": "Link text"
33
+ }
24
34
  },
25
35
  {
26
- "name": "Muted underline",
27
- "props": { "color": "muted", "underline": true },
28
- "children": "Secondary link"
36
+ "name": "Body color",
37
+ "props": {
38
+ "color": "body",
39
+ "href": "#body-link",
40
+ "text": "Inline body link"
41
+ }
29
42
  },
30
43
  {
31
- "name": "Body color",
32
- "props": { "color": "body" },
33
- "children": "Inline body link"
44
+ "name": "Muted underline",
45
+ "props": {
46
+ "color": "muted",
47
+ "href": "#secondary-link",
48
+ "underline": true,
49
+ "text": "Secondary link"
50
+ }
34
51
  },
35
52
  {
36
53
  "name": "Destructive",
37
- "props": { "color": "destructive" },
38
- "children": "Delete account"
54
+ "props": {
55
+ "color": "destructive",
56
+ "href": "#delete-account",
57
+ "text": "Delete account"
58
+ }
39
59
  },
40
60
  {
41
- "name": "With icon",
42
- "props": { "color": "default", "icon": "arrow-up-right-from-square" },
43
- "children": "Continue"
61
+ "name": "Leading icon",
62
+ "props": {
63
+ "color": "default",
64
+ "href": "#continue",
65
+ "icon": "arrow-up-right-from-square",
66
+ "text": "Continue"
67
+ }
44
68
  },
45
69
  {
46
- "name": "Icon both sides",
47
- "props": { "icon": "plus", "iconRight": "chevron-right" },
48
- "children": "Open document"
70
+ "name": "Trailing icon",
71
+ "props": {
72
+ "href": "#details",
73
+ "icon": "plus",
74
+ "iconRight": "chevron-right",
75
+ "text": "Open document"
76
+ }
49
77
  },
50
78
  {
51
- "name": "As heading tag",
52
- "props": { "tag": "span" },
53
- "children": "Styled as link"
79
+ "name": "Disabled",
80
+ "props": {
81
+ "disabled": true,
82
+ "href": "#disabled",
83
+ "text": "Disabled link"
84
+ }
54
85
  },
55
86
  {
56
- "name": "With href",
57
- "props": { "href": "/dashboard", "color": "default" },
58
- "children": "Go to dashboard"
87
+ "name": "Heading tag",
88
+ "props": {
89
+ "href": "#heading-link",
90
+ "icon": "arrow-up-right-from-square",
91
+ "tag": "h3",
92
+ "text": "Heading link"
93
+ }
59
94
  },
60
95
  {
61
96
  "name": "External new tab",
62
97
  "props": {
63
98
  "href": "https://example.com",
64
99
  "target": "_blank",
65
- "icon": "arrow-up-right-from-square"
66
- },
67
- "children": "Example.com"
100
+ "icon": "arrow-up-right-from-square",
101
+ "text": "Example.com"
102
+ }
103
+ },
104
+ {
105
+ "name": "Span tag",
106
+ "props": {
107
+ "href": "#span-link",
108
+ "tag": "span",
109
+ "text": "Span link example"
110
+ }
68
111
  }
69
112
  ],
70
113
  "conditionals": {
@@ -72,9 +115,24 @@
72
115
  "iconRight": { "requires": "icon" }
73
116
  },
74
117
  "hints": {
75
- "target_needs_href": {
76
- "when": { "target": true },
77
- "message": "The target attribute only applies when href is set.",
118
+ "external_target_info": {
119
+ "when": { "target": "_blank" },
120
+ "message": "Use target=\"_blank\" for external destinations that should open in a new tab.",
121
+ "type": "info"
122
+ },
123
+ "icon_pairing_info": {
124
+ "when": { "iconRight": "chevron-right" },
125
+ "message": "iconRight is available only when icon is also set, so the link can render a balanced icon treatment.",
126
+ "type": "info"
127
+ },
128
+ "disabled_info": {
129
+ "when": { "disabled": true },
130
+ "message": "Disabled links keep their visual treatment but should not be the only way to reach important actions.",
131
+ "type": "info"
132
+ },
133
+ "tag_semantics_info": {
134
+ "when": { "tag": "h3" },
135
+ "message": "Use tag to borrow link styling on semantic headings or inline text, but keep href when the element should still navigate.",
78
136
  "type": "info"
79
137
  }
80
138
  }
@@ -0,0 +1,90 @@
1
+ <% data = [
2
+ {
3
+ name: "EV",
4
+ y: 23.9,
5
+ },
6
+ {
7
+ name: "Hybrids",
8
+ y: 12.6,
9
+ },
10
+ {
11
+ name: "Diesel",
12
+ y: 37.0,
13
+ },
14
+ {
15
+ name: "Petrol",
16
+ y: 26.4,
17
+ },
18
+ ] %>
19
+
20
+ <% total = data.sum { |point| point[:y] } %>
21
+ <% subtitle_rows = data.map { |point| "#{point[:name]}: #{point[:y]}%" }.join("<br>") %>
22
+
23
+ <% chart_options = {
24
+ chart: {
25
+ type: "pie",
26
+ },
27
+ accessibility: {
28
+ point: {
29
+ valueSuffix: "%",
30
+ },
31
+ },
32
+ title: {
33
+ text: "2023 Norway car registrations",
34
+ floating: true,
35
+ align: "center",
36
+ verticalAlign: "top",
37
+ y: 8,
38
+ },
39
+ subtitle: {
40
+ text: "Total<br><strong>#{total.round(1)}</strong><br><br>#{subtitle_rows}",
41
+ useHTML: true,
42
+ floating: true,
43
+ align: "center",
44
+ verticalAlign: "middle",
45
+ y: 8,
46
+ style: {
47
+ textAlign: "center",
48
+ },
49
+ },
50
+ tooltip: {
51
+ pointFormat: "{series.name}: <b>{point.percentage:.0f}%</b>",
52
+ },
53
+ legend: {
54
+ enabled: false,
55
+ },
56
+ plotOptions: {
57
+ series: {
58
+ allowPointSelect: true,
59
+ cursor: "pointer",
60
+ borderRadius: 8,
61
+ dataLabels: [
62
+ {
63
+ enabled: true,
64
+ distance: 20,
65
+ format: "{point.name}",
66
+ },
67
+ {
68
+ enabled: true,
69
+ distance: -15,
70
+ format: "{point.percentage:.0f}%",
71
+ style: {
72
+ fontSize: "0.9em",
73
+ },
74
+ },
75
+ ],
76
+ showInLegend: true,
77
+ },
78
+ },
79
+ series: [
80
+ {
81
+ name: "Registrations",
82
+ colorByPoint: true,
83
+ center: ["50%", "50%"],
84
+ innerSize: "75%",
85
+ data: data,
86
+ },
87
+ ],
88
+ } %>
89
+
90
+ <%= pb_rails("pb_circle_chart", props: { options: chart_options }) %>