superdesk-ui-framework 3.0.82 → 3.1.1

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 (34) hide show
  1. package/app/img/DotsSmall-dark.svg +14 -0
  2. package/app/img/OneDot.svg +3 -0
  3. package/app/styles/_design-tokens.scss +2 -1
  4. package/app/styles/_drag-handle.scss +36 -12
  5. package/app/styles/app.scss +1 -0
  6. package/app/styles/design-tokens/_component-tokens.scss +11 -0
  7. package/app-typescript/components/DragHandle.tsx +27 -5
  8. package/app-typescript/components/DragHandleDots.tsx +19 -0
  9. package/app-typescript/components/Menu.tsx +0 -1
  10. package/app-typescript/components/TreeMenu.tsx +60 -69
  11. package/app-typescript/helpers.tsx +4 -0
  12. package/app-typescript/index.ts +2 -0
  13. package/dist/OneDot.svg +3 -0
  14. package/dist/examples.bundle.css +22 -24
  15. package/dist/examples.bundle.js +1692 -1603
  16. package/dist/playgrounds/react-playgrounds/TestGround.tsx +1 -40
  17. package/dist/react/DragHandleDocs.tsx +68 -2
  18. package/dist/superdesk-ui.bundle.css +47 -20
  19. package/dist/superdesk-ui.bundle.js +1625 -1205
  20. package/examples/css/docs-page.css +22 -4
  21. package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +1 -40
  22. package/examples/pages/react/DragHandleDocs.tsx +68 -2
  23. package/package.json +1 -1
  24. package/react/components/DragHandle.d.ts +9 -2
  25. package/react/components/DragHandle.js +14 -4
  26. package/react/components/DragHandleDots.d.ts +9 -0
  27. package/react/components/DragHandleDots.js +61 -0
  28. package/react/components/Menu.js +1 -1
  29. package/react/components/TreeMenu.d.ts +62 -0
  30. package/react/components/TreeMenu.js +340 -0
  31. package/react/helpers.d.ts +1 -0
  32. package/react/helpers.js +5 -1
  33. package/react/index.d.ts +2 -0
  34. package/react/index.js +5 -1
@@ -19,6 +19,8 @@
19
19
  --docs-page-border__window-bar--top: hsla(0, 0%, 100%, 0.9);
20
20
  --docs-page-border__window-bar--bottom: hsla(0, 0%, 88%, 1);
21
21
  --docs-page-border__table: hsla(0, 0%, 0%, 0.16);
22
+
23
+ --docs-page-bg__table-tr-even: hsla(214, 13%, 50%, 0.08);
22
24
  }
23
25
 
