@ably/ui 14.0.0-dev.75dcb64 → 14.0.0-dev.7ed5089

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 (75) hide show
  1. package/core/.DS_Store +0 -0
  2. package/core/Code.js +1 -1
  3. package/core/ContactFooter/component.css +9 -7
  4. package/core/ContactFooter.js +1 -1
  5. package/core/CookieMessage/component.css +12 -10
  6. package/core/CookieMessage.js +1 -1
  7. package/core/Expander.js +1 -0
  8. package/core/Flash/component.css +21 -19
  9. package/core/Flash.js +1 -1
  10. package/core/Footer/component.css +24 -22
  11. package/core/Footer.js +1 -1
  12. package/core/Meganav/component.css +105 -103
  13. package/core/Meganav/component.js +1 -1
  14. package/core/Meganav.js +1 -1
  15. package/core/Notice/component.css +6 -4
  16. package/core/Notice/component.js +1 -1
  17. package/core/Notice.js +1 -1
  18. package/core/Slider/component.css +38 -4
  19. package/core/Slider/component.js +1 -1
  20. package/core/Slider.js +1 -1
  21. package/core/Table/Table.js +1 -1
  22. package/core/Table/TableCell.js +4 -4
  23. package/core/Table.js +1 -1
  24. package/core/Tooltip/.DS_Store +0 -0
  25. package/core/Tooltip.js +1 -1
  26. package/core/icons/icon-gui-partial.svg +4 -0
  27. package/core/scripts.js +1 -1
  28. package/core/sprites.svg +1 -1
  29. package/core/styles/buttons.css +123 -121
  30. package/core/styles/forms.css +51 -49
  31. package/core/styles/layout.css +16 -14
  32. package/core/styles/properties.css +252 -250
  33. package/core/styles/text.css +167 -165
  34. package/core/styles.components.css +24 -22
  35. package/core/utils/syntax-highlighter.css +59 -55
  36. package/package.json +2 -4
  37. package/src/.DS_Store +0 -0
  38. package/src/core/.DS_Store +0 -0
  39. package/src/core/Accordion.tsx +4 -4
  40. package/src/core/Code.tsx +0 -1
  41. package/src/core/ContactFooter/component.css +9 -7
  42. package/src/core/ContactFooter.tsx +0 -1
  43. package/src/core/CookieMessage/component.css +12 -10
  44. package/src/core/CookieMessage.tsx +0 -1
  45. package/src/core/Expander/Expander.stories.tsx +152 -0
  46. package/src/core/Expander.tsx +54 -0
  47. package/src/core/Flash/component.css +21 -19
  48. package/src/core/Flash.tsx +1 -2
  49. package/src/core/Footer/component.css +24 -22
  50. package/src/core/Footer.tsx +0 -1
  51. package/src/core/Icon/Icon.stories.tsx +1 -0
  52. package/src/core/Meganav/component.css +105 -103
  53. package/src/core/Meganav/component.js +0 -2
  54. package/src/core/Meganav.tsx +0 -1
  55. package/src/core/Notice/component.css +6 -4
  56. package/src/core/Notice/component.js +0 -1
  57. package/src/core/Notice.tsx +0 -1
  58. package/src/core/Slider/Slider.stories.tsx +82 -29
  59. package/src/core/Slider/component.css +38 -4
  60. package/src/core/Slider/component.js +0 -2
  61. package/src/core/Slider.tsx +166 -86
  62. package/src/core/Table/Table.tsx +38 -9
  63. package/src/core/Table/TableCell.tsx +31 -6
  64. package/src/core/Table.tsx +2 -0
  65. package/src/core/Tooltip/.DS_Store +0 -0
  66. package/src/core/Tooltip.tsx +34 -5
  67. package/src/core/icons/icon-gui-partial.svg +4 -0
  68. package/src/core/scripts.js +0 -2
  69. package/src/core/styles/buttons.css +123 -121
  70. package/src/core/styles/forms.css +51 -49
  71. package/src/core/styles/layout.css +16 -14
  72. package/src/core/styles/properties.css +252 -250
  73. package/src/core/styles/text.css +167 -165
  74. package/src/core/styles.components.css +24 -22
  75. package/src/core/utils/syntax-highlighter.css +59 -55
@@ -1,45 +1,98 @@
1
- import React, { ReactNode } from "react";
1
+ import React from "react";
2
2
  import Slider from "../Slider";
