@indico-data/design-system 1.0.49 → 1.0.51

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/lib/types.d.ts CHANGED
@@ -46,6 +46,7 @@ declare const allIcons: {
46
46
  readonly dashboard: import("react/jsx-runtime").JSX.Element;
47
47
  readonly 'data-and-access': import("react/jsx-runtime").JSX.Element;
48
48
  readonly database: import("react/jsx-runtime").JSX.Element;
49
+ readonly document: import("react/jsx-runtime").JSX.Element;
49
50
  readonly date: import("react/jsx-runtime").JSX.Element;
50
51
  readonly draggable: import("react/jsx-runtime").JSX.Element;
51
52
  readonly droplet: import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -254,6 +254,11 @@ const indicons = {
254
254
  <path d="M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z" />
255
255
  </svg>
256
256
  ),
257
+ document: (
258
+ <svg viewBox="0 0 24 24">
259
+ <path d="M15.6.3q-.45-.3-.9-.3H3.9c-.8 0-1.5.9-1.5 1.7v20.6c0 .8.7 1.7 1.5 1.7H20c.8 0 1.5-.9 1.5-1.7V6.8c0-.3-.1-.6-.3-.8zm4.1 21.8H4.3V1.9h10.1V6c0 .7.5 1.2 1.2 1.2h4.1z" />
260
+ </svg>
261
+ ),
257
262
  date: (
258
263
  <svg viewBox="0 0 50 50" fill="currentColor">
259
264
  <path d="m24 28.15q-0.75 0-1.25-0.525t-0.5-1.225q0-0.75 0.5-1.275t1.25-0.525 1.25 0.525 0.5 1.275q0 0.7-0.5 1.225t-1.25 0.525zm-8 0q-0.75 0-1.25-0.525t-0.5-1.225q0-0.75 0.5-1.275t1.25-0.525 1.25 0.525 0.5 1.275q0 0.7-0.5 1.225t-1.25 0.525zm16 0q-0.75 0-1.25-0.525t-0.5-1.225q0-0.75 0.5-1.275t1.25-0.525 1.25 0.525 0.5 1.275q0 0.7-0.5 1.225t-1.25 0.525zm-8 7.85q-0.75 0-1.25-0.525t-0.5-1.225q0-0.75 0.5-1.275t1.25-0.525 1.25 0.525 0.5 1.275q0 0.7-0.5 1.225t-1.25 0.525zm-8 0q-0.75 0-1.25-0.525t-0.5-1.225q0-0.75 0.5-1.275t1.25-0.525 1.25 0.525 0.5 1.275q0 0.7-0.5 1.225t-1.25 0.525zm16 0q-0.75 0-1.25-0.525t-0.5-1.225q0-0.75 0.5-1.275t1.25-0.525 1.25 0.525 0.5 1.275q0 0.7-0.5 1.225t-1.25 0.525zm-22.1 7q-1.2 0-2.05-0.85t-0.85-2.05v-28.95q0-1.15 0.85-2.025t2.05-0.875h3.7v-3.5h2.5v3.5h15.9v-3.5h2.45v3.5h3.65q1.2 0 2.05 0.875t0.85 2.025v28.95q0 1.2-0.85 2.05t-2.05 0.85zm0-2.25h28.2q0.25 0 0.45-0.2t0.2-0.45v-19.85h-29.5v19.85q0 0.25 0.2 0.45t0.45 0.2zm-0.65-22.75h29.5v-6.85q0-0.25-0.2-0.425t-0.45-0.175h-28.2q-0.25 0-0.45 0.175t-0.2 0.425zm0 0v-6.85q0-0.25 0-0.425t0-0.175 0 0.175 0 0.425v6.85z" />
@@ -738,10 +743,8 @@ const indicons = {
738
743
  </svg>
739
744
  ),
740
745
  text: (
741
- <svg viewBox="0 0 102 102" fill="currentColor">
742
- <g transform="translate(1 1)">
743
- <path d="M25.4,90.3V23.4H0V9.7h64.5v13.7H39.1v66.9H25.4z M70.6,90.3V49.2H54.8V35.5H100v13.7H84.3v41.2H70.6z" />
744
- </g>
746
+ <svg viewBox="0 0 24 24">
747
+ <path d="M16 4V2H0v2h7v18h2V4zM24.2 9h-10v2h4v11h2V11h4z" />
745
748
  </svg>
746
749
  ),
747
750
  'thumbs-down': (
@@ -26,13 +26,13 @@ export const StyledWizardWithSidebar = styled.div<{
26
26
  .wizard-sidebar {
27
27
  width: 245px;
28
28
  padding: 30px;
29
- border-right: 1px solid #aaaaaa;
29
+ border-right: 1px solid ${COLORS.silverChalice};
30
30
 
31
31
  .sidebar-step {
32
32
  margin-bottom: ${SPACING.sm};
33
33
  display: flex;
34
34
  align-items: center;
35
- color: #aaaaaa;
35
+ color: ${COLORS.silverChalice};
36
36
  &.current-step,
37
37
  &.prior-step {
38
38
  color: ${COLORS.black};
@@ -30,3 +30,4 @@ export { LoadingAwareContainer } from './LoadingAwareContainer';
30
30
  export { Wizard, WizardCard, WizardSection, StyledWizard } from './Wizard';
31
31
  export { WizardWithSidebar } from './WizardWithSidebar';
32
32
  export { Drawer } from './Navigation/Drawer';
33
+ export { TextTruncate } from './text-truncate';
@@ -0,0 +1,59 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import { TextTruncate } from './TextTruncate';
3
+
4
+ <Meta
5
+ title="Text Utilities/TextTruncate"
6
+ component={TextTruncate}
7
+ argTypes={{
8
+ string: {
9
+ description: 'The string to truncate.',
10
+ control: {
11
+ type: 'text',
12
+ },
13
+ },
14
+ maxChars: {
15
+ control: {
16
+ type: 'number',
17
+ },
18
+ },
19
+ }}
20
+ />
21
+
22
+ # Text Truncate
23
+
24
+ This component truncates the provided text if the character limit exceeds the Max Character Length
25
+ set on the component property. It will add `...` to the end of the truncated text. It will also
26
+ add a `title` attribute to the component with the full text if the text is truncated.
27
+
28
+ <Canvas>
29
+ <Story
30
+ name="default"
31
+ args={{
32
+ string: 'This string is being truncated for length.',
33
+ maxChars: 30,
34
+ }}
35
+ >
36
+ {Template.bind({})}
37
+ </Story>
38
+ </Canvas>
39
+
40
+ <ArgsTable of={TextTruncate} />
41
+
42
+ ## Non Truncated Text
43
+
44
+ This is an example of a string that is shorter than the max character length and will not be
45
+ truncated.
46
+
47
+ <Canvas>
48
+ <Story
49
+ name="non truncated text"
50
+ args={{
51
+ string: 'This string meets the length required to not be truncated.',
52
+ maxChars: 100,
53
+ }}
54
+ >
55
+ {Template.bind({})}
56
+ </Story>
57
+ </Canvas>
58
+
59
+ export const Template = (args) => <TextTruncate {...args} />;
@@ -0,0 +1,3 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const StyledTextTruncate = styled.span``;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import { TextTruncate } from './TextTruncate';
4
+
5
+ describe('TextTruncate', () => {
6
+ const longText = 'this is a really long string that should be truncated';
7
+
8
+ it('truncates text when it exceeds the maximum length and adds a title attr', () => {
9
+ const { getByTitle } = render(<TextTruncate string={longText} maxChars={20} />);
10
+ expect(getByTitle(longText).textContent).toEqual('this is a really lon...');
11
+ });
12
+
13
+ it('does not truncate the text when it is below the max length', () => {
14
+ const { getByText } = render(<TextTruncate string={longText} maxChars={200} />);
15
+ expect(getByText(longText).textContent).toEqual(longText);
16
+ });
17
+
18
+ });
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { StyledTextTruncate } from './TextTruncate.styles';
3
+
4
+ interface TextTruncateProps {
5
+ string: string;
6
+ maxChars: number;
7
+ children: any;
8
+ }
9
+
10
+ export function TextTruncate({ string, maxChars, children }: TextTruncateProps) {
11
+ return string.length > maxChars ? (
12
+ <StyledTextTruncate title={string}>
13
+ {`${string.substring(0, maxChars)}...`}
14
+ {children}
15
+ </StyledTextTruncate>
16
+ ) : (
17
+ <StyledTextTruncate>
18
+ {string} {children}
19
+ </StyledTextTruncate>
20
+ );
21
+ }
@@ -0,0 +1 @@
1
+ export { TextTruncate } from './TextTruncate';
package/src/index.ts CHANGED
@@ -54,5 +54,6 @@ export {
54
54
  WizardCard,
55
55
  WizardSection,
56
56
  StyledWizard,
57
+ TextTruncate,
57
58
  WizardWithSidebar,
58
59
  } from './components';