playbook_ui 13.3.0 → 13.4.0.pre.alpha.PLAY973Hash1181

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_button/button.html.erb +2 -2
  4. data/app/pb_kits/playbook/pb_button/button.rb +3 -0
  5. data/app/pb_kits/playbook/pb_card/card.rb +1 -1
  6. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -1
  7. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +5 -1
  8. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +2 -2
  9. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -2
  10. data/app/pb_kits/playbook/pb_file_upload/file_upload.rb +1 -1
  11. data/app/pb_kits/playbook/pb_kit/dateTime.ts +54 -23
  12. data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +1 -1
  13. data/app/pb_kits/playbook/pb_radio/radio.rb +1 -1
  14. data/app/pb_kits/playbook/pb_select/select.rb +1 -1
  15. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +1 -1
  16. data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.rb +1 -1
  17. data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.rb +1 -1
  18. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +1 -1
  19. data/app/pb_kits/playbook/pb_source/source.rb +1 -1
  20. data/app/pb_kits/playbook/pb_table/docs/_table_two_actions.jsx +3 -3
  21. data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -2
  22. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +14 -7
  23. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.html.erb +21 -0
  24. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.jsx +36 -0
  25. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.md +1 -0
  26. data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +3 -1
  27. data/app/pb_kits/playbook/pb_timestamp/docs/index.js +1 -0
  28. data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +5 -1
  29. data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +3 -1
  30. data/app/pb_kits/playbook/pb_title/_title.scss +3 -4
  31. data/app/pb_kits/playbook/pb_toggle/toggle.rb +1 -1
  32. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -1
  33. data/app/pb_kits/playbook/tokens/_spacing.scss +1 -1
  34. data/app/pb_kits/playbook/tokens/_text_align.scss +18 -0
  35. data/app/pb_kits/playbook/utilities/_hover.scss +4 -0
  36. data/app/pb_kits/playbook/utilities/_max_width.scss +4 -0
  37. data/app/pb_kits/playbook/utilities/_spacing.scss +92 -49
  38. data/app/pb_kits/playbook/utilities/_text_align.scss +3 -0
  39. data/app/pb_kits/playbook/utilities/globalProps.ts +30 -2
  40. data/dist/playbook-rails.js +5 -5
  41. data/lib/playbook/classnames.rb +1 -0
  42. data/lib/playbook/hover.rb +6 -2
  43. data/lib/playbook/kit_base.rb +4 -2
  44. data/lib/playbook/props/hash.rb +1 -1
  45. data/lib/playbook/spacing.rb +13 -4
  46. data/lib/playbook/text_align.rb +37 -0
  47. data/lib/playbook/version.rb +2 -2
  48. metadata +13 -7
@@ -1,69 +1,112 @@
1
1
  @import "../tokens/spacing";
2
2
 
3
3
  $space_classes: (
4
- xxs: $space_xxs,
5
- xs: $space_xs,
6
- sm: $space_sm,
7
- md: $space_md,
8
- lg: $space_lg,
9
- xl: $space_xl,
10
- none: 0,
4
+ xxs: $space_xxs,
5
+ xs: $space_xs,
6
+ sm: $space_sm,
7
+ md: $space_md,
8
+ lg: $space_lg,
9
+ xl: $space_xl,
10
+ none: 0,
11
11
  auto: auto,
12
12
  initial: initial,
13
13
  inherit: inherit
14
14
  );
15
15
 
