pxt-core 13.1.17 → 13.1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxt-core",
3
- "version": "13.1.17",
3
+ "version": "13.1.18",
4
4
  "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors",
5
5
  "keywords": [
6
6
  "TypeScript",
@@ -0,0 +1,66 @@
1
+ import * as React from "react";
2
+ import { classList, ControlProps } from "../util";
3
+ import { Button, ButtonViewProps } from "./Button";
4
+ import { DropdownProps } from "./Dropdown";
5
+ import { FocusList } from "./FocusList";
6
+ import { Modal } from "./Modal";
7
+
8
+ interface DropdownModalProps extends DropdownProps {
9
+ onClose: () => void;
10
+ }
11
+
12
+ export const DropdownModal = (props: DropdownModalProps) => {
13
+ const {
14
+ className,
15
+ ariaLabel,
16
+ items,
17
+ selectedId,
18
+ onItemSelected,
19
+ onClose
20
+ } = props;
21
+
22
+ const focusableItems = React.useRef<{[k: string]: HTMLButtonElement}>({});
23
+
24
+ React.useEffect(() => {
25
+ if (Object.keys(focusableItems.current).length) {
26
+ focusableItems.current[selectedId ?? 0].focus();
27
+ }
28
+ }, [selectedId]);
29
+
30
+
31
+ return (
32
+ <Modal
33
+ className={classList("common-dropdown-modal", className)}
34
+ title={ariaLabel}
35
+ hideTitle={true}
36
+ onClose={onClose}
37
+ hideDismissButton={true}
38
+ >
39
+ <FocusList
40
+ role="listbox"
41
+ className="common-menu-dropdown-pane common-dropdown-shadow"
42
+ childTabStopId={selectedId}
43
+ useUpAndDownArrowKeys={true}
44
+ onClose={onClose}
45
+ >
46
+ <ul role="presentation">
47
+ { items.map(item =>
48
+ <li key={item.id} role="presentation">
49
+ <Button
50
+ {...item}
51
+ buttonRef={ref => focusableItems.current[item.id] = (ref as HTMLButtonElement)}
52
+ className={classList("common-dropdown-item", item.className)}
53
+ onClick={() => {
54
+ onItemSelected(item.id);
55
+ onClose();
56
+ }}
57
+ ariaSelected={item.id === selectedId}
58
+ leftIcon={classList("fas fa-check", selectedId !== item.id && "transparent")}
59
+ role="option"/>
60
+ </li>
61
+ )}
62
+ </ul>
63
+ </FocusList>
64
+ </Modal>
65
+ )
66
+ }
@@ -8,7 +8,7 @@ export interface InputProps extends ControlProps {
8
8
  inputClassName?: string;
9
9
  groupClassName?: string;
10
10
  initialValue?: string;
11
- label?: string;
11
+ label?: string | JSX.Element;
12
12
  title?: string;
13
13
  placeholder?: string;
14
14
  icon?: string;
@@ -0,0 +1,17 @@
1
+ .common-dropdown-modal .common-modal {
2
+ .common-modal-header {
3
+ display: none;
4
+ }
5
+ .common-modal-body {
6
+ background: none;
7
+ }
8
+
9
+ .common-menu-dropdown-pane {
10
+ position: relative;
11
+ right: unset;
12
+ }
13
+
14
+ .common-dropdown-item .fas.fa-check.transparent {
15
+ opacity: 0;
16
+ }
17
+ }
@@ -11,6 +11,7 @@
11
11
  @import "controls/Checkbox.less";
12
12
  @import "controls/DraggableGraph.less";
13
13
  @import "controls/Dropdown.less";
14
+ @import "controls/DropdownModal.less";
14
15
  @import "controls/EditorToggle.less";
15
16
  @import "controls/Icon.less";
16
17
  @import "controls/Input.less";
@@ -369,3 +369,8 @@
369
369
  }
370
370
  }
371
371
  }
372
+
373
+ .hc .theme-picker .theme-card.selected {
374
+ border-color: @highContrastTextColor;
375
+ box-shadow: inset 0 0 0 2px @highContrastTextColor;
376
+ }
@@ -12,7 +12,6 @@
12
12
  --note-event-text-color-hover: #ffffff;
13
13
  --note-event-border-hover: 2px solid #ffffff;
14
14
 
15
- --header-text-color: black;
16
15
 
17
16
  --white-key-color: white;
18
17
  --black-key-color: black;
@@ -28,7 +27,9 @@
28
27
 
29
28
  --velocity-slider-color: var(--note-event-color);
30
29
 
31
- --header-background: #f0f0f0;
30
+ --header-background: var(--pxt-neutral-background1);
31
+ --header-text-color: var(--pxt-neutral-foreground1);
32
+
32
33
  --piano-roll-border-color: var(--workspace-grid-line-color);
33
34
  }
34
35
 
@@ -64,6 +65,13 @@
64
65
  .piano-roll .header-container {
65
66
  height: var(--header-height);
66
67
  flex-shrink: 0;
68
+
69
+ .header > .common-dropdown .common-menu-dropdown-pane {
70
+ max-height: 15rem;
71
+ overflow-y: auto;
72
+ overflow-x: hidden;
73
+ z-index: 2;
74
+ }
67
75
  }
68
76
 
69
77
  .piano-roll .header,
@@ -128,6 +136,10 @@
128
136
  &>.common-dropdown #snap-select {
129
137
  min-width: 4.75rem;
130
138
  }
139
+
140
+ .common-button.menu-button {
141
+ color: var(--header-text-color);
142
+ }
131
143
  }
132
144
 
133
145
  .scrollbar.horizontal {
@@ -340,6 +352,16 @@
340
352
  background-color: var(--playhead-color);
341
353
  }
342
354
 
355
+ .piano-roll .header .velocity-editor-toggle {
356
+ overflow-x: hidden;
357
+
358
+ label {
359
+ white-space: nowrap;
360
+ text-overflow: ellipsis;
361
+ overflow: hidden;
362
+ }
363
+ }
364
+
343
365
  .velocity-editor {
344
366
  position: relative;
345
367
  display: flex;
@@ -421,4 +443,10 @@
421
443
  .music-editor-edit-controls .common-button.green {
422
444
  display: none;
423
445
  }
446
+ }
447
+
448
+ @media @tabletAndBelow {
449
+ .common-dropdown > .common-button {
450
+ min-width: 8rem;
451
+ }
424
452
  }