@ncds/ui-admin 1.5.2 → 1.5.3
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/cjs/src/components/date-picker/RangeDatePickerWithButtons.js +4 -2
- package/dist/cjs/src/components/image-file-input/ImageFileInput.js +6 -4
- package/dist/cjs/src/components/input/PasswordInput.js +5 -20
- package/dist/cjs/src/components/tab/HorizontalTab.js +1 -1
- package/dist/esm/src/components/date-picker/RangeDatePickerWithButtons.js +4 -2
- package/dist/esm/src/components/image-file-input/ImageFileInput.js +6 -4
- package/dist/esm/src/components/input/PasswordInput.js +5 -20
- package/dist/esm/src/components/tab/HorizontalTab.js +1 -1
- package/dist/types/src/components/date-picker/RangeDatePickerWithButtons.d.ts +63 -6
- package/dist/types/src/constant/date-picker.d.ts +6 -0
- package/dist/ui-admin/assets/styles/style.css +9 -11
- package/package.json +1 -1
|
@@ -31,9 +31,11 @@ var RangeDatePickerWithButtons = function (_a) {
|
|
|
31
31
|
endDateOptions = _a.endDateOptions,
|
|
32
32
|
validationOption = _a.validationOption,
|
|
33
33
|
periodKeys = _a.periodKeys,
|
|
34
|
+
periodItems = _a.periodItems,
|
|
34
35
|
onDateValidation = _a.onDateValidation;
|
|
36
|
+
var items = periodItems !== null && periodItems !== void 0 ? periodItems : _datePicker.PERIOD_ITEM;
|
|
35
37
|
var setCalculatedDate = function () {
|
|
36
|
-
var currentPeriodItem =
|
|
38
|
+
var currentPeriodItem = items[currentButtonId];
|
|
37
39
|
if (!currentPeriodItem) {
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
@@ -71,7 +73,7 @@ var RangeDatePickerWithButtons = function (_a) {
|
|
|
71
73
|
children: periodKeys.map(function (key) {
|
|
72
74
|
return (0, _jsxRuntime.jsx)(_button.ButtonGroup.Item, {
|
|
73
75
|
isCurrent: currentButtonId === key,
|
|
74
|
-
label:
|
|
76
|
+
label: items[key].text,
|
|
75
77
|
onClick: function () {
|
|
76
78
|
return setCurrentButtonId(key);
|
|
77
79
|
}
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ImageFileInputErrorType = exports.ImageFileInput = void 0;
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
8
|
var _dynamic = _interopRequireDefault(require("@ncds/ui-admin-icon/dynamic"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _react = require("react");
|
|
11
11
|
var _button = require("../button");
|
|
12
12
|
var _shared = require("../shared");
|
|
13
|
-
var _ImagePreview = require("./components/ImagePreview");
|
|
14
13
|
var _tooltip = require("../tooltip");
|
|
14
|
+
var _ImagePreview = require("./components/ImagePreview");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
17
17
|
__assign = Object.assign || function (t) {
|
|
@@ -189,7 +189,9 @@ var ImageFileInput = exports.ImageFileInput = /*#__PURE__*/(0, _react.forwardRef
|
|
|
189
189
|
children: [(0, _jsxRuntime.jsx)(_button.Button, {
|
|
190
190
|
onlyIcon: true,
|
|
191
191
|
size: size,
|
|
192
|
-
className:
|
|
192
|
+
className: (0, _classnames.default)('ncua-image-file-input__preview-container', {
|
|
193
|
+
destructive: destructive
|
|
194
|
+
}),
|
|
193
195
|
onClick: handleBrowseClick,
|
|
194
196
|
disabled: disabled,
|
|
195
197
|
label: imagePreviewTooltipLabel
|
|
@@ -8,7 +8,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
8
8
|
var _uiAdminIcon = require("@ncds/ui-admin-icon");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _react = require("react");
|
|
11
|
-
var _hooks = require("../../hooks");
|
|
12
11
|
var _InputBase = require("./InputBase");
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
@@ -40,37 +39,23 @@ var PasswordInput = exports.PasswordInput = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
40
39
|
var _c = (0, _react.useState)(false),
|
|
41
40
|
isVisible = _c[0],
|
|
42
41
|
setIsVisible = _c[1];
|
|
43
|
-
var _d = (0, _react.useState)(false),
|
|
44
|
-
hasContent = _d[0],
|
|
45
|
-
setHasContent = _d[1];
|
|
46
|
-
var callbackRef = (0, _hooks.useCallbackRef)(function (node) {
|
|
47
|
-
if (node) {
|
|
48
|
-
setHasContent(!!node.value);
|
|
49
|
-
var handleInput_1 = function () {
|
|
50
|
-
setHasContent(!!node.value);
|
|
51
|
-
};
|
|
52
|
-
node.addEventListener('input', handleInput_1);
|
|
53
|
-
return function () {
|
|
54
|
-
node.removeEventListener('input', handleInput_1);
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
var mergedRef = (0, _hooks.useMergeRefs)([ref, callbackRef]);
|
|
59
42
|
var svgProps = {
|
|
60
43
|
width: svgSize[size],
|
|
61
44
|
height: svgSize[size]
|
|
62
45
|
};
|
|
63
46
|
var handleVisibilityChange = function () {
|
|
64
|
-
setIsVisible(
|
|
47
|
+
setIsVisible(function (prev) {
|
|
48
|
+
return !prev;
|
|
49
|
+
});
|
|
65
50
|
};
|
|
66
51
|
return (0, _jsxRuntime.jsx)(_InputBase.InputBase, __assign({
|
|
67
|
-
ref:
|
|
52
|
+
ref: ref,
|
|
68
53
|
size: size,
|
|
69
54
|
type: isVisible ? 'text' : 'password',
|
|
70
55
|
leadingElement: {
|
|
71
56
|
type: 'icon',
|
|
72
57
|
icon: 'lock-01',
|
|
73
|
-
color:
|
|
58
|
+
color: props.value ? 'gray600' : 'gray300'
|
|
74
59
|
},
|
|
75
60
|
trailingElement: {
|
|
76
61
|
type: 'custom',
|
|
@@ -39,7 +39,7 @@ var HorizontalTab = function (_a) {
|
|
|
39
39
|
};
|
|
40
40
|
if (!menus.length) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
41
41
|
return (0, _jsxRuntime.jsx)("div", __assign({
|
|
42
|
-
className: (0, _classnames.default)('ncua-horizontal-tab', "ncua-horizontal-tab--".concat(type), {
|
|
42
|
+
className: (0, _classnames.default)('ncua-horizontal-tab', "ncua-horizontal-tab--".concat(type), "ncua-horizontal-tab--".concat(size), {
|
|
43
43
|
'ncua-horizontal-tab--fullWidth': fullWidth
|
|
44
44
|
})
|
|
45
45
|
}, {
|
|
@@ -25,9 +25,11 @@ export var RangeDatePickerWithButtons = function (_a) {
|
|
|
25
25
|
endDateOptions = _a.endDateOptions,
|
|
26
26
|
validationOption = _a.validationOption,
|
|
27
27
|
periodKeys = _a.periodKeys,
|
|
28
|
+
periodItems = _a.periodItems,
|
|
28
29
|
onDateValidation = _a.onDateValidation;
|
|
30
|
+
var items = periodItems !== null && periodItems !== void 0 ? periodItems : PERIOD_ITEM;
|
|
29
31
|
var setCalculatedDate = function () {
|
|
30
|
-
var currentPeriodItem =
|
|
32
|
+
var currentPeriodItem = items[currentButtonId];
|
|
31
33
|
if (!currentPeriodItem) {
|
|
32
34
|
return;
|
|
33
35
|
}
|
|
@@ -65,7 +67,7 @@ export var RangeDatePickerWithButtons = function (_a) {
|
|
|
65
67
|
children: periodKeys.map(function (key) {
|
|
66
68
|
return _jsx(ButtonGroup.Item, {
|
|
67
69
|
isCurrent: currentButtonId === key,
|
|
68
|
-
label:
|
|
70
|
+
label: items[key].text,
|
|
69
71
|
onClick: function () {
|
|
70
72
|
return setCurrentButtonId(key);
|
|
71
73
|
}
|
|
@@ -26,13 +26,13 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
26
26
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
27
27
|
};
|
|
28
28
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
|
-
import { forwardRef, useState, useRef, useEffect } from 'react';
|
|
30
|
-
import classNames from 'classnames';
|
|
31
29
|
import Icon from '@ncds/ui-admin-icon/dynamic';
|
|
30
|
+
import classNames from 'classnames';
|
|
31
|
+
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
32
32
|
import { Button } from '../button';
|
|
33
33
|
import { HintText, Label } from '../shared';
|
|
34
|
-
import { ImagePreview } from './components/ImagePreview';
|
|
35
34
|
import { Tooltip } from '../tooltip';
|
|
35
|
+
import { ImagePreview } from './components/ImagePreview';
|
|
36
36
|
export var ImageFileInputErrorType;
|
|
37
37
|
(function (ImageFileInputErrorType) {
|
|
38
38
|
ImageFileInputErrorType["ALREADY_UPLOADED"] = "ALREADY_UPLOADED";
|
|
@@ -182,7 +182,9 @@ export var ImageFileInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
182
182
|
children: [_jsx(Button, {
|
|
183
183
|
onlyIcon: true,
|
|
184
184
|
size: size,
|
|
185
|
-
className:
|
|
185
|
+
className: classNames('ncua-image-file-input__preview-container', {
|
|
186
|
+
destructive: destructive
|
|
187
|
+
}),
|
|
186
188
|
onClick: handleBrowseClick,
|
|
187
189
|
disabled: disabled,
|
|
188
190
|
label: imagePreviewTooltipLabel
|
|
@@ -20,7 +20,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
20
20
|
import { Eye, EyeOff } from '@ncds/ui-admin-icon';
|
|
21
21
|
import classNames from 'classnames';
|
|
22
22
|
import { forwardRef, useState } from 'react';
|
|
23
|
-
import { useCallbackRef, useMergeRefs } from '../../hooks';
|
|
24
23
|
import { InputBase } from './InputBase';
|
|
25
24
|
var svgSize = {
|
|
26
25
|
xs: 14,
|
|
@@ -33,37 +32,23 @@ export var PasswordInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
33
32
|
var _c = useState(false),
|
|
34
33
|
isVisible = _c[0],
|
|
35
34
|
setIsVisible = _c[1];
|
|
36
|
-
var _d = useState(false),
|
|
37
|
-
hasContent = _d[0],
|
|
38
|
-
setHasContent = _d[1];
|
|
39
|
-
var callbackRef = useCallbackRef(function (node) {
|
|
40
|
-
if (node) {
|
|
41
|
-
setHasContent(!!node.value);
|
|
42
|
-
var handleInput_1 = function () {
|
|
43
|
-
setHasContent(!!node.value);
|
|
44
|
-
};
|
|
45
|
-
node.addEventListener('input', handleInput_1);
|
|
46
|
-
return function () {
|
|
47
|
-
node.removeEventListener('input', handleInput_1);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
var mergedRef = useMergeRefs([ref, callbackRef]);
|
|
52
35
|
var svgProps = {
|
|
53
36
|
width: svgSize[size],
|
|
54
37
|
height: svgSize[size]
|
|
55
38
|
};
|
|
56
39
|
var handleVisibilityChange = function () {
|
|
57
|
-
setIsVisible(
|
|
40
|
+
setIsVisible(function (prev) {
|
|
41
|
+
return !prev;
|
|
42
|
+
});
|
|
58
43
|
};
|
|
59
44
|
return _jsx(InputBase, __assign({
|
|
60
|
-
ref:
|
|
45
|
+
ref: ref,
|
|
61
46
|
size: size,
|
|
62
47
|
type: isVisible ? 'text' : 'password',
|
|
63
48
|
leadingElement: {
|
|
64
49
|
type: 'icon',
|
|
65
50
|
icon: 'lock-01',
|
|
66
|
-
color:
|
|
51
|
+
color: props.value ? 'gray600' : 'gray300'
|
|
67
52
|
},
|
|
68
53
|
trailingElement: {
|
|
69
54
|
type: 'custom',
|
|
@@ -32,7 +32,7 @@ export var HorizontalTab = function (_a) {
|
|
|
32
32
|
};
|
|
33
33
|
if (!menus.length) return _jsx(_Fragment, {});
|
|
34
34
|
return _jsx("div", __assign({
|
|
35
|
-
className: classNames('ncua-horizontal-tab', "ncua-horizontal-tab--".concat(type), {
|
|
35
|
+
className: classNames('ncua-horizontal-tab', "ncua-horizontal-tab--".concat(type), "ncua-horizontal-tab--".concat(size), {
|
|
36
36
|
'ncua-horizontal-tab--fullWidth': fullWidth
|
|
37
37
|
})
|
|
38
38
|
}, {
|
|
@@ -1,14 +1,71 @@
|
|
|
1
1
|
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
-
import { PERIOD_ITEM } from '../../constant/date-picker';
|
|
2
|
+
import { PERIOD_ITEM, type PeriodItemMap } from '../../constant/date-picker';
|
|
3
3
|
import { type RangeDatePickerProps } from './RangeDatePicker';
|
|
4
4
|
export type PeriodKeyType = keyof typeof PERIOD_ITEM;
|
|
5
|
-
type RangeDatePickerWithButtonsProps = {
|
|
5
|
+
type RangeDatePickerWithButtonsProps<T extends PeriodItemMap = typeof PERIOD_ITEM> = {
|
|
6
6
|
useYesterdayAsEndDate?: boolean;
|
|
7
|
-
currentButtonId:
|
|
8
|
-
setCurrentButtonId: Dispatch<SetStateAction<
|
|
9
|
-
periodKeys:
|
|
7
|
+
currentButtonId: keyof T & string;
|
|
8
|
+
setCurrentButtonId: Dispatch<SetStateAction<keyof T & string>>;
|
|
9
|
+
periodKeys: (keyof T & string)[];
|
|
10
|
+
periodItems?: T;
|
|
10
11
|
size?: 'xs' | 'sm';
|
|
11
12
|
} & RangeDatePickerProps;
|
|
12
|
-
export declare const RangeDatePickerWithButtons:
|
|
13
|
+
export declare const RangeDatePickerWithButtons: <T extends PeriodItemMap = {
|
|
14
|
+
TODAY: {
|
|
15
|
+
text: string;
|
|
16
|
+
period: number;
|
|
17
|
+
unit: string;
|
|
18
|
+
};
|
|
19
|
+
YESTERDAY: {
|
|
20
|
+
text: string;
|
|
21
|
+
period: number;
|
|
22
|
+
unit: string;
|
|
23
|
+
};
|
|
24
|
+
'3DAYS': {
|
|
25
|
+
text: string;
|
|
26
|
+
period: number;
|
|
27
|
+
unit: string;
|
|
28
|
+
};
|
|
29
|
+
'7DAYS': {
|
|
30
|
+
text: string;
|
|
31
|
+
period: number;
|
|
32
|
+
unit: string;
|
|
33
|
+
};
|
|
34
|
+
'1WEEK': {
|
|
35
|
+
text: string;
|
|
36
|
+
period: number;
|
|
37
|
+
unit: string;
|
|
38
|
+
};
|
|
39
|
+
'15DAYS': {
|
|
40
|
+
text: string;
|
|
41
|
+
period: number;
|
|
42
|
+
unit: string;
|
|
43
|
+
};
|
|
44
|
+
'1MONTHS': {
|
|
45
|
+
text: string;
|
|
46
|
+
period: number;
|
|
47
|
+
unit: string;
|
|
48
|
+
};
|
|
49
|
+
'3MONTHS': {
|
|
50
|
+
text: string;
|
|
51
|
+
period: number;
|
|
52
|
+
unit: string;
|
|
53
|
+
};
|
|
54
|
+
'1YEAR': {
|
|
55
|
+
text: string;
|
|
56
|
+
period: number;
|
|
57
|
+
unit: string;
|
|
58
|
+
};
|
|
59
|
+
ENTIRE: {
|
|
60
|
+
text: string;
|
|
61
|
+
period: number;
|
|
62
|
+
unit: null;
|
|
63
|
+
};
|
|
64
|
+
NONE: {
|
|
65
|
+
text: string;
|
|
66
|
+
period: number;
|
|
67
|
+
unit: null;
|
|
68
|
+
};
|
|
69
|
+
}>({ useYesterdayAsEndDate, size, currentButtonId, setCurrentButtonId, startDateOptions, endDateOptions, validationOption, periodKeys, periodItems, onDateValidation, }: RangeDatePickerWithButtonsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
13
70
|
export {};
|
|
14
71
|
//# sourceMappingURL=RangeDatePickerWithButtons.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
@charset "UTF-8";
|
|
2
1
|
:root {
|
|
3
2
|
--primary-red-50: #fffafd;
|
|
4
3
|
--primary-red-100: #ffeaee;
|
|
@@ -4158,6 +4157,10 @@ button {
|
|
|
4158
4157
|
background-color: var(--gray-500);
|
|
4159
4158
|
border-color: var(--gray-500);
|
|
4160
4159
|
}
|
|
4160
|
+
.ncua-date-picker .flatpickr-day.selected.nextMonthDay, .ncua-date-picker .flatpickr-day.selected.prevMonthDay {
|
|
4161
|
+
background-color: var(--gray-500);
|
|
4162
|
+
border-color: var(--gray-500);
|
|
4163
|
+
}
|
|
4161
4164
|
.ncua-date-picker .flatpickr-day.selected:hover {
|
|
4162
4165
|
border-color: var(--gray-700);
|
|
4163
4166
|
background-color: var(--gray-700);
|
|
@@ -5227,19 +5230,10 @@ button {
|
|
|
5227
5230
|
}
|
|
5228
5231
|
.ncua-file-input__hint-list {
|
|
5229
5232
|
margin: 0;
|
|
5230
|
-
|
|
5233
|
+
list-style: disc;
|
|
5231
5234
|
color: var(--gray-400);
|
|
5232
|
-
}
|
|
5233
|
-
.ncua-file-input__hint-item {
|
|
5234
|
-
position: relative;
|
|
5235
5235
|
padding-left: 16px;
|
|
5236
5236
|
}
|
|
5237
|
-
.ncua-file-input__hint-item::before {
|
|
5238
|
-
content: "•";
|
|
5239
|
-
position: absolute;
|
|
5240
|
-
left: 0;
|
|
5241
|
-
top: 0;
|
|
5242
|
-
}
|
|
5243
5237
|
.ncua-file-input--xs {
|
|
5244
5238
|
font-size: var(--font-size-xxs);
|
|
5245
5239
|
line-height: var(--line-heights-xxs);
|
|
@@ -5332,6 +5326,10 @@ button {
|
|
|
5332
5326
|
.ncua-image-file-input__preview-container[disabled], .ncua-image-file-input__preview-container.is-disable, .ncua-image-file-input__preview-container.ncua-btn:hover {
|
|
5333
5327
|
border: 1px dashed var(--gray-200);
|
|
5334
5328
|
}
|
|
5329
|
+
.ncua-image-file-input__preview-container.destructive {
|
|
5330
|
+
background-color: var(--primary-red-100);
|
|
5331
|
+
border: 1px solid var(--primary-red-600);
|
|
5332
|
+
}
|
|
5335
5333
|
.ncua-image-file-input__preview-remove-button {
|
|
5336
5334
|
position: absolute;
|
|
5337
5335
|
top: 50%;
|