@opengovsg/oui 0.0.54 → 0.0.55
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/AGENTS.md +63 -0
- package/dist/cjs/avatar/avatar.cjs +1 -1
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +1 -1
- package/dist/cjs/calendar/index.cjs +9 -0
- package/dist/cjs/calendar/{hooks/use-calendar-selectors.cjs → use-calendar-selectors.cjs} +1 -1
- package/dist/cjs/combo-box/combo-box-item.cjs +2 -52
- package/dist/cjs/index.cjs +21 -10
- package/dist/cjs/list-box/index.cjs +8 -0
- package/dist/cjs/list-box/list-box.cjs +65 -0
- package/dist/cjs/navbar/index.cjs +6 -6
- package/dist/cjs/navbar/{navbar-menu/item.cjs → navbar-menu-item.cjs} +3 -3
- package/dist/cjs/navbar/{navbar-menu/toggle.cjs → navbar-menu-toggle.cjs} +3 -3
- package/dist/cjs/navbar/{navbar-menu/menu.cjs → navbar-menu.cjs} +4 -4
- package/dist/cjs/navbar/navbar.cjs +3 -3
- package/dist/cjs/pagination/index.cjs +2 -2
- package/dist/cjs/pagination/pagination.cjs +18 -18
- package/dist/cjs/pagination/use-pagination.cjs +5 -5
- package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
- package/dist/esm/avatar/avatar.js +1 -1
- package/dist/esm/calendar/calendar-month-day-selector.js +1 -1
- package/dist/esm/calendar/index.js +4 -0
- package/dist/esm/calendar/{hooks/use-calendar-selectors.js → use-calendar-selectors.js} +1 -1
- package/dist/esm/combo-box/combo-box-item.js +5 -55
- package/dist/esm/index.js +9 -4
- package/dist/esm/list-box/index.js +2 -0
- package/dist/esm/list-box/list-box.js +63 -0
- package/dist/esm/navbar/index.js +3 -3
- package/dist/esm/navbar/{navbar-menu/item.js → navbar-menu-item.js} +3 -3
- package/dist/esm/navbar/{navbar-menu/toggle.js → navbar-menu-toggle.js} +2 -2
- package/dist/esm/navbar/{navbar-menu/menu.js → navbar-menu.js} +4 -4
- package/dist/esm/navbar/navbar.js +1 -1
- package/dist/esm/pagination/index.js +1 -1
- package/dist/esm/pagination/pagination.js +1 -1
- package/dist/esm/pagination/use-pagination.js +1 -1
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/types/avatar/avatar-context.d.ts +1 -1
- package/dist/types/avatar/avatar-context.d.ts.map +1 -1
- package/dist/types/avatar/use-img-loading-status.d.ts.map +1 -0
- package/dist/types/calendar/index.d.ts +4 -0
- package/dist/types/calendar/index.d.ts.map +1 -1
- package/dist/types/calendar/use-calendar-selectors.d.ts.map +1 -0
- package/dist/types/combo-box/combo-box-item.d.ts +3 -10
- package/dist/types/combo-box/combo-box-item.d.ts.map +1 -1
- 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/dist/types/list-box/index.d.ts +3 -0
- package/dist/types/list-box/index.d.ts.map +1 -0
- package/dist/types/list-box/list-box.d.ts +11 -0
- package/dist/types/list-box/list-box.d.ts.map +1 -0
- package/dist/types/navbar/index.d.ts +6 -6
- package/dist/types/navbar/index.d.ts.map +1 -1
- package/dist/types/navbar/{navbar-menu/i18n.d.ts → navbar-menu-i18n.d.ts} +1 -1
- package/dist/types/navbar/navbar-menu-i18n.d.ts.map +1 -0
- package/dist/types/navbar/{navbar-menu/item.d.ts → navbar-menu-item.d.ts} +3 -3
- package/dist/types/navbar/navbar-menu-item.d.ts.map +1 -0
- package/dist/types/navbar/{navbar-menu/toggle.d.ts → navbar-menu-toggle.d.ts} +1 -1
- package/dist/types/navbar/navbar-menu-toggle.d.ts.map +1 -0
- package/dist/types/navbar/{navbar-menu/menu.d.ts → navbar-menu.d.ts} +3 -3
- package/dist/types/navbar/navbar-menu.d.ts.map +1 -0
- package/dist/types/pagination/index.d.ts +2 -2
- package/dist/types/pagination/index.d.ts.map +1 -1
- package/dist/types/pagination/{hooks/use-pagination.d.ts → use-pagination-base.d.ts} +1 -1
- package/dist/types/pagination/use-pagination-base.d.ts.map +1 -0
- package/dist/types/pagination/use-pagination-item.d.ts +1 -1
- package/dist/types/pagination/use-pagination-item.d.ts.map +1 -1
- package/dist/types/pagination/use-pagination.d.ts +1 -1
- package/dist/types/pagination/use-pagination.d.ts.map +1 -1
- package/package.json +7 -6
- package/dist/cjs/calendar/hooks/index.cjs +0 -8
- package/dist/esm/calendar/hooks/index.js +0 -2
- package/dist/types/avatar/hooks/use-img-loading-status.d.ts.map +0 -1
- package/dist/types/calendar/hooks/index.d.ts +0 -2
- package/dist/types/calendar/hooks/index.d.ts.map +0 -1
- package/dist/types/calendar/hooks/use-calendar-selectors.d.ts.map +0 -1
- package/dist/types/navbar/navbar-menu/i18n.d.ts.map +0 -1
- package/dist/types/navbar/navbar-menu/item.d.ts.map +0 -1
- package/dist/types/navbar/navbar-menu/menu.d.ts.map +0 -1
- package/dist/types/navbar/navbar-menu/toggle.d.ts.map +0 -1
- package/dist/types/pagination/hooks/use-pagination.d.ts.map +0 -1
- /package/dist/cjs/avatar/{hooks/use-img-loading-status.cjs → use-img-loading-status.cjs} +0 -0
- /package/dist/cjs/navbar/{navbar-menu/i18n.cjs → navbar-menu-i18n.cjs} +0 -0
- /package/dist/cjs/pagination/{hooks/use-pagination.cjs → use-pagination-base.cjs} +0 -0
- /package/dist/esm/avatar/{hooks/use-img-loading-status.js → use-img-loading-status.js} +0 -0
- /package/dist/esm/navbar/{navbar-menu/i18n.js → navbar-menu-i18n.js} +0 -0
- /package/dist/esm/pagination/{hooks/use-pagination.js → use-pagination-base.js} +0 -0
- /package/dist/types/avatar/{hooks/use-img-loading-status.d.ts → use-img-loading-status.d.ts} +0 -0
- /package/dist/types/calendar/{hooks/use-calendar-selectors.d.ts → use-calendar-selectors.d.ts} +0 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @opengovsg/oui — Agent guide
|
|
2
|
+
|
|
3
|
+
This is the React component package of the OUI design system from Open Government Products Singapore. Components are built on [react-aria-components](https://react-aria.adobe.com/).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# pnpm
|
|
9
|
+
pnpm add @opengovsg/oui @opengovsg/oui-theme tailwindcss react-aria-components motion
|
|
10
|
+
|
|
11
|
+
# yarn
|
|
12
|
+
yarn add @opengovsg/oui @opengovsg/oui-theme tailwindcss react-aria-components motion
|
|
13
|
+
|
|
14
|
+
# npm
|
|
15
|
+
npm install @opengovsg/oui @opengovsg/oui-theme tailwindcss react-aria-components motion
|
|
16
|
+
|
|
17
|
+
# bun
|
|
18
|
+
bun add @opengovsg/oui @opengovsg/oui-theme tailwindcss react-aria-components motion
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then add `@import "@opengovsg/oui-theme/tailwind.css"` to your Tailwind entrypoint. Full setup: https://oui.open.gov.sg/docs/getting-started/installation
|
|
22
|
+
|
|
23
|
+
## Or install as local source via the shadcn CLI
|
|
24
|
+
|
|
25
|
+
Each component is also distributed as a shadcn-CLI-compatible registry entry, so callers who need to customize beyond what props expose can take local ownership:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx shadcn@latest add https://oui.open.gov.sg/r/<name>.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Component files land in `components/oui/`, shared utilities in `lib/oui/`. From that point on, the file is yours — we don't push updates to it. Full guide: https://oui.open.gov.sg/llm/getting-started/registry.md
|
|
32
|
+
|
|
33
|
+
## Import
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Button, Accordion, TextField } from "@opengovsg/oui"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Subpath imports also work (e.g., `import { Button } from "@opengovsg/oui/button"`).
|
|
40
|
+
|
|
41
|
+
## Agent-friendly docs
|
|
42
|
+
|
|
43
|
+
Structured markdown is available at predictable URLs:
|
|
44
|
+
|
|
45
|
+
- **Index**: https://oui.open.gov.sg/llms.txt — list of every component with one-line descriptions
|
|
46
|
+
- **Single-file dump**: https://oui.open.gov.sg/llms-full.txt — all docs concatenated
|
|
47
|
+
- **Per-component**: `https://oui.open.gov.sg/llm/components/<name>.md` — e.g. `/llm/components/button.md`
|
|
48
|
+
- **Setup guides**: `https://oui.open.gov.sg/llm/getting-started/<name>.md` — e.g. `/llm/getting-started/next.md`
|
|
49
|
+
- **Topical guides**: `https://oui.open.gov.sg/llm/guides/<name>.md`
|
|
50
|
+
|
|
51
|
+
Each component doc inlines runnable example source and links to the underlying React Aria primitive — consult those upstream docs for behavioral details (keyboard handling, ARIA semantics, advanced state) not covered by OUI's own docs.
|
|
52
|
+
|
|
53
|
+
## Cross-cutting guides
|
|
54
|
+
|
|
55
|
+
- **Forms**: https://oui.open.gov.sg/llm/guides/forms.md — composition with `<Form>`, validation patterns, React Hook Form + Zod integration, server errors, layout conventions.
|
|
56
|
+
|
|
57
|
+
## Contributing to docs
|
|
58
|
+
|
|
59
|
+
If you're editing component docs, follow the rubric: https://oui.open.gov.sg/llm/contributing/doc-quality-rubric.md
|
|
60
|
+
|
|
61
|
+
## Types
|
|
62
|
+
|
|
63
|
+
Prop types ship as `.d.ts` files in `dist/types/`. TypeScript-aware tooling resolves them automatically.
|
|
@@ -9,7 +9,7 @@ var ouiTheme = require('@opengovsg/oui-theme');
|
|
|
9
9
|
var utils = require('../system/utils.cjs');
|
|
10
10
|
var avatarContext = require('./avatar-context.cjs');
|
|
11
11
|
var avatarGroupContext = require('./avatar-group-context.cjs');
|
|
12
|
-
var useImgLoadingStatus = require('./
|
|
12
|
+
var useImgLoadingStatus = require('./use-img-loading-status.cjs');
|
|
13
13
|
var utils$1 = require('./utils.cjs');
|
|
14
14
|
var refs = require('../system/react-utils/refs.cjs');
|
|
15
15
|
var user = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/user.cjs');
|
|
@@ -11,8 +11,8 @@ var select = require('../select/select.cjs');
|
|
|
11
11
|
var selectItem = require('../select/select-item.cjs');
|
|
12
12
|
var agnosticCalendarStateContext = require('./agnostic-calendar-state-context.cjs');
|
|
13
13
|
var calendarStyleContext = require('./calendar-style-context.cjs');
|
|
14
|
+
var useCalendarSelectors = require('./use-calendar-selectors.cjs');
|
|
14
15
|
var i18n = require('./i18n.cjs');
|
|
15
|
-
var useCalendarSelectors = require('./hooks/use-calendar-selectors.cjs');
|
|
16
16
|
|
|
17
17
|
const CalendarMonthDaySelector = () => {
|
|
18
18
|
const { slots, size, classNames } = calendarStyleContext.useCalendarStyleContext();
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var agnosticCalendarStateContext = require('./agnostic-calendar-state-context.cjs');
|
|
4
5
|
var calendar = require('./calendar.cjs');
|
|
6
|
+
var calendarBottomContent = require('./calendar-bottom-content.cjs');
|
|
7
|
+
var calendarGridHeader = require('./calendar-grid-header.cjs');
|
|
8
|
+
var calendarHeader = require('./calendar-header.cjs');
|
|
5
9
|
var calendarStyleContext = require('./calendar-style-context.cjs');
|
|
6
10
|
var utils = require('./utils.cjs');
|
|
7
11
|
var date = require('@internationalized/date');
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
|
|
15
|
+
exports.AgnosticCalendarStateContext = agnosticCalendarStateContext.AgnosticCalendarStateContext;
|
|
16
|
+
exports.useAgnosticCalendarStateContext = agnosticCalendarStateContext.useAgnosticCalendarStateContext;
|
|
11
17
|
exports.Calendar = calendar.Calendar;
|
|
12
18
|
exports.CalendarStateWrapper = calendar.CalendarStateWrapper;
|
|
19
|
+
exports.CalendarBottomContent = calendarBottomContent.CalendarBottomContent;
|
|
20
|
+
exports.CalendarGridHeader = calendarGridHeader.CalendarGridHeader;
|
|
21
|
+
exports.CalendarHeader = calendarHeader.CalendarHeader;
|
|
13
22
|
exports.CalendarStyleContext = calendarStyleContext.CalendarStyleContext;
|
|
14
23
|
exports.useCalendarStyleContext = calendarStyleContext.useCalendarStyleContext;
|
|
15
24
|
exports.getEraFormat = utils.getEraFormat;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var $670gB$react = require('react');
|
|
7
6
|
var reactAriaComponents = require('react-aria-components');
|
|
8
|
-
var
|
|
7
|
+
var listBox = require('../list-box/list-box.cjs');
|
|
9
8
|
var utils = require('../system/utils.cjs');
|
|
10
9
|
var comboBoxVariantContext = require('./combo-box-variant-context.cjs');
|
|
11
10
|
|
|
@@ -15,56 +14,7 @@ const ComboBoxItem = utils.forwardRef(function ComboBoxItem2(originalProps, ref)
|
|
|
15
14
|
ref,
|
|
16
15
|
comboBoxVariantContext.ComboBoxVariantContext
|
|
17
16
|
);
|
|
18
|
-
|
|
19
|
-
{ className, description, children, classNames, ...props },
|
|
20
|
-
variantProps
|
|
21
|
-
] = utils.mapPropsVariants(originalProps, ouiTheme.listBoxItemStyles.variantKeys);
|
|
22
|
-
const styles = ouiTheme.listBoxItemStyles(variantProps);
|
|
23
|
-
const defaultTextValue = $670gB$react.useMemo(() => {
|
|
24
|
-
if (props.textValue) {
|
|
25
|
-
return props.textValue;
|
|
26
|
-
}
|
|
27
|
-
if (typeof children === "string") {
|
|
28
|
-
return children;
|
|
29
|
-
}
|
|
30
|
-
return void 0;
|
|
31
|
-
}, [children, props.textValue]);
|
|
32
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
-
reactAriaComponents.ListBoxItem,
|
|
34
|
-
{
|
|
35
|
-
textValue: defaultTextValue,
|
|
36
|
-
...props,
|
|
37
|
-
className: reactAriaComponents.composeRenderProps(
|
|
38
|
-
className ?? classNames?.container,
|
|
39
|
-
(className2, renderProps) => styles.container({ ...renderProps, className: className2 })
|
|
40
|
-
),
|
|
41
|
-
children: (renderProps) => {
|
|
42
|
-
if (typeof children === "function") {
|
|
43
|
-
return children(renderProps);
|
|
44
|
-
}
|
|
45
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
46
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
-
reactAriaComponents.Text,
|
|
48
|
-
{
|
|
49
|
-
className: styles.label({ className: classNames?.label }),
|
|
50
|
-
slot: "label",
|
|
51
|
-
children
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
55
|
-
reactAriaComponents.Text,
|
|
56
|
-
{
|
|
57
|
-
className: styles.description({
|
|
58
|
-
className: classNames?.description
|
|
59
|
-
}),
|
|
60
|
-
slot: "description",
|
|
61
|
-
children: description
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
] });
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
);
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(listBox.ListBoxItem, { ref, ...originalProps });
|
|
68
18
|
});
|
|
69
19
|
|
|
70
20
|
exports.ComboBoxItem = ComboBoxItem;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var ripple = require('./ripple/ripple.cjs');
|
|
|
9
9
|
var useRipple = require('./ripple/use-ripple.cjs');
|
|
10
10
|
var spinner = require('./spinner/spinner.cjs');
|
|
11
11
|
var useSpinner = require('./spinner/use-spinner.cjs');
|
|
12
|
-
var toggle
|
|
12
|
+
var toggle = require('./toggle/toggle.cjs');
|
|
13
13
|
var skipNavLink = require('./skip-nav-link/skip-nav-link.cjs');
|
|
14
14
|
var input = require('./input/input.cjs');
|
|
15
15
|
var textField = require('./text-field/text-field.cjs');
|
|
@@ -27,11 +27,16 @@ var select = require('./select/select.cjs');
|
|
|
27
27
|
var selectItem = require('./select/select-item.cjs');
|
|
28
28
|
var selectVariantContext = require('./select/select-variant-context.cjs');
|
|
29
29
|
var badge = require('./badge/badge.cjs');
|
|
30
|
+
var agnosticCalendarStateContext = require('./calendar/agnostic-calendar-state-context.cjs');
|
|
30
31
|
var calendar = require('./calendar/calendar.cjs');
|
|
32
|
+
var calendarBottomContent = require('./calendar/calendar-bottom-content.cjs');
|
|
33
|
+
var calendarGridHeader = require('./calendar/calendar-grid-header.cjs');
|
|
34
|
+
var calendarHeader = require('./calendar/calendar-header.cjs');
|
|
31
35
|
var calendarStyleContext = require('./calendar/calendar-style-context.cjs');
|
|
32
36
|
var utils$1 = require('./calendar/utils.cjs');
|
|
33
37
|
var date = require('@internationalized/date');
|
|
34
38
|
var rangeCalendar = require('./range-calendar/range-calendar.cjs');
|
|
39
|
+
var listBox = require('./list-box/list-box.cjs');
|
|
35
40
|
var menu = require('./menu/menu.cjs');
|
|
36
41
|
var popover = require('./popover/popover.cjs');
|
|
37
42
|
var tabs = require('./tabs/tabs.cjs');
|
|
@@ -43,7 +48,7 @@ var checkboxGroupStyleContext = require('./checkbox/checkbox-group-style-context
|
|
|
43
48
|
var pagination = require('./pagination/pagination.cjs');
|
|
44
49
|
var paginationCursor = require('./pagination/pagination-cursor.cjs');
|
|
45
50
|
var paginationItem = require('./pagination/pagination-item.cjs');
|
|
46
|
-
var
|
|
51
|
+
var usePaginationBase = require('./pagination/use-pagination-base.cjs');
|
|
47
52
|
var usePagination = require('./pagination/use-pagination.cjs');
|
|
48
53
|
var fileDropzone = require('./file-dropzone/file-dropzone.cjs');
|
|
49
54
|
var fileInfo = require('./file-dropzone/file-info.cjs');
|
|
@@ -59,9 +64,9 @@ var toast = require('./toast/toast.cjs');
|
|
|
59
64
|
var navbar = require('./navbar/navbar.cjs');
|
|
60
65
|
var navbarBrand = require('./navbar/navbar-brand.cjs');
|
|
61
66
|
var navbarContent = require('./navbar/navbar-content.cjs');
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
var
|
|
67
|
+
var navbarMenu = require('./navbar/navbar-menu.cjs');
|
|
68
|
+
var navbarMenuItem = require('./navbar/navbar-menu-item.cjs');
|
|
69
|
+
var navbarMenuToggle = require('./navbar/navbar-menu-toggle.cjs');
|
|
65
70
|
var navbarItem = require('./navbar/navbar-item.cjs');
|
|
66
71
|
var useNavbar = require('./navbar/use-navbar.cjs');
|
|
67
72
|
var navbarContext = require('./navbar/navbar-context.cjs');
|
|
@@ -97,7 +102,7 @@ exports.Ripple = ripple.Ripple;
|
|
|
97
102
|
exports.useRipple = useRipple.useRipple;
|
|
98
103
|
exports.Spinner = spinner.Spinner;
|
|
99
104
|
exports.useSpinner = useSpinner.useSpinner;
|
|
100
|
-
exports.Toggle = toggle
|
|
105
|
+
exports.Toggle = toggle.Toggle;
|
|
101
106
|
exports.SkipNavLink = skipNavLink.SkipNavLink;
|
|
102
107
|
exports.Input = input.Input;
|
|
103
108
|
exports.TextField = textField.TextField;
|
|
@@ -122,8 +127,13 @@ exports.SelectItem = selectItem.SelectItem;
|
|
|
122
127
|
exports.SelectVariantContext = selectVariantContext.SelectVariantContext;
|
|
123
128
|
exports.useSelectVariantContext = selectVariantContext.useSelectVariantContext;
|
|
124
129
|
exports.Badge = badge.Badge;
|
|
130
|
+
exports.AgnosticCalendarStateContext = agnosticCalendarStateContext.AgnosticCalendarStateContext;
|
|
131
|
+
exports.useAgnosticCalendarStateContext = agnosticCalendarStateContext.useAgnosticCalendarStateContext;
|
|
125
132
|
exports.Calendar = calendar.Calendar;
|
|
126
133
|
exports.CalendarStateWrapper = calendar.CalendarStateWrapper;
|
|
134
|
+
exports.CalendarBottomContent = calendarBottomContent.CalendarBottomContent;
|
|
135
|
+
exports.CalendarGridHeader = calendarGridHeader.CalendarGridHeader;
|
|
136
|
+
exports.CalendarHeader = calendarHeader.CalendarHeader;
|
|
127
137
|
exports.CalendarStyleContext = calendarStyleContext.CalendarStyleContext;
|
|
128
138
|
exports.useCalendarStyleContext = calendarStyleContext.useCalendarStyleContext;
|
|
129
139
|
exports.getEraFormat = utils$1.getEraFormat;
|
|
@@ -137,6 +147,7 @@ Object.defineProperty(exports, "CalendarDate", {
|
|
|
137
147
|
exports.RangeCalendar = rangeCalendar.RangeCalendar;
|
|
138
148
|
exports.RangeCalendarCell = rangeCalendar.RangeCalendarCell;
|
|
139
149
|
exports.RangeCalendarStateWrapper = rangeCalendar.RangeCalendarStateWrapper;
|
|
150
|
+
exports.ListBoxItem = listBox.ListBoxItem;
|
|
140
151
|
exports.Menu = menu.Menu;
|
|
141
152
|
exports.MenuItem = menu.MenuItem;
|
|
142
153
|
exports.MenuSection = menu.MenuSection;
|
|
@@ -164,7 +175,7 @@ exports.useCheckboxGroupStyleContext = checkboxGroupStyleContext.useCheckboxGrou
|
|
|
164
175
|
exports.Pagination = pagination.Pagination;
|
|
165
176
|
exports.PaginationCursor = paginationCursor.PaginationCursor;
|
|
166
177
|
exports.PaginationItem = paginationItem.PaginationItem;
|
|
167
|
-
exports.PaginationItemType =
|
|
178
|
+
exports.PaginationItemType = usePaginationBase.PaginationItemType;
|
|
168
179
|
exports.CURSOR_TRANSITION_TIMEOUT = usePagination.CURSOR_TRANSITION_TIMEOUT;
|
|
169
180
|
exports.usePagination = usePagination.usePagination;
|
|
170
181
|
exports.FileDropzone = fileDropzone.FileDropzone;
|
|
@@ -183,9 +194,9 @@ exports.Toaster = toast.Toaster;
|
|
|
183
194
|
exports.Navbar = navbar.Navbar;
|
|
184
195
|
exports.NavbarBrand = navbarBrand.NavbarBrand;
|
|
185
196
|
exports.NavbarContent = navbarContent.NavbarContent;
|
|
186
|
-
exports.NavbarMenu =
|
|
187
|
-
exports.NavbarMenuItem =
|
|
188
|
-
exports.NavbarMenuToggle =
|
|
197
|
+
exports.NavbarMenu = navbarMenu.NavbarMenu;
|
|
198
|
+
exports.NavbarMenuItem = navbarMenuItem.NavbarMenuItem;
|
|
199
|
+
exports.NavbarMenuToggle = navbarMenuToggle.NavbarMenuToggle;
|
|
189
200
|
exports.NavbarItem = navbarItem.NavbarItem;
|
|
190
201
|
exports.useNavbar = useNavbar.useNavbar;
|
|
191
202
|
exports.NavbarProvider = navbarContext.NavbarProvider;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 reactAriaComponents = require('react-aria-components');
|
|
8
|
+
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
+
var utils = require('../system/utils.cjs');
|
|
10
|
+
|
|
11
|
+
const ListBoxItem = utils.forwardRef(function ListBoxItem2(originalProps, ref) {
|
|
12
|
+
const [
|
|
13
|
+
{ className, description, children, classNames, ...props },
|
|
14
|
+
variantProps
|
|
15
|
+
] = utils.mapPropsVariants(originalProps, ouiTheme.listBoxItemStyles.variantKeys);
|
|
16
|
+
const styles = ouiTheme.listBoxItemStyles(variantProps);
|
|
17
|
+
const defaultTextValue = $670gB$react.useMemo(() => {
|
|
18
|
+
if (props.textValue) {
|
|
19
|
+
return props.textValue;
|
|
20
|
+
}
|
|
21
|
+
if (typeof children === "string") {
|
|
22
|
+
return children;
|
|
23
|
+
}
|
|
24
|
+
return void 0;
|
|
25
|
+
}, [children, props.textValue]);
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
|
+
reactAriaComponents.ListBoxItem,
|
|
28
|
+
{
|
|
29
|
+
ref,
|
|
30
|
+
textValue: defaultTextValue,
|
|
31
|
+
...props,
|
|
32
|
+
className: reactAriaComponents.composeRenderProps(
|
|
33
|
+
className ?? classNames?.container,
|
|
34
|
+
(className2, renderProps) => styles.container({ ...renderProps, className: className2 })
|
|
35
|
+
),
|
|
36
|
+
children: (renderProps) => {
|
|
37
|
+
if (typeof children === "function") {
|
|
38
|
+
return children(renderProps);
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
reactAriaComponents.Text,
|
|
43
|
+
{
|
|
44
|
+
className: styles.label({ className: classNames?.label }),
|
|
45
|
+
slot: "label",
|
|
46
|
+
children
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
50
|
+
reactAriaComponents.Text,
|
|
51
|
+
{
|
|
52
|
+
className: styles.description({
|
|
53
|
+
className: classNames?.description
|
|
54
|
+
}),
|
|
55
|
+
slot: "description",
|
|
56
|
+
children: description
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
exports.ListBoxItem = ListBoxItem;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
var navbar = require('./navbar.cjs');
|
|
5
5
|
var navbarBrand = require('./navbar-brand.cjs');
|
|
6
6
|
var navbarContent = require('./navbar-content.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
7
|
+
var navbarMenu = require('./navbar-menu.cjs');
|
|
8
|
+
var navbarMenuItem = require('./navbar-menu-item.cjs');
|
|
9
|
+
var navbarMenuToggle = require('./navbar-menu-toggle.cjs');
|
|
10
10
|
var navbarItem = require('./navbar-item.cjs');
|
|
11
11
|
var useNavbar = require('./use-navbar.cjs');
|
|
12
12
|
var navbarContext = require('./navbar-context.cjs');
|
|
@@ -16,9 +16,9 @@ var navbarContext = require('./navbar-context.cjs');
|
|
|
16
16
|
exports.Navbar = navbar.Navbar;
|
|
17
17
|
exports.NavbarBrand = navbarBrand.NavbarBrand;
|
|
18
18
|
exports.NavbarContent = navbarContent.NavbarContent;
|
|
19
|
-
exports.NavbarMenu =
|
|
20
|
-
exports.NavbarMenuItem =
|
|
21
|
-
exports.NavbarMenuToggle =
|
|
19
|
+
exports.NavbarMenu = navbarMenu.NavbarMenu;
|
|
20
|
+
exports.NavbarMenuItem = navbarMenuItem.NavbarMenuItem;
|
|
21
|
+
exports.NavbarMenuToggle = navbarMenuToggle.NavbarMenuToggle;
|
|
22
22
|
exports.NavbarItem = navbarItem.NavbarItem;
|
|
23
23
|
exports.useNavbar = useNavbar.useNavbar;
|
|
24
24
|
exports.NavbarProvider = navbarContext.NavbarProvider;
|
|
@@ -5,9 +5,9 @@
|
|
|
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 utils = require('
|
|
9
|
-
var navbarContext = require('
|
|
10
|
-
var refs = require('
|
|
8
|
+
var utils = require('../system/utils.cjs');
|
|
9
|
+
var navbarContext = require('./navbar-context.cjs');
|
|
10
|
+
var refs = require('../system/react-utils/refs.cjs');
|
|
11
11
|
|
|
12
12
|
const NavbarMenuItem = utils.forwardRef(
|
|
13
13
|
(props, ref) => {
|
|
@@ -7,8 +7,8 @@ var $670gB$react = require('react');
|
|
|
7
7
|
var reactAria = require('react-aria');
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
10
|
-
var navbarContext = require('
|
|
11
|
-
var
|
|
10
|
+
var navbarContext = require('./navbar-context.cjs');
|
|
11
|
+
var navbarMenuI18n = require('./navbar-menu-i18n.cjs');
|
|
12
12
|
|
|
13
13
|
const NavbarMenuToggle = ({
|
|
14
14
|
icon,
|
|
@@ -35,7 +35,7 @@ const NavbarMenuToggle = ({
|
|
|
35
35
|
}
|
|
36
36
|
window.scrollTo({ top: menuTopOffset, behavior: "instant" });
|
|
37
37
|
};
|
|
38
|
-
const stringFormatter = reactAria.useLocalizedStringFormatter(
|
|
38
|
+
const stringFormatter = reactAria.useLocalizedStringFormatter(navbarMenuI18n.i18nStrings);
|
|
39
39
|
const toggleStyles = $670gB$react.useMemo(() => {
|
|
40
40
|
return ouiTheme.buttonStyles({
|
|
41
41
|
variant: "unstyled",
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var Overlay = require('
|
|
6
|
+
var Overlay = require('../node_modules/.pnpm/@react-aria_overlays@3.31.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/Overlay.cjs');
|
|
7
7
|
var reactAria = require('react-aria');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
-
var utils = require('
|
|
10
|
-
var navbarContext = require('
|
|
11
|
-
var refs = require('
|
|
9
|
+
var utils = require('../system/utils.cjs');
|
|
10
|
+
var navbarContext = require('./navbar-context.cjs');
|
|
11
|
+
var refs = require('../system/react-utils/refs.cjs');
|
|
12
12
|
|
|
13
13
|
const NavbarMenu = utils.forwardRef(
|
|
14
14
|
({ className, children, portalContainer, style, onKeyDown, ...props }, ref) => {
|
|
@@ -8,7 +8,7 @@ var reactAria = require('react-aria');
|
|
|
8
8
|
var children = require('../system/react-utils/children.cjs');
|
|
9
9
|
var utils = require('../system/utils.cjs');
|
|
10
10
|
var navbarContext = require('./navbar-context.cjs');
|
|
11
|
-
var
|
|
11
|
+
var navbarMenu = require('./navbar-menu.cjs');
|
|
12
12
|
var useNavbar = require('./use-navbar.cjs');
|
|
13
13
|
|
|
14
14
|
const showOnScrollUpVariants = {
|
|
@@ -29,10 +29,10 @@ const Navbar = utils.forwardRef((props, ref) => {
|
|
|
29
29
|
const { children: children$1, ...otherProps } = props;
|
|
30
30
|
const context = useNavbar.useNavbar({ ...otherProps, ref });
|
|
31
31
|
const Component = context.Component;
|
|
32
|
-
const [childrenWithoutMenu, menu
|
|
32
|
+
const [childrenWithoutMenu, menu] = children.pickChildren(children$1, navbarMenu.NavbarMenu);
|
|
33
33
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
34
34
|
/* @__PURE__ */ jsxRuntime.jsx("header", { ...context.getWrapperProps(), children: childrenWithoutMenu }),
|
|
35
|
-
menu
|
|
35
|
+
menu
|
|
36
36
|
] });
|
|
37
37
|
return /* @__PURE__ */ jsxRuntime.jsx(navbarContext.NavbarProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(reactAria.FocusScope, { contain: context.isMenuOpen, children: context.shouldShowOnScrollUp ? /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domAnimation, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
38
|
react.m.nav,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var pagination = require('./pagination.cjs');
|
|
5
5
|
var paginationCursor = require('./pagination-cursor.cjs');
|
|
6
6
|
var paginationItem = require('./pagination-item.cjs');
|
|
7
|
-
var
|
|
7
|
+
var usePaginationBase = require('./use-pagination-base.cjs');
|
|
8
8
|
var usePagination = require('./use-pagination.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -12,6 +12,6 @@ var usePagination = require('./use-pagination.cjs');
|
|
|
12
12
|
exports.Pagination = pagination.Pagination;
|
|
13
13
|
exports.PaginationCursor = paginationCursor.PaginationCursor;
|
|
14
14
|
exports.PaginationItem = paginationItem.PaginationItem;
|
|
15
|
-
exports.PaginationItemType =
|
|
15
|
+
exports.PaginationItemType = usePaginationBase.PaginationItemType;
|
|
16
16
|
exports.CURSOR_TRANSITION_TIMEOUT = usePagination.CURSOR_TRANSITION_TIMEOUT;
|
|
17
17
|
exports.usePagination = usePagination.usePagination;
|
|
@@ -7,7 +7,7 @@ var $670gB$react = require('react');
|
|
|
7
7
|
var i18n = require('@react-aria/i18n');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
9
|
var utils = require('../system/utils.cjs');
|
|
10
|
-
var
|
|
10
|
+
var usePaginationBase = require('./use-pagination-base.cjs');
|
|
11
11
|
var paginationCursor = require('./pagination-cursor.cjs');
|
|
12
12
|
var paginationItem = require('./pagination-item.cjs');
|
|
13
13
|
var usePagination = require('./use-pagination.cjs');
|
|
@@ -42,7 +42,7 @@ const Pagination = utils.forwardRef((props, ref) => {
|
|
|
42
42
|
const isRTL = direction === "rtl";
|
|
43
43
|
const renderChevronIcon = $670gB$react.useCallback(
|
|
44
44
|
(key) => {
|
|
45
|
-
if (key ===
|
|
45
|
+
if (key === usePaginationBase.PaginationItemType.PREV && !isRTL || key === usePaginationBase.PaginationItemType.NEXT && isRTL) {
|
|
46
46
|
return /* @__PURE__ */ jsxRuntime.jsx(chevronLeft.default, {});
|
|
47
47
|
}
|
|
48
48
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -66,11 +66,11 @@ const Pagination = utils.forwardRef((props, ref) => {
|
|
|
66
66
|
"data-slot": "prev",
|
|
67
67
|
getAriaLabel: getItemAriaLabel,
|
|
68
68
|
isDisabled: props.isDisabled || !loop && activePage === 1,
|
|
69
|
-
value:
|
|
69
|
+
value: usePaginationBase.PaginationItemType.PREV,
|
|
70
70
|
onPress: onPrevious,
|
|
71
|
-
children: renderChevronIcon(
|
|
71
|
+
children: renderChevronIcon(usePaginationBase.PaginationItemType.PREV)
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
usePaginationBase.PaginationItemType.PREV
|
|
74
74
|
);
|
|
75
75
|
}, [
|
|
76
76
|
slots,
|
|
@@ -92,11 +92,11 @@ const Pagination = utils.forwardRef((props, ref) => {
|
|
|
92
92
|
"data-slot": "next",
|
|
93
93
|
getAriaLabel: getItemAriaLabel,
|
|
94
94
|
isDisabled: props.isDisabled || !loop && activePage === total,
|
|
95
|
-
value:
|
|
95
|
+
value: usePaginationBase.PaginationItemType.NEXT,
|
|
96
96
|
onPress: onNext,
|
|
97
|
-
children: renderChevronIcon(
|
|
97
|
+
children: renderChevronIcon(usePaginationBase.PaginationItemType.NEXT)
|
|
98
98
|
},
|
|
99
|
-
|
|
99
|
+
usePaginationBase.PaginationItemType.NEXT
|
|
100
100
|
);
|
|
101
101
|
}, [
|
|
102
102
|
slots,
|
|
@@ -114,19 +114,19 @@ const Pagination = utils.forwardRef((props, ref) => {
|
|
|
114
114
|
const isBefore = index < range.indexOf(activePage);
|
|
115
115
|
if (renderItemProp && typeof renderItemProp === "function") {
|
|
116
116
|
let page = typeof value == "number" ? value : index;
|
|
117
|
-
if (value ===
|
|
117
|
+
if (value === usePaginationBase.PaginationItemType.NEXT) {
|
|
118
118
|
page = activePage + 1;
|
|
119
119
|
}
|
|
120
|
-
if (value ===
|
|
120
|
+
if (value === usePaginationBase.PaginationItemType.PREV) {
|
|
121
121
|
page = activePage - 1;
|
|
122
122
|
}
|
|
123
|
-
if (value ===
|
|
123
|
+
if (value === usePaginationBase.PaginationItemType.DOTS) {
|
|
124
124
|
page = isBefore ? activePage - dotsJump >= 1 ? activePage - dotsJump : 1 : activePage + dotsJump <= total ? activePage + dotsJump : total;
|
|
125
125
|
}
|
|
126
126
|
const itemChildren = {
|
|
127
|
-
[
|
|
128
|
-
[
|
|
129
|
-
[
|
|
127
|
+
[usePaginationBase.PaginationItemType.PREV]: renderChevronIcon(usePaginationBase.PaginationItemType.PREV),
|
|
128
|
+
[usePaginationBase.PaginationItemType.NEXT]: renderChevronIcon(usePaginationBase.PaginationItemType.NEXT),
|
|
129
|
+
[usePaginationBase.PaginationItemType.DOTS]: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
130
130
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
131
131
|
ellipsis.default,
|
|
132
132
|
{
|
|
@@ -168,13 +168,13 @@ const Pagination = utils.forwardRef((props, ref) => {
|
|
|
168
168
|
getAriaLabel: getItemAriaLabel
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
-
if (value ===
|
|
171
|
+
if (value === usePaginationBase.PaginationItemType.PREV) {
|
|
172
172
|
return renderPrevItem();
|
|
173
173
|
}
|
|
174
|
-
if (value ===
|
|
174
|
+
if (value === usePaginationBase.PaginationItemType.NEXT) {
|
|
175
175
|
return renderNextItem();
|
|
176
176
|
}
|
|
177
|
-
if (value ===
|
|
177
|
+
if (value === usePaginationBase.PaginationItemType.DOTS) {
|
|
178
178
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
179
179
|
paginationItem.PaginationItem,
|
|
180
180
|
{
|
|
@@ -206,7 +206,7 @@ const Pagination = utils.forwardRef((props, ref) => {
|
|
|
206
206
|
)
|
|
207
207
|
]
|
|
208
208
|
},
|
|
209
|
-
|
|
209
|
+
usePaginationBase.PaginationItemType.DOTS + isBefore
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
return /* @__PURE__ */ $670gB$react.createElement(
|
|
@@ -8,7 +8,7 @@ var useDeepCompare = require('use-deep-compare');
|
|
|
8
8
|
var usehooksTs = require('usehooks-ts');
|
|
9
9
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
10
10
|
var utils = require('../system/utils.cjs');
|
|
11
|
-
var
|
|
11
|
+
var usePaginationBase = require('./use-pagination-base.cjs');
|
|
12
12
|
var refs = require('../system/react-utils/refs.cjs');
|
|
13
13
|
|
|
14
14
|
const CURSOR_TRANSITION_TIMEOUT = 300;
|
|
@@ -93,7 +93,7 @@ function usePagination(originalProps) {
|
|
|
93
93
|
},
|
|
94
94
|
[domRef]
|
|
95
95
|
);
|
|
96
|
-
const { range, activePage, setPage, previous, next, first, last } =
|
|
96
|
+
const { range, activePage, setPage, previous, next, first, last } = usePaginationBase.usePagination({
|
|
97
97
|
page,
|
|
98
98
|
total,
|
|
99
99
|
initialPage,
|
|
@@ -179,11 +179,11 @@ function usePagination(originalProps) {
|
|
|
179
179
|
return getItemAriaLabelProp(page2);
|
|
180
180
|
}
|
|
181
181
|
switch (page2) {
|
|
182
|
-
case
|
|
182
|
+
case usePaginationBase.PaginationItemType.DOTS:
|
|
183
183
|
return "dots element";
|
|
184
|
-
case
|
|
184
|
+
case usePaginationBase.PaginationItemType.PREV:
|
|
185
185
|
return "previous page button";
|
|
186
|
-
case
|
|
186
|
+
case usePaginationBase.PaginationItemType.NEXT:
|
|
187
187
|
return "next page button";
|
|
188
188
|
case "first":
|
|
189
189
|
return "first page button";
|
|
@@ -8,11 +8,11 @@ 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');
|
|
15
|
+
var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
|
|
16
16
|
var utils = require('../system/utils.cjs');
|
|
17
17
|
|
|
18
18
|
const RangeCalendar = utils.forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
|
|
@@ -7,7 +7,7 @@ import { avatarStyles, dataAttr } from '@opengovsg/oui-theme';
|
|
|
7
7
|
import { forwardRef, mapPropsVariants } from '../system/utils.js';
|
|
8
8
|
import { AvatarContext, useAvatarContext } from './avatar-context.js';
|
|
9
9
|
import { useAvatarGroupContext } from './avatar-group-context.js';
|
|
10
|
-
import { useImageLoadingStatus } from './
|
|
10
|
+
import { useImageLoadingStatus } from './use-img-loading-status.js';
|
|
11
11
|
import { getInitialsFromText } from './utils.js';
|
|
12
12
|
import { useDomRef } from '../system/react-utils/refs.js';
|
|
13
13
|
import User from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/user.js';
|