@opengovsg/oui 0.0.12 → 0.0.14
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 +4 -4
- package/dist/cjs/button/button.cjs +3 -3
- package/dist/cjs/calendar/calendar-bottom-content.cjs +2 -2
- package/dist/cjs/calendar/calendar-header.cjs +2 -2
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +2 -2
- 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-group-style-context.cjs +16 -0
- package/dist/cjs/checkbox/checkbox.cjs +94 -0
- package/dist/cjs/checkbox/index.cjs +12 -0
- 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 +3 -3
- package/dist/cjs/date-field/date-field.cjs +3 -3
- package/dist/cjs/date-picker/date-picker.cjs +6 -5
- package/dist/cjs/date-range-picker/date-range-picker.cjs +5 -5
- package/dist/cjs/govt-banner/govt-banner.cjs +27 -62
- 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 +52 -35
- package/dist/cjs/input/input.cjs +2 -2
- package/dist/cjs/menu/menu.cjs +6 -6
- 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 +45 -0
- 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 +21 -0
- 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 +72 -0
- 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 +60 -0
- 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 +210 -0
- 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 +100 -0
- 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 +152 -0
- 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 +676 -0
- 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 +160 -0
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_check_private_redeclaration.cjs +9 -0
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.cjs +9 -0
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.cjs +16 -0
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.cjs +9 -0
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_get.cjs +11 -0
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_init.cjs +10 -0
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_set.cjs +12 -0
- 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/chevrons-right.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/ellipsis.cjs +23 -0
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/minus.cjs +19 -0
- package/dist/cjs/pagination/hooks/use-pagination.cjs +117 -0
- package/dist/cjs/pagination/index.cjs +17 -0
- package/dist/cjs/pagination/pagination-cursor.cjs +18 -0
- package/dist/cjs/pagination/pagination-item.cjs +18 -0
- package/dist/cjs/pagination/pagination.cjs +263 -0
- package/dist/cjs/pagination/use-pagination-item.cjs +87 -0
- package/dist/cjs/pagination/use-pagination.cjs +251 -0
- package/dist/cjs/range-calendar/range-calendar.cjs +7 -7
- package/dist/cjs/ripple/use-ripple.cjs +4 -4
- package/dist/cjs/select/select.cjs +3 -3
- 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/dom-props.cjs +186 -0
- package/dist/cjs/system/react-utils/filter-dom-props.cjs +46 -0
- package/dist/cjs/system/react-utils/index.cjs +2 -0
- 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 +2 -2
- 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/toggle/toggle.cjs +3 -3
- package/dist/esm/banner/banner.js +1 -1
- package/dist/esm/checkbox/checkbox-group-style-context.js +13 -0
- package/dist/esm/checkbox/checkbox.js +91 -0
- package/dist/esm/checkbox/index.js +3 -0
- package/dist/esm/date-picker/date-picker.js +4 -3
- package/dist/esm/date-range-picker/date-range-picker.js +2 -2
- package/dist/esm/govt-banner/govt-banner.js +25 -60
- package/dist/esm/index.js +19 -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 +43 -0
- 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 +19 -0
- 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 +69 -0
- 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 +58 -0
- 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 +205 -0
- 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 +98 -0
- 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 +150 -0
- 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 +674 -0
- 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 +155 -0
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_check_private_redeclaration.js +7 -0
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.js +7 -0
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.js +14 -0
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.js +7 -0
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_get.js +9 -0
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_init.js +8 -0
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_set.js +10 -0
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevrons-right.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/ellipsis.js +18 -0
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/minus.js +14 -0
- package/dist/esm/pagination/hooks/use-pagination.js +114 -0
- package/dist/esm/pagination/index.js +6 -0
- package/dist/esm/pagination/pagination-cursor.js +16 -0
- package/dist/esm/pagination/pagination-item.js +16 -0
- package/dist/esm/pagination/pagination.js +261 -0
- package/dist/esm/pagination/use-pagination-item.js +85 -0
- package/dist/esm/pagination/use-pagination.js +248 -0
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/esm/select/select.js +1 -1
- package/dist/esm/system/react-utils/dom-props.js +183 -0
- package/dist/esm/system/react-utils/filter-dom-props.js +44 -0
- package/dist/esm/system/react-utils/index.js +1 -0
- package/dist/types/badge/badge.d.ts +3 -1
- package/dist/types/badge/badge.d.ts.map +1 -1
- package/dist/types/badge/use-badge.d.ts +7 -48
- package/dist/types/badge/use-badge.d.ts.map +1 -1
- package/dist/types/checkbox/checkbox-group-style-context.d.ts +6 -0
- package/dist/types/checkbox/checkbox-group-style-context.d.ts.map +1 -0
- package/dist/types/checkbox/checkbox.d.ts +19 -0
- package/dist/types/checkbox/checkbox.d.ts.map +1 -0
- package/dist/types/checkbox/index.d.ts +3 -0
- package/dist/types/checkbox/index.d.ts.map +1 -0
- package/dist/types/govt-banner/govt-banner.d.ts.map +1 -1
- 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/pagination/hooks/use-pagination.d.ts +51 -0
- package/dist/types/pagination/hooks/use-pagination.d.ts.map +1 -0
- package/dist/types/pagination/index.d.ts +7 -0
- package/dist/types/pagination/index.d.ts.map +1 -0
- package/dist/types/pagination/pagination-cursor.d.ts +9 -0
- package/dist/types/pagination/pagination-cursor.d.ts.map +1 -0
- package/dist/types/pagination/pagination-item.d.ts +5 -0
- package/dist/types/pagination/pagination-item.d.ts.map +1 -0
- package/dist/types/pagination/pagination.d.ts +5 -0
- package/dist/types/pagination/pagination.d.ts.map +1 -0
- package/dist/types/pagination/use-pagination-item.d.ts +51 -0
- package/dist/types/pagination/use-pagination-item.d.ts.map +1 -0
- package/dist/types/pagination/use-pagination.d.ts +353 -0
- package/dist/types/pagination/use-pagination.d.ts.map +1 -0
- package/dist/types/spinner/use-spinner.d.ts +8 -8
- package/dist/types/system/react-utils/context.d.ts.map +1 -1
- package/dist/types/system/react-utils/dom-props.d.ts +3 -0
- package/dist/types/system/react-utils/dom-props.d.ts.map +1 -0
- package/dist/types/system/react-utils/filter-dom-props.d.ts +39 -0
- package/dist/types/system/react-utils/filter-dom-props.d.ts.map +1 -0
- package/dist/types/system/react-utils/index.d.ts +1 -0
- package/dist/types/system/react-utils/index.d.ts.map +1 -1
- package/package.json +8 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var react = require('react');
|
|
6
|
+
var $670gB$react = require('react');
|
|
7
7
|
var reactAria = require('react-aria');
|
|
8
8
|
var reactStately = require('react-stately');
|
|
9
9
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
@@ -12,57 +12,14 @@ var landmark = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/
|
|
|
12
12
|
var externalLink = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/external-link.cjs');
|
|
13
13
|
var lock = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/lock.cjs');
|
|
14
14
|
|
|
15
|
-
const i18nStrings = {
|
|
16
|
-
"en-SG": {
|
|
17
|
-
mainLabel: "A Singapore Government Agency Website",
|
|
18
|
-
identifyLabel: "How to identify",
|
|
19
|
-
environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
|
|
20
|
-
officialLinkHeader: "Official website links end with .gov.sg",
|
|
21
|
-
officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
|
|
22
|
-
officialLinkTrusted: "Trusted websites",
|
|
23
|
-
secureHeader: "Secure websites use HTTPS",
|
|
24
|
-
secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
|
|
25
|
-
},
|
|
26
|
-
"zh-SG": {
|
|
27
|
-
mainLabel: "A Singapore Government Agency Website",
|
|
28
|
-
identifyLabel: "How to identify",
|
|
29
|
-
environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
|
|
30
|
-
officialLinkHeader: "Official website links end with .gov.sg",
|
|
31
|
-
officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
|
|
32
|
-
officialLinkTrusted: "Trusted websites",
|
|
33
|
-
secureHeader: "Secure websites use HTTPS",
|
|
34
|
-
secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
|
|
35
|
-
},
|
|
36
|
-
"ms-SG": {
|
|
37
|
-
mainLabel: "A Singapore Government Agency Website",
|
|
38
|
-
identifyLabel: "How to identify",
|
|
39
|
-
environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
|
|
40
|
-
officialLinkHeader: "Official website links end with .gov.sg",
|
|
41
|
-
officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
|
|
42
|
-
officialLinkTrusted: "Trusted websites",
|
|
43
|
-
secureHeader: "Secure websites use HTTPS",
|
|
44
|
-
secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
|
|
45
|
-
},
|
|
46
|
-
"ta-SG": {
|
|
47
|
-
mainLabel: "A Singapore Government Agency Website",
|
|
48
|
-
identifyLabel: "How to identify",
|
|
49
|
-
environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
|
|
50
|
-
officialLinkHeader: "Official website links end with .gov.sg",
|
|
51
|
-
officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
|
|
52
|
-
officialLinkTrusted: "Trusted websites",
|
|
53
|
-
secureHeader: "Secure websites use HTTPS",
|
|
54
|
-
secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
15
|
function GovtBanner({
|
|
58
16
|
environment,
|
|
59
17
|
classNames,
|
|
60
18
|
...props
|
|
61
19
|
}) {
|
|
62
|
-
const formatMessage = reactAria.useMessageFormatter(i18nStrings);
|
|
63
20
|
const state = reactStately.useDisclosureState(props);
|
|
64
|
-
const panelRef = react.useRef(null);
|
|
65
|
-
const triggerRef = react.useRef(null);
|
|
21
|
+
const panelRef = $670gB$react.useRef(null);
|
|
22
|
+
const triggerRef = $670gB$react.useRef(null);
|
|
66
23
|
const { buttonProps: triggerProps, panelProps } = reactAria.useDisclosure(
|
|
67
24
|
props,
|
|
68
25
|
state,
|
|
@@ -106,10 +63,12 @@ function GovtBanner({
|
|
|
106
63
|
{
|
|
107
64
|
className: slots.mainContent({ className: classNames?.mainContent }),
|
|
108
65
|
children: [
|
|
109
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
110
|
-
environment ? /* @__PURE__ */ jsxRuntime.
|
|
111
|
-
|
|
112
|
-
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "A Singapore Government Agency Website" }),
|
|
67
|
+
environment ? /* @__PURE__ */ jsxRuntime.jsxs("b", { children: [
|
|
68
|
+
"[NOTE: THIS IS A ",
|
|
69
|
+
environment.toUpperCase(),
|
|
70
|
+
" WEBSITE]"
|
|
71
|
+
] }) : null,
|
|
113
72
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
114
73
|
"button",
|
|
115
74
|
{
|
|
@@ -121,7 +80,7 @@ function GovtBanner({
|
|
|
121
80
|
type: "button",
|
|
122
81
|
...reactAria.mergeProps(buttonProps, focusProps),
|
|
123
82
|
children: [
|
|
124
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: slots.link({ className: classNames?.link }), children:
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: slots.link({ className: classNames?.link }), children: "How to identify" }),
|
|
125
84
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
126
85
|
chevronDown.default,
|
|
127
86
|
{
|
|
@@ -164,13 +123,13 @@ function GovtBanner({
|
|
|
164
123
|
className: slots.panelHeader({
|
|
165
124
|
className: classNames?.panelHeader
|
|
166
125
|
}),
|
|
167
|
-
children:
|
|
126
|
+
children: "Official website links end with .gov.sg"
|
|
168
127
|
}
|
|
169
128
|
),
|
|
170
129
|
/* @__PURE__ */ jsxRuntime.jsxs("article", { children: [
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
130
|
+
"Government agencies communicate via ",
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: ".gov.sg" }),
|
|
132
|
+
" websites (e.g. go.gov.sg/open).",
|
|
174
133
|
" ",
|
|
175
134
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
176
135
|
"a",
|
|
@@ -180,7 +139,7 @@ function GovtBanner({
|
|
|
180
139
|
rel: "noreferrer",
|
|
181
140
|
target: "_blank",
|
|
182
141
|
children: [
|
|
183
|
-
|
|
142
|
+
"Trusted websites",
|
|
184
143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
185
144
|
externalLink.default,
|
|
186
145
|
{
|
|
@@ -226,12 +185,14 @@ function GovtBanner({
|
|
|
226
185
|
className: slots.panelHeader({
|
|
227
186
|
className: classNames?.panelHeader
|
|
228
187
|
}),
|
|
229
|
-
children:
|
|
188
|
+
children: "Secure websites use HTTPS"
|
|
230
189
|
}
|
|
231
190
|
),
|
|
232
|
-
/* @__PURE__ */ jsxRuntime.
|
|
233
|
-
|
|
234
|
-
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsxs("article", { children: [
|
|
192
|
+
"Look for a ",
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: "lock" }),
|
|
194
|
+
" ",
|
|
195
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": true, children: [
|
|
235
196
|
"(",
|
|
236
197
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
198
|
lock.default,
|
|
@@ -242,8 +203,12 @@ function GovtBanner({
|
|
|
242
203
|
}
|
|
243
204
|
),
|
|
244
205
|
")"
|
|
245
|
-
] })
|
|
246
|
-
|
|
206
|
+
] }),
|
|
207
|
+
" ",
|
|
208
|
+
"or ",
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: "https://" }),
|
|
210
|
+
" as an added precaution. Share sensitive information only on official, secure websites."
|
|
211
|
+
] })
|
|
247
212
|
]
|
|
248
213
|
}
|
|
249
214
|
)
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
var react = require('react');
|
|
5
|
+
var $670gB$react = require('react');
|
|
6
6
|
|
|
7
7
|
function useCallbackRef(callback, deps = []) {
|
|
8
|
-
const callbackRef = react.useRef(() => {
|
|
8
|
+
const callbackRef = $670gB$react.useRef(() => {
|
|
9
9
|
throw new Error("Cannot call an event handler while rendering.");
|
|
10
10
|
});
|
|
11
|
-
react.useInsertionEffect(() => {
|
|
11
|
+
$670gB$react.useInsertionEffect(() => {
|
|
12
12
|
callbackRef.current = callback;
|
|
13
13
|
});
|
|
14
|
-
return react.useCallback((...args) => callbackRef.current?.(...args), deps);
|
|
14
|
+
return $670gB$react.useCallback((...args) => callbackRef.current?.(...args), deps);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
exports.useCallbackRef = useCallbackRef;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
var react = require('react');
|
|
5
|
+
var $670gB$react = require('react');
|
|
6
6
|
var useCallbackRef = require('./use-callback-ref.cjs');
|
|
7
7
|
|
|
8
8
|
function useControllableState(props) {
|
|
@@ -14,7 +14,7 @@ function useControllableState(props) {
|
|
|
14
14
|
} = props;
|
|
15
15
|
const onChangeProp = useCallbackRef.useCallbackRef(onChange);
|
|
16
16
|
const shouldUpdateProp = useCallbackRef.useCallbackRef(shouldUpdate);
|
|
17
|
-
const [uncontrolledState, setUncontrolledState] = react.useState(defaultValue);
|
|
17
|
+
const [uncontrolledState, setUncontrolledState] = $670gB$react.useState(defaultValue);
|
|
18
18
|
const controlled = valueProp !== void 0;
|
|
19
19
|
const value = controlled ? valueProp : uncontrolledState;
|
|
20
20
|
const setValue = useCallbackRef.useCallbackRef(
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var useControllableState = require('./hooks/use-controllable-state.cjs');
|
|
5
|
+
var button = require('./button/button.cjs');
|
|
5
6
|
var govtBanner = require('./govt-banner/govt-banner.cjs');
|
|
6
7
|
var ripple = require('./ripple/ripple.cjs');
|
|
7
8
|
var useRipple = require('./ripple/use-ripple.cjs');
|
|
@@ -14,33 +15,40 @@ var textField = require('./text-field/text-field.cjs');
|
|
|
14
15
|
var field = require('./field/field.cjs');
|
|
15
16
|
var textArea = require('./text-area/text-area.cjs');
|
|
16
17
|
var textAreaField = require('./text-area-field/text-area-field.cjs');
|
|
18
|
+
var comboBox = require('./combo-box/combo-box.cjs');
|
|
19
|
+
var comboBoxFuzzy = require('./combo-box/combo-box-fuzzy.cjs');
|
|
20
|
+
var comboBoxItem = require('./combo-box/combo-box-item.cjs');
|
|
21
|
+
var comboBoxVariantContext = require('./combo-box/combo-box-variant-context.cjs');
|
|
22
|
+
var banner = require('./banner/banner.cjs');
|
|
17
23
|
var tagField = require('./tag-field/tag-field.cjs');
|
|
18
24
|
var tagFieldItem = require('./tag-field/tag-field-item.cjs');
|
|
19
25
|
var select = require('./select/select.cjs');
|
|
20
26
|
var selectItem = require('./select/select-item.cjs');
|
|
21
27
|
var selectVariantContext = require('./select/select-variant-context.cjs');
|
|
28
|
+
var badge = require('./badge/badge.cjs');
|
|
29
|
+
var calendar = require('./calendar/calendar.cjs');
|
|
30
|
+
var calendarStyleContext = require('./calendar/calendar-style-context.cjs');
|
|
31
|
+
var utils = require('./calendar/utils.cjs');
|
|
32
|
+
var date = require('@internationalized/date');
|
|
22
33
|
var rangeCalendar = require('./range-calendar/range-calendar.cjs');
|
|
23
34
|
var menu = require('./menu/menu.cjs');
|
|
24
35
|
var popover = require('./popover/popover.cjs');
|
|
25
36
|
var tabs = require('./tabs/tabs.cjs');
|
|
37
|
+
var dateField = require('./date-field/date-field.cjs');
|
|
26
38
|
var datePicker = require('./date-picker/date-picker.cjs');
|
|
27
39
|
var dateRangePicker = require('./date-range-picker/date-range-picker.cjs');
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var date = require('@internationalized/date');
|
|
36
|
-
var calendar = require('./calendar/calendar.cjs');
|
|
37
|
-
var calendarStyleContext = require('./calendar/calendar-style-context.cjs');
|
|
38
|
-
var utils = require('./calendar/utils.cjs');
|
|
39
|
-
var dateField = require('./date-field/date-field.cjs');
|
|
40
|
+
var checkbox = require('./checkbox/checkbox.cjs');
|
|
41
|
+
var checkboxGroupStyleContext = require('./checkbox/checkbox-group-style-context.cjs');
|
|
42
|
+
var pagination = require('./pagination/pagination.cjs');
|
|
43
|
+
var paginationCursor = require('./pagination/pagination-cursor.cjs');
|
|
44
|
+
var paginationItem = require('./pagination/pagination-item.cjs');
|
|
45
|
+
var usePagination = require('./pagination/hooks/use-pagination.cjs');
|
|
46
|
+
var usePagination$1 = require('./pagination/use-pagination.cjs');
|
|
40
47
|
|
|
41
48
|
|
|
42
49
|
|
|
43
50
|
exports.useControllableState = useControllableState.useControllableState;
|
|
51
|
+
exports.Button = button.Button;
|
|
44
52
|
exports.GovtBanner = govtBanner.GovtBanner;
|
|
45
53
|
exports.Ripple = ripple.Ripple;
|
|
46
54
|
exports.useRipple = useRipple.useRipple;
|
|
@@ -56,12 +64,32 @@ exports.FieldGroup = field.FieldGroup;
|
|
|
56
64
|
exports.Label = field.Label;
|
|
57
65
|
exports.TextArea = textArea.TextArea;
|
|
58
66
|
exports.TextAreaField = textAreaField.TextAreaField;
|
|
67
|
+
exports.ComboBox = comboBox.ComboBox;
|
|
68
|
+
exports.ComboBoxEmptyState = comboBox.ComboBoxEmptyState;
|
|
69
|
+
exports.ComboBoxFuzzy = comboBoxFuzzy.ComboBoxFuzzy;
|
|
70
|
+
exports.ComboBoxItem = comboBoxItem.ComboBoxItem;
|
|
71
|
+
exports.ComboBoxVariantContext = comboBoxVariantContext.ComboBoxVariantContext;
|
|
72
|
+
exports.useComboBoxVariantContext = comboBoxVariantContext.useComboBoxVariantContext;
|
|
73
|
+
exports.Banner = banner.Banner;
|
|
59
74
|
exports.TagField = tagField.TagField;
|
|
60
75
|
exports.TagFieldItem = tagFieldItem.TagFieldItem;
|
|
61
76
|
exports.Select = select.Select;
|
|
62
77
|
exports.SelectItem = selectItem.SelectItem;
|
|
63
78
|
exports.SelectVariantContext = selectVariantContext.SelectVariantContext;
|
|
64
79
|
exports.useSelectVariantContext = selectVariantContext.useSelectVariantContext;
|
|
80
|
+
exports.Badge = badge.Badge;
|
|
81
|
+
exports.Calendar = calendar.Calendar;
|
|
82
|
+
exports.CalendarStateWrapper = calendar.CalendarStateWrapper;
|
|
83
|
+
exports.CalendarStyleContext = calendarStyleContext.CalendarStyleContext;
|
|
84
|
+
exports.useCalendarStyleContext = calendarStyleContext.useCalendarStyleContext;
|
|
85
|
+
exports.getEraFormat = utils.getEraFormat;
|
|
86
|
+
exports.useGenerateLocalizedMonths = utils.useGenerateLocalizedMonths;
|
|
87
|
+
exports.useGenerateLocalizedYears = utils.useGenerateLocalizedYears;
|
|
88
|
+
exports.useLocalizedMonthYear = utils.useLocalizedMonthYear;
|
|
89
|
+
Object.defineProperty(exports, "CalendarDate", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () { return date.CalendarDate; }
|
|
92
|
+
});
|
|
65
93
|
exports.RangeCalendar = rangeCalendar.RangeCalendar;
|
|
66
94
|
exports.RangeCalendarCell = rangeCalendar.RangeCalendarCell;
|
|
67
95
|
exports.RangeCalendarStateWrapper = rangeCalendar.RangeCalendarStateWrapper;
|
|
@@ -80,28 +108,17 @@ exports.TabPanel = tabs.TabPanel;
|
|
|
80
108
|
exports.Tabs = tabs.Tabs;
|
|
81
109
|
exports.TabsVariantContext = tabs.TabsVariantContext;
|
|
82
110
|
exports.useTabsVariantContext = tabs.useTabsVariantContext;
|
|
83
|
-
exports.DatePicker = datePicker.DatePicker;
|
|
84
|
-
exports.DateRangePicker = dateRangePicker.DateRangePicker;
|
|
85
|
-
exports.Button = button.Button;
|
|
86
|
-
exports.ComboBox = comboBox.ComboBox;
|
|
87
|
-
exports.ComboBoxEmptyState = comboBox.ComboBoxEmptyState;
|
|
88
|
-
exports.ComboBoxFuzzy = comboBoxFuzzy.ComboBoxFuzzy;
|
|
89
|
-
exports.ComboBoxItem = comboBoxItem.ComboBoxItem;
|
|
90
|
-
exports.ComboBoxVariantContext = comboBoxVariantContext.ComboBoxVariantContext;
|
|
91
|
-
exports.useComboBoxVariantContext = comboBoxVariantContext.useComboBoxVariantContext;
|
|
92
|
-
exports.Banner = banner.Banner;
|
|
93
|
-
exports.Badge = badge.Badge;
|
|
94
|
-
Object.defineProperty(exports, "CalendarDate", {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
get: function () { return date.CalendarDate; }
|
|
97
|
-
});
|
|
98
|
-
exports.Calendar = calendar.Calendar;
|
|
99
|
-
exports.CalendarStateWrapper = calendar.CalendarStateWrapper;
|
|
100
|
-
exports.CalendarStyleContext = calendarStyleContext.CalendarStyleContext;
|
|
101
|
-
exports.useCalendarStyleContext = calendarStyleContext.useCalendarStyleContext;
|
|
102
|
-
exports.getEraFormat = utils.getEraFormat;
|
|
103
|
-
exports.useGenerateLocalizedMonths = utils.useGenerateLocalizedMonths;
|
|
104
|
-
exports.useGenerateLocalizedYears = utils.useGenerateLocalizedYears;
|
|
105
|
-
exports.useLocalizedMonthYear = utils.useLocalizedMonthYear;
|
|
106
111
|
exports.DateField = dateField.DateField;
|
|
107
112
|
exports.DateInput = dateField.DateInput;
|
|
113
|
+
exports.DatePicker = datePicker.DatePicker;
|
|
114
|
+
exports.DateRangePicker = dateRangePicker.DateRangePicker;
|
|
115
|
+
exports.Checkbox = checkbox.Checkbox;
|
|
116
|
+
exports.CheckboxGroup = checkbox.CheckboxGroup;
|
|
117
|
+
exports.CheckboxGroupStyleContext = checkboxGroupStyleContext.CheckboxGroupStyleContext;
|
|
118
|
+
exports.useCheckboxGroupStyleContext = checkboxGroupStyleContext.useCheckboxGroupStyleContext;
|
|
119
|
+
exports.Pagination = pagination.Pagination;
|
|
120
|
+
exports.PaginationCursor = paginationCursor.PaginationCursor;
|
|
121
|
+
exports.PaginationItem = paginationItem.PaginationItem;
|
|
122
|
+
exports.PaginationItemType = usePagination.PaginationItemType;
|
|
123
|
+
exports.CURSOR_TRANSITION_TIMEOUT = usePagination$1.CURSOR_TRANSITION_TIMEOUT;
|
|
124
|
+
exports.usePagination = usePagination$1.usePagination;
|
package/dist/cjs/input/input.cjs
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var react = require('react');
|
|
6
|
+
var $670gB$react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
9
|
|
|
10
|
-
const Input = react.forwardRef(
|
|
10
|
+
const Input = $670gB$react.forwardRef(
|
|
11
11
|
({ size, variant, isDisabled, ...props }, ref) => {
|
|
12
12
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
13
|
reactAriaComponents.Input,
|
package/dist/cjs/menu/menu.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var react = require('react');
|
|
6
|
+
var $670gB$react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
9
|
var popover = require('../popover/popover.cjs');
|
|
@@ -51,7 +51,7 @@ function MenuInner(originalProps, ref) {
|
|
|
51
51
|
) });
|
|
52
52
|
}
|
|
53
53
|
const Menu = utils.forwardRefGeneric(MenuInner);
|
|
54
|
-
const MenuItem = react.forwardRef(function MenuItem2(originalProps, ref) {
|
|
54
|
+
const MenuItem = $670gB$react.forwardRef(function MenuItem2(originalProps, ref) {
|
|
55
55
|
[originalProps, ref] = reactAriaComponents.useContextProps(
|
|
56
56
|
originalProps,
|
|
57
57
|
ref,
|
|
@@ -70,7 +70,7 @@ const MenuItem = react.forwardRef(function MenuItem2(originalProps, ref) {
|
|
|
70
70
|
variantProps
|
|
71
71
|
] = utils.mapPropsVariants(originalProps, ouiTheme.listBoxItemStyles.variantKeys);
|
|
72
72
|
const styles = ouiTheme.menuItemStyles(variantProps);
|
|
73
|
-
const multipleSelectionIcon = react.useMemo(() => {
|
|
73
|
+
const multipleSelectionIcon = $670gB$react.useMemo(() => {
|
|
74
74
|
if (multipleSelectionIconProp !== void 0) {
|
|
75
75
|
return multipleSelectionIconProp;
|
|
76
76
|
}
|
|
@@ -82,7 +82,7 @@ const MenuItem = react.forwardRef(function MenuItem2(originalProps, ref) {
|
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
}, [classNames?.icon, multipleSelectionIconProp, styles]);
|
|
85
|
-
const singleSelectionIcon = react.useMemo(() => {
|
|
85
|
+
const singleSelectionIcon = $670gB$react.useMemo(() => {
|
|
86
86
|
if (singleSelectionIconProp !== void 0) {
|
|
87
87
|
return singleSelectionIconProp;
|
|
88
88
|
}
|
|
@@ -94,7 +94,7 @@ const MenuItem = react.forwardRef(function MenuItem2(originalProps, ref) {
|
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
96
|
}, [classNames?.icon, singleSelectionIconProp, styles]);
|
|
97
|
-
const showIconContainer = react.useCallback(
|
|
97
|
+
const showIconContainer = $670gB$react.useCallback(
|
|
98
98
|
(selectionMode) => {
|
|
99
99
|
switch (selectionMode) {
|
|
100
100
|
case "none":
|
|
@@ -107,7 +107,7 @@ const MenuItem = react.forwardRef(function MenuItem2(originalProps, ref) {
|
|
|
107
107
|
},
|
|
108
108
|
[multipleSelectionIcon, singleSelectionIcon]
|
|
109
109
|
);
|
|
110
|
-
const defaultTextValue = react.useMemo(() => {
|
|
110
|
+
const defaultTextValue = $670gB$react.useMemo(() => {
|
|
111
111
|
if (props.textValue) {
|
|
112
112
|
return props.textValue;
|
|
113
113
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var useFocus = require('../../../../../@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');
|
|
4
|
+
var useFocusVisible = require('../../../../../@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');
|
|
5
|
+
var useFocusWithin = require('../../../../../@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');
|
|
6
|
+
var $670gB$react = require('react');
|
|
7
|
+
|
|
8
|
+
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
|
|
9
|
+
let { autoFocus: autoFocus = false, isTextInput: isTextInput, within: within } = props;
|
|
10
|
+
let state = ($670gB$react.useRef)({
|
|
11
|
+
isFocused: false,
|
|
12
|
+
isFocusVisible: autoFocus || (useFocusVisible.isFocusVisible)()
|
|
13
|
+
});
|
|
14
|
+
let [isFocused, setFocused] = ($670gB$react.useState)(false);
|
|
15
|
+
let [isFocusVisibleState, setFocusVisible] = ($670gB$react.useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
|
16
|
+
let updateState = ($670gB$react.useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
|
17
|
+
let onFocusChange = ($670gB$react.useCallback)((isFocused)=>{
|
|
18
|
+
state.current.isFocused = isFocused;
|
|
19
|
+
setFocused(isFocused);
|
|
20
|
+
updateState();
|
|
21
|
+
}, [
|
|
22
|
+
updateState
|
|
23
|
+
]);
|
|
24
|
+
(useFocusVisible.useFocusVisibleListener)((isFocusVisible)=>{
|
|
25
|
+
state.current.isFocusVisible = isFocusVisible;
|
|
26
|
+
updateState();
|
|
27
|
+
}, [], {
|
|
28
|
+
isTextInput: isTextInput
|
|
29
|
+
});
|
|
30
|
+
let { focusProps: focusProps } = (useFocus.useFocus)({
|
|
31
|
+
isDisabled: within,
|
|
32
|
+
onFocusChange: onFocusChange
|
|
33
|
+
});
|
|
34
|
+
let { focusWithinProps: focusWithinProps } = (useFocusWithin.useFocusWithin)({
|
|
35
|
+
isDisabled: !within,
|
|
36
|
+
onFocusWithinChange: onFocusChange
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
isFocused: isFocused,
|
|
40
|
+
isFocusVisible: isFocusVisibleState,
|
|
41
|
+
focusProps: within ? focusWithinProps : focusProps
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.useFocusRing = $f7dceffc5ad7768b$export$4e328f61c538687f;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var $670gB$react = require('react');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = ($670gB$react).createContext({
|
|
17
|
+
register: ()=>{}
|
|
18
|
+
});
|
|
19
|
+
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
|
20
|
+
|
|
21
|
+
exports.PressResponderContext = $ae1eeba8b9eafd08$export$5165eccb35aaadb5;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@react-aria/utils');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
|
17
|
+
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
|
18
|
+
let $14c0b72509d70225$var$state = 'default';
|
|
19
|
+
let $14c0b72509d70225$var$savedUserSelect = '';
|
|
20
|
+
let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
|
|
21
|
+
function $14c0b72509d70225$export$16a4697467175487(target) {
|
|
22
|
+
if ((utils.isIOS)()) {
|
|
23
|
+
if ($14c0b72509d70225$var$state === 'default') {
|
|
24
|
+
const documentObject = (utils.getOwnerDocument)(target);
|
|
25
|
+
$14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
|
26
|
+
documentObject.documentElement.style.webkitUserSelect = 'none';
|
|
27
|
+
}
|
|
28
|
+
$14c0b72509d70225$var$state = 'disabled';
|
|
29
|
+
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
30
|
+
// If not iOS, store the target's original user-select and change to user-select: none
|
|
31
|
+
// Ignore state since it doesn't apply for non iOS
|
|
32
|
+
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
|
33
|
+
$14c0b72509d70225$var$modifiedElementMap.set(target, target.style[property]);
|
|
34
|
+
target.style[property] = 'none';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
38
|
+
if ((utils.isIOS)()) {
|
|
39
|
+
// If the state is already default, there's nothing to do.
|
|
40
|
+
// If it is restoring, then there's no need to queue a second restore.
|
|
41
|
+
if ($14c0b72509d70225$var$state !== 'disabled') return;
|
|
42
|
+
$14c0b72509d70225$var$state = 'restoring';
|
|
43
|
+
// There appears to be a delay on iOS where selection still might occur
|
|
44
|
+
// after pointer up, so wait a bit before removing user-select.
|
|
45
|
+
setTimeout(()=>{
|
|
46
|
+
// Wait for any CSS transitions to complete so we don't recompute style
|
|
47
|
+
// for the whole page in the middle of the animation and cause jank.
|
|
48
|
+
(utils.runAfterTransition)(()=>{
|
|
49
|
+
// Avoid race conditions
|
|
50
|
+
if ($14c0b72509d70225$var$state === 'restoring') {
|
|
51
|
+
const documentObject = (utils.getOwnerDocument)(target);
|
|
52
|
+
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
|
|
53
|
+
$14c0b72509d70225$var$savedUserSelect = '';
|
|
54
|
+
$14c0b72509d70225$var$state = 'default';
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}, 300);
|
|
58
|
+
} else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
|
|
59
|
+
// Ignore state since it doesn't apply for non iOS
|
|
60
|
+
{
|
|
61
|
+
if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
|
62
|
+
let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
|
63
|
+
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
|
64
|
+
if (target.style[property] === 'none') target.style[property] = targetOldUserSelect;
|
|
65
|
+
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
|
66
|
+
$14c0b72509d70225$var$modifiedElementMap.delete(target);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
exports.disableTextSelection = $14c0b72509d70225$export$16a4697467175487;
|
|
72
|
+
exports.restoreTextSelection = $14c0b72509d70225$export$b0d6fa1ab32e3295;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('./utils.cjs');
|
|
4
|
+
var $670gB$react = require('react');
|
|
5
|
+
var utils$1 = require('@react-aria/utils');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
* governing permissions and limitations under the License.
|
|
17
|
+
*/ // Portions of the code in this file are based on code from react.
|
|
18
|
+
// Original licensing for the following can be found in the
|
|
19
|
+
// NOTICE file in the root directory of this source tree.
|
|
20
|
+
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
|
25
|
+
let { isDisabled: isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange: onFocusChange } = props;
|
|
26
|
+
const onBlur = ($670gB$react.useCallback)((e)=>{
|
|
27
|
+
if (e.target === e.currentTarget) {
|
|
28
|
+
if (onBlurProp) onBlurProp(e);
|
|
29
|
+
if (onFocusChange) onFocusChange(false);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}, [
|
|
33
|
+
onBlurProp,
|
|
34
|
+
onFocusChange
|
|
35
|
+
]);
|
|
36
|
+
const onSyntheticFocus = (utils.useSyntheticBlurEvent)(onBlur);
|
|
37
|
+
const onFocus = ($670gB$react.useCallback)((e)=>{
|
|
38
|
+
// Double check that document.activeElement actually matches e.target in case a previously chained
|
|
39
|
+
// focus handler already moved focus somewhere else.
|
|
40
|
+
const ownerDocument = (utils$1.getOwnerDocument)(e.target);
|
|
41
|
+
const activeElement = ownerDocument ? (utils$1.getActiveElement)(ownerDocument) : (utils$1.getActiveElement)();
|
|
42
|
+
if (e.target === e.currentTarget && activeElement === (utils$1.getEventTarget)(e.nativeEvent)) {
|
|
43
|
+
if (onFocusProp) onFocusProp(e);
|
|
44
|
+
if (onFocusChange) onFocusChange(true);
|
|
45
|
+
onSyntheticFocus(e);
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
onFocusChange,
|
|
49
|
+
onFocusProp,
|
|
50
|
+
onSyntheticFocus
|
|
51
|
+
]);
|
|
52
|
+
return {
|
|
53
|
+
focusProps: {
|
|
54
|
+
onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : undefined,
|
|
55
|
+
onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : undefined
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
exports.useFocus = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6;
|