@telia/teddy 0.0.18 → 0.0.20

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 (71) hide show
  1. package/README.md +0 -3
  2. package/dist/components/accordion/accordion.d.ts +2 -2
  3. package/dist/components/box/box.d.ts +1 -1
  4. package/dist/components/box/box.js +1 -1
  5. package/dist/components/button/button.d.ts +1 -1
  6. package/dist/components/button/button.js +1 -1
  7. package/dist/components/card/card.d.ts +19 -16
  8. package/dist/components/card/card.js +55 -47
  9. package/dist/components/chip/chip-indicator.d.ts +9 -0
  10. package/dist/components/chip/chip-indicator.js +16 -0
  11. package/dist/components/chip/chip-item.d.ts +9 -0
  12. package/dist/components/chip/chip-item.js +28 -0
  13. package/dist/components/chip/chip.d.ts +20 -0
  14. package/dist/components/chip/chip.js +31 -0
  15. package/dist/components/chip/index.d.ts +17 -0
  16. package/dist/components/chip/index.js +10 -0
  17. package/dist/components/field-error-text/field-error-text.d.ts +2 -2
  18. package/dist/components/flex/flex.d.ts +1 -1
  19. package/dist/components/flex/flex.js +1 -1
  20. package/dist/components/grid/grid.d.ts +1 -1
  21. package/dist/components/grid/grid.js +1 -1
  22. package/dist/components/heading/heading.d.ts +1 -1
  23. package/dist/components/heading/heading.js +1 -1
  24. package/dist/components/image/image.d.ts +11 -0
  25. package/dist/components/image/image.js +17 -0
  26. package/dist/components/image/index.d.ts +2 -0
  27. package/dist/components/image/index.js +4 -0
  28. package/dist/components/index.d.ts +2 -0
  29. package/dist/components/index.js +4 -0
  30. package/dist/components/modal/modal.d.ts +3 -3
  31. package/dist/components/modal/modal.js +2 -0
  32. package/dist/components/navigation-menu/navigation-menu.d.ts +1 -1
  33. package/dist/components/notification/notification.d.ts +24 -18
  34. package/dist/components/radio-group/radio-group.d.ts +1 -1
  35. package/dist/components/text/text.d.ts +3 -1
  36. package/dist/components/text/text.js +38 -27
  37. package/dist/components/text-field/text-field.d.ts +4 -4
  38. package/dist/components/toggle/toggle.d.ts +2 -2
  39. package/dist/main.js +4 -0
  40. package/dist/style.css +460 -229
  41. package/dist/utils/generate-styling/color.d.ts +15 -0
  42. package/dist/utils/generate-styling/color.js +12 -0
  43. package/dist/utils/{layout → generate-styling}/index.d.ts +44 -15
  44. package/dist/utils/{layout → generate-styling}/index.js +9 -5
  45. package/dist/utils/{layout → generate-styling}/justify.d.ts +6 -0
  46. package/dist/utils/{layout → generate-styling}/justify.js +2 -1
  47. package/dist/utils/generate-styling/object-fit.d.ts +45 -0
  48. package/dist/utils/generate-styling/object-fit.js +18 -0
  49. package/package.json +1 -1
  50. /package/dist/utils/{layout → generate-styling}/align.d.ts +0 -0
  51. /package/dist/utils/{layout → generate-styling}/align.js +0 -0
  52. /package/dist/utils/{layout → generate-styling}/flex.d.ts +0 -0
  53. /package/dist/utils/{layout → generate-styling}/flex.js +0 -0
  54. /package/dist/utils/{layout → generate-styling}/gap.d.ts +0 -0
  55. /package/dist/utils/{layout → generate-styling}/gap.js +0 -0
  56. /package/dist/utils/{layout → generate-styling}/grid.d.ts +0 -0
  57. /package/dist/utils/{layout → generate-styling}/grid.js +0 -0
  58. /package/dist/utils/{layout → generate-styling}/height.d.ts +0 -0
  59. /package/dist/utils/{layout → generate-styling}/height.js +0 -0
  60. /package/dist/utils/{layout → generate-styling}/inset.d.ts +0 -0
  61. /package/dist/utils/{layout → generate-styling}/inset.js +0 -0
  62. /package/dist/utils/{layout → generate-styling}/margin.d.ts +0 -0
  63. /package/dist/utils/{layout → generate-styling}/margin.js +0 -0
  64. /package/dist/utils/{layout → generate-styling}/padding.d.ts +0 -0
  65. /package/dist/utils/{layout → generate-styling}/padding.js +0 -0
  66. /package/dist/utils/{layout → generate-styling}/position.d.ts +0 -0
  67. /package/dist/utils/{layout → generate-styling}/position.js +0 -0
  68. /package/dist/utils/{layout → generate-styling}/util.d.ts +0 -0
  69. /package/dist/utils/{layout → generate-styling}/util.js +0 -0
  70. /package/dist/utils/{layout → generate-styling}/width.d.ts +0 -0
  71. /package/dist/utils/{layout → generate-styling}/width.js +0 -0
