@opengovsg/oui 0.0.0-snapshot-20251103063040 → 0.0.0-snapshot-20251201075851
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/badge/badge.cjs +4 -4
- package/dist/cjs/badge/use-badge.cjs +6 -6
- package/dist/cjs/banner/banner.cjs +3 -3
- package/dist/cjs/button/button.cjs +4 -4
- package/dist/cjs/calendar/calendar-bottom-content.cjs +3 -3
- package/dist/cjs/calendar/calendar-header.cjs +2 -2
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +6 -5
- package/dist/cjs/calendar/calendar.cjs +4 -4
- package/dist/cjs/calendar/hooks/use-calendar-selectors.cjs +4 -4
- package/dist/cjs/calendar/utils.cjs +3 -3
- package/dist/cjs/checkbox/checkbox.cjs +1 -1
- package/dist/cjs/combo-box/combo-box-fuzzy.cjs +6 -6
- package/dist/cjs/combo-box/combo-box-item.cjs +2 -2
- package/dist/cjs/combo-box/combo-box.cjs +5 -5
- package/dist/cjs/date-field/date-field.cjs +16 -7
- package/dist/cjs/date-picker/date-picker.cjs +39 -14
- package/dist/cjs/date-range-picker/date-range-picker.cjs +7 -7
- 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/govt-banner/govt-banner.cjs +3 -3
- package/dist/cjs/hooks/use-callback-ref.cjs +4 -4
- package/dist/cjs/hooks/use-controllable-state.cjs +2 -2
- package/dist/cjs/index.cjs +34 -24
- package/dist/cjs/input/input.cjs +2 -2
- package/dist/cjs/menu/menu.cjs +7 -7
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/Icon.cjs +4 -4
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +3 -3
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/plus.cjs +22 -0
- 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/number-field/index.cjs +8 -0
- package/dist/cjs/number-field/number-field.cjs +136 -0
- package/dist/cjs/pagination/hooks/use-pagination.cjs +7 -7
- package/dist/cjs/pagination/pagination.cjs +6 -6
- package/dist/cjs/pagination/use-pagination-item.cjs +7 -8
- package/dist/cjs/pagination/use-pagination.cjs +8 -8
- package/dist/cjs/range-calendar/range-calendar.cjs +6 -6
- package/dist/cjs/ripple/use-ripple.cjs +4 -4
- package/dist/cjs/select/select.cjs +4 -4
- package/dist/cjs/spinner/use-spinner.cjs +3 -3
- package/dist/cjs/system/react-utils/context.cjs +3 -3
- package/dist/cjs/system/react-utils/refs.cjs +3 -3
- package/dist/cjs/system/utils.cjs +3 -3
- package/dist/cjs/tabs/tabs.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-item.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-list.cjs +4 -4
- package/dist/cjs/tag-field/tag-field-root.cjs +14 -14
- package/dist/cjs/tag-field/tag-field-state-context.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-tag-list.cjs +3 -3
- package/dist/cjs/tag-field/tag-field-trigger.cjs +2 -2
- package/dist/cjs/tag-field/tag-field.cjs +5 -5
- package/dist/cjs/tag-field/use-tag-field-state.cjs +6 -6
- package/dist/cjs/tag-field/use-tag-field.cjs +4 -4
- package/dist/cjs/text-area/text-area.cjs +2 -2
- package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
- package/dist/cjs/text-field/text-field.cjs +1 -1
- package/dist/cjs/toggle/toggle.cjs +3 -3
- 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 +37 -12
- 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 +13 -9
- 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/plus.js +17 -0
- 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/number-field/index.js +2 -0
- package/dist/esm/number-field/number-field.js +134 -0
- package/dist/esm/pagination/use-pagination-item.js +5 -6
- 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 +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/menu/menu.d.ts.map +1 -1
- package/dist/types/number-field/index.d.ts +3 -0
- package/dist/types/number-field/index.d.ts.map +1 -0
- package/dist/types/number-field/number-field.d.ts +24 -0
- package/dist/types/number-field/number-field.d.ts.map +1 -0
- package/package.json +12 -8
- package/dist/cjs/node_modules/.pnpm/@react-aria_focus@3.20.5_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/focus/dist/useFocusRing.cjs +0 -45
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/context.cjs +0 -21
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/textSelection.cjs +0 -72
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocus.cjs +0 -60
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusVisible.cjs +0 -210
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusWithin.cjs +0 -100
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useHover.cjs +0 -152
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/usePress.cjs +0 -676
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/utils.cjs +0 -160
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_check_private_redeclaration.cjs +0 -9
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.cjs +0 -9
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.cjs +0 -16
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.cjs +0 -9
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_get.cjs +0 -11
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_init.cjs +0 -10
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_set.cjs +0 -12
- package/dist/esm/node_modules/.pnpm/@react-aria_focus@3.20.5_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/focus/dist/useFocusRing.js +0 -43
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/context.js +0 -19
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/textSelection.js +0 -69
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocus.js +0 -58
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusVisible.js +0 -205
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusWithin.js +0 -98
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useHover.js +0 -150
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/usePress.js +0 -674
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/utils.js +0 -155
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_check_private_redeclaration.js +0 -7
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.js +0 -7
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.js +0 -14
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.js +0 -7
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_get.js +0 -9
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_init.js +0 -8
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_set.js +0 -10
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { ErrorCode } from 'react-dropzone';
|
|
3
|
+
|
|
4
|
+
const formatBytes = (bytes, decimals = 2, size) => {
|
|
5
|
+
const k = 1e3;
|
|
6
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
7
|
+
const sizes = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
8
|
+
if (bytes === 0 || bytes === void 0)
|
|
9
|
+
return size !== void 0 ? `0 ${size}` : "0 bytes";
|
|
10
|
+
const i = size !== void 0 ? sizes.indexOf(size) : Math.floor(Math.log(bytes) / Math.log(k));
|
|
11
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
12
|
+
};
|
|
13
|
+
const formatErrorMessage = (error, config) => {
|
|
14
|
+
const { maxFileSize, minFileSize, maxFiles } = config;
|
|
15
|
+
switch (error.code) {
|
|
16
|
+
case ErrorCode.FileTooLarge:
|
|
17
|
+
return `You have exceeded the size limit, please upload a file below ${formatBytes(maxFileSize, 2)}`;
|
|
18
|
+
case ErrorCode.FileTooSmall:
|
|
19
|
+
return `Please upload a file above ${formatBytes(minFileSize, 2)}`;
|
|
20
|
+
case ErrorCode.TooManyFiles:
|
|
21
|
+
return `Maximum number of files allowed is ${maxFiles}.`;
|
|
22
|
+
default: {
|
|
23
|
+
return error.message;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { formatBytes, formatErrorMessage };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
3
|
+
export { Button } from './button/button.js';
|
|
3
4
|
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
4
5
|
export { Ripple } from './ripple/ripple.js';
|
|
5
6
|
export { useRipple } from './ripple/use-ripple.js';
|
|
@@ -9,18 +10,24 @@ export { Toggle } from './toggle/toggle.js';
|
|
|
9
10
|
export { SkipNavLink } from './skip-nav-link/skip-nav-link.js';
|
|
10
11
|
export { Input } from './input/input.js';
|
|
11
12
|
export { TextField } from './text-field/text-field.js';
|
|
12
|
-
export { Description, FieldError, FieldGroup, Label } from './field/field.js';
|
|
13
|
+
export { Description, FieldError, FieldErrorIcon, FieldGroup, Label } from './field/field.js';
|
|
13
14
|
export { TextArea } from './text-area/text-area.js';
|
|
14
15
|
export { TextAreaField } from './text-area-field/text-area-field.js';
|
|
15
16
|
export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
|
|
16
17
|
export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
|
|
17
18
|
export { ComboBoxItem } from './combo-box/combo-box-item.js';
|
|
18
19
|
export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box/combo-box-variant-context.js';
|
|
20
|
+
export { Banner } from './banner/banner.js';
|
|
19
21
|
export { TagField } from './tag-field/tag-field.js';
|
|
20
22
|
export { TagFieldItem } from './tag-field/tag-field-item.js';
|
|
21
23
|
export { Select } from './select/select.js';
|
|
22
24
|
export { SelectItem } from './select/select-item.js';
|
|
23
25
|
export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
|
|
26
|
+
export { Badge } from './badge/badge.js';
|
|
27
|
+
export { CalendarDate } from '@internationalized/date';
|
|
28
|
+
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
29
|
+
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
30
|
+
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
24
31
|
export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
|
|
25
32
|
export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
|
|
26
33
|
export { Popover } from './popover/popover.js';
|
|
@@ -30,15 +37,12 @@ export { DatePicker } from './date-picker/date-picker.js';
|
|
|
30
37
|
export { DateRangePicker } from './date-range-picker/date-range-picker.js';
|
|
31
38
|
export { Checkbox, CheckboxGroup } from './checkbox/checkbox.js';
|
|
32
39
|
export { CheckboxGroupStyleContext, useCheckboxGroupStyleContext } from './checkbox/checkbox-group-style-context.js';
|
|
40
|
+
export { PaginationItemType } from './pagination/hooks/use-pagination.js';
|
|
33
41
|
export { Pagination } from './pagination/pagination.js';
|
|
34
42
|
export { PaginationCursor } from './pagination/pagination-cursor.js';
|
|
35
43
|
export { PaginationItem } from './pagination/pagination-item.js';
|
|
36
|
-
export { PaginationItemType } from './pagination/hooks/use-pagination.js';
|
|
37
44
|
export { CURSOR_TRANSITION_TIMEOUT, usePagination } from './pagination/use-pagination.js';
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
43
|
-
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
44
|
-
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
45
|
+
export { FileDropzone } from './file-dropzone/file-dropzone.js';
|
|
46
|
+
export { FileInfo } from './file-dropzone/file-info.js';
|
|
47
|
+
export { formatBytes, formatErrorMessage } from './file-dropzone/utils.js';
|
|
48
|
+
export { NumberField } from './number-field/number-field.js';
|
package/dist/esm/menu/menu.js
CHANGED
|
@@ -4,11 +4,11 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
4
4
|
import { forwardRef, useMemo, useCallback } from 'react';
|
|
5
5
|
import { useContextProps, MenuItem as MenuItem$1, composeRenderProps, Provider, Menu as Menu$1, MenuSection as MenuSection$1, Header, Collection, MenuTrigger as MenuTrigger$1, SubmenuTrigger as SubmenuTrigger$1, Separator } from 'react-aria-components';
|
|
6
6
|
import { listBoxItemStyles, menuItemStyles, menuStyles, menuSectionStyles, menuDividerStyles } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Popover } from '../popover/popover.js';
|
|
8
7
|
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
9
8
|
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
9
|
import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-right.js';
|
|
11
10
|
import { createContext } from '../system/react-utils/context.js';
|
|
11
|
+
import { Popover } from '../popover/popover.js';
|
|
12
12
|
|
|
13
13
|
const [MenuVariantContext, useMenuVariantContext] = createContext({
|
|
14
14
|
name: "MenuVariantContext",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import createLucideIcon from '../createLucideIcon.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v0.475.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __iconNode = [
|
|
12
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
13
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
14
|
+
];
|
|
15
|
+
const Plus = createLucideIcon("Plus", __iconNode);
|
|
16
|
+
|
|
17
|
+
export { __iconNode, Plus as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import createLucideIcon from '../createLucideIcon.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v0.475.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __iconNode = [
|
|
12
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
13
|
+
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
14
|
+
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
15
|
+
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
16
|
+
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
17
|
+
];
|
|
18
|
+
const Trash2 = createLucideIcon("Trash2", __iconNode);
|
|
19
|
+
|
|
20
|
+
export { __iconNode, Trash2 as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import createLucideIcon from '../createLucideIcon.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v0.475.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __iconNode = [
|
|
12
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
13
|
+
["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
|
|
14
|
+
["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }]
|
|
15
|
+
];
|
|
16
|
+
const Upload = createLucideIcon("Upload", __iconNode);
|
|
17
|
+
|
|
18
|
+
export { __iconNode, Upload as default };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { NumberField as NumberField$1 } from 'react-aria-components';
|
|
5
|
+
import { numberFieldStyles, composeTailwindRenderProps, dataAttr, fieldBorderStyles, cn } from '@opengovsg/oui-theme';
|
|
6
|
+
import { mapPropsVariants } from '../system/utils.js';
|
|
7
|
+
import Minus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/minus.js';
|
|
8
|
+
import Plus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/plus.js';
|
|
9
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
10
|
+
import { Input } from '../input/input.js';
|
|
11
|
+
import { Button } from '../button/button.js';
|
|
12
|
+
|
|
13
|
+
function NumberField(originalProps) {
|
|
14
|
+
const [
|
|
15
|
+
{
|
|
16
|
+
label,
|
|
17
|
+
description,
|
|
18
|
+
errorMessage,
|
|
19
|
+
classNames,
|
|
20
|
+
inputProps,
|
|
21
|
+
startContent,
|
|
22
|
+
endContent,
|
|
23
|
+
hideSteppers,
|
|
24
|
+
...props
|
|
25
|
+
},
|
|
26
|
+
variantProps
|
|
27
|
+
] = mapPropsVariants(originalProps, numberFieldStyles.variantKeys);
|
|
28
|
+
const styles = numberFieldStyles(variantProps);
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
NumberField$1,
|
|
31
|
+
{
|
|
32
|
+
...props,
|
|
33
|
+
"data-hide-steppers": dataAttr(!!hideSteppers),
|
|
34
|
+
"data-has-start-content": dataAttr(!!startContent),
|
|
35
|
+
"data-has-end-content": dataAttr(!!endContent),
|
|
36
|
+
className: composeTailwindRenderProps(
|
|
37
|
+
props.className,
|
|
38
|
+
styles.base({
|
|
39
|
+
className: classNames?.base
|
|
40
|
+
})
|
|
41
|
+
),
|
|
42
|
+
children: [
|
|
43
|
+
label && /* @__PURE__ */ jsx(
|
|
44
|
+
Label,
|
|
45
|
+
{
|
|
46
|
+
className: styles.label({ className: classNames?.label }),
|
|
47
|
+
size: variantProps.size,
|
|
48
|
+
children: label
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsx(FieldGroup, { className: styles.field({ className: classNames?.field }), children: (renderProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
+
startContent,
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
Input,
|
|
55
|
+
{
|
|
56
|
+
size: variantProps.size,
|
|
57
|
+
variant: "unstyled",
|
|
58
|
+
className: styles.input({
|
|
59
|
+
className: classNames?.input
|
|
60
|
+
}),
|
|
61
|
+
...inputProps
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
endContent,
|
|
65
|
+
!hideSteppers && /* @__PURE__ */ jsxs(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
className: fieldBorderStyles({
|
|
69
|
+
...renderProps,
|
|
70
|
+
className: cn(
|
|
71
|
+
styles.stepperContainer({
|
|
72
|
+
className: classNames?.stepperContainer
|
|
73
|
+
})
|
|
74
|
+
)
|
|
75
|
+
}),
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
Button,
|
|
79
|
+
{
|
|
80
|
+
className: styles.decrement({
|
|
81
|
+
className: classNames?.decrement
|
|
82
|
+
}),
|
|
83
|
+
size: variantProps.size,
|
|
84
|
+
isIconOnly: true,
|
|
85
|
+
variant: "clear",
|
|
86
|
+
color: "neutral",
|
|
87
|
+
slot: "decrement",
|
|
88
|
+
children: /* @__PURE__ */ jsx(Minus, { "aria-hidden": true })
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
Button,
|
|
93
|
+
{
|
|
94
|
+
className: styles.increment({
|
|
95
|
+
className: classNames?.increment
|
|
96
|
+
}),
|
|
97
|
+
size: variantProps.size,
|
|
98
|
+
isIconOnly: true,
|
|
99
|
+
variant: "clear",
|
|
100
|
+
color: "neutral",
|
|
101
|
+
slot: "increment",
|
|
102
|
+
children: /* @__PURE__ */ jsx(Plus, { "aria-hidden": true })
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] }) }),
|
|
109
|
+
description && /* @__PURE__ */ jsx(
|
|
110
|
+
Description,
|
|
111
|
+
{
|
|
112
|
+
className: styles.description({
|
|
113
|
+
className: classNames?.description
|
|
114
|
+
}),
|
|
115
|
+
size: variantProps.size,
|
|
116
|
+
children: description
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
FieldError,
|
|
121
|
+
{
|
|
122
|
+
className: styles.error({
|
|
123
|
+
className: classNames?.error
|
|
124
|
+
}),
|
|
125
|
+
size: variantProps.size,
|
|
126
|
+
children: errorMessage
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { NumberField };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { useFocusRing
|
|
4
|
+
import { useFocusRing } from '@react-aria/focus';
|
|
5
|
+
import { usePress, useHover } from '@react-aria/interactions';
|
|
5
6
|
import { useRouter, mergeProps, chain, shouldClientNavigate } from '@react-aria/utils';
|
|
6
|
-
import { useHover as $6179b936705e76d3$export$ae780daf29e6d456 } from '../node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useHover.js';
|
|
7
|
-
import { usePress as $f6c31cce2adf654f$export$45712eceda6fad21 } from '../node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/usePress.js';
|
|
8
7
|
import { cn, dataAttr } from '@opengovsg/oui-theme';
|
|
9
8
|
import { filterDOMProps } from '../system/react-utils/filter-dom-props.js';
|
|
10
9
|
import { useDomRef } from '../system/react-utils/refs.js';
|
|
@@ -32,12 +31,12 @@ function usePaginationItem(props) {
|
|
|
32
31
|
() => isActive ? `${getAriaLabel?.(value)} active` : getAriaLabel?.(value),
|
|
33
32
|
[isActive, getAriaLabel, value]
|
|
34
33
|
);
|
|
35
|
-
const { isPressed, pressProps } =
|
|
34
|
+
const { isPressed, pressProps } = usePress({
|
|
36
35
|
isDisabled,
|
|
37
36
|
onPress
|
|
38
37
|
});
|
|
39
|
-
const { focusProps, isFocused, isFocusVisible } =
|
|
40
|
-
const { isHovered, hoverProps } =
|
|
38
|
+
const { focusProps, isFocused, isFocusVisible } = useFocusRing({});
|
|
39
|
+
const { isHovered, hoverProps } = useHover({ isDisabled });
|
|
41
40
|
const getItemProps = (props2 = {}) => {
|
|
42
41
|
return {
|
|
43
42
|
ref: domRef,
|
|
@@ -4,11 +4,11 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { Provider, Select as Select$1, SelectValue, Virtualizer, ListLayout, ListBox } from 'react-aria-components';
|
|
6
6
|
import { selectStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
|
-
import { Popover } from '../popover/popover.js';
|
|
9
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
10
8
|
import { SelectVariantContext } from './select-variant-context.js';
|
|
9
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
11
10
|
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';
|
|
11
|
+
import { Popover } from '../popover/popover.js';
|
|
12
12
|
import { Button } from '../button/button.js';
|
|
13
13
|
|
|
14
14
|
const calculateEstimatedRowHeight = (size) => {
|
|
@@ -4,15 +4,15 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { createElement } from 'react';
|
|
5
5
|
import { composeRenderProps } from 'react-aria-components';
|
|
6
6
|
import { tagFieldStyles } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
8
|
-
import { Input } from '../input/input.js';
|
|
9
|
-
import { Popover } from '../popover/popover.js';
|
|
10
7
|
import { TagFieldItem } from './tag-field-item.js';
|
|
11
8
|
import { TagFieldList } from './tag-field-list.js';
|
|
12
9
|
import { TagFieldRoot } from './tag-field-root.js';
|
|
13
10
|
import { TagFieldTagList } from './tag-field-tag-list.js';
|
|
14
11
|
import { TagFieldTrigger } from './tag-field-trigger.js';
|
|
15
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';
|
|
13
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
14
|
+
import { Input } from '../input/input.js';
|
|
15
|
+
import { Popover } from '../popover/popover.js';
|
|
16
16
|
|
|
17
17
|
function TagField({
|
|
18
18
|
classNames,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { TextField } from 'react-aria-components';
|
|
5
5
|
import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
6
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
6
|
import { TextArea } from '../text-area/text-area.js';
|
|
7
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
8
|
|
|
9
9
|
function TextAreaField({
|
|
10
10
|
label,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { TextField as TextField$1 } from 'react-aria-components';
|
|
5
5
|
import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
6
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
6
|
import { Input } from '../input/input.js';
|
|
7
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
8
|
|
|
9
9
|
function TextField({
|
|
10
10
|
label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-month-day-selector.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar-month-day-selector.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,wBAAwB,+
|
|
1
|
+
{"version":3,"file":"calendar-month-day-selector.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar-month-day-selector.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,wBAAwB,+CA4EpC,CAAA"}
|
|
@@ -6,6 +6,7 @@ interface DateFieldProps<T extends DateValue> extends AriaDateFieldProps<T>, Var
|
|
|
6
6
|
description?: string;
|
|
7
7
|
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
8
8
|
classNames?: SlotsToClasses<"base" | "label" | "input" | "description" | "error">;
|
|
9
|
+
inputProps?: DateInputProps;
|
|
9
10
|
}
|
|
10
11
|
export declare function DateField<T extends DateValue>(originalProps: DateFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
interface DateInputProps extends Omit<AriaDateInputProps, "children">, VariantProps<typeof dateInputStyles> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-field.d.ts","sourceRoot":"","sources":["../../../src/date-field/date-field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,IAAI,kBAAkB,EACpC,cAAc,IAAI,kBAAkB,EACpC,SAAS,EACT,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAQ9B,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EAC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CAAA;CAC5C;AAED,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,2CA+BtD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DatePickerProps as AriaDatePickerProps, DateValue, ValidationResult } from "react-aria-components";
|
|
2
|
-
import type { CalendarSlots, DatePickerSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
|
|
2
|
+
import type { CalendarSlots, DatePickerSlots, FieldErrorSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
|
|
3
3
|
import { datePickerStyles } from "@opengovsg/oui-theme";
|
|
4
4
|
import type { ButtonProps } from "../button";
|
|
5
5
|
import type { CalendarProps } from "../calendar";
|
|
@@ -8,11 +8,14 @@ interface DatePickerProps<T extends DateValue> extends VariantProps<typeof dateP
|
|
|
8
8
|
label?: string;
|
|
9
9
|
description?: string;
|
|
10
10
|
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
11
|
+
selectorIcon?: React.ReactNode;
|
|
11
12
|
calendarProps?: CalendarProps<T>;
|
|
12
13
|
popoverProps?: PopoverProps;
|
|
13
14
|
calendarButtonProps?: ButtonProps;
|
|
14
|
-
classNames?: SlotsToClasses<DatePickerSlots> & {
|
|
15
|
+
classNames?: SlotsToClasses<DatePickerSlots | "description"> & {
|
|
15
16
|
calendar?: SlotsToClasses<CalendarSlots>;
|
|
17
|
+
error?: SlotsToClasses<FieldErrorSlots>;
|
|
18
|
+
popover?: PopoverProps["classNames"];
|
|
16
19
|
};
|
|
17
20
|
}
|
|
18
21
|
export declare function DatePicker<T extends DateValue>(originalProps: DatePickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/date-picker/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,SAAS,EACT,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAK9B,OA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AAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAQ9C,UAAU,eAAe,CAAC,CAAC,SAAS,SAAS,CAC3C,SAAQ,YAAY,CAAC,OAAO,gBAAgB,CAAC,EAC3C,mBAAmB,CAAC,CAAC,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAClE,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAChC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,mBAAmB,CAAC,EAAE,WAAW,CAAA;IACjC,UAAU,CAAC,EAAE,cAAc,CAAC,eAAe,GAAG,aAAa,CAAC,GAAG;QAC7D,QAAQ,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAA;QACxC,KAAK,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAA;QACvC,OAAO,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;KACrC,CAAA;CACF;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,EAC5C,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC,2CAoFlC"}
|
|
@@ -9,6 +9,9 @@ export declare function Description({ size, className, ...props }: DescriptionPr
|
|
|
9
9
|
export interface FieldErrorProps extends AriaFieldErrorProps, FieldErrorVariantProps {
|
|
10
10
|
classNames?: SlotsToClasses<FieldErrorSlots>;
|
|
11
11
|
}
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function FieldErrorIcon({ size, className, }: Pick<FieldErrorProps, "size"> & {
|
|
13
|
+
className?: string;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function FieldError({ children, className, size, classNames, ...props }: FieldErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
export declare function FieldGroup(props: GroupProps): import("react/jsx-runtime").JSX.Element;
|
|
14
17
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/field/field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,UAAU,IAAI,cAAc,EAC5B,UAAU,EACV,SAAS,EACV,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/field/field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,UAAU,IAAI,cAAc,EAC5B,UAAU,EACV,SAAS,EACV,MAAM,uBAAuB,CAAA;AAU9B,OAAO,KAAK,EACV,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAS7B,MAAM,WAAW,UAAW,SAAQ,cAAc,EAAE,iBAAiB;CAAG;AAExE,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAE9D;AAED,MAAM,WAAW,gBAAiB,SAAQ,SAAS,EAAE,uBAAuB;CAAG;AAE/E,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAQ1E;AAED,MAAM,WAAW,eACf,SAAQ,mBAAmB,EACzB,sBAAsB;IACxB,UAAU,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAA;CAC7C;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,SAAS,GACV,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAIxD;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,UAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe,2CA0BjB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,2CAS3C"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FileDropzoneState, FileDropzoneStyleContextReturn } from "./types";
|
|
2
|
+
export declare const FileDropzoneStateContext: import("react").Context<FileDropzoneState>, useFileDropzoneStateContext: () => FileDropzoneState;
|
|
3
|
+
export declare const FileDropzoneStyleContext: import("react").Context<FileDropzoneStyleContextReturn>, useFileDropzoneStyleContext: () => FileDropzoneStyleContextReturn;
|
|
4
|
+
//# sourceMappingURL=contexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/contexts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAGhF,eAAO,MAAO,wBAAwB,8CAAE,2BAA2B,yBAI/D,CAAA;AACJ,eAAO,MAAO,wBAAwB,2DAAE,2BAA2B,sCAI/D,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { InputBase, Validation } from "@react-types/shared";
|
|
2
|
+
import type { AriaFieldProps } from "react-aria";
|
|
3
|
+
import type { DropzoneOptions } from "react-dropzone";
|
|
4
|
+
import type { FileDropzoneSlots, FileInfoDropzoneSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
|
|
5
|
+
import { fileDropzoneStyles } from "@opengovsg/oui-theme";
|
|
6
|
+
import type { FileItem } from "./types";
|
|
7
|
+
export interface FileItemsRenderProps {
|
|
8
|
+
file: FileItem;
|
|
9
|
+
removeFile: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface FileDropzoneProps extends Omit<AriaFieldProps, "validate">, InputBase, Validation<FileItem[]>, VariantProps<typeof fileDropzoneStyles> {
|
|
12
|
+
name?: string;
|
|
13
|
+
label?: React.ReactNode;
|
|
14
|
+
description?: React.ReactNode;
|
|
15
|
+
errorMessage?: React.ReactNode;
|
|
16
|
+
validator?: DropzoneOptions["validator"];
|
|
17
|
+
classNames?: SlotsToClasses<FileDropzoneSlots>;
|
|
18
|
+
itemClassNames?: SlotsToClasses<FileInfoDropzoneSlots>;
|
|
19
|
+
/** The current files (controlled). */
|
|
20
|
+
value?: FileItem[];
|
|
21
|
+
/** The default files (uncontrolled). */
|
|
22
|
+
defaultValue?: FileItem[];
|
|
23
|
+
/** Sets the controlled value. */
|
|
24
|
+
onChange?: (value: FileItem[]) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Allowed MIME types for each file upload (e.g `image/png`, `text/html`, etc). Wildcards are also supported (e.g `image/*`).
|
|
27
|
+
*
|
|
28
|
+
* Defaults to allowing uploading of all MIME types.
|
|
29
|
+
*/
|
|
30
|
+
allowedMimeTypes?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Maximum upload size of each file allowed in bytes. (e.g 1000 bytes = 1 KB)
|
|
33
|
+
* @default Number.POSITIVE_INFINITY
|
|
34
|
+
*/
|
|
35
|
+
maxFileSize?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Minimum upload size of each file allowed in bytes. (e.g 1000 bytes = 1 KB)
|
|
38
|
+
* @default 0
|
|
39
|
+
*/
|
|
40
|
+
minFileSize?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to show file size information below the dropzone.
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
showFileSizeText?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum number of files allowed per upload.
|
|
48
|
+
* @default 1
|
|
49
|
+
*/
|
|
50
|
+
maxFiles?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to show rejected files in the component.
|
|
53
|
+
*/
|
|
54
|
+
showRejectedFiles?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* List of file rejections (controlled).
|
|
57
|
+
*/
|
|
58
|
+
rejections?: FileItem[];
|
|
59
|
+
/**
|
|
60
|
+
* If provided, callback function will be called when files are rejected.
|
|
61
|
+
*/
|
|
62
|
+
onRejection?: (rejections: FileItem[]) => void;
|
|
63
|
+
/**
|
|
64
|
+
* If provided, this function will be called with any error messages that occur during file validation.
|
|
65
|
+
* If there are multiple errors, only the first message will be passed to this function.
|
|
66
|
+
*/
|
|
67
|
+
onError?: (errorMessage: string) => void;
|
|
68
|
+
children?: (values: FileItemsRenderProps) => React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to hide the dropzone when there is at least one file uploaded.
|
|
71
|
+
* @default true if maxFiles is 1, false otherwise
|
|
72
|
+
*/
|
|
73
|
+
hideDropzoneOnValue?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* If provided, the image preview will be shown in the given size variant.
|
|
76
|
+
* If `null`, no image preview will be shown.
|
|
77
|
+
* @default "small"
|
|
78
|
+
*/
|
|
79
|
+
imagePreview?: "small" | "large" | null;
|
|
80
|
+
}
|
|
81
|
+
export declare const FileDropzone: (originalProps: FileDropzoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
//# sourceMappingURL=file-dropzone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-dropzone.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/file-dropzone.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAA4B,MAAM,gBAAgB,CAAA;AAe/E,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAY,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,KAAK,EAAE,QAA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AAC,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAA;IAC9C;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,KAAK,CAAC,SAAS,CAAA;IAE5D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAE7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAA;CACxC;AAED,eAAO,MAAM,YAAY,kBAAmB,iBAAiB,4CAwQ5D,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FileInfoDropzoneSlots, SlotsToClasses } from "@opengovsg/oui-theme";
|
|
2
|
+
import type { FileItem } from "./types";
|
|
3
|
+
export interface FileInfoProps {
|
|
4
|
+
file: FileItem;
|
|
5
|
+
imagePreview?: "small" | "large" | null;
|
|
6
|
+
classNames?: SlotsToClasses<FileInfoDropzoneSlots>;
|
|
7
|
+
}
|
|
8
|
+
export declare const FileInfo: ({ file, imagePreview, classNames }: FileInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=file-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-info.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/file-info.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAQvC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAA;IACd,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAA;IACvC,UAAU,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAA;CACnD;AAED,eAAO,MAAM,QAAQ,uCAAwC,aAAa,4CA0HzE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FileDropzone } from "./file-dropzone";
|
|
2
|
+
export { FileInfo } from "./file-info";
|
|
3
|
+
export type { FileInfoProps } from "./file-info";
|
|
4
|
+
export type { FileDropzoneProps, FileItemsRenderProps } from "./file-dropzone";
|
|
5
|
+
export type { FileItem } from "./types";
|
|
6
|
+
export { formatBytes, formatErrorMessage } from "./utils";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE9E,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DropzoneState, FileError } from "react-dropzone";
|
|
2
|
+
import type { FileDropzoneSlots, fileDropzoneStyles, FileDropzoneVariantProps, FileInfoDropzoneSlots, SlotsToClasses } from "@opengovsg/oui-theme";
|
|
3
|
+
export interface FileItem extends File {
|
|
4
|
+
errors?: readonly FileError[];
|
|
5
|
+
}
|
|
6
|
+
export interface FileDropzoneState extends Omit<DropzoneState, "getInputProps"> {
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
isReadOnly?: boolean;
|
|
9
|
+
inputProps: ReturnType<DropzoneState["getInputProps"]>;
|
|
10
|
+
triggerFileSelector: () => void | null;
|
|
11
|
+
maxFiles: number;
|
|
12
|
+
maxFileSize: number;
|
|
13
|
+
showDropzone: boolean;
|
|
14
|
+
files: FileItem[];
|
|
15
|
+
handleRemoveFile: (fileName: string) => void;
|
|
16
|
+
handleRemoveRejection: (fileName: string) => void;
|
|
17
|
+
formatError: (error: FileError) => string;
|
|
18
|
+
}
|
|
19
|
+
export interface FileDropzoneStyleContextReturn extends FileDropzoneVariantProps {
|
|
20
|
+
slots: ReturnType<typeof fileDropzoneStyles>;
|
|
21
|
+
classNames?: SlotsToClasses<FileDropzoneSlots>;
|
|
22
|
+
itemClassNames?: SlotsToClasses<FileInfoDropzoneSlots>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE9D,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;CAC9B;AAED,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,UAAU,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAA;IACtD,mBAAmB,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,OAAO,CAAA;IACrB,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,qBAAqB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,MAAM,CAAA;CAC1C;AAED,MAAM,WAAW,8BACf,SAAQ,wBAAwB;IAChC,KAAK,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;IAC5C,UAAU,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAA;CACvD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileRejection } from "react-dropzone";
|
|
2
|
+
export declare const formatBytes: (bytes: number, decimals?: number, size?: "bytes" | "KB" | "MB" | "GB" | "TB" | "PB" | "EB" | "ZB" | "YB") => string;
|
|
3
|
+
export declare const formatErrorMessage: (error: FileRejection["errors"][number], config: {
|
|
4
|
+
maxFileSize: number;
|
|
5
|
+
minFileSize: number;
|
|
6
|
+
maxFiles: number;
|
|
7
|
+
}) => string;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAGnD,eAAO,MAAM,WAAW,UACf,MAAM,4BAEN,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,WAavE,CAAA;AAED,eAAO,MAAM,kBAAkB,UACtB,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAC9B;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,WAgBvE,CAAA"}
|