@manakind/ui-core 0.16.0 → 0.17.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.
- package/README.md +2 -0
- package/dist/button/button.css +14 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/reorder-control/index.d.ts +2 -0
- package/dist/reorder-control/index.d.ts.map +1 -0
- package/dist/reorder-control/index.js +2 -0
- package/dist/reorder-control/index.js.map +1 -0
- package/dist/reorder-control/reorder-control.css +44 -0
- package/dist/reorder-control/reorder-control.css.d.ts +2 -0
- package/dist/reorder-control/reorder-control.d.ts +68 -0
- package/dist/reorder-control/reorder-control.d.ts.map +1 -0
- package/dist/reorder-control/reorder-control.js +57 -0
- package/dist/reorder-control/reorder-control.js.map +1 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ separately, so an app can load only what it renders.
|
|
|
70
70
|
| `@manakind/ui-core/checkbox` | `Checkbox` |
|
|
71
71
|
| `@manakind/ui-core/date-input` | `DateInput` |
|
|
72
72
|
| `@manakind/ui-core/progress` | `Progress` |
|
|
73
|
+
| `@manakind/ui-core/reorder-control` | `ReorderControl` |
|
|
73
74
|
| `@manakind/ui-core/segment-group` | `SegmentGroup` |
|
|
74
75
|
| `@manakind/ui-core/select` | `Select` |
|
|
75
76
|
| `@manakind/ui-core/switch` | `Switch` |
|
|
@@ -88,6 +89,7 @@ separately, so an app can load only what it renders.
|
|
|
88
89
|
| `@manakind/ui-core/css/checkbox` | Checkbox structural CSS |
|
|
89
90
|
| `@manakind/ui-core/css/date-input` | DateInput structural CSS |
|
|
90
91
|
| `@manakind/ui-core/css/progress` | Progress structural CSS |
|
|
92
|
+
| `@manakind/ui-core/css/reorder-control` | ReorderControl structural CSS; its handle and input also need `css/button`, `css/icon` and `css/field` |
|
|
91
93
|
| `@manakind/ui-core/css/segment-group` | SegmentGroup structural CSS |
|
|
92
94
|
| `@manakind/ui-core/css/select` | Select structural CSS |
|
|
93
95
|
| `@manakind/ui-core/css/switch` | Switch structural CSS |
|
package/dist/button/button.css
CHANGED
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
color: var(--ds-button-primary-text);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
&:hover:not(:disabled) {
|
|
56
|
+
&:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
57
57
|
background-color: var(--ds-button-primary-bg-hover);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
&:active:not(:disabled) {
|
|
60
|
+
&:active:not(:disabled):not([aria-disabled="true"]) {
|
|
61
61
|
background-color: var(--ds-button-primary-bg-active);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
color: var(--ds-button-secondary-text);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
&:hover:not(:disabled) {
|
|
74
|
+
&:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
75
75
|
background-color: var(--ds-button-secondary-bg-hover);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
color: var(--ds-button-tertiary-text);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
&:hover:not(:disabled) {
|
|
87
|
+
&:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
88
88
|
background-color: var(--ds-button-tertiary-bg-hover);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -97,11 +97,11 @@
|
|
|
97
97
|
color: var(--ds-button-danger-text);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
&:hover:not(:disabled) {
|
|
100
|
+
&:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
101
101
|
background-color: var(--ds-button-danger-bg-hover);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
&:active:not(:disabled) {
|
|
104
|
+
&:active:not(:disabled):not([aria-disabled="true"]) {
|
|
105
105
|
background-color: var(--ds-button-danger-bg-active);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -111,7 +111,14 @@
|
|
|
111
111
|
outline-offset: 3px;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
/*
|
|
115
|
+
* `aria-disabled` keeps the button in the tab order while it does
|
|
116
|
+
* nothing, so focus is not dropped from a control that becomes unavailable
|
|
117
|
+
* while it is focused (the last step of a stepper, a sort that is already
|
|
118
|
+
* applied). It looks the same as `disabled`; the consumer guards the click.
|
|
119
|
+
*/
|
|
120
|
+
&:disabled,
|
|
121
|
+
&[aria-disabled="true"] {
|
|
115
122
|
opacity: var(--ds-opacity-disabled);
|
|
116
123
|
cursor: not-allowed;
|
|
117
124
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reorder-control/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reorder-control/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAIf,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-reorder-control {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--ds-reorder-control-gap);
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
overflow-wrap: anywhere;
|
|
9
|
+
|
|
10
|
+
&.ds-reorder-control--vertical {
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* A pointer drag starts on the handle, so it says so, and claims the
|
|
16
|
+
* touch: with the browser's panning left on, a finger dragging the
|
|
17
|
+
* handle would scroll the page instead.
|
|
18
|
+
*/
|
|
19
|
+
& .ds-reorder-control__handle {
|
|
20
|
+
cursor: grab;
|
|
21
|
+
touch-action: none;
|
|
22
|
+
|
|
23
|
+
&:active:not(:disabled) {
|
|
24
|
+
cursor: grabbing;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:disabled {
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Raised over the small input's own padding and width, which are sized
|
|
34
|
+
* for words: this box holds only a few centred digits.
|
|
35
|
+
*/
|
|
36
|
+
& .ds-input.ds-reorder-control__input {
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
width: var(--ds-reorder-control-input-inline-size);
|
|
39
|
+
padding-inline: var(--ds-reorder-control-input-padding-inline);
|
|
40
|
+
font-variant-numeric: tabular-nums;
|
|
41
|
+
text-align: center;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import './reorder-control.css';
|
|
3
|
+
import type { IconSource } from '../icon/icon';
|
|
4
|
+
/**
|
|
5
|
+
* What a drag library puts on the handle: its ref, ARIA attributes and
|
|
6
|
+
* pointer and keyboard listeners. The handle's name, look and disabled state
|
|
7
|
+
* stay the control's own.
|
|
8
|
+
*/
|
|
9
|
+
export type ReorderHandleProps = Omit<ComponentProps<'button'>, 'children' | 'aria-label' | 'className' | 'disabled' | 'type'>;
|
|
10
|
+
/** How the handle and the position stand: side by side, or the handle above. */
|
|
11
|
+
export type ReorderControlOrientation = 'horizontal' | 'vertical';
|
|
12
|
+
export interface ReorderControlProps {
|
|
13
|
+
/** The item's name. The handle is named "Reorder …" and the input "Position of …". */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Where the item sits in its list, counting from 1. */
|
|
16
|
+
position: number;
|
|
17
|
+
/** How many items the list holds. A typed position is clamped to 1 through this. */
|
|
18
|
+
count: number;
|
|
19
|
+
/** Called with a typed position, once it is committed and only if it moved. */
|
|
20
|
+
onPositionChange: (position: number) => void;
|
|
21
|
+
/** Glyph on the drag handle, supplied by the product. */
|
|
22
|
+
handleIcon: IconSource;
|
|
23
|
+
/**
|
|
24
|
+
* Spread onto the drag handle, so a drag library can drive it: with
|
|
25
|
+
* dnd-kit, `{ ref: setActivatorNodeRef, ...attributes, ...listeners }`.
|
|
26
|
+
*/
|
|
27
|
+
handleProps?: ReorderHandleProps;
|
|
28
|
+
/**
|
|
29
|
+
* `horizontal` (default) sets the position after the handle, for a row of
|
|
30
|
+
* text. `vertical` stacks it under the handle, half as wide, for a column
|
|
31
|
+
* beside a card, where a phone's row has little width to give.
|
|
32
|
+
*/
|
|
33
|
+
orientation?: ReorderControlOrientation;
|
|
34
|
+
/**
|
|
35
|
+
* Disables the handle and the input. The drag library's own listeners and
|
|
36
|
+
* ARIA come in through `handleProps`, so give it the same flag (dnd-kit:
|
|
37
|
+
* `useSortable({ id, disabled })`), or a pointer can still start a drag.
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/** Extra class names appended after `ds-reorder-control`. */
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Two ways to move an item in an ordered list: a drag handle, then the
|
|
45
|
+
* item's position as a number to retype.
|
|
46
|
+
*
|
|
47
|
+
* The handle is a button the product's drag library drives through
|
|
48
|
+
* `handleProps`; the control only names it and gives it the grab cursor and
|
|
49
|
+
* `touch-action: none` a pointer drag needs. The input is the way that does
|
|
50
|
+
* not need a pointer or a drag library's keyboard mode: it keeps what is
|
|
51
|
+
* typed (digits only) as a draft, selects its text on focus so a new number
|
|
52
|
+
* replaces the old, and commits on Enter or blur. Enter only commits: in a
|
|
53
|
+
* form it does not also submit it. A committed position is
|
|
54
|
+
* clamped to the list and reported only if it moved; Escape drops the draft.
|
|
55
|
+
*
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <ReorderControl
|
|
58
|
+
* label={item.title}
|
|
59
|
+
* position={index + 1}
|
|
60
|
+
* count={items.length}
|
|
61
|
+
* onPositionChange={(position) => move(item.id, position)}
|
|
62
|
+
* handleIcon={DragHandle}
|
|
63
|
+
* handleProps={{ ref: setActivatorNodeRef, ...attributes, ...listeners }}
|
|
64
|
+
* />
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function ReorderControl({ label, position, count, onPositionChange, handleIcon, handleProps, orientation, disabled, className, }: ReorderControlProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
//# sourceMappingURL=reorder-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorder-control.d.ts","sourceRoot":"","sources":["../../src/reorder-control/reorder-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAgC,MAAM,OAAO,CAAC;AAC1E,OAAO,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,cAAc,CAAC,QAAQ,CAAC,EACxB,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAC9D,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG,UAAU,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,yDAAyD;IACzD,UAAU,EAAE,UAAU,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,WAA0B,EAC1B,QAAgB,EAChB,SAAS,GACV,EAAE,mBAAmB,2CA+CrB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import './reorder-control.css';
|
|
4
|
+
import { IconButton } from '../button/icon-button';
|
|
5
|
+
import { cx } from '../cx';
|
|
6
|
+
import { Input } from '../field/input';
|
|
7
|
+
function clampPosition(value, count) {
|
|
8
|
+
return Math.min(Math.max(value, 1), count);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Two ways to move an item in an ordered list: a drag handle, then the
|
|
12
|
+
* item's position as a number to retype.
|
|
13
|
+
*
|
|
14
|
+
* The handle is a button the product's drag library drives through
|
|
15
|
+
* `handleProps`; the control only names it and gives it the grab cursor and
|
|
16
|
+
* `touch-action: none` a pointer drag needs. The input is the way that does
|
|
17
|
+
* not need a pointer or a drag library's keyboard mode: it keeps what is
|
|
18
|
+
* typed (digits only) as a draft, selects its text on focus so a new number
|
|
19
|
+
* replaces the old, and commits on Enter or blur. Enter only commits: in a
|
|
20
|
+
* form it does not also submit it. A committed position is
|
|
21
|
+
* clamped to the list and reported only if it moved; Escape drops the draft.
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <ReorderControl
|
|
25
|
+
* label={item.title}
|
|
26
|
+
* position={index + 1}
|
|
27
|
+
* count={items.length}
|
|
28
|
+
* onPositionChange={(position) => move(item.id, position)}
|
|
29
|
+
* handleIcon={DragHandle}
|
|
30
|
+
* handleProps={{ ref: setActivatorNodeRef, ...attributes, ...listeners }}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function ReorderControl({ label, position, count, onPositionChange, handleIcon, handleProps, orientation = 'horizontal', disabled = false, className, }) {
|
|
35
|
+
const [draft, setDraft] = useState(null);
|
|
36
|
+
const commit = () => {
|
|
37
|
+
if (draft === null)
|
|
38
|
+
return;
|
|
39
|
+
setDraft(null);
|
|
40
|
+
const typed = Number.parseInt(draft, 10);
|
|
41
|
+
if (Number.isNaN(typed))
|
|
42
|
+
return;
|
|
43
|
+
const next = clampPosition(typed, count);
|
|
44
|
+
if (next !== position)
|
|
45
|
+
onPositionChange(next);
|
|
46
|
+
};
|
|
47
|
+
const handleKeyDown = (event) => {
|
|
48
|
+
if (event.key === 'Enter') {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
commit();
|
|
51
|
+
}
|
|
52
|
+
if (event.key === 'Escape')
|
|
53
|
+
setDraft(null);
|
|
54
|
+
};
|
|
55
|
+
return (_jsxs("div", { className: cx('ds-reorder-control', `ds-reorder-control--${orientation}`, className), children: [_jsx(IconButton, { ...handleProps, type: "button", className: "ds-reorder-control__handle", variant: "tertiary", size: "sm", icon: handleIcon, "aria-label": `Reorder ${label}`, disabled: disabled }), _jsx(Input, { className: "ds-reorder-control__input", size: "sm", inputMode: "numeric", autoComplete: "off", "aria-label": `Position of ${label}`, value: draft ?? String(position), onChange: (event) => setDraft(event.target.value.replace(/\D/g, '')), onFocus: (event) => event.target.select(), onBlur: commit, onKeyDown: handleKeyDown, disabled: disabled })] }));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=reorder-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorder-control.js","sourceRoot":"","sources":["../../src/reorder-control/reorder-control.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA2C,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAgDvC,SAAS,aAAa,CAAC,KAAa,EAAE,KAAa;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,WAAW,GAAG,YAAY,EAC1B,QAAQ,GAAG,KAAK,EAChB,SAAS,GACW;IACpB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO;QAC3B,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAAE,OAAO;QAChC,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,IAAI,KAAK,QAAQ;YAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,KAAsC,EAAE,EAAE;QAC/D,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;YAC1B,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,EAAE,CAAC;QACX,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,uBAAuB,WAAW,EAAE,EAAE,SAAS,CAAC,aACvF,KAAC,UAAU,OACL,WAAW,EACf,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,IAAI,EACT,IAAI,EAAE,UAAU,gBACJ,WAAW,KAAK,EAAE,EAC9B,QAAQ,EAAE,QAAQ,GAClB,EACF,KAAC,KAAK,IACJ,SAAS,EAAC,2BAA2B,EACrC,IAAI,EAAC,IAAI,EACT,SAAS,EAAC,SAAS,EACnB,YAAY,EAAC,KAAK,gBACN,eAAe,KAAK,EAAE,EAClC,KAAK,EAAE,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EACpE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,EACzC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,QAAQ,GAClB,IACE,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manakind/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -80,6 +80,10 @@
|
|
|
80
80
|
"types": "./dist/progress/index.d.ts",
|
|
81
81
|
"import": "./dist/progress/index.js"
|
|
82
82
|
},
|
|
83
|
+
"./reorder-control": {
|
|
84
|
+
"types": "./dist/reorder-control/index.d.ts",
|
|
85
|
+
"import": "./dist/reorder-control/index.js"
|
|
86
|
+
},
|
|
83
87
|
"./segment-group": {
|
|
84
88
|
"types": "./dist/segment-group/index.d.ts",
|
|
85
89
|
"import": "./dist/segment-group/index.js"
|
|
@@ -152,6 +156,10 @@
|
|
|
152
156
|
"types": "./dist/progress/progress.css.d.ts",
|
|
153
157
|
"default": "./dist/progress/progress.css"
|
|
154
158
|
},
|
|
159
|
+
"./css/reorder-control": {
|
|
160
|
+
"types": "./dist/reorder-control/reorder-control.css.d.ts",
|
|
161
|
+
"default": "./dist/reorder-control/reorder-control.css"
|
|
162
|
+
},
|
|
155
163
|
"./css/segment-group": {
|
|
156
164
|
"types": "./dist/segment-group/segment-group.css.d.ts",
|
|
157
165
|
"default": "./dist/segment-group/segment-group.css"
|
|
@@ -187,7 +195,7 @@
|
|
|
187
195
|
},
|
|
188
196
|
"devDependencies": {
|
|
189
197
|
"@manakind/ds-config": "*",
|
|
190
|
-
"@manakind/manuia-tokens": "0.
|
|
198
|
+
"@manakind/manuia-tokens": "0.17.0",
|
|
191
199
|
"@testing-library/jest-dom": "^6.9.1",
|
|
192
200
|
"@testing-library/react": "^16.3.2",
|
|
193
201
|
"@testing-library/user-event": "^14.6.1",
|