16
16
  $positions: (
17
- m: "margin",
18
- mr: "margin-right",
19
- ml: "margin-left",
20
- mt: "margin-top",
21
- mb: "margin-bottom",
22
- mx: ("margin-left", "margin-right"),
23
- my: ("margin-top", "margin-bottom"),
24
- p: "padding",
25
- pr: "padding-right",
26
- pl: "padding-left",
27
- pt: "padding-top",
28
- pb: "padding-bottom",
29
- px: ("padding-left", "padding-right"),
30
- py: ("padding-top", "padding-bottom")
17
+ m: "margin",
18
+ mr: "margin-right",
19
+ ml: "margin-left",
20
+ mt: "margin-top",
21
+ mb: "margin-bottom",
22
+ mx: ("margin-left", "margin-right"),
23
+ my: ("margin-top", "margin-bottom"),
24
+ p: "padding",
25
+ pr: "padding-right",
26
+ pl: "padding-left",
27
+ pt: "padding-top",
28
+ pb: "padding-bottom",
29
+ px: ("padding-left", "padding-right"),
30
+ py: ("padding-top", "padding-bottom")
31
31
  );
32
32
 
33
- @each $position_name, $position in $positions {
34
- @each $space_name, $space in $space_classes {
35
- .#{$position_name}_#{$space_name} {
36
- @if type-of($position)=="list" {
37
- @each $coordinate in $position {
38
- #{$coordinate}: #{$space} !important;
39
- }
40
- }
41
- @else {
42
- #{$position}: #{$space} !important;
43
- }
44
- }
45
- }
33
+ $break_methods: (
34
+ at: "break_at",
35
+ on: "break_on",
36
+ );
37
+
38
+ @each $position_name,
39
+ $position in $positions {
40
+
41
+ @each $space_name,
42
+ $space in $space_classes {
43
+ .#{$position_name}_#{$space_name} {
44
+ @if type-of($position)=="list" {
45
+ @each $coordinate in $position {
46
+ #{$coordinate}: #{$space} !important;
47
+ }
48
+ }
49
+
50
+ @else {
51
+ #{$position}: #{$space} !important;
52
+ }
53
+ }
54
+ }
46
55
  }
47
56
 
