@indico-data/design-system 3.6.0 → 3.6.2
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.
- package/.vscode/settings.json +2 -1
- package/lib/components/tooltip/Tooltip.d.ts +7 -5
- package/lib/components/tooltip/Tooltip.stories.d.ts +2 -0
- package/lib/components/truncate/Truncate.d.ts +1 -1
- package/lib/components/truncate/Truncate.stories.d.ts +4 -1
- package/lib/components/truncate/types.d.ts +6 -5
- package/lib/index.css +8 -16
- package/lib/index.d.ts +11 -9
- package/lib/index.esm.css +8 -16
- package/lib/index.esm.js +25 -16
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +25 -16
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tanstackTable/styles/table.scss +1 -1
- package/src/components/tooltip/Tooltip.stories.tsx +72 -14
- package/src/components/tooltip/Tooltip.tsx +17 -5
- package/src/components/truncate/Truncate.mdx +16 -8
- package/src/components/truncate/Truncate.stories.tsx +44 -22
- package/src/components/truncate/Truncate.tsx +23 -18
- package/src/components/truncate/__tests__/Truncate.test.tsx +0 -11
- package/src/components/truncate/styles/Truncate.scss +12 -12
- package/src/components/truncate/types.ts +5 -5
- package/src/styles/globals.scss +0 -9
- package/src/styles/tokens/_semantic-tokens.scss +2 -1
package/.vscode/settings.json
CHANGED
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"eslint.nodePath": ".yarn/sdks",
|
|
7
7
|
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
|
|
8
8
|
"typescript.tsdk": ".yarn/sdks/typescript/lib",
|
|
9
|
-
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
9
|
+
"typescript.enablePromptUseWorkspaceTsdk": true,
|
|
10
|
+
"testing.automaticallyOpenTestResults": "neverOpen"
|
|
10
11
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
import { PlacesType } from 'react-tooltip';
|
|
2
|
-
interface TooltipProps {
|
|
3
|
+
export interface TooltipProps {
|
|
3
4
|
id: string;
|
|
4
5
|
/** Whether the tooltip should be shown on click */
|
|
5
6
|
clickToShow?: boolean;
|
|
@@ -8,12 +9,13 @@ interface TooltipProps {
|
|
|
8
9
|
/** The delay in milliseconds before the tooltip is hidden */
|
|
9
10
|
delayHide?: number;
|
|
10
11
|
children: React.ReactNode;
|
|
11
|
-
/** This is an override for the z-index of the tooltip */
|
|
12
|
-
zIndex?: number;
|
|
13
12
|
/** The placement of the tooltip */
|
|
14
13
|
place?: PlacesType;
|
|
14
|
+
/** The width of the tooltip */
|
|
15
|
+
width?: CSSProperties['width'];
|
|
16
|
+
/** The max width of the tooltip */
|
|
17
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
15
18
|
/** The content of the tooltip */
|
|
16
19
|
[key: string]: any;
|
|
17
20
|
}
|
|
18
|
-
export declare const Tooltip: ({ id, clickToShow, delayShow, delayHide, children,
|
|
19
|
-
export {};
|
|
21
|
+
export declare const Tooltip: ({ id, clickToShow, delayShow, delayHide, children, place, width, maxWidth, opacity, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TruncateProps } from './types';
|
|
2
|
-
export declare const Truncate: ({
|
|
2
|
+
export declare const Truncate: ({ numLines, truncateString, tooltipOptions, ...rest }: TruncateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,5 +5,8 @@ declare const meta: Meta<typeof Truncate>;
|
|
|
5
5
|
export default meta;
|
|
6
6
|
type Story = StoryObj<TruncateProps>;
|
|
7
7
|
export declare const Default: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const NoTruncate: Story;
|
|
9
|
+
export declare const WithNumLines: Story;
|
|
10
|
+
export declare const WithTooltipOptions: Story;
|
|
9
11
|
export declare const NoTooltip: Story;
|
|
12
|
+
export declare const TruncateWithTooltipWidth: Story;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { TooltipProps } from '../tooltip/Tooltip';
|
|
1
2
|
export interface TruncateProps {
|
|
2
3
|
/** The number of lines to truncate the text to. If left blank, it will default to 1 line. */
|
|
3
|
-
|
|
4
|
+
numLines?: number;
|
|
4
5
|
/** The string to truncate. This value will also be displayed in the tooltip when the text is truncated. */
|
|
5
6
|
truncateString: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/** The options for the tooltip. If `disabled` is `true`, the tooltip will not be shown. If left blank, the tooltip will be shown by default. This is particularly useful if you want to set the width of the tooltip to something other than the default `max-content`. */
|
|
8
|
+
tooltipOptions?: Partial<TooltipProps> & {
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
10
11
|
[key: string]: any;
|
|
11
12
|
}
|
package/lib/index.css
CHANGED
|
@@ -405,6 +405,7 @@
|
|
|
405
405
|
--pf-font-size-10xl: 6rem; /* 96px */
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
:root,
|
|
408
409
|
:root [data-theme=light] {
|
|
409
410
|
--pf-semantic-utility-info-default: var(--pf-secondary-color-450);
|
|
410
411
|
--pf-semantic-utility-info-light: var(--pf-secondary-color-400);
|
|
@@ -4485,14 +4486,6 @@ a:hover,
|
|
|
4485
4486
|
background-color: var(--pf-semantic-background-primary);
|
|
4486
4487
|
}
|
|
4487
4488
|
|
|
4488
|
-
.react-tooltip {
|
|
4489
|
-
z-index: 5;
|
|
4490
|
-
background-color: var(--pf-semantic-background-inverted);
|
|
4491
|
-
color: var(--pf-semantic-font-inverted);
|
|
4492
|
-
opacity: 1 !important;
|
|
4493
|
-
text-wrap: wrap;
|
|
4494
|
-
}
|
|
4495
|
-
|
|
4496
4489
|
:root,
|
|
4497
4490
|
:root [data-theme=light],
|
|
4498
4491
|
:root [data-theme=dark] {
|
|
@@ -6139,7 +6132,7 @@ body div[class*=select__single-value] {
|
|
|
6139
6132
|
background: var(--pf-semantic-background-accent) !important;
|
|
6140
6133
|
}
|
|
6141
6134
|
.tanstack-table__tbody__tr.show-hover:hover td {
|
|
6142
|
-
background-color: var(--pf-semantic-
|
|
6135
|
+
background-color: var(--pf-semantic-background-tertiary) !important;
|
|
6143
6136
|
cursor: pointer;
|
|
6144
6137
|
}
|
|
6145
6138
|
.tanstack-table__tbody__tr.is-clicked td {
|
|
@@ -9166,20 +9159,19 @@ body div[class*=select__single-value] {
|
|
|
9166
9159
|
color: inherit;
|
|
9167
9160
|
}
|
|
9168
9161
|
.truncate-wrapper .truncate {
|
|
9169
|
-
|
|
9162
|
+
width: 100%;
|
|
9170
9163
|
overflow: hidden;
|
|
9171
9164
|
text-overflow: ellipsis;
|
|
9172
|
-
width: 100%;
|
|
9173
|
-
display: inline-block;
|
|
9174
9165
|
}
|
|
9175
|
-
.truncate-wrapper .truncate-
|
|
9166
|
+
.truncate-wrapper .truncate--multi-line {
|
|
9176
9167
|
display: -webkit-box;
|
|
9177
9168
|
-webkit-box-orient: vertical;
|
|
9178
9169
|
-webkit-line-clamp: var(--line-clamp);
|
|
9179
9170
|
line-clamp: var(--line-clamp);
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9171
|
+
}
|
|
9172
|
+
.truncate-wrapper .truncate--single-line {
|
|
9173
|
+
display: inline-block;
|
|
9174
|
+
white-space: nowrap;
|
|
9183
9175
|
}
|
|
9184
9176
|
|
|
9185
9177
|
.Toastify__toast-theme--colored.Toastify__toast--default {
|
package/lib/index.d.ts
CHANGED
|
@@ -944,14 +944,16 @@ interface TooltipProps {
|
|
|
944
944
|
/** The delay in milliseconds before the tooltip is hidden */
|
|
945
945
|
delayHide?: number;
|
|
946
946
|
children: React.ReactNode;
|
|
947
|
-
/** This is an override for the z-index of the tooltip */
|
|
948
|
-
zIndex?: number;
|
|
949
947
|
/** The placement of the tooltip */
|
|
950
948
|
place?: PlacesType;
|
|
949
|
+
/** The width of the tooltip */
|
|
950
|
+
width?: CSSProperties['width'];
|
|
951
|
+
/** The max width of the tooltip */
|
|
952
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
951
953
|
/** The content of the tooltip */
|
|
952
954
|
[key: string]: any;
|
|
953
955
|
}
|
|
954
|
-
declare const Tooltip: ({ id, clickToShow, delayShow, delayHide, children,
|
|
956
|
+
declare const Tooltip: ({ id, clickToShow, delayShow, delayHide, children, place, width, maxWidth, opacity, ...rest }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
955
957
|
|
|
956
958
|
interface PaginationProps {
|
|
957
959
|
/** The total number of pages to be displayed */
|
|
@@ -1020,16 +1022,16 @@ declare const Stepper: ({ currentStep: externalCurrentStep, legendHeader, legend
|
|
|
1020
1022
|
|
|
1021
1023
|
interface TruncateProps {
|
|
1022
1024
|
/** The number of lines to truncate the text to. If left blank, it will default to 1 line. */
|
|
1023
|
-
|
|
1025
|
+
numLines?: number;
|
|
1024
1026
|
/** The string to truncate. This value will also be displayed in the tooltip when the text is truncated. */
|
|
1025
1027
|
truncateString: string;
|
|
1026
|
-
/**
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1028
|
+
/** The options for the tooltip. If `disabled` is `true`, the tooltip will not be shown. If left blank, the tooltip will be shown by default. This is particularly useful if you want to set the width of the tooltip to something other than the default `max-content`. */
|
|
1029
|
+
tooltipOptions?: Partial<TooltipProps> & {
|
|
1030
|
+
disabled?: boolean;
|
|
1031
|
+
};
|
|
1030
1032
|
[key: string]: any;
|
|
1031
1033
|
}
|
|
1032
1034
|
|
|
1033
|
-
declare const Truncate: ({
|
|
1035
|
+
declare const Truncate: ({ numLines, truncateString, tooltipOptions, ...rest }: TruncateProps) => react_jsx_runtime.JSX.Element;
|
|
1034
1036
|
|
|
1035
1037
|
export { Badge, BarSpinner, Button, Card, Checkbox, CirclePulse, Col, ConfirmationModal, Container, DatePicker, FloatUI, Form, Icon, IconTriggerDatePicker, LabeledInput as Input, InputDateRangePicker, Menu, Modal, Pagination, LabeledPasswordInput as PasswordInput, Pill, Radio as RadioInput, Row, LabeledSelect as SelectInput, type SelectOption, SingleInputDatePicker, SingleInputDateTimePicker, Skeleton, Stepper, Table, TanstackTable, LabeledTextarea as Textarea, TimePicker, Toggle as ToggleInput, Tooltip, Truncate, registerFontAwesomeIcons };
|
package/lib/index.esm.css
CHANGED
|
@@ -405,6 +405,7 @@
|
|
|
405
405
|
--pf-font-size-10xl: 6rem; /* 96px */
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
:root,
|
|
408
409
|
:root [data-theme=light] {
|
|
409
410
|
--pf-semantic-utility-info-default: var(--pf-secondary-color-450);
|
|
410
411
|
--pf-semantic-utility-info-light: var(--pf-secondary-color-400);
|
|
@@ -4485,14 +4486,6 @@ a:hover,
|
|
|
4485
4486
|
background-color: var(--pf-semantic-background-primary);
|
|
4486
4487
|
}
|
|
4487
4488
|
|
|
4488
|
-
.react-tooltip {
|
|
4489
|
-
z-index: 5;
|
|
4490
|
-
background-color: var(--pf-semantic-background-inverted);
|
|
4491
|
-
color: var(--pf-semantic-font-inverted);
|
|
4492
|
-
opacity: 1 !important;
|
|
4493
|
-
text-wrap: wrap;
|
|
4494
|
-
}
|
|
4495
|
-
|
|
4496
4489
|
:root,
|
|
4497
4490
|
:root [data-theme=light],
|
|
4498
4491
|
:root [data-theme=dark] {
|
|
@@ -6139,7 +6132,7 @@ body div[class*=select__single-value] {
|
|
|
6139
6132
|
background: var(--pf-semantic-background-accent) !important;
|
|
6140
6133
|
}
|
|
6141
6134
|
.tanstack-table__tbody__tr.show-hover:hover td {
|
|
6142
|
-
background-color: var(--pf-semantic-
|
|
6135
|
+
background-color: var(--pf-semantic-background-tertiary) !important;
|
|
6143
6136
|
cursor: pointer;
|
|
6144
6137
|
}
|
|
6145
6138
|
.tanstack-table__tbody__tr.is-clicked td {
|
|
@@ -9166,20 +9159,19 @@ body div[class*=select__single-value] {
|
|
|
9166
9159
|
color: inherit;
|
|
9167
9160
|
}
|
|
9168
9161
|
.truncate-wrapper .truncate {
|
|
9169
|
-
|
|
9162
|
+
width: 100%;
|
|
9170
9163
|
overflow: hidden;
|
|
9171
9164
|
text-overflow: ellipsis;
|
|
9172
|
-
width: 100%;
|
|
9173
|
-
display: inline-block;
|
|
9174
9165
|
}
|
|
9175
|
-
.truncate-wrapper .truncate-
|
|
9166
|
+
.truncate-wrapper .truncate--multi-line {
|
|
9176
9167
|
display: -webkit-box;
|
|
9177
9168
|
-webkit-box-orient: vertical;
|
|
9178
9169
|
-webkit-line-clamp: var(--line-clamp);
|
|
9179
9170
|
line-clamp: var(--line-clamp);
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9171
|
+
}
|
|
9172
|
+
.truncate-wrapper .truncate--single-line {
|
|
9173
|
+
display: inline-block;
|
|
9174
|
+
white-space: nowrap;
|
|
9183
9175
|
}
|
|
9184
9176
|
|
|
9185
9177
|
.Toastify__toast-theme--colored.Toastify__toast--default {
|
package/lib/index.esm.js
CHANGED
|
@@ -43092,12 +43092,17 @@ const h="react-tooltip-core-styles",w="react-tooltip-base-styles",b={core:!1,bas
|
|
|
43092
43092
|
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"});}));
|
|
43093
43093
|
|
|
43094
43094
|
const Tooltip = (_a) => {
|
|
43095
|
-
var { id, clickToShow, delayShow, delayHide, children,
|
|
43095
|
+
var { id, clickToShow, delayShow, delayHide, children, place = 'top', width = 'max-content', maxWidth, opacity = 1 } = _a, rest = __rest(_a, ["id", "clickToShow", "delayShow", "delayHide", "children", "place", "width", "maxWidth", "opacity"]);
|
|
43096
43096
|
return (jsx(M, Object.assign({ style: {
|
|
43097
43097
|
backgroundColor: 'var(--pf-semantic-background-inverted)',
|
|
43098
43098
|
color: 'var(--pf-semantic-font-inverted)',
|
|
43099
|
-
|
|
43100
|
-
|
|
43099
|
+
width,
|
|
43100
|
+
maxWidth,
|
|
43101
|
+
boxSizing: 'border-box',
|
|
43102
|
+
textWrap: 'wrap',
|
|
43103
|
+
wordWrap: 'break-word',
|
|
43104
|
+
zIndex: 1000,
|
|
43105
|
+
}, className: "tooltip", id: id, place: place, openOnClick: clickToShow, delayShow: delayShow, delayHide: delayHide, opacity: opacity }, rest, { children: children })));
|
|
43101
43106
|
};
|
|
43102
43107
|
|
|
43103
43108
|
function BarSpinner(_a) {
|
|
@@ -43233,29 +43238,33 @@ function v4(options, buf, offset) {
|
|
|
43233
43238
|
}
|
|
43234
43239
|
|
|
43235
43240
|
const Truncate = (_a) => {
|
|
43236
|
-
var {
|
|
43241
|
+
var { numLines = 1, truncateString, tooltipOptions = {} } = _a, rest = __rest(_a, ["numLines", "truncateString", "tooltipOptions"]);
|
|
43237
43242
|
const [isTruncated, setIsTruncated] = useState(false);
|
|
43238
|
-
const id = (
|
|
43243
|
+
const id = useMemo(() => v4().replace(/[^a-zA-Z0-9-_]/g, '_'), []);
|
|
43244
|
+
const ref = useRef(null);
|
|
43239
43245
|
useEffect(() => {
|
|
43240
43246
|
const checkTruncation = () => {
|
|
43241
|
-
const element =
|
|
43242
|
-
if (element)
|
|
43243
|
-
|
|
43244
|
-
|
|
43245
|
-
|
|
43246
|
-
|
|
43247
|
-
|
|
43248
|
-
|
|
43247
|
+
const element = ref.current;
|
|
43248
|
+
if (!element)
|
|
43249
|
+
return;
|
|
43250
|
+
if (numLines === 1) {
|
|
43251
|
+
setIsTruncated(element.scrollWidth > element.clientWidth);
|
|
43252
|
+
}
|
|
43253
|
+
else {
|
|
43254
|
+
setIsTruncated(element.scrollHeight > element.clientHeight);
|
|
43249
43255
|
}
|
|
43250
43256
|
};
|
|
43251
43257
|
checkTruncation();
|
|
43252
43258
|
window.addEventListener('resize', checkTruncation);
|
|
43253
43259
|
return () => window.removeEventListener('resize', checkTruncation);
|
|
43254
|
-
}, [id,
|
|
43260
|
+
}, [id, numLines]);
|
|
43255
43261
|
const truncateStyle = {
|
|
43256
|
-
'--line-clamp':
|
|
43262
|
+
'--line-clamp': numLines,
|
|
43257
43263
|
};
|
|
43258
|
-
return (jsxs("div", { className: "truncate-wrapper", style: truncateStyle, children: [jsx("span", Object.assign({ "data-testid": `truncate-${id}-${isTruncated ? 'truncated' : 'not-truncated'}`, "data-tooltip-id": id,
|
|
43264
|
+
return (jsxs("div", { className: "truncate-wrapper", style: truncateStyle, children: [jsx("span", Object.assign({ ref: ref, "data-testid": `truncate-${id}-${isTruncated ? 'truncated' : 'not-truncated'}`, "data-tooltip-id": id, className: classNames('truncate', {
|
|
43265
|
+
'truncate--multi-line': numLines > 1,
|
|
43266
|
+
'truncate--single-line': numLines === 1,
|
|
43267
|
+
}) }, rest, { children: truncateString })), isTruncated && truncateString && !tooltipOptions.disabled && (jsx(Tooltip, Object.assign({}, tooltipOptions, { id: id, children: truncateString })))] }));
|
|
43259
43268
|
};
|
|
43260
43269
|
|
|
43261
43270
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|