playbook_ui 12.37.0 → 12.38.0.pre.alpha.PLAY966collapsiblenav41086

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
  3. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
  4. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +10 -9
  5. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
  6. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
  7. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +4 -8
  8. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
  9. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
  10. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +75 -0
  11. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
  12. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
  13. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
  14. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
  15. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
  16. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
  17. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
  18. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
  19. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
  20. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
  21. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
  22. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
  23. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
  24. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
  25. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
  26. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
  27. data/app/pb_kits/playbook/pb_kit/dateTime.ts +146 -63
  28. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
  29. data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
  30. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +280 -17
  31. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
  32. data/app/pb_kits/playbook/pb_nav/_item.tsx +101 -25
  33. data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
  34. data/app/pb_kits/playbook/pb_nav/_nav.tsx +22 -1
  35. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
  36. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  37. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +85 -58
  38. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
  39. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
  40. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
  41. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
  42. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +14 -5
  43. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
  44. data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
  45. data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
  46. data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
  47. data/app/pb_kits/playbook/pb_nav/item.rb +29 -3
  48. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
  49. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
  50. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
  51. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
  52. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
  53. data/dist/playbook-rails.js +7 -7
  54. data/lib/playbook/version.rb +2 -2
  55. metadata +16 -9
  56. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -120
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92ab5b99e6bc4d33881e4087db34763fd0d818607d0412cbe5305e9a376c6c31
4
- data.tar.gz: 0ed7902b4ebff49a4dbc5dd60e7e6411311ab7fdee3bf0812501a6d2fe63a0f5
3
+ metadata.gz: 5eae0f530402898fcbefd959203904bbf32732eb48281f3c02be9b0ee45bc29c
4
+ data.tar.gz: fafdafb80adce91cc980b713d8e4be65ca9660b3c4e8634b3f77db98407a02a9
5
5
  SHA512:
6
- metadata.gz: 40657ad869c7a5ca5aa6494a5d4ef300f1e00aa30fe8f4fac97402b4fe169f46dbccdf166fa926a91543c6751b410471dcb1ad0add23601b99e71758204f3cd2
7
- data.tar.gz: 3b44c5fd8f3a0fad567fd4ff9064273ea86e86b5dec6ec283cc419fff7fad6a354571b4d7e77fafb59391fd913c0431f6764a00b895896aec9d1cc11ab1c8880
6
+ metadata.gz: 2c73ddd4680ede853733bf7efecebe98c3300e0033cde494c29c052ac06f0bae5e8c829a7872bd6f7ce60c6016117a7eea8d6cff895985ef7790da0679a5bb4d
7
+ data.tar.gz: fd9ad011a7d1ba1cf90c716a2aaaf3d317bb8de166947908a9c1b5c0281afcb142b5cdb2c62b3ad768496d975e1b59b8bfbb8ba00043d66e9e210a0026d788ac
@@ -20,6 +20,12 @@
20
20
  .icon_wrapper:hover {
21
21
  color: $primary
22
22
  }
23
+
24
+ .dark {
25
+ .pb_icon_kit {
26
+ color: $white;
27
+ }
28
+ }
23
29
  }
24
30
 
25
31
  [class^=pb_collapsible_main_kit] {
@@ -20,7 +20,7 @@ type CollapsibleProps = {
20
20
  icon?: string | string[],
21
21
  iconColor?: 'default' | 'light' | 'lighter' | 'link' | 'error' | 'success',
22
22
  iconSize?: IconSizes,
23
- iconClick?: ()=> void,
23
+ onIconClick?: ()=> void,
24
24
  onClick?: ()=> void,
25
25
  id?: string,
26
26
  }
@@ -36,7 +36,7 @@ const Collapsible = ({
36
36
  icon,
37
37
  iconColor = 'default',
38
38
  iconSize,
39
- iconClick,
39
+ onIconClick,
40
40
  onClick,
41
41
  id,
42
42
  ...props
@@ -66,7 +66,7 @@ const Collapsible = ({
66
66
  className
67
67
  )
68
68
  return (
69
- <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, iconClick, onClick }}>
69
+ <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick }}>
70
70
  <div
71
71
  {...ariaProps}
72
72
  {...dataProps}
@@ -33,6 +33,7 @@ type CollapsibleMainProps = {
33
33
  children: React.ReactNode[] | React.ReactNode,
34
34
  className?: string,
35
35
  cursor?: string,
36
+ dark?: boolean,
36
37
  onClick?: ()=> void
37
38
  }
38
39
  type IconColors = "default" | "light" | "lighter" | "link" | "error" | "success"
@@ -42,10 +43,10 @@ type IconProps = {
42
43
  icon?: string[] | string
43
44
  iconColor?: IconColors
44
45
  iconSize?: IconSizes
45
- iconClick?: ()=> void
46
+ onIconClick?: ()=> void
46
47
  }
47
48
 
48
- const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, iconClick }: IconProps) => {
49
+ const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, onIconClick }: IconProps) => {
49
50
  const color = colorMap[iconColor]
50
51
 
51
52
  const showIcon = (icon: string |string[]) => {
@@ -56,9 +57,9 @@ const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, iconClick }: IconPro
56
57
  }