24
26
  :root [data-theme="dark-ui"] {
@@ -703,7 +705,7 @@ pre.prettyprint {
703
705
  }
704
706
 
705
707
  .docs-page__container {
706
- max-width: 832px;
708
+ max-width: 1200px;
707
709
  margin: 30px auto 0;
708
710
  }
709
711
  .docs-page__container--large {
@@ -720,11 +722,16 @@ pre.prettyprint {
720
722
  justify-content: center;
721
723
  }
722
724
 
725
+
726
+ .docs-page__container .docs-page__code-window {
727
+ max-width: none !important;
728
+ }
729
+
723
730
  .docs-page__container .docs-page__h2,
724
731
  .docs-page__container .docs-page__h3,
725
- .docs-page__container .docs-page__code-window,
726
- .docs-page__container .docs-page__paragraph {
727
- max-width: none !important;
732
+ .docs-page__container .docs-page__paragraph,
733
+ .docs-page__container .docs-page__paragraph--small {
734
+ max-width: 85ch;
728
735
  }
729
736
 
730
737
  .docs-page__content-block {
@@ -957,6 +964,17 @@ doc-gif-img:hover img {
957
964
  border-color: var(--docs-page-border__table) !important;
958
965
  }
959
966
 
967
+ .docs-page__container table tr td:nth-child(3) {
968
+ white-space: nowrap;
969
+ }
970
+
971
+ .docs-page__container table tr:nth-child(even),
972
+ .docs-page__container table thead tr {
973
+ background-color: var(--docs-page-bg__table-tr-even);
974
+ }
975
+
976
+
977
+
960
978
 
961
979
  /* -------------- END COLOR SWATCHES -------------- */
962
980
  /* -------------- PrismJS overrides -------------- */
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import * as Components from './components/Index';
3
- import { Checkbox, RadioGroup, CheckboxButton, RadioButtonGroup, Button, Dropdown, Input, Label, Icon, IconButton, Badge, ThemeSelector, Container, IconLabel, Tooltip, Spinner, Divider, InputWrapper, InputNew, InputBase, Text, FormRowNew, ButtonGroup, Heading, SearchBar, Modal, BoxedList, BoxedListItem, TimePicker, DatePicker, TreeSelect, ContentDivider, Select, Option, AvatarGroup, SvgIconIllustration, IllustrationButton} from '../../../../app-typescript/index';
3
+ import { Checkbox, RadioGroup, CheckboxButton, RadioButtonGroup, Button, Dropdown, Input, Label, Icon, IconButton, Badge, ThemeSelector, Container, IconLabel, Tooltip, Spinner, Divider, InputWrapper, InputNew, InputBase, Text, FormRowNew, ButtonGroup, Heading, SearchBar, Modal, BoxedList, BoxedListItem, TimePicker, DatePicker, TreeSelect, ContentDivider, Select, Option, AvatarGroup, SvgIconIllustration, IllustrationButton } from '../../../../app-typescript/index';
4
4
  import { IAvatarInGroup } from '../../../../app-typescript/components/avatar/avatar-group';
5
5
  import { FormLabel } from '../../../../app-typescript/components/Form/FormLabel';
6
6
 
@@ -145,10 +145,6 @@ export class TestGround extends React.Component<IProps, IState> {
145
145
  <IconButton icon="adjust" ariaValue="Toggle theme" onClick={this.toggleTheme} toolTipFlow='left' />
146
146
  </ButtonGroup>
147
147
 
148
- <hr />
149
- <SvgIconIllustration illustration='headlines' />
150
- <hr />
151
-
152
148
  <div className='sd-grid-list sd-grid-list--xx-small sd-grid-list--gap-s sd-grid-list--no-margin' style={{width:'290px'}}>
153
149
 
154
150
  <IllustrationButton text='Headlines' onClick={()=> false}>
@@ -171,41 +167,6 @@ export class TestGround extends React.Component<IProps, IState> {
171
167
  <SvgIconIllustration illustration='translate' />
172
168
  </IllustrationButton>
173
169
 
174
- {/* <button className='illustration-button illustration-button--headlines'>
175
- <SvgIconIllustration illustration='headlines' />
176
- <span className='illustration-button__text-label'>
177
- Headlines
178
- </span>
179
- </button>
180
-
181
- <button className='illustration-button illustration-button--headlines'>
182
- <SvgIconIllustration illustration='keywords' />
183
- <span className='illustration-button__text-label'>
184
- Keywords
185
- </span>
186
- </button>
187
-
188
- <button className='illustration-button illustration-button--headlines'>
189
- <SvgIconIllustration illustration='optimise' />
190
- <span className='illustration-button__text-label'>
191
- Optimise
192
- </span>
193
- </button>
194
-
195
- <button className='illustration-button illustration-button--headlines'>
196
- <SvgIconIllustration illustration='summary' />
197
- <span className='illustration-button__text-label'>
198
- Summary
199
- </span>
200
- </button>
201
-
202
- <button className='illustration-button illustration-button--headlines'>
203
- <SvgIconIllustration illustration='translate' />
204
- <span className='illustration-button__text-label'>
205
- Translate
206
- </span>
207
- </button> */}
208
-
209
170
  </div>
210
171
 
211
172
  <hr />
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {DragHandle} from '../../../app-typescript';
2
+ import {DragHandle, Prop, PropsList } from '../../../app-typescript';
3
3
  import * as Markup from '../../js/react';
4
4
 
5
5
  export default class DragHandleDocs extends React.Component {
@@ -13,13 +13,79 @@ export default class DragHandleDocs extends React.Component {
13
13
  </Markup.ReactMarkupCodePreview>
14
14
  <Markup.ReactMarkup>
15
15
  <Markup.ReactMarkupPreview>
16
+ <p className="docs-page__paragraph">// Default</p>
16
17
  <div className="docs-page__content-row">
17
18
  <DragHandle />
18
19
  </div>
20
+ <p className="mt-2 docs-page__paragraph">// Some size examples</p>
21
+ <p className="docs-page__paragraph--small">
22
+ The number of dotted rows and dots in each row can be adjusted independently,
23
+ offering a wide range of size options.
24
+ </p>
25
+ <div className="docs-page__content-row">
26
+ <div className='sd-display--flex sd-flex--items-start sd-gap--medium'>
27
+ <DragHandle dotsInRow='2' dotRows='5' />
28
+ <DragHandle dotsInRow='2' dotRows='8' />
29
+ <DragHandle dotsInRow='3' dotRows='6' />
30
+ <DragHandle dotsInRow='3' dotRows='8' />
31
+ <DragHandle dotsInRow='3' dotRows='10' />
32
+ <DragHandle dotsInRow='5' dotRows='4' />
33
+ </div>
34
+
35
+ </div>
36
+ <p className="docs-page__paragraph">// Blank</p>
37
+ <p className="docs-page__paragraph--small">
38
+ This option will remove all default styles from the components container, like padding and background color.
39
+ To be used within list items, draggable labels, and similar contexts.
40
+ </p>
41
+ <div className="docs-page__content-row">
42
+ <div className='sd-display--flex sd-flex--items-start sd-gap--medium'>
43
+ <DragHandle blank={true} />
44
+ <DragHandle dotsInRow='2' dotRows='10' blank={true} />
45
+ <DragHandle dotsInRow='4' dotRows='10' blank={true} />
46
+ <DragHandle dotsInRow='5' dotRows='4' blank={true} />
47
+ <DragHandle dotsInRow='3' dotRows='4' blank={true} />
48
+
49
+ </div>
50
+ </div>
19
51
  </Markup.ReactMarkupPreview>
20
- <Markup.ReactMarkupCode>{'<DragHandle />'}
52
+ <Markup.ReactMarkupCode>{`
53
+ // Default
54
+ <DragHandle />
55
+
56
+ // Some size examples
57
+ // The number of dotted rows and dots in each row can be adjusted independently,
58
+ offering a wide range of size options.
59
+
60
+ <DragHandle dotsInRow='2' dotsInCol='5' />
61
+ <DragHandle dotsInRow='2' dotsInCol='8' />
62
+ <DragHandle dotsInRow='3' dotsInCol='6' />
63
+ <DragHandle dotsInRow='3' dotsInCol='8' />
64
+ <DragHandle dotsInRow='3' dotsInCol='10' />
65
+ <DragHandle dotsInRow='5' dotRows='4' />
66
+
67
+ // Blank
68
+ // This option will remove all default styles from the components container, like padding and background color.
69
+ To be used within list items, draggable labels, and similar contexts.
70
+
71
+ <DragHandle blank={true} />
72
+ <DragHandle dotsInRow='2' dotRows='10' blank={true} />
73
+ <DragHandle dotsInRow='4' dotRows='10' blank={true} />
74
+ <DragHandle dotsInRow='5' dotRows='4' blank={true} />
75
+ <DragHandle dotsInRow='3' dotRows='4' blank={true} />
76
+
77
+ `}
21
78
  </Markup.ReactMarkupCode>
22
79
  </Markup.ReactMarkup>
80
+
81
+ <h3 className="docs-page__h3">Props</h3>
82
+ <PropsList>
83
+ <Prop name='blank' isRequired={false} type='boolean' default='false' description='Set to true to remove all the default styling from the wrapper, leaving only the dots exposed. This should be applied if the drag handle is used in list items, draggable labels, or similar contexts.'/>
84
+ <Prop name='dotRows' isRequired={false} type='4 | 5 | 6 | 7 | 8 | 10' default='4' description='Set the number of dotted rows and, as a result, the height of the drag handle.'/>
85
+ <Prop name='dotsInRow' isRequired={false} type='2 | 3 | 4 | 5' default='2' description='Set the number of dots in the row. This will also affect the overall wdth of the component.'/>
86
+ <Prop name='dotColor' isRequired={false} type='light | dark' default='currentColor' description='The dots are using the theme text color by default, so this option should be used in rare cases where there is a need to explicitly change this.'/>
87
+ <Prop name='className' isRequired={false} type='string' default='/' description='Add custom classes to modify or override the default styles of the component.'/>
88
+ </PropsList>
23
89
  </section>
24
90
  );
25
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "3.0.82",
3
+ "version": "3.1.1",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,12 @@
1
1
  import * as React from 'react';
2
- import '../../app/styles/_drag-handle.scss';
3
- export declare class DragHandle extends React.PureComponent {
2
+ interface IProps {
3
+ blank?: boolean;
4
+ dotRows?: '4' | '5' | '6' | '7' | '8' | '10';
5
+ dotsInRow?: '2' | '3' | '4' | '5';
6
+ dotColor?: 'light' | 'dark';
7
+ className?: string;
8
+ }
9
+ export declare class DragHandle extends React.PureComponent<IProps> {
4
10
  render(): JSX.Element;
5
11
  }
12
+ export {};
@@ -43,16 +43,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.DragHandle = void 0;
45
45
  var React = __importStar(require("react"));
46
- require("../../app/styles/_drag-handle.scss");
47
- var dots_svg_1 = __importDefault(require("../../app/img/dots.svg"));
46
+ var classnames_1 = __importDefault(require("classnames"));
47
+ var DragHandleDots_1 = require("./DragHandleDots");
48
+ var dotSize = 4; // Size of the single dot image (OneDot.svg) that gets repeated and forms the dotted pattern.
48
49
  var DragHandle = /** @class */ (function (_super) {
49
50
  __extends(DragHandle, _super);
50
51
  function DragHandle() {
51
52
  return _super !== null && _super.apply(this, arguments) || this;
52
53
  }
53
54
  DragHandle.prototype.render = function () {
54
- return (React.createElement("div", { className: "drag-handle-wrapper" },
55
- React.createElement("img", { src: dots_svg_1.default, className: "drag-handle", draggable: false })));
55
+ var _a;
56
+ var _b, _c;
57
+ var classes = (0, classnames_1.default)('drag-handle-wrapper', (_a = {},
58
+ _a["drag-handle-wrapper--boxed"] = !this.props.blank,
59
+ _a['drag-handle-wrapper--blank'] = this.props.blank,
60
+ _a), this.props.className);
61
+ var calcSize = function (numberOfDots) {
62
+ return Number(numberOfDots) * dotSize - (dotSize / 2);
63
+ };
64
+ return (React.createElement("div", { className: classes },
65
+ React.createElement(DragHandleDots_1.DragHandleDots, { style: { width: calcSize((_b = this.props.dotsInRow) !== null && _b !== void 0 ? _b : '2'), height: calcSize((_c = this.props.dotRows) !== null && _c !== void 0 ? _c : '4') }, color: this.props.dotColor })));
56
66
  };
57
67
  return DragHandle;
58
68
  }(React.PureComponent));
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ interface IProps {
3
+ color?: 'light' | 'dark';
4
+ style?: any;
5
+ }
6
+ export declare class DragHandleDots extends React.PureComponent<IProps> {
7
+ render(): JSX.Element;
8
+ }
9
+ export {};
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.DragHandleDots = void 0;
45
+ var React = __importStar(require("react"));
46
+ var classnames_1 = __importDefault(require("classnames"));
47
+ var DragHandleDots = /** @class */ (function (_super) {
48
+ __extends(DragHandleDots, _super);
49
+ function DragHandleDots() {
50
+ return _super !== null && _super.apply(this, arguments) || this;
51
+ }
52
+ DragHandleDots.prototype.render = function () {
53
+ var _a;
54
+ var classes = (0, classnames_1.default)('drag-handle-dots', (_a = {},
55
+ _a["drag-handle-dots--".concat(this.props.color)] = this.props.color,
56
+ _a));
57
+ return (React.createElement("div", { style: this.props.style, className: classes }));
58
+ };
59
+ return DragHandleDots;
60
+ }(React.PureComponent));
61
+ exports.DragHandleDots = DragHandleDots;
@@ -119,7 +119,7 @@ var Menu = /** @class */ (function (_super) {
119
119
  }
120
120
  }
121
121
  } },
122
- React.createElement(tieredmenu_1.TieredMenu, { className: 'sd-overflow--y-auto max-h-full', popup: true, model: this.toPrimeReactInterface(this.props.items), ref: function (el) { return _this.menu = el; }, appendTo: document.body, onShow: function () {
122
+ React.createElement(tieredmenu_1.TieredMenu, { popup: true, model: this.toPrimeReactInterface(this.props.items), ref: function (el) { return _this.menu = el; }, appendTo: document.body, onShow: function () {
123
123
  _this.focusedBefore = document.activeElement;
124
124
  var firstMenuItem = document.querySelectorAll('.p-tieredmenu [role="menuitem"]')[0];
125
125
  if (firstMenuItem instanceof HTMLElement) {
@@ -0,0 +1,62 @@
1
+ import * as React from "react";
2
+ interface IState<T> {
3
+ options: Array<ITreeMenuNode<T>>;
4
+ openDropdown: boolean;
5
+ activeTree: Array<Array<ITreeMenuNode<T>>>;
6
+ buttonTree: Array<ITreeMenuNode<T>>;
7
+ buttonValue: ITreeMenuNode<T> | null;
8
+ filterArr: Array<ITreeMenuNode<T>>;
9
+ searchFieldValue: string;
10
+ firstBranchOptions: Array<ITreeMenuNode<T>>;
11
+ buttonTarget: Array<string>;
12
+ }
13
+ interface IProps<T> {
14
+ zIndex?: number;
15
+ searchPlaceholder?: string;
16
+ singleLevelSearch?: boolean;
17
+ 'data-test-id'?: string;
18
+ getOptions?(): Array<ITreeMenuNode<T>>;
19
+ getLabel(item: T): string;
20
+ getId(item: T): string;
21
+ getBackgroundColor?(item: T): string;
22
+ getBorderColor?(item: T): string;
23
+ optionTemplate?(item: T): React.ComponentType<T> | JSX.Element;
24
+ children: (toggle: (event: React.SyntheticEvent) => void) => JSX.Element;
25
+ }
26
+ interface IParent<T> {
27
+ value: T;
28
+ children: Array<ITreeMenuNode<T>>;
29
+ }
30
+ interface IChildren<T> {
31
+ value: T;
32
+ disabled?: boolean;
33
+ onSelect(): void;
34
+ }
35
+ export type ITreeMenuNode<T> = IParent<T> | IChildren<T>;
36
+ export declare class TreeMenu<T> extends React.Component<IProps<T>, IState<T>> {
37
+ private dropdownRef;
38
+ private ref;
39
+ private openDropdownRef;
40
+ private treeMenuRef;
41
+ private inputRef;
42
+ private popperInstance;
43
+ constructor(props: IProps<T>);
44
+ inputFocus: () => void;
45
+ listNavigation: () => void;
46
+ onMouseDown: (event: MouseEvent) => void;
47
+ onKeyDown: (e: KeyboardEvent) => void;
48
+ onPressEsc: (event: KeyboardEvent) => void;
49
+ componentDidMount: () => void;
50
+ componentWillUnmount(): void;
51
+ componentDidUpdate(_prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
52
+ toggleMenu(): void;
53
+ toggle(event: React.SyntheticEvent): void;
54
+ handleMultiLevel(item: ITreeMenuNode<T>): void;
55
+ handleButton(item: ITreeMenuNode<T>): void;
56
+ handleTree(_event: React.MouseEvent<HTMLLIElement, MouseEvent>, option: ITreeMenuNode<T>): void;
57
+ backButton(): void;
58
+ recursion(arr: Array<ITreeMenuNode<T>>): void;
59
+ filteredItem(arr: Array<ITreeMenuNode<T>>): JSX.Element | JSX.Element[];
60
+ render(): JSX.Element;
61
+ }
62
+ export {};