playbook_ui 16.8.0.pre.alpha.PLAY2965datepickerconsoleerrors16591 → 16.8.0.pre.alpha.PLAY2968timepickerrailsenhancedelementrefactor16753

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.jsx +68 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.md +7 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  6. data/app/pb_kits/playbook/pb_icon/_icon.scss +2 -1
  7. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.html.erb +90 -0
  8. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.jsx +100 -0
  9. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.md +1 -0
  10. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +2 -0
  12. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +2 -1
  13. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +1 -1
  14. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +37 -0
  15. data/app/pb_kits/playbook/pb_time_picker/_time_picker.scss +26 -3
  16. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.html.erb +24 -0
  17. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler_rails.md +6 -0
  18. data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +1 -0
  19. data/app/pb_kits/playbook/pb_time_picker/index.ts +743 -30
  20. data/app/pb_kits/playbook/pb_time_picker/time_picker.html.erb +168 -1
  21. data/app/pb_kits/playbook/pb_time_picker/time_picker.rb +56 -26
  22. data/dist/chunks/{_typeahead-DA__Kgp5.js → _typeahead-DKlUinmj.js} +1 -1
  23. data/dist/chunks/{lazysizes-B7xYodB-.js → time_picker_helper-Bx8nzyM8.js} +1 -1
  24. data/dist/chunks/vendor.js +4 -4
  25. data/dist/menu.yml +2 -2
  26. data/dist/playbook-rails-react-bindings.js +1 -1
  27. data/dist/playbook-rails.js +1 -1
  28. data/dist/playbook.css +1 -1
  29. data/lib/playbook/forms/builder/time_picker_field.rb +6 -3
  30. data/lib/playbook/version.rb +1 -1
  31. metadata +12 -5
  32. /data/app/pb_kits/playbook/pb_time_picker/docs/{_time_picker_on_handler.md → _time_picker_on_handler_react.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd2ca8297ec9a85d8dab2aecadfe8eac192a7f98f7be17f0a728b3f993f2bb5d
4
- data.tar.gz: 823a12f11d4305883854e5cc5919e28178f1cb7548f23c93dfe18f299c0a49c1
3
+ metadata.gz: 060ae3a63fe3d1a9ec48a8e837b2bd67656bebc1aab597f577b5b04420be096f
4
+ data.tar.gz: 5382abec9a61fa27ba52c6c999278d12f352713a82570b9344c338324ae39de6
5
5
  SHA512:
6
- metadata.gz: cb559e089d5ede598740cc35e24fa7a20085d54c829814a855fe4ecbf25e1aa0e5f8a4119a376b185e5ed818360899979a1c03e5f7dc9bc9c593d81074380627
7
- data.tar.gz: f7d28f0eb0beb741c5b1053f88f1b35189e4eaa3d3cde39598c3a760cc4ad5c8dd606d302642325fd6451b53d7d6008d1542508c7b305f7b56580432f62b37fb
6
+ metadata.gz: 798aaeb1ed09746867bc514ebd233a24d7757ef8a6ae3dd9cec9bb776f8763b9beae16253fed175ec400e716cf23acf8973c45e3c6d8c1156115efe63c58292f
7
+ data.tar.gz: e9eaf46a2fc74f92bdee699e41bedcba1a3127a2c74885d64c59339263995570da59001fd3fa5a5c745d98be133be0cadb090f4cada33d9a108132a3eb32e43f
@@ -0,0 +1,68 @@
1
+ import React from "react"
2
+ import AdvancedTable from "../../pb_advanced_table/_advanced_table"
3
+ import Title from "../../pb_title/_title"
4
+
5
+ const COLUMN_COUNT = 10
6
+ const ROW_COUNT = 40
7
+
8
+ const columnDefinitions = [
9
+ {
10
+ accessor: "region",
11
+ label: "Region",
12
+ id: "region",
13
+ columnStyling: { minWidth: 160 },
14
+ },
15
+ ...Array.from({ length: COLUMN_COUNT }, (_, index) => ({
16
+ accessor: `metric${index + 1}`,
17
+ label: `Metric ${index + 1}`,
18
+ id: `metric${index + 1}`,
19
+ columnStyling: { minWidth: 180 },
20
+ })),
21
+ ]
22
+
23
+ const tableData = Array.from({ length: ROW_COUNT }, (_, row) => ({
24
+ region: `Region ${row + 1}`,
25
+ ...Object.fromEntries(
26
+ Array.from({ length: COLUMN_COUNT }, (_, col) => [
27
+ `metric${col + 1}`,
28
+ String((row + 1) * (col + 1)),
29
+ ])
30
+ ),
31
+ }))
32
+
33
+ const tableProps = { sticky: true }
34
+
35
+ const AdvancedTableStickyScrollLimitation = (props) => (
36
+ <div>
37
+ <Title
38
+ size={4}
39
+ text="Without maxHeight"
40
+ {...props}
41
+ />
42
+ <AdvancedTable
43
+ columnDefinitions={columnDefinitions}
44
+ responsive="none"
45
+ stickyLeftColumn={["region"]}
46
+ tableData={tableData}
47
+ tableProps={tableProps}
48
+ {...props}
49
+ />
50
+ <Title
51
+ paddingTop="sm"
52
+ size={4}
53
+ text="With maxHeight"
54
+ {...props}
55
+ />
56
+ <AdvancedTable
57
+ columnDefinitions={columnDefinitions}
58
+ maxHeight="sm"
59
+ responsive="none"
60
+ stickyLeftColumn={["region"]}
61
+ tableData={tableData}
62
+ tableProps={tableProps}
63
+ {...props}
64
+ />
65
+ </div>
66
+ )
67
+
68
+ export default AdvancedTableStickyScrollLimitation
@@ -0,0 +1,7 @@
1
+ `stickyLeftColumn` adds horizontal overflow to the table wrapper. Without `maxHeight`, the page scrolls vertically while the table scrolls horizontally — two scroll containers.
2
+
3
+ Sticky columns work in that setup, but the sticky header cannot stick to the page. Scroll down on the page, then scroll the first table horizontally to see the conflict.
4
+
5
+ The second table uses `maxHeight` so both axes share one scroll container. The header sticks to the top of the table box instead of the page.
6
+
7
+ For a typical implementation with subrows, see [Sticky Columns with Sticky Header](#sticky-columns-with-sticky-header).
@@ -52,6 +52,7 @@ examples:
52
52
  - advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
53
53
  - advanced_table_sticky_columns: Sticky Columns
54
54
  - advanced_table_sticky_columns_and_header: Sticky Columns with Sticky Header
55
+ - advanced_table_sticky_scroll_limitation: Sticky Header and Column Scroll Limitation
55
56
  - advanced_table_responsive: Responsive Tables
56
57
  - advanced_table_custom_cell: Custom Components for Cells
57
58
  - advanced_table_with_custom_header: Custom Header Cell
@@ -27,6 +27,7 @@ export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen
27
27
  export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
28
28
  export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
29
29
  export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
30
+ export { default as AdvancedTableStickyScrollLimitation } from './_advanced_table_sticky_scroll_limitation.jsx'
30
31
  export { default as AdvancedTableExpandByDepth } from './_advanced_table_expand_by_depth.jsx'
31
32
  export { default as AdvancedTableColumnBorderColor} from './_advanced_table_column_border_color.jsx'
32
33
  export { default as AdvancedTableColumnVisibility } from './_advanced_table_column_visibility.jsx'
@@ -69,9 +69,10 @@ svg {
69
69
  transform: scaleX(-1) scaleY(-1);
70
70
  }
71
71
  &.svg-inline--fa {
72
+ box-sizing: content-box;
72
73
  height: 1em;
73
74
  overflow: visible;
74
- vertical-align: -.125em
75
+ vertical-align: -.125em;
75
76
  }
76
77
  &.svg_inverse {
77
78
  color: #fff;
@@ -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 }) %>
@@ -0,0 +1,100 @@
1
+ import React from "react";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+
4
+ const data = [
5
+ {
6
+ name: "EV",
7
+ y: 23.9,
8
+ },
9
+ {
10
+ name: "Hybrids",
11
+ y: 12.6,
12
+ },
13
+ {
14
+ name: "Diesel",
15
+ y: 37.0,
16
+ },
17
+ {
18
+ name: "Petrol",
19
+ y: 26.4,
20
+ },
21
+ ];
22
+
23
+ const total = data.reduce((sum, point) => sum + point.y, 0);
24
+ const subtitleRows = data.map((point) => `${point.name}: ${point.y}%`).join("<br>");
25
+
26
+ const chartOptions = {
27
+ chart: {
28
+ type: "pie",
29
+ },
30
+ accessibility: {
31
+ point: {
32
+ valueSuffix: "%",
33
+ },
34
+ },
35
+ title: {
36
+ text: "2023 Norway car registrations",
37
+ floating: true,
38
+ align: "center",
39
+ verticalAlign: "top",
40
+ y: 8,
41
+ },
42
+ subtitle: {
43
+ text: `Total<br><strong>${total.toFixed(1)}</strong><br><br>${subtitleRows}`,
44
+ useHTML: true,
45
+ floating: true,
46
+ align: "center",
47
+ verticalAlign: "middle",
48
+ y: 8,
49
+ style: {
50
+ textAlign: "center",
51
+ },
52
+ },
53
+ tooltip: {
54
+ pointFormat: "{series.name}: <b>{point.percentage:.0f}%</b>",
55
+ },
56
+ legend: {
57
+ enabled: false,
58
+ },
59
+ plotOptions: {
60
+ series: {
61
+ allowPointSelect: true,
62
+ cursor: "pointer",
63
+ borderRadius: 8,
64
+ dataLabels: [
65
+ {
66
+ enabled: true,
67
+ distance: 20,
68
+ format: "{point.name}",
69
+ },
70
+ {
71
+ enabled: true,
72
+ distance: -15,
73
+ format: "{point.percentage:.0f}%",
74
+ style: {
75
+ fontSize: "0.9em",
76
+ },
77
+ },
78
+ ],
79
+ showInLegend: true,
80
+ },
81
+ },
82
+ series: [
83
+ {
84
+ name: "Registrations",
85
+ colorByPoint: true,
86
+ center: ["50%", "50%"],
87
+ innerSize: "75%",
88
+ data,
89
+ },
90
+ ],
91
+ };
92
+
93
+ const PbCircleChartCenteredData = (props) => (
94
+ <PbCircleChart
95
+ options={chartOptions}
96
+ {...props}
97
+ />
98
+ );
99
+
100
+ export default PbCircleChartCenteredData;
@@ -0,0 +1 @@
1
+ This example shows how to achieve centered data. This data will remain in the center of all screen sizes.
@@ -30,4 +30,4 @@ const PbCircleChartDefault = (props) => (
30
30
  </div>
31
31
  );
32
32
 
33
- export default PbCircleChartDefault;
33
+ export default PbCircleChartDefault;
@@ -11,6 +11,7 @@ examples:
11
11
  - pb_circle_chart_with_title: With Title
12
12
  - pb_circle_chart_inner_sizes: Inner Circle Size Options
13
13
  - pb_circle_chart_custom_tooltip: Tooltip Customization
14
+ - pb_circle_chart_centered_data: Centered Data
14
15
 
15
16
 
16
17
  react:
@@ -25,5 +26,6 @@ examples:
25
26
  - pb_circle_chart_with_title: With Title
26
27
  - pb_circle_chart_inner_sizes: Inner Circle Size Options
27
28
  - pb_circle_chart_custom_tooltip: Tooltip Customization
29
+ - pb_circle_chart_centered_data: Centered Data
28
30
 
29
31
 
@@ -8,4 +8,5 @@ export { default as PbCircleChartDataWithLegend } from './_pb_circle_chart_data_
8
8
  export { default as PbCircleChartDataLegendPosition } from './_pb_circle_chart_data_legend_position.jsx'
9
9
  export { default as PbCircleChartWithTitle } from './_pb_circle_chart_with_title.jsx'
10
10
  export { default as PbCircleChartInnerSizes } from './_pb_circle_chart_inner_sizes.jsx'
11
- export { default as PbCircleChartCustomTooltip } from './_pb_circle_chart_custom_tooltip.jsx'
11
+ export { default as PbCircleChartCustomTooltip } from './_pb_circle_chart_custom_tooltip.jsx'
12
+ export { default as PbCircleChartCenteredData } from './_pb_circle_chart_centered_data.jsx'
@@ -36,4 +36,4 @@ When `filter` is present, `filter_content` and `filter_props` are ignored.
36
36
  <% end %>
37
37
  ```
38
38
 
39
- For Nitro apps that use a shared search/filter pattern, reference the example on Alpha for implementation details.
39
+ For Nitro apps that use a shared search/filter pattern, reference the [example on Alpha](https://github.com/powerhome/nitro-web/pull/56859/changes/aa2afcdc97d39d74beb65cf53eb3bb2517eb2181) for implementation details.
@@ -100,6 +100,29 @@
100
100
  color: $input_text_disabled_dark;
101
101
  }
102
102
  }
103
+
104
+ .text_input_wrapper_add_on {
105
+ &:has(input:disabled),
106
+ &:has(.text_input:disabled) {
107
+ .add-on-card,
108
+ .add-on-card-dark {
109
+ border-color: $input_border_disabled_dark;
110
+ background-color: $input_background_disabled_dark;
111
+ }
112
+
113
+ .add-on-icon {
114
+ color: $input_text_disabled_dark;
115
+ }
116
+
117
+ .text_input:focus ~ .add-on-card-dark,
118
+ input:focus ~ .add-on-card-dark {
119
+ background-color: $input_background_disabled_dark;
120
+ border-color: $input_border_disabled_dark;
121
+ border-width: 1px;
122
+ }
123
+ }
124
+ }
125
+
103
126
  &.error {
104
127
  .text_input_wrapper {
105
128
  // The `:not` here prevents error styling from affecting the country search input in the Phone Number Input Kit.
@@ -192,6 +215,20 @@
192
215
  }
193
216
  }
194
217
  }
218
+ &:not(.dark) .text_input_wrapper_add_on {
219
+ &:has(input:disabled),
220
+ &:has(.text_input:disabled) {
221
+ .add-on-card {
222
+ border-color: $input_border_disabled;
223
+ background-color: $input_background_disabled;
224
+ }
225
+
226
+ .add-on-icon {
227
+ color: $input_text_disabled;
228
+ }
229
+ }
230
+ }
231
+
195
232
  &.inline {
196
233
  .text_input_wrapper input::placeholder,
197
234
  .text_input_wrapper .text_input .placeholder {
@@ -70,15 +70,22 @@
70
70
  }
71
71
  }
72
72
 
73
- .text_input_wrapper_add_on .add-on-right .text_input {
73
+ .text_input_wrapper_add_on .add-on-right .text_input,
74
+ .text_input_wrapper_add_on input.text_input {
74
75
  cursor: pointer;
75
76
  }
76
77
 
77
78
  &.error {
78
- .text_input_wrapper_add_on .add-on-card {
79
+ .text_input_wrapper_add_on .add-on-right .text_input,
80
+ .text_input_wrapper_add_on input.text_input {
79
81
  border-color: $input_border_error;
80
82
  }
81
83
 
84
+ .text_input_wrapper_add_on .add-on-right .add-on-card {
85
+ border: 1px solid $input_border_error;
86
+ border-left: 0;
87
+ }
88
+
82
89
  &:focus,
83
90
  &:focus-within {
84
91
  .text_input_wrapper_add_on .text_input,
@@ -89,6 +96,18 @@
89
96
  }
90
97
  }
91
98
 
99
+ &.dark.error {
100
+ .text_input_wrapper_add_on .add-on-right .text_input,
101
+ .text_input_wrapper_add_on input.text_input {
102
+ border-color: $input_border_error_dark;
103
+ }
104
+
105
+ .text_input_wrapper_add_on .add-on-right .add-on-card {
106
+ border: 1px solid $input_border_error_dark;
107
+ border-left: 0;
108
+ }
109
+ }
110
+
92
111
  &.disabled {
93
112
  border-color: $input_border_disabled;
94
113
  > label {
@@ -266,7 +285,7 @@
266
285
  color: $input_border_error;
267
286
  }
268
287
  }
269
- .pb_caption_kit_xs {
288
+ .pb_time_picker_timezone_text {
270
289
  clear: both;
271
290
  display: block;
272
291
  width: 100%;
@@ -337,6 +356,10 @@
337
356
  justify-content: center;
338
357
  font-weight: $bolder;
339
358
  color: $input_text_active;
359
+
360
+ .pb_body_kit {
361
+ font-weight: $bolder;
362
+ }
340
363
  }
341
364
 
342
365
  .disabled_meridiem > label,
@@ -0,0 +1,24 @@
1
+ <%= pb_rails("flex", props: { margin_bottom: "sm", orientation: "column" }) do %>
2
+ <%= pb_rails("body", props: { id: "time-picker-on-change-output", text: "" }) %>
3
+ <%= pb_rails("body", props: { id: "time-picker-on-close-output", text: "" }) %>
4
+ <% end %>
5
+
6
+ <%= pb_rails("time_picker", props: { id: "time-picker-on-handler" }) %>
7
+
8
+ <script>
9
+ (function() {
10
+ var picker = document.getElementById("time-picker-on-handler");
11
+ var changeOutput = document.getElementById("time-picker-on-change-output");
12
+ var closeOutput = document.getElementById("time-picker-on-close-output");
13
+
14
+ if (!picker) return;
15
+
16
+ picker.addEventListener("pb-time-picker-change", function(event) {
17
+ changeOutput.textContent = "onChange: " + (event.detail.time || "");
18
+ });
19
+
20
+ picker.addEventListener("pb-time-picker-close", function(event) {
21
+ closeOutput.textContent = "onClose: " + (event.detail.time || "");
22
+ });
23
+ })();
24
+ </script>
@@ -0,0 +1,6 @@
1
+ Demonstrates listening for Time Picker custom events on the Rails enhanced element. Attach listeners to the picker root element (the element with `data-pb-time-picker`).
2
+
3
+ | Event | When it fires | `event.detail` |
4
+ | --- | --- | --- |
5
+ | `pb-time-picker-change` | Hour, minute, or period changes while the dropdown is open | `{ time: string }` — 24-hour `HH:MM` value, or `""` when cleared |
6
+ | `pb-time-picker-close` | Dropdown closes with a valid selection | `{ time: string }` — 24-hour `HH:MM` value |
@@ -11,6 +11,7 @@ examples:
11
11
  - time_picker_disabled: Disabled
12
12
  - time_picker_required_indicator: Required Indicator
13
13
  - time_picker_input_options: Input Options
14
+ - time_picker_on_handler: onChange & onClose Handlers
14
15
 
15
16
 
16
17
  react: