@orangesk/orange-design-system 2.0.0-beta.11 → 2.0.0-beta.13

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 (63) hide show
  1. package/build/components/index.js +4 -4
  2. package/build/components/index.js.map +1 -1
  3. package/build/components/tsconfig.tsbuildinfo +1 -1
  4. package/build/components/types/index.d.ts +14 -8
  5. package/build/components/types/src/components/Carousel/Carousel.static.d.ts +34 -1
  6. package/build/components/types/src/components/Cover/Cover.d.ts +3 -3
  7. package/build/components/types/src/components/Modal/Modal.d.ts +0 -2
  8. package/build/components/types/src/components/Modal/index.d.ts +0 -1
  9. package/build/components/types/src/components/Pill/Pill.d.ts +1 -1
  10. package/build/components/types/src/components/Table/Table.d.ts +2 -0
  11. package/build/components/types/src/components/Table/docsData.d.ts +2 -0
  12. package/build/components/types/src/components/Table/types.d.ts +1 -0
  13. package/build/components/types/src/components/Tag/Tag.d.ts +0 -2
  14. package/build/components/types/src/components/index.d.ts +2 -2
  15. package/build/fonts/HelveticaNeue-Bold.woff2 +0 -0
  16. package/build/fonts/HelveticaNeue-Light.woff2 +0 -0
  17. package/build/fonts/HelveticaNeue-Roman.woff2 +0 -0
  18. package/build/lib/components.css +1 -1
  19. package/build/lib/components.css.map +1 -1
  20. package/build/lib/scripts.js +4 -4
  21. package/build/lib/scripts.js.map +1 -1
  22. package/build/lib/style.css +1 -1
  23. package/build/lib/style.css.map +1 -1
  24. package/package.json +9 -9
  25. package/public/fonts/HelveticaNeue-Bold.woff2 +0 -0
  26. package/public/fonts/HelveticaNeue-Light.woff2 +0 -0
  27. package/public/fonts/HelveticaNeue-Roman.woff2 +0 -0
  28. package/src/components/AnchorNavigation/AnchorNavigation.static.ts +3 -0
  29. package/src/components/AnchorNavigation/styles/mixins.scss +4 -4
  30. package/src/components/Button/styles/config.scss +5 -4
  31. package/src/components/Carousel/Carousel.static.ts +204 -1
  32. package/src/components/Carousel/tests/Carousel.static.test.js +403 -0
  33. package/src/components/Carousel/tests/Carousel.unit.test.js +68 -0
  34. package/src/components/Cover/Cover.tsx +22 -20
  35. package/src/components/Cover/styles/config.scss +23 -12
  36. package/src/components/Cover/styles/mixins.scss +6 -5
  37. package/src/components/Cover/tests/Cover.unit.test.js +52 -52
  38. package/src/components/Forms/Group/styles/mixins.scss +14 -0
  39. package/src/components/Modal/Modal.tsx +1 -9
  40. package/src/components/Modal/index.ts +0 -1
  41. package/src/components/Modal/styles/config.scss +4 -4
  42. package/src/components/Modal/styles/mixins.scss +13 -59
  43. package/src/components/Modal/styles/style.scss +0 -16
  44. package/src/components/Modal/tests/Modal.unit.test.js +0 -37
  45. package/src/components/Pill/Pill.tsx +13 -2
  46. package/src/components/Pill/styles/config.scss +2 -21
  47. package/src/components/Pill/styles/style.scss +18 -6
  48. package/src/components/Pill/tests/Pill.conformance.test.js +8 -2
  49. package/src/components/Pill/tests/Pill.unit.test.js +69 -11
  50. package/src/components/Table/Row.tsx +9 -3
  51. package/src/components/Table/Table.tsx +11 -1
  52. package/src/components/Table/TableContext.ts +1 -0
  53. package/src/components/Table/docsData.ts +25 -0
  54. package/src/components/Table/styles/mixins.scss +37 -0
  55. package/src/components/Table/styles/style.scss +6 -0
  56. package/src/components/Table/types.ts +1 -0
  57. package/src/components/Tag/Tag.tsx +0 -2
  58. package/src/components/Tag/styles/style.scss +32 -0
  59. package/src/components/Tooltip/InfoTooltip.tsx +1 -5
  60. package/src/components/index.ts +2 -0
  61. package/src/styles/tokens/color.scss +1 -1
  62. package/build/components/types/src/components/Modal/ModalProductBody.d.ts +0 -10
  63. package/src/components/Modal/ModalProductBody.tsx +0 -52
@@ -14,8 +14,9 @@ interface RowProps {
14
14
  }
15
15
 
16
16
  const Row = ({ row }: RowProps) => {
17
- const { headers, expandableRows } = React.useContext(TableContext);
18
- return headers.map(({ key, cellProps }, index, array) => {
17
+ const { headers, expandableRows, isResponsive } =
18
+ React.useContext(TableContext);
19
+ return headers.map(({ key, label, cellProps }, index, array) => {
19
20
  const cell = row[key];
20
21
  const isObject = typeof cell === "object" && cell !== null;
21
22
  const value = isObject && "value" in cell ? cell.value : cell;
@@ -26,9 +27,14 @@ const Row = ({ row }: RowProps) => {
26
27
  .reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
27
28
  : {};
28
29
  const rl = row?.expand?.length || 0;
30
+
29
31
  return (
30
32
  <React.Fragment key={key}>
31
- <Cell {...cellProps} {...props}>
33
+ <Cell
34
+ {...cellProps}
35
+ {...props}
36
+ {...(isResponsive && { "data-label": label })}
37
+ >
32
38
  {value ? (value as React.ReactNode) : ""}
33
39
  </Cell>
34
40
  {index === array.length - 1 &&
@@ -23,6 +23,8 @@ interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {
23
23
  headers: TableHeader[];
24
24
  /** Compact table only takes spaced needed to display its content */
25
25
  isCompact?: boolean;
26
+ /** Enable responsive card layout below md breakpoint for better accessibility */
27
+ isResponsive?: boolean;
26
28
  /** If table has horizontal scrollbar */
27
29
  isScrollable?: boolean;
28
30
  /** Different colors for even and odd rows. */
@@ -43,6 +45,7 @@ const Table: React.FC<TableProps> = ({
43
45
  rows,
44
46
  footers,
45
47
  isCompact,
48
+ isResponsive,
46
49
  isStriped,
47
50
  isScrollable,
48
51
  colorScheme,
@@ -60,6 +63,7 @@ const Table: React.FC<TableProps> = ({
60
63
  {
61
64
  [`${CLASS_ROOT}--striped`]: isStriped,
62
65
  [`${CLASS_ROOT}--compact`]: isCompact,
66
+ [`${CLASS_ROOT}--responsive`]: isResponsive,
63
67
  "is-dark": colorScheme === "dark",
64
68
  "is-light": colorScheme === "light",
65
69
  },
@@ -94,6 +98,7 @@ const Table: React.FC<TableProps> = ({
94
98
  footers,
95
99
  rows: customRows,
96
100
  expandableRows,
101
+ isResponsive,
97
102
  };
98
103
 
99
104
  const table = (
@@ -108,7 +113,12 @@ const Table: React.FC<TableProps> = ({
108
113
  />
109
114
  }
110
115
  >
111
- <table ref={tableRef} className={classes} {...other}>
116
+ <table
117
+ ref={tableRef}
118
+ className={classes}
119
+ {...(isResponsive && { "data-table": "responsive" })}
120
+ {...other}
121
+ >
112
122
  {caption && (
113
123
  <caption {...(isScrollable && { id: captionId })}>
114
124
  {caption}
@@ -6,6 +6,7 @@ import { TableContextType } from "./types";
6
6
  const TableContext = React.createContext<TableContextType>({
7
7
  headers: [],
8
8
  rows: [],
9
+ isResponsive: false,
9
10
  });
10
11
 
11
12
  export default TableContext;
@@ -208,3 +208,28 @@ export const fillRows: TableRow[] = [
208
208
  col2: "3",
209
209
  },
210
210
  ];
211
+
212
+ export const responsiveHeaders: TableHeader[] = [
213
+ {
214
+ key: "account",
215
+ label: "Účel spracovania",
216
+ },
217
+ {
218
+ key: "legal",
219
+ label: "Právny základ a doba spracovania",
220
+ },
221
+ ];
222
+
223
+ export const responsiveRows: TableRow[] = [
224
+ {
225
+ account: "Mesačný poplatok (bez Digitálnej odmeny)",
226
+ legal:
227
+ "Právny základ - Súhlas (čl. 6 ods. 1 písm. a) GDPR) a zmluva (čl. 6 ods. 1 písm. b) GDPR) a oprávnený záujem (čl. 6 ods. 1 písm. f) GDPR). Všeobecná doba uchovávania – Počas trvania zmluvného vzťahu.",
228
+ },
229
+ {
230
+ account:
231
+ "Online predaj tovarov a poskytovanie doplnkových a asistenčných služieb",
232
+ legal:
233
+ "Právny základ - Zmluva (čl. 6 ods. 1 písm. b) GDPR) a oprávnený záujem (čl. 6 ods. 1 písm. f) GDPR). Všeobecná doba uchovávania – Počas trvania zmluvného vzťahu a uplynutia záručnej doby na predaný tovar.",
234
+ },
235
+ ];
@@ -112,3 +112,40 @@
112
112
  @mixin compact {
113
113
  width: auto;
114
114
  }
115
+
116
+ @mixin responsive-table {
117
+ thead {
118
+ display: none;
119
+ }
120
+
121
+ tbody,
122
+ tbody tr,
123
+ tbody td {
124
+ display: block;
125
+ }
126
+
127
+ tbody tr {
128
+ padding: space.get("small") 0;
129
+
130
+ &:last-child {
131
+ margin-bottom: 0;
132
+ }
133
+ }
134
+
135
+ tbody td {
136
+ padding: space.get("medium") 0;
137
+ border-bottom: none;
138
+ text-align: left !important;
139
+
140
+ &:before {
141
+ content: attr(data-label);
142
+ display: block;
143
+ font-weight: 700;
144
+ margin-bottom: space.get("xsmall");
145
+ }
146
+
147
+ &:first-child {
148
+ padding-left: 0;
149
+ }
150
+ }
151
+ }
@@ -47,6 +47,12 @@
47
47
  @include mixins.compact;
48
48
  }
49
49
 
50
+ &--responsive {
51
+ @include breakpoint.get("md", "down") {
52
+ @include mixins.responsive-table;
53
+ }
54
+ }
55
+
50
56
  @each $breakpoint in ("default", "sm", "md", "lg", "xl", "xxl") {
51
57
  @include breakpoint.get($breakpoint, "down") {
52
58
  &-scrollable#{generate.variant-name($breakpoint)} {
@@ -37,4 +37,5 @@ export interface TableContextType {
37
37
  rows: TableRow[];
38
38
  footers?: TableRow[];
39
39
  expandableRows?: ExpandableRows;
40
+ isResponsive?: boolean;
40
41
  }
@@ -21,8 +21,6 @@ export type TagSize = "small" | "large";
21
21
  interface CommonProps {
22
22
  color?: TagColor;
23
23
  size?: TagSize;
24
- /** @deprecated */
25
- isInverse?: boolean;
26
24
  isDisabled?: boolean;
27
25
  className?: string;
28
26
  children?: React.ReactNode;
@@ -20,6 +20,38 @@
20
20
  }
21
21
  }
22
22
 
23
+ // Special styling for default tags inside .background-secondary parent
24
+ .background-secondary & {
25
+ // Target tags that don't have any color variant class
26
+ // Use negative lookahead-like approach: exclude if class contains any color variant
27
+ &:not([class*="--orange"]):not([class*="--black"]):not(
28
+ [class*="--yellow"]
29
+ ):not([class*="--green"]):not([class*="--blue"]):not(
30
+ [class*="--success"]
31
+ ):not([class*="--danger"]):not([class*="--info"]):not(
32
+ [class*="--warning"]
33
+ ):not([class*="--transparent"]) {
34
+ background-color: var(--color-surface-moderate);
35
+
36
+ // Clickable tags should have same default background but keep normal interactive states
37
+ &:where(button),
38
+ &:where(a) {
39
+ background-color: var(--color-surface-moderate);
40
+
41
+ &:focus-visible,
42
+ &:hover {
43
+ background-color: color.$gray-600;
44
+ }
45
+
46
+ &:active,
47
+ &.is-active {
48
+ color: var(--color-text-inverse);
49
+ background-color: var(--color-background-contrast);
50
+ }
51
+ }
52
+ }
53
+ }
54
+
23
55
  // Transparent class is a special variant of color, it's not possible to make transparent variant for each color at the moment.
24
56
  &--transparent {
25
57
  @include mixins.color-transparent();
@@ -26,11 +26,7 @@ const InfoTooltip: React.FC<InfoTooltipProps> = ({
26
26
  )}
27
27
  {...other}
28
28
  >
29
- <Icon
30
- name="assistance"
31
- color="info"
32
- className={cx(`${CLASS_ROOT}__icon`, className)}
33
- />
29
+ <Icon name="assistance" className={cx(`${CLASS_ROOT}__icon`, className)} />
34
30
  <span className="sr-only">Info</span>
35
31
  </Tooltip>
36
32
  );
@@ -47,6 +47,7 @@ import {
47
47
  ModalCloseButton,
48
48
  ModalTitle,
49
49
  ModalProductHeader,
50
+ ModalProductFooter,
50
51
  } from "./Modal";
51
52
  import { Section } from "./Section";
52
53
  import { Sticker } from "./Sticker";
@@ -156,6 +157,7 @@ export {
156
157
  Modal,
157
158
  ModalBody,
158
159
  ModalCloseButton,
160
+ ModalProductFooter,
159
161
  ModalProductHeader,
160
162
  ModalTitle,
161
163
  Pagination,
@@ -112,7 +112,7 @@ $colors-dark: (
112
112
  $orange: map.get($colors-light, icon-brand);
113
113
  $orange-dark: map.get($colors-light, surface-tertiary);
114
114
  $black: map.get($colors-light, icon-default);
115
- $white: map.get($colors-light, icon-inverse);
115
+ $white: map.get($colors-light, text-inverse);
116
116
  $blue: map.get($colors-light, fill-accent1);
117
117
  $green: map.get($colors-light, fill-accent2);
118
118
  $pink: map.get($colors-light, fill-accent3);
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- interface ModalProductBodyProps extends React.HTMLAttributes<HTMLDivElement> {
3
- subtitleSection?: React.ReactNode;
4
- listSection?: React.ReactNode;
5
- benefitsSection?: React.ReactNode;
6
- extraPaymentsSection?: React.ReactNode;
7
- }
8
- export declare const CLASS_ROOT = "modal__product-body";
9
- declare const ModalProductBody: React.ForwardRefExoticComponent<ModalProductBodyProps & React.RefAttributes<HTMLDivElement>>;
10
- export { ModalProductBody };
@@ -1,52 +0,0 @@
1
- import React from "react";
2
- import cx from "classnames";
3
-
4
- interface ModalProductBodyProps extends React.HTMLAttributes<HTMLDivElement> {
5
- subtitleSection?: React.ReactNode;
6
- listSection?: React.ReactNode;
7
- benefitsSection?: React.ReactNode;
8
- extraPaymentsSection?: React.ReactNode;
9
- }
10
-
11
- export const CLASS_ROOT = "modal__product-body";
12
-
13
- const ModalProductBody = React.forwardRef<
14
- HTMLDivElement,
15
- ModalProductBodyProps
16
- >(
17
- (
18
- {
19
- className,
20
- subtitleSection,
21
- listSection,
22
- benefitsSection,
23
- extraPaymentsSection,
24
- ...other
25
- },
26
- ref,
27
- ) => {
28
- const classes = cx(CLASS_ROOT, className);
29
-
30
- const subtitleSectionClass = `${CLASS_ROOT}-subtitle-section`;
31
- const listSectionClass = `${CLASS_ROOT}-list-section`;
32
- const accordionSectionClass = `${CLASS_ROOT}-accordion-section`;
33
-
34
- return (
35
- <div className={classes} ref={ref} {...other}>
36
- {subtitleSection && (
37
- <div className={subtitleSectionClass}>{subtitleSection}</div>
38
- )}
39
- {listSection && <div className={listSectionClass}>{listSection}</div>}
40
- {benefitsSection && (
41
- <div className={accordionSectionClass}>{benefitsSection}</div>
42
- )}
43
- {extraPaymentsSection && (
44
- <div className={listSectionClass}>{extraPaymentsSection}</div>
45
- )}
46
- </div>
47
- );
48
- },
49
- );
50
- ModalProductBody.displayName = "ModalProductBody";
51
-
52
- export { ModalProductBody };