@opengovsg/oui 0.0.20 → 0.0.22
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/button/button.cjs +1 -1
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +4 -3
- package/dist/cjs/checkbox/checkbox.cjs +1 -1
- package/dist/cjs/combo-box/combo-box.cjs +2 -2
- package/dist/cjs/date-field/date-field.cjs +13 -4
- package/dist/cjs/date-picker/date-picker.cjs +38 -14
- package/dist/cjs/date-range-picker/date-range-picker.cjs +4 -4
- package/dist/cjs/field/field.cjs +20 -6
- package/dist/cjs/field/index.cjs +1 -0
- package/dist/cjs/file-dropzone/contexts.cjs +18 -0
- package/dist/cjs/file-dropzone/file-dropzone.cjs +311 -0
- package/dist/cjs/file-dropzone/file-info.cjs +146 -0
- package/dist/cjs/file-dropzone/index.cjs +13 -0
- package/dist/cjs/file-dropzone/types.cjs +3 -0
- package/dist/cjs/file-dropzone/utils.cjs +31 -0
- package/dist/cjs/index.cjs +19 -11
- package/dist/cjs/menu/menu.cjs +1 -1
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/trash-2.cjs +25 -0
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/upload.cjs +23 -0
- package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
- package/dist/cjs/select/select.cjs +2 -2
- package/dist/cjs/tag-field/tag-field.cjs +3 -3
- package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
- package/dist/cjs/text-field/text-field.cjs +1 -1
- package/dist/esm/button/button.js +1 -1
- package/dist/esm/calendar/calendar-month-day-selector.js +4 -3
- package/dist/esm/checkbox/checkbox.js +1 -1
- package/dist/esm/combo-box/combo-box.js +2 -2
- package/dist/esm/date-field/date-field.js +13 -4
- package/dist/esm/date-picker/date-picker.js +38 -14
- package/dist/esm/date-range-picker/date-range-picker.js +4 -4
- package/dist/esm/field/field.js +20 -7
- package/dist/esm/field/index.js +1 -1
- package/dist/esm/file-dropzone/contexts.js +13 -0
- package/dist/esm/file-dropzone/file-dropzone.js +309 -0
- package/dist/esm/file-dropzone/file-info.js +144 -0
- package/dist/esm/file-dropzone/index.js +4 -0
- package/dist/esm/file-dropzone/types.js +1 -0
- package/dist/esm/file-dropzone/utils.js +28 -0
- package/dist/esm/index.js +8 -5
- package/dist/esm/menu/menu.js +1 -1
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/trash-2.js +20 -0
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/upload.js +18 -0
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/esm/select/select.js +2 -2
- package/dist/esm/tag-field/tag-field.js +3 -3
- package/dist/esm/text-area-field/text-area-field.js +1 -1
- package/dist/esm/text-field/text-field.js +1 -1
- package/dist/types/calendar/calendar-month-day-selector.d.ts.map +1 -1
- package/dist/types/date-field/date-field.d.ts +1 -0
- package/dist/types/date-field/date-field.d.ts.map +1 -1
- package/dist/types/date-picker/date-picker.d.ts +5 -2
- package/dist/types/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/field/field.d.ts +4 -1
- package/dist/types/field/field.d.ts.map +1 -1
- package/dist/types/file-dropzone/contexts.d.ts +4 -0
- package/dist/types/file-dropzone/contexts.d.ts.map +1 -0
- package/dist/types/file-dropzone/file-dropzone.d.ts +82 -0
- package/dist/types/file-dropzone/file-dropzone.d.ts.map +1 -0
- package/dist/types/file-dropzone/file-info.d.ts +9 -0
- package/dist/types/file-dropzone/file-info.d.ts.map +1 -0
- package/dist/types/file-dropzone/index.d.ts +7 -0
- package/dist/types/file-dropzone/index.d.ts.map +1 -0
- package/dist/types/file-dropzone/types.d.ts +24 -0
- package/dist/types/file-dropzone/types.d.ts.map +1 -0
- package/dist/types/file-dropzone/utils.d.ts +8 -0
- package/dist/types/file-dropzone/utils.d.ts.map +1 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var $670gB$react = require('react');
|
|
7
|
+
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
+
var contexts = require('./contexts.cjs');
|
|
9
|
+
var utils = require('./utils.cjs');
|
|
10
|
+
var trash2 = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/trash-2.cjs');
|
|
11
|
+
var button = require('../button/button.cjs');
|
|
12
|
+
|
|
13
|
+
const FileInfo = ({ file, imagePreview, classNames }) => {
|
|
14
|
+
const {
|
|
15
|
+
handleRemoveFile,
|
|
16
|
+
handleRemoveRejection,
|
|
17
|
+
formatError,
|
|
18
|
+
isDisabled,
|
|
19
|
+
isReadOnly
|
|
20
|
+
} = contexts.useFileDropzoneStateContext();
|
|
21
|
+
const { size, variant, itemClassNames } = contexts.useFileDropzoneStyleContext();
|
|
22
|
+
const readableFileSize = utils.formatBytes(file.size, 2);
|
|
23
|
+
const styles = ouiTheme.fileInfoDropzoneStyles({
|
|
24
|
+
size,
|
|
25
|
+
variant,
|
|
26
|
+
imagePreview: imagePreview ?? void 0
|
|
27
|
+
});
|
|
28
|
+
const [previewSrc, setPreviewSrc] = $670gB$react.useState("");
|
|
29
|
+
$670gB$react.useEffect(() => {
|
|
30
|
+
let objectUrl = "";
|
|
31
|
+
if (file.type.startsWith("image/")) {
|
|
32
|
+
objectUrl = URL.createObjectURL(file);
|
|
33
|
+
setPreviewSrc(objectUrl);
|
|
34
|
+
}
|
|
35
|
+
return () => URL.revokeObjectURL(objectUrl);
|
|
36
|
+
}, [file]);
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: styles.base({
|
|
41
|
+
className: ouiTheme.cn(itemClassNames?.base, classNames?.base)
|
|
42
|
+
}),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sr-only", children: [
|
|
45
|
+
"File attached: ",
|
|
46
|
+
file.name,
|
|
47
|
+
" with file size of ",
|
|
48
|
+
readableFileSize
|
|
49
|
+
] }),
|
|
50
|
+
imagePreview && previewSrc && /* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: styles.imageContainer({
|
|
54
|
+
className: ouiTheme.cn(
|
|
55
|
+
itemClassNames?.imageContainer,
|
|
56
|
+
classNames?.imageContainer
|
|
57
|
+
)
|
|
58
|
+
}),
|
|
59
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
"img",
|
|
61
|
+
{
|
|
62
|
+
src: previewSrc,
|
|
63
|
+
alt: `Image preview of uploaded file: ${file.name}`,
|
|
64
|
+
className: styles.image({
|
|
65
|
+
className: ouiTheme.cn(itemClassNames?.image, classNames?.image)
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: styles.container({
|
|
75
|
+
className: ouiTheme.cn(itemClassNames?.container, classNames?.container)
|
|
76
|
+
}),
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: styles.textContainer({
|
|
82
|
+
className: ouiTheme.cn(
|
|
83
|
+
itemClassNames?.textContainer,
|
|
84
|
+
classNames?.textContainer
|
|
85
|
+
)
|
|
86
|
+
}),
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
+
"p",
|
|
90
|
+
{
|
|
91
|
+
title: file.name,
|
|
92
|
+
className: styles.name({
|
|
93
|
+
className: ouiTheme.cn(itemClassNames?.name, classNames?.name)
|
|
94
|
+
}),
|
|
95
|
+
children: file.name
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
+
"p",
|
|
100
|
+
{
|
|
101
|
+
className: styles.size({
|
|
102
|
+
className: ouiTheme.cn(itemClassNames?.size, classNames?.size)
|
|
103
|
+
}),
|
|
104
|
+
children: readableFileSize
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
file.errors?.length && /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
"p",
|
|
109
|
+
{
|
|
110
|
+
className: styles.error({
|
|
111
|
+
className: ouiTheme.cn(itemClassNames?.error, classNames?.error)
|
|
112
|
+
}),
|
|
113
|
+
children: file.errors.map(formatError).join(", ")
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
+
button.Button,
|
|
121
|
+
{
|
|
122
|
+
isDisabled: isDisabled || isReadOnly,
|
|
123
|
+
isIconOnly: !file.errors?.length,
|
|
124
|
+
size: size === "md" ? "md" : "xs",
|
|
125
|
+
variant: "clear",
|
|
126
|
+
color: file.errors?.length ? "main" : "critical",
|
|
127
|
+
"aria-label": "Remove file",
|
|
128
|
+
className: styles.actionButton({
|
|
129
|
+
className: ouiTheme.cn(
|
|
130
|
+
itemClassNames?.actionButton,
|
|
131
|
+
classNames?.actionButton
|
|
132
|
+
)
|
|
133
|
+
}),
|
|
134
|
+
onPress: () => file.errors?.length ? handleRemoveRejection(file.name) : handleRemoveFile(file.name),
|
|
135
|
+
children: file.errors?.length ? "Dismiss" : /* @__PURE__ */ jsxRuntime.jsx(trash2.default, {})
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
exports.FileInfo = FileInfo;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var fileDropzone = require('./file-dropzone.cjs');
|
|
5
|
+
var fileInfo = require('./file-info.cjs');
|
|
6
|
+
var utils = require('./utils.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.FileDropzone = fileDropzone.FileDropzone;
|
|
11
|
+
exports.FileInfo = fileInfo.FileInfo;
|
|
12
|
+
exports.formatBytes = utils.formatBytes;
|
|
13
|
+
exports.formatErrorMessage = utils.formatErrorMessage;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var reactDropzone = require('react-dropzone');
|
|
5
|
+
|
|
6
|
+
const formatBytes = (bytes, decimals = 2, size) => {
|
|
7
|
+
const k = 1e3;
|
|
8
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
9
|
+
const sizes = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
10
|
+
if (bytes === 0 || bytes === void 0)
|
|
11
|
+
return size !== void 0 ? `0 ${size}` : "0 bytes";
|
|
12
|
+
const i = size !== void 0 ? sizes.indexOf(size) : Math.floor(Math.log(bytes) / Math.log(k));
|
|
13
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
14
|
+
};
|
|
15
|
+
const formatErrorMessage = (error, config) => {
|
|
16
|
+
const { maxFileSize, minFileSize, maxFiles } = config;
|
|
17
|
+
switch (error.code) {
|
|
18
|
+
case reactDropzone.ErrorCode.FileTooLarge:
|
|
19
|
+
return `You have exceeded the size limit, please upload a file below ${formatBytes(maxFileSize, 2)}`;
|
|
20
|
+
case reactDropzone.ErrorCode.FileTooSmall:
|
|
21
|
+
return `Please upload a file above ${formatBytes(minFileSize, 2)}`;
|
|
22
|
+
case reactDropzone.ErrorCode.TooManyFiles:
|
|
23
|
+
return `Maximum number of files allowed is ${maxFiles}.`;
|
|
24
|
+
default: {
|
|
25
|
+
return error.message;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.formatBytes = formatBytes;
|
|
31
|
+
exports.formatErrorMessage = formatErrorMessage;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var useControllableState = require('./hooks/use-controllable-state.cjs');
|
|
5
|
+
var button = require('./button/button.cjs');
|
|
5
6
|
var govtBanner = require('./govt-banner/govt-banner.cjs');
|
|
6
7
|
var ripple = require('./ripple/ripple.cjs');
|
|
7
8
|
var useRipple = require('./ripple/use-ripple.cjs');
|
|
@@ -18,16 +19,17 @@ var comboBox = require('./combo-box/combo-box.cjs');
|
|
|
18
19
|
var comboBoxFuzzy = require('./combo-box/combo-box-fuzzy.cjs');
|
|
19
20
|
var comboBoxItem = require('./combo-box/combo-box-item.cjs');
|
|
20
21
|
var comboBoxVariantContext = require('./combo-box/combo-box-variant-context.cjs');
|
|
22
|
+
var banner = require('./banner/banner.cjs');
|
|
21
23
|
var tagField = require('./tag-field/tag-field.cjs');
|
|
22
24
|
var tagFieldItem = require('./tag-field/tag-field-item.cjs');
|
|
23
25
|
var select = require('./select/select.cjs');
|
|
24
26
|
var selectItem = require('./select/select-item.cjs');
|
|
25
27
|
var selectVariantContext = require('./select/select-variant-context.cjs');
|
|
26
28
|
var badge = require('./badge/badge.cjs');
|
|
29
|
+
var date = require('@internationalized/date');
|
|
27
30
|
var calendar = require('./calendar/calendar.cjs');
|
|
28
31
|
var calendarStyleContext = require('./calendar/calendar-style-context.cjs');
|
|
29
32
|
var utils = require('./calendar/utils.cjs');
|
|
30
|
-
var date = require('@internationalized/date');
|
|
31
33
|
var rangeCalendar = require('./range-calendar/range-calendar.cjs');
|
|
32
34
|
var menu = require('./menu/menu.cjs');
|
|
33
35
|
var popover = require('./popover/popover.cjs');
|
|
@@ -37,17 +39,19 @@ var datePicker = require('./date-picker/date-picker.cjs');
|
|
|
37
39
|
var dateRangePicker = require('./date-range-picker/date-range-picker.cjs');
|
|
38
40
|
var checkbox = require('./checkbox/checkbox.cjs');
|
|
39
41
|
var checkboxGroupStyleContext = require('./checkbox/checkbox-group-style-context.cjs');
|
|
42
|
+
var usePagination = require('./pagination/hooks/use-pagination.cjs');
|
|
40
43
|
var pagination = require('./pagination/pagination.cjs');
|
|
41
44
|
var paginationCursor = require('./pagination/pagination-cursor.cjs');
|
|
42
45
|
var paginationItem = require('./pagination/pagination-item.cjs');
|
|
43
|
-
var usePagination = require('./pagination/hooks/use-pagination.cjs');
|
|
44
46
|
var usePagination$1 = require('./pagination/use-pagination.cjs');
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
+
var fileDropzone = require('./file-dropzone/file-dropzone.cjs');
|
|
48
|
+
var fileInfo = require('./file-dropzone/file-info.cjs');
|
|
49
|
+
var utils$1 = require('./file-dropzone/utils.cjs');
|
|
47
50
|
|
|
48
51
|
|
|
49
52
|
|
|
50
53
|
exports.useControllableState = useControllableState.useControllableState;
|
|
54
|
+
exports.Button = button.Button;
|
|
51
55
|
exports.GovtBanner = govtBanner.GovtBanner;
|
|
52
56
|
exports.Ripple = ripple.Ripple;
|
|
53
57
|
exports.useRipple = useRipple.useRipple;
|
|
@@ -59,6 +63,7 @@ exports.Input = input.Input;
|
|
|
59
63
|
exports.TextField = textField.TextField;
|
|
60
64
|
exports.Description = field.Description;
|
|
61
65
|
exports.FieldError = field.FieldError;
|
|
66
|
+
exports.FieldErrorIcon = field.FieldErrorIcon;
|
|
62
67
|
exports.FieldGroup = field.FieldGroup;
|
|
63
68
|
exports.Label = field.Label;
|
|
64
69
|
exports.TextArea = textArea.TextArea;
|
|
@@ -69,6 +74,7 @@ exports.ComboBoxFuzzy = comboBoxFuzzy.ComboBoxFuzzy;
|
|
|
69
74
|
exports.ComboBoxItem = comboBoxItem.ComboBoxItem;
|
|
70
75
|
exports.ComboBoxVariantContext = comboBoxVariantContext.ComboBoxVariantContext;
|
|
71
76
|
exports.useComboBoxVariantContext = comboBoxVariantContext.useComboBoxVariantContext;
|
|
77
|
+
exports.Banner = banner.Banner;
|
|
72
78
|
exports.TagField = tagField.TagField;
|
|
73
79
|
exports.TagFieldItem = tagFieldItem.TagFieldItem;
|
|
74
80
|
exports.Select = select.Select;
|
|
@@ -76,6 +82,10 @@ exports.SelectItem = selectItem.SelectItem;
|
|
|
76
82
|
exports.SelectVariantContext = selectVariantContext.SelectVariantContext;
|
|
77
83
|
exports.useSelectVariantContext = selectVariantContext.useSelectVariantContext;
|
|
78
84
|
exports.Badge = badge.Badge;
|
|
85
|
+
Object.defineProperty(exports, "CalendarDate", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () { return date.CalendarDate; }
|
|
88
|
+
});
|
|
79
89
|
exports.Calendar = calendar.Calendar;
|
|
80
90
|
exports.CalendarStateWrapper = calendar.CalendarStateWrapper;
|
|
81
91
|
exports.CalendarStyleContext = calendarStyleContext.CalendarStyleContext;
|
|
@@ -84,10 +94,6 @@ exports.getEraFormat = utils.getEraFormat;
|
|
|
84
94
|
exports.useGenerateLocalizedMonths = utils.useGenerateLocalizedMonths;
|
|
85
95
|
exports.useGenerateLocalizedYears = utils.useGenerateLocalizedYears;
|
|
86
96
|
exports.useLocalizedMonthYear = utils.useLocalizedMonthYear;
|
|
87
|
-
Object.defineProperty(exports, "CalendarDate", {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function () { return date.CalendarDate; }
|
|
90
|
-
});
|
|
91
97
|
exports.RangeCalendar = rangeCalendar.RangeCalendar;
|
|
92
98
|
exports.RangeCalendarCell = rangeCalendar.RangeCalendarCell;
|
|
93
99
|
exports.RangeCalendarStateWrapper = rangeCalendar.RangeCalendarStateWrapper;
|
|
@@ -114,11 +120,13 @@ exports.Checkbox = checkbox.Checkbox;
|
|
|
114
120
|
exports.CheckboxGroup = checkbox.CheckboxGroup;
|
|
115
121
|
exports.CheckboxGroupStyleContext = checkboxGroupStyleContext.CheckboxGroupStyleContext;
|
|
116
122
|
exports.useCheckboxGroupStyleContext = checkboxGroupStyleContext.useCheckboxGroupStyleContext;
|
|
123
|
+
exports.PaginationItemType = usePagination.PaginationItemType;
|
|
117
124
|
exports.Pagination = pagination.Pagination;
|
|
118
125
|
exports.PaginationCursor = paginationCursor.PaginationCursor;
|
|
119
126
|
exports.PaginationItem = paginationItem.PaginationItem;
|
|
120
|
-
exports.PaginationItemType = usePagination.PaginationItemType;
|
|
121
127
|
exports.CURSOR_TRANSITION_TIMEOUT = usePagination$1.CURSOR_TRANSITION_TIMEOUT;
|
|
122
128
|
exports.usePagination = usePagination$1.usePagination;
|
|
123
|
-
exports.
|
|
124
|
-
exports.
|
|
129
|
+
exports.FileDropzone = fileDropzone.FileDropzone;
|
|
130
|
+
exports.FileInfo = fileInfo.FileInfo;
|
|
131
|
+
exports.formatBytes = utils$1.formatBytes;
|
|
132
|
+
exports.formatErrorMessage = utils$1.formatErrorMessage;
|
package/dist/cjs/menu/menu.cjs
CHANGED
|
@@ -6,11 +6,11 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var $670gB$react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
-
var popover = require('../popover/popover.cjs');
|
|
10
9
|
var utils = require('../system/utils.cjs');
|
|
11
10
|
var check = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.cjs');
|
|
12
11
|
var chevronRight = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs');
|
|
13
12
|
var context = require('../system/react-utils/context.cjs');
|
|
13
|
+
var popover = require('../popover/popover.cjs');
|
|
14
14
|
|
|
15
15
|
const [MenuVariantContext, useMenuVariantContext] = context.createContext({
|
|
16
16
|
name: "MenuVariantContext",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var createLucideIcon = require('../createLucideIcon.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v0.475.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const __iconNode = [
|
|
16
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
17
|
+
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
18
|
+
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
19
|
+
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
20
|
+
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
21
|
+
];
|
|
22
|
+
const Trash2 = createLucideIcon.default("Trash2", __iconNode);
|
|
23
|
+
|
|
24
|
+
exports.__iconNode = __iconNode;
|
|
25
|
+
exports.default = Trash2;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var createLucideIcon = require('../createLucideIcon.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v0.475.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const __iconNode = [
|
|
16
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
17
|
+
["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
|
|
18
|
+
["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }]
|
|
19
|
+
];
|
|
20
|
+
const Upload = createLucideIcon.default("Upload", __iconNode);
|
|
21
|
+
|
|
22
|
+
exports.__iconNode = __iconNode;
|
|
23
|
+
exports.default = Upload;
|
|
@@ -8,12 +8,12 @@ var date = require('@internationalized/date');
|
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var useDeepCompare = require('use-deep-compare');
|
|
10
10
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
11
|
-
var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
|
|
12
11
|
var agnosticCalendarStateContext = require('../calendar/agnostic-calendar-state-context.cjs');
|
|
13
12
|
var calendarBottomContent = require('../calendar/calendar-bottom-content.cjs');
|
|
14
13
|
var calendarGridHeader = require('../calendar/calendar-grid-header.cjs');
|
|
15
14
|
var calendarHeader = require('../calendar/calendar-header.cjs');
|
|
16
15
|
var utils = require('../system/utils.cjs');
|
|
16
|
+
var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
|
|
17
17
|
|
|
18
18
|
const RangeCalendar = utils.forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
|
|
19
19
|
const [props, variantProps] = utils.mapPropsVariants(
|
|
@@ -6,11 +6,11 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var $670gB$react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
-
var field = require('../field/field.cjs');
|
|
10
|
-
var popover = require('../popover/popover.cjs');
|
|
11
9
|
var utils = require('../system/utils.cjs');
|
|
12
10
|
var selectVariantContext = require('./select-variant-context.cjs');
|
|
11
|
+
var field = require('../field/field.cjs');
|
|
13
12
|
var chevronDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs');
|
|
13
|
+
var popover = require('../popover/popover.cjs');
|
|
14
14
|
var button = require('../button/button.cjs');
|
|
15
15
|
|
|
16
16
|
const calculateEstimatedRowHeight = (size) => {
|
|
@@ -6,15 +6,15 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var $670gB$react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
-
var field = require('../field/field.cjs');
|
|
10
|
-
var input = require('../input/input.cjs');
|
|
11
|
-
var popover = require('../popover/popover.cjs');
|
|
12
9
|
var tagFieldItem = require('./tag-field-item.cjs');
|
|
13
10
|
var tagFieldList = require('./tag-field-list.cjs');
|
|
14
11
|
var tagFieldRoot = require('./tag-field-root.cjs');
|
|
15
12
|
var tagFieldTagList = require('./tag-field-tag-list.cjs');
|
|
16
13
|
var tagFieldTrigger = require('./tag-field-trigger.cjs');
|
|
17
14
|
var chevronDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs');
|
|
15
|
+
var field = require('../field/field.cjs');
|
|
16
|
+
var input = require('../input/input.cjs');
|
|
17
|
+
var popover = require('../popover/popover.cjs');
|
|
18
18
|
|
|
19
19
|
function TagField({
|
|
20
20
|
classNames,
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
7
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
-
var field = require('../field/field.cjs');
|
|
9
8
|
var textArea = require('../text-area/text-area.cjs');
|
|
9
|
+
var field = require('../field/field.cjs');
|
|
10
10
|
|
|
11
11
|
function TextAreaField({
|
|
12
12
|
label,
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
7
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
-
var field = require('../field/field.cjs');
|
|
9
8
|
var input = require('../input/input.cjs');
|
|
9
|
+
var field = require('../field/field.cjs');
|
|
10
10
|
|
|
11
11
|
function TextField({
|
|
12
12
|
label,
|
|
@@ -5,9 +5,9 @@ import { forwardRef, useMemo } from 'react';
|
|
|
5
5
|
import { chain } from '@react-aria/utils';
|
|
6
6
|
import { Button as Button$1, composeRenderProps } from 'react-aria-components';
|
|
7
7
|
import { buttonStyles } from '@opengovsg/oui-theme';
|
|
8
|
-
import { Ripple } from '../ripple/ripple.js';
|
|
9
8
|
import { useRipple } from '../ripple/use-ripple.js';
|
|
10
9
|
import { Spinner } from '../spinner/spinner.js';
|
|
10
|
+
import { Ripple } from '../ripple/ripple.js';
|
|
11
11
|
|
|
12
12
|
const Button = forwardRef(
|
|
13
13
|
({
|
|
@@ -4,11 +4,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useContext } from 'react';
|
|
5
5
|
import { CalendarDate } from '@internationalized/date';
|
|
6
6
|
import { Group } from 'react-aria-components';
|
|
7
|
-
import { Select } from '../select/select.js';
|
|
8
|
-
import { SelectItem } from '../select/select-item.js';
|
|
9
7
|
import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
|
|
10
8
|
import { useCalendarStyleContext } from './calendar-style-context.js';
|
|
11
9
|
import { useCalendarSelectors } from './hooks/use-calendar-selectors.js';
|
|
10
|
+
import { Select } from '../select/select.js';
|
|
11
|
+
import { SelectItem } from '../select/select-item.js';
|
|
12
12
|
import { useCalendarI18n } from './hooks/use-calendar-i18n.js';
|
|
13
13
|
|
|
14
14
|
const CalendarMonthDaySelector = () => {
|
|
@@ -61,7 +61,8 @@ const CalendarMonthDaySelector = () => {
|
|
|
61
61
|
list: slots.yearList({ className: classNames?.yearList }),
|
|
62
62
|
selectedText: slots.selectorText({
|
|
63
63
|
className: classNames?.selectorText
|
|
64
|
-
})
|
|
64
|
+
}),
|
|
65
|
+
popover: "min-w-[8ch]"
|
|
65
66
|
},
|
|
66
67
|
selectedKey: state.visibleRange.start.year,
|
|
67
68
|
"aria-label": formatMessage("selectYear"),
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { Checkbox as Checkbox$1, composeRenderProps, Provider, CheckboxGroup as CheckboxGroup$1 } from 'react-aria-components';
|
|
5
5
|
import { checkboxStyles, checkboxGroupStyles } from '@opengovsg/oui-theme';
|
|
6
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
6
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
7
|
import { useCheckboxGroupStyleContext, CheckboxGroupStyleContext } from './checkbox-group-style-context.js';
|
|
9
8
|
import Minus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/minus.js';
|
|
10
9
|
import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
10
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
11
11
|
|
|
12
12
|
const Checkbox = ({
|
|
13
13
|
classNames,
|
|
@@ -5,13 +5,13 @@ import { useMemo, useCallback } from 'react';
|
|
|
5
5
|
import { useMessageFormatter } from 'react-aria';
|
|
6
6
|
import { ListLayout, Provider, ComboBox as ComboBox$1, Input, Button, Virtualizer, ListBox } from 'react-aria-components';
|
|
7
7
|
import { listBoxItemStyles, cn, comboBoxStyles, composeTailwindRenderProps, composeRenderProps, comboBoxClearButtonStyles } from '@opengovsg/oui-theme';
|
|
8
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
9
|
-
import { Popover } from '../popover/popover.js';
|
|
10
8
|
import { mapPropsVariants } from '../system/utils.js';
|
|
11
9
|
import { ComboBoxVariantContext } from './combo-box-variant-context.js';
|
|
10
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
12
11
|
import ChevronUp from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-up.js';
|
|
13
12
|
import ChevronDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
|
|
14
13
|
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
14
|
+
import { Popover } from '../popover/popover.js';
|
|
15
15
|
|
|
16
16
|
const calculateEstimatedRowHeight = (size) => {
|
|
17
17
|
switch (size) {
|
|
@@ -4,12 +4,20 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { DateField as DateField$1, DateInput as DateInput$1, DateSegment } from 'react-aria-components';
|
|
6
6
|
import { dateFieldStyles, composeTailwindRenderProps, dateInputStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
9
9
|
|
|
10
10
|
function DateField(originalProps) {
|
|
11
11
|
const [
|
|
12
|
-
{
|
|
12
|
+
{
|
|
13
|
+
inputProps,
|
|
14
|
+
label,
|
|
15
|
+
description,
|
|
16
|
+
errorMessage,
|
|
17
|
+
className,
|
|
18
|
+
classNames,
|
|
19
|
+
...props
|
|
20
|
+
},
|
|
13
21
|
variantProps
|
|
14
22
|
] = useMemo(
|
|
15
23
|
() => mapPropsVariants(originalProps, dateFieldStyles.variantKeys),
|
|
@@ -26,11 +34,11 @@ function DateField(originalProps) {
|
|
|
26
34
|
isDisabled: variantProps.isDisabled,
|
|
27
35
|
className: composeTailwindRenderProps(
|
|
28
36
|
className ?? classNames?.base,
|
|
29
|
-
"flex flex-col gap-2"
|
|
37
|
+
"flex w-full flex-col gap-2"
|
|
30
38
|
),
|
|
31
39
|
children: [
|
|
32
40
|
label && /* @__PURE__ */ jsx(Label, { size: variantProps.size, className: classNames?.label, children: label }),
|
|
33
|
-
/* @__PURE__ */ jsx(DateInput, { size: variantProps.size, className: styles }),
|
|
41
|
+
/* @__PURE__ */ jsx(DateInput, { size: variantProps.size, className: styles, ...inputProps }),
|
|
34
42
|
description && /* @__PURE__ */ jsx(
|
|
35
43
|
Description,
|
|
36
44
|
{
|
|
@@ -65,6 +73,7 @@ function DateInput(originalProps) {
|
|
|
65
73
|
className: composeRenderProps(
|
|
66
74
|
classNames?.segment,
|
|
67
75
|
(className2, renderProps) => styles.segment({
|
|
76
|
+
isEditable: segment.isEditable,
|
|
68
77
|
...renderProps,
|
|
69
78
|
className: className2
|
|
70
79
|
})
|
|
@@ -4,14 +4,13 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { DatePicker as DatePicker$1, Dialog } from 'react-aria-components';
|
|
6
6
|
import { datePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
8
|
-
import '@internationalized/date';
|
|
9
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
10
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
11
|
-
import { Popover } from '../popover/popover.js';
|
|
12
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
13
9
|
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
10
|
+
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
11
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
14
12
|
import { Button } from '../button/button.js';
|
|
13
|
+
import { Popover } from '../popover/popover.js';
|
|
15
14
|
|
|
16
15
|
function DatePicker(originalProps) {
|
|
17
16
|
const [
|
|
@@ -24,6 +23,7 @@ function DatePicker(originalProps) {
|
|
|
24
23
|
calendarProps,
|
|
25
24
|
popoverProps,
|
|
26
25
|
calendarButtonProps,
|
|
26
|
+
selectorIcon,
|
|
27
27
|
...props
|
|
28
28
|
},
|
|
29
29
|
variantProps
|
|
@@ -62,20 +62,44 @@ function DatePicker(originalProps) {
|
|
|
62
62
|
className: classNames?.calendarButton
|
|
63
63
|
}),
|
|
64
64
|
...calendarButtonProps,
|
|
65
|
-
children: /* @__PURE__ */ jsx(
|
|
65
|
+
children: selectorIcon ?? /* @__PURE__ */ jsx(
|
|
66
|
+
Calendar,
|
|
67
|
+
{
|
|
68
|
+
className: styles.selectorIcon({
|
|
69
|
+
className: classNames?.selectorIcon
|
|
70
|
+
}),
|
|
71
|
+
"aria-hidden": true
|
|
72
|
+
}
|
|
73
|
+
)
|
|
66
74
|
}
|
|
67
75
|
)
|
|
68
76
|
] }),
|
|
69
|
-
/* @__PURE__ */ jsx(
|
|
70
|
-
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
Popover,
|
|
79
|
+
{
|
|
80
|
+
placement: "bottom end",
|
|
81
|
+
classNames: classNames?.popover,
|
|
82
|
+
...popoverProps,
|
|
83
|
+
children: /* @__PURE__ */ jsx(Dialog, { className: styles.dialog({ className: classNames?.dialog }), children: /* @__PURE__ */ jsx(
|
|
84
|
+
Calendar$1,
|
|
85
|
+
{
|
|
86
|
+
size: variantProps.size === "xs" ? "sm" : variantProps.size,
|
|
87
|
+
classNames: classNames?.calendar,
|
|
88
|
+
pageBehavior: props.pageBehavior,
|
|
89
|
+
...calendarProps
|
|
90
|
+
}
|
|
91
|
+
) })
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
description && /* @__PURE__ */ jsx(
|
|
95
|
+
Description,
|
|
71
96
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
97
|
+
className: classNames?.description,
|
|
98
|
+
size: variantProps.size,
|
|
99
|
+
children: description
|
|
75
100
|
}
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
/* @__PURE__ */ jsx(FieldError, { size: variantProps.size, children: errorMessage })
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx(FieldError, { classNames: classNames?.error, size: variantProps.size, children: errorMessage })
|
|
79
103
|
]
|
|
80
104
|
}
|
|
81
105
|
);
|
|
@@ -5,13 +5,13 @@ import { useMemo } from 'react';
|
|
|
5
5
|
import { CalendarDate } from '@internationalized/date';
|
|
6
6
|
import { DateRangePicker as DateRangePicker$1, Dialog } from 'react-aria-components';
|
|
7
7
|
import { dateRangePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
8
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
9
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
10
|
-
import { Popover } from '../popover/popover.js';
|
|
11
|
-
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
12
8
|
import { mapPropsVariants } from '../system/utils.js';
|
|
13
9
|
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
10
|
+
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
11
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
12
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
14
13
|
import { Button } from '../button/button.js';
|
|
14
|
+
import { Popover } from '../popover/popover.js';
|
|
15
15
|
|
|
16
16
|
function DateRangePicker(originalProps) {
|
|
17
17
|
const [
|