playbook_ui 14.13.0.pre.rc.7 → 14.13.0.pre.rc.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4443547b1a5c9ef47d8702b6d09e74fdd8a73a14307323a424d4c0d6580dbd5d
4
- data.tar.gz: bef5910654db94c1bdada85da5cb8d1df982ae55710ecb2bfc9cb3f0593214f4
3
+ metadata.gz: a70a04cb9c6635cdf015ef05241a256fb8aa5dd829067b64161096e82762cd6e
4
+ data.tar.gz: c98ed6c04422dc587bb8a887f854a87293121a0ab86faa7f2761c35110086bee
5
5
  SHA512:
6
- metadata.gz: 7d9f28c606c355f2821e3df6e0c2502b73d6c02007f4338744e54ae995d3abc9c830001ec97aeb1be4a1daba6ffd5a6a661ac1a2b76d47991f599924b8a90b84
7
- data.tar.gz: b60655fd7f28dc7c8ffd954a3adb405609e089b8788b5af2bad4b2c1180e68fc8dfec0e40aa51bf01aff0db95de5d9c08facf34f2fbc5e4fc737f0ebc88eceba
6
+ metadata.gz: 46d2504fc4b91834eb2780c920f2e43e10f810589dbed43e8c7ba2cb023be3b9b0921ef50249bc92d8f0f35b7d50384cff7b381d94fb767772fbcefb26f38339
7
+ data.tar.gz: e07b29f1643d80b0bb16c5b9e6e1eb0665ecd3773ab8cd2c5eb79e09b6b55822dc3ed03dccb4fc012839f73512abe30e3d517e478149150f826927afdd5836fa
@@ -39,8 +39,15 @@ export const TableHeaderCell = ({
39
39
  sortIcon,
40
40
  table
41
41
  }: TableHeaderCellProps) => {
42
- const { sortControl, responsive, selectableRows, hasAnySubRows, showActionsBar, inlineRowLoading } =
43
- useContext(AdvancedTableContext);
42
+ const {
43
+ sortControl,
44
+ responsive,
45
+ selectableRows,
46
+ hasAnySubRows,
47
+ showActionsBar,
48
+ inlineRowLoading,
49
+ isActionBarVisible,
50
+ } = useContext(AdvancedTableContext);
44
51
 
45
52
  type justifyTypes = "none" | "center" | "start" | "end" | "between" | "around" | "evenly"
46
53
 
@@ -65,7 +72,7 @@ export const TableHeaderCell = ({
65
72
 
66
73
  const cellClassName = classnames(
67
74
  "table-header-cells",
68
- `${showActionsBar && "header-cells-with-actions"}`,
75
+ `${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
69
76
  `${isChrome() ? "chrome-styles" : ""}`,
70
77
  `${enableSorting ? "table-header-cells-active" : ""}`,
71
78
  { "pinned-left": responsive === "scroll" && isPinnedLeft },
@@ -0,0 +1,26 @@
1
+ export const showActionBar = (elem: HTMLElement) => {
2
+ elem.style.display = "block";
3
+ const height = elem.scrollHeight + "px";
4
+ elem.style.height = height;
5
+ elem.classList.add("is-visible");
6
+ elem.style.overflow = "hidden";
7
+
8
+ window.setTimeout(() => {
9
+ if (elem.classList.contains("is-visible")) {
10
+ elem.style.height = "";
11
+ elem.style.overflow = "visible";
12
+ }
13
+ }, 300);
14
+ };
15
+
16
+ export const hideActionBar = (elem: HTMLElement) => {
17
+ elem.style.height = elem.scrollHeight + "px";
18
+ elem.offsetHeight;
19
+ window.setTimeout(() => {
20
+ elem.style.height = "0";
21
+ elem.style.overflow = "hidden";
22
+ }, 10);
23
+ window.setTimeout(() => {
24
+ elem.classList.remove("is-visible");
25
+ }, 300);
26
+ };
@@ -31,12 +31,12 @@
31
31
  width: 100%;
32
32
  }
33
33
 
34
- .row-selection-actions-card {
35
- border-bottom-right-radius: 0px !important;
36
- border-bottom-left-radius: 0px !important;
37
- border-bottom-color: transparent;
38
- }
39
-
34
+ .row-selection-actions-card {
35
+ border-bottom-right-radius: 0px !important;
36
+ border-bottom-left-radius: 0px !important;
37
+ border-bottom-color: transparent;
38
+ transition: height 300ms ease;
39
+ }
40
40
  .table-header-cells:first-child {
41
41
  min-width: 180px;
42
42
  }
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useCallback } from "react"
1
+ import React, { useState, useEffect, useCallback, useRef } from "react"
2
2
  import classnames from "classnames"
3
3
 
4
4
  import { GenericObject } from "../types"
@@ -27,6 +27,7 @@ import FlexItem from "../pb_flex/_flex_item"
27
27
  import AdvancedTableContext from "./Context/AdvancedTableContext"
28
28
 
29
29
  import { updateExpandAndCollapseState } from "./Utilities/ExpansionControlHelpers"
30
+ import { showActionBar, hideActionBar } from "./Utilities/ActionBarAnimationHelper"
30
31
 
31
32
  import { CustomCell } from "./Components/CustomCell"
32
33
  import { TableHeader } from "./SubKits/TableHeader"
@@ -295,6 +296,20 @@ const AdvancedTable = (props: AdvancedTableProps) => {
295
296
  const onPageChange = (page: number) => {
296
297
  table.setPageIndex(page - 1)
297
298
  }
299
+ //When to show the actions bar as a whole
300
+ const isActionBarVisible = selectableRows && showActionsBar && selectedRowsLength > 0
301
+
302
+ //Ref and useEffect for animating the actions bar
303
+ const cardRef = useRef(null);
304
+ useEffect(() => {
305
+ if (cardRef.current) {
306
+ if (isActionBarVisible) {
307
+ showActionBar(cardRef.current);
308
+ } else {
309
+ hideActionBar(cardRef.current);
310
+ }
311
+ }
312
+ }, [isActionBarVisible]);
298
313
 
299
314
  return (
300
315
  <div {...ariaProps}
@@ -311,6 +326,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
311
326
  expandedControl,
312
327
  handleExpandOrCollapse,
313
328
  inlineRowLoading,
329
+ isActionBarVisible,
314
330
  loading,
315
331
  responsive,
316
332
  setExpanded,
@@ -333,27 +349,24 @@ const AdvancedTable = (props: AdvancedTableProps) => {
333
349
  total={table.getPageCount()}
334
350
  />
335
351
  }
336
- {
337
- selectableRows && showActionsBar && (
338
- <Card className="row-selection-actions-card"
339
- padding="xs"
352
+ <Card
353
+ borderNone={!isActionBarVisible}
354
+ className={`${isActionBarVisible && "show-action-card row-selection-actions-card"}`}
355
+ htmlOptions={{ ref: cardRef as any }}
356
+ padding={`${isActionBarVisible ? "xs" : "none"}`}
357
+ >
358
+ <Flex alignItems="center"
359
+ justify="between"
360
+ >
361
+ <Caption color="light"
362
+ paddingLeft="xs"
363
+ size="xs"
340
364
  >
341
- <Flex alignItems="center"
342
- justify="between"
343
- >
344
- <Caption color="light"
345
- paddingLeft="xs"
346
- size="xs"
347
- >
348
- {selectedRowsLength} Selected
349
- </Caption>
350
- <FlexItem>
351
- {actions}
352
- </FlexItem>
353
- </Flex>
354
- </Card>
355
- )
356
- }
365
+ {selectedRowsLength} Selected
366
+ </Caption>
367
+ <FlexItem>{actions}</FlexItem>
368
+ </Flex>
369
+ </Card>
357
370
  <Table
358
371
  className={`${loading ? "content-loading" : ""}`}
359
372
  dark={dark}
@@ -18,7 +18,6 @@ type HomeAddressStreetProps = {
18
18
  className?: string,
19
19
  data?: { [key: string]: string },
20
20
  dark?: boolean,
21
- preserveCase?: boolean,
22
21
  emphasis: "street" | "city" | "none",
23
22
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
24
23
  homeId: string,
@@ -44,7 +43,6 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
44
43
  htmlOptions = {},
45
44
  homeId,
46
45
  homeUrl,
47
- preserveCase = false,
48
46
  target,
49
47
  newWindow,
50
48
  houseStyle,
@@ -79,8 +77,6 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
79
77
  return null
80
78
  }
81
79
 
82
- const formatStreetAdr = (address: string): string => preserveCase ? address : titleize(address)
83
-
84
80
  return (
85
81
  <div
86
82
  className={classes(className, dark)}
@@ -95,7 +91,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
95
91
  dark={dark}
96
92
  size={4}
97
93
  >
98
- {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
94
+ {joinPresent([titleize(address), houseStyle], ' · ')}
99
95
  </Title>
100
96
  <Title
101
97
  className="pb_home_address_street_address"
@@ -105,14 +101,14 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
105
101
  {titleize(addressCont)}
106
102
  </Title>
107
103
  <Body color="light">
108
- {`${titleize(city)}, ${state.toUpperCase()} ${zipcode}`}
104
+ {`${titleize(city)}, ${state} ${zipcode}`}
109
105
  </Body>
110
106
  </div>
111
107
  }
112
108
  {emphasis == 'city' &&
113
109
  <div>
114
110
  <Body color="light">
115
- {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
111
+ {joinPresent([titleize(address), houseStyle], ' · ')}
116
112
  </Body>
117
113
  <Body color="light">{titleize(addressCont)}</Body>
118
114
  <div>
@@ -122,7 +118,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
122
118
  size={4}
123
119
  tag="span"
124
120
  >
125
- {`${titleize(city)}, ${state.toUpperCase()}`}
121
+ {`${titleize(city)}, ${state}`}
126
122
  </Title>
127
123
  <Body
128
124
  color="light"
@@ -136,15 +132,15 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
136
132
  {emphasis == 'none' &&
137
133
  <div>
138
134
  <Body dark={dark}>
139
- {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
135
+ {joinPresent([titleize(address), houseStyle], ' · ')}
140
136
  </Body>
141
- <Body dark={dark}>{formatStreetAdr(addressCont)}</Body>
137
+ <Body dark={dark}>{titleize(addressCont)}</Body>
142
138
  <div>
143
139
  <Body
144
140
  color="light"
145
141
  dark={dark}
146
142
  >
147
- {`${titleize(city)}, ${state.toUpperCase()} ${zipcode}`}
143
+ {`${titleize(city)}, ${state} ${zipcode}`}
148
144
  </Body>
149
145
  </div>
150
146
  </div>
@@ -5,14 +5,12 @@ examples:
5
5
  - home_address_street_emphasis: Emphasis
6
6
  - home_address_street_modified: Modified
7
7
  - home_address_street_link: Link
8
- - home_address_street_formatting: Formatting
9
8
 
10
9
  react:
11
10
  - home_address_street_default: Default
12
11
  - home_address_street_emphasis: Emphasis
13
12
  - home_address_street_modified: Modified
14
13
  - home_address_street_link: Link
15
- - home_address_street_formatting: Formatting
16
14
 
17
15
  swift:
18
16
  - home_address_street_default_swift: Default
@@ -2,4 +2,3 @@ export { default as HomeAddressStreetDefault } from './_home_address_street_defa
2
2
  export { default as HomeAddressStreetEmphasis } from './_home_address_street_emphasis.jsx'
3
3
  export { default as HomeAddressStreetModified } from './_home_address_street_modified.jsx'
4
4
  export { default as HomeAddressStreetLink } from './_home_address_street_link.jsx'
5
- export { default as HomeAddressStreetFormatting } from './_home_address_street_formatting.jsx'
@@ -18,7 +18,6 @@ module Playbook
18
18
  prop :state
19
19
  prop :zipcode
20
20
  prop :territory
21
- prop :preserve_case, default: false
22
21
  prop :dark, type: Playbook::Props::Boolean, default: false
23
22
 
24
23
  def classname
@@ -30,7 +29,7 @@ module Playbook
30
29
  end
31
30
 
32
31
  def city_state
33
- [city&.titleize, state&.upcase].join(", ")
32
+ [city&.titleize, state].join(", ")
34
33
  end
35
34
 
36
35
  def zip
@@ -38,7 +37,7 @@ module Playbook
38
37
  end
39
38
 
40
39
  def address_house_style
41
- [format_street_address, house_style].join(separator)
40
+ [address&.titleize, house_style].join(separator)
42
41
  end
43
42
 
44
43
  def address_house_style2
@@ -49,14 +48,6 @@ module Playbook
49
48
  house_style ? " \u00b7 " : ""
50
49
  end
51
50
 
52
- def format_street_address
53
- preserve_case ? address : custom_titleize(address)
54
- end
55
-
56
- def custom_titleize(str)
57
- str.split(" ").map(&:capitalize).join(" ")
58
- end
59
-
60
51
  def city_emphasis_props
61
52
  {
62
53
  address_house_style: address_house_style,