playbook_ui 14.14.0.pre.alpha.PBNTR894allowingcurrencyzero6405 → 14.14.0.pre.alpha.pbntr500currencykithandlingofnullvalues6275
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/app/pb_kits/playbook/pb_currency/_currency.tsx +2 -1
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +1 -1
- data/app/pb_kits/playbook/pb_currency/currency.rb +2 -14
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.html.erb +1 -3
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +8 -32
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +1 -20
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +12 -20
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +1 -49
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +3 -5
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +0 -9
- data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +2 -2
- data/app/pb_kits/playbook/pb_select/select.rb +0 -8
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +3 -2
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_tooltip/index.js +2 -2
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -10
- data/dist/chunks/{_typeahead-DXmDhfga.js → _typeahead-PqkcDf1H.js} +2 -2
- data/dist/chunks/{_weekday_stacked-Cb1DOlft.js → _weekday_stacked-BhC8Xp9l.js} +3 -3
- data/dist/chunks/{lib-Fr78pbpF.js → lib-D3us1bGD.js} +1 -1
- data/dist/chunks/{pb_form_validation-CN51bfsD.js → pb_form_validation-BpihMSOQ.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +3 -3
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -29
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_rails.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_react.md +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +0 -8
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +0 -33
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +0 -24
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +0 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +0 -49
- data/app/pb_kits/playbook/pb_drawer/index.js +0 -257
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +0 -71
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.jsx +0 -17
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.jsx +0 -61
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_icon_button/icon_button.test.jsx +0 -39
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +0 -11
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/index.js +0 -61
- data/app/pb_kits/playbook/pb_select/index.js +0 -38
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +0 -39
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +0 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +0 -26
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.14.0.pre.alpha.
|
4
|
+
version: 14.14.0.pre.alpha.pbntr500currencykithandlingofnullvalues6275
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -827,8 +827,6 @@ files:
|
|
827
827
|
- app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol.jsx
|
828
828
|
- app/pb_kits/playbook/pb_currency/docs/_currency_null_display.html.erb
|
829
829
|
- app/pb_kits/playbook/pb_currency/docs/_currency_null_display.jsx
|
830
|
-
- app/pb_kits/playbook/pb_currency/docs/_currency_null_display_rails.md
|
831
|
-
- app/pb_kits/playbook/pb_currency/docs/_currency_null_display_react.md
|
832
830
|
- app/pb_kits/playbook/pb_currency/docs/_currency_props_swift.md
|
833
831
|
- app/pb_kits/playbook/pb_currency/docs/_currency_size.html.erb
|
834
832
|
- app/pb_kits/playbook/pb_currency/docs/_currency_size.jsx
|
@@ -1202,21 +1200,14 @@ files:
|
|
1202
1200
|
- app/pb_kits/playbook/pb_drawer/_drawer.tsx
|
1203
1201
|
- app/pb_kits/playbook/pb_drawer/_drawer_context.tsx
|
1204
1202
|
- app/pb_kits/playbook/pb_drawer/context.ts
|
1205
|
-
- app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb
|
1206
1203
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx
|
1207
|
-
- app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb
|
1208
1204
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx
|
1209
|
-
- app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb
|
1210
1205
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx
|
1211
1206
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb
|
1212
1207
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx
|
1213
|
-
- app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb
|
1214
1208
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx
|
1215
1209
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md
|
1216
|
-
- app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb
|
1217
1210
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx
|
1218
|
-
- app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md
|
1219
|
-
- app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb
|
1220
1211
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx
|
1221
1212
|
- app/pb_kits/playbook/pb_drawer/docs/example.yml
|
1222
1213
|
- app/pb_kits/playbook/pb_drawer/docs/index.js
|
@@ -1225,7 +1216,6 @@ files:
|
|
1225
1216
|
- app/pb_kits/playbook/pb_drawer/drawer.test.jsx
|
1226
1217
|
- app/pb_kits/playbook/pb_drawer/hooks/useBreakpoint.tsx
|
1227
1218
|
- app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
|
1228
|
-
- app/pb_kits/playbook/pb_drawer/index.js
|
1229
1219
|
- app/pb_kits/playbook/pb_dropdown/_dropdown.scss
|
1230
1220
|
- app/pb_kits/playbook/pb_dropdown/_dropdown.tsx
|
1231
1221
|
- app/pb_kits/playbook/pb_dropdown/context/index.tsx
|
@@ -1634,16 +1624,11 @@ files:
|
|
1634
1624
|
- app/pb_kits/playbook/pb_icon/icon.rb
|
1635
1625
|
- app/pb_kits/playbook/pb_icon/icon.test.js
|
1636
1626
|
- app/pb_kits/playbook/pb_icon_button/_icon_button.scss
|
1637
|
-
- app/pb_kits/playbook/pb_icon_button/_icon_button.tsx
|
1638
1627
|
- app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb
|
1639
|
-
- app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.jsx
|
1640
1628
|
- app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb
|
1641
|
-
- app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.jsx
|
1642
1629
|
- app/pb_kits/playbook/pb_icon_button/docs/example.yml
|
1643
|
-
- app/pb_kits/playbook/pb_icon_button/docs/index.js
|
1644
1630
|
- app/pb_kits/playbook/pb_icon_button/icon_button.html.erb
|
1645
1631
|
- app/pb_kits/playbook/pb_icon_button/icon_button.rb
|
1646
|
-
- app/pb_kits/playbook/pb_icon_button/icon_button.test.jsx
|
1647
1632
|
- app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss
|
1648
1633
|
- app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx
|
1649
1634
|
- app/pb_kits/playbook/pb_icon_circle/docs/_description.md
|
@@ -2133,13 +2118,10 @@ files:
|
|
2133
2118
|
- app/pb_kits/playbook/pb_overlay/docs/_overlay_toggle.html.erb
|
2134
2119
|
- app/pb_kits/playbook/pb_overlay/docs/_overlay_toggle.jsx
|
2135
2120
|
- app/pb_kits/playbook/pb_overlay/docs/_overlay_toggle.md
|
2136
|
-
- app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb
|
2137
2121
|
- app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.jsx
|
2138
|
-
- app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md
|
2139
2122
|
- app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional_react.md
|
2140
2123
|
- app/pb_kits/playbook/pb_overlay/docs/example.yml
|
2141
2124
|
- app/pb_kits/playbook/pb_overlay/docs/index.js
|
2142
|
-
- app/pb_kits/playbook/pb_overlay/index.js
|
2143
2125
|
- app/pb_kits/playbook/pb_overlay/overlay.html.erb
|
2144
2126
|
- app/pb_kits/playbook/pb_overlay/overlay.rb
|
2145
2127
|
- app/pb_kits/playbook/pb_overlay/overlay.test.jsx
|
@@ -2498,7 +2480,6 @@ files:
|
|
2498
2480
|
- app/pb_kits/playbook/pb_select/docs/_select_value_text_same.jsx
|
2499
2481
|
- app/pb_kits/playbook/pb_select/docs/example.yml
|
2500
2482
|
- app/pb_kits/playbook/pb_select/docs/index.js
|
2501
|
-
- app/pb_kits/playbook/pb_select/index.js
|
2502
2483
|
- app/pb_kits/playbook/pb_select/select.html.erb
|
2503
2484
|
- app/pb_kits/playbook/pb_select/select.rb
|
2504
2485
|
- app/pb_kits/playbook/pb_select/select.test.js
|
@@ -3095,12 +3076,9 @@ files:
|
|
3095
3076
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.md
|
3096
3077
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay.jsx
|
3097
3078
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay.md
|
3098
|
-
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb
|
3099
|
-
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md
|
3100
3079
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb
|
3101
3080
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.jsx
|
3102
3081
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.md
|
3103
|
-
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb
|
3104
3082
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.jsx
|
3105
3083
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.md
|
3106
3084
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_margin.jsx
|
@@ -3114,7 +3092,6 @@ files:
|
|
3114
3092
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_with_icon_circle.html.erb
|
3115
3093
|
- app/pb_kits/playbook/pb_tooltip/docs/example.yml
|
3116
3094
|
- app/pb_kits/playbook/pb_tooltip/docs/index.js
|
3117
|
-
- app/pb_kits/playbook/pb_tooltip/floating_ui.js
|
3118
3095
|
- app/pb_kits/playbook/pb_tooltip/index.js
|
3119
3096
|
- app/pb_kits/playbook/pb_tooltip/tooltip.html.erb
|
3120
3097
|
- app/pb_kits/playbook/pb_tooltip/tooltip.rb
|
@@ -3367,11 +3344,11 @@ files:
|
|
3367
3344
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
3368
3345
|
- app/pb_kits/playbook/utilities/text.ts
|
3369
3346
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
3370
|
-
- dist/chunks/_typeahead-
|
3371
|
-
- dist/chunks/_weekday_stacked-
|
3347
|
+
- dist/chunks/_typeahead-PqkcDf1H.js
|
3348
|
+
- dist/chunks/_weekday_stacked-BhC8Xp9l.js
|
3372
3349
|
- dist/chunks/lazysizes-B7xYodB-.js
|
3373
|
-
- dist/chunks/lib-
|
3374
|
-
- dist/chunks/pb_form_validation-
|
3350
|
+
- dist/chunks/lib-D3us1bGD.js
|
3351
|
+
- dist/chunks/pb_form_validation-BpihMSOQ.js
|
3375
3352
|
- dist/chunks/vendor.js
|
3376
3353
|
- dist/menu.yml
|
3377
3354
|
- dist/playbook-doc.js
|
@@ -1 +0,0 @@
|
|
1
|
-
To customize how the `amount` field appears when it is empty, use the `null_display` prop and set it to the desired value you want to display.
|
@@ -1 +0,0 @@
|
|
1
|
-
To customize how the `amount` field appears when it is empty, use the `nullDisplay` prop and set it to the desired value you want to display.
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<%= pb_rails("flex") do %>
|
2
|
-
<%= pb_rails("button", props: { text: "Drawer with border right", margin_right: "sm", data: {"open-drawer": "drawer-12"} }) %>
|
3
|
-
|
4
|
-
<%= pb_rails("drawer", props: {
|
5
|
-
id:"drawer-12",
|
6
|
-
overlay: false,
|
7
|
-
border: "right"
|
8
|
-
}) do %>
|
9
|
-
Test me (Border Right)
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
|
13
|
-
<%= pb_rails("button", props: { text: "Drawer with border left", margin_right: "sm", data: {"open-drawer": "drawer-13"} }) %>
|
14
|
-
|
15
|
-
<%= pb_rails("drawer", props: {
|
16
|
-
id:"drawer-13",
|
17
|
-
overlay: false,
|
18
|
-
border: "left"
|
19
|
-
}) do %>
|
20
|
-
Test me (Border Left)
|
21
|
-
<% end %>
|
22
|
-
|
23
|
-
<%= pb_rails("button", props: { text: "Drawer with border full", data: {"open-drawer": "drawer-14"} }) %>
|
24
|
-
|
25
|
-
<%= pb_rails("drawer", props: {
|
26
|
-
id:"drawer-14",
|
27
|
-
overlay: false,
|
28
|
-
border: "full"
|
29
|
-
}) do %>
|
30
|
-
Test me (Border Full)
|
31
|
-
<% end %>
|
32
|
-
<% end %>
|
33
|
-
|
File without changes
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<%= pb_rails("button", props: { padding: "xs", margin_right: "sm", data: {"open-drawer": "drawer-4"} }) do %>
|
2
|
-
<%= pb_rails("icon", props: { icon: "bars", size: "2x" }) %>
|
3
|
-
<% end %>
|
4
|
-
|
5
|
-
<%= pb_rails("drawer", props: {
|
6
|
-
id:"drawer-4",
|
7
|
-
within_element: true,
|
8
|
-
placement: "bottom",
|
9
|
-
breakpoint: "md",
|
10
|
-
size: "full"
|
11
|
-
}) do %>
|
12
|
-
<%= pb_rails("nav", props: { display: {xl: "none", lg: "none", md: "none", sm: "block" } }) do %>
|
13
|
-
<%= pb_rails("nav/item", props: { text: "Photos", link: "#" }) %>
|
14
|
-
<%= pb_rails("nav/item", props: { text: "Music", link: "#" }) %>
|
15
|
-
<%= pb_rails("nav/item", props: { text: "Video", link: "#", active: true }) %>
|
16
|
-
<%= pb_rails("nav/item", props: { text: "Files", link: "#" }) %>
|
17
|
-
<% end %>
|
18
|
-
<%= pb_rails("nav", props: { display: {md: "block", sm: "none", xs: "none" }, orientation: "horizontal" }) do %>
|
19
|
-
<%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
|
20
|
-
<%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
|
21
|
-
<%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %>
|
22
|
-
<%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
|
23
|
-
<% end %>
|
24
|
-
<% end %>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<%= pb_rails("flex") do %>
|
2
|
-
<%= pb_rails("button", props: { text: "No Overlay Drawer", margin_right: "sm", data: {"open-drawer": "drawer-10"} }) %>
|
3
|
-
|
4
|
-
<%= pb_rails("drawer", props: {
|
5
|
-
id:"drawer-10",
|
6
|
-
overlay: false
|
7
|
-
}) do %>
|
8
|
-
Test me (No Overlay)
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
|
12
|
-
<%= pb_rails("button", props: { text: "Overlay Drawer", data: {"open-drawer": "drawer-11"} }) %>
|
13
|
-
|
14
|
-
<%= pb_rails("drawer", props: {
|
15
|
-
id:"drawer-11",
|
16
|
-
placement: "right"
|
17
|
-
}) do %>
|
18
|
-
Test me (Has Overlay)
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
21
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
Click the button to close the drawer when there is no overlay.
|
@@ -1,49 +0,0 @@
|
|
1
|
-
<%= pb_rails("flex") do %>
|
2
|
-
<%= pb_rails("button", props: { text: "XS Drawer", margin_right: "sm", data: {"open-drawer": "drawer-5"} }) %>
|
3
|
-
|
4
|
-
<%= pb_rails("drawer", props: {
|
5
|
-
id:"drawer-5",
|
6
|
-
size: "xs"
|
7
|
-
}) do %>
|
8
|
-
XS
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<%= pb_rails("button", props: { text: "SM Drawer", margin_right: "sm", data: {"open-drawer": "drawer-6"} }) %>
|
12
|
-
|
13
|
-
<%= pb_rails("drawer", props: {
|
14
|
-
id:"drawer-6",
|
15
|
-
size: "sm",
|
16
|
-
placement: "right"
|
17
|
-
}) do %>
|
18
|
-
This is a small drawer
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
<%= pb_rails("button", props: { text: "MD Drawer", margin_right: "sm", data: {"open-drawer": "drawer-7"} }) %>
|
22
|
-
|
23
|
-
<%= pb_rails("drawer", props: {
|
24
|
-
id:"drawer-7",
|
25
|
-
size: "md"
|
26
|
-
}) do %>
|
27
|
-
This is a medium drawer
|
28
|
-
<% end %>
|
29
|
-
|
30
|
-
<%= pb_rails("button", props: { text: "LG Drawer", margin_right: "sm", data: {"open-drawer": "drawer-8"} }) %>
|
31
|
-
|
32
|
-
<%= pb_rails("drawer", props: {
|
33
|
-
id:"drawer-8",
|
34
|
-
size: "lg",
|
35
|
-
placement: "right"
|
36
|
-
}) do %>
|
37
|
-
This is a large drawer
|
38
|
-
<% end %>
|
39
|
-
|
40
|
-
<%= pb_rails("button", props: { text: "XL Drawer", margin_right: "sm", data: {"open-drawer": "drawer-9"} }) %>
|
41
|
-
|
42
|
-
<%= pb_rails("drawer", props: {
|
43
|
-
id:"drawer-9",
|
44
|
-
size: "xl"
|
45
|
-
}) do %>
|
46
|
-
This is an extra large drawer
|
47
|
-
<% end %>
|
48
|
-
<% end %>
|
49
|
-
|
@@ -1,257 +0,0 @@
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element"
|
2
|
-
|
3
|
-
export default class PbDrawer extends PbEnhancedElement {
|
4
|
-
static get selector() {
|
5
|
-
return ".pb_drawer_wrapper"
|
6
|
-
}
|
7
|
-
|
8
|
-
connect() {
|
9
|
-
this.handleToggleClick = this.handleToggleClick.bind(this)
|
10
|
-
this.handleOutsideClick = this.handleOutsideClick.bind(this)
|
11
|
-
this.handleResize = this.handleResize.bind(this)
|
12
|
-
|
13
|
-
this._toggleTriggers = Array.from(document.querySelectorAll("[data-open-drawer]"))
|
14
|
-
this._toggleTriggers.forEach(el => {
|
15
|
-
el.addEventListener("click", this.handleToggleClick)
|
16
|
-
})
|
17
|
-
|
18
|
-
this._wrappers = Array.from(document.querySelectorAll(".pb_drawer_wrapper"))
|
19
|
-
this._wrappers.forEach(el => {
|
20
|
-
el.addEventListener("mousedown", this.handleOutsideClick)
|
21
|
-
})
|
22
|
-
|
23
|
-
this._withinElementDrawers = Array.from(
|
24
|
-
document.querySelectorAll(".pb_drawer_within_element_rails[data-breakpoint]")
|
25
|
-
)
|
26
|
-
|
27
|
-
window.addEventListener("resize", this.handleResize)
|
28
|
-
this.handleResize()
|
29
|
-
}
|
30
|
-
|
31
|
-
disconnect() {
|
32
|
-
this._toggleTriggers.forEach(el => {
|
33
|
-
el.removeEventListener("click", this.handleToggleClick)
|
34
|
-
})
|
35
|
-
this._wrappers.forEach(el => {
|
36
|
-
el.removeEventListener("mousedown", this.handleOutsideClick)
|
37
|
-
})
|
38
|
-
window.removeEventListener("resize", this.handleResize)
|
39
|
-
}
|
40
|
-
|
41
|
-
getOverlay(wrapper) {
|
42
|
-
if (wrapper.id && wrapper.id.startsWith("drawer-wrapper-")) {
|
43
|
-
const overlayId = wrapper.id.replace("drawer-wrapper-", "drawer-overlay-")
|
44
|
-
return document.getElementById(overlayId)
|
45
|
-
}
|
46
|
-
return wrapper.querySelector(".pb_drawer_overlay") || wrapper.querySelector(".pb_drawer_no_overlay")
|
47
|
-
}
|
48
|
-
|
49
|
-
handleToggleClick(event) {
|
50
|
-
const trigger = event.currentTarget
|
51
|
-
const drawerId = trigger.dataset.openDrawer
|
52
|
-
const dialog = document.getElementById(drawerId)
|
53
|
-
if (!dialog) return
|
54
|
-
|
55
|
-
if (dialog.classList.contains("pb_drawer_within_element_rails")) {
|
56
|
-
if (dialog.classList.contains("open")) {
|
57
|
-
this.closeWithinElementDrawer(dialog)
|
58
|
-
dialog.dataset.manualOpen = "false"
|
59
|
-
} else {
|
60
|
-
this.openWithinElementDrawer(dialog)
|
61
|
-
dialog.dataset.manualOpen = "true"
|
62
|
-
}
|
63
|
-
return
|
64
|
-
}
|
65
|
-
|
66
|
-
const wrapperId = `drawer-wrapper-${drawerId}`
|
67
|
-
const wrapper = document.getElementById(wrapperId)
|
68
|
-
if (!wrapper) return
|
69
|
-
|
70
|
-
if (wrapper !== this.element) return
|
71
|
-
|
72
|
-
if (wrapper.classList.contains("open")) {
|
73
|
-
this.closeDrawer(wrapper, dialog)
|
74
|
-
wrapper.dataset.manualOpen = "false"
|
75
|
-
} else {
|
76
|
-
this.openDrawer(wrapper, dialog)
|
77
|
-
wrapper.dataset.manualOpen = "true"
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
openWithinElementDrawer(dialog) {
|
82
|
-
if (dialog.classList.contains("open")) return
|
83
|
-
dialog.style.maxHeight = "0px"
|
84
|
-
dialog.offsetHeight
|
85
|
-
dialog.classList.add("open")
|
86
|
-
// Get trigger's height and add it to the final height
|
87
|
-
const trigger = document.querySelector(`[data-open-drawer="${dialog.id}"]`)
|
88
|
-
const triggerHeight = trigger ? trigger.offsetHeight : 0
|
89
|
-
const finalHeight = (dialog.scrollHeight + triggerHeight) + "px"
|
90
|
-
dialog.style.maxHeight = finalHeight
|
91
|
-
dialog.addEventListener("transitionend", function handleOpenEnd(e) {
|
92
|
-
if (e.propertyName === "max-height") {
|
93
|
-
dialog.style.maxHeight = "none"
|
94
|
-
dialog.removeEventListener("transitionend", handleOpenEnd)
|
95
|
-
}
|
96
|
-
})
|
97
|
-
}
|
98
|
-
|
99
|
-
closeWithinElementDrawer(dialog) {
|
100
|
-
if (!dialog.classList.contains("open")) return
|
101
|
-
const currentHeight = dialog.scrollHeight
|
102
|
-
dialog.style.maxHeight = currentHeight + "px"
|
103
|
-
dialog.offsetHeight
|
104
|
-
dialog.classList.remove("open")
|
105
|
-
dialog.style.maxHeight = "0px"
|
106
|
-
dialog.addEventListener("transitionend", function handleCloseEnd(e) {
|
107
|
-
if (e.propertyName === "max-height") {
|
108
|
-
dialog.removeEventListener("transitionend", handleCloseEnd)
|
109
|
-
dialog.style.maxHeight = "0px"
|
110
|
-
}
|
111
|
-
})
|
112
|
-
}
|
113
|
-
|
114
|
-
openDrawer(wrapper, dialog) {
|
115
|
-
const behavior = wrapper.dataset.behavior
|
116
|
-
const size = wrapper.dataset.size
|
117
|
-
const placement = wrapper.dataset.placement
|
118
|
-
this.handlePushOpen(behavior, size, placement)
|
119
|
-
|
120
|
-
wrapper.style.display = ""
|
121
|
-
const overlay = this.getOverlay(wrapper)
|
122
|
-
if (overlay) overlay.style.display = ""
|
123
|
-
|
124
|
-
wrapper.classList.add("open")
|
125
|
-
dialog.classList.add("open")
|
126
|
-
}
|
127
|
-
|
128
|
-
closeDrawer(wrapper, dialog) {
|
129
|
-
const behavior = wrapper.dataset.behavior
|
130
|
-
this.handlePushClose(behavior)
|
131
|
-
|
132
|
-
if (wrapper.className.includes("open")) wrapper.style.display = "none"
|
133
|
-
const overlay = this.getOverlay(wrapper)
|
134
|
-
if (overlay && wrapper.className.includes("open")) overlay.style.display = "none"
|
135
|
-
|
136
|
-
wrapper.classList.remove("open")
|
137
|
-
dialog.classList.remove("open")
|
138
|
-
}
|
139
|
-
|
140
|
-
handleOutsideClick(event) {
|
141
|
-
const wrapper = event.currentTarget
|
142
|
-
const dialog = wrapper.querySelector(".pb_drawer")
|
143
|
-
const overlay = this.getOverlay(wrapper)
|
144
|
-
|
145
|
-
if (dialog && dialog.classList.contains("pb_drawer_within_element_rails")) {
|
146
|
-
return
|
147
|
-
}
|
148
|
-
|
149
|
-
if (wrapper.dataset.overlayClick === "overlay_close" && event.target === overlay) {
|
150
|
-
this.closeDrawer(wrapper, dialog)
|
151
|
-
event.stopPropagation()
|
152
|
-
return
|
153
|
-
}
|
154
|
-
|
155
|
-
const dialogRect = dialog.getBoundingClientRect()
|
156
|
-
const clickedOutside =
|
157
|
-
event.clientX < dialogRect.left ||
|
158
|
-
event.clientX > dialogRect.right ||
|
159
|
-
event.clientY < dialogRect.top ||
|
160
|
-
event.clientY > dialogRect.bottom
|
161
|
-
|
162
|
-
if (clickedOutside) {
|
163
|
-
this.closeDrawer(wrapper, dialog)
|
164
|
-
event.stopPropagation()
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
handleResize() {
|
169
|
-
const breakpointValues = {
|
170
|
-
none: 0,
|
171
|
-
xs: 575,
|
172
|
-
sm: 768,
|
173
|
-
md: 992,
|
174
|
-
lg: 1200,
|
175
|
-
xl: 1400,
|
176
|
-
}
|
177
|
-
|
178
|
-
// Process wrappers
|
179
|
-
this._wrappers.forEach(wrapper => {
|
180
|
-
const bp = wrapper.dataset.breakpoint || "none"
|
181
|
-
if (bp === "none") return
|
182
|
-
|
183
|
-
const threshold = breakpointValues[bp] || 0
|
184
|
-
const dialog = wrapper.querySelector(".pb_drawer")
|
185
|
-
const trigger = dialog ? document.querySelector(`[data-open-drawer="${dialog.id}"]`) : null
|
186
|
-
|
187
|
-
if (window.innerWidth >= threshold) {
|
188
|
-
if (!wrapper.classList.contains("open")) {
|
189
|
-
this.openDrawer(wrapper, dialog)
|
190
|
-
}
|
191
|
-
if (trigger) trigger.style.display = "none"
|
192
|
-
} else {
|
193
|
-
if (trigger) trigger.style.display = ""
|
194
|
-
if (wrapper.classList.contains("open") && wrapper.dataset.manualOpen !== "true") {
|
195
|
-
this.closeDrawer(wrapper, dialog)
|
196
|
-
}
|
197
|
-
}
|
198
|
-
})
|
199
|
-
|
200
|
-
// Process within element drawers
|
201
|
-
this._withinElementDrawers.forEach(drawer => {
|
202
|
-
const bp = drawer.dataset.breakpoint || "none"
|
203
|
-
if (bp === "none") return
|
204
|
-
|
205
|
-
const threshold = breakpointValues[bp] || 0
|
206
|
-
const trigger = document.querySelector(`[data-open-drawer="${drawer.id}"]`)
|
207
|
-
|
208
|
-
if (window.innerWidth >= threshold) {
|
209
|
-
if (!drawer.classList.contains("open")) {
|
210
|
-
this.openWithinElementDrawer(drawer)
|
211
|
-
}
|
212
|
-
if (trigger) trigger.style.display = "none"
|
213
|
-
} else {
|
214
|
-
if (trigger) trigger.style.display = ""
|
215
|
-
if (drawer.classList.contains("open") && drawer.dataset.manualOpen !== "true") {
|
216
|
-
this.closeWithinElementDrawer(drawer)
|
217
|
-
}
|
218
|
-
}
|
219
|
-
})
|
220
|
-
}
|
221
|
-
|
222
|
-
handlePushOpen(behavior, size, placement) {
|
223
|
-
if (behavior !== "push") return
|
224
|
-
|
225
|
-
const sizeMap = {
|
226
|
-
xl: "365px",
|
227
|
-
lg: "300px",
|
228
|
-
md: "250px",
|
229
|
-
sm: "200px",
|
230
|
-
xs: "64px",
|
231
|
-
full: "100%",
|
232
|
-
}
|
233
|
-
|
234
|
-
const body = document.querySelector("body")
|
235
|
-
if (!body) return
|
236
|
-
|
237
|
-
if (placement === "left") {
|
238
|
-
body.style.cssText = `margin-left: ${sizeMap[size]} !important; margin-right: '' !important;`
|
239
|
-
} else if (placement === "right") {
|
240
|
-
body.style.cssText = `margin-right: ${sizeMap[size]} !important; margin-left: '' !important;`
|
241
|
-
}
|
242
|
-
body.classList.add("PBDrawer__Body--open")
|
243
|
-
}
|
244
|
-
|
245
|
-
handlePushClose(behavior) {
|
246
|
-
if (behavior !== "push") return
|
247
|
-
|
248
|
-
const body = document.querySelector("body")
|
249
|
-
if (!body) return
|
250
|
-
|
251
|
-
if (body.classList.contains("PBDrawer__Body--open")) {
|
252
|
-
body.classList.add("PBDrawer__Body--close")
|
253
|
-
}
|
254
|
-
body.style.cssText = ""
|
255
|
-
body.classList.remove("PBDrawer__Body--open")
|
256
|
-
}
|
257
|
-
}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
|
2
|
-
import React from 'react'
|
3
|
-
import classnames from 'classnames'
|
4
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
-
import { globalProps } from '../utilities/globalProps'
|
6
|
-
|
7
|
-
import Button from '../pb_button/_button'
|
8
|
-
import Icon from '../pb_icon/_icon'
|
9
|
-
import { IconSizes } from "../pb_icon/_icon"
|
10
|
-
|
11
|
-
type IconButtonProps = {
|
12
|
-
aria?: { [key: string]: string },
|
13
|
-
className?: string,
|
14
|
-
data?: { [key: string]: string },
|
15
|
-
htmlType?: 'submit' | 'reset' | 'button' | undefined,
|
16
|
-
icon?: string,
|
17
|
-
id?: string,
|
18
|
-
link?: string,
|
19
|
-
newWindow?: boolean,
|
20
|
-
size?: IconSizes,
|
21
|
-
target?: string,
|
22
|
-
variant?: 'default' | 'link',
|
23
|
-
}
|
24
|
-
|
25
|
-
const IconButton = (props: IconButtonProps) => {
|
26
|
-
const {
|
27
|
-
aria = {},
|
28
|
-
className,
|
29
|
-
data = {},
|
30
|
-
htmlType = 'button',
|
31
|
-
icon = 'bars',
|
32
|
-
id,
|
33
|
-
link,
|
34
|
-
newWindow = false,
|
35
|
-
size = "2x",
|
36
|
-
target,
|
37
|
-
variant = "default",
|
38
|
-
} = props
|
39
|
-
|
40
|
-
const ariaProps = buildAriaProps(aria)
|
41
|
-
const dataProps = buildDataProps(data)
|
42
|
-
const classes = classnames(buildCss('pb_icon_button_kit', variant), globalProps(props), className)
|
43
|
-
|
44
|
-
return (
|
45
|
-
<div
|
46
|
-
{...ariaProps}
|
47
|
-
{...dataProps}
|
48
|
-
className={classes}
|
49
|
-
id={id}
|
50
|
-
>
|
51
|
-
<Button
|
52
|
-
borderRadius="lg"
|
53
|
-
htmlType={htmlType}
|
54
|
-
link={link}
|
55
|
-
newWindow={newWindow}
|
56
|
-
target={target}
|
57
|
-
>
|
58
|
-
<Icon
|
59
|
-
className="icon_button_icon"
|
60
|
-
fixedWidth
|
61
|
-
icon={icon}
|
62
|
-
paddingX="xxs"
|
63
|
-
paddingY="xs"
|
64
|
-
size={size}
|
65
|
-
/>
|
66
|
-
</Button>
|
67
|
-
</div>
|
68
|
-
)
|
69
|
-
}
|
70
|
-
|
71
|
-
export default IconButton
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { IconButton } from 'playbook-ui'
|
3
|
-
|
4
|
-
const IconButtonDefault = (props) => (
|
5
|
-
<div>
|
6
|
-
<IconButton
|
7
|
-
{...props}
|
8
|
-
/>
|
9
|
-
<IconButton
|
10
|
-
{...props}
|
11
|
-
marginTop="md"
|
12
|
-
variant="link"
|
13
|
-
/>
|
14
|
-
</div>
|
15
|
-
)
|
16
|
-
|
17
|
-
export default IconButtonDefault
|