superdesk-ui-framework 3.1.8 → 3.1.12
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/app/styles/_helpers.scss +913 -780
- package/app/styles/_master-desk.scss +2 -2
- package/app/styles/components/_sd-collapse-box.scss +113 -0
- package/app/styles/components/_subnav.scss +0 -1
- package/app/styles/design-tokens/_design-tokens-general.scss +19 -5
- package/app/styles/design-tokens/_new-colors.scss +11 -1
- package/app/styles/grids/_grid-layout.scss +0 -1
- package/app/styles/layout/_editor.scss +5 -5
- package/app-typescript/components/ToggleBox/CustomHeaderToggleBox.tsx +56 -0
- package/app-typescript/components/{Togglebox.tsx → ToggleBox/SimpleToggleBox.tsx} +3 -14
- package/app-typescript/components/ToggleBox/index.tsx +41 -0
- package/app-typescript/components/TreeMenu.tsx +4 -2
- package/app-typescript/index.ts +1 -1
- package/dist/components/Alerts.tsx +1 -1
- package/dist/components/ContentDivider.tsx +1 -1
- package/dist/components/DragHandleDocs.tsx +2 -2
- package/dist/components/Index.tsx +105 -50
- package/dist/components/Panel.tsx +13 -13
- package/dist/components/Tags.tsx +2 -2
- package/dist/components/Togglebox.tsx +154 -15
- package/dist/components/utilities/BorderRadiusUtilities.tsx +56 -0
- package/dist/components/utilities/BorderUtilities.tsx +170 -0
- package/dist/components/utilities/DisplayUtilities.tsx +116 -0
- package/dist/components/utilities/FlexAndGridUtilities.tsx +551 -0
- package/dist/components/utilities/ObjectFitUtilities.tsx +53 -0
- package/dist/components/utilities/ObjectPositionUtilities.tsx +68 -0
- package/dist/components/utilities/OpacityUtilities.tsx +64 -0
- package/dist/components/utilities/OverflowUtilities.tsx +93 -0
- package/dist/components/utilities/PositionUtilities.tsx +52 -0
- package/dist/components/utilities/ShadowUtilities.tsx +123 -0
- package/dist/components/utilities/SpacingUtilities.tsx +2 -2
- package/dist/components/utilities/TextUtilities.tsx +44 -4
- package/dist/components.html +2 -4
- package/dist/components_deprecated/modals.html +2 -2
- package/dist/components_deprecated.html +1 -0
- package/dist/design-patterns/Index.tsx +1 -42
- package/dist/design-patterns.html +2 -4
- package/dist/design.html +1 -0
- package/dist/examples.bundle.css +15 -7
- package/dist/examples.bundle.js +3104 -1270
- package/dist/main.html +1 -0
- package/dist/playgrounds/react-playgrounds/Rundowns.tsx +1 -1
- package/dist/playgrounds/react-playgrounds/TestGround.tsx +214 -2
- package/dist/playgrounds.html +1 -0
- package/dist/superdesk-ui.bundle.css +1331 -1006
- package/dist/superdesk-ui.bundle.js +1094 -919
- package/dist/vendor.bundle.js +13 -13
- package/examples/css/docs-page.css +15 -7
- package/examples/js/doc.js +13 -1
- package/examples/pages/components/Alerts.tsx +1 -1
- package/examples/pages/components/ContentDivider.tsx +1 -1
- package/examples/pages/components/DragHandleDocs.tsx +2 -2
- package/examples/pages/components/Index.tsx +105 -50
- package/examples/pages/components/Panel.tsx +13 -13
- package/examples/pages/components/Tags.tsx +2 -2
- package/examples/pages/components/Togglebox.tsx +154 -15
- package/examples/pages/components/utilities/BorderRadiusUtilities.tsx +56 -0
- package/examples/pages/components/utilities/BorderUtilities.tsx +170 -0
- package/examples/pages/components/utilities/DisplayUtilities.tsx +116 -0
- package/examples/pages/components/utilities/FlexAndGridUtilities.tsx +551 -0
- package/examples/pages/components/utilities/ObjectFitUtilities.tsx +53 -0
- package/examples/pages/components/utilities/ObjectPositionUtilities.tsx +68 -0
- package/examples/pages/components/utilities/OpacityUtilities.tsx +64 -0
- package/examples/pages/components/utilities/OverflowUtilities.tsx +93 -0
- package/examples/pages/components/utilities/PositionUtilities.tsx +52 -0
- package/examples/pages/components/utilities/ShadowUtilities.tsx +123 -0
- package/examples/pages/components/utilities/SpacingUtilities.tsx +2 -2
- package/examples/pages/components/utilities/TextUtilities.tsx +44 -4
- package/examples/pages/components.html +2 -4
- package/examples/pages/components_deprecated/modals.html +2 -2
- package/examples/pages/components_deprecated.html +1 -0
- package/examples/pages/design-patterns/Index.tsx +1 -42
- package/examples/pages/design-patterns.html +2 -4
- package/examples/pages/design.html +1 -0
- package/examples/pages/main.html +1 -0
- package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +1 -1
- package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +214 -2
- package/examples/pages/playgrounds.html +1 -0
- package/package.json +1 -1
- package/react/components/ToggleBox/CustomHeaderToggleBox.d.ts +11 -0
- package/react/components/ToggleBox/CustomHeaderToggleBox.js +78 -0
- package/react/components/ToggleBox/SimpleToggleBox.d.ts +18 -0
- package/react/components/{Togglebox.js → ToggleBox/SimpleToggleBox.js} +7 -7
- package/react/components/ToggleBox/index.d.ts +26 -0
- package/react/components/ToggleBox/index.js +71 -0
- package/react/components/TreeMenu.js +4 -2
- package/react/index.d.ts +1 -1
- package/react/index.js +2 -2
- package/react/components/Togglebox.d.ts +0 -28
@@ -39,7 +39,7 @@ $board-header-border-color: var(--color-kanban-border);
|
|
39
39
|
}
|
40
40
|
|
41
41
|
.sd-board__content-block {
|
42
|
-
|
42
|
+
box-shadow: var(--sd-shadow--z2);
|
43
43
|
border-radius: $border-radius__base--x-small;
|
44
44
|
background-color: var(--sd-item__main-Bg);
|
45
45
|
display: flex;
|
@@ -51,7 +51,7 @@ $board-header-border-color: var(--color-kanban-border);
|
|
51
51
|
cursor: pointer;
|
52
52
|
|
53
53
|
&:hover {
|
54
|
-
|
54
|
+
box-shadow: var(--sd-shadow--z3);
|
55
55
|
outline: 1px solid var(--sd-colour-interactive--alpha-50);
|
56
56
|
}
|
57
57
|
}
|
@@ -140,3 +140,116 @@
|
|
140
140
|
align-items: center;
|
141
141
|
}
|
142
142
|
}
|
143
|
+
|
144
|
+
// NEW COLLAPSE BOX
|
145
|
+
.new-collapse-box {
|
146
|
+
--collapse-box-clor-bg: var(--sd-colour-panel-bg--100);
|
147
|
+
display: grid;
|
148
|
+
grid-template-columns: 1fr;
|
149
|
+
grid-template-rows: auto 0fr auto;
|
150
|
+
border-radius: var(--b-radius--small);
|
151
|
+
position: relative;
|
152
|
+
overflow: hidden;
|
153
|
+
transition: all 0.2s ease;
|
154
|
+
outline: 1px solid var(--sd-colour-line--x-light);
|
155
|
+
}
|
156
|
+
.new-collapse-box__header {
|
157
|
+
grid-row: 1 / 2;
|
158
|
+
height: auto;
|
159
|
+
padding: 0;
|
160
|
+
overflow: hidden;
|
161
|
+
transition: all 0.2s ease;
|
162
|
+
}
|
163
|
+
.new-collapse-box__content {
|
164
|
+
grid-row: 2 / 3;
|
165
|
+
display: flex;
|
166
|
+
flex-direction: column;
|
167
|
+
justify-content: flex-start;
|
168
|
+
align-items: stretch;
|
169
|
+
overflow: hidden;
|
170
|
+
padding-block: 0;
|
171
|
+
background-color: var(--sd-colour-panel-bg--100);
|
172
|
+
transition: grid-template-rows 0.2s ease;
|
173
|
+
}
|
174
|
+
.new-collapse-box {
|
175
|
+
&.new-collapse-box--open {
|
176
|
+
grid-template-rows: auto 1fr auto;
|
177
|
+
.new-collapse-box__content {
|
178
|
+
> .new-collapse-box__content-inner {
|
179
|
+
animation: fadeIn 0.3s ease-in 0s 1;
|
180
|
+
overflow-y: auto;
|
181
|
+
.new-collapse-box { // Nested -- collapse-box inside a parent collapse-box
|
182
|
+
&.new-collapse-box--open {
|
183
|
+
.new-collapse-box__content {
|
184
|
+
.new-collapse-box__content-inner {
|
185
|
+
animation: fadeIn2 0.3s ease-in 0s 1;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}
|
192
|
+
&:focus-within {
|
193
|
+
outline-color: var(--sd-colour-interactive);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
.sd-list-item {
|
197
|
+
border-radius: var(--b-radius--small) var(--b-radius--small) 0 0;
|
198
|
+
|
199
|
+
+ .sd-list-item {
|
200
|
+
border-block-start: none;
|
201
|
+
}
|
202
|
+
|
203
|
+
.sd-list-item__border {
|
204
|
+
border-radius: var(--b-radius--small) 0 0 0;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
.new-collapse-box__divider {
|
209
|
+
position: relative;
|
210
|
+
z-index: 1;
|
211
|
+
display: flex;
|
212
|
+
align-items: center;
|
213
|
+
justify-content: center;
|
214
|
+
width: 100%;
|
215
|
+
min-width: 100%;
|
216
|
+
background: linear-gradient(to bottom, transparent 50%, var(--collapse-box-clor-bg) 50%);
|
217
|
+
padding-inline: 0;
|
218
|
+
margin-inline: 0;
|
219
|
+
margin-block-start: -9px;
|
220
|
+
margin-block-end: 8px;
|
221
|
+
border-block-start: 0;
|
222
|
+
border-block-end: 0;
|
223
|
+
border-inline-start: 0;
|
224
|
+
border-inline-end: 0;
|
225
|
+
border-block-start-color: var(--sd-colour-line--light);
|
226
|
+
border-style: solid;
|
227
|
+
&::before,
|
228
|
+
&::after {
|
229
|
+
content: "";
|
230
|
+
position: relative;
|
231
|
+
inset-block-start: 50%;
|
232
|
+
width: 50%;
|
233
|
+
border-block-start: 1px solid transparent;
|
234
|
+
border-top-color: transparent;
|
235
|
+
border-top-color: inherit;
|
236
|
+
border-block-end: 0;
|
237
|
+
border-inline-start: 0;
|
238
|
+
border-inline-end: 0;
|
239
|
+
transform: translateY(50%);
|
240
|
+
border-style: inherit;
|
241
|
+
}
|
242
|
+
.new-collapse-box__divider-label {
|
243
|
+
background-color: var(--collapse-box-button-color-bg-default);
|
244
|
+
color: var(--collapse-box-button-color-fg-default);
|
245
|
+
transition: all 0.2s ease;
|
246
|
+
}
|
247
|
+
&:hover {
|
248
|
+
border-block-start-color: var(--sd-colour-line--medium);
|
249
|
+
.new-collapse-box__divider-label {
|
250
|
+
background-color: var(--collapse-box-button-color-bg-hover);
|
251
|
+
color: var(--collapse-box-button-color-fg-hover);
|
252
|
+
transition: all 0.2s ease;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
@@ -78,10 +78,11 @@
|
|
78
78
|
--sd-shadow--z4: 0 0 0 1px var(--sd-shadow-outline), 0 2px 10px hsla(0, 0%, 0%, 0.2), 0 6px 16px hsla(0, 0%, 0%, 0.3), 0 0 1px hsla(0, 0%, 0%, 0.1);
|
79
79
|
|
80
80
|
// DROP-SHADOW Filter
|
81
|
-
--sd-drop-shadow--z1: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 3px hsla(0, 0%, 0%, 0.18)) drop-shadow(0 0 1px
|
82
|
-
--sd-drop-shadow--z2: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 4px hsla(0, 0%, 0%, 0.18)) drop-shadow(0 2px 6px
|
83
|
-
--sd-drop-shadow--z3: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 6px hsla(0, 0%, 0%, 0.18)) drop-shadow(0 3px 8px
|
84
|
-
--sd-drop-shadow--z4: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 2px 10px hsla(0, 0%, 0%, 0.24)) drop-shadow(0 6px 16px
|
81
|
+
--sd-drop-shadow--z1: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 3px hsla(0, 0%, 0%, 0.18)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.12));
|
82
|
+
--sd-drop-shadow--z2: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 4px hsla(0, 0%, 0%, 0.18)) drop-shadow(0 2px 6px hsla(0, 0%, 0%, 0.14)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.1));
|
83
|
+
--sd-drop-shadow--z3: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 6px hsla(0, 0%, 0%, 0.18)) drop-shadow(0 3px 8px hsla(0, 0%, 0%, 0.26)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.1));
|
84
|
+
--sd-drop-shadow--z4: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 2px 10px hsla(0, 0%, 0%, 0.24)) drop-shadow(0 6px 16px hsla(0, 0%, 0%, 0.32)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.1));
|
85
|
+
--sd-drop-shadow--none: drop-shadow(0 0 0 transparent);
|
85
86
|
|
86
87
|
// FORM ELEMENTS
|
87
88
|
// Size
|
@@ -104,12 +105,25 @@
|
|
104
105
|
|
105
106
|
[data-theme="dark-ui"],
|
106
107
|
.dark-ui {
|
107
|
-
--sd-shadow-outline: hsl(214, 13%, 60%, 0.
|
108
|
+
--sd-shadow-outline: hsl(214, 13%, 60%, 0.28);
|
108
109
|
--sd-shadow-outline--2: hsl(214, 13%, 60%, 0.1);
|
109
110
|
--sd-shadow__dropdown: 0 0 0 1px var(--sd-shadow-outline), 0 2px 10px hsla(0, 0%, 0%, 0.6), 0 3px 1px -2px hsla(0, 0%, 0%, 0.2);
|
110
111
|
--sd-shadow__modal: 0 0 0 1px var(--sd-shadow-outline), 0 0 8px 2px hsla(0, 0%, 0%, 0.4);
|
111
112
|
--sd-shadow__toast: 0 0 0 1px var(--sd-shadow-outline--2), 0 2px 4px hsla(0, 0%, 0%, 0.24), 0 8px 12px hsla(0, 0%, 0%, 0.26);
|
112
113
|
--sd-shadow__menu-item--focus-inner: inset 0 0 0 4px var(--sd-colour-interactive--alpha-20), inset 0 0 0 1px var(--sd-colour-interactive--alpha-50);
|
114
|
+
|
115
|
+
// SHADOW
|
116
|
+
--sd-shadow--z1: 0 0 0 1px var(--sd-shadow-outline), 0 1px 3px hsla(0, 0%, 0%, 0.36), 0 0 1px hsla(0, 0%, 0%, 0.2);
|
117
|
+
--sd-shadow--z2: 0 0 0 1px var(--sd-shadow-outline), 0 1px 4px hsla(0, 0%, 0%, 0.36), 0 2px 6px hsla(0, 0%, 0%, 0.24), 0 0 1px hsla(0, 0%, 0%, 0.2);
|
118
|
+
--sd-shadow--z3: 0 0 0 1px var(--sd-shadow-outline), 0 1px 6px hsla(0, 0%, 0%, 0.36), 0 3px 8px hsla(0, 0%, 0%, 0.48), 0 0 1px hsla(0, 0%, 0%, 0.2);
|
119
|
+
--sd-shadow--z4: 0 0 0 1px var(--sd-shadow-outline), 0 2px 10px hsla(0, 0%, 0%, 0.4), 0 6px 16px hsla(0, 0%, 0%, 0.6), 0 0 1px hsla(0, 0%, 0%, 0.2);
|
120
|
+
|
121
|
+
// DROP-SHADOW Filter
|
122
|
+
--sd-drop-shadow--z1: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 3px hsla(0, 0%, 0%, 0.38)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.2));
|
123
|
+
--sd-drop-shadow--z2: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 4px hsla(0, 0%, 0%, 0.38)) drop-shadow(0 2px 6px hsla(0, 0%, 0%, 0.28)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.2));
|
124
|
+
--sd-drop-shadow--z3: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 1px 6px hsla(0, 0%, 0%, 0.38)) drop-shadow(0 3px 8px hsla(0, 0%, 0%, 0.50)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.2));
|
125
|
+
--sd-drop-shadow--z4: drop-shadow(0 0 0 var(--sd-shadow-outline)) drop-shadow(0 2px 10px hsla(0, 0%, 0%, 0.44)) drop-shadow(0 6px 16px hsla(0, 0%, 0%, 0.64)) drop-shadow(0 0 1px hsla(0, 0%, 0%, 0.2));
|
126
|
+
|
113
127
|
}
|
114
128
|
|
115
129
|
.sd-top-menu,
|
@@ -368,7 +368,11 @@
|
|
368
368
|
--sd-colour-state--in-progress: var(--sd-colour-highlight);
|
369
369
|
--sd-colour-state--done: var(--sd-colour-success);
|
370
370
|
|
371
|
-
|
371
|
+
// New Collapsible Box
|
372
|
+
--collapse-box-button-color-bg-default: hsla(var(--sd-colour-cool-grey-l--85), 1);
|
373
|
+
--collapse-box-button-color-bg-hover: hsla(var(--sd-colour-cool-grey-l--80), 1);
|
374
|
+
--collapse-box-button-color-fg-default: var(--color-text);
|
375
|
+
--collapse-box-button-color-fg-hover: var(--color-text);
|
372
376
|
}
|
373
377
|
|
374
378
|
|
@@ -531,6 +535,12 @@
|
|
531
535
|
--sd-colour-state--default: var(--color-text-lighter);
|
532
536
|
--sd-colour-state--in-progress: var(--sd-colour-highlight);
|
533
537
|
--sd-colour-state--done: var(--sd-colour-success);
|
538
|
+
|
539
|
+
// New Collapsible Box
|
540
|
+
--collapse-box-button-color-bg-default: hsla(var(--sd-colour-cool-grey-l--25), 1);
|
541
|
+
--collapse-box-button-color-bg-hover: hsla(var(--sd-colour-cool-grey-l--30), 1);
|
542
|
+
--collapse-box-button-color-fg-default: var(--color-text-light);
|
543
|
+
--collapse-box-button-color-fg-hover: var(--color-text);
|
534
544
|
}
|
535
545
|
|
536
546
|
|
@@ -700,7 +700,6 @@ $planningEditor-width: 53rem;
|
|
700
700
|
grid-template-columns: [slideInLeft] auto [mainContent] 1fr [slideInRight] auto [overlayContainer] 0;
|
701
701
|
grid-template-rows: [headerToolbar] auto [contentBlock] 1fr;
|
702
702
|
overflow: auto;
|
703
|
-
height: 100%;
|
704
703
|
}
|
705
704
|
|
706
705
|
.sd-main-content-grid__header {
|
@@ -383,6 +383,10 @@
|
|
383
383
|
}
|
384
384
|
|
385
385
|
.sd-editor__container-wrapper {
|
386
|
+
grid-column: 1 / 2;
|
387
|
+
display: grid;
|
388
|
+
grid-template-rows: 1fr;
|
389
|
+
grid-auto-columns: auto;
|
386
390
|
width: 0;
|
387
391
|
min-width: 0;
|
388
392
|
max-width: 0;
|
@@ -390,10 +394,6 @@
|
|
390
394
|
}
|
391
395
|
|
392
396
|
.sd-editor__container {
|
393
|
-
grid-column: 1 / 2;
|
394
|
-
display: grid;
|
395
|
-
grid-template-rows: 1fr;
|
396
|
-
grid-auto-columns: auto;
|
397
397
|
overflow-y: auto;
|
398
398
|
overflow: hidden;
|
399
399
|
opacity: 0;
|
@@ -422,7 +422,7 @@
|
|
422
422
|
}
|
423
423
|
}
|
424
424
|
|
425
|
-
.sd-content-wrapper--editor-full .open-editor .sd-editor__container {
|
425
|
+
.sd-content-wrapper--editor-full .open-editor .sd-editor__container-wrapper {
|
426
426
|
min-width: auto;
|
427
427
|
max-width: none;
|
428
428
|
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import classNames from 'classnames';
|
3
|
+
import {IPropsCustomHeader} from "../ToggleBox/index";
|
4
|
+
|
5
|
+
interface IState {
|
6
|
+
isOpen: boolean;
|
7
|
+
}
|
8
|
+
|
9
|
+
export class CustomHeaderToggleBox extends React.PureComponent<IPropsCustomHeader, IState> {
|
10
|
+
constructor(props: IPropsCustomHeader) {
|
11
|
+
super(props);
|
12
|
+
this.state = {
|
13
|
+
isOpen: this.props.initiallyOpen ?? false,
|
14
|
+
};
|
15
|
+
}
|
16
|
+
|
17
|
+
toggle = (): void => {
|
18
|
+
this.setState({isOpen: !this.state.isOpen}, () => {
|
19
|
+
this.props.onToggle?.(this.state.isOpen);
|
20
|
+
});
|
21
|
+
}
|
22
|
+
|
23
|
+
render() {
|
24
|
+
let classes = classNames('sd-shadow--z1 new-collapse-box', {
|
25
|
+
'new-collapse-box--open': this.state.isOpen,
|
26
|
+
});
|
27
|
+
|
28
|
+
return (
|
29
|
+
<div
|
30
|
+
className={classes}
|
31
|
+
data-test-id='toggle-box'
|
32
|
+
>
|
33
|
+
<div className='new-collapse-box__header'>
|
34
|
+
<div className='new-collapse-box__header-inner'>
|
35
|
+
{this.props.header}
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<button
|
39
|
+
className='new-collapse-box__divider'
|
40
|
+
onClick={this.toggle}
|
41
|
+
>
|
42
|
+
<span className='label label--translucent new-collapse-box__divider-label'>
|
43
|
+
{this.props.toggleButtonLabel}
|
44
|
+
</span>
|
45
|
+
</button>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<div className='new-collapse-box__content'>
|
49
|
+
<div className='new-collapse-box__content-inner p-2 pt-0-5'>
|
50
|
+
{this.props.children}
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
}
|
@@ -1,18 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import nextId from "react-id-generator";
|
4
|
-
|
5
|
-
interface IProps {
|
6
|
-
title: string;
|
7
|
-
badge?: JSX.Element;
|
8
|
-
children: any;
|
9
|
-
hideUsingCSS?: boolean;
|
10
|
-
initiallyOpen?: boolean; // defaults to false
|
11
|
-
className?: string;
|
12
|
-
margin?: 'none' | 'small' | 'normal' | 'large';
|
13
|
-
onOpen?(): void;
|
14
|
-
onClose?(): void;
|
15
|
-
}
|
4
|
+
import {IPropsSimple} from "../ToggleBox/index";
|
16
5
|
|
17
6
|
interface IState {
|
18
7
|
isOpen: boolean;
|
@@ -24,9 +13,9 @@ interface IState {
|
|
24
13
|
* @description ToggleBox used to open/close a set of details
|
25
14
|
*/
|
26
15
|
|
27
|
-
export class
|
16
|
+
export class SimpleToggleBox extends React.PureComponent<IPropsSimple, IState> {
|
28
17
|
htmlId = nextId();
|
29
|
-
constructor(props:
|
18
|
+
constructor(props: IPropsSimple) {
|
30
19
|
super(props);
|
31
20
|
this.state = {
|
32
21
|
isOpen: this.props.initiallyOpen ?? false,
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import {SimpleToggleBox} from './SimpleToggleBox';
|
3
|
+
import {CustomHeaderToggleBox} from './CustomHeaderToggleBox';
|
4
|
+
|
5
|
+
export interface IPropsSimple {
|
6
|
+
variant: 'simple';
|
7
|
+
title: string;
|
8
|
+
badge?: JSX.Element;
|
9
|
+
children: React.ReactNode;
|
10
|
+
hideUsingCSS?: boolean;
|
11
|
+
initiallyOpen?: boolean; // defaults to false
|
12
|
+
className?: string;
|
13
|
+
margin?: 'none' | 'small' | 'normal' | 'large';
|
14
|
+
onOpen?(): void;
|
15
|
+
onClose?(): void;
|
16
|
+
}
|
17
|
+
|
18
|
+
export interface IPropsCustomHeader {
|
19
|
+
variant: 'custom-header'; // always visible
|
20
|
+
header: React.ReactNode;
|
21
|
+
children: React.ReactNode;
|
22
|
+
toggleButtonLabel: string;
|
23
|
+
initiallyOpen?: boolean;
|
24
|
+
onToggle?(isOpen: boolean): void;
|
25
|
+
}
|
26
|
+
|
27
|
+
type IProps = IPropsSimple | IPropsCustomHeader;
|
28
|
+
|
29
|
+
export class ToggleBox extends React.PureComponent<IProps> {
|
30
|
+
render() {
|
31
|
+
if (this.props.variant === "simple") {
|
32
|
+
return (
|
33
|
+
<SimpleToggleBox {...this.props} />
|
34
|
+
);
|
35
|
+
} else {
|
36
|
+
return (
|
37
|
+
<CustomHeaderToggleBox {...this.props} />
|
38
|
+
);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
@@ -57,7 +57,7 @@ function nodeCanBeSelected<T>(item: IParent<T> | IChildren<T>): item is IChildre
|
|
57
57
|
|
58
58
|
function onSelect<T>(item: ITreeMenuNode<T>) {
|
59
59
|
if (nodeCanBeSelected(item)) {
|
60
|
-
return item.onSelect;
|
60
|
+
return item.onSelect();
|
61
61
|
}
|
62
62
|
|
63
63
|
return undefined;
|
@@ -420,7 +420,9 @@ export class TreeMenu<T> extends React.Component<IProps<T>, IState<T>> {
|
|
420
420
|
key={i}
|
421
421
|
option={option}
|
422
422
|
handleTree={this.handleTree}
|
423
|
-
onClick={
|
423
|
+
onClick={() => {
|
424
|
+
onSelect(option);
|
425
|
+
}}
|
424
426
|
disabledItem={disabledItem(option)}
|
425
427
|
getBorderColor={this.props.getBorderColor}
|
426
428
|
getBackgroundColor={this.props.getBackgroundColor}
|
package/app-typescript/index.ts
CHANGED
@@ -69,7 +69,7 @@ export { GridItem, GridItemContent, GridItemMedia, GridItemFooter, GridItemConte
|
|
69
69
|
} from './components/GridItem';
|
70
70
|
export { toasted } from './components/Toast';
|
71
71
|
export { Menu } from './components/Menu';
|
72
|
-
export { ToggleBox } from './components/
|
72
|
+
export { ToggleBox } from './components/ToggleBox/index';
|
73
73
|
export { SelectGrid } from './components/SelectGrid';
|
74
74
|
export { IconPicker } from './components/IconPicker';
|
75
75
|
export { ThemeSelector } from './components/ThemeSelector';
|
@@ -142,7 +142,7 @@ export default class AlertDoc extends React.Component {
|
|
142
142
|
This will strip all margins and the border-radius from the component. Hollow style is not recommended in this case, and small size is advised.</p>
|
143
143
|
<Markup.ReactMarkup>
|
144
144
|
<Markup.ReactMarkupPreview>
|
145
|
-
<div className='
|
145
|
+
<div className='d-flex' style={{border: '1px solid var(--sd-colour-line--medium)', backgroundColor: 'var(--sd-colour-panel-bg--100)', maxHeight: '360px'}}>
|
146
146
|
<PanelElements.Panel open={true} side='left' size='small'>
|
147
147
|
<PanelElements.PanelHeader title='Panel example' onClose={()=> false}>
|
148
148
|
<Alert type='warning' icon='exclamation-sign' banner={true} size='small'>
|
@@ -125,7 +125,7 @@ export default class ContentDividerDoc extends React.Component {
|
|
125
125
|
</div>
|
126
126
|
<p className="docs-page__paragraph ">// With text</p>
|
127
127
|
<p className="docs-page__paragraph--small sd-margin-b--3">Inside a flex container (flex-direction: column;).</p>
|
128
|
-
<div className='docs-page__content-row
|
128
|
+
<div className='docs-page__content-row d-flex'>
|
129
129
|
<div style={{width:'100%'}}>
|
130
130
|
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Cum sociis natoque penatibus et
|
131
131
|
magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit
|
@@ -23,7 +23,7 @@ export default class DragHandleDocs extends React.Component {
|
|
23
23
|
offering a wide range of size options.
|
24
24
|
</p>
|
25
25
|
<div className="docs-page__content-row">
|
26
|
-
<div className='
|
26
|
+
<div className='d-flex items-start sd-gap--medium'>
|
27
27
|
<DragHandle dotsInRow='2' dotRows='5' />
|
28
28
|
<DragHandle dotsInRow='2' dotRows='8' />
|
29
29
|
<DragHandle dotsInRow='3' dotRows='6' />
|
@@ -39,7 +39,7 @@ export default class DragHandleDocs extends React.Component {
|
|
39
39
|
To be used within list items, draggable labels, and similar contexts.
|
40
40
|
</p>
|
41
41
|
<div className="docs-page__content-row">
|
42
|
-
<div className='
|
42
|
+
<div className='d-flex items-start sd-gap--medium'>
|
43
43
|
<DragHandle blank={true} />
|
44
44
|
<DragHandle dotsInRow='2' dotRows='10' blank={true} />
|
45
45
|
<DragHandle dotsInRow='4' dotRows='10' blank={true} />
|
@@ -72,8 +72,18 @@ import { ResizablePanelsDoc } from './ResizablePanels';
|
|
72
72
|
import { IllustrationButtonDoc } from './IllustrationButton';
|
73
73
|
|
74
74
|
// Utilities
|
75
|
-
import {SpacingUtilitiesDoc} from './utilities/SpacingUtilities';
|
76
|
-
import {TextUtilitiesDoc} from './utilities/TextUtilities';
|
75
|
+
import { SpacingUtilitiesDoc } from './utilities/SpacingUtilities';
|
76
|
+
import { TextUtilitiesDoc } from './utilities/TextUtilities';
|
77
|
+
import { ShadowUtilitiesDoc } from './utilities/ShadowUtilities';
|
78
|
+
import { PositionUtilitiesDoc } from './utilities/PositionUtilities';
|
79
|
+
import { OverflowUtilitiesDoc } from './utilities/OverflowUtilities';
|
80
|
+
import { DisplayUtilitiesDoc } from './utilities/DisplayUtilities';
|
81
|
+
import { FlexAndGridUtilitiesDoc } from './utilities/FlexAndGridUtilities';
|
82
|
+
import { BorderRadiusUtilitiesDoc } from './utilities/BorderRadiusUtilities';
|
83
|
+
import { BorderUtilitiesDoc } from './utilities/BorderUtilities';
|
84
|
+
import { OpacityUtilitiesDoc } from './utilities/OpacityUtilities';
|
85
|
+
import { ObjectFitUtilitiesDoc } from './utilities/ObjectFitUtilities';
|
86
|
+
import { ObjectPositionUtilitiesDoc } from './utilities/ObjectPositionUtilities';
|
77
87
|
|
78
88
|
const pages = {
|
79
89
|
basicComponents: {
|
@@ -136,7 +146,7 @@ const pages = {
|
|
136
146
|
"drag-handle": {
|
137
147
|
name: 'Drag handle'
|
138
148
|
},
|
139
|
-
"illustration-button"
|
149
|
+
"illustration-button": {
|
140
150
|
name: 'Illustration Button'
|
141
151
|
}
|
142
152
|
}
|
@@ -299,65 +309,52 @@ const pages = {
|
|
299
309
|
utilityClasses: {
|
300
310
|
name: "Utility classes",
|
301
311
|
items: {
|
312
|
+
'border-utilities': {
|
313
|
+
name: 'Border'
|
314
|
+
},
|
315
|
+
'border-radius-utilities': {
|
316
|
+
name: 'Border Radius'
|
317
|
+
},
|
318
|
+
'display-utilities': {
|
319
|
+
name: 'Display'
|
320
|
+
},
|
321
|
+
'flex-and-grid-utilities': {
|
322
|
+
name: 'Flex & Grid'
|
323
|
+
},
|
324
|
+
'object-fit-utilities': {
|
325
|
+
name: 'Object Fit'
|
326
|
+
},
|
327
|
+
'object-position-utilities': {
|
328
|
+
name: 'Object Position'
|
329
|
+
},
|
330
|
+
'opacity-utilities': {
|
331
|
+
name: 'Opacity'
|
332
|
+
},
|
333
|
+
'overflow-utilities': {
|
334
|
+
name: 'Overflow'
|
335
|
+
},
|
336
|
+
'position-utilities': {
|
337
|
+
name: 'Position'
|
338
|
+
},
|
339
|
+
'shadow-utilities': {
|
340
|
+
name: 'Shadow'
|
341
|
+
},
|
302
342
|
'spacing-utilities': {
|
303
|
-
name: 'Spacing
|
343
|
+
name: 'Spacing',
|
304
344
|
},
|
305
345
|
'text-utilities': {
|
306
|
-
name: 'Text
|
346
|
+
name: 'Text'
|
307
347
|
}
|
308
348
|
}
|
309
349
|
}
|
310
350
|
}
|
311
|
-
interface IProps {
|
312
|
-
theme?: string;
|
313
|
-
}
|
314
|
-
interface IState {
|
315
|
-
theme: 'dark-ui' | 'light-ui' | string;
|
316
|
-
}
|
317
|
-
|
318
|
-
class ReactDoc extends React.Component<IProps, IState> {
|
319
|
-
constructor(props: IProps) {
|
320
|
-
super(props);
|
321
|
-
this.state = {
|
322
|
-
theme: 'light-ui',
|
323
|
-
}
|
324
|
-
this.handleTheme = this.handleTheme.bind(this);
|
325
|
-
}
|
326
|
-
|
327
|
-
handleTheme(newTheme: string) {
|
328
|
-
document.body.setAttribute('data-theme', newTheme);
|
329
|
-
|
330
|
-
this.setState({
|
331
|
-
theme: newTheme
|
332
|
-
})
|
333
|
-
}
|
334
|
-
|
335
|
-
checkTheme(theme: string) {
|
336
|
-
return this.state.theme === theme;
|
337
|
-
}
|
338
351
|
|
352
|
+
class ReactDoc extends React.Component {
|
339
353
|
render() {
|
340
354
|
return (
|
341
355
|
<React.Fragment>
|
342
356
|
<ReactNav pages={pages} />
|
343
357
|
<main className="docs-page__content docs-page__container-fluid">
|
344
|
-
<div className="docs-page__fla-button-container">
|
345
|
-
<Dropdown
|
346
|
-
items={[
|
347
|
-
{
|
348
|
-
type: 'group', label: 'Chose a theme', items: [
|
349
|
-
'divider',
|
350
|
-
{ label: 'Light', icon: 'adjust', active: this.checkTheme('light-ui'), onSelect: () => this.handleTheme('light-ui') },
|
351
|
-
{ label: 'Dark', icon: 'adjust', active: this.checkTheme('dark-ui'), onSelect: () => this.handleTheme('dark-ui') },
|
352
|
-
{ label: 'Accessible Light', active: this.checkTheme('accessible-light-ui'), icon: 'adjust', onSelect: () => this.handleTheme('accessible-light-ui') },
|
353
|
-
]
|
354
|
-
},
|
355
|
-
]}>
|
356
|
-
<button className="docs-page__fla-button" aria-label="Change theme" onClick={() => false}>
|
357
|
-
<i className="icon-adjust"></i>
|
358
|
-
</button>
|
359
|
-
</Dropdown>
|
360
|
-
</div>
|
361
358
|
<Switch>
|
362
359
|
<Route path="/components/buttons" component={ButtonsDoc} />
|
363
360
|
<Route path="/components/icon-buttons" component={IconButtonDoc} />
|
@@ -422,6 +419,16 @@ class ReactDoc extends React.Component<IProps, IState> {
|
|
422
419
|
{/* Utilities */}
|
423
420
|
<Route path="/components/spacing-utilities" component={SpacingUtilitiesDoc} />
|
424
421
|
<Route path="/components/text-utilities" component={TextUtilitiesDoc} />
|
422
|
+
<Route path="/components/shadow-utilities" component={ShadowUtilitiesDoc} />
|
423
|
+
<Route path="/components/position-utilities" component={PositionUtilitiesDoc} />
|
424
|
+
<Route path="/components/overflow-utilities" component={OverflowUtilitiesDoc} />
|
425
|
+
<Route path="/components/display-utilities" component={DisplayUtilitiesDoc} />
|
426
|
+
<Route path="/components/flex-and-grid-utilities" component={FlexAndGridUtilitiesDoc} />
|
427
|
+
<Route path="/components/border-radius-utilities" component={BorderRadiusUtilitiesDoc} />
|
428
|
+
<Route path="/components/border-utilities" component={BorderUtilitiesDoc} />
|
429
|
+
<Route path="/components/opacity-utilities" component={OpacityUtilitiesDoc} />
|
430
|
+
<Route path="/components/object-fit-utilities" component={ObjectFitUtilitiesDoc} />
|
431
|
+
<Route path="/components/object-position-utilities" component={ObjectPositionUtilitiesDoc} />
|
425
432
|
<Route path="/" component={ReactDefault} />
|
426
433
|
</Switch>
|
427
434
|
</main>
|
@@ -444,6 +451,54 @@ class ReactPlayground extends React.Component<IProps> {
|
|
444
451
|
}
|
445
452
|
}
|
446
453
|
|
454
|
+
interface IProps {
|
455
|
+
theme?: string;
|
456
|
+
}
|
457
|
+
interface IState {
|
458
|
+
theme: 'dark-ui' | 'light-ui' | string;
|
459
|
+
}
|
460
|
+
class ReactThemePicker extends React.Component<IProps, IState> {
|
461
|
+
constructor(props: IProps) {
|
462
|
+
super(props);
|
463
|
+
this.state = {
|
464
|
+
theme: 'light-ui',
|
465
|
+
}
|
466
|
+
this.handleTheme = this.handleTheme.bind(this);
|
467
|
+
}
|
468
|
+
|
469
|
+
handleTheme(newTheme: string) {
|
470
|
+
document.body.setAttribute('data-theme', newTheme);
|
471
|
+
|
472
|
+
this.setState({
|
473
|
+
theme: newTheme
|
474
|
+
})
|
475
|
+
}
|
476
|
+
|
477
|
+
checkTheme(theme: string) {
|
478
|
+
return this.state.theme === theme;
|
479
|
+
}
|
480
|
+
|
481
|
+
render() {
|
482
|
+
return (
|
483
|
+
<Dropdown
|
484
|
+
items={[
|
485
|
+
{
|
486
|
+
type: 'group', label: 'Chose a theme', items: [
|
487
|
+
'divider',
|
488
|
+
{ label: 'Light', icon: 'adjust', active: this.checkTheme('light-ui'), onSelect: () => this.handleTheme('light-ui') },
|
489
|
+
{ label: 'Dark', icon: 'adjust', active: this.checkTheme('dark-ui'), onSelect: () => this.handleTheme('dark-ui') },
|
490
|
+
{ label: 'Accessible Light', active: this.checkTheme('accessible-light-ui'), icon: 'adjust', onSelect: () => this.handleTheme('accessible-light-ui') },
|
491
|
+
]
|
492
|
+
},
|
493
|
+
]}>
|
494
|
+
<button className="docs-page__header-button" aria-label="Change theme" onClick={() => false}>
|
495
|
+
<i className="icon-adjust"></i>
|
496
|
+
</button>
|
497
|
+
</Dropdown>
|
498
|
+
);
|
499
|
+
}
|
500
|
+
}
|
501
|
+
|
447
502
|
const parsePlayground = ({ match }, playgrounds) => {
|
448
503
|
const Component = Playgrounds[playgrounds[match.params.id].component];
|
449
504
|
return (
|
@@ -451,5 +506,5 @@ const parsePlayground = ({ match }, playgrounds) => {
|
|
451
506
|
);
|
452
507
|
};
|
453
508
|
|
454
|
-
export { ReactDoc, ReactPlayground };
|
509
|
+
export { ReactDoc, ReactPlayground, ReactThemePicker };
|
455
510
|
|