playbook_ui 13.2.0 → 13.4.0.pre.alpha.PLAY973Hash1181
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_body/_body.scss +5 -0
- data/app/pb_kits/playbook/pb_body/_body.tsx +4 -1
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +19 -0
- data/app/pb_kits/playbook/pb_body/body.rb +8 -1
- data/app/pb_kits/playbook/pb_button/button.html.erb +2 -2
- data/app/pb_kits/playbook/pb_button/button.rb +3 -0
- data/app/pb_kits/playbook/pb_card/card.rb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -1
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +5 -1
- data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -2
- data/app/pb_kits/playbook/pb_file_upload/file_upload.rb +1 -1
- data/app/pb_kits/playbook/pb_kit/dateTime.ts +54 -23
- data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +1 -1
- data/app/pb_kits/playbook/pb_radio/radio.rb +1 -1
- data/app/pb_kits/playbook/pb_select/select.rb +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +1 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.rb +1 -1
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.rb +1 -1
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +1 -1
- data/app/pb_kits/playbook/pb_source/source.rb +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_header.html.erb +54 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_header.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_two_actions.jsx +3 -3
- data/app/pb_kits/playbook/pb_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_table_header.scss +31 -0
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +64 -0
- data/app/pb_kits/playbook/pb_table/table_header.rb +53 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -2
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +14 -7
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.html.erb +21 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.jsx +36 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.md +1 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +3 -1
- data/app/pb_kits/playbook/pb_title/_title.scss +8 -4
- data/app/pb_kits/playbook/pb_title/_title.tsx +4 -1
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +19 -0
- data/app/pb_kits/playbook/pb_title/title.rb +9 -2
- data/app/pb_kits/playbook/pb_toggle/toggle.rb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -1
- data/app/pb_kits/playbook/tokens/_spacing.scss +1 -1
- data/app/pb_kits/playbook/tokens/_text_align.scss +18 -0
- data/app/pb_kits/playbook/utilities/_hover.scss +4 -0
- data/app/pb_kits/playbook/utilities/_max_width.scss +4 -0
- data/app/pb_kits/playbook/utilities/_spacing.scss +92 -49
- data/app/pb_kits/playbook/utilities/_text_align.scss +3 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +30 -2
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/classnames.rb +1 -0
- data/lib/playbook/hover.rb +6 -2
- data/lib/playbook/kit_base.rb +4 -2
- data/lib/playbook/props/hash.rb +1 -1
- data/lib/playbook/spacing.rb +13 -4
- data/lib/playbook/text_align.rb +37 -0
- data/lib/playbook/version.rb +2 -2
- metadata +18 -7
@@ -11,7 +11,7 @@ module Playbook
|
|
11
11
|
prop :error
|
12
12
|
prop :inline, type: Playbook::Props::Boolean,
|
13
13
|
default: false
|
14
|
-
prop :input_options, type: Playbook::Props::
|
14
|
+
prop :input_options, type: Playbook::Props::HashProp,
|
15
15
|
default: {}
|
16
16
|
prop :label
|
17
17
|
prop :name
|
@@ -19,7 +19,7 @@ module Playbook
|
|
19
19
|
prop :required, type: Playbook::Props::Boolean,
|
20
20
|
default: false
|
21
21
|
prop :type, default: "text"
|
22
|
-
prop :validation, type: Playbook::Props::
|
22
|
+
prop :validation, type: Playbook::Props::HashProp,
|
23
23
|
default: {}
|
24
24
|
prop :value
|
25
25
|
prop :add_on, type: Playbook::Props::NestedProps,
|
@@ -5,7 +5,6 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
5
5
|
import { globalProps } from '../utilities/globalProps'
|
6
6
|
import DateTime from '../pb_kit/dateTime';
|
7
7
|
|
8
|
-
|
9
8
|
import Caption from '../pb_caption/_caption'
|
10
9
|
|
11
10
|
type TimestampProps = {
|
@@ -22,6 +21,7 @@ type TimestampProps = {
|
|
22
21
|
showUser?: boolean,
|
23
22
|
hideUpdated?: boolean,
|
24
23
|
showTimezone?: boolean,
|
24
|
+
unstyled?: boolean,
|
25
25
|
variant?: "default" | "elapsed" | "updated"
|
26
26
|
}
|
27
27
|
|
@@ -39,6 +39,7 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
|
|
39
39
|
showUser = false,
|
40
40
|
hideUpdated = false,
|
41
41
|
showTimezone = false,
|
42
|
+
unstyled = false,
|
42
43
|
variant = 'default',
|
43
44
|
} = props
|
44
45
|
|
@@ -85,7 +86,7 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
|
|
85
86
|
return `${updatedText} ${userDisplay} ${DateTime.fromNow(timestamp)}`
|
86
87
|
}
|
87
88
|
|
88
|
-
const
|
89
|
+
const timestampText = () => {
|
89
90
|
switch (variant) {
|
90
91
|
case 'updated':
|
91
92
|
return formatUpdatedString()
|
@@ -103,11 +104,17 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
|
|
103
104
|
className={classes}
|
104
105
|
>
|
105
106
|
<div className="pb_timestamp_kit">
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
107
|
+
{unstyled ? (
|
108
|
+
<div>
|
109
|
+
{timestampText()}
|
110
|
+
</div>
|
111
|
+
) : (
|
112
|
+
<Caption
|
113
|
+
dark={dark}
|
114
|
+
size="xs"
|
115
|
+
text={timestampText()}
|
116
|
+
/>
|
117
|
+
)}
|
111
118
|
</div>
|
112
119
|
</div>
|
113
120
|
)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= pb_rails("caption", props: { size: "xs", text: "Basic unstyled example" }) %>
|
2
|
+
|
3
|
+
<%= pb_rails("timestamp", props: {
|
4
|
+
timestamp: DateTime.now,
|
5
|
+
show_date: true,
|
6
|
+
align: "left",
|
7
|
+
unstyled: true,
|
8
|
+
}) %>
|
9
|
+
|
10
|
+
<br />
|
11
|
+
|
12
|
+
<%= pb_rails("caption", props: { size: "xs", text: "Example with wrapping typography kit" }) %>
|
13
|
+
|
14
|
+
<%= pb_rails("title", props: { size: 1 }) do %>
|
15
|
+
<%= pb_rails("timestamp", props: {
|
16
|
+
timestamp: DateTime.now,
|
17
|
+
show_date: true,
|
18
|
+
align: "left",
|
19
|
+
unstyled: true,
|
20
|
+
}) %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Caption, Timestamp, Title } from '../../'
|
3
|
+
|
4
|
+
const TimestampUnstyled = (props) => {
|
5
|
+
return (
|
6
|
+
<>
|
7
|
+
<Caption size="xs"
|
8
|
+
text="Basic unstyled example"
|
9
|
+
/>
|
10
|
+
<Timestamp
|
11
|
+
align="left"
|
12
|
+
showDate
|
13
|
+
timestamp={new Date()}
|
14
|
+
unstyled
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
|
18
|
+
<br />
|
19
|
+
|
20
|
+
<Caption size="xs"
|
21
|
+
text="Example with wrapping typography kit"
|
22
|
+
/>
|
23
|
+
<Title size={1}>
|
24
|
+
<Timestamp
|
25
|
+
align="left"
|
26
|
+
showDate
|
27
|
+
timestamp={new Date()}
|
28
|
+
unstyled
|
29
|
+
{...props}
|
30
|
+
/>
|
31
|
+
</Title>
|
32
|
+
</>
|
33
|
+
)
|
34
|
+
}
|
35
|
+
|
36
|
+
export default TimestampUnstyled
|
@@ -0,0 +1 @@
|
|
1
|
+
For alternative typography styles, you can pass a boolean prop called `unstyled` to the `Timestamp` kit and wrap it in any of our typography kits (`Title`, `Body`, etc.). This will allow the `Timestamp` kit to inherit any of our typography styles.
|
@@ -6,6 +6,7 @@ examples:
|
|
6
6
|
- timestamp_timezones: Timezones
|
7
7
|
- timestamp_updated: Last Updated by
|
8
8
|
- timestamp_elapsed: Time Ago
|
9
|
+
- timestamp_unstyled: Unstyled
|
9
10
|
|
10
11
|
react:
|
11
12
|
- timestamp_default: Default
|
@@ -13,7 +14,8 @@ examples:
|
|
13
14
|
- timestamp_timezones: Timezones
|
14
15
|
- timestamp_updated: Last Updated by
|
15
16
|
- timestamp_elapsed: Time Ago
|
16
|
-
|
17
|
+
- timestamp_unstyled: Unstyled
|
18
|
+
|
17
19
|
swift:
|
18
20
|
- timestamp_default_swift: Default
|
19
21
|
- timestamp_align_swift: Alignments
|
@@ -3,3 +3,4 @@ export { default as TimestampAlign } from './_timestamp_align.jsx'
|
|
3
3
|
export { default as TimestampTimezones } from './_timestamp_timezones.jsx'
|
4
4
|
export { default as TimestampUpdated } from './_timestamp_updated.jsx'
|
5
5
|
export { default as TimestampElapsed } from './_timestamp_elapsed.jsx'
|
6
|
+
export { default as TimestampUnstyled } from './_timestamp_unstyled.jsx'
|
@@ -4,5 +4,9 @@
|
|
4
4
|
data: object.data,
|
5
5
|
class: object.classname) do %>
|
6
6
|
|
7
|
-
|
7
|
+
<% if object.unstyled %>
|
8
|
+
<div><%= object.timestamp_text %></div>
|
9
|
+
<% else %>
|
10
|
+
<%= pb_rails("caption", props: { text: object.timestamp_text, size: 'xs', dark: object.dark }) %>
|
11
|
+
<% end %>
|
8
12
|
<% end %>
|
@@ -21,6 +21,8 @@ module Playbook
|
|
21
21
|
prop :show_user, type: Playbook::Props::Boolean,
|
22
22
|
default: false
|
23
23
|
prop :timezone, default: "America/New_York"
|
24
|
+
prop :unstyled, type: Playbook::Props::Boolean,
|
25
|
+
default: false
|
24
26
|
prop :variant, type: Playbook::Props::Enum,
|
25
27
|
values: %w[default elapsed updated],
|
26
28
|
default: "default"
|
@@ -29,7 +31,7 @@ module Playbook
|
|
29
31
|
generate_classname("pb_timestamp_kit", variant_class, align)
|
30
32
|
end
|
31
33
|
|
32
|
-
def
|
34
|
+
def timestamp_text
|
33
35
|
case variant
|
34
36
|
when "updated"
|
35
37
|
format_updated_string
|
@@ -27,14 +27,14 @@
|
|
27
27
|
@include title_colors;
|
28
28
|
}
|
29
29
|
|
30
|
-
&.dark {
|
31
|
-
@include pb_title_dark;
|
32
|
-
}
|
33
|
-
|
34
30
|
&[class*=_thin] {
|
35
31
|
@include pb_title_thin;
|
36
32
|
}
|
37
33
|
|
34
|
+
&[class*=_truncate] {
|
35
|
+
@include title_truncate;
|
36
|
+
}
|
37
|
+
|
38
38
|
@each $size, $size_value in $breakpoints_grid {
|
39
39
|
@each $title_size_value in [1, 2, 3, 4] {
|
40
40
|
$min_size: map-get($size_value, "min");
|
@@ -46,9 +46,13 @@
|
|
46
46
|
@else if $title_size_value == 3 { @include pb_title_3; }
|
47
47
|
@else if $title_size_value == 4 { @include pb_title_4; }
|
48
48
|
@include title_colors;
|
49
|
+
@include title_truncate;
|
49
50
|
@if $title_size_value != 4 { @include pb_title_bold; }
|
50
51
|
}
|
51
52
|
}
|
52
53
|
}
|
53
54
|
}
|
55
|
+
&.dark {
|
56
|
+
@include pb_title_dark;
|
57
|
+
}
|
54
58
|
}
|
@@ -17,6 +17,7 @@ type TitleProps = {
|
|
17
17
|
size?: SizeType | SizeResponsiveType,
|
18
18
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
|
19
19
|
text?: string,
|
20
|
+
truncate?: null | '1' | '2' | '3' | '4' | '5',
|
20
21
|
variant?: null | "link",
|
21
22
|
} & GlobalProps
|
22
23
|
|
@@ -33,12 +34,14 @@ const Title = (props: TitleProps): React.ReactElement => {
|
|
33
34
|
bold = true,
|
34
35
|
tag = 'h3',
|
35
36
|
text,
|
37
|
+
truncate = null,
|
36
38
|
variant = null,
|
37
39
|
} = props
|
38
40
|
|
39
41
|
const ariaProps: {[key: string]: string | number} = buildAriaProps(aria)
|
40
42
|
const dataProps: {[key: string]: string | number} = buildDataProps(data)
|
41
43
|
const getBold = bold ? '' : 'thin'
|
44
|
+
const isTruncated = truncate ? `truncate_${truncate}` : null
|
42
45
|
const isSizeNumberOrString = typeof size === "number" || typeof size === "string"
|
43
46
|
|
44
47
|
const buildResponsiveSizeCss = () => {
|
@@ -54,7 +57,7 @@ const Title = (props: TitleProps): React.ReactElement => {
|
|
54
57
|
}
|
55
58
|
|
56
59
|
const classes = classnames(
|
57
|
-
buildCss('pb_title_kit', isSizeNumberOrString ? `size_${size}` : "", variant, color, getBold),
|
60
|
+
buildCss('pb_title_kit', isSizeNumberOrString ? `size_${size}` : "", variant, color, getBold, isTruncated),
|
58
61
|
globalProps(props),
|
59
62
|
buildResponsiveSizeCss(),
|
60
63
|
className
|
@@ -15,4 +15,23 @@ $pb_title_colors: (
|
|
15
15
|
color: $color
|
16
16
|
}
|
17
17
|
}
|
18
|
+
}
|
19
|
+
|
20
|
+
$pb_title_truncate: (
|
21
|
+
truncate_1: 1,
|
22
|
+
truncate_2: 2,
|
23
|
+
truncate_3: 3,
|
24
|
+
truncate_4: 4,
|
25
|
+
truncate_5: 5
|
26
|
+
);
|
27
|
+
|
28
|
+
@mixin title_truncate {
|
29
|
+
@each $name, $number in $pb_title_truncate {
|
30
|
+
&[class*=_#{$name}] {
|
31
|
+
overflow: hidden;
|
32
|
+
display: -webkit-box;
|
33
|
+
-webkit-line-clamp: $number;
|
34
|
+
-webkit-box-orient: vertical;
|
35
|
+
}
|
36
|
+
}
|
18
37
|
}
|
@@ -16,12 +16,15 @@ module Playbook
|
|
16
16
|
default: nil,
|
17
17
|
deprecated: true
|
18
18
|
prop :bold, type: Playbook::Props::Boolean, default: true
|
19
|
+
prop :truncate, type: Playbook::Props::Enum,
|
20
|
+
values: [nil, "1", "2", "3", "4", "5"],
|
21
|
+
default: nil
|
19
22
|
|
20
23
|
def classname
|
21
24
|
if is_size_responsive
|
22
|
-
generate_classname("pb_title_kit", variant, color, is_bold) + generate_responsive_size_classname
|
25
|
+
generate_classname("pb_title_kit", variant, color, is_bold, is_truncated) + generate_responsive_size_classname
|
23
26
|
else
|
24
|
-
generate_classname("pb_title_kit", size, variant, color, is_bold)
|
27
|
+
generate_classname("pb_title_kit", size, variant, color, is_bold, is_truncated)
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
@@ -29,6 +32,10 @@ module Playbook
|
|
29
32
|
bold ? nil : "thin"
|
30
33
|
end
|
31
34
|
|
35
|
+
def is_truncated
|
36
|
+
truncate ? "truncate_#{truncate}" : nil
|
37
|
+
end
|
38
|
+
|
32
39
|
def is_size_responsive
|
33
40
|
try(:size).is_a?(::Hash)
|
34
41
|
end
|
@@ -5,7 +5,7 @@ require "action_view"
|
|
5
5
|
module Playbook
|
6
6
|
module PbToggle
|
7
7
|
class Toggle < Playbook::KitBase
|
8
|
-
prop :input_options, type: Playbook::Props::
|
8
|
+
prop :input_options, type: Playbook::Props::HashProp,
|
9
9
|
default: {}
|
10
10
|
|
11
11
|
prop :checked, type: Playbook::Props::Boolean,
|
@@ -19,7 +19,7 @@ module Playbook
|
|
19
19
|
prop :name
|
20
20
|
prop :options, type: Playbook::Props::HashArray,
|
21
21
|
default: []
|
22
|
-
prop :input_options, type: Playbook::Props::
|
22
|
+
prop :input_options, type: Playbook::Props::HashProp,
|
23
23
|
default: {}
|
24
24
|
|
25
25
|
prop :is_multi, type: Playbook::Props::Boolean,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
$text_align_start: start !default;
|
2
|
+
$text_align_end: end !default;
|
3
|
+
$text_align_left: left !default;
|
4
|
+
$text_align_right: right !default;
|
5
|
+
$text_align_center: center !default;
|
6
|
+
$text_align_justify: justify !default;
|
7
|
+
$text_align_justify_all: justify-all !default;
|
8
|
+
$text_align_match_parent: match-parent !default;
|
9
|
+
$text_align: (
|
10
|
+
start: $text_align_start,
|
11
|
+
end: $text_align_end,
|
12
|
+
left: $text_align_left,
|
13
|
+
right: $text_align_right,
|
14
|
+
center: $text_align_center,
|
15
|
+
justify: $text_align_justify,
|
16
|
+
justify_all: $text_align_justify_all,
|
17
|
+
match_parent: $text_align_match_parent
|
18
|
+
);
|
@@ -1,69 +1,112 @@
|
|
1
1
|
@import "../tokens/spacing";
|
2
2
|
|
3
3
|
$space_classes: (
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
@
|
63
|
-
|
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
|
}
|
@@ -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
|
-
|
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>
|