@@ -0,0 +1,15 @@
1
+ import { Responsive } from './util';
2
+
3
+ export declare const colorValues: readonly [];
4
+ export declare const color: readonly [{
5
+ readonly key: "color";
6
+ readonly className: "teddy-color";
7
+ readonly values: readonly [];
8
+ }];
9
+ /**
10
+ * The color. It can be or a responsive value.
11
+ * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
12
+ */
13
+ export type ColorProps = {
14
+ color?: Responsive<(typeof colorValues)[number]['key']>;
15
+ };
@@ -0,0 +1,12 @@
1
+ const colorValues = [];
2
+ const color = [
3
+ {
4
+ key: "color",
5
+ className: "teddy-color",
6
+ values: colorValues
7
+ }
8
+ ];
9
+ export {
10
+ color,
11
+ colorValues
12
+ };
@@ -1,16 +1,18 @@
1
- import { InsetProps } from './inset';
2
- import { PositionProps } from './position';
3
- import { PaddingProps } from './padding';
4
- import { Justify } from './justify';
5
- import { GridLayout, GridChildren } from './grid';
6
- import { GapProps } from './gap';
7
- import { Align } from './align';
8
- import { HTMLAttributes } from 'react';
9
- import { HeightProps } from './height';
10
- import { WidthProps } from './width';
11
- import { FlexChildren, FlexLayout } from './flex';
12
- import { MarginProps } from './margin';
13
1
  import { Responsive } from './util';
2
+ import { MarginProps } from './margin';
3
+ import { FlexChildren, FlexLayout } from './flex';
4
+ import { WidthProps } from './width';
5
+ import { HeightProps } from './height';
6
+ import { HTMLAttributes } from 'react';
7
+ import { Align } from './align';
8
+ import { GapProps } from './gap';
9
+ import { GridLayout, GridChildren } from './grid';
10
+ import { Justify } from './justify';
11
+ import { PaddingProps } from './padding';
12
+ import { PositionProps } from './position';
13
+ import { InsetProps } from './inset';
14
+ import { ColorProps } from './color';
15
+ import { ObjectFitProps } from './object-fit';
14
16
 
15
17
  export declare const displayValues: readonly [{
16
18
  readonly key: "none";
@@ -55,7 +57,7 @@ export declare const displayLayout: readonly [{
55
57
  }];
56
58
  }];
57
59
  export type DisplayLayout = Responsive<(typeof displayValues)[number]['key']>;
