@mw-kit/mw-ui 1.10.0 → 1.10.2
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/dist/components/Select/styles.d.ts +3 -1
- package/dist/components/Select/types.d.ts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.js +35 -15
- package/dist/index.mjs +35 -15
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const FloatingWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
2
|
type TriggerProps = {
|
|
3
3
|
$empty: boolean;
|
|
4
|
-
$
|
|
4
|
+
$rotate: boolean;
|
|
5
5
|
$viewMode: boolean | undefined;
|
|
6
|
+
$borderless: boolean | undefined;
|
|
7
|
+
$paddingless: boolean | undefined;
|
|
6
8
|
};
|
|
7
9
|
export declare const Trigger: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, TriggerProps>> & string;
|
|
8
10
|
export declare const TriggerValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -43,6 +43,8 @@ export type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
43
43
|
clearable?: boolean;
|
|
44
44
|
readOnly?: boolean;
|
|
45
45
|
viewMode?: boolean;
|
|
46
|
+
borderless?: boolean;
|
|
47
|
+
paddingless?: boolean;
|
|
46
48
|
/**
|
|
47
49
|
* The number of items to render above and below the visible area.
|
|
48
50
|
* The default is 2.
|
package/dist/index.d.mts
CHANGED
|
@@ -3193,6 +3193,8 @@ type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
3193
3193
|
clearable?: boolean;
|
|
3194
3194
|
readOnly?: boolean;
|
|
3195
3195
|
viewMode?: boolean;
|
|
3196
|
+
borderless?: boolean;
|
|
3197
|
+
paddingless?: boolean;
|
|
3196
3198
|
/**
|
|
3197
3199
|
* The number of items to render above and below the visible area.
|
|
3198
3200
|
* The default is 2.
|
package/dist/index.js
CHANGED
|
@@ -9568,8 +9568,8 @@ var SVGContainer = import_styled_components7.default.div`
|
|
|
9568
9568
|
|
|
9569
9569
|
> svg,
|
|
9570
9570
|
> svg * {
|
|
9571
|
-
stroke: ${({ theme: theme4 }) => `var(--color, ${theme4.colors.grey})`};
|
|
9572
|
-
color: ${({ theme: theme4 }) => `var(--color, ${theme4.colors.grey})`};
|
|
9571
|
+
stroke: ${({ theme: theme4 }) => `var(--icon-color, ${theme4.colors.grey})`};
|
|
9572
|
+
color: ${({ theme: theme4 }) => `var(--icon-color, ${theme4.colors.grey})`};
|
|
9573
9573
|
|
|
9574
9574
|
${({ $hasStrokeWidth: hasStrokeWidth }) => hasStrokeWidth && import_styled_components7.css`
|
|
9575
9575
|
stroke-width: var(--stroke-width, unset);
|
|
@@ -9587,7 +9587,7 @@ var SVGContainer = import_styled_components7.default.div`
|
|
|
9587
9587
|
// src/components/Icon/index.tsx
|
|
9588
9588
|
var import_jsx_runtime293 = require("react/jsx-runtime");
|
|
9589
9589
|
var getColor2 = (c) => {
|
|
9590
|
-
if (!c) return
|
|
9590
|
+
if (!c) return theme3.colors.grey;
|
|
9591
9591
|
if (Array.isArray(c)) return theme3.getColor(...c);
|
|
9592
9592
|
return isKeyOf(theme3.colors, c) ? theme3.colors[c] : c;
|
|
9593
9593
|
};
|
|
@@ -9616,7 +9616,7 @@ var Icon = import_react8.default.forwardRef((props, ref) => {
|
|
|
9616
9616
|
$hasHeight: commonProps.height !== void 0,
|
|
9617
9617
|
$hasStrokeWidth: strokeWidth !== void 0,
|
|
9618
9618
|
style: {
|
|
9619
|
-
"--color": getColor2(color),
|
|
9619
|
+
"--icon-color": getColor2(color),
|
|
9620
9620
|
...getSizes({
|
|
9621
9621
|
width: DEFAULT_WIDTH,
|
|
9622
9622
|
...props
|
|
@@ -19987,6 +19987,8 @@ var useMultiSelect = ({
|
|
|
19987
19987
|
clearable,
|
|
19988
19988
|
readOnly,
|
|
19989
19989
|
viewMode,
|
|
19990
|
+
borderless,
|
|
19991
|
+
paddingless,
|
|
19990
19992
|
overscan,
|
|
19991
19993
|
estimateSize,
|
|
19992
19994
|
height,
|
|
@@ -20124,6 +20126,8 @@ var useSingleSelect = ({
|
|
|
20124
20126
|
clearable,
|
|
20125
20127
|
readOnly,
|
|
20126
20128
|
viewMode,
|
|
20129
|
+
borderless,
|
|
20130
|
+
paddingless,
|
|
20127
20131
|
overscan,
|
|
20128
20132
|
estimateSize,
|
|
20129
20133
|
height,
|
|
@@ -20205,17 +20209,30 @@ var Trigger = import_styled_components77.default.button`
|
|
|
20205
20209
|
transition-timing-function: linear;
|
|
20206
20210
|
transition-duration: 0.25s;
|
|
20207
20211
|
|
|
20208
|
-
${({
|
|
20212
|
+
${({
|
|
20213
|
+
theme: theme4,
|
|
20214
|
+
$viewMode: viewMode,
|
|
20215
|
+
$borderless: borderless,
|
|
20216
|
+
$paddingless: paddingless
|
|
20217
|
+
}) => viewMode ? import_styled_components77.css`
|
|
20209
20218
|
padding: 0;
|
|
20210
20219
|
|
|
20211
20220
|
border: none;
|
|
20212
20221
|
` : import_styled_components77.css`
|
|
20213
|
-
|
|
20214
|
-
|
|
20215
|
-
|
|
20216
|
-
|
|
20217
|
-
|
|
20218
|
-
|
|
20222
|
+
${paddingless ? import_styled_components77.css`
|
|
20223
|
+
padding: 0;
|
|
20224
|
+
` : import_styled_components77.css`
|
|
20225
|
+
min-height: 35px;
|
|
20226
|
+
padding: 0 ${theme4.spacings.s3};
|
|
20227
|
+
`}
|
|
20228
|
+
|
|
20229
|
+
${borderless ? import_styled_components77.css`
|
|
20230
|
+
border: none;
|
|
20231
|
+
` : import_styled_components77.css`
|
|
20232
|
+
border-style: solid;
|
|
20233
|
+
border-width: 1px;
|
|
20234
|
+
border-radius: 4px;
|
|
20235
|
+
`}
|
|
20219
20236
|
`}
|
|
20220
20237
|
|
|
20221
20238
|
outline: none !important;
|
|
@@ -20259,11 +20276,11 @@ var Trigger = import_styled_components77.default.button`
|
|
|
20259
20276
|
pointer-events: none;
|
|
20260
20277
|
}
|
|
20261
20278
|
|
|
20262
|
-
>
|
|
20279
|
+
> div:nth-child(2) > svg {
|
|
20263
20280
|
transition-property: transform;
|
|
20264
20281
|
transition-timing-function: linear;
|
|
20265
20282
|
transition-duration: 0.25s;
|
|
20266
|
-
transform: rotate(${({ $
|
|
20283
|
+
transform: rotate(${({ $rotate: rotate }) => rotate ? "180deg" : "0deg"});
|
|
20267
20284
|
}
|
|
20268
20285
|
`;
|
|
20269
20286
|
var TriggerValue = import_styled_components77.default.div`
|
|
@@ -20348,6 +20365,7 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20348
20365
|
}
|
|
20349
20366
|
};
|
|
20350
20367
|
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20368
|
+
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20351
20369
|
return /* @__PURE__ */ (0, import_jsx_runtime366.jsxs)(import_react80.default.Fragment, { children: [
|
|
20352
20370
|
props.label !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime366.jsx)(Label11, { htmlFor: id, $viewMode: viewMode, children: props.label }),
|
|
20353
20371
|
/* @__PURE__ */ (0, import_jsx_runtime366.jsxs)(
|
|
@@ -20359,9 +20377,11 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20359
20377
|
"aria-haspopup": "listbox",
|
|
20360
20378
|
"aria-expanded": open,
|
|
20361
20379
|
"aria-controls": menuId,
|
|
20362
|
-
$
|
|
20380
|
+
$rotate: open && !clearEnabled,
|
|
20363
20381
|
$empty: isEmpty,
|
|
20364
20382
|
$viewMode: viewMode,
|
|
20383
|
+
$borderless: props.borderless,
|
|
20384
|
+
$paddingless: props.paddingless,
|
|
20365
20385
|
"aria-readonly": props.readOnly || viewMode,
|
|
20366
20386
|
"aria-invalid": invalid,
|
|
20367
20387
|
"aria-required": required && !viewMode,
|
|
@@ -20394,7 +20414,7 @@ var Select2 = import_react80.default.forwardRef(
|
|
|
20394
20414
|
{
|
|
20395
20415
|
width: "14px",
|
|
20396
20416
|
color: props.invalid ? ["warningRed"] : ["darkGrey"],
|
|
20397
|
-
|
|
20417
|
+
...clearEnabled ? {
|
|
20398
20418
|
type: "feather",
|
|
20399
20419
|
icon: "x",
|
|
20400
20420
|
onClick: (e) => {
|
package/dist/index.mjs
CHANGED
|
@@ -9508,8 +9508,8 @@ var SVGContainer = styled4.div`
|
|
|
9508
9508
|
|
|
9509
9509
|
> svg,
|
|
9510
9510
|
> svg * {
|
|
9511
|
-
stroke: ${({ theme: theme4 }) => `var(--color, ${theme4.colors.grey})`};
|
|
9512
|
-
color: ${({ theme: theme4 }) => `var(--color, ${theme4.colors.grey})`};
|
|
9511
|
+
stroke: ${({ theme: theme4 }) => `var(--icon-color, ${theme4.colors.grey})`};
|
|
9512
|
+
color: ${({ theme: theme4 }) => `var(--icon-color, ${theme4.colors.grey})`};
|
|
9513
9513
|
|
|
9514
9514
|
${({ $hasStrokeWidth: hasStrokeWidth }) => hasStrokeWidth && css6`
|
|
9515
9515
|
stroke-width: var(--stroke-width, unset);
|
|
@@ -9527,7 +9527,7 @@ var SVGContainer = styled4.div`
|
|
|
9527
9527
|
// src/components/Icon/index.tsx
|
|
9528
9528
|
import { jsx as jsx293 } from "react/jsx-runtime";
|
|
9529
9529
|
var getColor2 = (c) => {
|
|
9530
|
-
if (!c) return
|
|
9530
|
+
if (!c) return theme3.colors.grey;
|
|
9531
9531
|
if (Array.isArray(c)) return theme3.getColor(...c);
|
|
9532
9532
|
return isKeyOf(theme3.colors, c) ? theme3.colors[c] : c;
|
|
9533
9533
|
};
|
|
@@ -9556,7 +9556,7 @@ var Icon = React290.forwardRef((props, ref) => {
|
|
|
9556
9556
|
$hasHeight: commonProps.height !== void 0,
|
|
9557
9557
|
$hasStrokeWidth: strokeWidth !== void 0,
|
|
9558
9558
|
style: {
|
|
9559
|
-
"--color": getColor2(color),
|
|
9559
|
+
"--icon-color": getColor2(color),
|
|
9560
9560
|
...getSizes({
|
|
9561
9561
|
width: DEFAULT_WIDTH,
|
|
9562
9562
|
...props
|
|
@@ -19948,6 +19948,8 @@ var useMultiSelect = ({
|
|
|
19948
19948
|
clearable,
|
|
19949
19949
|
readOnly,
|
|
19950
19950
|
viewMode,
|
|
19951
|
+
borderless,
|
|
19952
|
+
paddingless,
|
|
19951
19953
|
overscan,
|
|
19952
19954
|
estimateSize,
|
|
19953
19955
|
height,
|
|
@@ -20085,6 +20087,8 @@ var useSingleSelect = ({
|
|
|
20085
20087
|
clearable,
|
|
20086
20088
|
readOnly,
|
|
20087
20089
|
viewMode,
|
|
20090
|
+
borderless,
|
|
20091
|
+
paddingless,
|
|
20088
20092
|
overscan,
|
|
20089
20093
|
estimateSize,
|
|
20090
20094
|
height,
|
|
@@ -20166,17 +20170,30 @@ var Trigger = styled74.button`
|
|
|
20166
20170
|
transition-timing-function: linear;
|
|
20167
20171
|
transition-duration: 0.25s;
|
|
20168
20172
|
|
|
20169
|
-
${({
|
|
20173
|
+
${({
|
|
20174
|
+
theme: theme4,
|
|
20175
|
+
$viewMode: viewMode,
|
|
20176
|
+
$borderless: borderless,
|
|
20177
|
+
$paddingless: paddingless
|
|
20178
|
+
}) => viewMode ? css49`
|
|
20170
20179
|
padding: 0;
|
|
20171
20180
|
|
|
20172
20181
|
border: none;
|
|
20173
20182
|
` : css49`
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
20183
|
+
${paddingless ? css49`
|
|
20184
|
+
padding: 0;
|
|
20185
|
+
` : css49`
|
|
20186
|
+
min-height: 35px;
|
|
20187
|
+
padding: 0 ${theme4.spacings.s3};
|
|
20188
|
+
`}
|
|
20189
|
+
|
|
20190
|
+
${borderless ? css49`
|
|
20191
|
+
border: none;
|
|
20192
|
+
` : css49`
|
|
20193
|
+
border-style: solid;
|
|
20194
|
+
border-width: 1px;
|
|
20195
|
+
border-radius: 4px;
|
|
20196
|
+
`}
|
|
20180
20197
|
`}
|
|
20181
20198
|
|
|
20182
20199
|
outline: none !important;
|
|
@@ -20220,11 +20237,11 @@ var Trigger = styled74.button`
|
|
|
20220
20237
|
pointer-events: none;
|
|
20221
20238
|
}
|
|
20222
20239
|
|
|
20223
|
-
>
|
|
20240
|
+
> div:nth-child(2) > svg {
|
|
20224
20241
|
transition-property: transform;
|
|
20225
20242
|
transition-timing-function: linear;
|
|
20226
20243
|
transition-duration: 0.25s;
|
|
20227
|
-
transform: rotate(${({ $
|
|
20244
|
+
transform: rotate(${({ $rotate: rotate }) => rotate ? "180deg" : "0deg"});
|
|
20228
20245
|
}
|
|
20229
20246
|
`;
|
|
20230
20247
|
var TriggerValue = styled74.div`
|
|
@@ -20309,6 +20326,7 @@ var Select2 = React348.forwardRef(
|
|
|
20309
20326
|
}
|
|
20310
20327
|
};
|
|
20311
20328
|
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20329
|
+
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20312
20330
|
return /* @__PURE__ */ jsxs188(React348.Fragment, { children: [
|
|
20313
20331
|
props.label !== void 0 && /* @__PURE__ */ jsx366(Label11, { htmlFor: id, $viewMode: viewMode, children: props.label }),
|
|
20314
20332
|
/* @__PURE__ */ jsxs188(
|
|
@@ -20320,9 +20338,11 @@ var Select2 = React348.forwardRef(
|
|
|
20320
20338
|
"aria-haspopup": "listbox",
|
|
20321
20339
|
"aria-expanded": open,
|
|
20322
20340
|
"aria-controls": menuId,
|
|
20323
|
-
$
|
|
20341
|
+
$rotate: open && !clearEnabled,
|
|
20324
20342
|
$empty: isEmpty,
|
|
20325
20343
|
$viewMode: viewMode,
|
|
20344
|
+
$borderless: props.borderless,
|
|
20345
|
+
$paddingless: props.paddingless,
|
|
20326
20346
|
"aria-readonly": props.readOnly || viewMode,
|
|
20327
20347
|
"aria-invalid": invalid,
|
|
20328
20348
|
"aria-required": required && !viewMode,
|
|
@@ -20355,7 +20375,7 @@ var Select2 = React348.forwardRef(
|
|
|
20355
20375
|
{
|
|
20356
20376
|
width: "14px",
|
|
20357
20377
|
color: props.invalid ? ["warningRed"] : ["darkGrey"],
|
|
20358
|
-
|
|
20378
|
+
...clearEnabled ? {
|
|
20359
20379
|
type: "feather",
|
|
20360
20380
|
icon: "x",
|
|
20361
20381
|
onClick: (e) => {
|