@wix/site-ui 1.30.0 → 1.32.0
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/1268.js +99 -0
- package/dist/1279.js +7 -0
- package/dist/1457.js +10 -0
- package/dist/1477.js +106 -0
- package/dist/1500.js +111 -0
- package/dist/167.js +6 -0
- package/dist/2274.js +34 -0
- package/dist/2287.js +17 -0
- package/dist/2418.js +31 -0
- package/dist/2801.js +20 -0
- package/dist/285.js +86 -0
- package/dist/2861.js +6 -0
- package/dist/3020.js +7 -0
- package/dist/3021.js +72 -0
- package/dist/3056.js +229 -0
- package/dist/3140.js +4 -0
- package/dist/3248.js +307 -0
- package/dist/3296.js +4 -0
- package/dist/3319.js +400 -0
- package/dist/3395.js +4 -0
- package/dist/3485.js +854 -0
- package/dist/353.js +14 -0
- package/dist/3670.js +418 -0
- package/dist/3829.js +113 -0
- package/dist/4026.js +12 -0
- package/dist/4143.js +46 -0
- package/dist/42.js +32 -0
- package/dist/4281.js +30 -0
- package/dist/4346.js +2 -0
- package/dist/4388.js +418 -0
- package/dist/4490.js +32 -0
- package/dist/4495.js +9 -0
- package/dist/4549.js +24 -0
- package/dist/4586.js +41 -0
- package/dist/4586.js.LICENSE.txt +19 -0
- package/dist/4707.js +19 -0
- package/dist/4723.js +7 -0
- package/dist/4745.js +7 -0
- package/dist/4768.js +35 -0
- package/dist/4922.js +15 -0
- package/dist/5036.js +17 -0
- package/dist/5085.js +20 -0
- package/dist/5299.js +597 -0
- package/dist/5659.js +4 -0
- package/dist/5778.js +10 -0
- package/dist/5864.js +86 -0
- package/dist/5992.js +913 -0
- package/dist/5992.js.LICENSE.txt +19 -0
- package/dist/6003.js +10 -0
- package/dist/6046.js +29 -0
- package/dist/6089.js +2355 -0
- package/dist/6107.js +10 -0
- package/dist/6247.js +20 -0
- package/dist/6270.js +487 -0
- package/dist/6329.js +32 -0
- package/dist/6330.js +30 -0
- package/dist/6499.js +7 -0
- package/dist/6535.js +71 -0
- package/dist/6588.js +382 -0
- package/dist/6706.js +16 -0
- package/dist/6825.js +7 -0
- package/dist/6882.js +1562 -0
- package/dist/6914.js +30 -0
- package/dist/7021.js +13 -0
- package/dist/7366.js +83 -0
- package/dist/7373.js +25 -0
- package/dist/7541.js +25 -0
- package/dist/7564.js +10 -0
- package/dist/7642.js +20 -0
- package/dist/7725.js +10 -0
- package/dist/7871.js +38 -0
- package/dist/8052.js +352 -0
- package/dist/8106.js +238 -0
- package/dist/8171.js +346 -0
- package/dist/8225.js +21 -0
- package/dist/8272.js +333 -0
- package/dist/8527.js +58 -0
- package/dist/8724.js +10 -0
- package/dist/8750.js +1920 -0
- package/dist/8758.js +43 -0
- package/dist/880.js +149 -0
- package/dist/8935.js +8 -0
- package/dist/8960.js +22 -0
- package/dist/8971.js +40 -0
- package/dist/8979.js +10 -0
- package/dist/8996.js +71 -0
- package/dist/904.js +121 -0
- package/dist/9048.js +52 -0
- package/dist/9087.js +256 -0
- package/dist/9189.js +158 -0
- package/dist/9255.js +136 -0
- package/dist/9352.js +148 -0
- package/dist/951.js +22 -0
- package/dist/9635.js +22 -0
- package/dist/9829.js +4 -0
- package/dist/9863.js +8 -0
- package/dist/Accordion/index.d.ts +569 -12
- package/dist/Accordion/index.js +423 -8
- package/dist/AlertDialog/index.d.ts +1417 -18
- package/dist/AlertDialog/index.js +34 -14
- package/dist/Autocomplete/index.d.ts +1861 -38
- package/dist/Autocomplete/index.js +98 -24
- package/dist/Avatar/index.d.ts +129 -7
- package/dist/Avatar/index.js +149 -6
- package/dist/Breadcrumbs/index.d.ts +960 -7
- package/dist/Breadcrumbs/index.js +5 -5
- package/dist/Button/index.d.ts +88 -6
- package/dist/Button/index.js +27 -3
- package/dist/Checkbox/index.d.ts +425 -5
- package/dist/Checkbox/index.js +45 -5
- package/dist/CheckboxGroup/index.d.ts +318 -3
- package/dist/CheckboxGroup/index.js +166 -3
- package/dist/Collapsible/index.d.ts +377 -7
- package/dist/Collapsible/index.js +160 -6
- package/dist/Combobox/index.d.ts +1984 -48
- package/dist/Combobox/index.js +352 -29
- package/dist/ContextMenu/index.d.ts +2340 -36
- package/dist/ContextMenu/index.js +197 -22
- package/dist/Dialog/index.d.ts +1355 -18
- package/dist/Dialog/index.js +16 -14
- package/dist/Drawer/index.d.ts +1653 -18
- package/dist/Drawer/index.js +2797 -20
- package/dist/Field/index.d.ts +655 -15
- package/dist/Field/index.js +677 -10
- package/dist/Fieldset/index.d.ts +94 -5
- package/dist/Fieldset/index.js +68 -5
- package/dist/Form/index.d.ts +331 -2
- package/dist/Form/index.js +106 -3
- package/dist/Input/index.d.ts +692 -3
- package/dist/Input/index.js +10 -3
- package/dist/Menu/index.d.ts +2301 -36
- package/dist/Menu/index.js +365 -26
- package/dist/Menubar/index.d.ts +2301 -3
- package/dist/Menubar/index.js +105 -3
- package/dist/Meter/index.d.ts +175 -11
- package/dist/Meter/index.js +129 -9
- package/dist/NavigationMenu/index.d.ts +978 -28
- package/dist/NavigationMenu/index.js +1034 -17
- package/dist/NumberField/index.d.ts +612 -15
- package/dist/NumberField/index.js +1409 -11
- package/dist/Popover/index.d.ts +1655 -20
- package/dist/Popover/index.js +792 -17
- package/dist/PreviewCard/index.d.ts +1523 -14
- package/dist/PreviewCard/index.js +679 -14
- package/dist/Progress/index.d.ts +183 -11
- package/dist/Progress/index.js +181 -9
- package/dist/Radio/index.d.ts +185 -6
- package/dist/Radio/index.js +253 -6
- package/dist/RadioGroup/index.d.ts +341 -2
- package/dist/RadioGroup/index.js +154 -3
- package/dist/ScrollArea/index.d.ts +265 -13
- package/dist/ScrollArea/index.js +892 -10
- package/dist/Select/index.d.ts +1493 -38
- package/dist/Select/index.js +1824 -23
- package/dist/Separator/index.d.ts +80 -6
- package/dist/Separator/index.js +3 -3
- package/dist/Slider/index.d.ts +678 -16
- package/dist/Slider/index.js +1199 -11
- package/dist/Switch/index.d.ts +393 -5
- package/dist/Switch/index.js +208 -6
- package/dist/Tabs/index.d.ts +523 -12
- package/dist/Tabs/index.js +685 -9
- package/dist/Toggle/index.d.ts +305 -2
- package/dist/Toggle/index.js +76 -3
- package/dist/ToggleGroup/index.d.ts +316 -2
- package/dist/ToggleGroup/index.js +102 -3
- package/dist/Toolbar/index.d.ts +282 -13
- package/dist/Toolbar/index.js +230 -9
- package/dist/Tooltip/index.d.ts +1572 -14
- package/dist/Tooltip/index.js +965 -14
- package/dist/index.d.ts +12749 -652
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
package/dist/Menubar/index.js
CHANGED
|
@@ -1,11 +1,113 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Menubar } from "@base-ui/react/menubar";
|
|
3
2
|
import clsx from "clsx";
|
|
3
|
+
import { useBaseUiId } from "../6046.js";
|
|
4
|
+
import { MenubarContext, useMenubarContext } from "../7564.js";
|
|
5
|
+
import { FloatingTree, FloatingNode, useFloatingTree, useFloatingNodeId } from "../285.js";
|
|
6
|
+
import { CompositeRoot } from "../9087.js";
|
|
4
7
|
import * as __rspack_external_react from "react";
|
|
8
|
+
let MenubarDataAttributes_MenubarDataAttributes = /*#__PURE__*/ function(MenubarDataAttributes) {
|
|
9
|
+
MenubarDataAttributes["modal"] = "data-modal";
|
|
10
|
+
MenubarDataAttributes["orientation"] = "data-orientation";
|
|
11
|
+
MenubarDataAttributes["hasSubmenuOpen"] = "data-has-submenu-open";
|
|
12
|
+
return MenubarDataAttributes;
|
|
13
|
+
}({});
|
|
14
|
+
const menubarStateAttributesMapping = {
|
|
15
|
+
hasSubmenuOpen (value) {
|
|
16
|
+
return value ? {
|
|
17
|
+
[MenubarDataAttributes_MenubarDataAttributes.hasSubmenuOpen]: ''
|
|
18
|
+
} : null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const Menubar_Menubar = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
22
|
+
const { orientation = 'horizontal', loopFocus = true, render, className, modal = true, disabled = false, id: idProp, style, ...elementProps } = props;
|
|
23
|
+
const [contentElement, setContentElement] = __rspack_external_react.useState(null);
|
|
24
|
+
const [hasSubmenuOpen, setHasSubmenuOpen] = __rspack_external_react.useState(false);
|
|
25
|
+
const id = useBaseUiId(idProp);
|
|
26
|
+
const state = {
|
|
27
|
+
orientation,
|
|
28
|
+
modal,
|
|
29
|
+
hasSubmenuOpen
|
|
30
|
+
};
|
|
31
|
+
const contentRef = __rspack_external_react.useRef(null);
|
|
32
|
+
const allowMouseUpTriggerRef = __rspack_external_react.useRef(false);
|
|
33
|
+
const context = __rspack_external_react.useMemo(()=>({
|
|
34
|
+
contentElement,
|
|
35
|
+
setContentElement,
|
|
36
|
+
setHasSubmenuOpen,
|
|
37
|
+
hasSubmenuOpen,
|
|
38
|
+
modal,
|
|
39
|
+
disabled,
|
|
40
|
+
orientation,
|
|
41
|
+
allowMouseUpTriggerRef,
|
|
42
|
+
rootId: id
|
|
43
|
+
}), [
|
|
44
|
+
contentElement,
|
|
45
|
+
hasSubmenuOpen,
|
|
46
|
+
modal,
|
|
47
|
+
disabled,
|
|
48
|
+
orientation,
|
|
49
|
+
id
|
|
50
|
+
]);
|
|
51
|
+
return /*#__PURE__*/ jsx(MenubarContext.Provider, {
|
|
52
|
+
value: context,
|
|
53
|
+
children: /*#__PURE__*/ jsx(FloatingTree, {
|
|
54
|
+
children: /*#__PURE__*/ jsx(MenubarContent, {
|
|
55
|
+
children: /*#__PURE__*/ jsx(CompositeRoot, {
|
|
56
|
+
render: render,
|
|
57
|
+
className: className,
|
|
58
|
+
style: style,
|
|
59
|
+
state: state,
|
|
60
|
+
stateAttributesMapping: menubarStateAttributesMapping,
|
|
61
|
+
refs: [
|
|
62
|
+
forwardedRef,
|
|
63
|
+
setContentElement,
|
|
64
|
+
contentRef
|
|
65
|
+
],
|
|
66
|
+
props: [
|
|
67
|
+
{
|
|
68
|
+
role: 'menubar',
|
|
69
|
+
id
|
|
70
|
+
},
|
|
71
|
+
elementProps
|
|
72
|
+
],
|
|
73
|
+
orientation: orientation,
|
|
74
|
+
loopFocus: loopFocus,
|
|
75
|
+
highlightItemOnHover: hasSubmenuOpen
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
if ("production" !== process.env.NODE_ENV) Menubar_Menubar.displayName = "Menubar";
|
|
82
|
+
function MenubarContent(props) {
|
|
83
|
+
const nodeId = useFloatingNodeId();
|
|
84
|
+
const { events: menuEvents } = useFloatingTree();
|
|
85
|
+
const rootContext = useMenubarContext();
|
|
86
|
+
__rspack_external_react.useEffect(()=>{
|
|
87
|
+
function onSubmenuOpenChange(details) {
|
|
88
|
+
if (!details.nodeId || details.parentNodeId !== nodeId) return;
|
|
89
|
+
if (details.open) {
|
|
90
|
+
if (!rootContext.hasSubmenuOpen) rootContext.setHasSubmenuOpen(true);
|
|
91
|
+
} else if ('sibling-open' !== details.reason && 'list-navigation' !== details.reason) rootContext.setHasSubmenuOpen(false);
|
|
92
|
+
}
|
|
93
|
+
menuEvents.on('menuopenchange', onSubmenuOpenChange);
|
|
94
|
+
return ()=>{
|
|
95
|
+
menuEvents.off('menuopenchange', onSubmenuOpenChange);
|
|
96
|
+
};
|
|
97
|
+
}, [
|
|
98
|
+
menuEvents,
|
|
99
|
+
nodeId,
|
|
100
|
+
rootContext
|
|
101
|
+
]);
|
|
102
|
+
return /*#__PURE__*/ jsx(FloatingNode, {
|
|
103
|
+
id: nodeId,
|
|
104
|
+
children: props.children
|
|
105
|
+
});
|
|
106
|
+
}
|
|
5
107
|
const Menubar_module = {};
|
|
6
|
-
const
|
|
108
|
+
const Menubar_Menubar_Menubar = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Menubar_Menubar, {
|
|
7
109
|
ref: ref,
|
|
8
110
|
className: clsx(Menubar_module.root, className),
|
|
9
111
|
...props
|
|
10
112
|
}));
|
|
11
|
-
export {
|
|
113
|
+
export { Menubar_Menubar_Menubar as Menubar };
|
package/dist/Meter/index.d.ts
CHANGED
|
@@ -1,29 +1,193 @@
|
|
|
1
|
-
import { MeterIndicatorProps } from '@base-ui/react/meter';
|
|
2
|
-
import { MeterLabelProps } from '@base-ui/react/meter';
|
|
3
|
-
import { MeterRootProps } from '@base-ui/react/meter';
|
|
4
|
-
import { MeterTrackProps } from '@base-ui/react/meter';
|
|
5
|
-
import { MeterValueProps } from '@base-ui/react/meter';
|
|
1
|
+
import { MeterIndicatorProps as MeterIndicatorProps_2 } from '@base-ui/react/meter';
|
|
2
|
+
import { MeterLabelProps as MeterLabelProps_2 } from '@base-ui/react/meter';
|
|
3
|
+
import { MeterRootProps as MeterRootProps_2 } from '@base-ui/react/meter';
|
|
4
|
+
import { MeterTrackProps as MeterTrackProps_2 } from '@base-ui/react/meter';
|
|
5
|
+
import { MeterValueProps as MeterValueProps_2 } from '@base-ui/react/meter';
|
|
6
6
|
import * as React_2 from 'react';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Props shared by all Base UI components.
|
|
10
|
+
* Contains `className` (string or callback taking the component's state as an argument) and `render` (function to customize rendering).
|
|
11
|
+
*/
|
|
12
|
+
declare type BaseUIComponentProps<ElementType extends React_2.ElementType, State, RenderFunctionProps = HTMLProps> = Omit<WithBaseUIEvent<React_2.ComponentPropsWithRef<ElementType>>, 'className' | 'color' | 'defaultValue' | 'defaultChecked' | 'style'> & {
|
|
13
|
+
/**
|
|
14
|
+
* CSS class applied to the element, or a function that
|
|
15
|
+
* returns a class based on the component's state.
|
|
16
|
+
*/
|
|
17
|
+
className?: string | ((state: State) => string | undefined) | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Allows you to replace the component's HTML element
|
|
20
|
+
* with a different tag, or compose it with another component.
|
|
21
|
+
*
|
|
22
|
+
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
23
|
+
*/
|
|
24
|
+
render?: React_2.ReactElement | ComponentRenderFn<RenderFunctionProps, State> | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Style applied to the element, or a function that
|
|
27
|
+
* returns a style object based on the component's state.
|
|
28
|
+
*/
|
|
29
|
+
style?: React_2.CSSProperties | ((state: State) => React_2.CSSProperties | undefined) | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E & {
|
|
33
|
+
preventBaseUIHandler: () => void;
|
|
34
|
+
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element.
|
|
39
|
+
*
|
|
40
|
+
* @template Props Props to be spread on the rendered element.
|
|
41
|
+
* @template State Component's internal state.
|
|
42
|
+
*/
|
|
43
|
+
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
44
|
+
|
|
45
|
+
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
46
|
+
ref?: React_2.Ref<T> | undefined;
|
|
47
|
+
};
|
|
48
|
+
|
|
8
49
|
export declare const Meter: {
|
|
9
|
-
Root: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<
|
|
50
|
+
Root: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<MeterRootProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
10
51
|
className?: string | undefined;
|
|
11
52
|
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
Track: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<
|
|
53
|
+
Track: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<MeterTrackProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
13
54
|
className?: string | undefined;
|
|
14
55
|
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
Indicator: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<
|
|
56
|
+
Indicator: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<MeterIndicatorProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
16
57
|
className?: string | undefined;
|
|
17
58
|
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
18
|
-
Value: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<
|
|
59
|
+
Value: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<MeterValueProps_2, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
|
|
19
60
|
className?: string | undefined;
|
|
20
61
|
} & React_2.RefAttributes<HTMLSpanElement>>;
|
|
21
|
-
Label: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<
|
|
62
|
+
Label: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<MeterLabelProps_2, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
|
|
22
63
|
className?: string | undefined;
|
|
23
64
|
} & React_2.RefAttributes<HTMLSpanElement>>;
|
|
24
65
|
};
|
|
25
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Visualizes the position of the value along the range.
|
|
69
|
+
* Renders a `<div>` element.
|
|
70
|
+
*
|
|
71
|
+
* Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)
|
|
72
|
+
*/
|
|
73
|
+
export declare const MeterIndicator: React_2.ForwardRefExoticComponent<Omit<MeterIndicatorProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
74
|
+
|
|
75
|
+
export declare namespace MeterIndicator {
|
|
76
|
+
export type State = MeterIndicatorState;
|
|
77
|
+
export type Props = MeterIndicatorProps;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare interface MeterIndicatorProps extends BaseUIComponentProps<'div', MeterIndicatorState> {}
|
|
81
|
+
|
|
82
|
+
export declare interface MeterIndicatorState extends MeterRootState {}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* An accessible label for the meter.
|
|
86
|
+
* Renders a `<span>` element.
|
|
87
|
+
*
|
|
88
|
+
* Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)
|
|
89
|
+
*/
|
|
90
|
+
export declare const MeterLabel: React_2.ForwardRefExoticComponent<Omit<MeterLabelProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
|
|
91
|
+
|
|
92
|
+
export declare namespace MeterLabel {
|
|
93
|
+
export type State = MeterLabelState;
|
|
94
|
+
export type Props = MeterLabelProps;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export declare interface MeterLabelProps extends BaseUIComponentProps<'span', MeterLabelState> {}
|
|
98
|
+
|
|
99
|
+
export declare interface MeterLabelState extends MeterRootState {}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Groups all parts of the meter and provides the value for screen readers.
|
|
103
|
+
* Renders a `<div>` element.
|
|
104
|
+
*
|
|
105
|
+
* Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)
|
|
106
|
+
*/
|
|
107
|
+
export declare const MeterRoot: React_2.ForwardRefExoticComponent<Omit<MeterRootProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
|
|
109
|
+
export declare namespace MeterRoot {
|
|
110
|
+
export type State = MeterRootState;
|
|
111
|
+
export type Props = MeterRootProps;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export declare interface MeterRootProps extends BaseUIComponentProps<'div', MeterRootState> {
|
|
115
|
+
/**
|
|
116
|
+
* A string value that provides a user-friendly name for `aria-valuenow`, the current value of the meter.
|
|
117
|
+
*/
|
|
118
|
+
'aria-valuetext'?: React_2.AriaAttributes['aria-valuetext'] | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Options to format the value.
|
|
121
|
+
*/
|
|
122
|
+
format?: Intl.NumberFormatOptions | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* A function that returns a string value that provides a human-readable text alternative for `aria-valuenow`, the current value of the meter.
|
|
125
|
+
*/
|
|
126
|
+
getAriaValueText?: ((formattedValue: string, value: number) => string) | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* The locale used by `Intl.NumberFormat` when formatting the value.
|
|
129
|
+
* Defaults to the user's runtime locale.
|
|
130
|
+
*/
|
|
131
|
+
locale?: Intl.LocalesArgument | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* The maximum value
|
|
134
|
+
* @default 100
|
|
135
|
+
*/
|
|
136
|
+
max?: number | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* The minimum value
|
|
139
|
+
* @default 0
|
|
140
|
+
*/
|
|
141
|
+
min?: number | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* The current value.
|
|
144
|
+
*/
|
|
145
|
+
value: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare interface MeterRootState {}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Contains the meter indicator and represents the entire range of the meter.
|
|
152
|
+
* Renders a `<div>` element.
|
|
153
|
+
*
|
|
154
|
+
* Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)
|
|
155
|
+
*/
|
|
156
|
+
export declare const MeterTrack: React_2.ForwardRefExoticComponent<Omit<MeterTrackProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
157
|
+
|
|
158
|
+
export declare namespace MeterTrack {
|
|
159
|
+
export type State = MeterTrackState;
|
|
160
|
+
export type Props = MeterTrackProps;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export declare interface MeterTrackProps extends BaseUIComponentProps<'div', MeterTrackState> {}
|
|
164
|
+
|
|
165
|
+
export declare interface MeterTrackState extends MeterRootState {}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A text element displaying the current value.
|
|
169
|
+
* Renders a `<span>` element.
|
|
170
|
+
*
|
|
171
|
+
* Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)
|
|
172
|
+
*/
|
|
173
|
+
export declare const MeterValue: React_2.ForwardRefExoticComponent<Omit<MeterValueProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
|
|
174
|
+
|
|
175
|
+
export declare namespace MeterValue {
|
|
176
|
+
export type State = MeterValueState;
|
|
177
|
+
export type Props = MeterValueProps;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export declare interface MeterValueProps extends Omit<BaseUIComponentProps<'span', MeterValueState>, 'children'> {
|
|
181
|
+
children?: null | ((formattedValue: string, value: number) => React_2.ReactNode) | undefined;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare interface MeterValueState extends MeterRootState {}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Adds a `preventBaseUIHandler` method to all event handlers.
|
|
188
|
+
*/
|
|
189
|
+
declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K]> };
|
|
26
190
|
|
|
27
|
-
|
|
191
|
+
declare type WithPreventBaseUIHandler<T> = T extends ((event: infer E) => any) ? E extends React_2.SyntheticEvent<Element, Event> ? (event: BaseUIEvent<E>) => ReturnType<T> : T : T extends undefined ? undefined : T;
|
|
28
192
|
|
|
29
193
|
export { }
|
package/dist/Meter/index.js
CHANGED
|
@@ -1,7 +1,127 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Meter } from "@base-ui/react/meter";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import clsx from "clsx";
|
|
3
|
+
import { useRenderElement, esm_formatErrorMessage } from "../8272.js";
|
|
4
|
+
import { formatNumberValue } from "../6914.js";
|
|
5
|
+
import { visuallyHidden } from "../8225.js";
|
|
6
|
+
import { valueToPercent } from "../3395.js";
|
|
7
|
+
import { useRegisteredLabelId } from "../6706.js";
|
|
4
8
|
import * as __rspack_external_react from "react";
|
|
9
|
+
const MeterRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
10
|
+
if ("production" !== process.env.NODE_ENV) MeterRootContext.displayName = "MeterRootContext";
|
|
11
|
+
function useMeterRootContext() {
|
|
12
|
+
const context = __rspack_external_react.useContext(MeterRootContext);
|
|
13
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MeterRootContext is missing. Meter parts must be placed within <Meter.Root>.' : esm_formatErrorMessage(38));
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
const MeterRoot_MeterRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
17
|
+
const { format, getAriaValueText, locale, max = 100, min = 0, value: valueProp, render, className, children, style, ...elementProps } = componentProps;
|
|
18
|
+
const [labelId, setLabelId] = __rspack_external_react.useState();
|
|
19
|
+
const formattedValue = formatNumberValue(valueProp, locale, format);
|
|
20
|
+
let ariaValuetext = `${valueProp}%`;
|
|
21
|
+
if (getAriaValueText) ariaValuetext = getAriaValueText(formattedValue, valueProp);
|
|
22
|
+
else if (format) ariaValuetext = formattedValue;
|
|
23
|
+
const defaultProps = {
|
|
24
|
+
'aria-labelledby': labelId,
|
|
25
|
+
'aria-valuemax': max,
|
|
26
|
+
'aria-valuemin': min,
|
|
27
|
+
'aria-valuenow': valueProp,
|
|
28
|
+
'aria-valuetext': ariaValuetext,
|
|
29
|
+
role: 'meter',
|
|
30
|
+
children: /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
31
|
+
children: [
|
|
32
|
+
children,
|
|
33
|
+
/*#__PURE__*/ jsx("span", {
|
|
34
|
+
role: "presentation",
|
|
35
|
+
style: visuallyHidden,
|
|
36
|
+
children: "x"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
42
|
+
formattedValue,
|
|
43
|
+
max,
|
|
44
|
+
min,
|
|
45
|
+
setLabelId,
|
|
46
|
+
value: valueProp
|
|
47
|
+
}), [
|
|
48
|
+
formattedValue,
|
|
49
|
+
max,
|
|
50
|
+
min,
|
|
51
|
+
setLabelId,
|
|
52
|
+
valueProp
|
|
53
|
+
]);
|
|
54
|
+
const element = useRenderElement('div', componentProps, {
|
|
55
|
+
ref: forwardedRef,
|
|
56
|
+
props: [
|
|
57
|
+
defaultProps,
|
|
58
|
+
elementProps
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
return /*#__PURE__*/ jsx(MeterRootContext.Provider, {
|
|
62
|
+
value: contextValue,
|
|
63
|
+
children: element
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
if ("production" !== process.env.NODE_ENV) MeterRoot_MeterRoot.displayName = "MeterRoot";
|
|
67
|
+
const MeterTrack_MeterTrack = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
68
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
69
|
+
return useRenderElement('div', componentProps, {
|
|
70
|
+
ref: forwardedRef,
|
|
71
|
+
props: elementProps
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
if ("production" !== process.env.NODE_ENV) MeterTrack_MeterTrack.displayName = "MeterTrack";
|
|
75
|
+
const MeterIndicator_MeterIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
76
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
77
|
+
const context = useMeterRootContext();
|
|
78
|
+
const percentageWidth = valueToPercent(context.value, context.min, context.max);
|
|
79
|
+
return useRenderElement('div', componentProps, {
|
|
80
|
+
ref: forwardedRef,
|
|
81
|
+
props: [
|
|
82
|
+
{
|
|
83
|
+
style: {
|
|
84
|
+
insetInlineStart: 0,
|
|
85
|
+
height: 'inherit',
|
|
86
|
+
width: `${percentageWidth}%`
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
elementProps
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
if ("production" !== process.env.NODE_ENV) MeterIndicator_MeterIndicator.displayName = "MeterIndicator";
|
|
94
|
+
const MeterValue_MeterValue = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
95
|
+
const { className, render, children, style, ...elementProps } = componentProps;
|
|
96
|
+
const { value, formattedValue } = useMeterRootContext();
|
|
97
|
+
return useRenderElement('span', componentProps, {
|
|
98
|
+
ref: forwardedRef,
|
|
99
|
+
props: [
|
|
100
|
+
{
|
|
101
|
+
'aria-hidden': true,
|
|
102
|
+
children: 'function' == typeof children ? children(formattedValue, value) : (formattedValue || value) ?? ''
|
|
103
|
+
},
|
|
104
|
+
elementProps
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
if ("production" !== process.env.NODE_ENV) MeterValue_MeterValue.displayName = "MeterValue";
|
|
109
|
+
const MeterLabel_MeterLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
110
|
+
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
111
|
+
const { setLabelId } = useMeterRootContext();
|
|
112
|
+
const id = useRegisteredLabelId(idProp, setLabelId);
|
|
113
|
+
return useRenderElement('span', componentProps, {
|
|
114
|
+
ref: forwardedRef,
|
|
115
|
+
props: [
|
|
116
|
+
{
|
|
117
|
+
id,
|
|
118
|
+
role: 'presentation'
|
|
119
|
+
},
|
|
120
|
+
elementProps
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
if ("production" !== process.env.NODE_ENV) MeterLabel_MeterLabel.displayName = "MeterLabel";
|
|
5
125
|
const Meter_module = {
|
|
6
126
|
root: "root-bc9hfF",
|
|
7
127
|
track: "track-BJK3T1",
|
|
@@ -9,36 +129,36 @@ const Meter_module = {
|
|
|
9
129
|
value: "value-Uz_0kH",
|
|
10
130
|
label: "label-yJGBDG"
|
|
11
131
|
};
|
|
12
|
-
const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
132
|
+
const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MeterRoot_MeterRoot, {
|
|
13
133
|
ref: ref,
|
|
14
134
|
className: clsx(Meter_module.root, className),
|
|
15
135
|
...props
|
|
16
136
|
}));
|
|
17
|
-
const Track = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
137
|
+
const Track = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MeterTrack_MeterTrack, {
|
|
18
138
|
ref: ref,
|
|
19
139
|
className: clsx(Meter_module.track, className),
|
|
20
140
|
...props
|
|
21
141
|
}));
|
|
22
|
-
const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
142
|
+
const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MeterIndicator_MeterIndicator, {
|
|
23
143
|
ref: ref,
|
|
24
144
|
className: clsx(Meter_module.indicator, className),
|
|
25
145
|
...props
|
|
26
146
|
}));
|
|
27
|
-
const Value = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
147
|
+
const Value = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MeterValue_MeterValue, {
|
|
28
148
|
ref: ref,
|
|
29
149
|
className: clsx(Meter_module.value, className),
|
|
30
150
|
...props
|
|
31
151
|
}));
|
|
32
|
-
const Label = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
152
|
+
const Label = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MeterLabel_MeterLabel, {
|
|
33
153
|
ref: ref,
|
|
34
154
|
className: clsx(Meter_module.label, className),
|
|
35
155
|
...props
|
|
36
156
|
}));
|
|
37
|
-
const
|
|
157
|
+
const Meter = {
|
|
38
158
|
Root: Root,
|
|
39
159
|
Track: Track,
|
|
40
160
|
Indicator: Indicator,
|
|
41
161
|
Value: Value,
|
|
42
162
|
Label: Label
|
|
43
163
|
};
|
|
44
|
-
export {
|
|
164
|
+
export { Meter };
|