@accelint/design-system 1.1.2 → 1.1.4
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/components/aria/index.js.map +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/collection/index.d.ts +1 -1
- package/dist/components/collection/index.js.map +1 -1
- package/dist/components/combo-box/index.js +9 -5
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/date-field/index.js +8 -4
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-input/index.js +15 -7
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/index.js +7 -5
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/index.js +21 -8
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/element/index.d.ts +1 -1
- package/dist/components/element/index.js +7 -3
- package/dist/components/element/index.js.map +1 -1
- package/dist/components/element/types.d.ts +2 -0
- package/dist/components/group/index.js +6 -6
- package/dist/components/group/index.js.map +1 -1
- package/dist/components/icon/index.js +4 -4
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/index.d.ts +34 -34
- package/dist/components/input/index.js +17 -8
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/merge-provider/index.js.map +1 -1
- package/dist/components/merge-provider/types.d.ts +2 -0
- package/dist/components/number-field/index.js +8 -4
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/popover/index.js +8 -4
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/query-builder/action-element.js.map +1 -1
- package/dist/components/query-builder/dataset-sample.js.map +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/index.js +12 -8
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/search-field/index.js +9 -5
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/select/index.js +5 -5
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/slider/index.js +48 -20
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/switch/index.js +4 -4
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tabs/index.js +32 -20
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-field/index.js +8 -4
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/textarea/index.js +16 -7
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/time-field/index.js +8 -4
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tooltip/index.js +17 -9
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.js.map +1 -1
- package/dist/components/tree/utils.js +3 -1
- package/dist/components/tree/utils.js.map +1 -1
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/use-theme/index.d.ts +1 -1
- package/dist/hooks/use-theme/index.js.map +1 -1
- package/dist/hooks/use-tree/index.js.map +1 -1
- package/dist/hooks/use-update-effect/index.js.map +1 -1
- package/dist/index.d.ts +34 -34
- package/dist/ladle/actions.js.map +1 -1
- package/dist/test/setup.js +10 -10
- package/dist/test/setup.js.map +1 -1
- package/dist/utils/css/index.js.map +1 -1
- package/dist/utils/props/index.js +1 -2
- package/dist/utils/props/index.js.map +1 -1
- package/dist/vanilla.d.ts +29 -29
- package/package.json +15 -14
|
@@ -32,7 +32,7 @@ var DrawerContext = createContext({
|
|
|
32
32
|
toggle: noop
|
|
33
33
|
});
|
|
34
34
|
function Drawer(props) {
|
|
35
|
-
|
|
35
|
+
const defaultedProps = useDefaultProps(props, "Drawer");
|
|
36
36
|
const {
|
|
37
37
|
children: childrenProp,
|
|
38
38
|
classNames: classNamesProp,
|
|
@@ -45,7 +45,7 @@ function Drawer(props) {
|
|
|
45
45
|
isOpen: isOpenProp,
|
|
46
46
|
onOpenChange,
|
|
47
47
|
...rest
|
|
48
|
-
} =
|
|
48
|
+
} = defaultedProps;
|
|
49
49
|
const theme = useTheme();
|
|
50
50
|
const isSSR = useIsSSR();
|
|
51
51
|
const classNames = useMemo(
|
|
@@ -119,8 +119,12 @@ function Drawer(props) {
|
|
|
119
119
|
) });
|
|
120
120
|
}
|
|
121
121
|
function DrawerTabList(props) {
|
|
122
|
-
|
|
123
|
-
const {
|
|
122
|
+
const defaultProps = useDefaultProps(props, "DrawerTabList");
|
|
123
|
+
const {
|
|
124
|
+
children,
|
|
125
|
+
classNames: classNamesProp,
|
|
126
|
+
variant = "fill"
|
|
127
|
+
} = defaultProps;
|
|
124
128
|
const { anchor } = useContext(DrawerContext);
|
|
125
129
|
const theme = useTheme();
|
|
126
130
|
const classNames = useMemo(
|
|
@@ -147,8 +151,12 @@ function DrawerTabList(props) {
|
|
|
147
151
|
) });
|
|
148
152
|
}
|
|
149
153
|
function DrawerTab(props) {
|
|
150
|
-
|
|
151
|
-
const {
|
|
154
|
+
const defaultProps = useDefaultProps(props, "DrawerTab");
|
|
155
|
+
const {
|
|
156
|
+
children: childrenProp,
|
|
157
|
+
classNames: classNamesProp,
|
|
158
|
+
...rest
|
|
159
|
+
} = defaultProps;
|
|
152
160
|
const { isOpen, open, toggle } = useContext(DrawerContext);
|
|
153
161
|
const theme = useTheme();
|
|
154
162
|
const classNames = useMemo(
|
|
@@ -194,7 +202,11 @@ var defaultMapping = {
|
|
|
194
202
|
};
|
|
195
203
|
var DrawerDialogContext = createContext(null);
|
|
196
204
|
var DrawerDialog = forwardRef(function DrawerDialog2(props, ref) {
|
|
197
|
-
[
|
|
205
|
+
const [contextProps, contextRef] = useContextProps(
|
|
206
|
+
props,
|
|
207
|
+
ref,
|
|
208
|
+
DrawerDialogContext
|
|
209
|
+
);
|
|
198
210
|
const {
|
|
199
211
|
children,
|
|
200
212
|
classNames: classNamesProp,
|
|
@@ -202,7 +214,7 @@ var DrawerDialog = forwardRef(function DrawerDialog2(props, ref) {
|
|
|
202
214
|
"aria-label": ariaLabel,
|
|
203
215
|
"aria-labelledby": ariaLabelledBy,
|
|
204
216
|
...rest
|
|
205
|
-
} =
|
|
217
|
+
} = contextProps;
|
|
206
218
|
const { close } = useContext(DrawerContext);
|
|
207
219
|
const [backRef, hasBack] = useSlot();
|
|
208
220
|
const [titleRef, hasTitle] = useSlot();
|
|
@@ -295,6 +307,7 @@ var DrawerDialog = forwardRef(function DrawerDialog2(props, ref) {
|
|
|
295
307
|
"div",
|
|
296
308
|
{
|
|
297
309
|
...rest,
|
|
310
|
+
ref: contextRef,
|
|
298
311
|
className: classNames?.dialog?.container,
|
|
299
312
|
style,
|
|
300
313
|
"aria-label": ariaLabel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/drawer/index.tsx"],"names":["isOpen","DrawerDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoEA,IAAM,gBAAgB,aAAA,CAAkC;AAAA,EACtD,MAAA,EAAQ,OAAA;AAAA,EACR,WAAA,EAAa,KAAA;AAAA,EACb,MAAA,EAAQ,KAAA;AAAA,EACR,KAAA,EAAO,IAAA;AAAA,EACP,IAAA,EAAM,IAAA;AAAA,EACN,OAAA,EAAS,IAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAC,CAAA;AAEM,SAAS,OAAO,KAAA,EAAoB;AACzC,EAAA,KAAA,GAAQ,eAAA,CAAgB,OAAO,QAAQ,CAAA;AAEvC,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,MAAA,GAAS,OAAA;AAAA,IACT,WAAA,GAAc,KAAA;AAAA,IACd,WAAA,GAAc,KAAA;AAAA,IACd,iBAAA,GAAoB,KAAA;AAAA,IACpB,aAAA,GAAgB,IAAA;AAAA,IAChB,yBAAA,GAA4B,KAAA;AAAA,IAC5B,MA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AAA;AACF,GACF;AAGA,EAAA,IAAI,CAAC,SAAA,IAAa,CAAC,cAAA,IAAkB,CAAC,QAAA,EAAU;AAC9C,IAAA,OAAA,CAAQ,IAAA;AAAA,MACN;AAAA,KACF;AAAA,EACF;AAEA,EAAA,uBACE,GAAA,CAAC,YAAS,MAAA,EACR,QAAA,kBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,YAAY,MAAA,EAAQ,SAAA;AAAA,MAC/B,KAAA;AAAA,MACA,YAAA,EAAY,SAAA;AAAA,MACZ,iBAAA,EAAiB,cAAA;AAAA,MAEjB,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,UAAA,EAAY,MAAA,EAAQ,QAAS,QAAA,EAAS;AAAA;AAAA,GACxD,EACF,CAAA;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { toBoolean } from '@accelint/converters';\nimport { noop } from '@accelint/core';\nimport { useFocusWithin } from '@react-aria/interactions';\nimport { useOverlay } from '@react-aria/overlays';\nimport { useIsSSR } from '@react-aria/ssr';\nimport { useOverlayTriggerState } from '@react-stately/overlays';\nimport type { PressEvent } from '@react-types/shared';\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n useRef,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Provider,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport {\n callRenderProps,\n mergeClassNames,\n mergeProps,\n} from '../../utils/props';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport type { ButtonProps } from '../button/types';\nimport { ElementContext } from '../element';\nimport type { ElementProps } from '../element/types.ts';\nimport { Tab, TabList, Tabs } from '../tabs';\nimport type { TabRenderProps } from '../tabs/types';\nimport { TooltipContext, TooltipTargetContext } from '../tooltip';\nimport type { TooltipProps, TooltipTargetProps } from '../tooltip/types';\nimport {\n drawerClassNames,\n drawerDialogStateVars,\n drawerStateVars,\n} from './drawer.css';\nimport type {\n DrawerContextValue,\n DrawerDialogProps,\n DrawerMapping,\n DrawerProps,\n DrawerTabListProps,\n DrawerTabProps,\n} from './types';\n\nconst DrawerContext = createContext<DrawerContextValue>({\n anchor: 'right',\n layoutShift: false,\n isOpen: false,\n close: noop,\n open: noop,\n setOpen: noop,\n toggle: noop,\n});\n\nexport function Drawer(props: DrawerProps) {\n props = useDefaultProps(props, 'Drawer');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n anchor = 'right',\n defaultOpen = false,\n layoutShift = false,\n shouldCloseOnBlur = false,\n isDismissable = true,\n isKeyboardDismissDisabled = false,\n isOpen: isOpenProp,\n onOpenChange,\n ...rest\n } = props;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Remove focus when Drawer closes\n const handleOpenChange = useCallback(\n (isOpen: boolean) => {\n if (!isOpen) {\n const focused = isSSR ? null : document.activeElement;\n\n if (\n focused &&\n 'blur' in focused &&\n typeof focused.blur === 'function'\n ) {\n focused.blur();\n }\n }\n\n onOpenChange?.(isOpen);\n },\n [isSSR, onOpenChange],\n );\n\n const state = useOverlayTriggerState({\n defaultOpen,\n isOpen: isOpenProp,\n onOpenChange: handleOpenChange,\n });\n\n const { isOpen, close, open } = state;\n const ref = useRef<HTMLDivElement>(null);\n\n const { overlayProps } = useOverlay(\n {\n isOpen,\n shouldCloseOnBlur,\n isDismissable,\n isKeyboardDismissDisabled,\n onClose: close,\n },\n ref,\n );\n\n // TODO: it may be desirable to disallow focus within the closed Drawer instead\n // If focus forces the Drawer open\n const { focusWithinProps } = useFocusWithin({\n onFocusWithin: open,\n });\n\n const context = useMemo(\n () => ({ ...state, anchor, layoutShift }),\n [state, anchor, layoutShift],\n );\n\n const values = useMemo<\n [\n [typeof DrawerContext, DrawerContextValue],\n [\n typeof DrawerDialogContext,\n ContextValue<DrawerDialogProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [DrawerContext, context],\n [DrawerDialogContext, { classNames }],\n ],\n [context, classNames],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerStateVars, {\n anchor,\n layoutShift,\n isOpen,\n }),\n [anchor, layoutShift, isOpen],\n );\n\n const children = useMemo(\n () => callRenderProps(childrenProp, state),\n [childrenProp, state],\n );\n\n return (\n <Provider values={values}>\n <div\n {...mergeProps(overlayProps, focusWithinProps)}\n ref={ref}\n className={classNames?.container}\n style={style}\n >\n <Tabs classNames={classNames?.tabs} {...rest}>\n {children}\n </Tabs>\n </div>\n </Provider>\n );\n}\n\nexport function DrawerTabList<T extends object>(props: DrawerTabListProps<T>) {\n props = useDefaultProps(props, 'DrawerTabList');\n\n const { children, classNames: classNamesProp, variant = 'fill' } = props;\n const { anchor } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n const values = useMemo<\n [\n [typeof TooltipContext, ContextValue<TooltipProps, HTMLDivElement>],\n [\n typeof TooltipTargetContext,\n ContextValue<TooltipTargetProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [TooltipContext, { placement: anchor === 'left' ? 'right' : 'left' }],\n [TooltipTargetContext, { focusable: false, relative: 'parent' }],\n ],\n [anchor],\n );\n\n return (\n <Provider values={values}>\n <TabList<T>\n classNames={classNames?.tabs}\n align='center'\n anchor={anchor === 'left' ? 'start' : 'end'}\n orientation='vertical'\n variant={variant}\n >\n {children}\n </TabList>\n </Provider>\n );\n}\n\nexport function DrawerTab(props: DrawerTabProps) {\n props = useDefaultProps(props, 'DrawerTab');\n\n const { children: childrenProp, classNames: classNamesProp, ...rest } = props;\n const { isOpen, open, toggle } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Must bind to press start (instead of later press events) due to Tab changing selected state on start\n const handlePressStart = useCallback(\n (event: PressEvent) => {\n const { selected } = event.target.parentElement?.dataset ?? {};\n\n if (toBoolean(selected)) {\n toggle();\n } else {\n open();\n }\n },\n [open, toggle],\n );\n\n const children = useCallback(\n (renderProps: TabRenderProps) =>\n callRenderProps(childrenProp, { ...renderProps, isOpen }),\n [childrenProp, isOpen],\n );\n\n return (\n <Tab\n {...rest}\n classNames={classNames?.tabs}\n onPressStart={handlePressStart}\n >\n {children}\n </Tab>\n );\n}\n\nconst defaultMapping: DrawerMapping = {\n heading: {\n child: headings.v4,\n parent: headings.v3,\n },\n back: {\n variant: 'icon',\n },\n close: {\n variant: 'icon',\n },\n};\n\nexport const DrawerDialogContext =\n createContext<ContextValue<DrawerDialogProps, HTMLDivElement>>(null);\n\nexport const DrawerDialog = forwardRef(function DrawerDialog(\n props: DrawerDialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DrawerDialogContext);\n\n const {\n children,\n classNames: classNamesProp,\n mapping: mappingProp,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = props;\n\n const { close } = useContext(DrawerContext);\n const [backRef, hasBack] = useSlot();\n const [titleRef, hasTitle] = useSlot();\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp, {\n header: {\n title: hasBack ? mapping.heading.child : mapping.heading.parent,\n },\n }),\n [theme.Drawer, classNamesProp, hasBack, mapping],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerDialogStateVars, {\n isChild: !!hasBack,\n }),\n [hasBack],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<ButtonProps, HTMLButtonElement>,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header?.header,\n values: [\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n back: {\n ...mapping.back,\n ref: backRef,\n classNames: classNames?.header?.back,\n },\n close: {\n ...mapping.close,\n classNames: classNames?.header?.close,\n onPress: close,\n },\n },\n },\n ],\n [\n AriaHeadingContext,\n {\n slots: {\n title: {\n ref: titleRef,\n className: classNames?.header?.title,\n },\n },\n },\n ],\n ],\n },\n content: { className: classNames?.content },\n footer: { as: 'footer', className: classNames?.footer },\n },\n },\n ],\n ],\n [\n classNames?.header?.header,\n classNames?.header?.back,\n classNames?.header?.close,\n classNames?.header?.title,\n classNames?.content,\n classNames?.footer,\n backRef,\n close,\n mapping,\n titleRef,\n ],\n );\n\n // biome-ignore lint/complexity/useSimplifiedLogicExpression: intentional\n if (!ariaLabel && !ariaLabelledBy && !hasTitle) {\n console.warn(\n 'If a Drawer does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.',\n );\n }\n\n return (\n <Provider values={values}>\n <div\n {...rest}\n className={classNames?.dialog?.container}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n <div className={classNames?.dialog?.dialog}>{children}</div>\n </div>\n </Provider>\n );\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/drawer/index.tsx"],"names":["isOpen","DrawerDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoEA,IAAM,gBAAgB,aAAA,CAAkC;AAAA,EACtD,MAAA,EAAQ,OAAA;AAAA,EACR,WAAA,EAAa,KAAA;AAAA,EACb,MAAA,EAAQ,KAAA;AAAA,EACR,KAAA,EAAO,IAAA;AAAA,EACP,IAAA,EAAM,IAAA;AAAA,EACN,OAAA,EAAS,IAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAC,CAAA;AAEM,SAAS,OAAO,KAAA,EAAoB;AACzC,EAAA,MAAM,cAAA,GAAiB,eAAA,CAAgB,KAAA,EAAO,QAAQ,CAAA;AAEtD,EAAA,MAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,UAAA,EAAY,cAAA;AAAA,IACZ,MAAA,GAAS,OAAA;AAAA,IACT,WAAA,GAAc,KAAA;AAAA,IACd,WAAA,GAAc,KAAA;AAAA,IACd,iBAAA,GAAoB,KAAA;AAAA,IACpB,aAAA,GAAgB,IAAA;AAAA,IAChB,yBAAA,GAA4B,KAAA;AAAA,IAC5B,MAAA,EAAQ,UAAA;AAAA,IACR,YAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,cAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AACvB,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,gBAAA,EAAkB,KAAA,CAAM,QAAQ,cAAc,CAAA;AAAA,IACpE,CAAC,KAAA,CAAM,MAAA,EAAQ,cAAc;AAAA,GAC/B;AAGA,EAAA,MAAM,gBAAA,GAAmB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,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,UAAA;AAAA,MACL,SAAA,EAAW,YAAY,MAAA,EAAQ,SAAA;AAAA,MAC/B,KAAA;AAAA,MACA,YAAA,EAAY,SAAA;AAAA,MACZ,iBAAA,EAAiB,cAAA;AAAA,MAEjB,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,UAAA,EAAY,MAAA,EAAQ,QAAS,QAAA,EAAS;AAAA;AAAA,GACxD,EACF,CAAA;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { toBoolean } from '@accelint/converters';\nimport { noop } from '@accelint/core';\nimport { useFocusWithin } from '@react-aria/interactions';\nimport { useOverlay } from '@react-aria/overlays';\nimport { useIsSSR } from '@react-aria/ssr';\nimport { useOverlayTriggerState } from '@react-stately/overlays';\nimport {\n createContext,\n type ForwardedRef,\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useContext,\n useMemo,\n useRef,\n} from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Provider,\n} from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useSlot } from '../../hooks/use-slot';\nimport { useTheme } from '../../hooks/use-theme';\nimport { headings } from '../../styles/typography.css';\nimport { inlineVars } from '../../utils/css';\nimport {\n callRenderProps,\n mergeClassNames,\n mergeProps,\n} from '../../utils/props';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext } from '../button';\nimport { ElementContext } from '../element';\nimport { Tab, TabList, Tabs } from '../tabs';\nimport { TooltipContext, TooltipTargetContext } from '../tooltip';\nimport {\n drawerClassNames,\n drawerDialogStateVars,\n drawerStateVars,\n} from './drawer.css';\nimport type { PressEvent } from '@react-types/shared';\nimport type { ButtonProps } from '../button/types';\nimport type { ElementProps } from '../element/types.ts';\nimport type { TabRenderProps } from '../tabs/types';\nimport type { TooltipProps, TooltipTargetProps } from '../tooltip/types';\nimport type {\n DrawerContextValue,\n DrawerDialogProps,\n DrawerMapping,\n DrawerProps,\n DrawerTabListProps,\n DrawerTabProps,\n} from './types';\n\nconst DrawerContext = createContext<DrawerContextValue>({\n anchor: 'right',\n layoutShift: false,\n isOpen: false,\n close: noop,\n open: noop,\n setOpen: noop,\n toggle: noop,\n});\n\nexport function Drawer(props: DrawerProps) {\n const defaultedProps = useDefaultProps(props, 'Drawer');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n anchor = 'right',\n defaultOpen = false,\n layoutShift = false,\n shouldCloseOnBlur = false,\n isDismissable = true,\n isKeyboardDismissDisabled = false,\n isOpen: isOpenProp,\n onOpenChange,\n ...rest\n } = defaultedProps;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Remove focus when Drawer closes\n const handleOpenChange = useCallback(\n (isOpen: boolean) => {\n if (!isOpen) {\n const focused = isSSR ? null : document.activeElement;\n\n if (\n focused &&\n 'blur' in focused &&\n typeof focused.blur === 'function'\n ) {\n focused.blur();\n }\n }\n\n onOpenChange?.(isOpen);\n },\n [isSSR, onOpenChange],\n );\n\n const state = useOverlayTriggerState({\n defaultOpen,\n isOpen: isOpenProp,\n onOpenChange: handleOpenChange,\n });\n\n const { isOpen, close, open } = state;\n const ref = useRef<HTMLDivElement>(null);\n\n const { overlayProps } = useOverlay(\n {\n isOpen,\n shouldCloseOnBlur,\n isDismissable,\n isKeyboardDismissDisabled,\n onClose: close,\n },\n ref,\n );\n\n // TODO: it may be desirable to disallow focus within the closed Drawer instead\n // If focus forces the Drawer open\n const { focusWithinProps } = useFocusWithin({\n onFocusWithin: open,\n });\n\n const context = useMemo(\n () => ({ ...state, anchor, layoutShift }),\n [state, anchor, layoutShift],\n );\n\n const values = useMemo<\n [\n [typeof DrawerContext, DrawerContextValue],\n [\n typeof DrawerDialogContext,\n ContextValue<DrawerDialogProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [DrawerContext, context],\n [DrawerDialogContext, { classNames }],\n ],\n [context, classNames],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerStateVars, {\n anchor,\n layoutShift,\n isOpen,\n }),\n [anchor, layoutShift, isOpen],\n );\n\n const children = useMemo(\n () => callRenderProps(childrenProp, state),\n [childrenProp, state],\n );\n\n return (\n <Provider values={values}>\n <div\n {...mergeProps(overlayProps, focusWithinProps)}\n ref={ref}\n className={classNames?.container}\n style={style}\n >\n <Tabs classNames={classNames?.tabs} {...rest}>\n {children}\n </Tabs>\n </div>\n </Provider>\n );\n}\n\nexport function DrawerTabList<T extends object>(props: DrawerTabListProps<T>) {\n const defaultProps = useDefaultProps(props, 'DrawerTabList');\n\n const {\n children,\n classNames: classNamesProp,\n variant = 'fill',\n } = defaultProps;\n const { anchor } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n const values = useMemo<\n [\n [typeof TooltipContext, ContextValue<TooltipProps, HTMLDivElement>],\n [\n typeof TooltipTargetContext,\n ContextValue<TooltipTargetProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [TooltipContext, { placement: anchor === 'left' ? 'right' : 'left' }],\n [TooltipTargetContext, { focusable: false, relative: 'parent' }],\n ],\n [anchor],\n );\n\n return (\n <Provider values={values}>\n <TabList<T>\n classNames={classNames?.tabs}\n align='center'\n anchor={anchor === 'left' ? 'start' : 'end'}\n orientation='vertical'\n variant={variant}\n >\n {children}\n </TabList>\n </Provider>\n );\n}\n\nexport function DrawerTab(props: DrawerTabProps) {\n const defaultProps = useDefaultProps(props, 'DrawerTab');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n ...rest\n } = defaultProps;\n\n const { isOpen, open, toggle } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Must bind to press start (instead of later press events) due to Tab changing selected state on start\n const handlePressStart = useCallback(\n (event: PressEvent) => {\n const { selected } = event.target.parentElement?.dataset ?? {};\n\n if (toBoolean(selected)) {\n toggle();\n } else {\n open();\n }\n },\n [open, toggle],\n );\n\n const children = useCallback(\n (renderProps: TabRenderProps) =>\n callRenderProps(childrenProp, { ...renderProps, isOpen }),\n [childrenProp, isOpen],\n );\n\n return (\n <Tab\n {...rest}\n classNames={classNames?.tabs}\n onPressStart={handlePressStart}\n >\n {children}\n </Tab>\n );\n}\n\nconst defaultMapping: DrawerMapping = {\n heading: {\n child: headings.v4,\n parent: headings.v3,\n },\n back: {\n variant: 'icon',\n },\n close: {\n variant: 'icon',\n },\n};\n\nexport const DrawerDialogContext =\n createContext<ContextValue<DrawerDialogProps, HTMLDivElement>>(null);\n\nexport const DrawerDialog = forwardRef(function DrawerDialog(\n props: DrawerDialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n DrawerDialogContext,\n );\n\n const {\n children,\n classNames: classNamesProp,\n mapping: mappingProp,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = contextProps;\n\n const { close } = useContext(DrawerContext);\n const [backRef, hasBack] = useSlot();\n const [titleRef, hasTitle] = useSlot();\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp, {\n header: {\n title: hasBack ? mapping.heading.child : mapping.heading.parent,\n },\n }),\n [theme.Drawer, classNamesProp, hasBack, mapping],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerDialogStateVars, {\n isChild: !!hasBack,\n }),\n [hasBack],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<ButtonProps, HTMLButtonElement>,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header?.header,\n values: [\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n back: {\n ...mapping.back,\n ref: backRef,\n classNames: classNames?.header?.back,\n },\n close: {\n ...mapping.close,\n classNames: classNames?.header?.close,\n onPress: close,\n },\n },\n },\n ],\n [\n AriaHeadingContext,\n {\n slots: {\n title: {\n ref: titleRef,\n className: classNames?.header?.title,\n },\n },\n },\n ],\n ],\n },\n content: { className: classNames?.content },\n footer: { as: 'footer', className: classNames?.footer },\n },\n },\n ],\n ],\n [\n classNames?.header?.header,\n classNames?.header?.back,\n classNames?.header?.close,\n classNames?.header?.title,\n classNames?.content,\n classNames?.footer,\n backRef,\n close,\n mapping,\n titleRef,\n ],\n );\n\n // biome-ignore lint/complexity/useSimplifiedLogicExpression: intentional\n if (!ariaLabel && !ariaLabelledBy && !hasTitle) {\n console.warn(\n 'If a Drawer does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.',\n );\n }\n\n return (\n <Provider values={values}>\n {/** biome-ignore lint/a11y/useAriaPropsSupportedByRole: Legacy */}\n <div\n {...rest}\n ref={contextRef}\n className={classNames?.dialog?.container}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n <div className={classNames?.dialog?.dialog}>{children}</div>\n </div>\n </Provider>\n );\n});\n"]}
|
|
@@ -7,7 +7,7 @@ declare const ElementContext: react.Context<ContextValue<ElementProps<any, any,
|
|
|
7
7
|
/**
|
|
8
8
|
* This generic component serves as any easy way for more complex components
|
|
9
9
|
* to establish stylable content areas within their layout with optional
|
|
10
|
-
*
|
|
10
|
+
* targeted contexts for any subcomponents
|
|
11
11
|
*
|
|
12
12
|
* See Dialog & Drawer as examples
|
|
13
13
|
*/
|
|
@@ -7,9 +7,13 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
7
7
|
|
|
8
8
|
var ElementContext = createContext(null);
|
|
9
9
|
var Element = forwardRef(function Element2(props, ref) {
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const [contextProps, contextRef] = useContextProps(
|
|
11
|
+
props,
|
|
12
|
+
ref,
|
|
13
|
+
ElementContext
|
|
14
|
+
);
|
|
15
|
+
const { as: El = "div", values, mergeValues, ...rest } = contextProps;
|
|
16
|
+
let children = /* @__PURE__ */ jsx(El, { ...rest, ref: contextRef });
|
|
13
17
|
if (mergeValues) {
|
|
14
18
|
children = /* @__PURE__ */ jsx(MergeProvider, { values: mergeValues, children });
|
|
15
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/element/index.tsx"],"names":["Element"],"mappings":";;;;;;;AAmBO,IAAM,cAAA,GACX,cAKE,IAAI;AASD,IAAM,OAAA,GAAU,UAAA,CAAW,SAASA,QAAAA,CAazC,OACA,GAAA,EACA;AACA,EAAA,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/element/index.tsx"],"names":["Element"],"mappings":";;;;;;;AAmBO,IAAM,cAAA,GACX,cAKE,IAAI;AASD,IAAM,OAAA,GAAU,UAAA,CAAW,SAASA,QAAAA,CAazC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,UAAU,CAAA,GAAI,eAAA;AAAA,IACjC,KAAA;AAAA,IACA,GAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,EAAE,IAAI,EAAA,GAAK,KAAA,EAAO,QAAQ,WAAA,EAAa,GAAG,MAAK,GAAI,YAAA;AAGzD,EAAA,IAAI,2BAAW,GAAA,CAAC,EAAA,EAAA,EAAI,GAAG,IAAA,EAAM,KAAK,UAAA,EAAY,CAAA;AAE9C,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,QAAA,mBAAW,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAQ,WAAA,EAAc,QAAA,EAAS,CAAA;AAAA,EAC3D;AAEA,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,QAAA,mBAAW,GAAA,CAAC,QAAA,EAAA,EAAS,MAAA,EAAiB,QAAA,EAAS,CAAA;AAAA,EACjD;AAEA,EAAA,OAAO,QAAA;AACT,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/** biome-ignore-all lint/suspicious/noExplicitAny: ElementProps is a unique case */\n\nimport { createContext, type ForwardedRef, forwardRef } from 'react';\nimport { type ContextValue, Provider } from 'react-aria-components';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { MergeProvider } from '../merge-provider';\nimport type { ElementProps } from './types';\n\nexport const ElementContext =\n createContext<\n ContextValue<\n ElementProps<any, any, any, any, any, any, any, any, any, any, any>,\n HTMLElement\n >\n >(null);\n\n/**\n * This generic component serves as any easy way for more complex components\n * to establish stylable content areas within their layout with optional\n * targeted contexts for any subcomponents\n *\n * See Dialog & Drawer as examples\n */\nexport const Element = forwardRef(function Element<\n A,\n B,\n C,\n D,\n E,\n F,\n G,\n H,\n I,\n J,\n K,\n>(\n props: ElementProps<A, B, C, D, E, F, G, H, I, J, K>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [contextProps, contextRef] = useContextProps(\n props,\n ref,\n ElementContext,\n );\n\n const { as: El = 'div', values, mergeValues, ...rest } = contextProps;\n\n // @ts-expect-error Can't narrow props type to match element or ref, making this less dynamic runs into union complexity and performance issues\n let children = <El {...rest} ref={contextRef} />;\n\n if (mergeValues) {\n children = <MergeProvider values={mergeValues}>{children}</MergeProvider>;\n }\n\n if (values) {\n children = <Provider values={values}>{children}</Provider>;\n }\n\n return children;\n});\n"]}
|
|
@@ -2,6 +2,8 @@ import { JSX, HTMLElementType } from 'react';
|
|
|
2
2
|
import { SlotProps } from 'react-aria-components';
|
|
3
3
|
import { ProviderValues } from '../../types/react-aria.js';
|
|
4
4
|
|
|
5
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: ElementProps is a special case */
|
|
6
|
+
|
|
5
7
|
type ElementProps<A = any, B = any, C = any, D = any, E = any, F = any, G = any, H = any, I = any, J = any, K = any> = /**
|
|
6
8
|
* Initially tried to make these props generic and constrain props to element
|
|
7
9
|
* passed into generic, but ran into major performance issues with enormous
|
|
@@ -9,12 +9,12 @@ import { groupClassNames, groupStateVars } from './group.css.js';
|
|
|
9
9
|
import { jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
var GroupContext = (
|
|
12
|
-
//
|
|
13
|
-
//
|
|
12
|
+
// Unfortunately, using "unknown" or "object" here creates complex type issues with <Provider />
|
|
13
|
+
// biome-ignore lint/suspicious/noExplicitAny: Legacy
|
|
14
14
|
createContext(null)
|
|
15
15
|
);
|
|
16
16
|
var Group = forwardRef(function Group2(props, ref) {
|
|
17
|
-
[
|
|
17
|
+
const [contextProps, contextRef] = useContextProps(props, ref, GroupContext);
|
|
18
18
|
const {
|
|
19
19
|
children: childrenProp,
|
|
20
20
|
classNames: classNamesProp,
|
|
@@ -22,7 +22,7 @@ var Group = forwardRef(function Group2(props, ref) {
|
|
|
22
22
|
orientation = "horizontal",
|
|
23
23
|
reverse = false,
|
|
24
24
|
values: valuesProp
|
|
25
|
-
} =
|
|
25
|
+
} = contextProps;
|
|
26
26
|
const theme = useTheme();
|
|
27
27
|
const classNames = useMemo(
|
|
28
28
|
() => mergeClassNames(groupClassNames, theme.Group, classNamesProp),
|
|
@@ -52,8 +52,8 @@ var Group = forwardRef(function Group2(props, ref) {
|
|
|
52
52
|
}, [childrenProp, orientation, reverse]);
|
|
53
53
|
const values = useMemo(() => [[context, valuesProp]], [context, valuesProp]);
|
|
54
54
|
const children = useMemo(
|
|
55
|
-
() => /* @__PURE__ */ jsx("div", { ref, className: classNames?.container, style, children: /* @__PURE__ */ jsx("div", { className: classNames?.group, children: childrenProp }) }),
|
|
56
|
-
[
|
|
55
|
+
() => /* @__PURE__ */ jsx("div", { ref: contextRef, className: classNames?.container, style, children: /* @__PURE__ */ jsx("div", { className: classNames?.group, children: childrenProp }) }),
|
|
56
|
+
[contextRef, classNames?.container, classNames?.group, style, childrenProp]
|
|
57
57
|
);
|
|
58
58
|
return context && valuesProp ? /* @__PURE__ */ jsx(MergeProvider, { values, children }) : children;
|
|
59
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/group/index.tsx"],"names":["Group","type"],"mappings":";;;;;;;;;;AA6BO,IAAM,YAAA;AAAA;AAAA;AAAA,EAGX,cAAsE,IAAI;AAAA;AAOrE,IAAM,KAAA,GAAQ,UAAA,CAAW,SAASA,MAAAA,CACvC,OACA,GAAA,EACA;AACA,EAAA,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/group/index.tsx"],"names":["Group","type"],"mappings":";;;;;;;;;;AA6BO,IAAM,YAAA;AAAA;AAAA;AAAA,EAGX,cAAsE,IAAI;AAAA;AAOrE,IAAM,KAAA,GAAQ,UAAA,CAAW,SAAS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AAA,EAAE,CAAE,KAAA,CAAM,IAAI,CAAA,IAAK,OAAA;AAEhE,IAAA,OAAO,WAAW,cAAA,EAAgB;AAAA,MAChC,KAAA,EAAO,QAAA,CAAS,KAAA,CAAM,YAAY,CAAA;AAAA,MAClC,WAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,YAAA,EAAc,WAAA,EAAa,OAAO,CAAC,CAAA;AAEvC,EAAA,MAAM,MAAA,GAAS,OAAA,CAGb,MAAM,CAAC,CAAC,OAAA,EAAU,UAAU,CAAC,CAAA,EAAG,CAAC,OAAA,EAAS,UAAU,CAAC,CAAA;AAEvD,EAAA,MAAM,QAAA,GAAW,OAAA;AAAA,IACf,sBACE,GAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAK,YAAY,SAAA,EAAW,UAAA,EAAY,SAAA,EAAW,KAAA,EACtD,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,UAAA,EAAY,KAAA,EAAQ,wBAAa,CAAA,EACnD,CAAA;AAAA,IAEF,CAAC,UAAA,EAAY,UAAA,EAAY,WAAW,UAAA,EAAY,KAAA,EAAO,OAAO,YAAY;AAAA,GAC5E;AAEA,EAAA,OAAO,WAAW,UAAA,mBAChB,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAiB,UAAS,CAAA,GAEzC,QAAA;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n Children,\n createContext,\n type ForwardedRef,\n forwardRef,\n type ReactElement,\n useMemo,\n} from 'react';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inlineVars } from '../../utils/css';\nimport { mergeClassNames } from '../../utils/props';\nimport { MergeProvider } from '../merge-provider';\nimport { groupClassNames, groupStateVars } from './group.css';\nimport type { ContextValue } from 'react-aria-components';\nimport type { GroupProps } from './types';\n\nexport const GroupContext =\n // Unfortunately, using \"unknown\" or \"object\" here creates complex type issues with <Provider />\n // biome-ignore lint/suspicious/noExplicitAny: Legacy\n createContext<ContextValue<GroupProps<any, Element>, HTMLDivElement>>(null);\n\n/**\n * This generic component allows for collective prop distribution to a collection of components of the same type\n *\n * @example A list of <Button />s and you want to control their size instead of passing the same props to each\n */\nexport const Group = forwardRef(function Group<T, E extends Element>(\n props: GroupProps<T, E>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(props, ref, GroupContext);\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n context,\n orientation = 'horizontal',\n reverse = false,\n values: valuesProp,\n } = contextProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(groupClassNames, theme.Group, classNamesProp),\n [theme.Group, classNamesProp],\n );\n\n const style = useMemo(() => {\n const types = Children.toArray(childrenProp).reduce<Set<string>>(\n (acc, child) => {\n if (\n child &&\n typeof child !== 'boolean' &&\n typeof child !== 'number' &&\n typeof child !== 'string'\n ) {\n const type = (child as ReactElement).type;\n // @ts-expect-error TS doesn't know about \"render\" type\n const name = typeof type !== 'string' ? type.render?.name : type;\n\n if (name) {\n acc.add(name);\n }\n }\n\n return acc;\n },\n new Set<string>(),\n );\n\n const type = { 0: 'Empty', 1: [...types].at(0) }[types.size] ?? 'Mixed';\n\n return inlineVars(groupStateVars, {\n count: Children.count(childrenProp),\n orientation,\n reverse,\n type,\n });\n }, [childrenProp, orientation, reverse]);\n\n const values = useMemo<\n [[Exclude<typeof context, undefined>, ContextValue<T, E>]]\n // biome-ignore lint/style/noNonNullAssertion: intentional\n >(() => [[context!, valuesProp]], [context, valuesProp]);\n\n const children = useMemo(\n () => (\n <div ref={contextRef} className={classNames?.container} style={style}>\n <div className={classNames?.group}>{childrenProp}</div>\n </div>\n ),\n [contextRef, classNames?.container, classNames?.group, style, childrenProp],\n );\n\n return context && valuesProp ? (\n <MergeProvider values={values}>{children}</MergeProvider>\n ) : (\n children\n );\n});\n"]}
|
|
@@ -10,8 +10,8 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
10
10
|
|
|
11
11
|
var IconContext = createContext(null);
|
|
12
12
|
var Icon = forwardRef(function Icon2(props, ref) {
|
|
13
|
-
[
|
|
14
|
-
|
|
13
|
+
const [contextProps, contextRef] = useContextProps(props, ref, IconContext);
|
|
14
|
+
const finalProps = useDefaultProps(contextProps, "Icon");
|
|
15
15
|
const {
|
|
16
16
|
children,
|
|
17
17
|
classNames: classNamesProp,
|
|
@@ -19,7 +19,7 @@ var Icon = forwardRef(function Icon2(props, ref) {
|
|
|
19
19
|
fill,
|
|
20
20
|
size = "relative",
|
|
21
21
|
stroke
|
|
22
|
-
} =
|
|
22
|
+
} = finalProps;
|
|
23
23
|
const theme = useTheme();
|
|
24
24
|
const classNames = useMemo(
|
|
25
25
|
() => mergeClassNames(iconClassNames, theme.Icon, classNamesProp),
|
|
@@ -34,7 +34,7 @@ var Icon = forwardRef(function Icon2(props, ref) {
|
|
|
34
34
|
}),
|
|
35
35
|
[color, fill, size, stroke]
|
|
36
36
|
);
|
|
37
|
-
return /* @__PURE__ */ jsx("div", { ref, className: classNames?.container, style, children: /* @__PURE__ */ jsx("div", { className: classNames?.icon, children }) });
|
|
37
|
+
return /* @__PURE__ */ jsx("div", { ref: contextRef, className: classNames?.container, style, children: /* @__PURE__ */ jsx("div", { className: classNames?.icon, children }) });
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
export { Icon, IconContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/icon/index.tsx"],"names":["Icon"],"mappings":";;;;;;;;;;AAsBO,IAAM,WAAA,GACX,cAAuD,IAAI;AAEtD,IAAM,IAAA,GAAO,UAAA,CAAW,SAASA,KAAAA,CACtC,OACA,GAAA,EACA;AACA,EAAA,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/icon/index.tsx"],"names":["Icon"],"mappings":";;;;;;;;;;AAsBO,IAAM,WAAA,GACX,cAAuD,IAAI;AAEtD,IAAM,IAAA,GAAO,UAAA,CAAW,SAASA,KAAAA,CACtC,OACA,GAAA,EACA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,UAAU,IAAI,eAAA,CAAgB,KAAA,EAAO,KAAK,WAAW,CAAA;AAE1E,EAAA,MAAM,UAAA,GAAa,eAAA,CAAgB,YAAA,EAAc,MAAM,CAAA;AAEvD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,UAAA,EAAY,cAAA;AAAA,IACZ,KAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA,GAAO,UAAA;AAAA,IACP;AAAA,GACF,GAAI,UAAA;AAEJ,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,cAAA,EAAgB,KAAA,CAAM,MAAM,cAAc,CAAA;AAAA,IAChE,CAAC,KAAA,CAAM,IAAA,EAAM,cAAc;AAAA,GAC7B;AAEA,EAAA,MAAM,KAAA,GAAQ,OAAA;AAAA,IACZ,MACE,WAAW,aAAA,EAAe;AAAA,MACxB,KAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACH,CAAC,KAAA,EAAO,IAAA,EAAM,IAAA,EAAM,MAAM;AAAA,GAC5B;AAEA,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAK,UAAA,EAAY,WAAW,UAAA,EAAY,SAAA,EAAW,KAAA,EACtD,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,UAAA,EAAY,IAAA,EAAO,UAAS,CAAA,EAC9C,CAAA;AAEJ,CAAC","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { createContext, type ForwardedRef, forwardRef, useMemo } from 'react';\nimport { useContextProps } from '../../hooks/use-context-props';\nimport { useDefaultProps } from '../../hooks/use-defaults';\nimport { useTheme } from '../../hooks/use-theme';\nimport { inlineVars } from '../../utils/css';\nimport { mergeClassNames } from '../../utils/props';\nimport { iconClassNames, iconStateVars } from './icon.css';\nimport type { ContextValue } from 'react-aria-components';\nimport type { IconProps } from './types';\n\nexport const IconContext =\n createContext<ContextValue<IconProps, HTMLDivElement>>(null);\n\nexport const Icon = forwardRef(function Icon(\n props: IconProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [contextProps, contextRef] = useContextProps(props, ref, IconContext);\n\n const finalProps = useDefaultProps(contextProps, 'Icon');\n\n const {\n children,\n classNames: classNamesProp,\n color,\n fill,\n size = 'relative',\n stroke,\n } = finalProps;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(iconClassNames, theme.Icon, classNamesProp),\n [theme.Icon, classNamesProp],\n );\n\n const style = useMemo(\n () =>\n inlineVars(iconStateVars, {\n color,\n fill,\n size,\n stroke,\n }),\n [color, fill, size, stroke],\n );\n\n return (\n <div ref={contextRef} className={classNames?.container} style={style}>\n <div className={classNames?.icon}>{children}</div>\n </div>\n );\n});\n"]}
|
|
@@ -1,107 +1,107 @@
|
|
|
1
1
|
export { AriaFieldError, AriaFieldErrorContext, AriaGroup, AriaGroupContext, AriaHeader, AriaHeaderContext, AriaHeading, AriaHeadingContext, AriaKeyboard, AriaKeyboardContext, AriaLabel, AriaLabelContext, AriaListBoxSection, AriaListBoxSectionContext, AriaMenuSection, AriaMenuSectionContext, AriaSection, AriaSectionContext, AriaSelectValue, AriaSelectValueContext, AriaSeparator, AriaSeparatorContext, AriaText, AriaTextContext } from './aria/index.js';
|
|
2
2
|
export { Button, ButtonContext, LinkButton, LinkButtonContext, ToggleButton, ToggleButtonContext } from './button/index.js';
|
|
3
3
|
export { buttonClassNames, buttonColorVars, buttonContainer, buttonSpaceVars, buttonStateVars } from './button/button.css.js';
|
|
4
|
-
export { ButtonClassNames, ButtonColors, ButtonMapping, ButtonProps, ButtonRenderProps, ButtonSizes, ButtonState, ButtonVariants, LinkButtonProps, ToggleButtonProps } from './button/types.js';
|
|
5
4
|
export { Checkbox, CheckboxContext, CheckboxGroup, CheckboxGroupContext } from './checkbox/index.js';
|
|
6
5
|
export { checkboxClassNames, checkboxColorVars, checkboxContainer, checkboxGroupContainer, checkboxGroupStateVars, checkboxSpaceVars, checkboxStateVars } from './checkbox/checkbox.css.js';
|
|
7
|
-
export { CheckboxAlignment, CheckboxClassNames, CheckboxGroupProps, CheckboxGroupRenderProps, CheckboxGroupState, CheckboxProps, CheckboxRenderProps, CheckboxState } from './checkbox/types.js';
|
|
8
6
|
export { Chip, ChipContext, ChipGroup, ChipGroupContext, ChipItem, ChipList } from './chip/index.js';
|
|
9
7
|
export { chipClassNames, chipColorVars, chipContainer, chipSpaceVars, chipStateVars } from './chip/chip.css.js';
|
|
10
|
-
export { ChipClassNames, ChipColors, ChipGroupProps, ChipItemProps, ChipListProps, ChipMapping, ChipProps, ChipRenderProps, ChipSizes, ChipState } from './chip/types.js';
|
|
11
8
|
export { createCollectionRenderer } from './collection/index.js';
|
|
12
9
|
export { ComboBox, ComboBoxContext } from './combo-box/index.js';
|
|
13
10
|
export { comboBoxClassNames, comboBoxColorVars, comboBoxContainer, comboBoxSpaceVars, comboBoxStateVars } from './combo-box/combo-box.css.js';
|
|
14
|
-
export { ComboBoxClassNames, ComboBoxMapping, ComboBoxProps, ComboBoxRenderProps, ComboBoxSizes, ComboBoxState } from './combo-box/types.js';
|
|
15
11
|
export { DateField } from './date-field/index.js';
|
|
16
12
|
export { dateFieldClassNames, dateFieldColorVars, dateFieldContainer, dateFieldSpaceVars, dateFieldStateVars } from './date-field/date-field.css.js';
|
|
17
|
-
export { DateFieldClassNames, DateFieldMapping, DateFieldProps, DateFieldRenderProps, DateFieldSizes, DateFieldState } from './date-field/types.js';
|
|
18
13
|
export { DateInput, DateInputContext, DateSegment, DateSegmentContext, DateSegments } from './date-input/index.js';
|
|
19
14
|
export { dateInputClassNames, dateInputColorVars, dateInputContainer, dateInputSpaceVars, dateInputStateVars, dateSegmentStateVars, dateSegmentsContainer } from './date-input/date-input.css.js';
|
|
20
|
-
export { DateInputClassNames, DateInputMapping, DateInputProps, DateInputRenderProps, DateInputSizes, DateInputState, DateSegmentProps, DateSegmentRenderProps, DateSegmentState, DateSegmentsProps } from './date-input/types.js';
|
|
21
15
|
export { Dialog, DialogContext } from './dialog/index.js';
|
|
22
16
|
export { dialogClassNames, dialogColorVars, dialogContainer, dialogSpaceVars, dialogStateVars } from './dialog/dialog.css.js';
|
|
23
|
-
export { DialogClassNames, DialogMapping, DialogProps, DialogRenderProps, DialogSizes, DialogState } from './dialog/types.js';
|
|
24
17
|
export { Drawer, DrawerDialog, DrawerDialogContext, DrawerTab, DrawerTabList } from './drawer/index.js';
|
|
25
18
|
export { drawerAnimationVars, drawerClassNames, drawerColorVars, drawerContainer, drawerDialogStateVars, drawerSpaceVars, drawerStateVars } from './drawer/drawer.css.js';
|
|
26
|
-
export { DrawerAnchor, DrawerClassNames, DrawerDialogProps, DrawerDialogState, DrawerMapping, DrawerProps, DrawerRenderProps, DrawerState, DrawerTabListProps, DrawerTabProps, DrawerTabRenderProps } from './drawer/types.js';
|
|
27
19
|
export { Element, ElementContext } from './element/index.js';
|
|
28
|
-
export { ElementProps } from './element/types.js';
|
|
29
20
|
export { Group, GroupContext } from './group/index.js';
|
|
30
21
|
export { groupClassNames, groupContainer, groupSpaceVars, groupStateVars } from './group/group.css.js';
|
|
31
|
-
export { GroupClassNames, GroupProps, GroupState } from './group/types.js';
|
|
32
22
|
export { Icon, IconContext } from './icon/index.js';
|
|
33
23
|
export { iconClassNames, iconColorVars, iconContainer, iconSpaceVars, iconStateVars } from './icon/icon.css.js';
|
|
34
|
-
export { IconClassNames, IconProps, IconSizes, IconState } from './icon/types.js';
|
|
35
24
|
export { Input, InputContext } from './input/index.js';
|
|
36
25
|
export { inputClassNames, inputColorVars, inputContainer, inputSpaceVars, inputStateVars } from './input/input.css.js';
|
|
37
|
-
export { InputClassNames, InputMapping, InputProps, InputRenderProps, InputState, InputType } from './input/types.js';
|
|
38
26
|
export { Menu, MenuContext, MenuItem, MenuItemContext, MenuList, MenuListContext } from './menu/index.js';
|
|
39
27
|
export { menuClassNames, menuColorVars, menuContainers, menuItemStateVars, menuSpaceVars, menuStateVars } from './menu/menu.css.js';
|
|
40
|
-
export { MenuClassNames, MenuItemProps, MenuItemRenderProps, MenuItemState, MenuListProps, MenuMapping, MenuProps, MenuRenderProps, MenuSizes, MenuState } from './menu/types.js';
|
|
41
28
|
export { MergeProvider } from './merge-provider/index.js';
|
|
42
|
-
export { MergeProviderProps } from './merge-provider/types.js';
|
|
43
29
|
export { NumberField, NumberFieldContext } from './number-field/index.js';
|
|
44
30
|
export { numberFieldClassNames, numberFieldColorVars, numberFieldContainer, numberFieldSpaceVars, numberFieldStateVars } from './number-field/number-field.css.js';
|
|
45
|
-
export { NumberFieldClassNames, NumberFieldMapping, NumberFieldProps, NumberFieldRenderProps, NumberFieldSizes, NumberFieldState } from './number-field/types.js';
|
|
46
31
|
export { Options, OptionsContext, OptionsItem, OptionsItemContext, OptionsList, OptionsListContext } from './options/index.js';
|
|
47
32
|
export { optionsClassNames, optionsColorVars, optionsContainers, optionsItemStateVars, optionsListStateVars, optionsSpaceVars, optionsStateVars } from './options/options.css.js';
|
|
48
|
-
export { OptionsClassNames, OptionsItemProps, OptionsItemRenderProps, OptionsItemState, OptionsListProps, OptionsListRenderProps, OptionsListState, OptionsMapping, OptionsProps, OptionsRenderProps, OptionsSizes, OptionsState } from './options/types.js';
|
|
49
33
|
export { Picker, PickerContext, PickerItem, PickerItemContext } from './picker/index.js';
|
|
50
34
|
export { pickerClassNames, pickerContainers, pickerItemColorVars, pickerItemStateVars, pickerSpaceVars, pickerStateVars } from './picker/picker.css.js';
|
|
51
|
-
export { PickerClassNames, PickerItemProps, PickerItemRenderProps, PickerItemState, PickerProps, PickerState } from './picker/types.js';
|
|
52
35
|
export { Popover, PopoverContext } from './popover/index.js';
|
|
53
36
|
export { popoverClassNames, popoverColorVars, popoverContainer, popoverSpaceVars, popoverStateVars } from './popover/popover.css.js';
|
|
54
|
-
export { PopoverClassNames, PopoverProps, PopoverRenderProps, PopoverState } from './popover/types.js';
|
|
55
37
|
export { QueryBuilder } from './query-builder/index.js';
|
|
56
38
|
export { QueryBuilderContext } from './query-builder/constants.js';
|
|
57
39
|
export { queryBuilderClassNames, queryBuilderColorVars, queryBuilderContainers, queryBuilderGroupStateVars, queryBuilderRuleStateVars, queryBuilderSpaceVars, queryBuilderStateVars } from './query-builder/query-builder.css.js';
|
|
58
|
-
export { QueryBuilderClassNames, QueryBuilderContextValue, QueryBuilderGroupState, QueryBuilderMapping, QueryBuilderProps, QueryBuilderRuleState, QueryBuilderSizes, QueryBuilderState, QueryBuilderValueEditors } from './query-builder/types.js';
|
|
59
40
|
export { pressToMouseEvent } from './query-builder/utils.js';
|
|
60
41
|
export { Radio, RadioContext, RadioGroup, RadioGroupContext } from './radio/index.js';
|
|
61
42
|
export { radioClassNames, radioColorVars, radioGroupStateVars, radioSpaceVars, radioStateVars } from './radio/radio.css.js';
|
|
62
|
-
export { RadioAlignment, RadioClassNames, RadioContextProps, RadioGroupProps, RadioGroupRenderProps, RadioGroupState, RadioProps, RadioRenderProps, RadioState } from './radio/types.js';
|
|
63
43
|
export { SearchField, SearchFieldContext } from './search-field/index.js';
|
|
64
44
|
export { searchFieldClassNames, searchFieldContainer, searchFieldSpaceVars, searchFieldStateVars } from './search-field/search-field.css.js';
|
|
65
|
-
export { SearchFieldClassNames, SearchFieldMapping, SearchFieldProps, SearchFieldRenderProps, SearchFieldState } from './search-field/types.js';
|
|
66
45
|
export { Select, SelectContext } from './select/index.js';
|
|
67
46
|
export { selectClassNames, selectColorVars, selectContainer, selectSpaceVars, selectStateVars } from './select/select.css.js';
|
|
68
|
-
export { SelectClassNames, SelectMapping, SelectProps, SelectRenderProps, SelectSizes, SelectState } from './select/types.js';
|
|
69
47
|
export { Slider, SliderBar, SliderBarContext, SliderContext, SliderOutput, SliderOutputContext, SliderThumb, SliderThumbContext, SliderTrack, SliderTrackContext } from './slider/index.js';
|
|
70
48
|
export { sliderClassNames, sliderColorVars, sliderSpaceVars, sliderStateVars, sliderThumbStateVars, sliderTrackStateVars } from './slider/slider.css.js';
|
|
71
|
-
export { SliderBarProps, SliderClassNames, SliderInputProps, SliderLayout, SliderOutputProps, SliderProps, SliderRenderProps, SliderState, SliderThumbProps, SliderThumbRenderProps, SliderThumbState, SliderTrackProps, SliderTrackRenderProps } from './slider/types.js';
|
|
72
49
|
export { Switch, SwitchContext } from './switch/index.js';
|
|
73
50
|
export { switchClassNames, switchColorVars, switchContainer, switchSpaceVars, switchStateVars } from './switch/switch.css.js';
|
|
74
|
-
export { SwitchAlignment, SwitchClassNames, SwitchProps, SwitchRenderProps, SwitchState } from './switch/types.js';
|
|
75
51
|
export { Tab, TabContext, TabList, TabListContext, TabPanel, TabPanelContext, TabPanels, TabPanelsContext, Tabs, TabsContext } from './tabs/index.js';
|
|
76
52
|
export { tabColorVars, tabListStateVars, tabPanelStateVars, tabPanelsStateVars, tabSpaceVars, tabStateVars, tabsClassNames, tabsContainers } from './tabs/tabs.css.js';
|
|
77
|
-
export { TabListAlignment, TabListAnchor, TabListProps, TabListState, TabListVariants, TabPanelProps, TabPanelRenderProps, TabPanelState, TabPanelsProps, TabPanelsState, TabProps, TabRenderProps, TabState, TabsClassNames, TabsProps } from './tabs/types.js';
|
|
78
53
|
export { TextField, TextFieldContext } from './text-field/index.js';
|
|
79
54
|
export { textFieldClassNames, textFieldColorVars, textFieldContainer, textFieldSpaceVars, textFieldStateVars } from './text-field/text-field.css.js';
|
|
80
|
-
export { TextFieldClassNames, TextFieldMapping, TextFieldProps, TextFieldSizes, TextFieldState } from './text-field/types.js';
|
|
81
55
|
export { TextArea, TextAreaContext } from './textarea/index.js';
|
|
82
56
|
export { textAreaClassNames, textAreaColorVars, textAreaContainer, textAreaSpaceVars, textAreaStateVars } from './textarea/textarea.css.js';
|
|
83
|
-
export { TextAreaClassNames, TextAreaProps, TextAreaRenderProps, TextAreaState } from './textarea/types.js';
|
|
84
57
|
export { TimeField, TimeFieldContext } from './time-field/index.js';
|
|
85
58
|
export { timeFieldClassNames, timeFieldColorVars, timeFieldContainer, timeFieldSpaceVars, timeFieldStateVars } from './time-field/time-field.css.js';
|
|
86
|
-
export { TimeFieldClassNames, TimeFieldMapping, TimeFieldProps, TimeFieldRenderProps, TimeFieldSizes, TimeFieldState } from './time-field/types.js';
|
|
87
59
|
export { Tooltip, TooltipContext, TooltipTarget, TooltipTargetContext } from './tooltip/index.js';
|
|
88
60
|
export { tooltipClassNames, tooltipContainers, tooltipSpaceVars, tooltipStateVars, tooltipTargetStateVars } from './tooltip/tooltip.css.js';
|
|
89
|
-
export { TooltipClassNames, TooltipMapping, TooltipProps, TooltipRenderProps, TooltipState, TooltipTargetProps, TooltipTargetState } from './tooltip/types.js';
|
|
90
61
|
export { Tree, TreeGroup, TreeItem, TreeStateContext } from './tree/index.js';
|
|
91
62
|
export { treeClassNames, treeColorVars, treeContainers, treeGroupStateVars, treeIndicatorStateVars, treeItemStateVars, treeSpaceVars, treeStateVars } from './tree/tree.css.js';
|
|
63
|
+
export { ButtonClassNames, ButtonColors, ButtonMapping, ButtonProps, ButtonRenderProps, ButtonSizes, ButtonState, ButtonVariants, LinkButtonProps, ToggleButtonProps } from './button/types.js';
|
|
64
|
+
export { CheckboxAlignment, CheckboxClassNames, CheckboxGroupProps, CheckboxGroupRenderProps, CheckboxGroupState, CheckboxProps, CheckboxRenderProps, CheckboxState } from './checkbox/types.js';
|
|
65
|
+
export { ChipClassNames, ChipColors, ChipGroupProps, ChipItemProps, ChipListProps, ChipMapping, ChipProps, ChipRenderProps, ChipSizes, ChipState } from './chip/types.js';
|
|
66
|
+
export { ComboBoxClassNames, ComboBoxMapping, ComboBoxProps, ComboBoxRenderProps, ComboBoxSizes, ComboBoxState } from './combo-box/types.js';
|
|
67
|
+
export { DateFieldClassNames, DateFieldMapping, DateFieldProps, DateFieldRenderProps, DateFieldSizes, DateFieldState } from './date-field/types.js';
|
|
68
|
+
export { DateInputClassNames, DateInputMapping, DateInputProps, DateInputRenderProps, DateInputSizes, DateInputState, DateSegmentProps, DateSegmentRenderProps, DateSegmentState, DateSegmentsProps } from './date-input/types.js';
|
|
69
|
+
export { DialogClassNames, DialogMapping, DialogProps, DialogRenderProps, DialogSizes, DialogState } from './dialog/types.js';
|
|
70
|
+
export { DrawerAnchor, DrawerClassNames, DrawerDialogProps, DrawerDialogState, DrawerMapping, DrawerProps, DrawerRenderProps, DrawerState, DrawerTabListProps, DrawerTabProps, DrawerTabRenderProps } from './drawer/types.js';
|
|
71
|
+
export { ElementProps } from './element/types.js';
|
|
72
|
+
export { GroupClassNames, GroupProps, GroupState } from './group/types.js';
|
|
73
|
+
export { IconClassNames, IconProps, IconSizes, IconState } from './icon/types.js';
|
|
74
|
+
export { InputClassNames, InputMapping, InputProps, InputRenderProps, InputState, InputType } from './input/types.js';
|
|
75
|
+
export { MenuClassNames, MenuItemProps, MenuItemRenderProps, MenuItemState, MenuListProps, MenuMapping, MenuProps, MenuRenderProps, MenuSizes, MenuState } from './menu/types.js';
|
|
76
|
+
export { MergeProviderProps } from './merge-provider/types.js';
|
|
77
|
+
export { NumberFieldClassNames, NumberFieldMapping, NumberFieldProps, NumberFieldRenderProps, NumberFieldSizes, NumberFieldState } from './number-field/types.js';
|
|
78
|
+
export { OptionsClassNames, OptionsItemProps, OptionsItemRenderProps, OptionsItemState, OptionsListProps, OptionsListRenderProps, OptionsListState, OptionsMapping, OptionsProps, OptionsRenderProps, OptionsSizes, OptionsState } from './options/types.js';
|
|
79
|
+
export { PickerClassNames, PickerItemProps, PickerItemRenderProps, PickerItemState, PickerProps, PickerState } from './picker/types.js';
|
|
80
|
+
export { PopoverClassNames, PopoverProps, PopoverRenderProps, PopoverState } from './popover/types.js';
|
|
81
|
+
export { QueryBuilderClassNames, QueryBuilderContextValue, QueryBuilderGroupState, QueryBuilderMapping, QueryBuilderProps, QueryBuilderRuleState, QueryBuilderSizes, QueryBuilderState, QueryBuilderValueEditors } from './query-builder/types.js';
|
|
82
|
+
export { RadioAlignment, RadioClassNames, RadioContextProps, RadioGroupProps, RadioGroupRenderProps, RadioGroupState, RadioProps, RadioRenderProps, RadioState } from './radio/types.js';
|
|
83
|
+
export { SearchFieldClassNames, SearchFieldMapping, SearchFieldProps, SearchFieldRenderProps, SearchFieldState } from './search-field/types.js';
|
|
84
|
+
export { SelectClassNames, SelectMapping, SelectProps, SelectRenderProps, SelectSizes, SelectState } from './select/types.js';
|
|
85
|
+
export { SliderBarProps, SliderClassNames, SliderInputProps, SliderLayout, SliderOutputProps, SliderProps, SliderRenderProps, SliderState, SliderThumbProps, SliderThumbRenderProps, SliderThumbState, SliderTrackProps, SliderTrackRenderProps } from './slider/types.js';
|
|
86
|
+
export { SwitchAlignment, SwitchClassNames, SwitchProps, SwitchRenderProps, SwitchState } from './switch/types.js';
|
|
87
|
+
export { TabListAlignment, TabListAnchor, TabListProps, TabListState, TabListVariants, TabPanelProps, TabPanelRenderProps, TabPanelState, TabPanelsProps, TabPanelsState, TabProps, TabRenderProps, TabState, TabsClassNames, TabsProps } from './tabs/types.js';
|
|
88
|
+
export { TextFieldClassNames, TextFieldMapping, TextFieldProps, TextFieldSizes, TextFieldState } from './text-field/types.js';
|
|
89
|
+
export { TextAreaClassNames, TextAreaProps, TextAreaRenderProps, TextAreaState } from './textarea/types.js';
|
|
90
|
+
export { TimeFieldClassNames, TimeFieldMapping, TimeFieldProps, TimeFieldRenderProps, TimeFieldSizes, TimeFieldState } from './time-field/types.js';
|
|
91
|
+
export { TooltipClassNames, TooltipMapping, TooltipProps, TooltipRenderProps, TooltipState, TooltipTargetProps, TooltipTargetState } from './tooltip/types.js';
|
|
92
92
|
export { TreeClassNames, TreeGroupProps, TreeGroupRenderProps, TreeGroupState, TreeIndicatorRenderProps, TreeIndicatorState, TreeItemProps, TreeItemRenderProps, TreeItemState, TreeMapping, TreeProps, TreeRenderProps, TreeSizes, TreeState, TreeStateContextValue } from './tree/types.js';
|
|
93
93
|
import 'react';
|
|
94
94
|
import 'react-aria-components';
|
|
95
95
|
import '../types/react-aria.js';
|
|
96
|
-
import '../types/props.js';
|
|
97
96
|
import '@react-types/shared';
|
|
98
|
-
import 'type-fest';
|
|
99
97
|
import 'react/jsx-runtime';
|
|
100
|
-
import '../types/generic.js';
|
|
101
98
|
import '@react-stately/datepicker';
|
|
102
|
-
import '@react-aria/overlays';
|
|
103
|
-
import '@react-stately/overlays';
|
|
104
99
|
import 'react-querybuilder';
|
|
100
|
+
import 'type-fest';
|
|
105
101
|
import '@react-aria/datepicker';
|
|
102
|
+
import '../types/props.js';
|
|
103
|
+
import '../types/generic.js';
|
|
104
|
+
import '@react-aria/overlays';
|
|
105
|
+
import '@react-stately/overlays';
|
|
106
106
|
import '../types/use-tree.js';
|
|
107
107
|
import '@react-stately/data';
|
|
@@ -25,11 +25,19 @@ var defaultMapping = {
|
|
|
25
25
|
};
|
|
26
26
|
var InputContext = createContext(null);
|
|
27
27
|
var Input = forwardRef(function Input2(props, ref) {
|
|
28
|
-
[
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const [contextProps1, contextRef1] = useContextProps(
|
|
29
|
+
props,
|
|
30
|
+
ref,
|
|
31
|
+
InputContext$1
|
|
32
|
+
);
|
|
33
|
+
contextProps1.className = void 0;
|
|
34
|
+
contextProps1.style = void 0;
|
|
35
|
+
const [contextProps2, contextRef2] = useContextProps(
|
|
36
|
+
contextProps1,
|
|
37
|
+
contextRef1,
|
|
38
|
+
InputContext
|
|
39
|
+
);
|
|
40
|
+
const defaultProps = useDefaultProps(contextProps2, "Input");
|
|
33
41
|
const {
|
|
34
42
|
classNames: classNamesProp,
|
|
35
43
|
defaultValue = "",
|
|
@@ -47,14 +55,14 @@ var Input = forwardRef(function Input2(props, ref) {
|
|
|
47
55
|
onHoverEnd,
|
|
48
56
|
"aria-invalid": ariaInvalid,
|
|
49
57
|
...rest
|
|
50
|
-
} =
|
|
58
|
+
} = defaultProps;
|
|
51
59
|
const [value, setValue] = useControlledState(valueProp, defaultValue);
|
|
52
60
|
const length = (`${value ?? ""}`.length || placeholder?.length) ?? 0;
|
|
53
61
|
const isInvalid = !!ariaInvalid && ariaInvalid !== "false";
|
|
54
62
|
const isPlaceholder = !!placeholder && !value;
|
|
55
63
|
const isEmpty = !value;
|
|
56
64
|
const { isFocused, isFocusVisible, focusProps } = useFocusRing({
|
|
57
|
-
autoFocus:
|
|
65
|
+
autoFocus: defaultProps.autoFocus,
|
|
58
66
|
isTextInput: true
|
|
59
67
|
});
|
|
60
68
|
const { hoverProps, isHovered } = useHover({
|
|
@@ -80,6 +88,7 @@ var Input = forwardRef(function Input2(props, ref) {
|
|
|
80
88
|
);
|
|
81
89
|
const mergedProps = useMemo(
|
|
82
90
|
() => mergeProps(rest, focusProps, hoverProps),
|
|
91
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: TODO: Verify this dependency array is correct.
|
|
83
92
|
[focusProps, hoverProps, rest]
|
|
84
93
|
);
|
|
85
94
|
const style = useMemo(
|
|
@@ -125,7 +134,7 @@ var Input = forwardRef(function Input2(props, ref) {
|
|
|
125
134
|
"input",
|
|
126
135
|
{
|
|
127
136
|
...mergedProps,
|
|
128
|
-
ref,
|
|
137
|
+
ref: contextRef2,
|
|
129
138
|
className: classNames?.input,
|
|
130
139
|
disabled: isDisabled,
|
|
131
140
|
placeholder,
|