@planningcenter/tapestry-react 0.0.1-alpha.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/ActionsDropdown/ActionsDropdown.js +9 -8
  2. package/dist/cjs/Button/Button.js +4 -4
  3. package/dist/cjs/Checkbox/Checkbox.js +2 -2
  4. package/dist/cjs/DataTable/DataTable.js +3 -3
  5. package/dist/cjs/DataTable/components/BodyRows.js +2 -2
  6. package/dist/cjs/DataTable/components/BodySubRows.js +2 -2
  7. package/dist/cjs/DataTable/components/CheckboxCell.js +10 -10
  8. package/dist/cjs/DataTable/components/Icon.js +1 -1
  9. package/dist/cjs/NumberField/NumberField.js +19 -10
  10. package/dist/cjs/Page/PageActions.js +5 -0
  11. package/dist/cjs/Page/PageHeader.js +17 -21
  12. package/dist/cjs/Page/PageTab.js +11 -2
  13. package/dist/cjs/Page/PageTabList.js +5 -10
  14. package/dist/cjs/Page/PageTitle.js +3 -2
  15. package/dist/cjs/Page/PageToolbar.js +30 -6
  16. package/dist/cjs/Radio/Radio.js +1 -1
  17. package/dist/cjs/ThemeProvider/ThemeProvider.js +2 -2
  18. package/dist/cjs/ThemeProvider/styles.js +4 -4
  19. package/dist/cjs/server.js +1 -1
  20. package/dist/cjs/system/split-styles.js +1 -1
  21. package/dist/esm/ActionsDropdown/ActionsDropdown.js +9 -8
  22. package/dist/esm/Button/Button.js +4 -4
  23. package/dist/esm/Checkbox/Checkbox.js +2 -2
  24. package/dist/esm/DataTable/DataTable.js +3 -3
  25. package/dist/esm/DataTable/components/BodyRows.js +2 -2
  26. package/dist/esm/DataTable/components/BodySubRows.js +2 -2
  27. package/dist/esm/DataTable/components/CheckboxCell.js +10 -10
  28. package/dist/esm/DataTable/components/Icon.js +1 -1
  29. package/dist/esm/NumberField/NumberField.js +19 -10
  30. package/dist/esm/Page/PageActions.js +5 -0
  31. package/dist/esm/Page/PageHeader.js +17 -18
  32. package/dist/esm/Page/PageTab.js +10 -2
  33. package/dist/esm/Page/PageTabList.js +5 -8
  34. package/dist/esm/Page/PageTitle.js +3 -2
  35. package/dist/esm/Page/PageToolbar.js +28 -6
  36. package/dist/esm/Radio/Radio.js +1 -1
  37. package/dist/esm/ThemeProvider/ThemeProvider.js +2 -2
  38. package/dist/esm/ThemeProvider/styles.js +4 -4
  39. package/dist/esm/server.js +1 -1
  40. package/dist/esm/system/split-styles.js +1 -1
  41. package/package.json +1 -1
  42. package/src/ActionsDropdown/ActionsDropdown.tsx +8 -7
  43. package/src/Button/Button.tsx +4 -4
  44. package/src/Checkbox/Checkbox.js +2 -2
  45. package/src/Combobox/Combobox.mdx +1 -1
  46. package/src/DataTable/DataTable.js +3 -3
  47. package/src/DataTable/components/BodyRows.js +2 -2
  48. package/src/DataTable/components/BodySubRows.js +2 -2
  49. package/src/DataTable/components/CheckboxCell.js +10 -10
  50. package/src/DataTable/components/Icon.js +1 -1
  51. package/src/Input/InputLabel.js +1 -1
  52. package/src/NumberField/NumberField.js +19 -9
  53. package/src/Page/Page.mdx +56 -1
  54. package/src/Page/PageActions.js +12 -1
  55. package/src/Page/PageHeader.js +19 -25
  56. package/src/Page/PageTab.js +15 -1
  57. package/src/Page/PageTabList.js +10 -8
  58. package/src/Page/PageTitle.js +9 -1
  59. package/src/Page/PageToolbar.js +29 -6
  60. package/src/Radio/Radio.js +1 -1
  61. package/src/ThemeProvider/ThemeProvider.tsx +2 -2
  62. package/src/ThemeProvider/styles.ts +6 -6
  63. package/src/server.js +1 -1
  64. package/src/system/README.md +2 -2
  65. package/src/system/split-styles.js +1 -1
