playbook_ui 13.9.0.pre.alpha.verdaccioregistry1277 → 13.10.0.pre.alpha.play978makehighchartsadevdependencypoc1322

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: 2635d340cb1a78d1b51e0d23c810dc545ce3132db87e95faabd2c39ee07f2ea6
4
- data.tar.gz: f249fcd93140caf859615d77bf14a538e9f089065a6d8ea746c15a80d4ac9626
3
+ metadata.gz: d5c698aeede8c696425be923ef80ccb4b453064586661668bca56ed1787a74e3
4
+ data.tar.gz: a87fad36bcc83461fcc2339ee3e63c8a2e18aedb037b6e6d28c4376df3ffc7c0
5
5
  SHA512:
6
- metadata.gz: dc57ebf6ed2aefdb0a0eeae5de4ab537b607ef157c222c7f7a6d0aa21c4964f3eaf087ca96ccd743c6f1674251c8508db325c93712f3d4fe48ca8c0e614ab5ac
7
- data.tar.gz: ecc8a305deb0c237a64d0b2af44087f30f8efc44669856a3370b983ce4a3ea2cccda4563856c2308243260c8dcd26e32722cc81d6b35f9d62f62b6c4d618eac2
6
+ metadata.gz: c7f26369bc905f351e426edf19c216f6d49e5a3ea3a5e36d028396aed0404f67cb989ab3f5e38622ee1d1eca7d2a25fd3cf80a85e3a4bf09883d635c5d3904ce
7
+ data.tar.gz: cef471a7455cf4866819da82b92149fd24080c5f32ee1042a83cca2ddcdb417a5e15a411bc436d5aeca2b0e24a6e2cf26b6c557487a62c2bf5b9ec5ac5ebf9c7
@@ -0,0 +1,12 @@
1
+ ![avatar-default](https://github.com/powerhome/playbook/assets/92755007/b1bed6d5-56b4-40e2-96c3-6090642fc89f)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading, spacing: Spacing.small) {
5
+ PBAvatar(image: Image("andrew", bundle: .module), size: .xxSmall, status: .online)
6
+ PBAvatar(image: Image("andrew", bundle: .module), size: .xSmall, status: .away)
7
+ PBAvatar(image: Image("andrew", bundle: .module), size: .small, status: .online)
8
+ PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .away)
9
+ PBAvatar(image: Image("andrew", bundle: .module), size: .large, status: .online)
10
+ PBAvatar(image: Image("andrew", bundle: .module), size: .xLarge, status: .offline)
11
+ }
12
+ ```
@@ -0,0 +1,12 @@
1
+ ![avatar-monogram](https://github.com/powerhome/playbook/assets/92755007/c7fd747d-46a9-4da0-8d89-dfa3647ea572)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading, spacing: Spacing.small) {
5
+ PBAvatar(name: "Tim Wenhold", size: .xxSmall, status: .online)
6
+ PBAvatar(name: "Tim Wenhold", size: .xSmall, status: .away)
7
+ PBAvatar(name: "Tim Wenhold", size: .small, status: .online)
8
+ PBAvatar(name: "Tim Wenhold", size: .medium, status: .away)
9
+ PBAvatar(name: "Tim Wenhold", size: .large, status: .online)
10
+ PBAvatar(name: "Tim", size: .xLarge, status: .offline)
11
+ }
12
+ ```
@@ -0,0 +1,8 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **Image** | `Image` | Sets the Avatar image | | |
5
+ | **Name** | `String` | Used to display user's initails when image is blank | | |
6
+ | **Size** | `Size` | Adjusts the Avatar image size | `.medium` | `.xxSmall` `.xSmall` `.small` `.medium` `.large` `.xLarge` |
7
+ | **Status** | `PresenceStatus` | Sets user's activity status | | `away` `offline` `online` |
8
+ | **Wrapped** | `Bool` | Displays the wrapped variant | `false` | `true` `false` |
@@ -10,4 +10,6 @@ examples:
10
10
  - avatar_no_image: "Bad Image Link"
11
11
  - avatar_status: Status
12
12
  swift:
13
- - avatar_swift: Default
13
+ - avatar_default_swift: Default
14
+ - avatar_monogram_swift: Monogram
15
+ - avatar_props_swift: ""
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
4
4
  import { GlobalProps, globalProps } from '../utilities/globalProps'
