@opengovsg/oui 0.0.9 → 0.0.11
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/agnostic-calendar-state-context.cjs +13 -0
- package/dist/cjs/calendar/calendar-bottom-content.cjs +51 -0
- package/dist/cjs/calendar/calendar-grid-header.cjs +28 -0
- package/dist/cjs/calendar/calendar-header.cjs +74 -0
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +86 -0
- package/dist/cjs/calendar/calendar-style-context.cjs +0 -25
- package/dist/cjs/calendar/calendar.cjs +143 -4
- package/dist/cjs/calendar/hooks/index.cjs +11 -0
- package/dist/cjs/calendar/hooks/use-calendar-i18n.cjs +33 -0
- package/dist/cjs/calendar/hooks/use-calendar-selectors.cjs +41 -0
- package/dist/cjs/calendar/index.cjs +1 -1
- package/dist/cjs/combo-box/combo-box-fuzzy.cjs +3 -3
- package/dist/cjs/combo-box/combo-box-item.cjs +2 -2
- package/dist/cjs/combo-box/combo-box.cjs +3 -2
- package/dist/cjs/index.cjs +38 -16
- package/dist/cjs/menu/index.cjs +15 -0
- package/dist/cjs/menu/menu.cjs +229 -0
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.cjs +19 -0
- package/dist/cjs/popover/index.cjs +8 -0
- package/dist/cjs/popover/popover.cjs +46 -0
- package/dist/cjs/range-calendar/index.cjs +10 -0
- package/dist/cjs/range-calendar/range-calendar.cjs +188 -0
- package/dist/cjs/select/select.cjs +4 -1
- package/dist/cjs/system/react-utils/context.cjs +3 -2
- package/dist/cjs/tabs/index.cjs +13 -0
- package/dist/cjs/tabs/tabs.cjs +97 -0
- package/dist/cjs/tag-field/tag-field-item.cjs +8 -3
- package/dist/cjs/tag-field/tag-field.cjs +2 -1
- package/dist/esm/button/button.js +1 -1
- package/dist/esm/calendar/agnostic-calendar-state-context.js +10 -0
- package/dist/esm/calendar/calendar-bottom-content.js +49 -0
- package/dist/esm/calendar/calendar-grid-header.js +26 -0
- package/dist/esm/calendar/calendar-header.js +72 -0
- package/dist/esm/calendar/calendar-month-day-selector.js +84 -0
- package/dist/esm/calendar/calendar-style-context.js +1 -25
- package/dist/esm/calendar/calendar.js +147 -9
- package/dist/esm/calendar/hooks/index.js +3 -0
- package/dist/esm/calendar/hooks/use-calendar-i18n.js +30 -0
- package/dist/esm/calendar/hooks/use-calendar-selectors.js +39 -0
- package/dist/esm/calendar/index.js +2 -2
- package/dist/esm/combo-box/combo-box-fuzzy.js +4 -4
- package/dist/esm/combo-box/combo-box-item.js +3 -3
- package/dist/esm/combo-box/combo-box.js +4 -3
- package/dist/esm/index.js +13 -9
- package/dist/esm/menu/index.js +2 -0
- package/dist/esm/menu/menu.js +220 -0
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.js +14 -0
- package/dist/esm/popover/index.js +2 -0
- package/dist/esm/popover/popover.js +44 -0
- package/dist/esm/range-calendar/index.js +2 -0
- package/dist/esm/range-calendar/range-calendar.js +184 -0
- package/dist/esm/select/select.js +5 -2
- package/dist/esm/system/react-utils/context.js +3 -2
- package/dist/esm/tabs/index.js +2 -0
- package/dist/esm/tabs/tabs.js +90 -0
- package/dist/esm/tag-field/tag-field-item.js +9 -4
- package/dist/esm/tag-field/tag-field.js +3 -2
- package/dist/types/calendar/agnostic-calendar-state-context.d.ts +3 -0
- package/dist/types/calendar/agnostic-calendar-state-context.d.ts.map +1 -0
- package/dist/types/calendar/calendar-bottom-content.d.ts +4 -0
- package/dist/types/calendar/calendar-bottom-content.d.ts.map +1 -0
- package/dist/types/calendar/calendar-grid-header.d.ts +2 -0
- package/dist/types/calendar/calendar-grid-header.d.ts.map +1 -0
- package/dist/types/calendar/calendar-header.d.ts +6 -0
- package/dist/types/calendar/calendar-header.d.ts.map +1 -0
- package/dist/types/calendar/calendar-month-day-selector.d.ts +2 -0
- package/dist/types/calendar/calendar-month-day-selector.d.ts.map +1 -0
- package/dist/types/calendar/calendar-style-context.d.ts +10 -1030
- package/dist/types/calendar/calendar-style-context.d.ts.map +1 -1
- package/dist/types/calendar/calendar.d.ts +5 -2
- package/dist/types/calendar/calendar.d.ts.map +1 -1
- package/dist/types/calendar/hooks/index.d.ts +3 -0
- package/dist/types/calendar/hooks/index.d.ts.map +1 -0
- package/dist/types/calendar/hooks/use-calendar-i18n.d.ts +4 -0
- package/dist/types/calendar/hooks/use-calendar-i18n.d.ts.map +1 -0
- package/dist/types/calendar/hooks/use-calendar-selectors.d.ts +13 -0
- package/dist/types/calendar/hooks/use-calendar-selectors.d.ts.map +1 -0
- package/dist/types/calendar/types.d.ts +5 -4
- package/dist/types/calendar/types.d.ts.map +1 -1
- package/dist/types/combo-box/combo-box-fuzzy.d.ts +2 -2
- package/dist/types/combo-box/combo-box-fuzzy.d.ts.map +1 -1
- package/dist/types/combo-box/combo-box-item.d.ts +3 -3
- package/dist/types/combo-box/combo-box-item.d.ts.map +1 -1
- package/dist/types/combo-box/combo-box.d.ts +3 -3
- package/dist/types/combo-box/combo-box.d.ts.map +1 -1
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/menu/index.d.ts +2 -0
- package/dist/types/menu/index.d.ts.map +1 -0
- package/dist/types/menu/menu.d.ts +38 -0
- package/dist/types/menu/menu.d.ts.map +1 -0
- package/dist/types/popover/index.d.ts +2 -0
- package/dist/types/popover/index.d.ts.map +1 -0
- package/dist/types/popover/popover.d.ts +21 -0
- package/dist/types/popover/popover.d.ts.map +1 -0
- package/dist/types/range-calendar/index.d.ts +2 -0
- package/dist/types/range-calendar/index.d.ts.map +1 -0
- package/dist/types/range-calendar/range-calendar.d.ts +69 -0
- package/dist/types/range-calendar/range-calendar.d.ts.map +1 -0
- package/dist/types/select/select.d.ts +7 -6
- package/dist/types/select/select.d.ts.map +1 -1
- package/dist/types/system/react-utils/context.d.ts +3 -2
- package/dist/types/system/react-utils/context.d.ts.map +1 -1
- package/dist/types/tabs/index.d.ts +2 -0
- package/dist/types/tabs/index.d.ts.map +1 -0
- package/dist/types/tabs/tabs.d.ts +16 -0
- package/dist/types/tabs/tabs.d.ts.map +1 -0
- package/dist/types/tag-field/tag-field-item.d.ts +2 -2
- package/dist/types/tag-field/tag-field-item.d.ts.map +1 -1
- package/dist/types/tag-field/tag-field-tag-list.d.ts.map +1 -1
- package/dist/types/tag-field/tag-field.d.ts.map +1 -1
- package/dist/types/tag-field/types.d.ts +3 -3
- package/dist/types/tag-field/types.d.ts.map +1 -1
- package/dist/types/text-area-field/text-area-field.d.ts +3 -3
- package/dist/types/text-area-field/text-area-field.d.ts.map +1 -1
- package/dist/types/text-field/text-field.d.ts +3 -3
- package/dist/types/text-field/text-field.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/cjs/calendar/calendar-base.cjs +0 -347
- package/dist/esm/calendar/calendar-base.js +0 -343
- package/dist/types/calendar/calendar-base.d.ts +0 -14
- package/dist/types/calendar/calendar-base.d.ts.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { useContextProps, TabList as TabList$1, composeRenderProps, Tab as Tab$1, Provider, Tabs as Tabs$1, TabPanel as TabPanel$1 } from 'react-aria-components';
|
|
6
|
+
import { tabListStyles, tabStyles, tabsStyles, tabPanelStyles } from '@opengovsg/oui-theme';
|
|
7
|
+
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
8
|
+
import { createContext } from '../system/react-utils/context.js';
|
|
9
|
+
|
|
10
|
+
const [TabsVariantContext, useTabsVariantContext] = createContext({
|
|
11
|
+
name: "TabsVariantContext",
|
|
12
|
+
strict: true
|
|
13
|
+
});
|
|
14
|
+
function Tabs(originalProps) {
|
|
15
|
+
const [props, variantProps] = mapPropsVariants(
|
|
16
|
+
originalProps,
|
|
17
|
+
tabsStyles.variantKeys
|
|
18
|
+
);
|
|
19
|
+
return /* @__PURE__ */ jsx(Provider, { values: [[TabsVariantContext, variantProps]], children: /* @__PURE__ */ jsx(
|
|
20
|
+
Tabs$1,
|
|
21
|
+
{
|
|
22
|
+
...props,
|
|
23
|
+
className: composeRenderProps(
|
|
24
|
+
props.className,
|
|
25
|
+
(className, renderProps) => tabsStyles({ ...renderProps, ...variantProps, className })
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
) });
|
|
29
|
+
}
|
|
30
|
+
const TabList = forwardRefGeneric(function TabList2(originalProps, ref) {
|
|
31
|
+
[originalProps, ref] = useContextProps(
|
|
32
|
+
originalProps,
|
|
33
|
+
ref,
|
|
34
|
+
TabsVariantContext
|
|
35
|
+
);
|
|
36
|
+
const [props, variantProps] = mapPropsVariants(
|
|
37
|
+
originalProps,
|
|
38
|
+
tabListStyles.variantKeys
|
|
39
|
+
);
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
TabList$1,
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
...props,
|
|
45
|
+
className: composeRenderProps(
|
|
46
|
+
props.className,
|
|
47
|
+
(className, renderProps) => tabListStyles({ ...renderProps, ...variantProps, className })
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
const Tab = forwardRef(function Tab2(originalProps, ref) {
|
|
53
|
+
[originalProps, ref] = useContextProps(
|
|
54
|
+
originalProps,
|
|
55
|
+
ref,
|
|
56
|
+
TabsVariantContext
|
|
57
|
+
);
|
|
58
|
+
const [{ children, startContent, endContent, ...props }, variantProps] = mapPropsVariants(originalProps, tabStyles.variantKeys);
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
Tab$1,
|
|
61
|
+
{
|
|
62
|
+
ref,
|
|
63
|
+
...props,
|
|
64
|
+
isDisabled: originalProps.isDisabled,
|
|
65
|
+
className: composeRenderProps(
|
|
66
|
+
props.className,
|
|
67
|
+
(className, renderProps) => tabStyles({ ...renderProps, ...variantProps, className })
|
|
68
|
+
),
|
|
69
|
+
children: (renderProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
startContent,
|
|
71
|
+
typeof children === "function" ? children(renderProps) : children,
|
|
72
|
+
endContent
|
|
73
|
+
] })
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
function TabPanel(props) {
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
TabPanel$1,
|
|
80
|
+
{
|
|
81
|
+
...props,
|
|
82
|
+
className: composeRenderProps(
|
|
83
|
+
props.className,
|
|
84
|
+
(className, renderProps) => tabPanelStyles({ ...renderProps, className })
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { Tab, TabList, TabPanel, Tabs, TabsVariantContext, useTabsVariantContext };
|
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { listBoxItemStyles, dataAttr } from '@opengovsg/oui-theme';
|
|
6
6
|
import { forwardRefGeneric } from '../system/utils.js';
|
|
7
7
|
import { TagFieldStateContext } from './tag-field-state-context.js';
|
|
8
8
|
|
|
9
9
|
const TagFieldItemInner = ({ item, isHighlighted, classNames, ...itemProps }, ref) => {
|
|
10
10
|
const { itemToText, size } = useContext(TagFieldStateContext);
|
|
11
|
-
const styles =
|
|
11
|
+
const styles = listBoxItemStyles({ size });
|
|
12
12
|
return /* @__PURE__ */ jsx(
|
|
13
13
|
"li",
|
|
14
14
|
{
|
|
15
15
|
ref,
|
|
16
16
|
...itemProps,
|
|
17
|
-
className: styles.container({
|
|
17
|
+
className: styles.container({
|
|
18
|
+
className: classNames?.container,
|
|
19
|
+
isFocused: isHighlighted,
|
|
20
|
+
isDisabled: itemProps["aria-disabled"]
|
|
21
|
+
}),
|
|
18
22
|
"data-rac": true,
|
|
19
|
-
"data-
|
|
23
|
+
"data-focused": dataAttr(isHighlighted),
|
|
24
|
+
"data-disabled": dataAttr(itemProps["aria-disabled"]),
|
|
20
25
|
children: /* @__PURE__ */ jsx("span", { className: styles.label({ className: classNames?.label }), children: itemToText(item) })
|
|
21
26
|
}
|
|
22
27
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { createElement } from 'react';
|
|
5
|
-
import { composeRenderProps
|
|
5
|
+
import { composeRenderProps } from 'react-aria-components';
|
|
6
6
|
import { tagFieldStyles } from '@opengovsg/oui-theme';
|
|
7
7
|
import { TagFieldItem } from './tag-field-item.js';
|
|
8
8
|
import { TagFieldList } from './tag-field-list.js';
|
|
@@ -12,6 +12,7 @@ import { TagFieldTrigger } from './tag-field-trigger.js';
|
|
|
12
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
13
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
14
14
|
import { Input } from '../input/input.js';
|
|
15
|
+
import { Popover } from '../popover/popover.js';
|
|
15
16
|
|
|
16
17
|
function TagField({
|
|
17
18
|
classNames,
|
|
@@ -91,7 +92,7 @@ function TagField({
|
|
|
91
92
|
}
|
|
92
93
|
)
|
|
93
94
|
] }),
|
|
94
|
-
/* @__PURE__ */ jsx(Popover, { children: /* @__PURE__ */ jsx(
|
|
95
|
+
/* @__PURE__ */ jsx(Popover, { className: styles.popover({ className: classNames?.popover }), children: /* @__PURE__ */ jsx(
|
|
95
96
|
TagFieldList,
|
|
96
97
|
{
|
|
97
98
|
className: styles.list({ className: classNames?.list }),
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CalendarState, RangeCalendarState } from "react-stately";
|
|
2
|
+
export declare const AgnosticCalendarStateContext: import("react").Context<CalendarState | RangeCalendarState>, useAgnosticCalendarStateContext: () => CalendarState | RangeCalendarState;
|
|
3
|
+
//# sourceMappingURL=agnostic-calendar-state-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agnostic-calendar-state-context.d.ts","sourceRoot":"","sources":["../../../src/calendar/agnostic-calendar-state-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAItE,eAAO,MAAO,4BAA4B,+DAAE,+BAA+B,0CAIvE,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CalendarDate } from "@internationalized/date";
|
|
2
|
+
import type { CalendarProps } from "./types";
|
|
3
|
+
export declare const CalendarBottomContent: <T extends CalendarDate>({ bottomContent, showTodayButton, }: Pick<CalendarProps<T>, "bottomContent" | "showTodayButton">) => string | number | bigint | true | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
//# sourceMappingURL=calendar-bottom-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-bottom-content.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar-bottom-content.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAI3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM5C,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,YAAY,uCAGzD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAAC,6VAkC7D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-grid-header.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar-grid-header.tsx"],"names":[],"mappings":"AASA,wBAAgB,kBAAkB,4CAiBjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-header.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar-header.tsx"],"names":[],"mappings":"AAYA,UAAU,mBAAmB;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,cAAc,CAAC,EAAE,YAAgB,EAAE,EAAE,mBAAmB,2CA8DvE"}
|
|
@@ -0,0 +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,+CA2EpC,CAAA"}
|