57
58
 
58
59
  const handleIconClick = (e:any) => {
59
- if (iconClick) {
60
+ if (onIconClick) {
60
61
  e.stopPropagation();
61
- iconClick()
62
+ onIconClick()
62
63
  }
63
64
  }
64
65
 
@@ -93,18 +94,18 @@ const CollapsibleMain = ({
93
94
  cursor = 'pointer',
94
95
  ...props
95
96
  }: CollapsibleMainProps): React.ReactElement=> {
96
- const {collapsed, toggle, icon, iconSize, iconColor, iconClick, onClick}: any = useContext(CollapsibleContext)
97
+ const {collapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick}: any = useContext(CollapsibleContext)
97
98
  const mainCSS = buildCss('pb_collapsible_main_kit')
98
99
  const mainSpacing = globalProps(props, { cursor })
99
100
 
100
- const handleCollapsibleClick = (e:any) => {
101
+ const handleCollapsibleClick = () => {
101
102
  toggle();
102
- onClick && onClick(e)
103
+ onClick && onClick()
103
104
  }
104
105
 
105
106
  return (
106
107
  <div className={classnames(mainCSS, className, mainSpacing)}>
107
- <div onClick={(e)=>handleCollapsibleClick(e)}>
108
+ <div onClick={handleCollapsibleClick}>
108
109
  <Flex
109
110
  spacing="between"
110
111
  vertical="center"
@@ -116,7 +117,7 @@ const CollapsibleMain = ({
116
117
  iconColor={iconColor as IconColors}
117
118
  iconSize={iconSize as IconSizes}
118
119
  icon={icon as string[] | string}
119
- iconClick={iconClick}
120
+ onIconClick={onIconClick}
120
121
  />
121
122
  </FlexItem>
122
123
  </Flex>
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleColor = () => (
4
+ const CollapsibleColor = (props) => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconColor='default'
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main>
10
+ <Collapsible.Main {...props}>
11
11
  <div>{'Default Section'}</div>
12
12
  </Collapsible.Main>
13
13
  <Collapsible.Content>
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleDefault = () => (
4
+ const CollapsibleDefault = (props) => (
5
5
  <Collapsible >
6
- <Collapsible.Main>
6
+ <Collapsible.Main {...props}>
7
7
  <div>{'Main Section'}</div>
8
8
  </Collapsible.Main>
9
9
  <Collapsible.Content>
@@ -1,18 +1,14 @@
1
1
  import React from 'react'
2
- import { Collapsible, useCollapsible, Button } from '../..'
2
+ import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleIcons = () => {
5
- const [isCollapsed, setIsCollapsed] = useCollapsible(true)
4
+ const CollapsibleIcons = (props) => {
6
5
 
7
6
  return (
8
7
  <>
9
- <Button onClick={()=> setIsCollapsed(!isCollapsed)}>
10
- {isCollapsed ? "Expand" : "Collapse"}
11
- </Button>
12
- <Collapsible collapsed={isCollapsed}
8
+ <Collapsible
13
9
  icon={['plus','minus']}
14
10
  >
15
- <Collapsible.Main>
11
+ <Collapsible.Main {...props}>
16
12
  <div>{'Main Section'}</div>
17
13
  </Collapsible.Main>
18
14
  <Collapsible.Content>
@@ -1,2 +1,2 @@
1
1
  ##### Prop
2
- This kit uses 'chevron-up' and 'chevron-down' icons as default for the toggle icons. To customize these icons, use the `icon` prop to pass in an array of two icons, the first will render when the collapisble is closed and the second will render when the collapsible is open. In this example, we are using `icon: ['plus','minus']`
2
+ The `icon` prop allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when collapsed (chevron-down), and the second value will replace the default icon when expanded (chevron-up). `icon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the collapsible state.
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleSize = () => (
4
+ const CollapsibleSize = (props) => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconSize="xs"
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main>
10
+ <Collapsible.Main {...props}>
11
11
  <div>{'Extra Small Section'}</div>
12
12
  </Collapsible.Main>
13
13
  <Collapsible.Content>
@@ -22,7 +22,7 @@ const CollapsibleSize = () => (
22
22
  iconSize="sm"
23
23
  marginBottom="xs"
24
24
  >
25
- <Collapsible.Main>
25
+ <Collapsible.Main {...props}>
26
26
  <div>{'Small Section'}</div>
27
27
  </Collapsible.Main>
28
28
  <Collapsible.Content>
@@ -36,7 +36,7 @@ const CollapsibleSize = () => (
36
36
  <Collapsible
37
37
  marginBottom="xs"
38
38
  >
39
- <Collapsible.Main>
39
+ <Collapsible.Main {...props}>
40
40
  <div>{'Default Section'}</div>
41
41
  </Collapsible.Main>
42
42
  <Collapsible.Content>
@@ -51,7 +51,7 @@ const CollapsibleSize = () => (
51
51
  iconSize="lg"
52
52
  marginBottom="xs"
53
53
  >
54
- <Collapsible.Main>
54
+ <Collapsible.Main {...props}>
55
55
  <div>{'Large Section'}</div>
56
56
  </Collapsible.Main>
57
57
  <Collapsible.Content>
@@ -0,0 +1,75 @@
1
+ import React from 'react'
2
+ import { Collapsible, useCollapsible, Button } from '../..'
3
+
4
+ const CollapsibleState = (props) => {
5
+ const [isCollapsed, setIsCollapsed] = useCollapsible(true)
6
+
7
+ return (
8
+ <>
9
+ <Button
10
+ onClick={() => setIsCollapsed(!isCollapsed)}
11
+ padding="none"
12
+ variant="link"
13
+ >
14
+ {isCollapsed ? "Expand All" : "Collapse All"}
15
+ </Button>
16
+
17
+ <Collapsible
18
+ collapsed={isCollapsed}
19
+ icon={["plus", "minus"]}
20
+ padding="none"
21
+ >
22
+ <Collapsible.Main padding="sm"
23
+ {...props}
24
+ >
25
+ <div>{"Main Section"}</div>
26
+ </Collapsible.Main>
27
+ <Collapsible.Content>
28
+ <div>
29
+ {
30
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit."
31
+ }
32
+ </div>
33
+ </Collapsible.Content>
34
+ </Collapsible>
35
+ <Collapsible
36
+ collapsed={isCollapsed}
37
+ icon={["plus", "minus"]}
38
+ padding="none"
39
+ >
40
+ <Collapsible.Main padding="sm"
41
+ {...props}
42
+ >
43
+ <div>{"Main Section"}</div>
44
+ </Collapsible.Main>
45
+ <Collapsible.Content>
46
+ <div>
47
+ {
48
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit."
49
+ }
50
+ </div>
51
+ </Collapsible.Content>
52
+ </Collapsible>
53
+ <Collapsible
54
+ collapsed={isCollapsed}
55
+ icon={["plus", "minus"]}
56
+ padding="none"
57
+ >
58
+ <Collapsible.Main padding="sm"
59
+ {...props}
60
+ >
61
+ <div>{"Main Section"}</div>
62
+ </Collapsible.Main>
63
+ <Collapsible.Content>
64
+ <div>
65
+ {
66
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit."
67
+ }
68
+ </div>
69
+ </Collapsible.Content>
70
+ </Collapsible>
71
+ </>
72
+ )
73
+ }
74
+
75
+ export default CollapsibleState
@@ -0,0 +1,3 @@
1
+ The `collapsed` prop allows you to toggle the collapsible with external controls (like buttons) when used in conjunction with our `useCollapsible` hook.
2
+
3
+ NOTE: you must import and declare the `useCollapsible` hook then pass its state to the collapsed prop of any Collapsible you wish to manage with the external control. See our code example for details.
@@ -2,12 +2,13 @@ examples:
2
2
 
3
3
  rails:
4
4
  - collapsible_default: Default
5
- - collapsible_size: Size
6
- - collapsible_color: Color
7
- # - collapsible_icons: Custom Icons
5
+ - collapsible_size: Icon Size
6
+ - collapsible_color: Icon Color
7
+ - collapsible_icons: Custom Icons
8
8
 
9
9
  react:
10
10
  - collapsible_default: Default
11
- - collapsible_size: Size
12
- - collapsible_color: Color
13
- # - collapsible_icons: Custom Icons
11
+ - collapsible_size: Icon Size
12
+ - collapsible_color: Icon Color
13
+ - collapsible_icons: Custom Icons
14
+ - collapsible_state: useCollapsible Hook
@@ -1,4 +1,5 @@
1
1
  export { default as CollapsibleDefault } from './_collapsible_default.jsx'
2
2
  export { default as CollapsibleSize } from './_collapsible_size.jsx'
3
3
  export { default as CollapsibleColor } from './_collapsible_color.jsx'
4
- export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
4
+ export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
5
+ export {default as CollapsibleState } from './_collapsible_state.jsx'
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import classnames from "classnames";
3
3
 
4
- import DateTime from "../pb_kit/dateTime";
5
4
  import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
6
5
  import { globalProps } from "../utilities/globalProps";
6
+ import DateTime from '../pb_kit/dateTime';
7
7
 
8
8
  import Body from "../pb_body/_body";
9
9
  import Caption from "../pb_caption/_caption";
@@ -20,7 +20,7 @@ type PbDateProps = {
20
20
  showIcon?: boolean;
21
21
  size?: "sm" | "md" | "lg";
22
22
  unstyled?: boolean;
23
- value: string | Date;
23
+ value: Date;
24
24
  };
25
25
 
26
26
  const PbDate = (props: PbDateProps) => {
@@ -37,12 +37,11 @@ const PbDate = (props: PbDateProps) => {
37
37
  value,
38
38
  } = props;
39
39
 
40
- const dateTimestamp = new DateTime({ value: value });
41
- const weekday = dateTimestamp.toWeekday();
42
- const month = dateTimestamp.toMonth();
43
- const day = dateTimestamp.toDay();
44
- const year = dateTimestamp.toYear();
45
- const currentYear = new Date().getFullYear().toString();
40
+ const weekday = DateTime.toWeekday(value);
41
+ const month = DateTime.toMonth(value);
42
+ const day = DateTime.toDay(value);
43
+ const year = DateTime.toYear(value);
44
+ const currentYear = new Date().getFullYear();
46
45
 
47
46
  const ariaProps = buildAriaProps(aria);
48
47
  const dataProps = buildDataProps(data);
@@ -7,7 +7,7 @@ const DateAlignment = (props) => {
7
7
  <FormattedDate
8
8
  dayOfWeek
9
9
  icon
10
- value="1995-12-25"
10
+ value={new Date('25 Dec 1995')}
11
11
  {...props}
12
12
  />
13
13
 
@@ -17,7 +17,7 @@ const DateAlignment = (props) => {
17
17
  alignment="center"
18
18
  dayOfWeek
19
19
  icon
20
- value="2020-12-25"
20
+ value={new Date('25 Dec 2020')}
21
21
  {...props}
22
22
  />
23
23
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Date as FormattedDate } from '../../'
2
+ import { Date as FormattedDate, Caption, Title } from '../../'
3
3
 
4
4
  const DateDefault = (props) => {
5
5
  return (
@@ -12,9 +12,20 @@ const DateDefault = (props) => {
12
12
 
13
13
  <br />
14
14
 
15
+ <div style={{display: "flex", columnGap: 4}}>
16
+ <FormattedDate
17
+ size="sm"
18
+ value={"2012-08-03"}
19
+ {...props}
20
+ />
21
+ <Caption>{"(Hyphenated Date)"}</Caption>
22
+ </div>
23
+
24
+ <br />
25
+
15
26
  <FormattedDate
16
27
  size="sm"
17
- value="2012-08-03"
28
+ value={new Date('03 Aug 2012')}
18
29
  {...props}
19
30
  />
20
31
 
@@ -23,7 +34,7 @@ const DateDefault = (props) => {
23
34
  <FormattedDate
24
35
  showDayOfWeek
25
36
  size="sm"
26
- value="2017-12-03"
37
+ value={new Date('03 Dec 2017')}
27
38
  {...props}
28
39
  />
29
40
 
@@ -37,8 +48,21 @@ const DateDefault = (props) => {
37
48
 
38
49
  <br />
39
50
 
51
+ <div style={{display: "flex", columnGap: 4}}>
52
+ <FormattedDate
53
+ value={"2012-08-03"}
54
+ {...props}
55
+ />
56
+ <Title
57
+ size={4}
58
+ text={"(Hyphenated Date)"}
59
+ />
60
+ </div>
61
+
62
+ <br />
63
+
40
64
  <FormattedDate
41
- value="2012-08-03"
65
+ value={new Date('03 Aug 2012')}
42
66
  {...props}
43
67
  />
44
68
 
@@ -46,7 +70,7 @@ const DateDefault = (props) => {
46
70
 
47
71
  <FormattedDate
48
72
  showDayOfWeek
49
- value="2017-12-03"
73
+ value={new Date('03 Dec 2017')}
50
74
  {...props}
51
75
  />
52
76
  </>
@@ -21,7 +21,7 @@ const DateUnstyled = (props) => {
21
21
  <Title size={1}>
22
22
  <FormattedDate
23
23
  unstyled
24
- value="1995-12-25"
24
+ value={new Date('25 Dec 1995')}
25
25
  {...props}
26
26
  />
27
27
  </Title>
@@ -36,7 +36,7 @@ const DateUnstyled = (props) => {
36
36
  showDayOfWeek
37
37
  showIcon
38
38
  unstyled
39
- value="1995-12-25"
39
+ value={new Date('25 Dec 1995')}
40
40
  {...props}
41
41
  />
42
42
  </Caption>
@@ -7,7 +7,7 @@ const DateVariants = (props) => {
7
7
  <FormattedDate
8
8
  showIcon
9
9
  size="sm"
10
- value="1995-12-25"
10
+ value={new Date('25 Dec 1995')}
11
11
  {...props}
12
12
  />
13
13
 
@@ -15,7 +15,7 @@ const DateVariants = (props) => {
15
15
  <br />
16
16
 
17
17
  <FormattedDate
18
- value="1995-12-25"
18
+ value={new Date('25 Dec 1995')}
19
19
  {...props}
20
20
  />
21
21
 
@@ -24,7 +24,7 @@ const DateVariants = (props) => {
24
24
 
25
25
  <FormattedDate
26
26
  showIcon
27
- value="1995-12-25"
27
+ value={new Date('25 Dec 1995')}
28
28
  {...props}
29
29
  />
30
30
 
@@ -33,7 +33,7 @@ const DateVariants = (props) => {
33
33
 
34
34
  <FormattedDate
35
35
  showDayOfWeek
36
- value="1995-12-25"
36
+ value={new Date('25 Dec 1995')}
37
37
  {...props}
38
38
  />
39
39
 
@@ -43,7 +43,7 @@ const DateVariants = (props) => {
43
43
  <FormattedDate
44
44
  showDayOfWeek
45
45
  showIcon
46
- value="1995-12-25"
46
+ value={new Date('25 Dec 1995')}
47
47
  {...props}
48
48
  />
49
49
  </div>
@@ -3,7 +3,7 @@ import classnames from "classnames";
3
3
 
4
4
  import { globalProps } from "../utilities/globalProps";
5
5
  import { buildCss, buildDataProps } from "../utilities/props";
6
- import DateTime from "../pb_kit/dateTime";
6
+ import DateTime from '../pb_kit/dateTime';
7
7
 
8
8
  import Body from "../pb_body/_body";
9
9
  import Caption from "../pb_caption/_caption";
@@ -21,18 +21,16 @@ type DateRangeInlineProps = {
21
21
  endDate?: Date;
22
22
  };
23
23
 
24
- const dateTimestamp = (dateValue: Date | string, includeYear: boolean) => {
25
- const date = new DateTime({ value: dateValue });
24
+ const dateTimestamp = (dateValue: Date, includeYear: boolean) => {
26
25
  if (includeYear) {
27
- return `${date.toMonth()} ${date.toDay()}, ${date.toYear()}`;
26
+ return `${DateTime.toMonth(dateValue)} ${DateTime.toDay(dateValue)}, ${DateTime.toYear(dateValue)}`;
28
27
  } else {
29
- return `${date.toMonth()} ${date.toDay()}`;
28
+ return `${DateTime.toMonth(dateValue)} ${DateTime.toDay(dateValue)}`;
30
29
  }
31
30
  };
32
31
 
33
- const dateTimeIso = (dateValue: Date | string) => {
34
- const date = new DateTime({ value: dateValue });
35
- return date.toIso();
32
+ const dateTimeIso = (dateValue: Date) => {
33
+ return DateTime.toIso(dateValue);
36
34
  };
37
35
 
38
36
  const DateRangeInline = (props: DateRangeInlineProps) => {
@@ -52,14 +50,17 @@ const DateRangeInline = (props: DateRangeInlineProps) => {
52
50
  <>
53
51
  {icon && (
54
52
  <>
55
- <Body color="light" key={Math.random()} tag="span">
56
- <Icon
57
- className="pb_date_range_inline_icon"
58
- dark={dark}
59
- fixedWidth
60
- icon="calendar-alt"
61
- size={size}
53
+ <Body color="light"
54
+ key={Math.random()}
62
55
  tag="span"
56
+ >
57
+ <Icon
58
+ className="pb_date_range_inline_icon"
59
+ dark={dark}
60
+ fixedWidth
61
+ icon="calendar-alt"
62
+ size={size}
63
+ tag="span"
63
64
  />
64
65
  </Body>
65
66
  </>
@@ -78,7 +79,7 @@ const DateRangeInline = (props: DateRangeInlineProps) => {
78
79
 
79
80
  const dateRangeClasses = buildCss("pb_date_range_inline_kit", align);
80
81
  const dataProps = buildDataProps(data)
81
- const renderTime = (date: Date | string) => {
82
+ const renderTime = (date: Date) => {
82
83
  return (
83
84
  <time dateTime={dateTimeIso(date)}>
84
85
  {dateInCurrentYear() ? (
@@ -92,24 +93,30 @@ const DateRangeInline = (props: DateRangeInlineProps) => {
92
93
 
93
94
  return (
94
95
  <div
95
- {...dataProps}
96
- className={classnames(dateRangeClasses, globalProps(props), className)}
96
+ {...dataProps}
97
+ className={classnames(dateRangeClasses, globalProps(props), className)}
97
98
  >
98
99
  <div className="pb_date_range_inline_wrapper">
99
100
  {size == "xs" && (
100
101
  <>
101
102
  {iconContent()}
102
- <Caption dark={dark} tag="span">
103
+ <Caption dark={dark}
104
+ tag="span"
105
+ >
103
106
  {renderTime(startDate)}
104
107
  </Caption>
105
- <Caption dark={dark} tag="span">
108
+ <Caption dark={dark}
109
+ tag="span"
110
+ >
106
111
  <Icon
107
- className="pb_date_range_inline_arrow"
108
- fixedWidth
109
- icon="long-arrow-right"
112
+ className="pb_date_range_inline_arrow"
113
+ fixedWidth
114
+ icon="long-arrow-right"
110
115
  />
111
116
  </Caption>
112
- <Caption dark={dark} tag="span">
117
+ <Caption dark={dark}
118
+ tag="span"
119
+ >
113
120
  {renderTime(endDate)}
114
121
  </Caption>
115
122
  </>
@@ -118,18 +125,25 @@ const DateRangeInline = (props: DateRangeInlineProps) => {
118
125
  {size == "sm" && (
119
126
  <>
120
127
  {iconContent()}
121
- <Body dark={dark} tag="span">
128
+ <Body dark={dark}
129
+ tag="span"
130
+ >
122
131
  {renderTime(startDate)}
123
132
  </Body>
124
- <Body color="light" dark={dark} tag="span">
125
- <Icon
126
- className="pb_date_range_inline_arrow"
133
+ <Body color="light"
127
134
  dark={dark}
128
- fixedWidth
129
- icon="long-arrow-right"
135
+ tag="span"
136
+ >
137
+ <Icon
138
+ className="pb_date_range_inline_arrow"
139
+ dark={dark}
140
+ fixedWidth
141
+ icon="long-arrow-right"
130
142
  />
131
143
  </Body>
132
- <Body dark={dark} tag="span">
144
+ <Body dark={dark}
145
+ tag="span"
146
+ >
133
147
  {renderTime(endDate)}
134
148
  </Body>
135
149
  </>