playbook_ui 14.1.0.pre.alpha.PBNTR455ganttchartPOC3569 → 14.1.0.pre.alpha.PBNTR462starratingdefaultvalue3579
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_advanced_table/_advanced_table.scss +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_badge/_badge.scss +9 -0
- data/app/pb_kits/playbook/pb_badge/_badge.tsx +8 -3
- data/app/pb_kits/playbook/pb_badge/badge.rb +1 -1
- data/app/pb_kits/playbook/pb_badge/badge.test.js +17 -11
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.html.erb +13 -0
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.jsx +31 -12
- data/app/pb_kits/playbook/pb_button/_button.tsx +4 -1
- data/app/pb_kits/playbook/pb_button/button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/button.rb +4 -0
- data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +2 -2
- data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +5 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +3 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +4 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +3 -0
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +20 -1
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +21 -0
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +4 -2
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.rb +10 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +4 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +13 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.jsx +46 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +3 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_filter/filter.rb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +43 -25
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +6 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +4 -4
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +4 -0
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +0 -2
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +49 -13
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +164 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +19 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +62 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/data.js +23 -0
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +0 -7
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +10 -5
- data/app/pb_kits/playbook/pb_star_rating/index.js +88 -41
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +4 -2
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +19 -0
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx +0 -2
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +0 -1
- data/app/pb_kits/playbook/pb_time/_time.tsx +12 -8
- data/app/pb_kits/playbook/pb_time/time.html.erb +3 -3
- data/app/pb_kits/playbook/pb_time/time.rb +4 -0
- data/app/pb_kits/playbook/tokens/_container.scss +21 -0
- data/app/pb_kits/playbook/utilities/_min_width.scss +45 -0
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +20 -3
- data/app/pb_kits/playbook/utilities/icons/allicons.tsx +59 -0
- data/app/pb_kits/playbook/utilities/icons/clock.svg +9 -0
- data/app/pb_kits/playbook/utilities/icons/spinner.svg +3 -0
- data/app/pb_kits/playbook/utilities/icons/times.svg +3 -0
- data/dist/chunks/_typeahead-nSyn1ajB.js +22 -0
- data/dist/chunks/_weekday_stacked-iq_X37be.js +45 -0
- data/dist/chunks/{lib-XlOB2yGW.js → lib-D9uVVKnh.js} +2 -2
- data/dist/chunks/{pb_form_validation-mwEv7D-z.js → pb_form_validation-u2wnZ3oe.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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/classnames.rb +1 -0
- data/lib/playbook/spacing.rb +31 -2
- data/lib/playbook/version.rb +1 -1
- metadata +25 -9
- data/dist/chunks/_typeahead-B6CmTH6o.js +0 -22
- data/dist/chunks/_weekday_stacked-CNZpeoOR.js +0 -45
- /data/app/pb_kits/playbook/pb_pagination/docs/{_pagination_default.md → _pagination_default_rails.md} +0 -0
@@ -60,7 +60,6 @@ $flag-min-resolution: 192dpi;
|
|
60
60
|
}
|
61
61
|
|
62
62
|
.iti__flag {
|
63
|
-
background-image: url("https://intl-tel-input.com/intl-tel-input/img/flags.png");
|
64
63
|
border-radius: 1px;
|
65
64
|
}
|
66
65
|
|
@@ -197,10 +196,4 @@ $flag-min-resolution: 192dpi;
|
|
197
196
|
}
|
198
197
|
}
|
199
198
|
}
|
200
|
-
|
201
|
-
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: $flag-min-resolution) {
|
202
|
-
.iti__flag {
|
203
|
-
background-image: url("https://intl-tel-input.com/intl-tel-input/img/flags.png");
|
204
|
-
}
|
205
|
-
}
|
206
199
|
}
|
@@ -21,6 +21,8 @@ import classnames from "classnames";
|
|
21
21
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
22
22
|
import { uniqueId } from 'lodash';
|
23
23
|
|
24
|
+
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth'>
|
25
|
+
|
24
26
|
type PbPopoverProps = {
|
25
27
|
aria?: { [key: string]: string };
|
26
28
|
className?: string;
|
@@ -32,7 +34,7 @@ type PbPopoverProps = {
|
|
32
34
|
reference: PopperReference & any;
|
33
35
|
show?: boolean;
|
34
36
|
shouldClosePopover?: (arg0: boolean) => void;
|
35
|
-
} &
|
37
|
+
} & ModifiedGlobalProps & Omit<PopperProps<any>, 'children'>
|
36
38
|
& { children?: React.ReactChild[] | React.ReactChild }
|
37
39
|
|
38
40
|
// Prop enabled default modifiers here
|
@@ -80,10 +82,13 @@ const Popover = (props: PbPopoverProps) => {
|
|
80
82
|
targetId,
|
81
83
|
} = props;
|
82
84
|
|
85
|
+
const items = globalProps(props).split(' ')
|
86
|
+
const filteredItems = items.filter(item => !item.includes('min_width'))
|
87
|
+
const filteredGlobalProps = filteredItems.join(' ')
|
83
88
|
const popoverSpacing =
|
84
|
-
|
89
|
+
filteredGlobalProps.includes("dark") || !filteredGlobalProps
|
85
90
|
? "p_sm"
|
86
|
-
:
|
91
|
+
: filteredGlobalProps
|
87
92
|
const overflowHandling = maxHeight || maxWidth ? "overflow_handling" : "";
|
88
93
|
const zIndexStyle = zIndex ? { zIndex: zIndex } : {};
|
89
94
|
const widthHeightStyles = () => {
|
@@ -100,7 +105,7 @@ const Popover = (props: PbPopoverProps) => {
|
|
100
105
|
const htmlProps = buildHtmlProps(htmlOptions);
|
101
106
|
const classes = classnames(
|
102
107
|
buildCss("pb_popover_kit"),
|
103
|
-
|
108
|
+
filteredGlobalProps,
|
104
109
|
className
|
105
110
|
);
|
106
111
|
|
@@ -250,4 +255,4 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
|
|
250
255
|
);
|
251
256
|
};
|
252
257
|
|
253
|
-
export default PbReactPopover;
|
258
|
+
export default PbReactPopover;
|
@@ -1,119 +1,166 @@
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element"
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element"
|
2
2
|
|
3
|
-
const
|
4
|
-
const
|
3
|
+
const STAR_RATING_WRAPPER_SELECTOR = "[data-pb-star-rating-wrapper]"
|
4
|
+
const STAR_RATING_SELECTOR = "[data-pb-star-rating]"
|
5
|
+
const STAR_RATING_INPUT_DATA_SELECTOR = "[data-pb-star-rating-input]"
|
5
6
|
|
6
7
|
export default class PbStarRating extends PbEnhancedElement {
|
7
8
|
static get selector() {
|
8
|
-
return
|
9
|
+
return STAR_RATING_WRAPPER_SELECTOR
|
9
10
|
}
|
10
11
|
|
11
12
|
connect() {
|
12
|
-
this.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
this.addEventListeners()
|
14
|
+
this.handleFormReset()
|
15
|
+
this.setDefaultValue()
|
16
|
+
}
|
17
|
+
|
18
|
+
addEventListeners() {
|
19
|
+
this.element.querySelectorAll(STAR_RATING_SELECTOR).forEach(star => {
|
20
|
+
star.addEventListener("click", (event) => {
|
21
|
+
const clickedStarId = event.currentTarget.id
|
22
|
+
this.updateStarColors(clickedStarId)
|
23
|
+
this.updateHiddenInputValue(clickedStarId)
|
24
|
+
this.clearFormValidation()
|
25
|
+
})
|
17
26
|
|
18
|
-
document.querySelectorAll(STAR_RATING_SELECTOR).forEach(star => {
|
19
27
|
star.addEventListener("mouseenter", (event) => {
|
20
28
|
const hoveredStarId = event.currentTarget.id
|
21
|
-
this.updateStarHoverColors(hoveredStarId)
|
29
|
+
this.updateStarHoverColors(hoveredStarId)
|
22
30
|
})
|
23
31
|
|
24
32
|
star.addEventListener("mouseleave", () => {
|
25
|
-
this.removeStarHoverColors()
|
33
|
+
this.removeStarHoverColors()
|
26
34
|
})
|
27
35
|
|
28
36
|
star.addEventListener("keydown", (event) => {
|
29
37
|
if (event.key === 'Enter' || event.key === ' ') {
|
30
|
-
event.preventDefault()
|
31
|
-
this.handleStarClick(star.id)
|
38
|
+
event.preventDefault()
|
39
|
+
this.handleStarClick(star.id)
|
32
40
|
}
|
33
41
|
})
|
34
42
|
})
|
35
43
|
}
|
36
44
|
|
37
45
|
handleStarClick(starId) {
|
38
|
-
this.updateStarColors(starId)
|
39
|
-
this.updateHiddenInputValue(starId)
|
46
|
+
this.updateStarColors(starId)
|
47
|
+
this.updateHiddenInputValue(starId)
|
40
48
|
}
|
41
49
|
|
42
50
|
updateStarColors(clickedStarId) {
|
43
|
-
const allStars =
|
51
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
44
52
|
|
45
53
|
allStars.forEach(star => {
|
46
|
-
const starId = star.id
|
47
|
-
const icon = star.querySelector(".interactive-star-icon")
|
54
|
+
const starId = star.id
|
55
|
+
const icon = star.querySelector(".interactive-star-icon")
|
48
56
|
|
49
57
|
if (icon) {
|
50
58
|
if (starId <= clickedStarId) {
|
51
59
|
if (star.classList.contains("yellow_star")) {
|
52
|
-
icon.classList.add("yellow-star-selected")
|
60
|
+
icon.classList.add("yellow-star-selected")
|
53
61
|
} else if (star.classList.contains("primary_star_light")) {
|
54
|
-
icon.classList.add("primary-star-selected")
|
62
|
+
icon.classList.add("primary-star-selected")
|
55
63
|
} else if (star.classList.contains("primary_star_dark")) {
|
56
|
-
icon.classList.add("primary-star-selected")
|
64
|
+
icon.classList.add("primary-star-selected")
|
57
65
|
} else if (star.classList.contains("subtle_star_light")) {
|
58
|
-
icon.classList.add("subtle-star-selected")
|
66
|
+
icon.classList.add("subtle-star-selected")
|
59
67
|
} else if (star.classList.contains("subtle_star_dark")) {
|
60
|
-
icon.classList.add("subtle-star-selected")
|
68
|
+
icon.classList.add("subtle-star-selected")
|
61
69
|
} else {
|
62
|
-
icon.classList.add("yellow-star-selected")
|
70
|
+
icon.classList.add("yellow-star-selected")
|
63
71
|
}
|
64
72
|
} else {
|
65
|
-
icon.classList.remove("yellow-star-selected", "primary-star-selected", "subtle-star-selected")
|
73
|
+
icon.classList.remove("yellow-star-selected", "primary-star-selected", "subtle-star-selected")
|
66
74
|
}
|
67
|
-
icon.classList.remove("star-hovered")
|
75
|
+
icon.classList.remove("star-hovered")
|
68
76
|
}
|
69
|
-
})
|
77
|
+
})
|
70
78
|
}
|
71
79
|
|
72
80
|
updateHiddenInputValue(value) {
|
73
|
-
const hiddenInput =
|
81
|
+
const hiddenInput = this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR)
|
74
82
|
if (hiddenInput) {
|
75
|
-
hiddenInput.value = value
|
83
|
+
hiddenInput.value = value
|
76
84
|
}
|
77
85
|
}
|
78
86
|
|
79
87
|
updateStarHoverColors(hoveredStarId) {
|
80
|
-
const allStars =
|
88
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
81
89
|
|
82
90
|
allStars.forEach(star => {
|
83
|
-
const starId = star.id
|
84
|
-
const icon = star.querySelector(".interactive-star-icon")
|
91
|
+
const starId = star.id
|
92
|
+
const icon = star.querySelector(".interactive-star-icon")
|
85
93
|
|
86
94
|
if (icon) {
|
87
95
|
if (starId <= hoveredStarId) {
|
88
96
|
if (!icon.classList.contains("yellow-star-selected") &&
|
89
97
|
!icon.classList.contains("primary-star-selected") &&
|
90
98
|
!icon.classList.contains("subtle-star-selected")) {
|
91
|
-
icon.classList.add("star-hovered")
|
99
|
+
icon.classList.add("star-hovered")
|
92
100
|
}
|
93
101
|
} else {
|
94
|
-
icon.classList.remove("star-hovered")
|
102
|
+
icon.classList.remove("star-hovered")
|
95
103
|
}
|
96
104
|
}
|
97
|
-
})
|
105
|
+
})
|
98
106
|
}
|
99
107
|
|
100
108
|
|
101
109
|
removeStarHoverColors() {
|
102
|
-
const allStars =
|
110
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
103
111
|
|
104
112
|
allStars.forEach(star => {
|
105
|
-
const icon = star.querySelector(".interactive-star-icon")
|
113
|
+
const icon = star.querySelector(".interactive-star-icon")
|
106
114
|
if (icon) {
|
107
115
|
if (!icon.classList.contains("yellow-star-selected") &&
|
108
116
|
!icon.classList.contains("primary-star-selected") &&
|
109
117
|
!icon.classList.contains("subtle-star-selected")) {
|
110
|
-
icon.classList.remove("star-hovered")
|
118
|
+
icon.classList.remove("star-hovered")
|
111
119
|
}
|
112
120
|
}
|
113
|
-
})
|
121
|
+
})
|
114
122
|
}
|
115
123
|
|
116
124
|
isStarSelected() {
|
117
|
-
return
|
125
|
+
return this.element.querySelectorAll(".yellow-star-selected, .primary-star-selected, .subtle-star-selected").length > 0
|
126
|
+
}
|
127
|
+
|
128
|
+
handleFormReset() {
|
129
|
+
const form = this.element.closest("form")
|
130
|
+
if (form) {
|
131
|
+
form.addEventListener("reset", () => {
|
132
|
+
this.updateHiddenInputValue("")
|
133
|
+
this.resetStarRatingValues()
|
134
|
+
})
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
resetStarRatingValues() {
|
139
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
140
|
+
allStars.forEach(star => {
|
141
|
+
const icon = star.querySelector(".interactive-star-icon")
|
142
|
+
if (icon) {
|
143
|
+
icon.classList.remove("yellow-star-selected", "primary-star-selected", "subtle-star-selected")
|
144
|
+
}
|
145
|
+
})
|
146
|
+
}
|
147
|
+
|
148
|
+
clearFormValidation() {
|
149
|
+
const hiddenInput = this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR)
|
150
|
+
if (hiddenInput.checkValidity()) {
|
151
|
+
const errorLabelElement = this.element.querySelector(".pb_body_kit_negative")
|
152
|
+
if (errorLabelElement) {
|
153
|
+
errorLabelElement.remove()
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
setDefaultValue() {
|
159
|
+
const hiddenInput = this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR)
|
160
|
+
const defaultValue = hiddenInput.value
|
161
|
+
|
162
|
+
if (defaultValue) {
|
163
|
+
this.updateStarColors(defaultValue)
|
164
|
+
}
|
118
165
|
}
|
119
166
|
}
|
@@ -39,11 +39,13 @@
|
|
39
39
|
<% end %>
|
40
40
|
|
41
41
|
<% else %>
|
42
|
-
<%= pb_rails("flex", props: { orientation: "column" }) do %>
|
42
|
+
<%= pb_rails("flex", props: { data: {"pb-star-rating-wrapper": "true" }, orientation: "column" }) do %>
|
43
43
|
<% if object.label.present? %>
|
44
44
|
<%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
|
45
45
|
<% end %>
|
46
|
-
|
46
|
+
|
47
|
+
<%= hidden_input_tag %>
|
48
|
+
|
47
49
|
<%= pb_rails("flex", props: { orientation: "row" }) do %>
|
48
50
|
<% object.denominator.times do |index| %>
|
49
51
|
<div data-pb-star-rating id="<%= index + 1 %>" class="<%= star_color %>">
|
@@ -30,6 +30,11 @@ module Playbook
|
|
30
30
|
default: "display"
|
31
31
|
prop :label, type: Playbook::Props::String
|
32
32
|
prop :name, type: Playbook::Props::String
|
33
|
+
prop :required, type: Playbook::Props::Boolean,
|
34
|
+
default: false
|
35
|
+
prop :input_options, type: Playbook::Props::HashProp,
|
36
|
+
default: {}
|
37
|
+
prop :default_value
|
33
38
|
|
34
39
|
def one_decimal_rating
|
35
40
|
rating.to_f.round(1)
|
@@ -106,6 +111,20 @@ module Playbook
|
|
106
111
|
def classname
|
107
112
|
generate_classname("pb_star_rating_kit")
|
108
113
|
end
|
114
|
+
|
115
|
+
def hidden_input_tag
|
116
|
+
tag(:input, all_input_options)
|
117
|
+
end
|
118
|
+
|
119
|
+
def all_input_options
|
120
|
+
input_options.merge(
|
121
|
+
data: { "pb-star-rating-input": true },
|
122
|
+
name: name,
|
123
|
+
required: required,
|
124
|
+
style: "display: none",
|
125
|
+
value: default_value || ""
|
126
|
+
)
|
127
|
+
end
|
109
128
|
end
|
110
129
|
end
|
111
130
|
end
|
@@ -36,7 +36,6 @@ const StarRatingDisplay = (props: StarRatingDisplayProps) => {
|
|
36
36
|
<Icon
|
37
37
|
className={starIcon[colorOption].className}
|
38
38
|
customIcon={starIcon[colorOption].icon as unknown as { [key: string]: SVGElement }}
|
39
|
-
icon=""
|
40
39
|
/>
|
41
40
|
</React.Fragment>
|
42
41
|
))}
|
@@ -45,7 +44,6 @@ const StarRatingDisplay = (props: StarRatingDisplayProps) => {
|
|
45
44
|
<Icon
|
46
45
|
className={starIcon[backgroundType].className}
|
47
46
|
customIcon={starIcon[backgroundType].icon as unknown as { [key: string]: SVGElement }}
|
48
|
-
icon=""
|
49
47
|
/>
|
50
48
|
</React.Fragment>
|
51
49
|
))}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
|
4
|
+
import { getAllIcons } from "../utilities/icons/allicons"
|
4
5
|
import { buildCss, buildHtmlProps } from "../utilities/props";
|
5
6
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
6
7
|
import DateTime from '../pb_kit/dateTime';
|
@@ -42,7 +43,7 @@ const Time = (props: TimeProps): React.ReactElement => {
|
|
42
43
|
globalProps(props),
|
43
44
|
className
|
44
45
|
);
|
45
|
-
|
46
|
+
const clockIcon = getAllIcons()["clock"]
|
46
47
|
const htmlProps = buildHtmlProps(htmlOptions);
|
47
48
|
|
48
49
|
return (
|
@@ -54,9 +55,10 @@ const Time = (props: TimeProps): React.ReactElement => {
|
|
54
55
|
unstyled
|
55
56
|
? (
|
56
57
|
<span>
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
<Icon
|
59
|
+
className="svg-inline--fa clock"
|
60
|
+
customIcon={clockIcon.icon as unknown as { [key: string]: SVGElement }}
|
61
|
+
/>
|
60
62
|
{" "}
|
61
63
|
</span>
|
62
64
|
)
|
@@ -65,10 +67,12 @@ const Time = (props: TimeProps): React.ReactElement => {
|
|
65
67
|
<Body color="light"
|
66
68
|
tag="span"
|
67
69
|
>
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
<Icon
|
71
|
+
className="svg-inline--fa clock"
|
72
|
+
customIcon={clockIcon.icon as unknown as { [key: string]: SVGElement }}
|
73
|
+
fixedWidth
|
74
|
+
size={size === "md" ? "" : "sm"}
|
75
|
+
/>
|
72
76
|
{" "}
|
73
77
|
</Body>
|
74
78
|
</>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<% if object.unstyled %>
|
14
14
|
<% if object.show_icon %>
|
15
15
|
<span>
|
16
|
-
<%= pb_rails("icon", props: {
|
16
|
+
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine.root.join(clock_icon), fixed_width: true }) %>
|
17
17
|
</span>
|
18
18
|
<% end %>
|
19
19
|
|
@@ -27,7 +27,7 @@
|
|
27
27
|
<% elsif size == "md" %>
|
28
28
|
<% if object.show_icon %>
|
29
29
|
<%= pb_rails("body", props: { color: "light", tag: "span"}) do %>
|
30
|
-
<%= pb_rails("icon", props: {
|
30
|
+
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine.root.join(clock_icon), fixed_width: true }) %>
|
31
31
|
<% end %>
|
32
32
|
<% end %>
|
33
33
|
|
@@ -41,7 +41,7 @@
|
|
41
41
|
<% else %>
|
42
42
|
<% if object.show_icon %>
|
43
43
|
<%= pb_rails("body", props: { color: "light", tag: "span"}) do %>
|
44
|
-
<%= pb_rails("icon", props: {
|
44
|
+
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine.root.join(clock_icon), fixed_width: true, size: "sm" }) %>
|
45
45
|
<% end %>
|
46
46
|
<% end %>
|
47
47
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$container_0: 0% !default;
|
2
|
+
$container_xxs: 320px !default;
|
3
|
+
$container_xs: 360px !default;
|
4
|
+
$container_sm: 540px !default;
|
5
|
+
$container_md: 720px !default;
|
6
|
+
$container_lg: 960px !default;
|
7
|
+
$container_xl: 1140px !default;
|
8
|
+
$container_xxl: 1320px !default;
|
9
|
+
$container_100: 100% !default;
|
10
|
+
$containers: (
|
11
|
+
container_0: $container_0,
|
12
|
+
container_xxs: $container_xxs,
|
13
|
+
container_xs: $container_xs,
|
14
|
+
container_sm: $container_sm,
|
15
|
+
container_md: $container_md,
|
16
|
+
container_lg: $container_lg,
|
17
|
+
container_xl: $container_xl,
|
18
|
+
container_xxl: $container_xxl,
|
19
|
+
container_100: $container_100,
|
20
|
+
none: 0,
|
21
|
+
);
|
@@ -0,0 +1,45 @@
|
|
1
|
+
@import "../tokens/container";
|
2
|
+
|
3
|
+
.min_width_0 {
|
4
|
+
min-width: map-get($containers, 'none');
|
5
|
+
}
|
6
|
+
|
7
|
+
.min_with_0_percent {
|
8
|
+
min-width: $container_0;
|
9
|
+
}
|
10
|
+
|
11
|
+
.min_width_xxs {
|
12
|
+
min-width: $container_xxs;
|
13
|
+
}
|
14
|
+
|
15
|
+
.min_width_xs {
|
16
|
+
min-width: $container_xs;
|
17
|
+
}
|
18
|
+
|
19
|
+
.min_width_sm {
|
20
|
+
min-width: $container_sm;
|
21
|
+
}
|
22
|
+
|
23
|
+
.min_width_md {
|
24
|
+
min-width: $container_md;
|
25
|
+
}
|
26
|
+
|
27
|
+
.min_width_lg {
|
28
|
+
min-width: $container_lg;
|
29
|
+
}
|
30
|
+
|
31
|
+
.min_width_xl {
|
32
|
+
min-width: $container_xl;
|
33
|
+
}
|
34
|
+
|
35
|
+
.min_width_xxl {
|
36
|
+
min-width: $container_xxl;
|
37
|
+
}
|
38
|
+
|
39
|
+
.min_width_100_percent {
|
40
|
+
min-width: $container_100;
|
41
|
+
}
|
42
|
+
|
43
|
+
.minwidth-resize {
|
44
|
+
resize: horizontal;
|
45
|
+
}
|
@@ -94,6 +94,10 @@ type MaxWidth = {
|
|
94
94
|
maxWidth?: Sizes,
|
95
95
|
}
|
96
96
|
|
97
|
+
type MinWidth = {
|
98
|
+
minWidth?: Sizes,
|
99
|
+
}
|
100
|
+
|
97
101
|
type NumberSpacing = {
|
98
102
|
numberSpacing?: "tabular",
|
99
103
|
}
|
@@ -170,7 +174,7 @@ type ZIndex = {
|
|
170
174
|
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
171
175
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
172
176
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
173
|
-
LineHeight & Margin & MaxWidth & NumberSpacing & Order & Overflow & Padding &
|
177
|
+
LineHeight & Margin & MinWidth & MaxWidth & NumberSpacing & Order & Overflow & Padding &
|
174
178
|
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left;
|
175
179
|
|
176
180
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
@@ -194,6 +198,14 @@ const getPositioningPropsClasses = (position: string, value: Sizes | {value: str
|
|
194
198
|
return css;
|
195
199
|
};
|
196
200
|
|
201
|
+
const filterClassName = (value: string): string => {
|
202
|
+
if (value.includes("%")) {
|
203
|
+
return value.replace("%", "_percent");
|
204
|
+
} else {
|
205
|
+
return value;
|
206
|
+
}
|
207
|
+
};
|
208
|
+
|
197
209
|
// Prop categories
|
198
210
|
const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} = {
|
199
211
|
|
@@ -320,10 +332,15 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
320
332
|
css += numberSpacing ? `ns_${numberSpacing} ` : ''
|
321
333
|
return css
|
322
334
|
},
|
335
|
+
minWidthProps: ({ minWidth }: MinWidth) => {
|
336
|
+
let css = ''
|
337
|
+
css += minWidth ? `min_width_${filterClassName(minWidth)} ` : ''
|
338
|
+
return css.trimEnd()
|
339
|
+
},
|
323
340
|
maxWidthProps: ({ maxWidth }: MaxWidth) => {
|
324
341
|
let css = ''
|
325
|
-
css += maxWidth ? `max_width_${maxWidth
|
326
|
-
return css
|
342
|
+
css += maxWidth ? `max_width_${filterClassName(maxWidth)} ` : ''
|
343
|
+
return css.trimEnd()
|
327
344
|
},
|
328
345
|
zIndexProps: (zIndex: ZIndex) => {
|
329
346
|
let css = ''
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
const spinner = (
|
4
|
+
<svg
|
5
|
+
fill="none"
|
6
|
+
height="25"
|
7
|
+
viewBox="0 0 31 25"
|
8
|
+
width="31"
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
10
|
+
>
|
11
|
+
<path d="M17.4043 1.85547C17.4043 2.69922 16.7012 3.35547 15.9043 3.35547C15.0605 3.35547 14.4043 2.69922 14.4043 1.85547C14.4043 1.05859 15.0605 0.355469 15.9043 0.355469C16.7012 0.355469 17.4043 1.05859 17.4043 1.85547ZM17.4043 22.8555C17.4043 23.6992 16.7012 24.3555 15.9043 24.3555C15.0605 24.3555 14.4043 23.6992 14.4043 22.8555C14.4043 22.0586 15.0605 21.3555 15.9043 21.3555C16.7012 21.3555 17.4043 22.0586 17.4043 22.8555ZM24.9043 12.3555C24.9043 11.5586 25.5605 10.8555 26.4043 10.8555C27.2012 10.8555 27.9043 11.5586 27.9043 12.3555C27.9043 13.1992 27.2012 13.8555 26.4043 13.8555C25.5605 13.8555 24.9043 13.1992 24.9043 12.3555ZM5.4043 13.8555C4.56055 13.8555 3.9043 13.1992 3.9043 12.3555C3.9043 11.5586 4.56055 10.8555 5.4043 10.8555C6.20117 10.8555 6.9043 11.5586 6.9043 12.3555C6.9043 13.1992 6.20117 13.8555 5.4043 13.8555ZM7.41992 20.8398C6.81055 20.2773 6.81055 19.3398 7.41992 18.7305C7.98242 18.168 8.91992 18.168 9.5293 18.7305C10.0918 19.3398 10.0918 20.2773 9.5293 20.8398C8.91992 21.4492 7.98242 21.4492 7.41992 20.8398ZM22.2324 20.8398C21.8574 20.5117 21.6699 19.9023 21.8105 19.3867C21.9512 18.8711 22.373 18.4492 22.8887 18.3086C23.4043 18.168 24.0137 18.3555 24.3887 18.7305C24.7637 19.1055 24.9512 19.668 24.8105 20.2305C24.6699 20.7461 24.248 21.168 23.7324 21.3086C23.1699 21.4492 22.6074 21.2617 22.2324 20.8398ZM7.41992 3.87109C7.98242 3.30859 8.91992 3.30859 9.5293 3.87109C10.0918 4.48047 10.0918 5.41797 9.5293 6.02734C8.91992 6.58984 7.98242 6.58984 7.41992 6.02734C6.81055 5.41797 6.81055 4.48047 7.41992 3.87109Z"
|
12
|
+
fill="#242B42"
|
13
|
+
/>
|
14
|
+
</svg>
|
15
|
+
)
|
16
|
+
|
17
|
+
const clock = (
|
18
|
+
<svg
|
19
|
+
fill="none"
|
20
|
+
height="25"
|
21
|
+
viewBox="0 0 31 25"
|
22
|
+
width="31"
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
>
|
25
|
+
<path d="M25.1221 12C25.1221 8.53125 23.2471 5.34375 20.2471 3.5625C17.2002 1.82812 13.4971 1.82812 10.4971 3.5625C7.4502 5.34375 5.62207 8.53125 5.62207 12C5.62207 15.5156 7.4502 18.7031 10.4971 20.4844C13.4971 22.2188 17.2002 22.2188 20.2471 20.4844C23.2471 18.7031 25.1221 15.5156 25.1221 12ZM3.37207 12C3.37207 7.73438 5.62207 3.79688 9.37207 1.64062C13.0752 -0.515625 17.6221 -0.515625 21.3721 1.64062C25.0752 3.79688 27.3721 7.73438 27.3721 12C27.3721 16.3125 25.0752 20.25 21.3721 22.4062C17.6221 24.5625 13.0752 24.5625 9.37207 22.4062C5.62207 20.25 3.37207 16.3125 3.37207 12ZM14.2471 5.625C14.2471 5.01562 14.7158 4.5 15.3721 4.5C15.9814 4.5 16.4971 5.01562 16.4971 5.625V11.4375L20.4814 14.0625C20.9971 14.4375 21.1377 15.1406 20.8096 15.6562C20.4346 16.1719 19.7314 16.3125 19.2158 15.9375L14.7158 12.9375C14.4346 12.75 14.2471 12.375 14.2471 12V5.625Z"
|
26
|
+
fill="#242B42"
|
27
|
+
/>
|
28
|
+
</svg>
|
29
|
+
)
|
30
|
+
|
31
|
+
const times = (
|
32
|
+
<svg
|
33
|
+
fill="none"
|
34
|
+
height="25"
|
35
|
+
viewBox="0 0 31 25"
|
36
|
+
width="31"
|
37
|
+
xmlns="http://www.w3.org/2000/svg"
|
38
|
+
>
|
39
|
+
<path
|
40
|
+
d="M23.0762 6.77734L17.4512 12.4023L23.0293 17.9805C23.498 18.4023 23.498 19.1055 23.0293 19.5273C22.6074 19.9961 21.9043 19.9961 21.4824 19.5273L15.8574 13.9492L10.2793 19.5273C9.85742 19.9961 9.1543 19.9961 8.73242 19.5273C8.26367 19.1055 8.26367 18.4023 8.73242 17.9336L14.3105 12.3555L8.73242 6.77734C8.26367 6.35547 8.26367 5.65234 8.73242 5.18359C9.1543 4.76172 9.85742 4.76172 10.3262 5.18359L15.9043 10.8086L21.4824 5.23047C21.9043 4.76172 22.6074 4.76172 23.0762 5.23047C23.498 5.65234 23.498 6.35547 23.0762 6.77734Z"
|
41
|
+
fill="#242B42"
|
42
|
+
/>
|
43
|
+
</svg>
|
44
|
+
)
|
45
|
+
|
46
|
+
export const getAllIcons = () => {
|
47
|
+
|
48
|
+
return {
|
49
|
+
clock: {
|
50
|
+
icon: clock
|
51
|
+
},
|
52
|
+
spinner: {
|
53
|
+
icon: spinner
|
54
|
+
},
|
55
|
+
times: {
|
56
|
+
icon: times
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<svg
|
2
|
+
fill="none"
|
3
|
+
height="25"
|
4
|
+
viewBox="0 0 31 25"
|
5
|
+
width="31"
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
7
|
+
>
|
8
|
+
<path d="M25.1221 12C25.1221 8.53125 23.2471 5.34375 20.2471 3.5625C17.2002 1.82812 13.4971 1.82812 10.4971 3.5625C7.4502 5.34375 5.62207 8.53125 5.62207 12C5.62207 15.5156 7.4502 18.7031 10.4971 20.4844C13.4971 22.2188 17.2002 22.2188 20.2471 20.4844C23.2471 18.7031 25.1221 15.5156 25.1221 12ZM3.37207 12C3.37207 7.73438 5.62207 3.79688 9.37207 1.64062C13.0752 -0.515625 17.6221 -0.515625 21.3721 1.64062C25.0752 3.79688 27.3721 7.73438 27.3721 12C27.3721 16.3125 25.0752 20.25 21.3721 22.4062C17.6221 24.5625 13.0752 24.5625 9.37207 22.4062C5.62207 20.25 3.37207 16.3125 3.37207 12ZM14.2471 5.625C14.2471 5.01562 14.7158 4.5 15.3721 4.5C15.9814 4.5 16.4971 5.01562 16.4971 5.625V11.4375L20.4814 14.0625C20.9971 14.4375 21.1377 15.1406 20.8096 15.6562C20.4346 16.1719 19.7314 16.3125 19.2158 15.9375L14.7158 12.9375C14.4346 12.75 14.2471 12.375 14.2471 12V5.625Z" fill="#242B42" />
|
9
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="31" height="25" viewBox="0 0 31 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M17.4043 1.85547C17.4043 2.69922 16.7012 3.35547 15.9043 3.35547C15.0605 3.35547 14.4043 2.69922 14.4043 1.85547C14.4043 1.05859 15.0605 0.355469 15.9043 0.355469C16.7012 0.355469 17.4043 1.05859 17.4043 1.85547ZM17.4043 22.8555C17.4043 23.6992 16.7012 24.3555 15.9043 24.3555C15.0605 24.3555 14.4043 23.6992 14.4043 22.8555C14.4043 22.0586 15.0605 21.3555 15.9043 21.3555C16.7012 21.3555 17.4043 22.0586 17.4043 22.8555ZM24.9043 12.3555C24.9043 11.5586 25.5605 10.8555 26.4043 10.8555C27.2012 10.8555 27.9043 11.5586 27.9043 12.3555C27.9043 13.1992 27.2012 13.8555 26.4043 13.8555C25.5605 13.8555 24.9043 13.1992 24.9043 12.3555ZM5.4043 13.8555C4.56055 13.8555 3.9043 13.1992 3.9043 12.3555C3.9043 11.5586 4.56055 10.8555 5.4043 10.8555C6.20117 10.8555 6.9043 11.5586 6.9043 12.3555C6.9043 13.1992 6.20117 13.8555 5.4043 13.8555ZM7.41992 20.8398C6.81055 20.2773 6.81055 19.3398 7.41992 18.7305C7.98242 18.168 8.91992 18.168 9.5293 18.7305C10.0918 19.3398 10.0918 20.2773 9.5293 20.8398C8.91992 21.4492 7.98242 21.4492 7.41992 20.8398ZM22.2324 20.8398C21.8574 20.5117 21.6699 19.9023 21.8105 19.3867C21.9512 18.8711 22.373 18.4492 22.8887 18.3086C23.4043 18.168 24.0137 18.3555 24.3887 18.7305C24.7637 19.1055 24.9512 19.668 24.8105 20.2305C24.6699 20.7461 24.248 21.168 23.7324 21.3086C23.1699 21.4492 22.6074 21.2617 22.2324 20.8398ZM7.41992 3.87109C7.98242 3.30859 8.91992 3.30859 9.5293 3.87109C10.0918 4.48047 10.0918 5.41797 9.5293 6.02734C8.91992 6.58984 7.98242 6.58984 7.41992 6.02734C6.81055 5.41797 6.81055 4.48047 7.41992 3.87109Z" fill="#242B42"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="31" height="25" viewBox="0 0 31 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M23.0762 6.77734L17.4512 12.4023L23.0293 17.9805C23.498 18.4023 23.498 19.1055 23.0293 19.5273C22.6074 19.9961 21.9043 19.9961 21.4824 19.5273L15.8574 13.9492L10.2793 19.5273C9.85742 19.9961 9.1543 19.9961 8.73242 19.5273C8.26367 19.1055 8.26367 18.4023 8.73242 17.9336L14.3105 12.3555L8.73242 6.77734C8.26367 6.35547 8.26367 5.65234 8.73242 5.18359C9.1543 4.76172 9.85742 4.76172 10.3262 5.18359L15.9043 10.8086L21.4824 5.23047C21.9043 4.76172 22.6074 4.76172 23.0762 5.23047C23.498 5.65234 23.498 6.35547 23.0762 6.77734Z" fill="#242B42"/>
|
3
|
+
</svg>
|