@@ -6,7 +6,7 @@ import { GlobalProps, globalProps } from '../utilities/globalProps'
6
6
  type BackgroundProps = {
7
7
  alt?: string,
8
8
  aria?: {[key: string]: string},
9
- backgroundColor?: 'gradient' |
9
+ backgroundColor?: ResponsiveProp<string> | 'gradient' |
10
10
  'dark' |'light' | 'white' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'primary' | 'shadow' |
11
11
  'category_1' | 'category_2' | 'category_3' | 'category_4' | 'category_5' | 'category_6' | 'category_7' |
12
12
  'category_8' | 'category_9' | 'category_10' | 'category_11' | 'category_12' | 'category_13' | 'category_14' |
@@ -15,20 +15,53 @@ type BackgroundProps = {
15
15
  'card_light' | 'card_dark' | 'data_1' | 'data_2' | 'data_3' | 'data_4' | 'data_5' | 'data_6' | 'data_7' | 'data_8' |
16
16
  'border_light' | 'border_dark' | 'success_secondary' | 'error_secondary' | 'info_secondary' | 'warning_secondary' |
17
17
  'neutral_secondary' | 'primary_secondary' | 'success_subtle' | 'warning_subtle' | 'error_subtle' | 'info_subtle' | 'neutral_subtle',
18
- backgroundPosition?: string,
19
- backgroundRepeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round' | 'initial' | 'inherit',
20
- backgroundSize?: 'auto' | 'cover' | 'contain',
18
+ backgroundSize?: ResponsiveProp<string> | 'auto' | 'cover' | 'contain',
19
+ backgroundPosition?: ResponsiveProp<string> | string,
20
+ backgroundRepeat?: ResponsiveProp<string> | 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round' | 'initial' | 'inherit',
21
+ imageUrl?: ResponsiveProp<string> | string,
21
22
  children?: React.ReactChild[] | React.ReactNode,
22
23
  className?: string,
23
24
  customColor?: string,
24
25
  data?: {[key: string]: string},
25
26
  id?: string,
26
- imageUrl?: string,
27
27
  padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
28
28
  tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'tr' | 'th' | 'td' | 'thead' | 'col',
29
29
  transition?: 'fade' | 'blur' | 'scale',
30
30
  } & GlobalProps
31
31
 
32
+ type ResponsiveProp<T> = T | {
33
+ xs?: T,
34
+ sm?: T,
35
+ md?: T,
36
+ lg?: T,
37
+ xl?: T,
38
+ default?: T
39
+ };
40
+
41
+ const breakpoints: {[key: string]: string} = {
42
+ xs: '(max-width: 575px)',
43
+ sm: '(min-width: 576px) and (max-width: 767px)',
44
+ md: '(min-width: 768px) and (max-width: 991px)',
45
+ lg: '(min-width: 992px) and (max-width: 1199px)',
46
+ xl: '(min-width: 1200px)',
47
+ };
48
+
49
+ const getResponsiveValue = <T extends string | undefined>(prop: ResponsiveProp<T> | undefined): T => {
50
+ if (typeof prop === 'string') {
51
+ return prop;
52
+ }
53
+
54
+ // Check for breakpoints
55
+ for (const [bp, value] of Object.entries(prop || {})) {
56
+ if (bp !== 'default' && window.matchMedia(breakpoints[bp]).matches) {
57
+ return value as T;
58
+ }
59
+ }
60
+
61
+ // Return the default value if provided, otherwise undefined
62
+ return prop?.default || undefined;
63
+ };
64
+
32
65
  const Background = (props: BackgroundProps) => {
33
66
  const {
34
67
  alt = '',
@@ -46,60 +79,78 @@ const Background = (props: BackgroundProps) => {
46
79
  tag = 'div',
47
80
  transition = '',
48
81
  } = props
82
+
83
+ const [responsiveProps, setResponsiveProps] = useState({
84
+ backgroundSize: getResponsiveValue(backgroundSize),
85
+ backgroundPosition: getResponsiveValue(backgroundPosition),
86
+ backgroundRepeat: getResponsiveValue(backgroundRepeat),
87
+ backgroundColor: getResponsiveValue(backgroundColor),
88
+ imageUrl: getResponsiveValue(imageUrl),
89
+ });
49
90
 
50
- const ariaProps = buildAriaProps(aria)
51
- const dataProps = buildDataProps(data)
91
+ // Update responsive values on window resize.
92
+ useEffect(() => {
93
+ const updateResponsiveProps = () => {
94
+ setResponsiveProps({
95
+ backgroundSize: getResponsiveValue(props.backgroundSize),
96
+ backgroundPosition: getResponsiveValue(props.backgroundPosition),
97
+ backgroundRepeat: getResponsiveValue(props.backgroundRepeat),
98
+ backgroundColor: getResponsiveValue(props.backgroundColor),
99
+ imageUrl: getResponsiveValue(props.imageUrl),
100
+ });
101
+ };
102
+ window.addEventListener('resize', updateResponsiveProps);
103
+ return () => window.removeEventListener('resize', updateResponsiveProps);
104
+ }, [props]);
52
105
 
53
- const backgroundStyle = {
54
- backgroundImage: `url(${imageUrl})`,
55
- backgroundRepeat: `${backgroundRepeat}`,
56
- backgroundSize: `${backgroundSize}`,
57
- backgroundPosition: backgroundPosition
58
- }
59
-
60
- const backgroundPositionStyle = {
61
- backgroundColor: customColor? customColor: null,
62
- backgroundPosition: `${backgroundPosition}`
63
- }
64
106
 
65
- const getBackgroundColor = customColor ? 'pb_background_custom_color' : `pb_background_color_${backgroundColor}`
66
- const classes = classnames(buildCss('pb_background_kit'), 'lazyload', backgroundStyle, transition, globalProps(props), getBackgroundColor, className)
107
+ // Extract currently applicable responsive values.
108
+ const {
109
+ backgroundColor: resBackgroundColor,
110
+ backgroundPosition: resBackgroundPosition,
111
+ backgroundRepeat: resBackgroundRepeat,
112
+ backgroundSize: resBackgroundSize,
113
+ imageUrl: resImageUrl,
114
+ } = responsiveProps;
67
115
 
116
+ // Build CSS classes and styles using responsive values.
117
+ const classes = classnames(
118
+ buildCss('pb_background_kit'),
119
+ 'lazyload',
120
+ globalProps(props),
121
+ transition,
122
+ {
123
+ [`pb_background_color_${resBackgroundColor}`]: resBackgroundColor && !customColor,
124
+ [`pb_background_custom_color`]: !!customColor,
125
+ },
126
+ className
127
+ );
68
128
 
69
- const Tag: React.ReactElement | any = `${tag}`
129
+ const backgroundStyle = {
130
+ backgroundImage: resImageUrl ? `url(${resImageUrl})` : undefined,
131
+ backgroundRepeat: resBackgroundRepeat || undefined,
132
+ backgroundSize: resBackgroundSize || undefined,
133
+ backgroundPosition: resBackgroundPosition || undefined,
134
+ backgroundColor: customColor || undefined,
135
+ };
70
136
 
71
- const displayReturn = () => {
72
- if (imageUrl)
73
- return (
74
- <Tag
75
- alt={alt}
76
- style={backgroundStyle}
77
- {...ariaProps}
78
- {...dataProps}
79
- className={classes}
80
- id={id}
81
- >
82
- { children }
83
- </Tag>
84
- )
85
- else
86
- return (
87
- <Tag
88
- {...ariaProps}
89
- {...dataProps}
90
- className={classes}
91
- id={id}
92
- style={backgroundPositionStyle}
93
- >
94
- { children }
95
- </Tag>
96
- )
97
- }
137
+ const Tag: React.ReactElement | any = `${tag}`;
138
+ const ariaProps = buildAriaProps(aria);
139
+ const dataProps = buildDataProps(data);
98
140
 
141
+
99
142
  return (
100
- <>
101
- { displayReturn() }
102
- </>
143
+ <Tag
144
+ alt={alt}
145
+ style={backgroundStyle}
146
+ {...ariaProps}
147
+ {...dataProps}
148
+ className={classes}
149
+ id={id}
150
+ >
151
+ {children}
152
+ </Tag>
153
+
103
154
  )
104
155
  }
105
156
 
@@ -1,4 +1,4 @@
1
- ![badge-colors](https://github.com/powerhome/playbook/assets/92755007/52ce34ef-eb0d-48c0-9232-89edfff60cef)
1
+ ![badge-colors](https://github.com/powerhome/playbook/assets/92755007/79c1d61c-0411-4ee3-ab4f-927df2fad422)
2
2
 
3
3
  ```swift
4
4
  HStack {
@@ -40,11 +40,11 @@ $pb_button_sizes: (
40
40
  border-radius: $border_radius_rounded;
41
41
  border: 1px solid $border_light;
42
42
  color: $text_lt_light;
43
- padding: ($space_xxs - 2) $space_xs;
43
+ padding: ($space_xxs - 3) $space_xs;
44
44
  min-height: $space_md + 4;
45
45
 
46
46
  .pb_icon_kit_emoji, .pb_icon_kit {
47
- font-size: $font_base;
47
+ font-size: $font_small;
48
48
  }
49
49
  &:hover {
50
50
  background-color: $bg_light;
@@ -1,22 +1,9 @@
1
- //function to retrieve all ancestors of unchecked item and set checked to false
2
- export const getAncestorsOfUnchecked = (
3
- data: { [key: string]: any }[],
4
- item: { [key: string]: any }
5
- ) => {
6
- if (item.parent_id) {
7
- const ancestor = filterFormattedDataById(data, item.parent_id);
8
- ancestor[0].checked = false;
9
- ancestor[0].parent_id && getAncestorsOfUnchecked(data, ancestor[0]);
10
- }
11
- return data;
12
- };
13
-
14
- //function is going over formattedData and returning all objects that match the
15
- //id of the clicked item from the dropdown
1
+ // Function is going over formattedData and returning all objects that match the
2
+ // ID of the clicked item from the dropdown
16
3
  export const filterFormattedDataById = (
17
4
  formattedData: { [key: string]: any }[],
18
5
  id: string
19
- ) => {
6
+ ): { [key: string]: any }[] => {
20
7
  const matched: { [key: string]: any }[] = [];
21
8
  const recursiveSearch = (data: { [key: string]: any }[], term: string) => {
22
9
  for (const item of data) {
@@ -38,7 +25,7 @@ export const filterFormattedDataById = (
38
25
  export const findByFilter = (
39
26
  formattedData: { [key: string]: any }[],
40
27
  searchTerm: string
41
- ) => {
28
+ ): { [key: string]: any }[] => {
42
29
  const matchedItems: { [key: string]: any }[] = [];
43
30
  const recursiveSearch = (data: { [key: string]: any }[], term: string) => {
44
31
  for (const item of data) {
@@ -56,7 +43,20 @@ export const findByFilter = (
56
43
  return matchedItems;
57
44
  };
58
45
 
59
- //function to get all items with checked = true
46
+ // Function to retrieve all ancestors of unchecked item and set checked to false
47
+ export const getAncestorsOfUnchecked = (
48
+ data: { [key: string]: any }[],
49
+ item: { [key: string]: any }
50
+ ): { [key: string]: any }[] => {
51
+ if (item.parent_id) {
52
+ const ancestor = filterFormattedDataById(data, item.parent_id);
53
+ ancestor[0].checked = false;
54
+ ancestor[0].parent_id && getAncestorsOfUnchecked(data, ancestor[0]);
55
+ }
56
+ return data;
57
+ };
58
+
59
+ // Function to get all items with checked = true
60
60
  export const getCheckedItems = (
61
61
  data: { [key: string]: any }[]
62
62
  ): { [key: string]: any }[] => {
@@ -76,7 +76,9 @@ export const getCheckedItems = (
76
76
  return checkedItems;
77
77
  };
78
78
 
79
- export const getDefaultCheckedItems = (treeData: { [key: string]: any }[]) => {
79
+ export const getDefaultCheckedItems = (
80
+ treeData: { [key: string]: any }[]
81
+ ): { [key: string]: any }[] => {
80
82
  const checkedDefault: { [key: string]: any }[] = [];
81
83
 
82
84
  const traverseTree = (items: { [key: string]: any }[]) => {
@@ -118,7 +120,7 @@ export const getDefaultCheckedItems = (treeData: { [key: string]: any }[]) => {
118
120
  export const recursiveCheckParent = (
119
121
  item: { [key: string]: any },
120
122
  data: any
121
- ) => {
123
+ ): any => {
122
124
  if (item.parent_id !== null) {
123
125
  const parent = filterFormattedDataById(data, item.parent_id);
124
126
  const allChildrenChecked = parent[0].children.every(
@@ -135,8 +137,11 @@ export const recursiveCheckParent = (
135
137
  return data;
136
138
  };
137
139
 
138
- export const getExpandedItems = (treeData: { [key: string]: string }[], selectedIds: string[]) => {
139
- let expandedItems: any[] = [];
140
+ export const getExpandedItems = (
141
+ treeData: { [key: string]: string }[],
142
+ selectedIds: string[]
143
+ ): any[] => {
144
+ const expandedItems: any[] = [];
140
145
 
141
146
  const traverse = (items: string | any[], ancestors: any[] = []) => {
142
147
  for (let i = 0; i < items.length; i++) {
@@ -30,10 +30,11 @@
30
30
  align-items: center;
31
31
  justify-content: space-between;
32
32
  .input_inner_container {
33
- max-width: 90%;
33
+ width: 100%;
34
34
  }
35
35
 
36
36
  input {
37
+ width: 100%;
37
38
  border: none;
38
39
  font-family: $font_family_base;
39
40
  font-size: $font_base;