@coveord/plasma-mantine 55.0.4 → 55.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 (47) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +36 -35
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/child-form/ChildForm.d.ts +44 -0
  5. package/dist/cjs/components/child-form/ChildForm.d.ts.map +1 -0
  6. package/dist/cjs/components/child-form/ChildForm.js +73 -0
  7. package/dist/cjs/components/child-form/ChildForm.js.map +1 -0
  8. package/dist/cjs/components/child-form/ChildForm.module.css +7 -0
  9. package/dist/cjs/components/child-form/index.d.ts +2 -0
  10. package/dist/cjs/components/child-form/index.d.ts.map +1 -0
  11. package/dist/cjs/components/child-form/index.js +8 -0
  12. package/dist/cjs/components/child-form/index.js.map +1 -0
  13. package/dist/cjs/components/ellipsis-text/EllipsisText.d.ts +1 -1
  14. package/dist/cjs/components/ellipsis-text/EllipsisText.d.ts.map +1 -1
  15. package/dist/cjs/components/ellipsis-text/EllipsisText.js +20 -7
  16. package/dist/cjs/components/ellipsis-text/EllipsisText.js.map +1 -1
  17. package/dist/cjs/components/ellipsis-text/EllipsisText.module.css +6 -1
  18. package/dist/cjs/components/index.d.ts +1 -0
  19. package/dist/cjs/components/index.d.ts.map +1 -1
  20. package/dist/cjs/components/index.js +1 -0
  21. package/dist/cjs/components/index.js.map +1 -1
  22. package/dist/esm/components/child-form/ChildForm.d.ts +44 -0
  23. package/dist/esm/components/child-form/ChildForm.d.ts.map +1 -0
  24. package/dist/esm/components/child-form/ChildForm.js +50 -0
  25. package/dist/esm/components/child-form/ChildForm.js.map +1 -0
  26. package/dist/esm/components/child-form/ChildForm.module.css +7 -0
  27. package/dist/esm/components/child-form/index.d.ts +2 -0
  28. package/dist/esm/components/child-form/index.d.ts.map +1 -0
  29. package/dist/esm/components/child-form/index.js +3 -0
  30. package/dist/esm/components/child-form/index.js.map +1 -0
  31. package/dist/esm/components/ellipsis-text/EllipsisText.d.ts +1 -1
  32. package/dist/esm/components/ellipsis-text/EllipsisText.d.ts.map +1 -1
  33. package/dist/esm/components/ellipsis-text/EllipsisText.js +18 -6
  34. package/dist/esm/components/ellipsis-text/EllipsisText.js.map +1 -1
  35. package/dist/esm/components/ellipsis-text/EllipsisText.module.css +6 -1
  36. package/dist/esm/components/index.d.ts +1 -0
  37. package/dist/esm/components/index.d.ts.map +1 -1
  38. package/dist/esm/components/index.js +1 -0
  39. package/dist/esm/components/index.js.map +1 -1
  40. package/package.json +3 -3
  41. package/src/components/child-form/ChildForm.module.css +7 -0
  42. package/src/components/child-form/ChildForm.tsx +70 -0
  43. package/src/components/child-form/__tests__/ChildForm.spec.tsx +30 -0
  44. package/src/components/child-form/index.ts +1 -0
  45. package/src/components/ellipsis-text/EllipsisText.module.css +6 -1
  46. package/src/components/ellipsis-text/EllipsisText.tsx +20 -11
  47. package/src/components/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './action-icon';\nexport * from './blank-slate';\nexport * from './browser-preview';\nexport * from './button';\nexport * from './code-editor';\nexport * from './collection';\nexport * from './copyToClipboard';\nexport * from './date-range-picker';\nexport * from './ellipsis-text';\nexport * from './header';\nexport * from './inline-confirm';\nexport * from './menu';\nexport * from './prompt';\nexport * from './read-only';\nexport * from './sticky-footer';\nexport * from './table';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,WAAW;AACzB,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,UAAU"}