58
- export declare const layout: readonly [{
60
+ export declare const stylings: readonly [{
59
61
  readonly key: "position";
60
62
  readonly className: "teddy-position";
61
63
  readonly values: readonly [{
@@ -83,6 +85,25 @@ export declare const layout: readonly [{
83
85
  readonly key: "unset";
84
86
  readonly value: "unset";
85
87
  }];
88
+ }, {
89
+ readonly key: "objectFit";
90
+ readonly className: "teddy-object-fit";
91
+ readonly values: readonly [{
92
+ readonly key: "fill";
93
+ readonly value: "fill";
94
+ }, {
95
+ readonly key: "contain";
96
+ readonly value: "contain";
97
+ }, {
98
+ readonly key: "cover";
99
+ readonly value: "cover";
100
+ }, {
101
+ readonly key: "none";
102
+ readonly value: "none";
103
+ }, {
104
+ readonly key: "scale-down";
105
+ readonly value: "scale-down";
106
+ }];
86
107
  }, {
87
108
  readonly key: "inset";
88
109
  readonly className: "teddy-inset";
@@ -1556,6 +1577,10 @@ export declare const layout: readonly [{
1556
1577
  readonly key: "page-padding-xl";
1557
1578
  readonly value: "var(--teddy-spacing-page-padding-xl)";
1558
1579
  }];
1580
+ }, {
1581
+ readonly key: "color";
1582
+ readonly className: "teddy-color";
1583
+ readonly values: readonly [];
1559
1584
  }, {
1560
1585
  readonly key: "align";
1561
1586
  readonly className: "teddy-ai";
@@ -1590,6 +1615,9 @@ export declare const layout: readonly [{
1590
1615
  }, {
1591
1616
  readonly key: "between";
1592
1617
  readonly value: "space-between";
1618
+ }, {
1619
+ readonly key: "stretch";
1620
+ readonly value: "stretch";
1593
1621
  }];
1594
1622
  }, {
1595
1623
  readonly key: "display";
@@ -1918,7 +1946,8 @@ export declare const layout: readonly [{
1918
1946
  readonly value: "span 12";
1919
1947
  }];
1920
1948
  }];
1921
- export type CommonChildrenLayoutProps = PositionProps & InsetProps & MarginProps & PaddingProps & WidthProps & HeightProps;
1949
+ export type CommonChildrenLayoutProps = PositionProps & InsetProps & MarginProps & PaddingProps & WidthProps & HeightProps & ColorProps;
1950
+ export type ImageStylingProps = CommonChildrenLayoutProps & ObjectFitProps;
1922
1951
  export type ChildrenLayoutProps = FlexChildren & GridChildren & CommonChildrenLayoutProps;
1923
1952
  export type CommonFlexGridLayoutProps = ChildrenLayoutProps & GapProps & {
1924
1953
  align?: Align;
@@ -1926,7 +1955,7 @@ export type CommonFlexGridLayoutProps = ChildrenLayoutProps & GapProps & {
1926
1955
  };
1927
1956
  export type LayoutFlexProps = CommonFlexGridLayoutProps & FlexLayout;
1928
1957
  export type LayoutGridProps = CommonFlexGridLayoutProps & GridLayout;
1929
- export type LayoutProps = Omit<LayoutGridProps, 'display'> & Omit<LayoutFlexProps, 'display'> & {
1958
+ export type LayoutProps = Omit<LayoutGridProps, 'display'> & Omit<ImageStylingProps, 'display'> & Omit<LayoutFlexProps, 'display'> & {
1930
1959
  display?: DisplayLayout;
1931
1960
  };
1932
1961
  type InlineStyle = React.CSSProperties | Record<string, string | number | null | undefined> | undefined;
@@ -10,6 +10,8 @@ import { justify } from "./justify.js";
10
10
  import { paddings } from "./padding.js";
11
11
  import { position } from "./position.js";
12
12
  import { inset } from "./inset.js";
13
+ import { color } from "./color.js";
14
+ import { objectFit } from "./object-fit.js";
13
15
  const breakpoint = {
14
16
  sm: "0px",
15
17
  md: "600px",
@@ -25,14 +27,16 @@ const displayLayout = [
25
27
  values: displayValues
26
28
  }
27
29
  ];
28
- const layout = [
30
+ const stylings = [
29
31
  ...position,
32
+ ...objectFit,
30
33
  ...inset,
31
34
  ...margins,
32
35
  ...paddings,
33
36
  ...widths,
34
37
  ...heights,
35
38
  ...gap,
39
+ ...color,
36
40
  ...align,
37
41
  ...justify,
38
42
  ...displayLayout,
@@ -58,8 +62,8 @@ function extractProps(props) {
58
62
  const extractedProps = { ...props };
59
63
  let style = extractedProps.style;
60
64
  let className = extractedProps.className;
61
- for (const key in layout) {
62
- const currentLayout = layout[key];
65
+ for (const key in stylings) {
66
+ const currentLayout = stylings[key];
63
67
  const currentLayoutKey = currentLayout.key;
64
68
  const layoutProp = extractedProps[currentLayoutKey];
65
69
  if (layoutProp) {
@@ -88,6 +92,6 @@ export {
88
92
  displayLayout,
89
93
  displayValues,
90
94
  extractProps,
91
- layout,
92
- mergeStyles
95
+ mergeStyles,
96
+ stylings
93
97
  };
@@ -12,6 +12,9 @@ export declare const justifyValues: readonly [{
12
12
  }, {
13
13
  readonly key: "between";
14
14
  readonly value: "space-between";
15
+ }, {
16
+ readonly key: "stretch";
17
+ readonly value: "stretch";
15
18
  }];
16
19
  export declare const justify: readonly [{
17
20
  readonly key: "justify";
@@ -28,6 +31,9 @@ export declare const justify: readonly [{
28
31
  }, {
29
32
  readonly key: "between";
30
33
  readonly value: "space-between";
34
+ }, {
35
+ readonly key: "stretch";
36
+ readonly value: "stretch";
31
37
  }];
32
38
  }];
33
39
  /**
@@ -2,7 +2,8 @@ const justifyValues = [
2
2
  { key: "start", value: "flex-start" },
3
3
  { key: "center", value: "center" },
4
4
  { key: "end", value: "flex-end" },
5
- { key: "between", value: "space-between" }
5
+ { key: "between", value: "space-between" },
6
+ { key: "stretch", value: "stretch" }
6
7
  ];
7
8
  const justify = [
8
9
  {
@@ -0,0 +1,45 @@
1
+ import { Responsive } from './util';
2
+
3
+ export declare const objectFitValues: readonly [{
4
+ readonly key: "fill";
5
+ readonly value: "fill";
6
+ }, {
7
+ readonly key: "contain";
8
+ readonly value: "contain";
9
+ }, {
10
+ readonly key: "cover";
11
+ readonly value: "cover";
12
+ }, {
13
+ readonly key: "none";
14
+ readonly value: "none";
15
+ }, {
16
+ readonly key: "scale-down";
17
+ readonly value: "scale-down";
18
+ }];
19
+ export declare const objectFit: readonly [{
20
+ readonly key: "objectFit";
21
+ readonly className: "teddy-object-fit";
22
+ readonly values: readonly [{
23
+ readonly key: "fill";
24
+ readonly value: "fill";
25
+ }, {
26
+ readonly key: "contain";
27
+ readonly value: "contain";
28
+ }, {
29
+ readonly key: "cover";
30
+ readonly value: "cover";
31
+ }, {
32
+ readonly key: "none";
33
+ readonly value: "none";
34
+ }, {
35
+ readonly key: "scale-down";
36
+ readonly value: "scale-down";
37
+ }];
38
+ }];
39
+ /**
40
+ * ObjectFit. It can be or a responsive value.
41
+ * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
42
+ */
43
+ export type ObjectFitProps = {
44
+ objectFit?: Responsive<(typeof objectFitValues)[number]['key']>;
45
+ };
@@ -0,0 +1,18 @@
1
+ const objectFitValues = [
2
+ { key: "fill", value: "fill" },
3
+ { key: "contain", value: "contain" },
4
+ { key: "cover", value: "cover" },
5
+ { key: "none", value: "none" },
6
+ { key: "scale-down", value: "scale-down" }
7
+ ];
8
+ const objectFit = [
9
+ {
10
+ key: "objectFit",
11
+ className: "teddy-object-fit",
12
+ values: objectFitValues
13
+ }
14
+ ];
15
+ export {
16
+ objectFit,
17
+ objectFitValues
18
+ };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "pnpm": ">=8"
19
19
  },
20
20
  "private": false,
21
- "version": "0.0.18",
21
+ "version": "0.0.20",
22
22
  "sideEffects": [
23
23
  "**/*.css"
24
24
  ],
File without changes
File without changes
File without changes
File without changes