48
- @each $size, $size_value in $breakpoints_max_only {
49
- @each $position_name, $position in $positions {
50
- @each $space_name, $space in $space_classes {
51
- $min_size: map-get($size_value, "min");
52
- $max_size: map-get($size_value, "max");
53
- .#{$position_name}_#{$size}_#{$space_name} {
54
- @if type-of($position)=="list" {
55
- @each $coordinate in $position {
56
- @include break_at( $max_size) {
57
- #{$coordinate}: #{$space} !important;
57
+ // Generate media queries
58
+ @each $size,
59
+ $size_value in $breakpoints_grid {
60
+
61
+ @each $position_name,
62
+ $position in $positions {
63
+
64
+ @each $break_method,
65
+ $method in $break_methods {
66
+
67
+ @each $space_name,
68
+ $space in $space_classes {
69
+ $min_size: map-get($size_value, "min");
70
+ $max_size: map-get($size_value, "max");
71
+
72
+ .break_#{$break_method}_#{$size}\:#{$position_name}_#{$space_name} {
73
+ @if type-of($position) == "list" {
74
+ @if $break_method == "on" {
75
+ @each $coordinate in $position {
76
+ @include break_on($min_size, $max_size) {
77
+ #{$coordinate}: #{$space} !important;
78
+ }
79
+ }
80
+ }
81
+
82
+ @else {
83
+ @each $coordinate in $position {
84
+ @if ($max_size != null) {
85
+ @include break_at($max_size) {
86
+ #{$coordinate}: #{$space} !important;
87
+ }
88
+ }
58
89
  }
59
90
  }
60
91
  }
92
+
61
93
  @else {
62
- @include break_at( $max_size) {
63
- #{$position}: #{$space} !important;
94
+ @if $break_method == "on" {
95
+ @include break_on($min_size, $max_size) {
96
+ #{$position}: #{$space} !important;
97
+ }
98
+ }
99
+
100
+ @else {
101
+ @if ($max_size != null) {
102
+ @include break_at($max_size) {
103
+ #{$position}: #{$space} !important;
104
+ }
105
+ }
64
106
  }
65
107
  }
66
- }
67
- }
68
- }
108
+ }
109
+ }
110
+ }
111
+ }
69
112
  }
@@ -0,0 +1,3 @@
1
+ @import "../tokens/text_align";
2
+
3
+ @include global_props_responsive_css($text_align, 'text_align', 'text-align');
@@ -62,6 +62,7 @@ type FlexWrap = {
62
62
 
63
63
  type Hover = Shadow & {
64
64
  background?: string,
65
+ color?: string,
65
66
  scale?: "sm" | "md" | "lg"
66
67
  }
67
68
 
@@ -85,6 +86,8 @@ type Margin = {
85
86
  marginX?: AllSizes,
86
87
  marginY?: AllSizes,
87
88
  margin?: AllSizes,
89
+ break?: string,
90
+ default?: string
88
91
  }
89
92
 
90
93
  type MaxWidth = {
@@ -107,6 +110,8 @@ type Padding = {
107
110
  paddingX?: AllSizes,
108
111
  paddingY?: AllSizes,
109
112
  padding?: AllSizes,
113
+ break?: string,
114
+ default?: string
110
115
  }
111
116
 
112
117
  type Position = {
@@ -119,6 +124,10 @@ type Shadow = {
119
124
 
120
125
  type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
121
126
 
127
+ type TextAlign = {
128
+ textAlign?: "start" | "end" | "left" | "right" | "center" | "justify" | "justifyAll" | "matchParent",
129
+ }
130
+
122
131
  type ZIndexType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
123
132
  type ZIndexResponsiveType = {[key: string]: ZIndexType}
124
133
  type ZIndex = {
@@ -130,7 +139,7 @@ export type GlobalProps = AlignContent & AlignItems & AlignSelf &
130
139
  BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
131
140
  FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
132
141
  LineHeight & Margin & MaxWidth & NumberSpacing & Order & Padding &
133
- Position & Shadow & ZIndex & { hover?: string };
142
+ Position & Shadow & TextAlign & ZIndex & { hover?: string };
134
143
 
135
144
  const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
136
145
  const keys: string[] = Object.keys(prop)
@@ -149,6 +158,7 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
149
158
  css += hover.shadow ? `hover_shadow_${hover.shadow} ` : '';
150
159
  css += hover.background ? `hover_background_${hover.background } ` : '';
151
160
  css += hover.scale ? `hover_scale_${hover.scale} ` : '';
161
+ css += hover.color ? `hover_color_${hover.color } ` : '';
152
162
  return css;
153
163
  },
154
164
 
@@ -186,13 +196,24 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
186
196
  padding,
187
197
  };
188
198
 
199
+ const screenSizeValues = ["xs", "sm", "md", "lg", "xl"]
200
+
189
201
  function handleObjectValue(properties: Margin | Padding, prefix: string) {
190
202
  let classResult = '';
191
203
 
204
+ const breakValue = properties.break || "on";
205
+ const defaultValue = properties.default || null;
206
+
192
207
  Object.entries(properties).forEach(([key, value]) => {
193
- classResult += `${prefix}_${key}_${value} `;
208
+ if (screenSizeValues.includes(key)) {
209
+ classResult += `break_${breakValue}_${key}:${prefix}_${value} `;
210
+ }
194
211
  });
195
212
 
213
+ if (defaultValue) {
214
+ classResult += `${prefix}_${defaultValue} `;
215
+ }
216
+
196
217
  return classResult;
197
218
  }
198
219
 
@@ -377,6 +398,13 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
377
398
  css += position && position !== 'static' ? `position_${position}` : ''
378
399
  return css
379
400
  },
401
+ textAlignProps: ({ textAlign }: TextAlign) => {
402
+ if (typeof textAlign === 'object') {
403
+ return getResponsivePropClasses(textAlign, 'text_align')
404
+ } else {
405
+ return textAlign ? `text_align_${textAlign} ` : ''
406
+ }
407
+ }
380
408
  }
381
409
 
382
410
  type DefaultProps = {[key: string]: string} | Record<string, unknown>