3
+ import Icon from "../Icon";
3
4
 
4
- export default {
5
- title: "Components/Slider",
6
- component: Slider,
7
- parameters: {
8
- layout: "fullscreen",
9
- },
10
- tags: ["autodocs"],
11
- };
5
+ const Slide = ({ name }: { name: string }) => (
6
+ <div className="relative ">
7
+ <div className="relative w-full sm:w-[560px] md:w-[784px] lg:w-[960px] bg-white overflow-hidden flex gap-40 rounded-3xl shadow-container-subtle">
8
+ <div className="w-full md:w-2/3 flex flex-col gap-24 pr-40 md:pr-0 pt-40 pl-40 pb-40 sm:pb-[120px] md:pb-40">
9
+ <h2 className="ui-text-h2 font-medium text-neutral-1000">
10
+ “Ably seamlessly absorbs sudden bursts in load during unexpected
11
+ client events. The integration was easy and we were live in under a
12
+ month.”
13
+ </h2>
14
+ <div className="flex flex-col sm:flex-row gap-32">
15
+ <div className="flex gap-8">
16
+ <div className="static self-center sm:absolute sm:-bottom-48 sm:-right-[56px] rounded-full bg-gradient-to-l from-neutral-200 to-50% to-neutral-500 w-[48px] h-[48px] sm:w-[201px] sm:h-[201px] md:w-[257px] md:h-[257px] lg:w-[280px] lg:h-[280px] overflow-hidden flex items-center justify-center sm:border-[16px] border-neutral-200">
17
+ <img src="https://picsum.photos/id/64/200" alt="test-image" />
18
+ </div>
19
+ <div className="sm:py-16">
20
+ <p className="ui-text-p1 text-neutral-1300">{name}</p>
21
+ <p className="ui-text-p3 text-neutral-800">
22
+ Co-Founder & Technical Leader
23
+ </p>
24
+ </div>
25
+ </div>
12
26
 
13
- const Slide = ({ children }: { children: ReactNode }) => (
14
- <div className="h-full p-24 bg-white rounded">
15
- <p className="ui-text-p2 text-center">{children}</p>
27
+ <div className="w-[80px] h-1 sm:w-1 sm:h-full bg-neutral-500"></div>
28
+ <div className="flex items-center gap-4">
29
+ <img src="https://picsum.photos/id/145/40" alt="test-image" />
30
+ <p className="ui-text-h4 font-bold">Mentimeter</p>
31
+ </div>
32
+ </div>
33
+ <a href="/case-study" className="ui-btn self-start">
34
+ Read case study
35
+ <Icon
36
+ name="icon-gui-arrow-right"
37
+ size="1.25rem"
38
+ additionalCSS="ml-4"
39
+ />
40
+ </a>
41
+ </div>
42
+ </div>
43
+
44
+ <div className="absolute h-256 -z-10 -bottom-48 -left-36 w-1/5 rounded-full blur-xl opacity-50 transform -rotate-45 bg-gradient-to-bl from-bg-glow-green to-bg-glow-teal"></div>
45
+ <div className="absolute h-256 -z-10 -top-48 -right-48 w-3/5 rounded-full blur-xl opacity-50 transform rotate-12 bg-gradient-to-br from-bg-glow-green to-bg-glow-teal"></div>
16
46
  </div>
17
47
  );
18
48
 
19
49
  const slides = [
20
- <Slide key="1">
21
- Powers live chat, updates, analytics, and composition for millions of users.
22
- </Slide>,
23
- <Slide key="2">
24
- Powers virtual venues for millions of event attendees around the world.
25
- </Slide>,
26
- <Slide key="3">
27
- Provides 5 million daily users with live financial commentary and stock
28
- tickers.
29
- </Slide>,
30
- <Slide key="4">Monitors live car performance data across the USA.</Slide>,
50
+ <Slide key="1" name={"Johan Bengtsson"} />,
51
+ <Slide key="2" name={"Mirko Bergman"} />,
52
+ <Slide key="3" name={"Stefania Lombardo"} />,
53
+ <Slide key="4" name={"Aleksandar Kostadinov"} />,
31
54
  ];
32
55
 
33
- export const SliderOnAllBreakpoints = {
56
+ export default {
57
+ title: "Components/Slider",
58
+ component: Slider,
59
+ args: {
60
+ children: slides,
61
+ options: {
62
+ interval: 10000,
63
+ intervalIndicator: true,
64
+ controlPosition: "floating",
65
+ },
66
+ },
67
+ };
68
+
69
+ export const FloatingControlPosition = {
70
+ args: {
71
+ children: slides,
72
+ options: {
73
+ interval: 10000,
74
+ intervalIndicator: true,
75
+ controlPosition: "floating",
76
+ },
77
+ },
78
+ };
79
+
80
+ export const InlineControlPosition = {
34
81
  args: {
35
- slides,
82
+ options: {
83
+ interval: 10000,
84
+ intervalIndicator: true,
85
+ controlPosition: "inline",
86
+ },
36
87
  },
37
88
  };
38
89
 
39
- export const SliderOnSmallBreakpointOnly = {
90
+ export const WithoutIntervalIndicator = {
40
91
  args: {
41
- slides,
42
- classes: `sm:grid-cols-${slides.length / 2} md:grid-cols-${slides.length}`,
43
- mqEnableThreshold: () => !window.matchMedia("(min-width: 48rem)").matches,
92
+ options: {
93
+ interval: 10000,
94
+ intervalIndicator: false,
95
+ controlPosition: "floating",
96
+ },
44
97
  },
45
98
  };
@@ -1,6 +1,40 @@
1
- .ui-slider-marker {
2
- font-size: 0.5rem;
3
- top: -1px;
1
+ @layer components {
2
+ .ui-slider-marker {
3
+ font-size: 0.5rem;
4
+ top: -1px;
4
5
 
5
- @apply leading-none px-4 relative;
6
+ @apply leading-none px-4 relative;
7
+ }
8
+
9
+ @keyframes fillAnimation {
10
+ 0% {
11
+ width: 0%;
12
+ }
13
+ 100% {
14
+ width: 100%;
15
+ }
16
+ }
17
+
18
+ .ui-icon-cta {
19
+ @apply cursor-pointer overflow-hidden;
20
+ @apply rounded border-2 border-mid-grey hover:border-active-orange;
21
+ transition: all 0.4s;
22
+ }
23
+
24
+ @screen sm {
25
+ .ui-icon-cta-left:hover .ui-icon-cta-holder {
26
+ transform: translateX(-120%);
27
+ }
28
+ .ui-icon-cta-right .ui-icon-cta-holder {
29
+ transform: translateX(-120%);
30
+ }
31
+ .ui-icon-cta-right:hover .ui-icon-cta-holder {
32
+ transform: translateX(0%);
33
+ }
34
+ }
35
+
36
+ .ui-icon-cta-holder {
37
+ @apply w-full h-full;
38
+ transition: all 0.4s;
39
+ }
6
40
  }
@@ -1,5 +1,3 @@
1
- import "./component.css";
2
-
3
1
  import throttle from "lodash.throttle";
4
2
 
5
3
  import { queryId, queryIdAll } from "../dom-query";
@@ -1,108 +1,188 @@
1
- import React, { CSSProperties, ReactNode, useEffect, useRef } from "react";
2
-
1
+ import React, { useState, useEffect, useRef, ReactNode } from "react";
3
2
  import Icon from "./Icon";
4
- import SliderScripts from "./Slider/component.js";
5
- import "./Slider/component.css";
6
-
7
- type SliderProps = {
8
- slides?: ReactNode[];
9
- classes?: string;
10
- slideClasses?: string;
11
- slideMinWidth?: string;
12
- slideMaxWidth?: string;
13
- mqEnableThreshold?: () => boolean;
14
-
15
- container?: HTMLDivElement | null;
3
+
4
+ interface SliderProps {
5
+ children: ReactNode[];
6
+ options?: {
7
+ interval?: number;
8
+ controlPosition?: "inline" | "floating";
9
+ intervalIndicator?: boolean;
10
+ };
11
+ }
12
+
13
+ interface SliderIndicatorProps {
14
+ numSlides: number;
15
+ activeIndex: number;
16
+ interval: number;
17
+ intervalIndicator?: boolean;
18
+ isInline?: boolean;
19
+ }
20
+
21
+ const SlideIndicator = ({
22
+ numSlides,
23
+ activeIndex,
24
+ interval,
25
+ intervalIndicator,
26
+ isInline,
27
+ }: SliderIndicatorProps) => {
28
+ return (
29
+ <ul
30
+ className={`flex gap-4 left-1/2 ${
31
+ isInline ? "bottom-0" : "absolute -bottom-40 transform -translate-x-1/2"
32
+ }`}
33
+ >
34
+ {Array.from({ length: numSlides }, (_, i) =>
35
+ intervalIndicator ? (
36
+ <li
37
+ key={i}
38
+ className="relative w-40 h-4 mx-1 rounded-full bg-neutral-500"
39
+ >
40
+ {i === activeIndex && (
41
+ <span
42
+ className="absolute inset-0 rounded-full bg-active-orange"
43
+ style={{
44
+ animation: `fillAnimation ${interval}ms linear`,
45
+ }}
46
+ ></span>
47
+ )}
48
+ </li>
49
+ ) : (
50
+ <li key={i}>
51
+ <span
52
+ className={`ui-slider-marker ${
53
+ i === activeIndex ? "text-active-orange" : "text-cool-black"
54
+ }`}
55
+ data-id="slider-marker"
56
+ >
57
+ &#x2b24;
58
+ </span>
59
+ </li>
60
+ )
61
+ )}
62
+ </ul>
63
+ );
16
64
  };
17
65
 
18
- const Slider = ({
19
- slides = [],
20
- classes = "",
21
- slideClasses = "",
22
- slideMinWidth = "16.875rem",
23
- slideMaxWidth = "1fr",
24
- mqEnableThreshold = () => true,
25
- ...props
26
- }: SliderProps) => {
27
- const containerRef = useRef<HTMLDivElement>(null);
66
+ const Slider = ({ children, options }: SliderProps) => {
67
+ const [activeIndex, setActiveIndex] = useState(0);
68
+ const [touchStartX, setTouchStartX] = useState(0);
69
+ const [touchEndX, setTouchEndX] = useState(0);
70
+ const timerRef = useRef<NodeJS.Timeout | null>(null);
28
71
 
29
- useEffect(() => {
30
- SliderScripts({
31
- container: containerRef.current,
32
- mqEnableThreshold,
33
- });
34
- }, []);
72
+ const isInline = options?.controlPosition === "inline";
73
+
74
+ const next = () => {
75
+ setActiveIndex((prevIndex) => (prevIndex + 1) % children.length);
76
+ resetInterval();
77
+ };
78
+
79
+ const prev = () => {
80
+ setActiveIndex((prevIndex) =>
81
+ prevIndex > 0 ? prevIndex - 1 : children.length - 1
82
+ );
83
+ resetInterval();
84
+ };
35
85
 
36
- if (slides.length === 0) return;
86
+ const resetInterval = () => {
87
+ if (timerRef.current) clearInterval(timerRef.current);
88
+ timerRef.current = setInterval(next, options?.interval ?? 10000);
89
+ };
90
+
91
+ const handleTouchStart = (e) => {
92
+ setTouchStartX(e.touches[0].clientX);
93
+ };
94
+
95
+ const handleTouchMove = (e) => {
96
+ setTouchEndX(e.touches[0].clientX);
97
+ };
98
+
99
+ const handleTouchEnd = () => {
100
+ if (touchStartX - touchEndX > 50) {
101
+ next();
102
+ }
103
+ if (touchStartX - touchEndX < -50) {
104
+ prev();
105
+ }
106
+ };
107
+
108
+ useEffect(() => {
109
+ resetInterval();
110
+ return () => {
111
+ if (timerRef.current) clearInterval(timerRef.current);
112
+ };
113
+ }, [children.length, options?.interval]);
37
114
 
38
115
  return (
39
116
  <div
40
- className="w-full overflow-x-hidden"
41
- data-id="slider"
42
- style={
43
- {
44
- "--dynamic-grid-columns-count": slides.length,
45
- "--dynamic-grid-column-min-width": slideMinWidth,
46
- "--dynamic-grid-column-max-width": slideMaxWidth,
47
- } as CSSProperties
48
- }
49
- ref={containerRef}
117
+ className="relative"
118
+ onTouchStart={handleTouchStart}
119
+ onTouchMove={handleTouchMove}
120
+ onTouchEnd={handleTouchEnd}
50
121
  >
51
- <ol
52
- className={`grid ui-grid-gap grid-cols-dynamic transform transition-transform ${classes}`}
53
- data-id="slider-strip"
54
- {...props}
55
- >
56
- {slides.map((slide, i) => (
57
- <li key={i} className={slideClasses} data-id="slider-slide">
58
- {slide}
59
- </li>
60
- ))}
61
- </ol>
122
+ <div className="overflow-y-visible overflow-x-clip w-full py-40">
123
+ <div
124
+ className="flex items-center transition-transform ease-in-out duration-500"
125
+ style={{ transform: `translateX(-${activeIndex * 100}%)` }}
126
+ >
127
+ {children.map((child, index) => (
128
+ <div
129
+ key={index}
130
+ className="w-full flex-shrink-0 flex justify-center sm:px-60 transition-opacity ease-in delay-500 duration-500"
131
+ style={{
132
+ opacity: activeIndex === index ? 1 : 0.1,
133
+ }}
134
+ >
135
+ {child}
136
+ </div>
137
+ ))}
138
+ </div>
139
+ </div>
62
140
 
63
141
  <div
64
- className="justify-center items-center my-24 hidden"
65
- data-id="slider-controls"
142
+ className={`flex items-center pointer-events-none ${
143
+ isInline
144
+ ? "ui-standard-container justify-center gap-24"
145
+ : "sm:flex sm:absolute inset-0 justify-between"
146
+ }`}
66
147
  >
67
148
  <button
68
- type="button"
69
- className="p-0 w-24 h-24 flex items-center focus:outline-gui-focus"
70
- data-id="slider-previous"
149
+ className={`${
150
+ isInline ? "w-32 h-32" : "hidden sm:flex w-48 h-48"
151
+ } pointer-events-auto rounded border border-mid-grey hover:border-active-orange flex justify-center items-center ui-icon-cta ui-icon-cta-left`}
152
+ onClick={prev}
71
153
  >
72
- <Icon
73
- name="icon-gui-disclosure-arrow"
74
- size="1.5rem"
75
- color="text-cool-black"
76
- additionalCSS="transform rotate-180"
77
- data-id="meganav-control-mobile-dropdown-menu"
78
- />
154
+ <div className="ui-icon-cta-holder flex gap-4">
155
+ <div className="w-full h-full flex-shrink-0 flex items-center justify-center">
156
+ <Icon name="icon-gui-arrow-left" size="1.5rem" />
157
+ </div>
158
+ <div className="w-full h-full flex-shrink-0 flex items-center justify-center">
159
+ <Icon name="icon-gui-arrow-left" size="1.5rem" />
160
+ </div>
161
+ </div>
79
162
  </button>
80
163
 
81
- <ul className="flex justify-center items-center mx-32 relative h-24">
82
- {slides.map((_, i) => (
83
- <li key={i}>
84
- <span
85
- className="ui-slider-marker text-cool-black"
86
- data-id="slider-marker"
87
- >
88
- &#x2b24;
89
- </span>{" "}
90
- {/* ⬤ */}
91
- </li>
92
- ))}
93
- </ul>
164
+ <SlideIndicator
165
+ numSlides={children.length}
166
+ activeIndex={activeIndex}
167
+ interval={options?.interval ?? 10000}
168
+ intervalIndicator={options?.intervalIndicator}
169
+ isInline={isInline}
170
+ />
94
171
 
95
172
  <button
96
- type="button"
97
- className="p-0 w-24 h-24 flex items-center focus:outline-gui-focus"
98
- data-id="slider-next"
173
+ className={`${
174
+ isInline ? "w-32 h-32" : "hidden sm:flex w-48 h-48"
175
+ } pointer-events-auto rounded border border-mid-grey hover:border-active-orange justify-center items-center ui-icon-cta ui-icon-cta-right`}
176
+ onClick={next}
99
177
  >
100
- <Icon
101
- name="icon-gui-disclosure-arrow"
102
- size="1.5rem"
103
- color="text-cool-black"
104
- data-id="meganav-control-mobile-dropdown-menu"
105
- />
178
+ <div className="ui-icon-cta-holder flex gap-4">
179
+ <div className="w-full h-full flex-shrink-0 flex items-center justify-center">
180
+ <Icon name="icon-gui-arrow-right" size="1.5rem" />
181
+ </div>
182
+ <div className="w-full h-full flex-shrink-0 flex items-center justify-center">
183
+ <Icon name="icon-gui-arrow-right" size="1.5rem" />
184
+ </div>
185
+ </div>
106
186
  </button>
107
187
  </div>
108
188
  </div>
@@ -1,28 +1,57 @@
1
- import React, { PropsWithChildren, ReactElement, cloneElement } from "react";
1
+ import React, {
2
+ PropsWithChildren,
3
+ ReactElement,
4
+ TableHTMLAttributes,
5
+ cloneElement,
6
+ } from "react";
2
7
 
3
8
  type TableProps = {
4
9
  id?: string;
5
10
  };
6
11
 
7
- export const Table = ({ id, children }: PropsWithChildren<TableProps>) => (
8
- <table id={id} className="ui-standard-container mb-4 sm:table-fixed">
12
+ export const Table = ({
13
+ id,
14
+ children,
15
+ ...rest
16
+ }: PropsWithChildren<TableProps & TableHTMLAttributes<HTMLTableElement>>) => (
17
+ <table
18
+ id={id}
19
+ {...rest}
20
+ className={`ui-standard-container mb-4 sm:table-fixed ${
21
+ rest?.className ?? ""
22
+ }`}
23
+ >
9
24
  {children}
10
25
  </table>
11
26
  );
12
27
 
13
- export const TableBody = ({ children }: PropsWithChildren) => (
14
- <tbody>{children}</tbody>
28
+ export const TableBody = ({
29
+ children,
30
+ ...rest
31
+ }: PropsWithChildren<TableHTMLAttributes<HTMLTableSectionElement>>) => (
32
+ <tbody {...rest}>{children}</tbody>
15
33
  );
16
34
 
17
- export const TableHeader = ({ children }: PropsWithChildren) => (
18
- <thead className="sticky bg-white z-10 top-0" key="sticky-block">
35
+ export const TableHeader = ({
36
+ children,
37
+ ...rest
38
+ }: PropsWithChildren<TableHTMLAttributes<HTMLTableSectionElement>>) => (
39
+ <thead
40
+ {...rest}
41
+ className={`sticky bg-white z-10 top-0 ${rest?.className ?? ""}`}
42
+ >
19
43
  {cloneElement(children as ReactElement, { isHeader: true })}
20
44
  </thead>
21
45
  );
22
46
 
23
- export const TableRowHeader = ({ children }: PropsWithChildren) => (
47
+ export const TableRowHeader = ({
48
+ children,
49
+ ...rest
50
+ }: PropsWithChildren<TableHTMLAttributes<HTMLTableRowElement>>) => (
24
51
  <tr
25
- className="-ml-24 mt-8 sm:ml-0 sm:mt-0 ui-text-overline1 !text-cool-black bg-light-grey sm:sticky z-10"
52
+ className={`-ml-24 mt-8 sm:ml-0 sm:mt-0 bg-light-grey sm:sticky z-10 ${
53
+ rest?.className ?? ""
54
+ }`}
26
55
  style={{ top: "4rem" }}
27
56
  >
28
57
  {cloneElement(children as ReactElement, { isRowHeader: true })}
@@ -25,13 +25,22 @@ const Unsupported = () => (
25
25
  />
26
26
  );
27
27
 
28
+ const Partial = () => (
29
+ <Icon
30
+ name="icon-gui-partial"
31
+ size="1.5rem"
32
+ additionalCSS="flex-grow-0 flex-shrink-0"
33
+ data-testid="partial-icon"
34
+ />
35
+ );
36
+
28
37
  const LabelCell = ({
29
38
  children,
30
39
  ...rest
31
40
  }: PropsWithChildren<React.TdHTMLAttributes<HTMLTableCellElement>>) => {
32
41
  const classes = `
33
- ui-text-p1 !font-bold pt-24 pb-8 border-light-grey sm:p-24 sm:relative sm:top-2 flex sm:table-cell ${
34
- rest.className ?? ""
42
+ ui-text-p1 font-bold pt-24 pb-8 border-light-grey sm:p-24 sm:relative sm:top-2 flex sm:table-cell ${
43
+ rest?.className ?? ""
35
44
  }
36
45
  `;
37
46
 
@@ -56,7 +65,7 @@ const TableCell = ({
56
65
  ? "rounded-l-none rounded-r sm:rounded-lg py-20 px-24"
57
66
  : "py-6"
58
67
  }
59
- ${rest.className ?? ""}
68
+ ${rest?.className ?? ""}
60
69
  `}
61
70
  >
62
71
  {children}
@@ -67,7 +76,12 @@ const HeaderCell = ({
67
76
  children,
68
77
  ...rest
69
78
  }: PropsWithChildren<React.TdHTMLAttributes<HTMLTableCellElement>>) => (
70
- <td {...rest} className="ui-text-h3 px-24 py-24 hidden sm:table-cell">
79
+ <td
80
+ {...rest}
81
+ className={`ui-text-h3 px-24 py-24 hidden sm:table-cell ${
82
+ rest?.className ?? ""
83
+ }`}
84
+ >
71
85
  {children}
72
86
  </td>
73
87
  );
@@ -76,9 +90,20 @@ const CtaCell = ({
76
90
  children,
77
91
  ...rest
78
92
  }: PropsWithChildren<React.TdHTMLAttributes<HTMLTableCellElement>>) => (
79
- <td {...rest} className="pt-24 hidden sm:table-cell">
93
+ <td
94
+ {...rest}
95
+ className={`pt-24 hidden sm:table-cell ${rest?.className ?? ""}`}
96
+ >
80
97
  {children}
81
98
  </td>
82
99
  );
83
100
 
84
- export { TableCell, LabelCell, HeaderCell, CtaCell, Supported, Unsupported };
101
+ export {
102
+ TableCell,
103
+ LabelCell,
104
+ HeaderCell,
105
+ CtaCell,
106
+ Supported,
107
+ Unsupported,
108
+ Partial,
109
+ };
@@ -7,6 +7,7 @@ import {
7
7
  CtaCell,
8
8
  Supported,
9
9
  Unsupported,
10
+ Partial,
10
11
  } from "./Table/TableCell";
11
12
 
12
13
  export default {
@@ -21,4 +22,5 @@ export default {
21
22
  Header: TableHeader,
22
23
  Supported,
23
24
  Unsupported,
25
+ Partial,
24
26
  };
Binary file
@@ -1,6 +1,24 @@
1
- import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
1
+ import React, {
2
+ ButtonHTMLAttributes,
3
+ HTMLAttributes,
4
+ PropsWithChildren,
5
+ useEffect,
6
+ useRef,
7
+ useState,
8
+ } from "react";
2
9
  import Icon from "./Icon";
3
- const Tooltip = ({ children }: PropsWithChildren) => {
10
+
11
+ type TooltipProps = {
12
+ triggerProps?: ButtonHTMLAttributes<HTMLButtonElement>;
13
+ tooltipProps?: HTMLAttributes<HTMLDivElement>;
14
+ } & HTMLAttributes<HTMLDivElement>;
15
+
16
+ const Tooltip = ({
17
+ children,
18
+ triggerProps,
19
+ tooltipProps,
20
+ ...rest
21
+ }: PropsWithChildren<TooltipProps>) => {
4
22
  const [open, setOpen] = useState(false);
5
23
  const [position, setPosition] = useState({ x: 0, y: 0 });
6
24
  const offset = 8;
@@ -26,21 +44,28 @@ const Tooltip = ({ children }: PropsWithChildren) => {
26
44
  }, [open]);
27
45
 
28
46
  return (
29
- <div className="relative inline-block align-top h-16">
47
+ <div
48
+ {...rest}
49
+ className={`relative inline-block align-top h-16 ${
50
+ rest?.className ?? ""
51
+ }`}
52
+ >
30
53
  <button
31
54
  onMouseEnter={() => setOpen(true)}
32
55
  onMouseLeave={() => setOpen(false)}
33
- className="ml-8 p-0 relative top-1 focus:outline-none"
34
56
  type="button"
35
57
  ref={reference}
36
58
  aria-describedby="tooltip"
59
+ {...triggerProps}
60
+ className={`ml-8 p-0 relative top-1 focus:outline-none ${
61
+ triggerProps?.className ?? ""
62
+ }`}
37
63
  >
38
64
  <Icon name="icon-gui-info" size="1rem" />
39
65
  </button>
40
66
 
41
67
  {open ? (
42
68
  <div
43
- className="bg-light-grey p-12 rounded pointer-events-none absolute z-20"
44
69
  role="tooltip"
45
70
  ref={floating}
46
71
  style={{
@@ -48,6 +73,10 @@ const Tooltip = ({ children }: PropsWithChildren) => {
48
73
  left: -position.x,
49
74
  boxShadow: "4px 4px 15px rgba(0, 0, 0, 0.2)",
50
75
  }}
76
+ {...tooltipProps}
77
+ className={`bg-light-grey p-12 rounded pointer-events-none absolute z-20 ${
78
+ tooltipProps?.className ?? ""
79
+ }`}
51
80
  >
52
81
  <div className="w-256">{children}</div>
53
82
  </div>