@@ -18,12 +18,12 @@ const initialStyles = {
18
18
  flexShrink: 0,
19
19
  outline: 0,
20
20
  cursor: 'pointer',
21
- ' .ui-kit-Checkbox-Fill ': {
21
+ ' .tapestry-react-Checkbox-Fill ': {
22
22
  transform: 'scale(1)',
23
23
  transformOrigin: 'center center',
24
24
  transition: 'all 180ms ease-out',
25
25
  },
26
- ' .ui-kit-Checkbox-Minus, .ui-kit-Checkbox-Checked ': {
26
+ ' .tapestry-react-Checkbox-Minus, .tapestry-react-Checkbox-Checked ': {
27
27
  fill: '#fff',
28
28
  visibility: 'hidden',
29
29
  transform: 'scale(0)',
@@ -31,23 +31,23 @@ const initialStyles = {
31
31
  transition: 'all 180ms ease-out',
32
32
  },
33
33
  ' &:hover, &:focus ': {
34
- ' .ui-kit-Checkbox-Fill ': {
34
+ ' .tapestry-react-Checkbox-Fill ': {
35
35
  transform: 'scale(1.125)',
36
36
  },
37
37
  },
38
38
  ' &:active ': {
39
- ' .ui-kit-Checkbox-Fill ': {
39
+ ' .tapestry-react-Checkbox-Fill ': {
40
40
  transform: 'scale(1)',
41
41
  },
42
42
  },
43
43
  }
44
44
 
45
45
  const checkedStyles = {
46
- ' .ui-kit-Checkbox-Checked ': scaleStyles,
46
+ ' .tapestry-react-Checkbox-Checked ': scaleStyles,
47
47
  }
48
48
 
49
49
  const indeterminateStyles = {
50
- ' .ui-kit-Checkbox-Minus ': scaleStyles,
50
+ ' .tapestry-react-Checkbox-Minus ': scaleStyles,
51
51
  }
52
52
 
53
53
  function CheckboxCell({
@@ -87,22 +87,22 @@ function CheckboxCell({
87
87
  onFocus={onFocus}
88
88
  onClick={handleChange}
89
89
  onKeyDown={(event) => event.key === ' ' && handleChange(event)}
90
- className="uikit-reset ui-kit-Checkbox"
90
+ className="tapestry-react-reset tapestry-react-Checkbox"
91
91
  css={cssStyles}
92
92
  >
93
93
  <Icon.Path
94
94
  name={iconPaths.fill}
95
- className="uikit-reset ui-kit-Checkbox-Fill"
95
+ className="tapestry-react-reset tapestry-react-Checkbox-Fill"
96
96
  fill={checked || indeterminate ? 'primary' : 'surfaceTertiary'}
97
97
  stroke={checked || indeterminate ? 'primary' : 'separatorSecondary'}
98
98
  />
99
99
  <Icon.Path
100
100
  name={iconPaths.minus}
101
- className="uikit-reset ui-kit-Checkbox-Minus"
101
+ className="tapestry-react-reset tapestry-react-Checkbox-Minus"
102
102
  />
103
103
  <Icon.Path
104
104
  name={iconPaths.checked}
105
- className="uikit-reset ui-kit-Checkbox-Checked"
105
+ className="tapestry-react-reset tapestry-react-Checkbox-Checked"
106
106
  />
107
107
  </Icon>
108
108
  )
@@ -25,7 +25,7 @@ function Icon({ as, name, size = 'md', color, children, ...props }) {
25
25
  width={iconSize}
26
26
  height={iconSize}
27
27
  fill={themeColor}
28
- className="uikit-reset"
28
+ className="tapestry-react-reset"
29
29
  children={childrenToRender}
30
30
  {...props}
31
31
  />
@@ -8,7 +8,7 @@ import { inputs, inputLabels } from './utils'
8
8
 
9
9
  export type InputLabelProps = {
10
10
  /**
11
- * The `id` of the input to control. Compatible with all UI kit form components.
11
+ * The `id` of the input to control. Compatible with all Tapestry-React form components.
12
12
  */
13
13
  controls: string,
14
14
 
@@ -168,13 +168,26 @@ class NumberField extends Component<Props> {
168
168
  handleInput = (event) => {
169
169
  const { maxValue } = this.getParsedValues(event.target.value)
170
170
  if (this.props.pad) {
171
- const targetValue =
172
- event.target.value === ''
173
- ? event.target.value
174
- : parseFloat(event.target.value)
171
+ const deleteKeyPressed = event.target.value === ''
172
+ const targetValue = deleteKeyPressed
173
+ ? event.target.value
174
+ : parseFloat(event.target.value)
175
175
 
176
- if (targetValue !== '') {
176
+ if (deleteKeyPressed) {
177
+ const nextValue = `${this.props.value}`.slice(0, -1)
178
+ this.props.onChange(padNumber(nextValue, this.props.pad))
179
+ } else {
177
180
  let nextValue = this.clampValue(targetValue)
181
+ const paddedValue = parseFloat(`${this.props.value}${targetValue}`)
182
+ if (
183
+ !this.firstTouch &&
184
+ !isNaN(targetValue) &&
185
+ this.isValueValid(paddedValue)
186
+ ) {
187
+ nextValue = paddedValue
188
+ }
189
+ this.firstTouch = false
190
+
178
191
  if (this.props.moveFocusOnMax && nextValue / maxValue > 0.1) {
179
192
  const { next } = getTabbableSiblings(event.target)
180
193
  if (next) {
@@ -182,10 +195,7 @@ class NumberField extends Component<Props> {
182
195
  }
183
196
  }
184
197
 
185
- this.firstTouch = false
186
198
  this.changeIfValid(nextValue)
187
- } else {
188
- this.props.onChange('')
189
199
  }
190
200
  } else {
191
201
  this.props.onChange(event.target.value)
@@ -244,7 +254,7 @@ class NumberField extends Component<Props> {
244
254
  textOverflow: undefined,
245
255
  autoComplete: 'off',
246
256
  value: numberValue,
247
- highlightOnInteraction: highlightOnInteraction,
257
+ highlightOnInteraction: highlightOnInteraction || pad,
248
258
  onBlur: this.handleBlur,
249
259
  onInput: this.handleInput,
250
260
  onKeyDown: this.handleKeyDown,
package/src/Page/Page.mdx CHANGED
@@ -4,6 +4,27 @@ category: General
4
4
  summary: Page specific components.
5
5
  ---
6
6
 
7
+ ```jsx live
8
+ render(
9
+ <Box width="100%">
10
+ <PageHeader>
11
+ <PageTitle>People</PageTitle>
12
+ </PageHeader>
13
+ <PageBody
14
+ sidebar={
15
+ <Sidebar grow={0}>
16
+ <Sidebar.Item active>Item 1</Sidebar.Item>
17
+ <Sidebar.Item>Item 2</Sidebar.Item>
18
+ <Sidebar.Item>Item 3</Sidebar.Item>
19
+ </Sidebar>
20
+ }
21
+ >
22
+ Regular body
23
+ </PageBody>
24
+ </Box>
25
+ )
26
+ ```
27
+
7
28
  ```jsx live
8
29
  render(
9
30
  <Box width="100%">
@@ -33,6 +54,40 @@ render(
33
54
  )
34
55
  ```
35
56
 
57
+ ```jsx live
58
+ render(
59
+ <Box width="100%">
60
+ <PageHeader
61
+ toolbar={
62
+ <PageToolbar>
63
+ <PageTabList>
64
+ <PageTab active>My Schedule</PageTab>
65
+ <PageTab>All Plans</PageTab>
66
+ </PageTabList>
67
+ <PageActions>
68
+ <PageButton title="One" />
69
+ <PageButton title="Two" />
70
+ </PageActions>
71
+ </PageToolbar>
72
+ }
73
+ >
74
+ <PageTitle>People</PageTitle>
75
+ </PageHeader>
76
+ <PageBody
77
+ sidebar={
78
+ <Sidebar grow={0}>
79
+ <Sidebar.Item active>Item 1</Sidebar.Item>
80
+ <Sidebar.Item>Item 2</Sidebar.Item>
81
+ <Sidebar.Item>Item 3</Sidebar.Item>
82
+ </Sidebar>
83
+ }
84
+ >
85
+ Regular body
86
+ </PageBody>
87
+ </Box>
88
+ )
89
+ ```
90
+
36
91
  ```jsx live
37
92
  render(
38
93
  <Box width="100%">
@@ -74,7 +129,7 @@ render(
74
129
 
75
130
  ## Theming
76
131
 
77
- Use theme keys `pageBody`, `pageButton`, `pageDropdown`, and `pageTitle` to override `Page` component props.
132
+ Use theme keys `pageBody`, `pageButton`, `pageDropdown`, `pageHeader`, and `pageTitle` to override `Page` component props.
78
133
 
79
134
  ```jsx live
80
135
  render(
@@ -3,7 +3,18 @@ import React from 'react'
3
3
  import StackView from '../StackView'
4
4
 
5
5
  function PageActions(props) {
6
- return <StackView axis="horizontal" spacing={1} {...props} />
6
+ return (
7
+ <StackView
8
+ alignment="center"
9
+ alignSelf="end"
10
+ axis="horizontal"
11
+ distribution="end"
12
+ flex="1"
13
+ paddingBottom={2}
14
+ spacing={1}
15
+ {...props}
16
+ />
17
+ )
7
18
  }
8
19
 
9
20
  export default PageActions
@@ -1,41 +1,35 @@
1
- import React, { Children } from 'react'
1
+ import React from 'react'
2
2
 
3
3
  import { useThemeValue } from '../system'
4
4
  import StackView from '../StackView'
5
5
 
6
- import { PAGE_TABLIST_DISPLAY_NAME } from './PageTabList'
7
-
8
6
  function PageHeader({ children, toolbar, ...restProps }) {
9
7
  const themeProps = useThemeValue('pageHeader')
10
- const tabsPresent = toolbar
11
- ? Children.toArray(toolbar.props.children).some(
12
- (child) => child && child.type.displayName === PAGE_TABLIST_DISPLAY_NAME
13
- )
14
- : false
15
- const childrenToRender = toolbar
16
- ? children
17
- ? Children.toArray([
18
- <StackView axis="horizontal" alignment="center" width="100%">
19
- {children}
20
- </StackView>,
21
- toolbar,
22
- ])
23
- : toolbar
24
- : children
25
8
  return (
26
9
  <StackView
27
10
  as="header"
28
- axis={children && toolbar ? 'vertical' : 'horizontal'}
29
- alignment={children && toolbar ? 'start' : 'center'}
30
- paddingHorizontal={3}
31
- paddingTop={1.5}
32
- paddingBottom={tabsPresent ? null : 1.5}
33
- spacing={1.5}
11
+ axis="vertical"
34
12
  backgroundColor="primary-light"
13
+ paddingHorizontal={2}
14
+ minHeight={8}
15
+ mediaQueries={{
16
+ sm: { paddingHorizontal: 3 },
17
+ }}
18
+ spacing={0}
35
19
  {...themeProps}
36
20
  {...restProps}
37
21
  >
38
- {childrenToRender}
22
+ {children && (
23
+ <StackView
24
+ alignment="center"
25
+ axis="horizontal"
26
+ paddingTop={2}
27
+ width="100%"
28
+ >
29
+ {children}
30
+ </StackView>
31
+ )}
32
+ {toolbar}
39
33
  </StackView>
40
34
  )
41
35
  }
@@ -1,9 +1,23 @@
1
1
  import React from 'react'
2
2
 
3
3
  import Tab from '../Tab'
4
+ import { useThemeValue } from '../system'
4
5
 
5
6
  function PageTab(props) {
6
- return <Tab {...props} size="lg" />
7
+ const themeProps = useThemeValue('pageTab')
8
+ return (
9
+ <Tab
10
+ mediaQueries={{
11
+ sm: {
12
+ paddingHorizontal: 3,
13
+ },
14
+ }}
15
+ paddingHorizontal={1.5}
16
+ size="lg"
17
+ {...themeProps}
18
+ {...props}
19
+ />
20
+ )
7
21
  }
8
22
 
9
23
  export default PageTab
@@ -2,12 +2,14 @@ import React from 'react'
2
2
 
3
3
  import StackView from '../StackView'
4
4
 
5
- export const PAGE_TABLIST_DISPLAY_NAME = 'PageTabList'
6
-
7
- function PageTabList(props) {
8
- return <StackView axis="horizontal" spacing={0.5} {...props} />
5
+ export default function PageTabList(props) {
6
+ return (
7
+ <StackView
8
+ axis="horizontal"
9
+ paddingTop={2}
10
+ spacing={0.5}
11
+ alignSelf="end"
12
+ {...props}
13
+ />
14
+ )
9
15
  }
10
-
11
- PageTabList.displayName = PAGE_TABLIST_DISPLAY_NAME
12
-
13
- export default PageTabList
@@ -5,7 +5,15 @@ import Heading from '../Heading'
5
5
 
6
6
  function PageTitle(props) {
7
7
  const themeProps = useThemeValue('pageTitle')
8
- return <Heading level={2} color="white" {...themeProps} {...props} />
8
+ return (
9
+ <Heading
10
+ color="white"
11
+ fontSize="25px"
12
+ level={2}
13
+ {...themeProps}
14
+ {...props}
15
+ />
16
+ )
9
17
  }
10
18
 
11
19
  export default PageTitle
@@ -1,17 +1,40 @@
1
1
  import React from 'react'
2
2
 
3
3
  import StackView from '../StackView'
4
+ import { useThemeValue } from '../system'
5
+
6
+ function PageToolbar({ stackBelow, ...restProps }) {
7
+ const themeBreakpoints = useThemeValue('breakpoints')
8
+ const breakpoint = Object.keys(themeBreakpoints).includes(stackBelow)
9
+ ? stackBelow
10
+ : 'sm'
11
+ const stackProps = stackBelow
12
+ ? {
13
+ axis: 'vertical',
14
+ alignment: 'stretch',
15
+ spacing: 2,
16
+ mediaQueries: {
17
+ [breakpoint]: {
18
+ axis: 'horizontal',
19
+ alignment: 'center',
20
+ paddingBottom: 0,
21
+ spacing: 0,
22
+ },
23
+ },
24
+ }
25
+ : null
4
26
 
5
- function PageToolbar({ children }) {
6
27
  return (
7
28
  <StackView
8
- grow={1}
29
+ alignment="center"
9
30
  axis="horizontal"
10
- alignment="start"
11
31
  distribution="space-between"
12
- >
13
- {children}
14
- </StackView>
32
+ flex={1}
33
+ spacing={2}
34
+ width="100%"
35
+ {...stackProps}
36
+ {...restProps}
37
+ />
15
38
  )
16
39
  }
17
40
 
@@ -136,7 +136,7 @@ function Radio({
136
136
  opacity={0}
137
137
  />
138
138
 
139
- <Icon className="ui-kit-Radio-Icon" size={size}>
139
+ <Icon className="tapestry-react-Radio-Icon" size={size}>
140
140
  <Icon.Path
141
141
  name={iconPaths.fill}
142
142
  fill={radioTheme.fill}
@@ -10,10 +10,10 @@ import { Theme } from '../index'
10
10
  import { objectToCSSProperties, shallowEqual } from '../utils'
11
11
  import { setRootStyles, styleReset } from './styles'
12
12
 
13
- const STORAGE_KEY = 'ui-kit-theme'
13
+ const STORAGE_KEY = 'tapestry-react-theme'
14
14
 
15
15
  export const cache = createCache({
16
- key: 'uikit',
16
+ key: 'tapestry-react',
17
17
  prefix: (key) => {
18
18
  switch (key) {
19
19
  case 'appearance':
@@ -9,7 +9,7 @@ const getRootStyles = (styles) => {
9
9
  }
10
10
 
11
11
  export const setRootStyles = (styles) => {
12
- const styleElement = <HTMLStyleElement>document.getElementById('uikit-style')
12
+ const styleElement = <HTMLStyleElement>document.getElementById('tapestry-react-style')
13
13
  const sheet = <CSSStyleSheet>styleElement.sheet
14
14
  const styleString = getRootStyles(styles)
15
15
  sheet.deleteRule(0)
@@ -24,7 +24,7 @@ export const defaultColorProperties = objectToCSSProperties(
24
24
  export const styleReset = `
25
25
  ${getRootStyles(defaultColorProperties)}
26
26
 
27
- .uikit-reset {
27
+ .tapestry-react-reset {
28
28
  appearance: none;
29
29
  box-sizing: border-box;
30
30
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
@@ -40,12 +40,12 @@ ${getRootStyles(defaultColorProperties)}
40
40
  color: inherit;
41
41
  }
42
42
 
43
- .uikit-reset::-moz-focus-inner {
43
+ .tapestry-react-reset::-moz-focus-inner {
44
44
  padding: 0px;
45
45
  border: 0px;
46
46
  }
47
47
 
48
- .uikit-reset:focus:not(.focus-visible) {
48
+ .tapestry-react-reset:focus:not(.focus-visible) {
49
49
  outline: 0px;
50
50
  }
51
51
  `
@@ -56,9 +56,9 @@ ${getRootStyles(defaultColorProperties)}
56
56
  // we use our own global style implementation in place of Emotion Global
57
57
  // so we can have more control over when styles are injected since multiple
58
58
  // Providers can be used on a page
59
- if (typeof window !== 'undefined' && !document.getElementById('uikit-style')) {
59
+ if (typeof window !== 'undefined' && !document.getElementById('tapestry-react-style')) {
60
60
  const styleElement = document.createElement('style')
61
- styleElement.id = 'uikit-style'
61
+ styleElement.id = 'tapestry-react-style'
62
62
  styleElement.innerHTML = styleReset
63
63
  document.head.insertAdjacentElement('afterbegin', styleElement)
64
64
  }
package/src/server.js CHANGED
@@ -4,7 +4,7 @@ import ThemeProvider from './ThemeProvider'
4
4
 
5
5
  export const styleElement = (
6
6
  <style
7
- id="uikit-style"
7
+ id="tapestry-react-style"
8
8
  dangerouslySetInnerHTML={{ __html: ThemeProvider.styleReset }}
9
9
  />
10
10
  )
@@ -41,7 +41,7 @@ function Box(props) {
41
41
 
42
42
  <small>See the [Box](../Box/Box.tsx) component for an actual implementation.</small>
43
43
 
44
- The `splitStyles` function will also process any `mediaQueries` and `variants` props that are defined. See [Responsive](https://ministrycentered.github.io/ui-kit/responsive) and [Variants](https://ministrycentered.github.io/ui-kit/variants) for more information and examples.
44
+ The `splitStyles` function will also process any `mediaQueries` and `variants` props that are defined. See [Responsive](https://ministrycentered.github.io/tapestry-react/responsive) and [Variants](https://ministrycentered.github.io/tapestry-react/variants) for more information and examples.
45
45
 
46
46
  ### Plugins
47
47
 
@@ -90,7 +90,7 @@ function StackView(props) {
90
90
  A fork of the [CXS](https://github.com/cxs-css/cxs) library is available as an escape hatch if Emotion is performing poorly. This is specifically used to combat performance issues in intensive components like `DataTable`. This is done through a `useCss` hook exported from system:
91
91
 
92
92
  ```jsx
93
- import { designSystem } from '@planning-center/ui-kit'
93
+ import { designSystem } from '@planningcenter/tapestry-react'
94
94
  function Box({ color, ...props }) {
95
95
  const css = designSystem.useCss()
96
96
  return <div className={css({ color })} {...props} />
@@ -26,7 +26,7 @@ export default function ({
26
26
  }
27
27
  return {
28
28
  ...restProps,
29
- className: className ? `uikit-reset ${className}` : `uikit-reset`,
29
+ className: className ? `tapestry-react-reset ${className}` : `tapestry-react-reset`,
30
30
  css: (theme) => {
31
31
  const propStyles = {}
32
32
  for (const prop in styleProps) {