1
+ {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './action-icon';\nexport * from './blank-slate';\nexport * from './browser-preview';\nexport * from './button';\nexport * from './code-editor';\nexport * from './collection';\nexport * from './copyToClipboard';\nexport * from './date-range-picker';\nexport * from './ellipsis-text';\nexport * from './header';\nexport * from './inline-confirm';\nexport * from './menu';\nexport * from './prompt';\nexport * from './read-only';\nexport * from './sticky-footer';\nexport * from './table';\nexport * from './child-form';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,WAAW;AACzB,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,UAAU;AACxB,cAAc,eAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "55.0.4",
3
+ "version": "55.2.0",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -42,8 +42,8 @@
42
42
  "lodash.debounce": "4.0.8",
43
43
  "lodash.defaultsdeep": "4.6.1",
44
44
  "monaco-editor": "0.52.0",
45
- "@coveord/plasma-react-icons": "55.0.4",
46
- "@coveord/plasma-tokens": "55.0.4"
45
+ "@coveord/plasma-react-icons": "55.2.0",
46
+ "@coveord/plasma-tokens": "55.2.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@mantine/carousel": "7.13.3",
@@ -0,0 +1,7 @@
1
+ .paper {
2
+ border: 1px solid var(--mantine-color-gray-3);
3
+ border-radius: var(--mantine-radius-default);
4
+ box-shadow:
5
+ 0 1px 0 -1px var(--mantine-color-gray-3) inset,
6
+ 0 4px 2px -2px rgb(55 55 55 / 3%) inset;
7
+ }
@@ -0,0 +1,70 @@
1
+ import {
2
+ Collapse,
3
+ CollapseProps,
4
+ Factory,
5
+ Paper,
6
+ polymorphicFactory,
7
+ Stack,
8
+ StylesApiProps,
9
+ Text,
10
+ Title,
11
+ useProps,
12
+ useStyles,
13
+ } from '@mantine/core';
14
+ import classes from './ChildForm.module.css';
15
+
16
+ export type ChildFormStylesNames = 'root' | 'paper';
17
+
18
+ export interface ChildFormProps extends CollapseProps, StylesApiProps<ChildFormFactory> {
19
+ /**
20
+ * Title of the child form.
21
+ */
22
+ title?: string;
23
+ /**
24
+ * Description of the child form.
25
+ */
26
+ description?: string;
27
+ }
28
+
29
+ type ChildFormFactory = Factory<{
30
+ props: ChildFormProps;
31
+ defaultRef: HTMLDivElement;
32
+ defaultComponent: 'div';
33
+ stylesNames: ChildFormStylesNames;
34
+ }>;
35
+
36
+ const defaultProps: Partial<ChildFormProps> = {};
37
+
38
+ export const ChildForm = polymorphicFactory<ChildFormFactory>((props, ref) => {
39
+ const {className, children, style, classNames, styles, unstyled, vars, title, description, ...others} = useProps(
40
+ 'ChildForm',
41
+ defaultProps,
42
+ props,
43
+ );
44
+
45
+ const getStyles = useStyles<ChildFormFactory>({
46
+ name: 'ChildForm',
47
+ classes,
48
+ props,
49
+ className,
50
+ style,
51
+ classNames,
52
+ styles,
53
+ unstyled,
54
+ vars,
55
+ });
56
+
57
+ return (
58
+ <Collapse ref={ref} {...others} {...getStyles('root')}>
59
+ <Paper bg="gray.0" p="md" {...getStyles('paper')}>
60
+ {(title || description) && (
61
+ <Stack gap={0} mb="md">
62
+ {title && <Title order={5}>{title}</Title>}
63
+ {description && <Text c="gray.7">{description}</Text>}
64
+ </Stack>
65
+ )}
66
+ <Stack gap="md">{children}</Stack>
67
+ </Paper>
68
+ </Collapse>
69
+ );
70
+ });
@@ -0,0 +1,30 @@
1
+ import {TextInput} from '@mantine/core';
2
+ import {render, screen} from '../../../__tests__/Utils';
3
+ import {ChildForm} from '../ChildForm';
4
+
5
+ describe('ChildForm', () => {
6
+ it('renders the provided title and description', async () => {
7
+ render(<ChildForm in={true} title="This is a title" description="This is a description" />);
8
+
9
+ expect(screen.getByText(/this is a title/i)).toBeInTheDocument();
10
+ expect(screen.getByText(/this is a description/i)).toBeInTheDocument();
11
+ });
12
+ it('renders the content', () => {
13
+ render(
14
+ <ChildForm in={true}>
15
+ <TextInput label="Text input" />
16
+ </ChildForm>,
17
+ );
18
+
19
+ expect(screen.getByRole('textbox', {name: /text input/i})).toBeInTheDocument();
20
+ });
21
+ it('hides the container', () => {
22
+ render(
23
+ <ChildForm in={false}>
24
+ <TextInput label="Text input" />
25
+ </ChildForm>,
26
+ );
27
+
28
+ expect(screen.queryByRole('textbox', {name: /text input/i})).not.toBeInTheDocument();
29
+ });
30
+ });
@@ -0,0 +1 @@
1
+ export * from './ChildForm';
@@ -1,8 +1,13 @@
1
1
  .root {
2
+ display: flex;
3
+ width: 100%;
4
+ }
5
+
6
+ .noWrap {
2
7
  white-space: nowrap;
3
8
  }
4
9
 
5
- .text {
10
+ .ellipsis {
6
11
  flex-basis: 100%;
7
12
  overflow: hidden;
8
13
  text-overflow: ellipsis;
@@ -12,13 +12,14 @@ import {
12
12
  useStyles,
13
13
  } from '@mantine/core';
14
14
  import {ReactNode, useRef, useState} from 'react';
15
+ import clsx from 'clsx';
15
16
  import classes from './EllipsisText.module.css';
16
17
 
17
18
  export type EllipsisTextStylesNames = 'root' | 'tooltip' | 'text';
18
19
 
19
20
  export interface EllipsisTextProps
20
21
  extends BoxProps,
21
- Pick<TextProps, 'variant'>,
22
+ Pick<TextProps, 'variant' | 'lineClamp'>,
22
23
  Omit<StylesApiProps<EllipsisTextFactory>, 'variant'> {
23
24
  children: ReactNode;
24
25
  tooltipProps?: Partial<Omit<TooltipProps, 'label' | 'opened' | 'children'>>;
@@ -36,11 +37,9 @@ const defaultProps: Partial<EllipsisTextProps> = {
36
37
  };
37
38
 
38
39
  export const EllipsisText = polymorphicFactory<EllipsisTextFactory>((props, ref) => {
39
- const {className, children, style, classNames, styles, unstyled, variant, tooltipProps, ...others} = useProps(
40
- 'EllipsisText',
41
- defaultProps,
42
- props,
43
- );
40
+ const {className, children, style, classNames, styles, unstyled, variant, lineClamp, tooltipProps, ...others} =
41
+ useProps('EllipsisText', defaultProps, props);
42
+
44
43
  const getStyles = useStyles<EllipsisTextFactory>({
45
44
  name: 'EllipsisText',
46
45
  classes,
@@ -55,6 +54,9 @@ export const EllipsisText = polymorphicFactory<EllipsisTextFactory>((props, ref)
55
54
  const [showTooltip, setShowTooltip] = useState(false);
56
55
  const textRef = useRef<HTMLDivElement>();
57
56
 
57
+ const {className: rootClass, ...rootStyles} = getStyles('root');
58
+ const {className: textClass, ...textStyles} = getStyles('text');
59
+
58
60
  return (
59
61
  <Box
60
62
  ref={ref}
@@ -64,13 +66,20 @@ export const EllipsisText = polymorphicFactory<EllipsisTextFactory>((props, ref)
64
66
  }
65
67
  }}
66
68
  onMouseLeave={() => setShowTooltip(false)}
67
- display="flex"
68
- w="100%"
69
- {...getStyles('root')}
69
+ className={clsx(rootClass, {[classes.noWrap]: !lineClamp})}
70
+ {...rootStyles}
70
71
  {...others}
71
72
  >
72
73
  <Tooltip label={children} opened={showTooltip} {...tooltipProps} {...getStyles('tooltip')}>
73
- <Text variant={variant} ref={textRef} {...getStyles('text')}>
74
+ <Text
75
+ span
76
+ inherit
77
+ variant={variant}
78
+ ref={textRef}
79
+ className={clsx(textClass, {[classes.ellipsis]: !lineClamp})}
80
+ {...(!!lineClamp && {lineClamp: lineClamp})}
81
+ {...textStyles}
82
+ >
74
83
  {children}
75
84
  </Text>
76
85
  </Tooltip>
@@ -78,4 +87,4 @@ export const EllipsisText = polymorphicFactory<EllipsisTextFactory>((props, ref)
78
87
  );
79
88
  });
80
89
 
81
- const isOverflowing = (h: HTMLDivElement) => h.scrollWidth > h.clientWidth;
90
+ const isOverflowing = (h: HTMLDivElement) => h.scrollWidth > h.clientWidth || h.scrollHeight > h.clientHeight;
@@ -14,3 +14,4 @@ export * from './prompt';
14
14
  export * from './read-only';
15
15
  export * from './sticky-footer';
16
16
  export * from './table';
17
+ export * from './child-form';