@yamada-ui/react 2.2.0-next-20260405095509 → 2.2.0-next-20260407055159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/chart/use-chart.cjs +16 -0
- package/dist/cjs/components/chart/use-chart.cjs.map +1 -1
- package/dist/cjs/core/css/conditions.cjs +2 -1
- package/dist/cjs/core/css/conditions.cjs.map +1 -1
- package/dist/cjs/hooks/use-popper/index.cjs +4 -0
- package/dist/cjs/hooks/use-popper/index.cjs.map +1 -1
- package/dist/esm/components/chart/use-chart.js +16 -0
- package/dist/esm/components/chart/use-chart.js.map +1 -1
- package/dist/esm/core/css/conditions.js +2 -1
- package/dist/esm/core/css/conditions.js.map +1 -1
- package/dist/esm/hooks/use-popper/index.js +4 -0
- package/dist/esm/hooks/use-popper/index.js.map +1 -1
- package/dist/types/components/accordion/accordion.d.ts +2 -2
- package/dist/types/components/accordion/accordion.style.d.ts +1 -1
- package/dist/types/components/accordion/use-accordion.d.ts +11 -11
- package/dist/types/components/action-bar/action-bar.d.ts +2 -2
- package/dist/types/components/airy/airy.d.ts +2 -2
- package/dist/types/components/alert/alert.d.ts +2 -2
- package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -2
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -5
- package/dist/types/components/avatar/avatar.d.ts +5 -5
- package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
- package/dist/types/components/badge/badge.d.ts +2 -2
- package/dist/types/components/bleed/bleed.d.ts +2 -2
- package/dist/types/components/blockquote/blockquote.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
- package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
- package/dist/types/components/button/button.d.ts +2 -2
- package/dist/types/components/button/icon-button.d.ts +2 -2
- package/dist/types/components/calendar/calendar.d.ts +2 -2
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/calendar/use-calendar.d.ts +8 -8
- package/dist/types/components/card/card.d.ts +2 -2
- package/dist/types/components/carousel/carousel.d.ts +2 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/carousel/use-carousel.d.ts +3 -3
- package/dist/types/components/center/center.d.ts +2 -2
- package/dist/types/components/chart/area-chart.d.ts +2 -2
- package/dist/types/components/chart/bar-chart.d.ts +2 -2
- package/dist/types/components/chart/chart.d.ts +5 -5
- package/dist/types/components/chart/composed-chart.d.ts +2 -2
- package/dist/types/components/chart/donut-chart.d.ts +2 -2
- package/dist/types/components/chart/line-chart.d.ts +2 -2
- package/dist/types/components/chart/pie-chart.d.ts +2 -2
- package/dist/types/components/chart/radar-chart.d.ts +2 -2
- package/dist/types/components/chart/radial-chart.d.ts +2 -2
- package/dist/types/components/chart/use-chart.d.ts +2 -2
- package/dist/types/components/checkbox/checkbox.d.ts +5 -5
- package/dist/types/components/checkbox/checkbox.style.d.ts +1 -1
- package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -2
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +5 -5
- package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
- package/dist/types/components/circle-progress/circle-progress.d.ts +2 -2
- package/dist/types/components/close-button/close-button.d.ts +2 -2
- package/dist/types/components/code/code.d.ts +2 -2
- package/dist/types/components/collapse/collapse.d.ts +2 -2
- package/dist/types/components/color-picker/color-picker.d.ts +2 -2
- package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
- package/dist/types/components/color-picker/use-color-picker.d.ts +2 -2
- package/dist/types/components/color-selector/color-selector.d.ts +2 -2
- package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
- package/dist/types/components/color-selector/use-color-selector.d.ts +3 -3
- package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
- package/dist/types/components/container/container.d.ts +2 -2
- package/dist/types/components/data-list/data-list.d.ts +2 -2
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +2 -2
- package/dist/types/components/date-picker/use-date-picker.d.ts +4 -4
- package/dist/types/components/drawer/drawer.d.ts +2 -2
- package/dist/types/components/drawer/drawer.style.d.ts +2 -2
- package/dist/types/components/dropzone/dropzone.d.ts +5 -5
- package/dist/types/components/dropzone/dropzone.style.d.ts +1 -1
- package/dist/types/components/editable/editable.d.ts +4 -4
- package/dist/types/components/editable/use-editable.d.ts +2 -2
- package/dist/types/components/em/em.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
- package/dist/types/components/fade/fade.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +3 -3
- package/dist/types/components/field/use-field-props.d.ts +4 -4
- package/dist/types/components/fieldset/fieldset.d.ts +3 -3
- package/dist/types/components/file-button/file-button.d.ts +2 -2
- package/dist/types/components/file-button/use-file-button.d.ts +18 -18
- package/dist/types/components/file-input/file-input.d.ts +2 -2
- package/dist/types/components/file-input/use-file-input.d.ts +15 -15
- package/dist/types/components/flex/flex.d.ts +2 -2
- package/dist/types/components/flip/flip.d.ts +4 -4
- package/dist/types/components/flip/flip.style.d.ts +1 -1
- package/dist/types/components/float/float.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +3 -3
- package/dist/types/components/format/format-byte.d.ts +4 -4
- package/dist/types/components/format/format-date-time.d.ts +4 -4
- package/dist/types/components/format/format-number.d.ts +2 -2
- package/dist/types/components/grid/grid-item.d.ts +2 -2
- package/dist/types/components/grid/grid.d.ts +2 -2
- package/dist/types/components/group/group.d.ts +2 -2
- package/dist/types/components/group/use-group.d.ts +2 -2
- package/dist/types/components/heading/heading.d.ts +2 -2
- package/dist/types/components/hue-slider/hue-slider.d.ts +3 -3
- package/dist/types/components/hue-slider/hue-slider.style.d.ts +2 -2
- package/dist/types/components/icon/icon.d.ts +5 -5
- package/dist/types/components/image/image.d.ts +2 -2
- package/dist/types/components/indicator/indicator.d.ts +5 -5
- package/dist/types/components/indicator/indicator.style.d.ts +1 -1
- package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
- package/dist/types/components/input/input-addon.d.ts +2 -2
- package/dist/types/components/input/input-element.d.ts +2 -2
- package/dist/types/components/input/input.d.ts +2 -2
- package/dist/types/components/kbd/kbd.d.ts +2 -2
- package/dist/types/components/link/link.d.ts +2 -2
- package/dist/types/components/link-box/link-box.d.ts +2 -2
- package/dist/types/components/list/list.d.ts +2 -2
- package/dist/types/components/list/list.style.d.ts +2 -2
- package/dist/types/components/loading/loading-provider.d.ts +2 -2
- package/dist/types/components/loading/loading.d.ts +3 -3
- package/dist/types/components/mark/mark.d.ts +2 -2
- package/dist/types/components/menu/menu.d.ts +2 -2
- package/dist/types/components/menu/menu.style.d.ts +2 -2
- package/dist/types/components/menu/use-menu.d.ts +11 -11
- package/dist/types/components/modal/modal.d.ts +2 -2
- package/dist/types/components/modal/modal.style.d.ts +2 -2
- package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
- package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
- package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
- package/dist/types/components/native-popover/native-popover.d.ts +2 -2
- package/dist/types/components/native-select/native-select.d.ts +2 -2
- package/dist/types/components/native-table/native-table.d.ts +4 -4
- package/dist/types/components/notice/notice.style.d.ts +1 -1
- package/dist/types/components/number-input/number-input.d.ts +2 -2
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/pagination/pagination.d.ts +2 -2
- package/dist/types/components/pagination/pagination.style.d.ts +1 -1
- package/dist/types/components/pagination/use-pagination.d.ts +2 -2
- package/dist/types/components/password-input/password-input.d.ts +2 -2
- package/dist/types/components/password-input/strength-meter.d.ts +2 -2
- package/dist/types/components/password-input/strength-meter.style.d.ts +1 -1
- package/dist/types/components/password-input/use-password-input.d.ts +2 -2
- package/dist/types/components/pin-input/pin-input.d.ts +2 -2
- package/dist/types/components/pin-input/use-pin-input.d.ts +7 -7
- package/dist/types/components/popover/popover.d.ts +2 -2
- package/dist/types/components/progress/progress.d.ts +4 -4
- package/dist/types/components/progress/use-progress.d.ts +706 -706
- package/dist/types/components/qr-code/qr-code.d.ts +2 -2
- package/dist/types/components/qr-code/qr-code.style.d.ts +2 -2
- package/dist/types/components/radio/radio.d.ts +5 -5
- package/dist/types/components/radio/radio.style.d.ts +1 -1
- package/dist/types/components/radio/use-radio-group.d.ts +2 -2
- package/dist/types/components/radio-card/radio-card.d.ts +5 -5
- package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
- package/dist/types/components/rating/rating.style.d.ts +2 -2
- package/dist/types/components/rating/use-rating.d.ts +7 -7
- package/dist/types/components/reorder/reorder.d.ts +2 -2
- package/dist/types/components/reorder/reorder.style.d.ts +1 -1
- package/dist/types/components/reorder/use-reorder.d.ts +3 -3
- package/dist/types/components/resizable/resizable.d.ts +2 -2
- package/dist/types/components/resizable/resizable.style.d.ts +2 -2
- package/dist/types/components/resizable/use-resizable.d.ts +2 -2
- package/dist/types/components/ripple/ripple.d.ts +2 -2
- package/dist/types/components/ripple/use-ripple.d.ts +2 -2
- package/dist/types/components/rotate/rotate.d.ts +2 -2
- package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
- package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -2
- package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
- package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -9
- package/dist/types/components/select/select.d.ts +2 -2
- package/dist/types/components/select/select.style.d.ts +1 -1
- package/dist/types/components/select/use-select.d.ts +4 -4
- package/dist/types/components/separator/separator.d.ts +2 -2
- package/dist/types/components/simple-grid/simple-grid.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/slide/slide.d.ts +2 -2
- package/dist/types/components/slide-fade/slide-fade.d.ts +2 -2
- package/dist/types/components/slider/slider.d.ts +2 -2
- package/dist/types/components/slider/use-slider.d.ts +2 -2
- package/dist/types/components/stack/h-stack.d.ts +2 -2
- package/dist/types/components/stack/stack.d.ts +2 -2
- package/dist/types/components/stack/v-stack.d.ts +2 -2
- package/dist/types/components/stack/z-stack.d.ts +2 -2
- package/dist/types/components/stat/stat.d.ts +2 -2
- package/dist/types/components/status/status.d.ts +2 -2
- package/dist/types/components/status/status.style.d.ts +2 -2
- package/dist/types/components/steps/steps.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/steps/use-steps.d.ts +10 -10
- package/dist/types/components/switch/switch.d.ts +2 -2
- package/dist/types/components/table/table.d.ts +2 -2
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/components/tabs/tabs.style.d.ts +1 -1
- package/dist/types/components/tabs/use-tabs.d.ts +16 -16
- package/dist/types/components/tag/tag.d.ts +2 -2
- package/dist/types/components/tag/tag.style.d.ts +1 -1
- package/dist/types/components/text/text.d.ts +2 -2
- package/dist/types/components/textarea/textarea.d.ts +2 -2
- package/dist/types/components/textarea/use-autosize.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +5 -5
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +5 -5
- package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
- package/dist/types/components/toggle/use-toggle.d.ts +2 -2
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree/tree.d.ts +2 -2
- package/dist/types/components/tree/tree.style.d.ts +1 -1
- package/dist/types/components/tree/use-tree.d.ts +182 -182
- package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
- package/dist/types/components/wrap/wrap.d.ts +2 -2
- package/dist/types/core/components/create-component.d.ts +7 -7
- package/dist/types/core/css/conditions.d.ts +76 -68
- package/dist/types/core/system/color-mode-provider.d.ts +2 -2
- package/dist/types/core/system/index.types.d.ts +1 -1
- package/dist/types/core/system/storage-script.d.ts +3 -3
- package/dist/types/core/system/styled.d.ts +2 -2
- package/dist/types/core/system/system-provider.d.ts +2 -2
- package/dist/types/core/system/use-system-color-mode.d.ts +1 -1
- package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
- package/dist/types/hooks/use-clickable/index.d.ts +7 -7
- package/dist/types/hooks/use-clipboard/index.d.ts +2 -2
- package/dist/types/hooks/use-combobox/index.d.ts +12 -12
- package/dist/types/hooks/use-counter/index.d.ts +2 -2
- package/dist/types/hooks/use-descendants/index.d.ts +2 -2
- package/dist/types/hooks/use-field-sizing/index.d.ts +2 -2
- package/dist/types/hooks/use-hover/index.d.ts +2 -2
- package/dist/types/hooks/use-popper/index.d.ts +2 -2
- package/dist/types/hooks/use-resize-observer/index.d.ts +3 -3
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
- package/dist/types/providers/ui-provider/ui-provider.d.ts +4 -4
- package/dist/types/utils/children.d.ts +2 -2
- package/package.json +1 -1
|
@@ -11,10 +11,26 @@ const PLACEMENT_MAP = {
|
|
|
11
11
|
align: "right",
|
|
12
12
|
verticalAlign: "middle"
|
|
13
13
|
},
|
|
14
|
+
"center-end-end": {
|
|
15
|
+
align: "right",
|
|
16
|
+
verticalAlign: "bottom"
|
|
17
|
+
},
|
|
18
|
+
"center-end-start": {
|
|
19
|
+
align: "right",
|
|
20
|
+
verticalAlign: "top"
|
|
21
|
+
},
|
|
14
22
|
"center-start": {
|
|
15
23
|
align: "left",
|
|
16
24
|
verticalAlign: "middle"
|
|
17
25
|
},
|
|
26
|
+
"center-start-end": {
|
|
27
|
+
align: "left",
|
|
28
|
+
verticalAlign: "bottom"
|
|
29
|
+
},
|
|
30
|
+
"center-start-start": {
|
|
31
|
+
align: "left",
|
|
32
|
+
verticalAlign: "top"
|
|
33
|
+
},
|
|
18
34
|
end: {
|
|
19
35
|
align: "center",
|
|
20
36
|
verticalAlign: "bottom"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chart.cjs","names":["PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n}","createContext","getRootProps: PropGetter","getLegendProps: PropGetter<LegendProps>","getRootProps: PropGetter<TooltipProps<Y, M>>","getRootProps: PropGetter<\"text\">"],"sources":["../../../../src/components/chart/use-chart.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n LabelListProps,\n LabelProps,\n LegendProps,\n TooltipProps,\n} from \"recharts\"\nimport type {\n Direction,\n HTMLProps,\n PropGetter,\n RequiredPropGetter,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport { useCallback, useState } from \"react\"\nimport { createContext, dataAttr, handlerAll, isUndefined } from \"../../utils\"\n\nconst PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n} = {\n \"center-end\": { align: \"right\", verticalAlign: \"middle\" },\n \"center-start\": { align: \"left\", verticalAlign: \"middle\" },\n end: { align: \"center\", verticalAlign: \"bottom\" },\n \"end-center\": { align: \"center\", verticalAlign: \"bottom\" },\n \"end-end\": { align: \"right\", verticalAlign: \"bottom\" },\n \"end-start\": { align: \"left\", verticalAlign: \"bottom\" },\n start: { align: \"center\", verticalAlign: \"top\" },\n \"start-center\": { align: \"center\", verticalAlign: \"top\" },\n \"start-end\": { align: \"right\", verticalAlign: \"top\" },\n \"start-start\": { align: \"left\", verticalAlign: \"top\" },\n}\n\ninterface ChartContext extends UseChartReturn {}\n\nconst [ChartContext, useChartContext] = createContext<ChartContext>({\n name: \"ChartContext\",\n})\n\nexport { ChartContext, useChartContext }\n\nexport const useChart = () => {\n const [highlightedDataKey, setHighlightedDataKey] = useState<\n number | string | undefined\n >(undefined)\n\n const onHighlight = useCallback((dataKey?: number | string) => {\n setHighlightedDataKey(dataKey)\n }, [])\n\n return { highlightedDataKey, onHighlight }\n}\n\nexport type UseChartReturn = ReturnType<typeof useChart>\n\nexport interface UseChartLegendProps extends Merge<\n HTMLProps,\n Pick<\n LegendProps,\n | \"align\"\n | \"content\"\n | \"formatter\"\n | \"itemSorter\"\n | \"layout\"\n | \"onBBoxUpdate\"\n | \"onClick\"\n | \"onMouseEnter\"\n | \"onMouseLeave\"\n | \"payloadUniqBy\"\n | \"portal\"\n | \"verticalAlign\"\n >\n> {\n /**\n * The placement of the legend.\n *\n * @default 'start-end'\n */\n placement?: Direction\n}\n\nexport const useChartLegend = ({\n placement = \"start-end\",\n align = PLACEMENT_MAP[placement].align,\n content,\n formatter,\n itemSorter,\n layout = placement.startsWith(\"center\") ? \"vertical\" : \"horizontal\",\n payloadUniqBy,\n portal,\n verticalAlign = PLACEMENT_MAP[placement].verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: UseChartLegendProps = {}) => {\n const { highlightedDataKey, onHighlight } = useChartContext()\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLegendProps: PropGetter<LegendProps> = useCallback(\n (props) => ({\n align,\n content,\n formatter,\n itemSorter,\n layout,\n payloadUniqBy,\n portal,\n verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...props,\n }),\n [\n align,\n content,\n formatter,\n itemSorter,\n layout,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n payloadUniqBy,\n portal,\n verticalAlign,\n ],\n )\n\n const getLegendContentProps: PropGetter = useCallback(\n (props) => ({\n \"data-align\": align,\n \"data-orientation\": layout,\n \"data-vertical-align\": verticalAlign,\n ...props,\n }),\n [align, layout, verticalAlign],\n )\n\n const getLegendItemProps: RequiredPropGetter<\n \"div\",\n { dataKey?: number | string }\n > = useCallback(\n ({ dataKey, ...props }) => ({\n ...props,\n \"data-active\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey === dataKey,\n ),\n \"data-inactive\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey !== dataKey,\n ),\n onMouseEnter: handlerAll(props.onMouseEnter, () => onHighlight(dataKey)),\n onMouseLeave: handlerAll(props.onMouseLeave, () => onHighlight()),\n }),\n [highlightedDataKey, onHighlight],\n )\n\n return {\n getLegendContentProps,\n getLegendItemProps,\n getLegendProps,\n getRootProps,\n }\n}\n\nexport type UseChartLegendReturn = ReturnType<typeof useChartLegend>\n\nexport interface UseChartTooltipProps<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> extends Merge<\n HTMLProps,\n Omit<\n TooltipProps<Y, M>,\n | \"contentStyle\"\n | \"itemStyle\"\n | \"labelClassName\"\n | \"labelStyle\"\n | \"separator\"\n | \"wrapperClassName\"\n | \"wrapperStyle\"\n >\n> {}\n\nexport const useChartTooltip = <\n Y extends (number | string)[] | number | string,\n M extends number | string,\n>({\n active,\n allowEscapeViewBox,\n animationDuration = 0,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive = (animationDuration || 0) > 0,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...rest\n}: UseChartTooltipProps<Y, M> = {}) => {\n const getRootProps: PropGetter<TooltipProps<Y, M>> = useCallback(\n (props) => ({\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...props,\n }),\n [\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props) => ({\n ...rest,\n ...props,\n }),\n [rest],\n )\n\n return { getContentProps, getRootProps }\n}\n\nexport type UseChartTooltipReturn<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> = ReturnType<typeof useChartTooltip<Y, M>>\n\nexport interface UseChartLabelListProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelListProps,\n | \"angle\"\n | \"clockWise\"\n | \"content\"\n | \"dataKey\"\n | \"formatter\"\n | \"offset\"\n | \"position\"\n | \"textBreakAll\"\n | \"valueAccessor\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabelList = ({\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset = 12,\n position = \"top\",\n textBreakAll,\n valueAccessor,\n zIndex,\n ...rest\n}: UseChartLabelListProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelListProps: PropGetter<LabelListProps> = useCallback(\n (props) => ({\n angle,\n clockWise,\n content,\n dataKey,\n fill: \"\",\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ...props,\n }),\n [\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ],\n )\n\n return { getLabelListProps, getRootProps }\n}\n\nexport type UseChartLabelListReturn = ReturnType<typeof useChartLabelList>\n\nexport interface UseChartLabelProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelProps,\n | \"angle\"\n | \"children\"\n | \"content\"\n | \"formatter\"\n | \"labelRef\"\n | \"offset\"\n | \"parentViewBox\"\n | \"position\"\n | \"value\"\n | \"viewBox\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabel = ({\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...rest\n}: UseChartLabelProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelProps: PropGetter<LabelProps> = useCallback(\n (props) => ({\n angle,\n children,\n content,\n fill: \"\",\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...props,\n }),\n [\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ],\n )\n\n return { getLabelProps, getRootProps }\n}\n\nexport type UseChartLabelReturn = ReturnType<typeof useChartLabel>\n"],"mappings":";;;;;;;;AAkBA,MAAMA,gBAKF;CACF,cAAc;EAAE,OAAO;EAAS,eAAe;EAAU;CACzD,gBAAgB;EAAE,OAAO;EAAQ,eAAe;EAAU;CAC1D,KAAK;EAAE,OAAO;EAAU,eAAe;EAAU;CACjD,cAAc;EAAE,OAAO;EAAU,eAAe;EAAU;CAC1D,WAAW;EAAE,OAAO;EAAS,eAAe;EAAU;CACtD,aAAa;EAAE,OAAO;EAAQ,eAAe;EAAU;CACvD,OAAO;EAAE,OAAO;EAAU,eAAe;EAAO;CAChD,gBAAgB;EAAE,OAAO;EAAU,eAAe;EAAO;CACzD,aAAa;EAAE,OAAO;EAAS,eAAe;EAAO;CACrD,eAAe;EAAE,OAAO;EAAQ,eAAe;EAAO;CACvD;AAID,MAAM,CAAC,cAAc,mBAAmBC,8BAA4B,EAClE,MAAM,gBACP,CAAC;AAIF,MAAa,iBAAiB;CAC5B,MAAM,CAAC,oBAAoB,6CAEzB,OAAU;AAMZ,QAAO;EAAE;EAAoB,qCAJI,YAA8B;AAC7D,yBAAsB,QAAQ;KAC7B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EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAUD,QAAO;EAAE,yCAPN,WAAW;GACV,GAAG;GACH,GAAG;GACJ,GACD,CAAC,KAAK,CACP;EAEyB;EAAc;;AAyB1C,MAAa,qBAAqB,EAChC,OACA,WACA,SACA,SACA,WACA,SAAS,IACT,WAAW,OACX,cACA,eACA,QACA,GAAG,SACuB,EAAE,KAAK;CACjC,MAAMC,uCACH,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AA+BD,QAAO;EAAE,2CA5BN,WAAW;GACV;GACA;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAE2B;EAAc;;AAuB5C,MAAa,iBAAiB,EAC5B,OACA,UACA,SACA,WACA,UACA,QACA,eACA,UACA,OACA,SACA,QACA,GAAG,SACmB,EAAE,KAAK;CAC7B,MAAMA,uCACH,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AAiCD,QAAO;EAAE,uCA9BN,WAAW;GACV;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAEuB;EAAc"}
|
|
1
|
+
{"version":3,"file":"use-chart.cjs","names":["PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n}","createContext","getRootProps: PropGetter","getLegendProps: PropGetter<LegendProps>","getRootProps: PropGetter<TooltipProps<Y, M>>","getRootProps: PropGetter<\"text\">"],"sources":["../../../../src/components/chart/use-chart.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n LabelListProps,\n LabelProps,\n LegendProps,\n TooltipProps,\n} from \"recharts\"\nimport type {\n Direction,\n HTMLProps,\n PropGetter,\n RequiredPropGetter,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport { useCallback, useState } from \"react\"\nimport { createContext, dataAttr, handlerAll, isUndefined } from \"../../utils\"\n\nconst PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n} = {\n \"center-end\": { align: \"right\", verticalAlign: \"middle\" },\n \"center-end-end\": { align: \"right\", verticalAlign: \"bottom\" },\n \"center-end-start\": { align: \"right\", verticalAlign: \"top\" },\n \"center-start\": { align: \"left\", verticalAlign: \"middle\" },\n \"center-start-end\": { align: \"left\", verticalAlign: \"bottom\" },\n \"center-start-start\": { align: \"left\", verticalAlign: \"top\" },\n end: { align: \"center\", verticalAlign: \"bottom\" },\n \"end-center\": { align: \"center\", verticalAlign: \"bottom\" },\n \"end-end\": { align: \"right\", verticalAlign: \"bottom\" },\n \"end-start\": { align: \"left\", verticalAlign: \"bottom\" },\n start: { align: \"center\", verticalAlign: \"top\" },\n \"start-center\": { align: \"center\", verticalAlign: \"top\" },\n \"start-end\": { align: \"right\", verticalAlign: \"top\" },\n \"start-start\": { align: \"left\", verticalAlign: \"top\" },\n}\n\ninterface ChartContext extends UseChartReturn {}\n\nconst [ChartContext, useChartContext] = createContext<ChartContext>({\n name: \"ChartContext\",\n})\n\nexport { ChartContext, useChartContext }\n\nexport const useChart = () => {\n const [highlightedDataKey, setHighlightedDataKey] = useState<\n number | string | undefined\n >(undefined)\n\n const onHighlight = useCallback((dataKey?: number | string) => {\n setHighlightedDataKey(dataKey)\n }, [])\n\n return { highlightedDataKey, onHighlight }\n}\n\nexport type UseChartReturn = ReturnType<typeof useChart>\n\nexport interface UseChartLegendProps extends Merge<\n HTMLProps,\n Pick<\n LegendProps,\n | \"align\"\n | \"content\"\n | \"formatter\"\n | \"itemSorter\"\n | \"layout\"\n | \"onBBoxUpdate\"\n | \"onClick\"\n | \"onMouseEnter\"\n | \"onMouseLeave\"\n | \"payloadUniqBy\"\n | \"portal\"\n | \"verticalAlign\"\n >\n> {\n /**\n * The placement of the legend.\n *\n * @default 'start-end'\n */\n placement?: Direction\n}\n\nexport const useChartLegend = ({\n placement = \"start-end\",\n align = PLACEMENT_MAP[placement].align,\n content,\n formatter,\n itemSorter,\n layout = placement.startsWith(\"center\") ? \"vertical\" : \"horizontal\",\n payloadUniqBy,\n portal,\n verticalAlign = PLACEMENT_MAP[placement].verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: UseChartLegendProps = {}) => {\n const { highlightedDataKey, onHighlight } = useChartContext()\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLegendProps: PropGetter<LegendProps> = useCallback(\n (props) => ({\n align,\n content,\n formatter,\n itemSorter,\n layout,\n payloadUniqBy,\n portal,\n verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...props,\n }),\n [\n align,\n content,\n formatter,\n itemSorter,\n layout,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n payloadUniqBy,\n portal,\n verticalAlign,\n ],\n )\n\n const getLegendContentProps: PropGetter = useCallback(\n (props) => ({\n \"data-align\": align,\n \"data-orientation\": layout,\n \"data-vertical-align\": verticalAlign,\n ...props,\n }),\n [align, layout, verticalAlign],\n )\n\n const getLegendItemProps: RequiredPropGetter<\n \"div\",\n { dataKey?: number | string }\n > = useCallback(\n ({ dataKey, ...props }) => ({\n ...props,\n \"data-active\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey === dataKey,\n ),\n \"data-inactive\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey !== dataKey,\n ),\n onMouseEnter: handlerAll(props.onMouseEnter, () => onHighlight(dataKey)),\n onMouseLeave: handlerAll(props.onMouseLeave, () => onHighlight()),\n }),\n [highlightedDataKey, onHighlight],\n )\n\n return {\n getLegendContentProps,\n getLegendItemProps,\n getLegendProps,\n getRootProps,\n }\n}\n\nexport type UseChartLegendReturn = ReturnType<typeof useChartLegend>\n\nexport interface UseChartTooltipProps<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> extends Merge<\n HTMLProps,\n Omit<\n TooltipProps<Y, M>,\n | \"contentStyle\"\n | \"itemStyle\"\n | \"labelClassName\"\n | \"labelStyle\"\n | \"separator\"\n | \"wrapperClassName\"\n | \"wrapperStyle\"\n >\n> {}\n\nexport const useChartTooltip = <\n Y extends (number | string)[] | number | string,\n M extends number | string,\n>({\n active,\n allowEscapeViewBox,\n animationDuration = 0,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive = (animationDuration || 0) > 0,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...rest\n}: UseChartTooltipProps<Y, M> = {}) => {\n const getRootProps: PropGetter<TooltipProps<Y, M>> = useCallback(\n (props) => ({\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...props,\n }),\n [\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props) => ({\n ...rest,\n ...props,\n }),\n [rest],\n )\n\n return { getContentProps, getRootProps }\n}\n\nexport type UseChartTooltipReturn<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> = ReturnType<typeof useChartTooltip<Y, M>>\n\nexport interface UseChartLabelListProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelListProps,\n | \"angle\"\n | \"clockWise\"\n | \"content\"\n | \"dataKey\"\n | \"formatter\"\n | \"offset\"\n | \"position\"\n | \"textBreakAll\"\n | \"valueAccessor\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabelList = ({\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset = 12,\n position = \"top\",\n textBreakAll,\n valueAccessor,\n zIndex,\n ...rest\n}: UseChartLabelListProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelListProps: PropGetter<LabelListProps> = useCallback(\n (props) => ({\n angle,\n clockWise,\n content,\n dataKey,\n fill: \"\",\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ...props,\n }),\n [\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ],\n )\n\n return { getLabelListProps, getRootProps }\n}\n\nexport type UseChartLabelListReturn = ReturnType<typeof useChartLabelList>\n\nexport interface UseChartLabelProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelProps,\n | \"angle\"\n | \"children\"\n | \"content\"\n | \"formatter\"\n | \"labelRef\"\n | \"offset\"\n | \"parentViewBox\"\n | \"position\"\n | \"value\"\n | \"viewBox\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabel = ({\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...rest\n}: UseChartLabelProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelProps: PropGetter<LabelProps> = useCallback(\n (props) => ({\n angle,\n children,\n content,\n fill: \"\",\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...props,\n }),\n [\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ],\n )\n\n return { getLabelProps, getRootProps }\n}\n\nexport type UseChartLabelReturn = ReturnType<typeof useChartLabel>\n"],"mappings":";;;;;;;;AAkBA,MAAMA,gBAKF;CACF,cAAc;EAAE,OAAO;EAAS,eAAe;EAAU;CACzD,kBAAkB;EAAE,OAAO;EAAS,eAAe;EAAU;CAC7D,oBAAoB;EAAE,OAAO;EAAS,eAAe;EAAO;CAC5D,gBAAgB;EAAE,OAAO;EAAQ,eAAe;EAAU;CAC1D,oBAAoB;EAAE,OAAO;EAAQ,eAAe;EAAU;CAC9D,sBAAsB;EAAE,OAAO;EAAQ,eAAe;EAAO;CAC7D,KAAK;EAAE,OAAO;EAAU,eAAe;EAAU;CACjD,cAAc;EAAE,OAAO;EAAU,eAAe;EAAU;CAC1D,WAAW;EAAE,OAAO;EAAS,eAAe;EAAU;CACtD,aAAa;EAAE,OAAO;EAAQ,eAAe;EAAU;CACvD,OAAO;EAAE,OAAO;EAAU,eAAe;EAAO;CAChD,gBAAgB;EAAE,OAAO;EAAU,eAAe;EAAO;CACzD,aAAa;EAAE,OAAO;EAAS,eAAe;EAAO;CACrD,eAAe;EAAE,OAAO;EAAQ,eAAe;EAAO;CACvD;AAID,MAAM,CAAC,cAAc,mBAAmBC,8BAA4B,EAClE,MAAM,gBACP,CAAC;AAIF,MAAa,iBAAiB;CAC5B,MAAM,CAAC,oBAAoB,6CAEzB,OAAU;AAMZ,QAAO;EAAE;EAAoB,qCAJI,YAA8B;AAC7D,yBAAsB,QAAQ;KAC7B,EAAE,CAAC;EAEoC;;AA+B5C,MAAa,kBAAkB,EAC7B,YAAY,aACZ,QAAQ,cAAc,WAAW,OACjC,SACA,WACA,YACA,SAAS,UAAU,WAAW,SAAS,GAAG,aAAa,cACvD,eACA,QACA,gBAAgB,cAAc,WAAW,eACzC,cACA,SACA,cACA,cACA,GAAG,SACoB,EAAE,KAAK;CAC9B,MAAM,EAAE,oBAAoB,gBAAgB,iBAAiB;CAE7D,MAAMC,uCACH,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;CAED,MAAMC,yCACH,WAAW;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AA8BD,QAAO;EACL,+CA5BC,WAAW;GACV,cAAc;GACd,oBAAoB;GACpB,uBAAuB;GACvB,GAAG;GACJ,GACD;GAAC;GAAO;GAAQ;GAAc,CAC/B;EAsBC,4CAhBC,EAAE,SAAS,GAAG,aAAa;GAC1B,GAAG;GACH,+DACE,oDAAa,mBAAmB,IAAI,uBAAuB,QAC5D;GACD,iEACE,oDAAa,mBAAmB,IAAI,uBAAuB,QAC5D;GACD,gEAAyB,MAAM,oBAAoB,YAAY,QAAQ,CAAC;GACxE,gEAAyB,MAAM,oBAAoB,aAAa,CAAC;GAClE,GACD,CAAC,oBAAoB,YAAY,CAClC;EAKC;EACA;EACD;;AAsBH,MAAa,mBAGX,EACA,QACA,oBACA,oBAAoB,GACpB,iBACA,QACA,SACA,QACA,cACA,YACA,WACA,eACA,qBAAqB,qBAAqB,KAAK,GAC/C,YACA,gBACA,QACA,eACA,QACA,UACA,kBACA,QACA,SACA,gBACA,GAAG,SAC2B,EAAE,KAAK;CACrC,MAAMC,uCACH,WAAW;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAUD,QAAO;EAAE,yCAPN,WAAW;GACV,GAAG;GACH,GAAG;GACJ,GACD,CAAC,KAAK,CACP;EAEyB;EAAc;;AAyB1C,MAAa,qBAAqB,EAChC,OACA,WACA,SACA,SACA,WACA,SAAS,IACT,WAAW,OACX,cACA,eACA,QACA,GAAG,SACuB,EAAE,KAAK;CACjC,MAAMC,uCACH,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AA+BD,QAAO;EAAE,2CA5BN,WAAW;GACV;GACA;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAE2B;EAAc;;AAuB5C,MAAa,iBAAiB,EAC5B,OACA,UACA,SACA,WACA,UACA,QACA,eACA,UACA,OACA,SACA,QACA,GAAG,SACmB,EAAE,KAAK;CAC7B,MAAMA,uCACH,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AAiCD,QAAO;EAAE,uCA9BN,WAAW;GACV;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAEuB;EAAc"}
|
|
@@ -5,7 +5,7 @@ const toGroup = (selector) => [
|
|
|
5
5
|
"[data-group]",
|
|
6
6
|
".group"
|
|
7
7
|
].map((prefix) => `${prefix}${selector.slice(1)} &`).join(", ");
|
|
8
|
-
const toPeer = (selector) => [...["[data-peer]", ".peer"].flatMap((prefix) => [`&:has(~ ${prefix}${selector.slice(1)})`, `${prefix}${selector.slice(1)} ~ &`]), ...["[data-peer]", ".peer"].flatMap((prefix) => [`&:has(~ ${prefix} *${selector.slice(1)})`, `${prefix}:has(*${selector.slice(1)}) ~ &`])].join(", ");
|
|
8
|
+
const toPeer = (selector) => [...["[data-peer]", ".peer"].flatMap((prefix) => [selector ? `&:has(~ ${prefix}${selector.slice(1)})` : `&:has(~ ${prefix})`, selector ? `${prefix}${selector.slice(1)} ~ &` : `${prefix} ~ &`]), ...selector ? ["[data-peer]", ".peer"].flatMap((prefix) => [`&:has(~ ${prefix} *${selector.slice(1)})`, `${prefix}:has(*${selector.slice(1)}) ~ &`]) : []].join(", ");
|
|
9
9
|
const attributes = {
|
|
10
10
|
_inactive: "&[data-inactive]",
|
|
11
11
|
_accept: "&[data-accept]",
|
|
@@ -181,6 +181,7 @@ const groupAttributes = {
|
|
|
181
181
|
const groupAttributeProperties = Object.keys(groupAttributes);
|
|
182
182
|
const groupAttributeSelectors = Object.values(groupAttributes);
|
|
183
183
|
const peerAttributes = {
|
|
184
|
+
_peer: toPeer(),
|
|
184
185
|
_peerAccept: toPeer(attributes._accept),
|
|
185
186
|
_peerBlank: toPeer(pseudoClasses._blank),
|
|
186
187
|
_peerChecked: toPeer(pseudoClasses._checked),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.cjs","names":[],"sources":["../../../../src/core/css/conditions.ts"],"sourcesContent":["import type { Length } from \"../../utils\"\nimport type { DOMElement } from \"../components\"\nimport type { CSSObject } from \"./index.types\"\n\ntype ReplaceSelector<\n Y extends string[],\n M extends string,\n D extends string,\n> = Y extends [infer H extends string, ...infer R extends string[]]\n ? `${H}${M extends `&${infer T}` ? `${T} ${D}` : `${M} ${D}`}${Length<R> extends 0 ? \"\" : `, `}${ReplaceSelector<R, M, D>}`\n : \"\"\n\nconst toGroup = <Y extends string>(selector: Y) =>\n [\"[role=group]\", \"[data-group]\", \".group\"]\n .map((prefix) => `${prefix}${selector.slice(1)} &`)\n .join(\", \") as ReplaceSelector<\n [\"[role=group]\", \"[data-group]\", \".group\"],\n Y,\n \"&\"\n >\n\nconst toPeer = <Y extends string>(selector: Y) =>\n [\n ...[\"[data-peer]\", \".peer\"].flatMap((prefix) => [\n `&:has(~ ${prefix}${selector.slice(1)})`,\n `${prefix}${selector.slice(1)} ~ &`,\n ]),\n ...[\"[data-peer]\", \".peer\"].flatMap((prefix) => [\n `&:has(~ ${prefix} *${selector.slice(1)})`,\n `${prefix}:has(*${selector.slice(1)}) ~ &`,\n ]),\n ].join(\", \") as ReplaceSelector<[\"[data-peer]\", \".peer\"], Y, \"~ &\">\n\nexport type AnySelector =\n | `${string}${\" \" | \"#\" | \"*\" | \"+\" | \",\" | \".\" | \":\" | \">\" | \"@\" | \"[\" | \"]\" | \"~\"}${string}`\n | DOMElement\n\nexport const attributes = {\n /**\n * The CSS `&[data-inactive]` attribute selector.\n */\n _inactive: \"&[data-inactive]\",\n /**\n * The CSS `&[data-accept]` attribute selector.\n */\n _accept: \"&[data-accept]\",\n /**\n * The CSS `&[data-animated]` attribute selector.\n */\n _animated: \"&[data-animated]\",\n /**\n * The CSS `&[data-between]` attribute selector.\n */\n _between: \"&[data-between]\",\n /**\n * The CSS `&:is([data-center], [data-group-center])` attribute selector.\n */\n _center: \"&:is([data-center], [data-group-center])\",\n /**\n * The CSS `&:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])` attribute selector.\n */\n _collapsed:\n \"&:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])\",\n /**\n * The CSS `&[data-complete]` attribute selector.\n */\n _complete: \"&[data-complete]\",\n /**\n * The CSS `&:is([aria-current], [data-current]):not([aria-current='false'])` attribute selector.\n */\n _current: \"&:is([aria-current], [data-current]):not([aria-current='false'])\",\n /**\n * Styles for when `data-mode` is applied to any parent of this component or element.\n */\n _dark:\n \".dark &:not([data-mode]), [data-mode=dark] &:not([data-mode]), &[data-mode=dark]\",\n /**\n * The CSS `&:is([data-end], [data-group-end])` attribute selector.\n */\n _end: \"&:is([data-end], [data-group-end])\",\n /**\n * The CSS `&:is([data-expanded], [aria-expanded=true])` attribute selector.\n */\n _expanded: \"&:is([data-expanded], [aria-expanded=true])\",\n /**\n * The CSS `&[data-fallback]` attribute selector.\n */\n _fallback: \"&[data-fallback]\",\n /**\n * The CSS `&[data-filled]` attribute selector.\n */\n _filled: \"&[data-filled]\",\n /**\n * The CSS `&:is([data-grabbed], [aria-grabbed=true])` attribute selector.\n */\n _grabbed: \"&:is([data-grabbed], [aria-grabbed=true])\",\n /**\n * The CSS `&:is([role=grid], [data-grid])` attribute selector.\n */\n _grid: \"&:is([role=grid], [data-grid])\",\n /**\n * The CSS `&:is(:has(> [role=group]), :has(> [data-group]), :has(> .group))` attribute selector.\n */\n _hasGroup: \"&:is(:has(> [role=group]), :has(> [data-group]), :has(> .group))\",\n /**\n * The CSS `&:has(> [data-icon])` attribute selector.\n */\n _hasIcon: \"&:has(> [data-icon])\",\n /**\n * The CSS `&[data-idle]` attribute selector.\n */\n _idle: \"&[data-idle]\",\n /**\n * The CSS `&[data-incomplete]` attribute selector.\n */\n _incomplete: \"&[data-incomplete]\",\n /**\n * Styles for when `data-mode` is applied to any parent of this component or element.\n */\n _light:\n \".light &:not([data-mode]), [data-mode=light] &:not([data-mode]), &[data-mode=light]\",\n /**\n * The CSS `&[data-loaded]` attribute selector.\n */\n _loaded: \"&[data-loaded]\",\n /**\n * The CSS `&:is([data-loading], [aria-busy=true])` attribute selector.\n */\n _loading: \"&:is([data-loading], [aria-busy=true])\",\n /**\n * The CSS `&[dir=ltr]` attribute selector.\n */\n _ltr: \"[dir=ltr] &\",\n /**\n * The CSS `&[hidden]` attribute selector.\n */\n _nativeHidden: \"&[hidden]\",\n /**\n * The CSS `&[data-not-allowed]` attribute selector.\n */\n _notAllowed: \"&[data-not-allowed]\",\n /**\n * The CSS `&[aria-current='false']` attribute selector.\n */\n _notCurrent: \"&:not([aria-current], [data-current]), &[aria-current='false']\",\n /**\n * The CSS `&:not([data-fallback])` attribute selector.\n */\n _notFallback: \"&:not([data-fallback])\",\n /**\n * The CSS `&:not(:has(> [role=group]), :has(> [data-group]), :has(> .group))` attribute selector.\n */\n _notHasGroup:\n \"&:not(:has(> [role=group]), :has(> [data-group]), :has(> .group))\",\n /**\n * The CSS `&:not([data-selected]):not([aria-selected=true])` attribute selector.\n */\n _notSelected: \"&:not([data-selected]):not([aria-selected=true])\",\n /**\n * The CSS `&[data-numeric]` attribute selector.\n */\n _numeric: \"&[data-numeric]\",\n /**\n * The CSS `&:is([open], [data-open])` attribute selector.\n */\n _open: \"&:is([open], [data-open])\",\n /**\n * The CSS `&:is([data-pressed], [aria-pressed=true])` attribute selector.\n */\n _pressed: \"&:is([data-pressed], [aria-pressed=true])\",\n /**\n * The CSS `&:is([data-range])` attribute selector.\n */\n _range: \"&:is([data-range])\",\n /**\n * The CSS `&[data-reject]` attribute selector.\n */\n _reject: \"&[data-reject]\",\n /**\n * The CSS `& .ui-ripple` attribute selector.\n */\n _ripple: \"& .ui-ripple\",\n /**\n * The CSS `&[dir=rtl]` attribute selector.\n */\n _rtl: \"[dir=rtl] &\",\n /**\n * The CSS `&:is([data-start], [data-group-start])` attribute selector.\n */\n _start: \"&:is([data-start], [data-group-start])\",\n /**\n * The CSS `&:is([data-selected], [aria-selected=true])` attribute selector.\n */\n _selected: \"&:is([data-selected], [aria-selected=true])\",\n /**\n * The CSS `&:is([hidden], [data-hidden])` attribute selector.\n */\n _hidden: \"&:is([hidden], [data-hidden])\",\n /**\n * The CSS `&[data-never]` attribute selector.\n */\n _never: \"&[data-never]\",\n} as const\n\nexport type Attributes = typeof attributes\nexport type AttributeProperty = keyof Attributes\nexport type AttributeProps = {\n [K in AttributeProperty]?: CSSObject\n}\n\nexport const attributeProperties = Object.keys(\n attributes,\n) as AttributeProperty[]\nexport const attributeSelectors = Object.values(attributes)\n\nexport const pseudoElements = {\n /**\n * The CSS `&::after` pseudo-element.\n */\n _after: \"&::after\",\n /**\n * The CSS `&::backdrop` pseudo-element.\n */\n _backdrop: \"&::backdrop\",\n /**\n * The CSS `&::before` pseudo-element.\n */\n _before: \"&::before\",\n /**\n * The CSS `&::cue` pseudo-element.\n */\n _cue: \"&::cue\",\n /**\n * The CSS `&::cue-region` pseudo-element.\n */\n _cueRegion: \"&::cue-region\",\n /**\n * The CSS `&::details-content` pseudo-element.\n */\n _detailsContent: \"&::details-content\",\n /**\n * The CSS `&::file-selector-button` pseudo-element.\n */\n _fileSelector: \"&::file-selector-button\",\n /**\n * The CSS `&::first-letter` pseudo-element.\n */\n _firstLetter: \"&::first-letter\",\n /**\n * The CSS `&::first-line` pseudo-element.\n */\n _firstLine: \"&::first-line\",\n /**\n * The CSS `&::marker` pseudo-element.\n */\n _marker: \"&::marker\",\n /**\n * The CSS `&::placeholder, &[data-placeholder]` pseudo-element.\n */\n _placeholder: \"&::placeholder, &[data-placeholder]\",\n /**\n * The CSS `&::-webkit-scrollbar, &[data-scrollbar]` pseudo-element.\n */\n _scrollbar: \"&::-webkit-scrollbar, &[data-scrollbar]\",\n /**\n * The CSS `&::-webkit-scrollbar-button` pseudo-element.\n */\n _scrollbarButton: \"&::-webkit-scrollbar-button\",\n /**\n * The CSS `&::-webkit-scrollbar-corner` pseudo-element.\n */\n _scrollbarCorner: \"&::-webkit-scrollbar-corner\",\n /**\n * The CSS `&::-webkit-scrollbar-thumb` pseudo-element.\n */\n _scrollbarThumb: \"&::-webkit-scrollbar-thumb\",\n /**\n * The CSS `&::-webkit-scrollbar-track` pseudo-element.\n */\n _scrollbarTrack: \"&::-webkit-scrollbar-track\",\n /**\n * The CSS `&::-webkit-scrollbar-track-piece` pseudo-element.\n */\n _scrollbarTrackPiece: \"&::-webkit-scrollbar-track-piece\",\n /**\n * The CSS `&::selection` pseudo-element.\n */\n _selection: \"&::selection\",\n} as const\n\nexport type PseudoElements = typeof pseudoElements\nexport type PseudoElementProperty = keyof PseudoElements\nexport type PseudoElementProps = {\n [K in PseudoElementProperty]?: CSSObject\n}\n\nexport const pseudoElementProperties = Object.keys(\n pseudoElements,\n) as PseudoElementProperty[]\nexport const pseudoElementSelectors = Object.values(pseudoElements)\n\nexport const pseudoClasses = {\n /**\n * The CSS `&:is([data-activedescendant])` pseudo-class.\n */\n _activedescendant: \"&:is([data-activedescendant])\",\n /**\n * The CSS `:any-link` pseudo-class.\n */\n _anyLink: \"&:is(:any-link, [data-any-link])\",\n /**\n * The CSS `&:autofill` pseudo-class.\n */\n _autofill: \"&:autofill\",\n /**\n * The CSS `&:is(:blank, [data-blank])` pseudo-class.\n */\n _blank: \"&:is(:blank, [data-blank])\",\n /**\n * The CSS `&:is(:checked, [data-checked], [aria-checked=true])` pseudo-class.\n */\n _checked: \"&:is(:checked, [data-checked], [aria-checked=true])\",\n /**\n * The CSS `& > *` child combinator selector.\n */\n _child: \"& > *\",\n /**\n * The CSS `& > [data-content]` child combinator attribute selector.\n */\n _content: \"& > [data-content]\",\n /**\n * The CSS `&:default` pseudo-class.\n */\n _default: \"&:default\",\n /**\n * The CSS `&:empty` pseudo-class.\n */\n _empty: \"&:empty\",\n /**\n * The CSS `&:is(:enabled, [data-enabled])` pseudo-class.\n */\n _enabled: \"&:is(:enabled, [data-enabled])\",\n /**\n * The CSS `&:nth-of-type(even)` pseudo-class.\n */\n _even: \"&:nth-of-type(even)\",\n /**\n * The CSS `&:first-of-type` pseudo-class.\n */\n _first: \"&:first-of-type\",\n /**\n * The CSS `& > *:first-child` pseudo-class.\n */\n _firstChild: \"& > *:first-child\",\n /**\n * The CSS `&:not(:focus-within, [data-focus-within])` pseudo-class.\n */\n _focusWithin: \"&:not(:focus-within, [data-focus-within])\",\n /**\n * The CSS `&:fullscreen` pseudo-class.\n */\n _fullScreen: \"&:fullscreen\",\n /**\n * The CSS `&:is([data-orientation=horizontal], [aria-orientation=horizontal])` pseudo-class.\n */\n _horizontal:\n \"&:is([data-orientation=horizontal], [aria-orientation=horizontal])\",\n /**\n * The CSS `&:where(svg:not([data-loading])), & > [data-icon]` pseudo-class.\n */\n _icon: \"&:where(svg:not([data-loading])), & > [data-icon]\",\n /**\n * The CSS `&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed])` pseudo-class.\n */\n _indeterminate:\n \"&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed])\",\n /**\n * The CSS `& > [data-indicator]` pseudo-class.\n */\n _indicator: \"& > [data-indicator]\",\n /**\n * The CSS `&:is(:in-range, [data-in-range])` pseudo-class.\n */\n _inRange: \"&:is(:in-range, [data-in-range])\",\n /**\n * The CSS `&:last-of-type` pseudo-class.\n */\n _last: \"&:last-of-type\",\n /**\n * The CSS `& > *:last-child` pseudo-class.\n */\n _lastChild: \"& > *:last-child\",\n /**\n * The CSS `&:is(:link, [data-link])` pseudo-class.\n */\n _link: \"&:is(:link, [data-link])\",\n /**\n * The CSS `&:modal` pseudo-class.\n */\n _modal: \"&:modal\",\n /**\n * The CSS `&:active` pseudo-class.\n */\n _nativeActive: \"&:active\",\n /**\n * The CSS `&:checked` pseudo-class.\n */\n _nativeChecked: \"&:checked\",\n /**\n * The CSS `&:is(disabled, [disabled])` pseudo-class.\n */\n _nativeDisabled: \"&:is(disabled, [disabled])\",\n /**\n * The CSS `&:focus` pseudo-class.\n */\n _nativeFocus: \"&:focus\",\n /**\n * The CSS `&:focus-visible` pseudo-class.\n */\n _nativeFocusVisible: \"&:focus-visible\",\n /**\n * The CSS `&:focus-within` pseudo-class.\n */\n _nativeFocusWithin: \"&:focus-within\",\n /**\n * The CSS `&:hover` pseudo-class.\n */\n _nativeHover: \"&:hover\",\n /**\n * The CSS `&:is([readonly], [aria-readonly=true])` pseudo-class.\n */\n _nativeReadOnly: \"&:is([readonly], [aria-readonly=true])\",\n /**\n * The CSS `&:target` pseudo-class.\n */\n _nativeTarget: \"&:target\",\n /**\n * The CSS `&:valid` pseudo-class.\n */\n _nativeValid: \"&:valid\",\n /**\n * The CSS `&:not(:checked):not([data-checked]):not([aria-checked=true])` pseudo-class.\n */\n _notChecked: \"&:not(:checked):not([data-checked]):not([aria-checked=true])\",\n /**\n * The CSS `&:not(:empty)` pseudo-class.\n */\n _notEmpty: \"&:not(:empty)\",\n /**\n * The CSS `&:not(:first-of-type)` pseudo-class.\n */\n _notFirst: \"&:not(:first-of-type)\",\n /**\n * The CSS `& > *:not(:first-child)` pseudo-class.\n */\n _notFirstChild: \"& > *:not(:first-child)\",\n /**\n * The CSS `&:not(:last-of-type)` pseudo-class.\n */\n _notLast: \"&:not(:last-of-type)\",\n /**\n * The CSS `& > *:not(:last-child)` pseudo-class.\n */\n _notLastChild: \"& > *:not(:last-child)\",\n /**\n * The CSS `&:not(:target)` pseudo-class.\n */\n _notTarget: \"&:not(:target)\",\n /**\n * The CSS `&:nth-of-type(odd)` pseudo-class.\n */\n _odd: \"&:nth-of-type(odd)\",\n /**\n * The CSS `&:only-of-type` pseudo-class.\n */\n _only: \"&:only-of-type\",\n /**\n * The CSS `&:only-child` pseudo-class.\n */\n _onlyChild: \"&:only-child\",\n /**\n * The CSS `&:is(:optional, [data-optional])` pseudo-class.\n */\n _optional: \"&:is(:optional, [data-optional])\",\n /**\n * The CSS `&:is(:out-of-range, [data-out-of-range])` pseudo-class.\n */\n _outRange: \"&:is(:out-of-range, [data-out-of-range])\",\n /**\n * The CSS `&:is(:paused, [data-paused])` pseudo-class.\n */\n _paused: \"&:is(:paused, [data-paused])\",\n /**\n * The CSS `&:picture-in-picture` pseudo-class.\n */\n _picture: \"&:picture-in-picture\",\n /**\n * The CSS `&:placeholder-shown` pseudo-class.\n */\n _placeholderShown: \"&:placeholder-shown\",\n /**\n * The CSS `&:is(:playing, [data-playing])` pseudo-class.\n */\n _playing: \"&:is(:playing, [data-playing])\",\n /**\n * The CSS `&:popover-open` pseudo-class.\n */\n _popoverOpen: \"&:popover-open\",\n /**\n * The CSS `&:is(:read-write, [data-read-write])` pseudo-class.\n */\n _readWrite: \"&:is(:read-write, [data-read-write])\",\n /**\n * The CSS `&:is(:required, [required])` pseudo-class.\n */\n _required: \"&:is(:required, [required])\",\n /**\n * The CSS `&:is(:target, [data-target])` pseudo-class.\n */\n _target: \"&:is(:target, [data-target])\",\n /**\n * The CSS `&:is(:user-invalid, [data-user-invalid])` pseudo-class.\n */\n _userInvalid: \"&:is(:user-invalid, [data-user-invalid])\",\n /**\n * The CSS `&:is(:valid, [data-valid])` pseudo-class.\n */\n _valid: \"&:is(:valid, [data-valid])\",\n /**\n * The CSS `&:is([data-orientation=vertical], [aria-orientation=vertical])` pseudo-class.\n */\n _vertical: \"&:is([data-orientation=vertical], [aria-orientation=vertical])\",\n /**\n * The CSS `&:visited` pseudo-class.\n */\n _visited: \"&:visited\",\n /**\n * The CSS `&:is(:hover, [data-hover])` pseudo-class.\n */\n _hover:\n \"&:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])\",\n /**\n * The CSS `&:is(:active, [data-active])` pseudo-class.\n */\n _active:\n \"&:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])\",\n /**\n * The CSS `&:is(:focus, [data-focus])` pseudo-class.\n */\n _focus: \"&:is(:focus, [data-focus])\",\n /**\n * The CSS `&:is(:focus-visible, [data-focus-visible])` pseudo-class.\n */\n _focusVisible: \"&:is(:focus-visible, [data-focus-visible])\",\n /**\n * The CSS `&:is([data-invalid], [aria-invalid=true])` attribute selector.\n */\n _invalid: \"&:is([data-invalid], [aria-invalid=true])\",\n /**\n * The CSS `&:is([readonly], [data-readonly], [aria-readonly=true])` pseudo-class.\n */\n _readOnly: \"&:is([readonly], [data-readonly], [aria-readonly=true])\",\n /**\n * The CSS `&:is(:disabled, [disabled], [data-disabled])` pseudo-class.\n */\n _disabled: \"&:is(:disabled, [disabled], [data-disabled])\",\n} as const\n\nexport type PseudoClasses = typeof pseudoClasses\nexport type PseudoClassProperty = keyof PseudoClasses\nexport type PseudoClassProps = {\n [K in PseudoClassProperty]?: CSSObject\n}\n\nexport const pseudoClassProperties = Object.keys(\n pseudoClasses,\n) as PseudoClassProperty[]\nexport const pseudoClassSelectors = Object.values(pseudoClasses)\n\nexport const groupAttributes = {\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is accepted.\n */\n _groupAccept: toGroup(attributes._accept),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is activedescendant.\n */\n _groupActivedescendant: toGroup(pseudoClasses._activedescendant),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is blank.\n */\n _groupBlank: toGroup(pseudoClasses._blank),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is checked.\n */\n _groupChecked: toGroup(pseudoClasses._checked),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is collapsed.\n */\n _groupCollapsed: toGroup(attributes._collapsed),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is complete.\n */\n _groupComplete: toGroup(attributes._complete),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is current.\n */\n _groupCurrent: toGroup(attributes._current),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is enabled.\n */\n _groupEnabled: toGroup(pseudoClasses._enabled),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is expanded.\n */\n _groupExpanded: toGroup(attributes._expanded),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is focus-within.\n */\n _groupFocusWithin: toGroup(pseudoClasses._focusWithin),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is grabbed.\n */\n _groupGrabbed: toGroup(attributes._grabbed),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is horizontal.\n */\n _groupHorizontal: toGroup(pseudoClasses._horizontal),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is idle.\n */\n _groupIdle: toGroup(attributes._idle),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is incomplete.\n */\n _groupIncomplete: toGroup(attributes._incomplete),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is loaded.\n */\n _groupLoaded: toGroup(attributes._loaded),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is loading.\n */\n _groupLoading: toGroup(attributes._loading),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is open.\n */\n _groupOpen: toGroup(attributes._open),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is optional.\n */\n _groupOptional: toGroup(pseudoClasses._optional),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` has a placeholder shown.\n */\n _groupPlaceholderShown: toGroup(pseudoClasses._placeholderShown),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is pressed.\n */\n _groupPressed: toGroup(attributes._pressed),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is range.\n */\n _groupRange: toGroup(attributes._range),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is read-write.\n */\n _groupReadWrite: toGroup(pseudoClasses._readWrite),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is rejected.\n */\n _groupReject: toGroup(attributes._reject),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is required.\n */\n _groupRequired: toGroup(pseudoClasses._required),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is user-invalid.\n */\n _groupUserInvalid: toGroup(pseudoClasses._userInvalid),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is valid.\n */\n _groupValid: toGroup(pseudoClasses._valid),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is vertical.\n */\n _groupVertical: toGroup(pseudoClasses._vertical),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is hovered.\n */\n _groupHover: toGroup(pseudoClasses._hover),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is active.\n */\n _groupActive: toGroup(pseudoClasses._active),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is focused.\n */\n _groupFocus: toGroup(pseudoClasses._focus),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is focused-visible.\n */\n _groupFocusVisible: toGroup(pseudoClasses._focusVisible),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is selected.\n */\n _groupSelected: toGroup(attributes._selected),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is invalid.\n */\n _groupInvalid: toGroup(pseudoClasses._invalid),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is read-only.\n */\n _groupReadOnly: toGroup(pseudoClasses._readOnly),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is disabled.\n */\n _groupDisabled: toGroup(pseudoClasses._disabled),\n} as const\n\nexport type GroupAttributes = typeof groupAttributes\nexport type GroupAttributeProperty = keyof GroupAttributes\nexport type GroupAttributeProps = {\n [K in GroupAttributeProperty]?: CSSObject\n}\n\nexport const groupAttributeProperties = Object.keys(\n groupAttributes,\n) as GroupAttributeProperty[]\nexport const groupAttributeSelectors = Object.values(groupAttributes)\n\nexport const peerAttributes = {\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is accepted.\n */\n _peerAccept: toPeer(attributes._accept),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is blank.\n */\n _peerBlank: toPeer(pseudoClasses._blank),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is checked.\n */\n _peerChecked: toPeer(pseudoClasses._checked),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is collapsed.\n */\n _peerCollapsed: toPeer(attributes._collapsed),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is complete.\n */\n _peerComplete: toPeer(attributes._complete),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is current.\n */\n _peerCurrent: toPeer(attributes._current),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is enabled.\n */\n _peerEnabled: toPeer(pseudoClasses._enabled),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is expanded.\n */\n _peerExpanded: toPeer(attributes._expanded),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is focus-within.\n */\n _peerFocusWithin: toPeer(pseudoClasses._focusWithin),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is grabbed.\n */\n _peerGrabbed: toPeer(attributes._grabbed),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is horizontal.\n */\n _peerHorizontal: toPeer(pseudoClasses._horizontal),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is idle.\n */\n _peerIdle: toPeer(attributes._idle),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is incomplete.\n */\n _peerIncomplete: toPeer(attributes._incomplete),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is loaded.\n */\n _peerLoaded: toPeer(attributes._loaded),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is loading.\n */\n _peerLoading: toPeer(attributes._loading),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is optional.\n */\n _peerOptional: toPeer(pseudoClasses._optional),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` has a placeholder shown.\n */\n _peerPlaceholderShown: toPeer(pseudoClasses._placeholderShown),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is pressed.\n */\n _peerPressed: toPeer(attributes._pressed),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is range.\n */\n _peerRange: toPeer(attributes._range),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is read-write.\n */\n _peerReadWrite: toPeer(pseudoClasses._readWrite),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is rejected.\n */\n _peerReject: toPeer(attributes._reject),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is required.\n */\n _peerRequired: toPeer(pseudoClasses._required),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is user-invalid.\n */\n _peerUserInvalid: toPeer(pseudoClasses._userInvalid),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is valid.\n */\n _peerValid: toPeer(pseudoClasses._valid),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is vertical.\n */\n _peerVertical: toPeer(pseudoClasses._vertical),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is hovered.\n */\n _peerHover: toPeer(pseudoClasses._hover),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is active.\n */\n _peerActive: toPeer(pseudoClasses._active),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is focused.\n */\n _peerFocus: toPeer(pseudoClasses._focus),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is focused-visible.\n */\n _peerFocusVisible: toPeer(pseudoClasses._focusVisible),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is selected.\n */\n _peerSelected: toPeer(attributes._selected),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is invalid.\n */\n _peerInvalid: toPeer(pseudoClasses._invalid),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is read-only.\n */\n _peerReadOnly: toPeer(pseudoClasses._readOnly),\n /**\n * Styles to apply when a parent element with `data-peer` or `.peer` is disabled.\n */\n _peerDisabled: toPeer(pseudoClasses._disabled),\n} as const\n\nexport type PeerAttributes = typeof peerAttributes\nexport type PeerAttributeProperty = keyof PeerAttributes\nexport type PeerAttributeProps = {\n [K in PeerAttributeProperty]?: CSSObject\n}\n\nexport const peerAttributeProperties = Object.keys(\n peerAttributes,\n) as PeerAttributeProperty[]\nexport const peerAttributeSelectors = Object.values(peerAttributes)\n\nexport const conditions = {\n ...pseudoElements,\n ...attributes,\n ...pseudoClasses,\n ...groupAttributes,\n ...peerAttributes,\n} as const\n\nexport type Conditions = typeof conditions\nexport type ConditionProperty = keyof Conditions\nexport type ConditionSelector = Conditions[ConditionProperty]\nexport type ConditionProps = {\n [K in keyof Conditions]?: CSSObject\n}\n\nexport const conditionProperties = Object.keys(\n conditions,\n) as ConditionProperty[]\nexport const conditionSelectors = Object.values(conditions)\n\nexport function getCondition(key: string) {\n return key in conditions ? conditions[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a,qBAAqB,OAAO,OAAO,WAAW;AAE3D,SAAgB,aAAa,KAAa;AACxC,QAAO,OAAO,aAAa,WAAW,OAA4B"}
|
|
1
|
+
{"version":3,"file":"conditions.cjs","names":[],"sources":["../../../../src/core/css/conditions.ts"],"sourcesContent":["import type { Length } from \"../../utils\"\nimport type { DOMElement } from \"../components\"\nimport type { CSSObject } from \"./index.types\"\n\ntype ReplaceSelector<\n Y extends string[],\n M extends string,\n D extends string,\n> = Y extends [infer H extends string, ...infer R extends string[]]\n ? `${H}${M extends `&${infer T}` ? `${T} ${D}` : `${M} ${D}`}${Length<R> extends 0 ? \"\" : `, `}${ReplaceSelector<R, M, D>}`\n : \"\"\n\nconst toGroup = <Y extends string>(selector: Y) =>\n [\"[role=group]\", \"[data-group]\", \".group\"]\n .map((prefix) => `${prefix}${selector.slice(1)} &`)\n .join(\", \") as ReplaceSelector<\n [\"[role=group]\", \"[data-group]\", \".group\"],\n Y,\n \"&\"\n >\n\nconst toPeer = <Y extends string>(selector?: Y) =>\n [\n ...[\"[data-peer]\", \".peer\"].flatMap((prefix) => [\n selector\n ? `&:has(~ ${prefix}${selector.slice(1)})`\n : `&:has(~ ${prefix})`,\n selector ? `${prefix}${selector.slice(1)} ~ &` : `${prefix} ~ &`,\n ]),\n ...(selector\n ? [\"[data-peer]\", \".peer\"].flatMap((prefix) => [\n `&:has(~ ${prefix} *${selector.slice(1)})`,\n `${prefix}:has(*${selector.slice(1)}) ~ &`,\n ])\n : []),\n ].join(\", \") as ReplaceSelector<[\"[data-peer]\", \".peer\"], Y, \"~ &\">\n\nexport type AnySelector =\n | `${string}${\" \" | \"#\" | \"*\" | \"+\" | \",\" | \".\" | \":\" | \">\" | \"@\" | \"[\" | \"]\" | \"~\"}${string}`\n | DOMElement\n\nexport const attributes = {\n /**\n * The CSS `&[data-inactive]` attribute selector.\n */\n _inactive: \"&[data-inactive]\",\n /**\n * The CSS `&[data-accept]` attribute selector.\n */\n _accept: \"&[data-accept]\",\n /**\n * The CSS `&[data-animated]` attribute selector.\n */\n _animated: \"&[data-animated]\",\n /**\n * The CSS `&[data-between]` attribute selector.\n */\n _between: \"&[data-between]\",\n /**\n * The CSS `&:is([data-center], [data-group-center])` attribute selector.\n */\n _center: \"&:is([data-center], [data-group-center])\",\n /**\n * The CSS `&:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])` attribute selector.\n */\n _collapsed:\n \"&:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])\",\n /**\n * The CSS `&[data-complete]` attribute selector.\n */\n _complete: \"&[data-complete]\",\n /**\n * The CSS `&:is([aria-current], [data-current]):not([aria-current='false'])` attribute selector.\n */\n _current: \"&:is([aria-current], [data-current]):not([aria-current='false'])\",\n /**\n * Styles for when `data-mode` is applied to any parent of this component or element.\n */\n _dark:\n \".dark &:not([data-mode]), [data-mode=dark] &:not([data-mode]), &[data-mode=dark]\",\n /**\n * The CSS `&:is([data-end], [data-group-end])` attribute selector.\n */\n _end: \"&:is([data-end], [data-group-end])\",\n /**\n * The CSS `&:is([data-expanded], [aria-expanded=true])` attribute selector.\n */\n _expanded: \"&:is([data-expanded], [aria-expanded=true])\",\n /**\n * The CSS `&[data-fallback]` attribute selector.\n */\n _fallback: \"&[data-fallback]\",\n /**\n * The CSS `&[data-filled]` attribute selector.\n */\n _filled: \"&[data-filled]\",\n /**\n * The CSS `&:is([data-grabbed], [aria-grabbed=true])` attribute selector.\n */\n _grabbed: \"&:is([data-grabbed], [aria-grabbed=true])\",\n /**\n * The CSS `&:is([role=grid], [data-grid])` attribute selector.\n */\n _grid: \"&:is([role=grid], [data-grid])\",\n /**\n * The CSS `&:is(:has(> [role=group]), :has(> [data-group]), :has(> .group))` attribute selector.\n */\n _hasGroup: \"&:is(:has(> [role=group]), :has(> [data-group]), :has(> .group))\",\n /**\n * The CSS `&:has(> [data-icon])` attribute selector.\n */\n _hasIcon: \"&:has(> [data-icon])\",\n /**\n * The CSS `&[data-idle]` attribute selector.\n */\n _idle: \"&[data-idle]\",\n /**\n * The CSS `&[data-incomplete]` attribute selector.\n */\n _incomplete: \"&[data-incomplete]\",\n /**\n * Styles for when `data-mode` is applied to any parent of this component or element.\n */\n _light:\n \".light &:not([data-mode]), [data-mode=light] &:not([data-mode]), &[data-mode=light]\",\n /**\n * The CSS `&[data-loaded]` attribute selector.\n */\n _loaded: \"&[data-loaded]\",\n /**\n * The CSS `&:is([data-loading], [aria-busy=true])` attribute selector.\n */\n _loading: \"&:is([data-loading], [aria-busy=true])\",\n /**\n * The CSS `&[dir=ltr]` attribute selector.\n */\n _ltr: \"[dir=ltr] &\",\n /**\n * The CSS `&[hidden]` attribute selector.\n */\n _nativeHidden: \"&[hidden]\",\n /**\n * The CSS `&[data-not-allowed]` attribute selector.\n */\n _notAllowed: \"&[data-not-allowed]\",\n /**\n * The CSS `&[aria-current='false']` attribute selector.\n */\n _notCurrent: \"&:not([aria-current], [data-current]), &[aria-current='false']\",\n /**\n * The CSS `&:not([data-fallback])` attribute selector.\n */\n _notFallback: \"&:not([data-fallback])\",\n /**\n * The CSS `&:not(:has(> [role=group]), :has(> [data-group]), :has(> .group))` attribute selector.\n */\n _notHasGroup:\n \"&:not(:has(> [role=group]), :has(> [data-group]), :has(> .group))\",\n /**\n * The CSS `&:not([data-selected]):not([aria-selected=true])` attribute selector.\n */\n _notSelected: \"&:not([data-selected]):not([aria-selected=true])\",\n /**\n * The CSS `&[data-numeric]` attribute selector.\n */\n _numeric: \"&[data-numeric]\",\n /**\n * The CSS `&:is([open], [data-open])` attribute selector.\n */\n _open: \"&:is([open], [data-open])\",\n /**\n * The CSS `&:is([data-pressed], [aria-pressed=true])` attribute selector.\n */\n _pressed: \"&:is([data-pressed], [aria-pressed=true])\",\n /**\n * The CSS `&:is([data-range])` attribute selector.\n */\n _range: \"&:is([data-range])\",\n /**\n * The CSS `&[data-reject]` attribute selector.\n */\n _reject: \"&[data-reject]\",\n /**\n * The CSS `& .ui-ripple` attribute selector.\n */\n _ripple: \"& .ui-ripple\",\n /**\n * The CSS `&[dir=rtl]` attribute selector.\n */\n _rtl: \"[dir=rtl] &\",\n /**\n * The CSS `&:is([data-start], [data-group-start])` attribute selector.\n */\n _start: \"&:is([data-start], [data-group-start])\",\n /**\n * The CSS `&:is([data-selected], [aria-selected=true])` attribute selector.\n */\n _selected: \"&:is([data-selected], [aria-selected=true])\",\n /**\n * The CSS `&:is([hidden], [data-hidden])` attribute selector.\n */\n _hidden: \"&:is([hidden], [data-hidden])\",\n /**\n * The CSS `&[data-never]` attribute selector.\n */\n _never: \"&[data-never]\",\n} as const\n\nexport type Attributes = typeof attributes\nexport type AttributeProperty = keyof Attributes\nexport type AttributeProps = {\n [K in AttributeProperty]?: CSSObject\n}\n\nexport const attributeProperties = Object.keys(\n attributes,\n) as AttributeProperty[]\nexport const attributeSelectors = Object.values(attributes)\n\nexport const pseudoElements = {\n /**\n * The CSS `&::after` pseudo-element.\n */\n _after: \"&::after\",\n /**\n * The CSS `&::backdrop` pseudo-element.\n */\n _backdrop: \"&::backdrop\",\n /**\n * The CSS `&::before` pseudo-element.\n */\n _before: \"&::before\",\n /**\n * The CSS `&::cue` pseudo-element.\n */\n _cue: \"&::cue\",\n /**\n * The CSS `&::cue-region` pseudo-element.\n */\n _cueRegion: \"&::cue-region\",\n /**\n * The CSS `&::details-content` pseudo-element.\n */\n _detailsContent: \"&::details-content\",\n /**\n * The CSS `&::file-selector-button` pseudo-element.\n */\n _fileSelector: \"&::file-selector-button\",\n /**\n * The CSS `&::first-letter` pseudo-element.\n */\n _firstLetter: \"&::first-letter\",\n /**\n * The CSS `&::first-line` pseudo-element.\n */\n _firstLine: \"&::first-line\",\n /**\n * The CSS `&::marker` pseudo-element.\n */\n _marker: \"&::marker\",\n /**\n * The CSS `&::placeholder, &[data-placeholder]` pseudo-element.\n */\n _placeholder: \"&::placeholder, &[data-placeholder]\",\n /**\n * The CSS `&::-webkit-scrollbar, &[data-scrollbar]` pseudo-element.\n */\n _scrollbar: \"&::-webkit-scrollbar, &[data-scrollbar]\",\n /**\n * The CSS `&::-webkit-scrollbar-button` pseudo-element.\n */\n _scrollbarButton: \"&::-webkit-scrollbar-button\",\n /**\n * The CSS `&::-webkit-scrollbar-corner` pseudo-element.\n */\n _scrollbarCorner: \"&::-webkit-scrollbar-corner\",\n /**\n * The CSS `&::-webkit-scrollbar-thumb` pseudo-element.\n */\n _scrollbarThumb: \"&::-webkit-scrollbar-thumb\",\n /**\n * The CSS `&::-webkit-scrollbar-track` pseudo-element.\n */\n _scrollbarTrack: \"&::-webkit-scrollbar-track\",\n /**\n * The CSS `&::-webkit-scrollbar-track-piece` pseudo-element.\n */\n _scrollbarTrackPiece: \"&::-webkit-scrollbar-track-piece\",\n /**\n * The CSS `&::selection` pseudo-element.\n */\n _selection: \"&::selection\",\n} as const\n\nexport type PseudoElements = typeof pseudoElements\nexport type PseudoElementProperty = keyof PseudoElements\nexport type PseudoElementProps = {\n [K in PseudoElementProperty]?: CSSObject\n}\n\nexport const pseudoElementProperties = Object.keys(\n pseudoElements,\n) as PseudoElementProperty[]\nexport const pseudoElementSelectors = Object.values(pseudoElements)\n\nexport const pseudoClasses = {\n /**\n * The CSS `&:is([data-activedescendant])` pseudo-class.\n */\n _activedescendant: \"&:is([data-activedescendant])\",\n /**\n * The CSS `:any-link` pseudo-class.\n */\n _anyLink: \"&:is(:any-link, [data-any-link])\",\n /**\n * The CSS `&:autofill` pseudo-class.\n */\n _autofill: \"&:autofill\",\n /**\n * The CSS `&:is(:blank, [data-blank])` pseudo-class.\n */\n _blank: \"&:is(:blank, [data-blank])\",\n /**\n * The CSS `&:is(:checked, [data-checked], [aria-checked=true])` pseudo-class.\n */\n _checked: \"&:is(:checked, [data-checked], [aria-checked=true])\",\n /**\n * The CSS `& > *` child combinator selector.\n */\n _child: \"& > *\",\n /**\n * The CSS `& > [data-content]` child combinator attribute selector.\n */\n _content: \"& > [data-content]\",\n /**\n * The CSS `&:default` pseudo-class.\n */\n _default: \"&:default\",\n /**\n * The CSS `&:empty` pseudo-class.\n */\n _empty: \"&:empty\",\n /**\n * The CSS `&:is(:enabled, [data-enabled])` pseudo-class.\n */\n _enabled: \"&:is(:enabled, [data-enabled])\",\n /**\n * The CSS `&:nth-of-type(even)` pseudo-class.\n */\n _even: \"&:nth-of-type(even)\",\n /**\n * The CSS `&:first-of-type` pseudo-class.\n */\n _first: \"&:first-of-type\",\n /**\n * The CSS `& > *:first-child` pseudo-class.\n */\n _firstChild: \"& > *:first-child\",\n /**\n * The CSS `&:not(:focus-within, [data-focus-within])` pseudo-class.\n */\n _focusWithin: \"&:not(:focus-within, [data-focus-within])\",\n /**\n * The CSS `&:fullscreen` pseudo-class.\n */\n _fullScreen: \"&:fullscreen\",\n /**\n * The CSS `&:is([data-orientation=horizontal], [aria-orientation=horizontal])` pseudo-class.\n */\n _horizontal:\n \"&:is([data-orientation=horizontal], [aria-orientation=horizontal])\",\n /**\n * The CSS `&:where(svg:not([data-loading])), & > [data-icon]` pseudo-class.\n */\n _icon: \"&:where(svg:not([data-loading])), & > [data-icon]\",\n /**\n * The CSS `&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed])` pseudo-class.\n */\n _indeterminate:\n \"&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed])\",\n /**\n * The CSS `& > [data-indicator]` pseudo-class.\n */\n _indicator: \"& > [data-indicator]\",\n /**\n * The CSS `&:is(:in-range, [data-in-range])` pseudo-class.\n */\n _inRange: \"&:is(:in-range, [data-in-range])\",\n /**\n * The CSS `&:last-of-type` pseudo-class.\n */\n _last: \"&:last-of-type\",\n /**\n * The CSS `& > *:last-child` pseudo-class.\n */\n _lastChild: \"& > *:last-child\",\n /**\n * The CSS `&:is(:link, [data-link])` pseudo-class.\n */\n _link: \"&:is(:link, [data-link])\",\n /**\n * The CSS `&:modal` pseudo-class.\n */\n _modal: \"&:modal\",\n /**\n * The CSS `&:active` pseudo-class.\n */\n _nativeActive: \"&:active\",\n /**\n * The CSS `&:checked` pseudo-class.\n */\n _nativeChecked: \"&:checked\",\n /**\n * The CSS `&:is(disabled, [disabled])` pseudo-class.\n */\n _nativeDisabled: \"&:is(disabled, [disabled])\",\n /**\n * The CSS `&:focus` pseudo-class.\n */\n _nativeFocus: \"&:focus\",\n /**\n * The CSS `&:focus-visible` pseudo-class.\n */\n _nativeFocusVisible: \"&:focus-visible\",\n /**\n * The CSS `&:focus-within` pseudo-class.\n */\n _nativeFocusWithin: \"&:focus-within\",\n /**\n * The CSS `&:hover` pseudo-class.\n */\n _nativeHover: \"&:hover\",\n /**\n * The CSS `&:is([readonly], [aria-readonly=true])` pseudo-class.\n */\n _nativeReadOnly: \"&:is([readonly], [aria-readonly=true])\",\n /**\n * The CSS `&:target` pseudo-class.\n */\n _nativeTarget: \"&:target\",\n /**\n * The CSS `&:valid` pseudo-class.\n */\n _nativeValid: \"&:valid\",\n /**\n * The CSS `&:not(:checked):not([data-checked]):not([aria-checked=true])` pseudo-class.\n */\n _notChecked: \"&:not(:checked):not([data-checked]):not([aria-checked=true])\",\n /**\n * The CSS `&:not(:empty)` pseudo-class.\n */\n _notEmpty: \"&:not(:empty)\",\n /**\n * The CSS `&:not(:first-of-type)` pseudo-class.\n */\n _notFirst: \"&:not(:first-of-type)\",\n /**\n * The CSS `& > *:not(:first-child)` pseudo-class.\n */\n _notFirstChild: \"& > *:not(:first-child)\",\n /**\n * The CSS `&:not(:last-of-type)` pseudo-class.\n */\n _notLast: \"&:not(:last-of-type)\",\n /**\n * The CSS `& > *:not(:last-child)` pseudo-class.\n */\n _notLastChild: \"& > *:not(:last-child)\",\n /**\n * The CSS `&:not(:target)` pseudo-class.\n */\n _notTarget: \"&:not(:target)\",\n /**\n * The CSS `&:nth-of-type(odd)` pseudo-class.\n */\n _odd: \"&:nth-of-type(odd)\",\n /**\n * The CSS `&:only-of-type` pseudo-class.\n */\n _only: \"&:only-of-type\",\n /**\n * The CSS `&:only-child` pseudo-class.\n */\n _onlyChild: \"&:only-child\",\n /**\n * The CSS `&:is(:optional, [data-optional])` pseudo-class.\n */\n _optional: \"&:is(:optional, [data-optional])\",\n /**\n * The CSS `&:is(:out-of-range, [data-out-of-range])` pseudo-class.\n */\n _outRange: \"&:is(:out-of-range, [data-out-of-range])\",\n /**\n * The CSS `&:is(:paused, [data-paused])` pseudo-class.\n */\n _paused: \"&:is(:paused, [data-paused])\",\n /**\n * The CSS `&:picture-in-picture` pseudo-class.\n */\n _picture: \"&:picture-in-picture\",\n /**\n * The CSS `&:placeholder-shown` pseudo-class.\n */\n _placeholderShown: \"&:placeholder-shown\",\n /**\n * The CSS `&:is(:playing, [data-playing])` pseudo-class.\n */\n _playing: \"&:is(:playing, [data-playing])\",\n /**\n * The CSS `&:popover-open` pseudo-class.\n */\n _popoverOpen: \"&:popover-open\",\n /**\n * The CSS `&:is(:read-write, [data-read-write])` pseudo-class.\n */\n _readWrite: \"&:is(:read-write, [data-read-write])\",\n /**\n * The CSS `&:is(:required, [required])` pseudo-class.\n */\n _required: \"&:is(:required, [required])\",\n /**\n * The CSS `&:is(:target, [data-target])` pseudo-class.\n */\n _target: \"&:is(:target, [data-target])\",\n /**\n * The CSS `&:is(:user-invalid, [data-user-invalid])` pseudo-class.\n */\n _userInvalid: \"&:is(:user-invalid, [data-user-invalid])\",\n /**\n * The CSS `&:is(:valid, [data-valid])` pseudo-class.\n */\n _valid: \"&:is(:valid, [data-valid])\",\n /**\n * The CSS `&:is([data-orientation=vertical], [aria-orientation=vertical])` pseudo-class.\n */\n _vertical: \"&:is([data-orientation=vertical], [aria-orientation=vertical])\",\n /**\n * The CSS `&:visited` pseudo-class.\n */\n _visited: \"&:visited\",\n /**\n * The CSS `&:is(:hover, [data-hover])` pseudo-class.\n */\n _hover:\n \"&:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])\",\n /**\n * The CSS `&:is(:active, [data-active])` pseudo-class.\n */\n _active:\n \"&:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])\",\n /**\n * The CSS `&:is(:focus, [data-focus])` pseudo-class.\n */\n _focus: \"&:is(:focus, [data-focus])\",\n /**\n * The CSS `&:is(:focus-visible, [data-focus-visible])` pseudo-class.\n */\n _focusVisible: \"&:is(:focus-visible, [data-focus-visible])\",\n /**\n * The CSS `&:is([data-invalid], [aria-invalid=true])` attribute selector.\n */\n _invalid: \"&:is([data-invalid], [aria-invalid=true])\",\n /**\n * The CSS `&:is([readonly], [data-readonly], [aria-readonly=true])` pseudo-class.\n */\n _readOnly: \"&:is([readonly], [data-readonly], [aria-readonly=true])\",\n /**\n * The CSS `&:is(:disabled, [disabled], [data-disabled])` pseudo-class.\n */\n _disabled: \"&:is(:disabled, [disabled], [data-disabled])\",\n} as const\n\nexport type PseudoClasses = typeof pseudoClasses\nexport type PseudoClassProperty = keyof PseudoClasses\nexport type PseudoClassProps = {\n [K in PseudoClassProperty]?: CSSObject\n}\n\nexport const pseudoClassProperties = Object.keys(\n pseudoClasses,\n) as PseudoClassProperty[]\nexport const pseudoClassSelectors = Object.values(pseudoClasses)\n\nexport const groupAttributes = {\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is accepted.\n */\n _groupAccept: toGroup(attributes._accept),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is activedescendant.\n */\n _groupActivedescendant: toGroup(pseudoClasses._activedescendant),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is blank.\n */\n _groupBlank: toGroup(pseudoClasses._blank),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is checked.\n */\n _groupChecked: toGroup(pseudoClasses._checked),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is collapsed.\n */\n _groupCollapsed: toGroup(attributes._collapsed),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is complete.\n */\n _groupComplete: toGroup(attributes._complete),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is current.\n */\n _groupCurrent: toGroup(attributes._current),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is enabled.\n */\n _groupEnabled: toGroup(pseudoClasses._enabled),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is expanded.\n */\n _groupExpanded: toGroup(attributes._expanded),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is focus-within.\n */\n _groupFocusWithin: toGroup(pseudoClasses._focusWithin),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is grabbed.\n */\n _groupGrabbed: toGroup(attributes._grabbed),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is horizontal.\n */\n _groupHorizontal: toGroup(pseudoClasses._horizontal),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is idle.\n */\n _groupIdle: toGroup(attributes._idle),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is incomplete.\n */\n _groupIncomplete: toGroup(attributes._incomplete),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is loaded.\n */\n _groupLoaded: toGroup(attributes._loaded),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is loading.\n */\n _groupLoading: toGroup(attributes._loading),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is open.\n */\n _groupOpen: toGroup(attributes._open),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is optional.\n */\n _groupOptional: toGroup(pseudoClasses._optional),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` has a placeholder shown.\n */\n _groupPlaceholderShown: toGroup(pseudoClasses._placeholderShown),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is pressed.\n */\n _groupPressed: toGroup(attributes._pressed),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is range.\n */\n _groupRange: toGroup(attributes._range),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is read-write.\n */\n _groupReadWrite: toGroup(pseudoClasses._readWrite),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is rejected.\n */\n _groupReject: toGroup(attributes._reject),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is required.\n */\n _groupRequired: toGroup(pseudoClasses._required),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is user-invalid.\n */\n _groupUserInvalid: toGroup(pseudoClasses._userInvalid),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is valid.\n */\n _groupValid: toGroup(pseudoClasses._valid),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is vertical.\n */\n _groupVertical: toGroup(pseudoClasses._vertical),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is hovered.\n */\n _groupHover: toGroup(pseudoClasses._hover),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is active.\n */\n _groupActive: toGroup(pseudoClasses._active),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is focused.\n */\n _groupFocus: toGroup(pseudoClasses._focus),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is focused-visible.\n */\n _groupFocusVisible: toGroup(pseudoClasses._focusVisible),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is selected.\n */\n _groupSelected: toGroup(attributes._selected),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is invalid.\n */\n _groupInvalid: toGroup(pseudoClasses._invalid),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is read-only.\n */\n _groupReadOnly: toGroup(pseudoClasses._readOnly),\n /**\n * Styles to apply when a parent element with `role=group`, `data-group` or `.group` is disabled.\n */\n _groupDisabled: toGroup(pseudoClasses._disabled),\n} as const\n\nexport type GroupAttributes = typeof groupAttributes\nexport type GroupAttributeProperty = keyof GroupAttributes\nexport type GroupAttributeProps = {\n [K in GroupAttributeProperty]?: CSSObject\n}\n\nexport const groupAttributeProperties = Object.keys(\n groupAttributes,\n) as GroupAttributeProperty[]\nexport const groupAttributeSelectors = Object.values(groupAttributes)\n\nexport const peerAttributes = {\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` exists.\n */\n _peer: toPeer(),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is accepted.\n */\n _peerAccept: toPeer(attributes._accept),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is blank.\n */\n _peerBlank: toPeer(pseudoClasses._blank),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is checked.\n */\n _peerChecked: toPeer(pseudoClasses._checked),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is collapsed.\n */\n _peerCollapsed: toPeer(attributes._collapsed),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is complete.\n */\n _peerComplete: toPeer(attributes._complete),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is current.\n */\n _peerCurrent: toPeer(attributes._current),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is enabled.\n */\n _peerEnabled: toPeer(pseudoClasses._enabled),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is expanded.\n */\n _peerExpanded: toPeer(attributes._expanded),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is focus-within.\n */\n _peerFocusWithin: toPeer(pseudoClasses._focusWithin),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is grabbed.\n */\n _peerGrabbed: toPeer(attributes._grabbed),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is horizontal.\n */\n _peerHorizontal: toPeer(pseudoClasses._horizontal),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is idle.\n */\n _peerIdle: toPeer(attributes._idle),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is incomplete.\n */\n _peerIncomplete: toPeer(attributes._incomplete),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is loaded.\n */\n _peerLoaded: toPeer(attributes._loaded),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is loading.\n */\n _peerLoading: toPeer(attributes._loading),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is optional.\n */\n _peerOptional: toPeer(pseudoClasses._optional),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` has a placeholder shown.\n */\n _peerPlaceholderShown: toPeer(pseudoClasses._placeholderShown),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is pressed.\n */\n _peerPressed: toPeer(attributes._pressed),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is range.\n */\n _peerRange: toPeer(attributes._range),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is read-write.\n */\n _peerReadWrite: toPeer(pseudoClasses._readWrite),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is rejected.\n */\n _peerReject: toPeer(attributes._reject),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is required.\n */\n _peerRequired: toPeer(pseudoClasses._required),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is user-invalid.\n */\n _peerUserInvalid: toPeer(pseudoClasses._userInvalid),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is valid.\n */\n _peerValid: toPeer(pseudoClasses._valid),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is vertical.\n */\n _peerVertical: toPeer(pseudoClasses._vertical),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is hovered.\n */\n _peerHover: toPeer(pseudoClasses._hover),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is active.\n */\n _peerActive: toPeer(pseudoClasses._active),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is focused.\n */\n _peerFocus: toPeer(pseudoClasses._focus),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is focused-visible.\n */\n _peerFocusVisible: toPeer(pseudoClasses._focusVisible),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is selected.\n */\n _peerSelected: toPeer(attributes._selected),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is invalid.\n */\n _peerInvalid: toPeer(pseudoClasses._invalid),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is read-only.\n */\n _peerReadOnly: toPeer(pseudoClasses._readOnly),\n /**\n * Styles to apply when a sibling element with `data-peer` or `.peer` is disabled.\n */\n _peerDisabled: toPeer(pseudoClasses._disabled),\n} as const\n\nexport type PeerAttributes = typeof peerAttributes\nexport type PeerAttributeProperty = keyof PeerAttributes\nexport type PeerAttributeProps = {\n [K in PeerAttributeProperty]?: CSSObject\n}\n\nexport const peerAttributeProperties = Object.keys(\n peerAttributes,\n) as PeerAttributeProperty[]\nexport const peerAttributeSelectors = Object.values(peerAttributes)\n\nexport const conditions = {\n ...pseudoElements,\n ...attributes,\n ...pseudoClasses,\n ...groupAttributes,\n ...peerAttributes,\n} as const\n\nexport type Conditions = typeof conditions\nexport type ConditionProperty = keyof Conditions\nexport type ConditionSelector = Conditions[ConditionProperty]\nexport type ConditionProps = {\n [K in keyof Conditions]?: CSSObject\n}\n\nexport const conditionProperties = Object.keys(\n conditions,\n) as ConditionProperty[]\nexport const conditionSelectors = Object.values(conditions)\n\nexport function getCondition(key: string) {\n return key in conditions ? conditions[key as ConditionProperty] : key\n}\n"],"mappings":";;AAYA,MAAM,WAA6B,aACjC;CAAC;CAAgB;CAAgB;CAAS,CACvC,KAAK,WAAW,GAAG,SAAS,SAAS,MAAM,EAAE,CAAC,IAAI,CAClD,KAAK,KAAK;AAMf,MAAM,UAA4B,aAChC,CACE,GAAG,CAAC,eAAe,QAAQ,CAAC,SAAS,WAAW,CAC9C,WACI,WAAW,SAAS,SAAS,MAAM,EAAE,CAAC,KACtC,WAAW,OAAO,IACtB,WAAW,GAAG,SAAS,SAAS,MAAM,EAAE,CAAC,QAAQ,GAAG,OAAO,MAC5D,CAAC,EACF,GAAI,WACA,CAAC,eAAe,QAAQ,CAAC,SAAS,WAAW,CAC3C,WAAW,OAAO,IAAI,SAAS,MAAM,EAAE,CAAC,IACxC,GAAG,OAAO,QAAQ,SA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,OAAO,WAAW,SAAS;CAIzC,eAAe,OAAO,cAAc,UAAU;CAI9C,uBAAuB,OAAO,cAAc,kBAAkB;CAI9D,cAAc,OAAO,WAAW,SAAS;CAIzC,YAAY,OAAO,WAAW,OAAO;CAIrC,gBAAgB,OAAO,cAAc,WAAW;CAIhD,aAAa,OAAO,WAAW,QAAQ;CAIvC,eAAe,OAAO,cAAc,UAAU;CAI9C,kBAAkB,OAAO,cAAc,aAAa;CAIpD,YAAY,OAAO,cAAc,OAAO;CAIxC,eAAe,OAAO,cAAc,UAAU;CAI9C,YAAY,OAAO,cAAc,OAAO;CAIxC,aAAa,OAAO,cAAc,QAAQ;CAI1C,YAAY,OAAO,cAAc,OAAO;CAIxC,mBAAmB,OAAO,cAAc,cAAc;CAItD,eAAe,OAAO,WAAW,UAAU;CAI3C,cAAc,OAAO,cAAc,SAAS;CAI5C,eAAe,OAAO,cAAc,UAAU;CAI9C,eAAe,OAAO,cAAc,UAAU;CAC/C;AAQD,MAAa,0BAA0B,OAAO,KAC5C,eACD;AACD,MAAa,yBAAyB,OAAO,OAAO,eAAe;AAEnE,MAAa,aAAa;CACxB,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACJ;AASD,MAAa,sBAAsB,OAAO,KACxC,WACD;AACD,MAAa,qBAAqB,OAAO,OAAO,WAAW;AAE3D,SAAgB,aAAa,KAAa;AACxC,QAAO,OAAO,aAAa,WAAW,OAA4B"}
|
|
@@ -9,7 +9,11 @@ let _floating_ui_react_dom = require("@floating-ui/react-dom");
|
|
|
9
9
|
//#region src/hooks/use-popper/index.ts
|
|
10
10
|
const PLACEMENT_MAP = {
|
|
11
11
|
"center-end": "right",
|
|
12
|
+
"center-end-end": "right-end",
|
|
13
|
+
"center-end-start": "right-start",
|
|
12
14
|
"center-start": "left",
|
|
15
|
+
"center-start-end": "left-end",
|
|
16
|
+
"center-start-start": "left-start",
|
|
13
17
|
end: "bottom",
|
|
14
18
|
"end-center": "bottom",
|
|
15
19
|
"end-end": "bottom-end",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["PLACEMENT_MAP: {\n [key in Direction]: FloatingPlacement\n}","middleware: (false | Middleware | null | undefined)[]","elements","middleware","autoUpdate","mergeRefs","popperProps: (keyof UsePopperProps)[]","useSplitProps"],"sources":["../../../../src/hooks/use-popper/index.ts"],"sourcesContent":["import type {\n Placement as FloatingPlacement,\n Middleware,\n Platform,\n Strategy,\n UseFloatingOptions,\n VirtualElement,\n} from \"@floating-ui/react-dom\"\nimport type { ComponentRef, Ref } from \"react\"\nimport type {\n Direction,\n DOMElement,\n HTMLElementProps,\n HTMLProps,\n} from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n size,\n useFloating,\n} from \"@floating-ui/react-dom\"\nimport { useCallback, useMemo } from \"react\"\nimport { useSplitProps } from \"../../core\"\nimport { mergeRefs } from \"../../utils\"\n\nconst PLACEMENT_MAP: {\n [key in Direction]: FloatingPlacement\n} = {\n \"center-end\": \"right\",\n \"center-start\": \"left\",\n end: \"bottom\",\n \"end-center\": \"bottom\",\n \"end-end\": \"bottom-end\",\n \"end-start\": \"bottom-start\",\n start: \"top\",\n \"start-center\": \"top\",\n \"start-end\": \"top-end\",\n \"start-start\": \"top-start\",\n}\n\ntype WhileElementsMounted = UseFloatingOptions[\"whileElementsMounted\"]\n\ntype Reference<Y extends DOMElement | VirtualElement = \"div\"> =\n Y extends DOMElement ? ComponentRef<Y> : Y\n\nexport interface UsePopperProps<Y extends DOMElement | VirtualElement = \"div\"> {\n /**\n * If `true`, automatically updates the position of the floating element when necessary.\n *\n * @default true\n */\n autoUpdate?: boolean\n /**\n * Object containing the reference and floating elements.\n */\n elements?: {\n floating?: HTMLElement | null\n reference?: null | Reference<Y>\n }\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: boolean\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: number\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: boolean\n /**\n * Array of middleware objects to modify the positioning or provide data for\n * rendering.\n */\n middleware?: (false | Middleware | null | undefined)[]\n /**\n * The main and cross-axis offset to displace popper element from its reference element.\n */\n offset?: [number, number]\n /**\n * Whether the popper should be enabled.\n *\n * @default true\n */\n open?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'start'\n */\n placement?: Direction\n /**\n * Custom or extended platform object.\n */\n platform?: Platform\n /**\n * If `true`, will prevent the popper from being cut off and ensure it's visible within the boundary area.\n *\n * @default true\n */\n preventOverflow?: boolean\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: Strategy\n /**\n * Whether to use `transform` for positioning instead of `top` and `left`\n * (layout) in the `floatingStyles` object.\n *\n * @default true\n */\n transform?: boolean\n /**\n * A callback invoked when both the reference and floating elements are\n * mounted, and cleaned up when either is unmounted. This is useful for\n * setting up event listeners (e.g. pass `autoUpdate`).\n */\n whileElementsMounted?: (\n reference: Reference<Y>,\n floating: HTMLElement,\n update: () => void,\n ) => () => void\n}\n\nexport const usePopper = <\n Y extends DOMElement | VirtualElement = \"div\",\n M extends DOMElement = \"div\",\n>({\n autoUpdate: autoUpdateProp = true,\n elements,\n flip: flipProp = true,\n gutter = 8,\n matchWidth,\n middleware: middlewareProp,\n offset: offsetProp,\n open = true,\n placement = \"start\",\n platform,\n preventOverflow = true,\n strategy = \"absolute\",\n transform = true,\n whileElementsMounted: whileElementsMountedProp,\n}: UsePopperProps<Y> = {}) => {\n const middleware = useMemo(() => {\n const middleware: (false | Middleware | null | undefined)[] = []\n\n if (offsetProp) {\n const [mainAxis, crossAxis] = offsetProp\n\n middleware.push(offset({ crossAxis, mainAxis }))\n } else if (gutter) {\n middleware.push(offset(gutter))\n }\n\n if (flipProp) middleware.push(flip())\n\n if (preventOverflow) middleware.push(shift())\n\n if (middlewareProp) middleware.push(...middlewareProp)\n\n if (matchWidth)\n middleware.push(\n size({\n apply({ elements, rects }) {\n Object.assign(elements.floating.style, {\n minWidth: `${rects.reference.width}px`,\n })\n },\n }),\n )\n\n return middleware\n }, [\n flipProp,\n gutter,\n matchWidth,\n middlewareProp,\n offsetProp,\n preventOverflow,\n ])\n const whileElementsMounted = useMemo(() => {\n if (whileElementsMountedProp)\n return whileElementsMountedProp as WhileElementsMounted\n\n if (autoUpdateProp) return autoUpdate\n }, [autoUpdateProp, whileElementsMountedProp])\n\n const { floatingStyles, refs, ...rest } = useFloating<Reference<Y>>({\n elements,\n middleware,\n open,\n placement: PLACEMENT_MAP[placement],\n platform,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n const getReferenceProps = useCallback(\n <D extends DOMElement | VirtualElement = Y>(\n props?: D extends DOMElement ? HTMLProps<D> : HTMLElementProps,\n ) =>\n ({\n ...props,\n ref: mergeRefs(props?.ref as Ref<any>, refs.setReference),\n }) as D extends DOMElement ? HTMLProps<D> : HTMLElementProps,\n [refs.setReference],\n )\n\n const getPopperProps = useCallback(\n <H extends DOMElement = M>(props?: HTMLProps<H>) =>\n ({\n ...props,\n ref: mergeRefs(props?.ref as Ref<any>, refs.setFloating),\n style: {\n ...props?.style,\n minWidth: matchWidth ? undefined : \"max-content\",\n ...floatingStyles,\n },\n }) as HTMLProps<H>,\n [refs.setFloating, matchWidth, floatingStyles],\n )\n\n return {\n ...rest,\n refs,\n getPopperProps,\n getReferenceProps,\n }\n}\n\nexport type UsePopperReturn = ReturnType<typeof usePopper>\n\nexport const popperProps: (keyof UsePopperProps)[] = [\n \"autoUpdate\",\n \"elements\",\n \"flip\",\n \"gutter\",\n \"matchWidth\",\n \"middleware\",\n \"offset\",\n \"open\",\n \"placement\",\n \"platform\",\n \"preventOverflow\",\n \"strategy\",\n \"transform\",\n \"whileElementsMounted\",\n]\n\nexport const usePopperProps = <\n Y extends DOMElement | VirtualElement = \"div\",\n M extends Dict = Dict,\n D extends keyof UsePopperProps = keyof UsePopperProps,\n>(\n props: M,\n omitKeys?: D[],\n) => {\n return useSplitProps(\n props,\n popperProps.filter((key) => !omitKeys?.includes(key as D)),\n ) as unknown as [\n keyof UsePopperProps extends D\n ? UsePopperProps<Y>\n : Omit<UsePopperProps<Y>, D>,\n Omit<\n M,\n keyof UsePopperProps extends D\n ? keyof UsePopperProps\n : Exclude<keyof UsePopperProps, D>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;AA4BA,MAAMA,gBAEF;CACF,cAAc;CACd,gBAAgB;CAChB,KAAK;CACL,cAAc;CACd,WAAW;CACX,aAAa;CACb,OAAO;CACP,gBAAgB;CAChB,aAAa;CACb,eAAe;CAChB;AAiGD,MAAa,aAGX,EACA,YAAY,iBAAiB,MAC7B,UACA,MAAM,WAAW,MACjB,SAAS,GACT,YACA,YAAY,gBACZ,QAAQ,YACR,OAAO,MACP,YAAY,SACZ,UACA,kBAAkB,MAClB,WAAW,YACX,YAAY,MACZ,sBAAsB,6BACD,EAAE,KAAK;CAC5B,MAAM,sCAA2B;EAC/B,MAAMC,eAAwD,EAAE;AAEhE,MAAI,YAAY;GACd,MAAM,CAAC,UAAU,aAAa;AAE9B,gBAAW,wCAAY;IAAE;IAAW;IAAU,CAAC,CAAC;aACvC,OACT,cAAW,wCAAY,OAAO,CAAC;AAGjC,MAAI,SAAU,cAAW,uCAAW,CAAC;AAErC,MAAI,gBAAiB,cAAW,wCAAY,CAAC;AAE7C,MAAI,eAAgB,cAAW,KAAK,GAAG,eAAe;AAEtD,MAAI,WACF,cAAW,sCACJ,EACH,MAAM,EAAE,sBAAU,SAAS;AACzB,UAAO,OAAOC,WAAS,SAAS,OAAO,EACrC,UAAU,GAAG,MAAM,UAAU,MAAM,KACpC,CAAC;KAEL,CAAC,CACH;AAEH,SAAOC;IACN;EACD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CACF,MAAM,gDAAqC;AACzC,MAAI,yBACF,QAAO;AAET,MAAI,eAAgB,QAAOC;IAC1B,CAAC,gBAAgB,yBAAyB,CAAC;CAE9C,MAAM,EAAE,gBAAgB,MAAM,GAAG,iDAAmC;EAClE;EACA;EACA;EACA,WAAW,cAAc;EACzB;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,4CAEF,WAEC;EACC,GAAG;EACH,KAAKC,sBAAU,OAAO,KAAiB,KAAK,aAAa;EAC1D,GACH,CAAC,KAAK,aAAa,CACpB;CAED,MAAM,yCACuB,WACxB;EACC,GAAG;EACH,KAAKA,sBAAU,OAAO,KAAiB,KAAK,YAAY;EACxD,OAAO;GACL,GAAG,OAAO;GACV,UAAU,aAAa,SAAY;GACnC,GAAG;GACJ;EACF,GACH;EAAC,KAAK;EAAa;EAAY;EAAe,CAC/C;AAED,QAAO;EACL,GAAG;EACH;EACA;EACA;EACD;;AAKH,MAAaC,cAAwC;CACnD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,kBAKX,OACA,aACG;AACH,QAAOC,4BACL,OACA,YAAY,QAAQ,QAAQ,CAAC,UAAU,SAAS,IAAS,CAAC,CAC3D"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["PLACEMENT_MAP: {\n [key in Direction]: FloatingPlacement\n}","middleware: (false | Middleware | null | undefined)[]","elements","middleware","autoUpdate","mergeRefs","popperProps: (keyof UsePopperProps)[]","useSplitProps"],"sources":["../../../../src/hooks/use-popper/index.ts"],"sourcesContent":["import type {\n Placement as FloatingPlacement,\n Middleware,\n Platform,\n Strategy,\n UseFloatingOptions,\n VirtualElement,\n} from \"@floating-ui/react-dom\"\nimport type { ComponentRef, Ref } from \"react\"\nimport type {\n Direction,\n DOMElement,\n HTMLElementProps,\n HTMLProps,\n} from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n size,\n useFloating,\n} from \"@floating-ui/react-dom\"\nimport { useCallback, useMemo } from \"react\"\nimport { useSplitProps } from \"../../core\"\nimport { mergeRefs } from \"../../utils\"\n\nconst PLACEMENT_MAP: {\n [key in Direction]: FloatingPlacement\n} = {\n \"center-end\": \"right\",\n \"center-end-end\": \"right-end\",\n \"center-end-start\": \"right-start\",\n \"center-start\": \"left\",\n \"center-start-end\": \"left-end\",\n \"center-start-start\": \"left-start\",\n end: \"bottom\",\n \"end-center\": \"bottom\",\n \"end-end\": \"bottom-end\",\n \"end-start\": \"bottom-start\",\n start: \"top\",\n \"start-center\": \"top\",\n \"start-end\": \"top-end\",\n \"start-start\": \"top-start\",\n}\n\ntype WhileElementsMounted = UseFloatingOptions[\"whileElementsMounted\"]\n\ntype Reference<Y extends DOMElement | VirtualElement = \"div\"> =\n Y extends DOMElement ? ComponentRef<Y> : Y\n\nexport interface UsePopperProps<Y extends DOMElement | VirtualElement = \"div\"> {\n /**\n * If `true`, automatically updates the position of the floating element when necessary.\n *\n * @default true\n */\n autoUpdate?: boolean\n /**\n * Object containing the reference and floating elements.\n */\n elements?: {\n floating?: HTMLElement | null\n reference?: null | Reference<Y>\n }\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: boolean\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: number\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: boolean\n /**\n * Array of middleware objects to modify the positioning or provide data for\n * rendering.\n */\n middleware?: (false | Middleware | null | undefined)[]\n /**\n * The main and cross-axis offset to displace popper element from its reference element.\n */\n offset?: [number, number]\n /**\n * Whether the popper should be enabled.\n *\n * @default true\n */\n open?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'start'\n */\n placement?: Direction\n /**\n * Custom or extended platform object.\n */\n platform?: Platform\n /**\n * If `true`, will prevent the popper from being cut off and ensure it's visible within the boundary area.\n *\n * @default true\n */\n preventOverflow?: boolean\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: Strategy\n /**\n * Whether to use `transform` for positioning instead of `top` and `left`\n * (layout) in the `floatingStyles` object.\n *\n * @default true\n */\n transform?: boolean\n /**\n * A callback invoked when both the reference and floating elements are\n * mounted, and cleaned up when either is unmounted. This is useful for\n * setting up event listeners (e.g. pass `autoUpdate`).\n */\n whileElementsMounted?: (\n reference: Reference<Y>,\n floating: HTMLElement,\n update: () => void,\n ) => () => void\n}\n\nexport const usePopper = <\n Y extends DOMElement | VirtualElement = \"div\",\n M extends DOMElement = \"div\",\n>({\n autoUpdate: autoUpdateProp = true,\n elements,\n flip: flipProp = true,\n gutter = 8,\n matchWidth,\n middleware: middlewareProp,\n offset: offsetProp,\n open = true,\n placement = \"start\",\n platform,\n preventOverflow = true,\n strategy = \"absolute\",\n transform = true,\n whileElementsMounted: whileElementsMountedProp,\n}: UsePopperProps<Y> = {}) => {\n const middleware = useMemo(() => {\n const middleware: (false | Middleware | null | undefined)[] = []\n\n if (offsetProp) {\n const [mainAxis, crossAxis] = offsetProp\n\n middleware.push(offset({ crossAxis, mainAxis }))\n } else if (gutter) {\n middleware.push(offset(gutter))\n }\n\n if (flipProp) middleware.push(flip())\n\n if (preventOverflow) middleware.push(shift())\n\n if (middlewareProp) middleware.push(...middlewareProp)\n\n if (matchWidth)\n middleware.push(\n size({\n apply({ elements, rects }) {\n Object.assign(elements.floating.style, {\n minWidth: `${rects.reference.width}px`,\n })\n },\n }),\n )\n\n return middleware\n }, [\n flipProp,\n gutter,\n matchWidth,\n middlewareProp,\n offsetProp,\n preventOverflow,\n ])\n const whileElementsMounted = useMemo(() => {\n if (whileElementsMountedProp)\n return whileElementsMountedProp as WhileElementsMounted\n\n if (autoUpdateProp) return autoUpdate\n }, [autoUpdateProp, whileElementsMountedProp])\n\n const { floatingStyles, refs, ...rest } = useFloating<Reference<Y>>({\n elements,\n middleware,\n open,\n placement: PLACEMENT_MAP[placement],\n platform,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n const getReferenceProps = useCallback(\n <D extends DOMElement | VirtualElement = Y>(\n props?: D extends DOMElement ? HTMLProps<D> : HTMLElementProps,\n ) =>\n ({\n ...props,\n ref: mergeRefs(props?.ref as Ref<any>, refs.setReference),\n }) as D extends DOMElement ? HTMLProps<D> : HTMLElementProps,\n [refs.setReference],\n )\n\n const getPopperProps = useCallback(\n <H extends DOMElement = M>(props?: HTMLProps<H>) =>\n ({\n ...props,\n ref: mergeRefs(props?.ref as Ref<any>, refs.setFloating),\n style: {\n ...props?.style,\n minWidth: matchWidth ? undefined : \"max-content\",\n ...floatingStyles,\n },\n }) as HTMLProps<H>,\n [refs.setFloating, matchWidth, floatingStyles],\n )\n\n return {\n ...rest,\n refs,\n getPopperProps,\n getReferenceProps,\n }\n}\n\nexport type UsePopperReturn = ReturnType<typeof usePopper>\n\nexport const popperProps: (keyof UsePopperProps)[] = [\n \"autoUpdate\",\n \"elements\",\n \"flip\",\n \"gutter\",\n \"matchWidth\",\n \"middleware\",\n \"offset\",\n \"open\",\n \"placement\",\n \"platform\",\n \"preventOverflow\",\n \"strategy\",\n \"transform\",\n \"whileElementsMounted\",\n]\n\nexport const usePopperProps = <\n Y extends DOMElement | VirtualElement = \"div\",\n M extends Dict = Dict,\n D extends keyof UsePopperProps = keyof UsePopperProps,\n>(\n props: M,\n omitKeys?: D[],\n) => {\n return useSplitProps(\n props,\n popperProps.filter((key) => !omitKeys?.includes(key as D)),\n ) as unknown as [\n keyof UsePopperProps extends D\n ? UsePopperProps<Y>\n : Omit<UsePopperProps<Y>, D>,\n Omit<\n M,\n keyof UsePopperProps extends D\n ? keyof UsePopperProps\n : Exclude<keyof UsePopperProps, D>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;AA4BA,MAAMA,gBAEF;CACF,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,gBAAgB;CAChB,oBAAoB;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AO,KAAiB,KAAK,YAAY;EACxD,OAAO;GACL,GAAG,OAAO;GACV,UAAU,aAAa,SAAY;GACnC,GAAG;GACJ;EACF,GACH;EAAC,KAAK;EAAa;EAAY;EAAe,CAC/C;AAED,QAAO;EACL,GAAG;EACH;EACA;EACA;EACD;;AAKH,MAAaC,cAAwC;CACnD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,kBAKX,OACA,aACG;AACH,QAAOC,4BACL,OACA,YAAY,QAAQ,QAAQ,CAAC,UAAU,SAAS,IAAS,CAAC,CAC3D"}
|
|
@@ -10,10 +10,26 @@ const PLACEMENT_MAP = {
|
|
|
10
10
|
align: "right",
|
|
11
11
|
verticalAlign: "middle"
|
|
12
12
|
},
|
|
13
|
+
"center-end-end": {
|
|
14
|
+
align: "right",
|
|
15
|
+
verticalAlign: "bottom"
|
|
16
|
+
},
|
|
17
|
+
"center-end-start": {
|
|
18
|
+
align: "right",
|
|
19
|
+
verticalAlign: "top"
|
|
20
|
+
},
|
|
13
21
|
"center-start": {
|
|
14
22
|
align: "left",
|
|
15
23
|
verticalAlign: "middle"
|
|
16
24
|
},
|
|
25
|
+
"center-start-end": {
|
|
26
|
+
align: "left",
|
|
27
|
+
verticalAlign: "bottom"
|
|
28
|
+
},
|
|
29
|
+
"center-start-start": {
|
|
30
|
+
align: "left",
|
|
31
|
+
verticalAlign: "top"
|
|
32
|
+
},
|
|
17
33
|
end: {
|
|
18
34
|
align: "center",
|
|
19
35
|
verticalAlign: "bottom"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chart.js","names":["PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n}","createContext","getRootProps: PropGetter","getLegendProps: PropGetter<LegendProps>","getRootProps: PropGetter<TooltipProps<Y, M>>","getRootProps: PropGetter<\"text\">"],"sources":["../../../../src/components/chart/use-chart.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n LabelListProps,\n LabelProps,\n LegendProps,\n TooltipProps,\n} from \"recharts\"\nimport type {\n Direction,\n HTMLProps,\n PropGetter,\n RequiredPropGetter,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport { useCallback, useState } from \"react\"\nimport { createContext, dataAttr, handlerAll, isUndefined } from \"../../utils\"\n\nconst PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n} = {\n \"center-end\": { align: \"right\", verticalAlign: \"middle\" },\n \"center-start\": { align: \"left\", verticalAlign: \"middle\" },\n end: { align: \"center\", verticalAlign: \"bottom\" },\n \"end-center\": { align: \"center\", verticalAlign: \"bottom\" },\n \"end-end\": { align: \"right\", verticalAlign: \"bottom\" },\n \"end-start\": { align: \"left\", verticalAlign: \"bottom\" },\n start: { align: \"center\", verticalAlign: \"top\" },\n \"start-center\": { align: \"center\", verticalAlign: \"top\" },\n \"start-end\": { align: \"right\", verticalAlign: \"top\" },\n \"start-start\": { align: \"left\", verticalAlign: \"top\" },\n}\n\ninterface ChartContext extends UseChartReturn {}\n\nconst [ChartContext, useChartContext] = createContext<ChartContext>({\n name: \"ChartContext\",\n})\n\nexport { ChartContext, useChartContext }\n\nexport const useChart = () => {\n const [highlightedDataKey, setHighlightedDataKey] = useState<\n number | string | undefined\n >(undefined)\n\n const onHighlight = useCallback((dataKey?: number | string) => {\n setHighlightedDataKey(dataKey)\n }, [])\n\n return { highlightedDataKey, onHighlight }\n}\n\nexport type UseChartReturn = ReturnType<typeof useChart>\n\nexport interface UseChartLegendProps extends Merge<\n HTMLProps,\n Pick<\n LegendProps,\n | \"align\"\n | \"content\"\n | \"formatter\"\n | \"itemSorter\"\n | \"layout\"\n | \"onBBoxUpdate\"\n | \"onClick\"\n | \"onMouseEnter\"\n | \"onMouseLeave\"\n | \"payloadUniqBy\"\n | \"portal\"\n | \"verticalAlign\"\n >\n> {\n /**\n * The placement of the legend.\n *\n * @default 'start-end'\n */\n placement?: Direction\n}\n\nexport const useChartLegend = ({\n placement = \"start-end\",\n align = PLACEMENT_MAP[placement].align,\n content,\n formatter,\n itemSorter,\n layout = placement.startsWith(\"center\") ? \"vertical\" : \"horizontal\",\n payloadUniqBy,\n portal,\n verticalAlign = PLACEMENT_MAP[placement].verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: UseChartLegendProps = {}) => {\n const { highlightedDataKey, onHighlight } = useChartContext()\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLegendProps: PropGetter<LegendProps> = useCallback(\n (props) => ({\n align,\n content,\n formatter,\n itemSorter,\n layout,\n payloadUniqBy,\n portal,\n verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...props,\n }),\n [\n align,\n content,\n formatter,\n itemSorter,\n layout,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n payloadUniqBy,\n portal,\n verticalAlign,\n ],\n )\n\n const getLegendContentProps: PropGetter = useCallback(\n (props) => ({\n \"data-align\": align,\n \"data-orientation\": layout,\n \"data-vertical-align\": verticalAlign,\n ...props,\n }),\n [align, layout, verticalAlign],\n )\n\n const getLegendItemProps: RequiredPropGetter<\n \"div\",\n { dataKey?: number | string }\n > = useCallback(\n ({ dataKey, ...props }) => ({\n ...props,\n \"data-active\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey === dataKey,\n ),\n \"data-inactive\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey !== dataKey,\n ),\n onMouseEnter: handlerAll(props.onMouseEnter, () => onHighlight(dataKey)),\n onMouseLeave: handlerAll(props.onMouseLeave, () => onHighlight()),\n }),\n [highlightedDataKey, onHighlight],\n )\n\n return {\n getLegendContentProps,\n getLegendItemProps,\n getLegendProps,\n getRootProps,\n }\n}\n\nexport type UseChartLegendReturn = ReturnType<typeof useChartLegend>\n\nexport interface UseChartTooltipProps<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> extends Merge<\n HTMLProps,\n Omit<\n TooltipProps<Y, M>,\n | \"contentStyle\"\n | \"itemStyle\"\n | \"labelClassName\"\n | \"labelStyle\"\n | \"separator\"\n | \"wrapperClassName\"\n | \"wrapperStyle\"\n >\n> {}\n\nexport const useChartTooltip = <\n Y extends (number | string)[] | number | string,\n M extends number | string,\n>({\n active,\n allowEscapeViewBox,\n animationDuration = 0,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive = (animationDuration || 0) > 0,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...rest\n}: UseChartTooltipProps<Y, M> = {}) => {\n const getRootProps: PropGetter<TooltipProps<Y, M>> = useCallback(\n (props) => ({\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...props,\n }),\n [\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props) => ({\n ...rest,\n ...props,\n }),\n [rest],\n )\n\n return { getContentProps, getRootProps }\n}\n\nexport type UseChartTooltipReturn<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> = ReturnType<typeof useChartTooltip<Y, M>>\n\nexport interface UseChartLabelListProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelListProps,\n | \"angle\"\n | \"clockWise\"\n | \"content\"\n | \"dataKey\"\n | \"formatter\"\n | \"offset\"\n | \"position\"\n | \"textBreakAll\"\n | \"valueAccessor\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabelList = ({\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset = 12,\n position = \"top\",\n textBreakAll,\n valueAccessor,\n zIndex,\n ...rest\n}: UseChartLabelListProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelListProps: PropGetter<LabelListProps> = useCallback(\n (props) => ({\n angle,\n clockWise,\n content,\n dataKey,\n fill: \"\",\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ...props,\n }),\n [\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ],\n )\n\n return { getLabelListProps, getRootProps }\n}\n\nexport type UseChartLabelListReturn = ReturnType<typeof useChartLabelList>\n\nexport interface UseChartLabelProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelProps,\n | \"angle\"\n | \"children\"\n | \"content\"\n | \"formatter\"\n | \"labelRef\"\n | \"offset\"\n | \"parentViewBox\"\n | \"position\"\n | \"value\"\n | \"viewBox\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabel = ({\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...rest\n}: UseChartLabelProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelProps: PropGetter<LabelProps> = useCallback(\n (props) => ({\n angle,\n children,\n content,\n fill: \"\",\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...props,\n }),\n [\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ],\n )\n\n return { getLabelProps, getRootProps }\n}\n\nexport type UseChartLabelReturn = ReturnType<typeof useChartLabel>\n"],"mappings":";;;;;;;AAkBA,MAAMA,gBAKF;CACF,cAAc;EAAE,OAAO;EAAS,eAAe;EAAU;CACzD,gBAAgB;EAAE,OAAO;EAAQ,eAAe;EAAU;CAC1D,KAAK;EAAE,OAAO;EAAU,eAAe;EAAU;CACjD,cAAc;EAAE,OAAO;EAAU,eAAe;EAAU;CAC1D,WAAW;EAAE,OAAO;EAAS,eAAe;EAAU;CACtD,aAAa;EAAE,OAAO;EAAQ,eAAe;EAAU;CACvD,OAAO;EAAE,OAAO;EAAU,eAAe;EAAO;CAChD,gBAAgB;EAAE,OAAO;EAAU,eAAe;EAAO;CACzD,aAAa;EAAE,OAAO;EAAS,eAAe;EAAO;CACrD,eAAe;EAAE,OAAO;EAAQ,eAAe;EAAO;CACvD;AAID,MAAM,CAAC,cAAc,mBAAmBC,gBAA4B,EAClE,MAAM,gBACP,CAAC;AAIF,MAAa,iBAAiB;CAC5B,MAAM,CAAC,oBAAoB,yBAAyB,SAElD,OAAU;AAMZ,QAAO;EAAE;EAAoB,aAJT,aAAa,YAA8B;AAC7D,yBAAsB,QAAQ;KAC7B,EAAE,CAAC;EAEoC;;AA+B5C,MAAa,kBAAkB,EAC7B,YAAY,aACZ,QAAQ,cAAc,WAAW,OACjC,SACA,WACA,YACA,SAAS,UAAU,WAAW,SAAS,GAAG,aAAa,cACvD,eACA,QACA,gBAAgB,cAAc,WAAW,eACzC,cACA,SACA,cACA,cACA,GAAG,SACoB,EAAE,KAAK;CAC9B,MAAM,EAAE,oBAAoB,gBAAgB,iBAAiB;CAE7D,MAAMC,eAA2B,aAC9B,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;CAED,MAAMC,iBAA0C,aAC7C,WAAW;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AA8BD,QAAO;EACL,uBA7BwC,aACvC,WAAW;GACV,cAAc;GACd,oBAAoB;GACpB,uBAAuB;GACvB,GAAG;GACJ,GACD;GAAC;GAAO;GAAQ;GAAc,CAC/B;EAsBC,oBAjBE,aACD,EAAE,SAAS,GAAG,aAAa;GAC1B,GAAG;GACH,2CACE,gCAAa,mBAAmB,IAAI,uBAAuB,QAC5D;GACD,6CACE,gCAAa,mBAAmB,IAAI,uBAAuB,QAC5D;GACD,4CAAyB,MAAM,oBAAoB,YAAY,QAAQ,CAAC;GACxE,4CAAyB,MAAM,oBAAoB,aAAa,CAAC;GAClE,GACD,CAAC,oBAAoB,YAAY,CAClC;EAKC;EACA;EACD;;AAsBH,MAAa,mBAGX,EACA,QACA,oBACA,oBAAoB,GACpB,iBACA,QACA,SACA,QACA,cACA,YACA,WACA,eACA,qBAAqB,qBAAqB,KAAK,GAC/C,YACA,gBACA,QACA,eACA,QACA,UACA,kBACA,QACA,SACA,gBACA,GAAG,SAC2B,EAAE,KAAK;CACrC,MAAMC,eAA+C,aAClD,WAAW;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAUD,QAAO;EAAE,iBAR2B,aACjC,WAAW;GACV,GAAG;GACH,GAAG;GACJ,GACD,CAAC,KAAK,CACP;EAEyB;EAAc;;AAyB1C,MAAa,qBAAqB,EAChC,OACA,WACA,SACA,SACA,WACA,SAAS,IACT,WAAW,OACX,cACA,eACA,QACA,GAAG,SACuB,EAAE,KAAK;CACjC,MAAMC,eAAmC,aACtC,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AA+BD,QAAO;EAAE,mBA7B6C,aACnD,WAAW;GACV;GACA;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAE2B;EAAc;;AAuB5C,MAAa,iBAAiB,EAC5B,OACA,UACA,SACA,WACA,UACA,QACA,eACA,UACA,OACA,SACA,QACA,GAAG,SACmB,EAAE,KAAK;CAC7B,MAAMA,eAAmC,aACtC,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AAiCD,QAAO;EAAE,eA/BqC,aAC3C,WAAW;GACV;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAEuB;EAAc"}
|
|
1
|
+
{"version":3,"file":"use-chart.js","names":["PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n}","createContext","getRootProps: PropGetter","getLegendProps: PropGetter<LegendProps>","getRootProps: PropGetter<TooltipProps<Y, M>>","getRootProps: PropGetter<\"text\">"],"sources":["../../../../src/components/chart/use-chart.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n LabelListProps,\n LabelProps,\n LegendProps,\n TooltipProps,\n} from \"recharts\"\nimport type {\n Direction,\n HTMLProps,\n PropGetter,\n RequiredPropGetter,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport { useCallback, useState } from \"react\"\nimport { createContext, dataAttr, handlerAll, isUndefined } from \"../../utils\"\n\nconst PLACEMENT_MAP: {\n [key in Direction]: {\n align: LegendProps[\"align\"]\n verticalAlign: LegendProps[\"verticalAlign\"]\n }\n} = {\n \"center-end\": { align: \"right\", verticalAlign: \"middle\" },\n \"center-end-end\": { align: \"right\", verticalAlign: \"bottom\" },\n \"center-end-start\": { align: \"right\", verticalAlign: \"top\" },\n \"center-start\": { align: \"left\", verticalAlign: \"middle\" },\n \"center-start-end\": { align: \"left\", verticalAlign: \"bottom\" },\n \"center-start-start\": { align: \"left\", verticalAlign: \"top\" },\n end: { align: \"center\", verticalAlign: \"bottom\" },\n \"end-center\": { align: \"center\", verticalAlign: \"bottom\" },\n \"end-end\": { align: \"right\", verticalAlign: \"bottom\" },\n \"end-start\": { align: \"left\", verticalAlign: \"bottom\" },\n start: { align: \"center\", verticalAlign: \"top\" },\n \"start-center\": { align: \"center\", verticalAlign: \"top\" },\n \"start-end\": { align: \"right\", verticalAlign: \"top\" },\n \"start-start\": { align: \"left\", verticalAlign: \"top\" },\n}\n\ninterface ChartContext extends UseChartReturn {}\n\nconst [ChartContext, useChartContext] = createContext<ChartContext>({\n name: \"ChartContext\",\n})\n\nexport { ChartContext, useChartContext }\n\nexport const useChart = () => {\n const [highlightedDataKey, setHighlightedDataKey] = useState<\n number | string | undefined\n >(undefined)\n\n const onHighlight = useCallback((dataKey?: number | string) => {\n setHighlightedDataKey(dataKey)\n }, [])\n\n return { highlightedDataKey, onHighlight }\n}\n\nexport type UseChartReturn = ReturnType<typeof useChart>\n\nexport interface UseChartLegendProps extends Merge<\n HTMLProps,\n Pick<\n LegendProps,\n | \"align\"\n | \"content\"\n | \"formatter\"\n | \"itemSorter\"\n | \"layout\"\n | \"onBBoxUpdate\"\n | \"onClick\"\n | \"onMouseEnter\"\n | \"onMouseLeave\"\n | \"payloadUniqBy\"\n | \"portal\"\n | \"verticalAlign\"\n >\n> {\n /**\n * The placement of the legend.\n *\n * @default 'start-end'\n */\n placement?: Direction\n}\n\nexport const useChartLegend = ({\n placement = \"start-end\",\n align = PLACEMENT_MAP[placement].align,\n content,\n formatter,\n itemSorter,\n layout = placement.startsWith(\"center\") ? \"vertical\" : \"horizontal\",\n payloadUniqBy,\n portal,\n verticalAlign = PLACEMENT_MAP[placement].verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...rest\n}: UseChartLegendProps = {}) => {\n const { highlightedDataKey, onHighlight } = useChartContext()\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLegendProps: PropGetter<LegendProps> = useCallback(\n (props) => ({\n align,\n content,\n formatter,\n itemSorter,\n layout,\n payloadUniqBy,\n portal,\n verticalAlign,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...props,\n }),\n [\n align,\n content,\n formatter,\n itemSorter,\n layout,\n onBBoxUpdate,\n onClick,\n onMouseEnter,\n onMouseLeave,\n payloadUniqBy,\n portal,\n verticalAlign,\n ],\n )\n\n const getLegendContentProps: PropGetter = useCallback(\n (props) => ({\n \"data-align\": align,\n \"data-orientation\": layout,\n \"data-vertical-align\": verticalAlign,\n ...props,\n }),\n [align, layout, verticalAlign],\n )\n\n const getLegendItemProps: RequiredPropGetter<\n \"div\",\n { dataKey?: number | string }\n > = useCallback(\n ({ dataKey, ...props }) => ({\n ...props,\n \"data-active\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey === dataKey,\n ),\n \"data-inactive\": dataAttr(\n !isUndefined(highlightedDataKey) && highlightedDataKey !== dataKey,\n ),\n onMouseEnter: handlerAll(props.onMouseEnter, () => onHighlight(dataKey)),\n onMouseLeave: handlerAll(props.onMouseLeave, () => onHighlight()),\n }),\n [highlightedDataKey, onHighlight],\n )\n\n return {\n getLegendContentProps,\n getLegendItemProps,\n getLegendProps,\n getRootProps,\n }\n}\n\nexport type UseChartLegendReturn = ReturnType<typeof useChartLegend>\n\nexport interface UseChartTooltipProps<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> extends Merge<\n HTMLProps,\n Omit<\n TooltipProps<Y, M>,\n | \"contentStyle\"\n | \"itemStyle\"\n | \"labelClassName\"\n | \"labelStyle\"\n | \"separator\"\n | \"wrapperClassName\"\n | \"wrapperStyle\"\n >\n> {}\n\nexport const useChartTooltip = <\n Y extends (number | string)[] | number | string,\n M extends number | string,\n>({\n active,\n allowEscapeViewBox,\n animationDuration = 0,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive = (animationDuration || 0) > 0,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...rest\n}: UseChartTooltipProps<Y, M> = {}) => {\n const getRootProps: PropGetter<TooltipProps<Y, M>> = useCallback(\n (props) => ({\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ...props,\n }),\n [\n active,\n allowEscapeViewBox,\n animationDuration,\n animationEasing,\n axisId,\n content,\n cursor,\n defaultIndex,\n filterNull,\n formatter,\n includeHidden,\n isAnimationActive,\n itemSorter,\n labelFormatter,\n offset,\n payloadUniqBy,\n portal,\n position,\n reverseDirection,\n shared,\n trigger,\n useTranslate3d,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props) => ({\n ...rest,\n ...props,\n }),\n [rest],\n )\n\n return { getContentProps, getRootProps }\n}\n\nexport type UseChartTooltipReturn<\n Y extends (number | string)[] | number | string,\n M extends number | string,\n> = ReturnType<typeof useChartTooltip<Y, M>>\n\nexport interface UseChartLabelListProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelListProps,\n | \"angle\"\n | \"clockWise\"\n | \"content\"\n | \"dataKey\"\n | \"formatter\"\n | \"offset\"\n | \"position\"\n | \"textBreakAll\"\n | \"valueAccessor\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabelList = ({\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset = 12,\n position = \"top\",\n textBreakAll,\n valueAccessor,\n zIndex,\n ...rest\n}: UseChartLabelListProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelListProps: PropGetter<LabelListProps> = useCallback(\n (props) => ({\n angle,\n clockWise,\n content,\n dataKey,\n fill: \"\",\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ...props,\n }),\n [\n angle,\n clockWise,\n content,\n dataKey,\n formatter,\n offset,\n position,\n textBreakAll,\n valueAccessor,\n zIndex,\n ],\n )\n\n return { getLabelListProps, getRootProps }\n}\n\nexport type UseChartLabelListReturn = ReturnType<typeof useChartLabelList>\n\nexport interface UseChartLabelProps extends Merge<\n HTMLProps<\"text\">,\n Pick<\n LabelProps,\n | \"angle\"\n | \"children\"\n | \"content\"\n | \"formatter\"\n | \"labelRef\"\n | \"offset\"\n | \"parentViewBox\"\n | \"position\"\n | \"value\"\n | \"viewBox\"\n | \"zIndex\"\n >\n> {}\n\nexport const useChartLabel = ({\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...rest\n}: UseChartLabelProps = {}) => {\n const getRootProps: PropGetter<\"text\"> = useCallback(\n (props) => ({ ...rest, ...props }),\n [rest],\n )\n\n const getLabelProps: PropGetter<LabelProps> = useCallback(\n (props) => ({\n angle,\n children,\n content,\n fill: \"\",\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ...props,\n }),\n [\n angle,\n children,\n content,\n formatter,\n labelRef,\n offset,\n parentViewBox,\n position,\n value,\n viewBox,\n zIndex,\n ],\n )\n\n return { getLabelProps, getRootProps }\n}\n\nexport type UseChartLabelReturn = ReturnType<typeof useChartLabel>\n"],"mappings":";;;;;;;AAk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,WAAW;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AA8BD,QAAO;EACL,uBA7BwC,aACvC,WAAW;GACV,cAAc;GACd,oBAAoB;GACpB,uBAAuB;GACvB,GAAG;GACJ,GACD;GAAC;GAAO;GAAQ;GAAc,CAC/B;EAsBC,oBAjBE,aACD,EAAE,SAAS,GAAG,aAAa;GAC1B,GAAG;GACH,2CACE,gCAAa,mBAAmB,IAAI,uBAAuB,QAC5D;GACD,6CACE,gCAAa,mBAAmB,IAAI,uBAAuB,QAC5D;GACD,4CAAyB,MAAM,oBAAoB,YAAY,QAAQ,CAAC;GACxE,4CAAyB,MAAM,oBAAoB,aAAa,CAAC;GAClE,GACD,CAAC,oBAAoB,YAAY,CAClC;EAKC;EACA;EACD;;AAsBH,MAAa,mBAGX,EACA,QACA,oBACA,oBAAoB,GACpB,iBACA,QACA,SACA,QACA,cACA,YACA,WACA,eACA,qBAAqB,qBAAqB,KAAK,GAC/C,YACA,gBACA,QACA,eACA,QACA,UACA,kBACA,QACA,SACA,gBACA,GAAG,SAC2B,EAAE,KAAK;CACrC,MAAMC,eAA+C,aAClD,WAAW;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAUD,QAAO;EAAE,iBAR2B,aACjC,WAAW;GACV,GAAG;GACH,GAAG;GACJ,GACD,CAAC,KAAK,CACP;EAEyB;EAAc;;AAyB1C,MAAa,qBAAqB,EAChC,OACA,WACA,SACA,SACA,WACA,SAAS,IACT,WAAW,OACX,cACA,eACA,QACA,GAAG,SACuB,EAAE,KAAK;CACjC,MAAMC,eAAmC,aACtC,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AA+BD,QAAO;EAAE,mBA7B6C,aACnD,WAAW;GACV;GACA;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAE2B;EAAc;;AAuB5C,MAAa,iBAAiB,EAC5B,OACA,UACA,SACA,WACA,UACA,QACA,eACA,UACA,OACA,SACA,QACA,GAAG,SACmB,EAAE,KAAK;CAC7B,MAAMA,eAAmC,aACtC,WAAW;EAAE,GAAG;EAAM,GAAG;EAAO,GACjC,CAAC,KAAK,CACP;AAiCD,QAAO;EAAE,eA/BqC,aAC3C,WAAW;GACV;GACA;GACA;GACA,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACJ,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EAEuB;EAAc"}
|
|
@@ -4,7 +4,7 @@ const toGroup = (selector) => [
|
|
|
4
4
|
"[data-group]",
|
|
5
5
|
".group"
|
|
6
6
|
].map((prefix) => `${prefix}${selector.slice(1)} &`).join(", ");
|
|
7
|
-
const toPeer = (selector) => [...["[data-peer]", ".peer"].flatMap((prefix) => [`&:has(~ ${prefix}${selector.slice(1)})`, `${prefix}${selector.slice(1)} ~ &`]), ...["[data-peer]", ".peer"].flatMap((prefix) => [`&:has(~ ${prefix} *${selector.slice(1)})`, `${prefix}:has(*${selector.slice(1)}) ~ &`])].join(", ");
|
|
7
|
+
const toPeer = (selector) => [...["[data-peer]", ".peer"].flatMap((prefix) => [selector ? `&:has(~ ${prefix}${selector.slice(1)})` : `&:has(~ ${prefix})`, selector ? `${prefix}${selector.slice(1)} ~ &` : `${prefix} ~ &`]), ...selector ? ["[data-peer]", ".peer"].flatMap((prefix) => [`&:has(~ ${prefix} *${selector.slice(1)})`, `${prefix}:has(*${selector.slice(1)}) ~ &`]) : []].join(", ");
|
|
8
8
|
const attributes = {
|
|
9
9
|
_inactive: "&[data-inactive]",
|
|
10
10
|
_accept: "&[data-accept]",
|
|
@@ -180,6 +180,7 @@ const groupAttributes = {
|
|
|
180
180
|
const groupAttributeProperties = Object.keys(groupAttributes);
|
|
181
181
|
const groupAttributeSelectors = Object.values(groupAttributes);
|
|
182
182
|
const peerAttributes = {
|
|
183
|
+
_peer: toPeer(),
|
|
183
184
|
_peerAccept: toPeer(attributes._accept),
|
|
184
185
|
_peerBlank: toPeer(pseudoClasses._blank),
|
|
185
186
|
_peerChecked: toPeer(pseudoClasses._checked),
|