@accelint/design-toolkit 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/index.d.ts +1 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +1 -5
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/accordion/types.d.ts +9 -10
- package/dist/components/avatar/index.d.ts +4 -2
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/styles.d.ts +16 -15
- package/dist/components/avatar/styles.js +1 -1
- package/dist/components/avatar/styles.js.map +1 -1
- package/dist/components/avatar/types.d.ts +7 -7
- package/dist/components/badge/index.d.ts +3 -2
- package/dist/components/badge/index.js +1 -1
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/badge/styles.js +1 -1
- package/dist/components/badge/styles.js.map +1 -1
- package/dist/components/badge/types.d.ts +3 -4
- package/dist/components/box/index.js +1 -1
- package/dist/components/box/index.js.map +1 -1
- package/dist/components/button/index.d.ts +6 -4
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/styles.d.ts +25 -24
- package/dist/components/button/styles.js +1 -1
- package/dist/components/button/styles.js.map +1 -1
- package/dist/components/button/types.d.ts +3 -5
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox/styles.d.ts +19 -18
- package/dist/components/checkbox/styles.js +1 -1
- package/dist/components/checkbox/styles.js.map +1 -1
- package/dist/components/chip/index.d.ts +4 -2
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip/styles.d.ts +70 -69
- package/dist/components/chip/styles.js +1 -1
- package/dist/components/chip/styles.js.map +1 -1
- package/dist/components/chip/types.d.ts +5 -5
- package/dist/components/classification-badge/index.d.ts +3 -2
- package/dist/components/classification-badge/index.js +1 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-badge/styles.js +1 -1
- package/dist/components/classification-badge/styles.js.map +1 -1
- package/dist/components/classification-badge/types.d.ts +3 -4
- package/dist/components/classification-banner/index.d.ts +3 -2
- package/dist/components/classification-banner/index.js +1 -1
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/classification-banner/styles.js +1 -1
- package/dist/components/classification-banner/styles.js.map +1 -1
- package/dist/components/classification-banner/types.d.ts +3 -4
- package/dist/components/color-picker/index.d.ts +45 -15
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-picker/styles.d.ts +42 -0
- package/dist/components/color-picker/styles.js +2 -0
- package/dist/components/color-picker/styles.js.map +1 -0
- package/dist/components/color-picker/types.d.ts +13 -0
- package/dist/components/color-picker/types.js +2 -0
- package/dist/components/color-picker/types.js.map +1 -0
- package/dist/components/combobox/index.d.ts +9 -14
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/combobox/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +8 -24
- package/dist/components/date-field/index.js +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-field/styles.d.ts +69 -0
- package/dist/components/date-field/styles.js +2 -0
- package/dist/components/date-field/styles.js.map +1 -0
- package/dist/components/date-field/types.d.ts +29 -0
- package/dist/components/date-field/types.js +2 -0
- package/dist/components/date-field/types.js.map +1 -0
- package/dist/components/details-list/index.d.ts +59 -0
- package/dist/components/details-list/index.js +2 -0
- package/dist/components/details-list/index.js.map +1 -0
- package/dist/components/details-list/styles.d.ts +65 -0
- package/dist/components/details-list/styles.js +2 -0
- package/dist/components/details-list/styles.js.map +1 -0
- package/dist/components/details-list/types.d.ts +16 -0
- package/dist/components/details-list/types.js +2 -0
- package/dist/components/details-list/types.js.map +1 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/context.d.ts +13 -0
- package/dist/components/drawer/context.js +2 -0
- package/dist/components/drawer/context.js.map +1 -0
- package/dist/components/drawer/index.d.ts +48 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/drawer/state.d.ts +26 -0
- package/dist/components/drawer/state.js +2 -0
- package/dist/components/drawer/state.js.map +1 -0
- package/dist/components/drawer/styles.d.ts +118 -0
- package/dist/components/drawer/styles.js +2 -0
- package/dist/components/drawer/styles.js.map +1 -0
- package/dist/components/drawer/types.d.ts +279 -0
- package/dist/components/drawer/types.js +2 -0
- package/dist/components/drawer/types.js.map +1 -0
- package/dist/components/hero/index.d.ts +45 -0
- package/dist/components/hero/index.js +2 -0
- package/dist/components/hero/index.js.map +1 -0
- package/dist/components/hero/styles.d.ts +48 -0
- package/dist/components/hero/styles.js +2 -0
- package/dist/components/hero/styles.js.map +1 -0
- package/dist/components/hero/types.d.ts +13 -0
- package/dist/components/hero/types.js +2 -0
- package/dist/components/hero/types.js.map +1 -0
- package/dist/components/icon/index.d.ts +3 -2
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon/styles.js +1 -1
- package/dist/components/icon/styles.js.map +1 -1
- package/dist/components/icon/types.d.ts +4 -5
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/index.js +1 -1
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/styles.js +1 -1
- package/dist/components/input/styles.js.map +1 -1
- package/dist/components/input/types.d.ts +1 -0
- package/dist/components/label/index.d.ts +3 -2
- package/dist/components/label/index.js +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/label/styles.js +1 -1
- package/dist/components/label/styles.js.map +1 -1
- package/dist/components/label/types.d.ts +2 -3
- package/dist/components/menu/index.d.ts +16 -21
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/styles.js +1 -1
- package/dist/components/menu/styles.js.map +1 -1
- package/dist/components/navigation-stack/index.d.ts +20 -0
- package/dist/components/navigation-stack/index.js +2 -0
- package/dist/components/navigation-stack/index.js.map +1 -0
- package/dist/components/navigation-stack/types.d.ts +31 -0
- package/dist/components/navigation-stack/types.js +2 -0
- package/dist/components/navigation-stack/types.js.map +1 -0
- package/dist/components/options/index.d.ts +28 -22
- package/dist/components/options/index.js +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options/styles.d.ts +72 -0
- package/dist/components/options/styles.js +2 -0
- package/dist/components/options/styles.js.map +1 -0
- package/dist/components/options/types.d.ts +29 -0
- package/dist/components/options/types.js +2 -0
- package/dist/components/options/types.js.map +1 -0
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/styles.d.ts +16 -15
- package/dist/components/popover/styles.js +1 -1
- package/dist/components/popover/styles.js.map +1 -1
- package/dist/components/query-builder/action-element.js +1 -1
- package/dist/components/query-builder/action-element.js.map +1 -1
- package/dist/components/query-builder/constants.js +1 -1
- package/dist/components/query-builder/constants.js.map +1 -1
- package/dist/components/query-builder/group.js +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.d.ts +5 -20
- package/dist/components/query-builder/index.js +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/rule.js +1 -1
- package/dist/components/query-builder/rule.js.map +1 -1
- package/dist/components/query-builder/types.d.ts +22 -0
- package/dist/components/query-builder/types.js +2 -0
- package/dist/components/query-builder/types.js.map +1 -0
- package/dist/components/query-builder/utils.js +1 -1
- package/dist/components/query-builder/utils.js.map +1 -1
- package/dist/components/query-builder/value-editor.js +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/styles.d.ts +19 -18
- package/dist/components/radio/styles.js +1 -1
- package/dist/components/radio/styles.js.map +1 -1
- package/dist/components/radio/types.d.ts +2 -3
- package/dist/components/search-field/index.d.ts +56 -15
- package/dist/components/search-field/index.js +1 -1
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-field/styles.d.ts +53 -0
- package/dist/components/search-field/styles.js +2 -0
- package/dist/components/search-field/styles.js.map +1 -0
- package/dist/components/search-field/types.d.ts +25 -0
- package/dist/components/search-field/types.js +2 -0
- package/dist/components/search-field/types.js.map +1 -0
- package/dist/components/skeleton/index.d.ts +42 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/skeleton/index.js.map +1 -0
- package/dist/components/skeleton/styles.d.ts +23 -0
- package/dist/components/skeleton/styles.js +2 -0
- package/dist/components/skeleton/styles.js.map +1 -0
- package/dist/components/skeleton/types.d.ts +8 -0
- package/dist/components/skeleton/types.js +2 -0
- package/dist/components/skeleton/types.js.map +1 -0
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +3 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/styles.d.ts +13 -12
- package/dist/components/switch/styles.js +1 -1
- package/dist/components/switch/styles.js.map +1 -1
- package/dist/components/switch/types.d.ts +2 -3
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area-field/index.d.ts +4 -3
- package/dist/components/text-area-field/index.js +1 -1
- package/dist/components/text-area-field/index.js.map +1 -1
- package/dist/components/text-area-field/styles.d.ts +19 -18
- package/dist/components/text-area-field/styles.js +1 -1
- package/dist/components/text-area-field/styles.js.map +1 -1
- package/dist/components/text-area-field/types.d.ts +2 -3
- package/dist/components/text-field/index.d.ts +4 -2
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/text-field/styles.d.ts +19 -18
- package/dist/components/text-field/styles.js +1 -1
- package/dist/components/text-field/styles.js.map +1 -1
- package/dist/components/text-field/types.d.ts +4 -4
- package/dist/components/tooltip/index.d.ts +14 -28
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/styles.d.ts +5 -0
- package/dist/components/tooltip/styles.js +2 -0
- package/dist/components/tooltip/styles.js.map +1 -0
- package/dist/components/tooltip/types.d.ts +8 -0
- package/dist/components/tooltip/types.js +2 -0
- package/dist/components/tooltip/types.js.map +1 -0
- package/dist/icons/catalog.js +1 -1
- package/dist/index.d.ts +54 -28
- package/dist/index.js +1 -1
- package/dist/lib/react.d.ts +13 -12
- package/dist/lib/react.js +4 -4
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/types.d.ts +6 -2
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/styles.css +1341 -278
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/index.js.map +1 -1
- package/dist/variants/variants.css +6 -0
- package/package.json +81 -58
- package/dist/components/options-item/index.d.ts +0 -30
- package/dist/components/options-item/index.js +0 -2
- package/dist/components/options-item/index.js.map +0 -1
- package/dist/components/query-builder/example-configuration.d.ts +0 -30
- package/dist/components/query-builder/example-configuration.js +0 -2
- package/dist/components/query-builder/example-configuration.js.map +0 -1
@@ -0,0 +1,29 @@
|
|
1
|
+
import { RefAttributes } from 'react';
|
2
|
+
import { Key, ListBoxProps, ListBoxItemProps, TextProps, ListBoxSectionProps } from 'react-aria-components';
|
3
|
+
import { IconProps } from '../icon/types.js';
|
4
|
+
|
5
|
+
type OptionsDataItem = {
|
6
|
+
id: Key;
|
7
|
+
name: string;
|
8
|
+
children?: OptionsDataItem[];
|
9
|
+
};
|
10
|
+
type OptionsItemProps<T extends OptionsDataItem> = Omit<ListBoxItemProps<T>, 'className'> & RefAttributes<HTMLDivElement> & {
|
11
|
+
classNames?: {
|
12
|
+
item?: ListBoxItemProps['className'];
|
13
|
+
icon?: IconProps['className'];
|
14
|
+
};
|
15
|
+
color?: 'info' | 'serious';
|
16
|
+
};
|
17
|
+
type OptionsProps<T extends OptionsDataItem> = Omit<ListBoxProps<T>, 'orientation' | 'layout'> & RefAttributes<HTMLDivElement> & {
|
18
|
+
size?: 'small' | 'large';
|
19
|
+
};
|
20
|
+
type OptionsSectionProps<T extends OptionsDataItem> = Omit<ListBoxSectionProps<T>, 'className'> & {
|
21
|
+
classNames?: {
|
22
|
+
section?: ListBoxSectionProps<T>['className'];
|
23
|
+
header?: string;
|
24
|
+
};
|
25
|
+
header?: string;
|
26
|
+
};
|
27
|
+
type OptionsItemTextProps = TextProps;
|
28
|
+
|
29
|
+
export type { OptionsDataItem, OptionsItemProps, OptionsItemTextProps, OptionsProps, OptionsSectionProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import'client-only';import {DialogTrigger,Pressable,Popover,Dialog,Heading}from'react-aria-components';import {PopoverStyles}from'./styles.js';
|
1
|
+
import {jsx}from'react/jsx-runtime';import'client-only';import {DialogTrigger,Pressable,Popover,Dialog,Heading}from'react-aria-components';import {PopoverStyles}from'./styles.js';const {content:c,body:y,title:N,footer:T}=PopoverStyles(),e=({placement:r="bottom",children:o,...p})=>jsx(DialogTrigger,{...p,children:o});e.displayName="Popover";const A=({children:r,...o})=>jsx(Pressable,{...o,children:r});e.displayName="Popover.Trigger";const i=({children:r,className:o,...p})=>jsx(Popover,{className:c({className:o}),...p,children:jsx(Dialog,{children:r})});i.displayName="Popover.Content";const a=({children:r,className:o,...p})=>jsx(Heading,{slot:"title",className:N({className:o}),...p,children:r});a.displayName="Popover.Title";const s=({children:r,className:o})=>jsx("div",{className:y({className:o}),children:r});s.displayName="Popover.Body";const P=({children:r,className:o})=>jsx("div",{className:T({className:o}),children:r});P.displayName="Popover.Footer",e.Title=a,e.Content=i,e.Body=s,e.Footer=P,e.Trigger=A;export{e as Popover,A as PopoverTrigger};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/popover/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/popover/index.tsx"],"names":["PopoverStyles","Popover","rest","jsx","t","n","props","g","l","PopoverContent","v","PopoverTitle","PopoverBody","PopoverFooter","PopoverTrigger"],"mappings":"mLAiCQ,MAAA,CAAA,OAAS,CAAA,CAAA,CAAA,YAAa,CAAA,CAAA,CAAA,MAAWA,CAAAA,CAAc,CAAA,CAE1CC,aAAAA,EAAW,CACtB,aAAY,CAAA,CAAA,CAAA,iBAEZ,CAAA,CAAGC,CACL,GAAA,CACSC,CAAAA,GAACC,GAAmB,CAAAC,aAAA,CAAGH,CAAAA,aAAgB,CAEhDD,EAAQ,EAAA,CAAA,CAAA,WAAc,CAAA,UAES,MAAE,CAAA,CAAA,CAAA,CAAA,UAAaK,CAAM,GAAA,CAC3CH,IAACC,GAAW,WAAGE,CAAAA,GAAQ,CAAA,CAAA,QAAS,CAEzCL,CAAAA,CAAQ,EAAA,CAAA,CAAA,6BAER,CAAA,MACE,CAAA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SACA,CAAA,CAAGC,CACL,GAAA,CAEIC,CAAAA,GAACC,GAAY,CAAAG,OAAA,CAAA,CAAA,SAAqB,CAAA,CAAA,CAAA,CAAA,SAAW,CAAI,CAAA,CAAA,CAAGL,CAAAA,GAElD,CAAA,CAAA,SAACE,GAAY,CAAAI,MAAA,CAAA,CAAA,QAAS,CACxB,CAAA,CAGJC,EAAe,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,wBAEL,CAAA,CAAA,CAAA,CAAA,oBAAqB,CAAA,CAAGP,CAAK,GAAA,CAEjDC,CAAAA,GAACC,GAAY,CAAAM,OAAA,CAAA,CAAA,IAAK,CAAA,iBAA2B,cAAe,CAAA,CAAA,CAAGR,CAAAA,GAC5D,CAAA,CAAA,QACH,CAIJS,CAAAA,CAAa,eAAc,CAAA,eAE3B,CAAA,MAAuB,YAAU,CAAA,CAAA,CAAA,SAAU,CAAA,CAClCR,CAAAA,GAACC,GAAA,CAAA,gBAAsB,cAAe,CAAA,CAAA,CAAA,CAAA,QAAS,CAExDQ,CAAAA,CAAY,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,qBAGxB,CAAA,CAAA,CAAA,CAAA,oBAEF,CAAA,CACST,CAAAA,GAACC,GAAA,CAAA,KAAI,CAAA,CAAA,SAAoB,CAAA,CAAA,CAAA,CAAA,SAAW,CAAI,CAAA,CAAA,CAAA,CAAA,QAAS,CAE1DS,CAAAA,CAAc,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,gBAEpB,CAAA,CAAA,CAAA,KACRZ,CAAQ,CAAA,CAAA,CAAA,CAAA,OACRA,CAAQ,CAAA,CAAA,CAAA,CAAA,IACRA,CAAQ,CAAA,CAAA,CAAA,CAAA,MACRA,CAAQ,CAAA,CAAA,CAAA,CAAA,OAAUa,CAAAA,CAAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\nimport 'client-only';\nimport type { ReactNode } from 'react';\nimport {\n Dialog as AriaDialog,\n DialogTrigger as AriaDialogTrigger,\n Heading as AriaHeading,\n Popover as AriaPopover,\n Pressable,\n} from 'react-aria-components';\n\nimport type {\n PopoverBodyProps,\n PopoverContentProps,\n PopoverProps,\n PopoverTitleProps,\n PopoverTriggerProps,\n} from './types';\n\nimport { PopoverStyles } from './styles';\n\nconst { content, body, title, footer } = PopoverStyles();\n\nexport const Popover = ({\n placement = 'bottom',\n children,\n ...rest\n}: PopoverProps) => {\n return <AriaDialogTrigger {...rest}>{children}</AriaDialogTrigger>;\n};\nPopover.displayName = 'Popover';\n\nexport const PopoverTrigger = ({ children, ...props }: PopoverTriggerProps) => {\n return <Pressable {...props}>{children}</Pressable>;\n};\nPopover.displayName = 'Popover.Trigger';\n\nconst PopoverContent = ({\n children,\n className,\n ...rest\n}: PopoverContentProps) => {\n return (\n <AriaPopover className={content({ className })} {...rest}>\n {/* @ts-expect-error package version mismatch TODO */}\n <AriaDialog>{children}</AriaDialog>\n </AriaPopover>\n );\n};\nPopoverContent.displayName = 'Popover.Content';\n\nconst PopoverTitle = ({ children, className, ...rest }: PopoverTitleProps) => {\n return (\n <AriaHeading slot='title' className={title({ className })} {...rest}>\n {children}\n </AriaHeading>\n );\n};\n\nPopoverTitle.displayName = 'Popover.Title';\n\nconst PopoverBody = ({ children, className }: PopoverBodyProps) => {\n return <div className={body({ className })}>{children}</div>;\n};\nPopoverBody.displayName = 'Popover.Body';\n\nconst PopoverFooter = ({\n children,\n className,\n}: { children: ReactNode; className?: string }) => {\n return <div className={footer({ className })}>{children}</div>;\n};\nPopoverFooter.displayName = 'Popover.Footer';\n\nPopover.Title = PopoverTitle;\nPopover.Content = PopoverContent;\nPopover.Body = PopoverBody;\nPopover.Footer = PopoverFooter;\nPopover.Trigger = PopoverTrigger;\n"]}
|
@@ -1,21 +1,22 @@
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
import * as tailwind_merge from 'tailwind-merge';
|
2
3
|
|
3
4
|
declare const PopoverStyles: tailwind_variants.TVReturnType<{
|
4
5
|
[key: string]: {
|
5
|
-
[key: string]:
|
6
|
-
content?:
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
7
|
+
content?: tailwind_merge.ClassNameValue;
|
8
|
+
body?: tailwind_merge.ClassNameValue;
|
9
|
+
footer?: tailwind_merge.ClassNameValue;
|
10
|
+
title?: tailwind_merge.ClassNameValue;
|
10
11
|
};
|
11
12
|
};
|
12
13
|
} | {
|
13
14
|
[x: string]: {
|
14
|
-
[x: string]:
|
15
|
-
content?:
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
16
|
+
content?: tailwind_merge.ClassNameValue;
|
17
|
+
body?: tailwind_merge.ClassNameValue;
|
18
|
+
footer?: tailwind_merge.ClassNameValue;
|
19
|
+
title?: tailwind_merge.ClassNameValue;
|
19
20
|
};
|
20
21
|
};
|
21
22
|
} | {}, {
|
@@ -25,11 +26,11 @@ declare const PopoverStyles: tailwind_variants.TVReturnType<{
|
|
25
26
|
footer: string;
|
26
27
|
}, undefined, {
|
27
28
|
[key: string]: {
|
28
|
-
[key: string]:
|
29
|
-
content?:
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
30
|
+
content?: tailwind_merge.ClassNameValue;
|
31
|
+
body?: tailwind_merge.ClassNameValue;
|
32
|
+
footer?: tailwind_merge.ClassNameValue;
|
33
|
+
title?: tailwind_merge.ClassNameValue;
|
33
34
|
};
|
34
35
|
};
|
35
36
|
} | {}, {
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {tv}from'./../../lib/utils.js';
|
1
|
+
import {tv}from'./../../lib/utils.js';const o=tv({slots:{content:"max-w-[280px] rounded-medium border border-static-light bg-surface-raised p-s",body:"fg-default-dark text-body-s",title:"fg-default-light mb-s text-header-m",footer:"mt-s flex justify-end gap-s"}});export{o as PopoverStyles};//# sourceMappingURL=styles.js.map
|
2
2
|
//# sourceMappingURL=styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/popover/styles.ts"],"names":["t"],"mappings":"sCAcE,
|
1
|
+
{"version":3,"sources":["../../../src/components/popover/styles.ts"],"names":["t"],"mappings":"sCAcE,MAAA,CAAO,CACLA,EAAA,CAAA,CAAA,KACE,CAAA,CAAA,OAAA,CAAA,+EACI,CAAA,IAAA,CAAA,yEAEE,CAAA,MAAA,CAAA,6BAEX,CAAA,CAAA","file":"styles.js","sourcesContent":["/* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { tv } from '@/lib/utils';\n\nexport const PopoverStyles = tv({\n slots: {\n content:\n 'max-w-[280px] rounded-medium border border-static-light bg-surface-raised p-s',\n body: 'fg-default-dark text-body-s',\n title: 'fg-default-light mb-s text-header-m',\n footer: 'mt-s flex justify-end gap-s',\n },\n});\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {useCallback,useMemo}from'react';import {Button}from'../button/index.js';import {pressToMouseEvent}from'./utils.js';
|
1
|
+
import {jsx}from'react/jsx-runtime';import'client-only';import {useCallback,useMemo}from'react';import {Button}from'../button/index.js';import {pressToMouseEvent}from'./utils.js';function E({disabled:e,disabledTranslation:t,title:o,handleOnClick:r}){const s=useCallback(p=>r(pressToMouseEvent(p)),[r]),m=useMemo(()=>t?.title&&e?t.title:o,[t?.title,e,o]);return jsx(Button,{isDisabled:e&&!t,onPress:s,size:"small",variant:"outline",children:m})}export{E as ActionElement};//# sourceMappingURL=action-element.js.map
|
2
2
|
//# sourceMappingURL=action-element.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/action-element.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/action-element.tsx"],"names":["handleOnClick","useCallback","event","title","useMemo","disabledTranslation","n","disabled","titleProp","jsx","Button","f","handlePress"],"mappings":"mLAsBE,SACA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,mBAEA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAAA,aAGoBC,CACjBC,CAAAA,CAAAA,CAAsBF,OAAsC,CAC7D,CAACA,WAAa,CAChB,CAAA,EAEMG,CAAQC,kBACZ,CAAA,CAAA,CAAA,CACEC,CAAAA,CAAAA,CAAqB,CAAA,CAAA,CAAA,CAAA,CAAAC,OAAA,CAASC,IACN,CAAA,EAAA,KAE1B,EAACF,CAAAA,CAAqB,OAAOE,CAAUC,CAAS,CAClD,CAAA,CAEA,OACEC,CAAAA,CAACC,CAAAA,CAAA,CACC,CAAA,CAAA,OAAAC,GAAA,CAAYJ,QAAY,UACxB,CAASK,CAAAA,YACJ,CAAA,CACL,CAAA,IAAA,CAAA,OAAQ,CAAA,OAEP,CAAA,SAGP,CAAA,QAAA,CAAA,CAAA,CAAA,CAAA","file":"action-element.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport type { PressEvent } from '@react-types/shared';\nimport { useCallback, useMemo } from 'react';\nimport type { ActionProps } from 'react-querybuilder';\nimport { Button } from '../button';\nimport { pressToMouseEvent } from './utils';\n\nexport function ActionElement({\n disabled,\n disabledTranslation,\n title: titleProp,\n handleOnClick,\n}: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n const title = useMemo(\n () =>\n disabledTranslation?.title && disabled\n ? disabledTranslation.title\n : titleProp,\n [disabledTranslation?.title, disabled, titleProp],\n );\n\n return (\n <Button\n isDisabled={disabled && !disabledTranslation}\n onPress={handlePress}\n size='small'\n variant='outline'\n >\n {title}\n </Button>\n );\n}\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
const e=["between","notBetween","during","overlapped","overlaps"];export{e as multiValueOperators};//# sourceMappingURL=constants.js.map
|
2
2
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/constants.ts"],"names":["multiValueOperators"],"mappings":"AAaO,
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/constants.ts"],"names":["multiValueOperators"],"mappings":"AAaO,MAAMA,EAAsB,CACjC,SAAA,CACA,YAAA,CACA,QAAA,CACA,aACA,UACF","file":"constants.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport const multiValueOperators = [\n 'between',\n 'notBetween',\n 'during',\n 'overlapped',\n 'overlaps',\n];\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {useMemo}from'react';import {useRuleGroup,useStopEventPropagation,TestID}from'react-querybuilder';
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import'client-only';import {cn}from'./../../lib/utils.js';import {useMemo}from'react';import {useRuleGroup,useStopEventPropagation,TestID}from'react-querybuilder';function O(t){const a=useRuleGroup(t),{schema:{controls:{ruleGroupBodyElements:s}}}=a,{schema:{classNames:n}}=t,c=useStopEventPropagation(a.addRule),i=useStopEventPropagation(a.addGroup),d=useStopEventPropagation(a.cloneGroup),m=useStopEventPropagation(a.toggleLockGroup),p=useStopEventPropagation(a.removeGroup),v=useMemo(()=>({...a,addGroup:i,addRule:c,cloneGroup:d,removeGroup:p,toggleLockGroup:m}),[i,c,d,a,p,m]);return jsxs("div",{className:cn(n.ruleGroup),children:[jsx("div",{className:cn(n.header),children:jsx(C,{...v})}),jsx("div",{className:cn(n.body),children:jsx(s,{...v})}),jsx("div",{className:cn(n.header),children:jsx(N,{...v})})]})}function C(t){const a=t.schema.showLockButtons,s=t.path.length>0,n=t.schema.showCloneButtons&&s,{schema:{controls:{combinatorSelector:c,cloneGroupAction:i,lockGroupAction:d,removeGroupAction:m}}}=t;return jsxs(Fragment,{children:[jsx(c,{testID:TestID.combinators,options:t.schema.combinators,value:t.combinator,title:t.translations.combinators.title,className:t.classNames.combinators,handleOnChange:t.onCombinatorChange,rules:t.ruleGroup.rules,level:t.path.length,path:t.path,disabled:t.disabled,context:t.context,validation:t.validationResult,schema:t.schema},TestID.combinators),n&&jsx("div",{children:jsx(i,{testID:TestID.cloneGroup,label:t.translations.cloneRuleGroup.label,title:t.translations.cloneRuleGroup.title,className:t.classNames.cloneGroup,handleOnClick:t.cloneGroup,rules:t.ruleGroup.rules,level:t.path.length,path:t.path,disabled:t.disabled,context:t.context,validation:t.validationResult,ruleOrGroup:t.ruleGroup,schema:t.schema},TestID.cloneGroup)}),a&&jsx("div",{children:jsx(d,{testID:TestID.lockGroup,label:t.translations.lockGroup.label,title:t.translations.lockGroup.title,className:t.classNames.lockGroup,handleOnClick:t.toggleLockGroup,rules:t.ruleGroup.rules,level:t.path.length,path:t.path,disabled:t.disabled,disabledTranslation:t.parentDisabled?void 0:t.translations.lockGroupDisabled,context:t.context,validation:t.validationResult,ruleOrGroup:t.ruleGroup,schema:t.schema},TestID.lockGroup)}),s&&jsx("div",{children:jsx(m,{testID:TestID.removeGroup,label:t.translations.removeGroup.label,title:t.translations.removeGroup.title,className:t.classNames.removeGroup,handleOnClick:t.removeGroup,rules:t.ruleGroup.rules,level:t.path.length,path:t.path,disabled:t.disabled,context:t.context,validation:t.validationResult,ruleOrGroup:t.ruleGroup,schema:t.schema},TestID.removeGroup)})]})}function N(t){const{schema:{controls:{addGroupAction:a,addRuleAction:s}}}=t;return jsxs(Fragment,{children:[jsx(s,{testID:TestID.addRule,label:t.translations.addRule.label,title:t.translations.addRule.title,className:t.classNames.addRule,handleOnClick:t.addRule,rules:t.ruleGroup.rules,level:t.path.length,path:t.path,disabled:t.disabled,context:t.context,validation:t.validationResult,ruleOrGroup:t.ruleGroup,schema:t.schema},TestID.addRule),jsx(a,{testID:TestID.addGroup,label:t.translations.addGroup.label,title:t.translations.addGroup.title,className:t.classNames.addGroup,handleOnClick:t.addGroup,rules:t.ruleGroup.rules,level:t.path.length,path:t.path,disabled:t.disabled,context:t.context,validation:t.validationResult,ruleOrGroup:t.ruleGroup,schema:t.schema},TestID.addGroup)]})}export{O as RuleGroup,N as RuleGroupFooterComponent,C as RuleGroupHeaderComponent};//# sourceMappingURL=group.js.map
|
2
2
|
//# sourceMappingURL=group.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/group.tsx"],"names":["group","useRuleGroup","C","addRule","useStopEventPropagation","l","k","addGroup","cloneGroup","removeGroup","toggleLockGroup","jsxs","b","h","e","elementProps","jsx","shouldShowLock","ruleGroup","R","TestID","o"],"mappings":"iMAsBO,SACL,CAAA,CAAMA,CAAAA,CAAQC,CAAAA,IAER,CACJ,CAAAC,YAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,MACN,CAAA,CAAA,QAAY,CAAA,CAAA,qBAEZF,CAEE,CACJ,CAAA,CAAA,CAAA,CAAA,CAAA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ChB,CAAA,CAAA,IAAA,CAAA,QAAoB,CAAA,CAAA,CAAA,QACpB,CAAA,OAAmB,CAAA,CAAA,CAAA,OACnB,CAAA,UAAsB,CAAA,CAAA,CAAA,gBACtB,CAAA,WAAuB,CAAA,CAAA,CAAA,SACvB,CAAQA,MAAU,CAAA,CAAA,CAAA,MAbN,CAAA,CAAAG,MAAA,CAcd,OAGE,CAAA,CAAAP,GAAA,CAAA,CAAA,CAAA,CAAQM,MAAO,CAAAC,MAAA,CAAA,QACRH,CAAAA,KAAU,CAAA,CAAA,CAAA,YAAa,CAAA,QAC9B,CAAA,KAAOA,CAAAA,KAAU,CAAA,CAAA,CAAA,YAAa,CAAA,QAC9B,CAAA,KAAA,CAAA,SAAqB,CAAA,CAAA,CAAA,UAAW,CAAA,QAChC,CAAA,aAAyB,CAAA,CAAA,CAAA,QAClBA,MAAU,CAAA,CAAA,CAAA,SACjB,CAAA,KAAOA,CAAAA,KAAU,CAAK,CAAA,CAAA,IAAA,CACtB,MAAMA,CAAU,KAChB,CAAA,CAAA,IAAA,CAAA,QAAoB,CAAA,CAAA,CAAA,QACpB,CAAA,OAAmB,CAAA,CAAA,CAAA,OACnB,CAAA,6BACA,CAAA,WAAuB,CAAA,CAAA,CAAA,SACvB,CAAQA,MAAU,CAAA,CAAA,CAAA,MAbN,CAAA,CAAAG,MAAA,CAAA,QAiBpB,CAAA,CAAA,CAAA,CAAA","file":"group.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { cn } from '@/lib/utils';\nimport { useMemo } from 'react';\nimport {\n type RuleGroupProps,\n TestID,\n useRuleGroup,\n useStopEventPropagation,\n} from 'react-querybuilder';\n\nexport function RuleGroup(props: RuleGroupProps) {\n const group = useRuleGroup(props);\n\n const {\n schema: {\n controls: { ruleGroupBodyElements: RuleGroupBodyElements },\n },\n } = group;\n\n const {\n schema: { classNames },\n } = props;\n\n const addRule = useStopEventPropagation(group.addRule);\n const addGroup = useStopEventPropagation(group.addGroup);\n const cloneGroup = useStopEventPropagation(group.cloneGroup);\n const toggleLockGroup = useStopEventPropagation(group.toggleLockGroup);\n const removeGroup = useStopEventPropagation(group.removeGroup);\n\n const elementProps = useMemo(\n () => ({\n ...group,\n addGroup,\n addRule,\n cloneGroup,\n removeGroup,\n toggleLockGroup,\n }),\n [addGroup, addRule, cloneGroup, group, removeGroup, toggleLockGroup],\n );\n\n return (\n <div className={cn(classNames.ruleGroup)}>\n <div className={cn(classNames.header)}>\n <RuleGroupHeaderComponent {...elementProps} />\n </div>\n <div className={cn(classNames.body)}>\n <RuleGroupBodyElements {...elementProps} />\n </div>\n <div className={cn(classNames.header)}>\n <RuleGroupFooterComponent {...elementProps} />\n </div>\n </div>\n );\n}\n\nexport function RuleGroupHeaderComponent(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const shouldShowLock = ruleGroup.schema.showLockButtons;\n const isNotRoot = ruleGroup.path.length > 0;\n const shouldShowClone = ruleGroup.schema.showCloneButtons && isNotRoot;\n\n const {\n schema: {\n controls: {\n combinatorSelector: CombinatorSelectorControlElement,\n cloneGroupAction: CloneGroupActionControlElement,\n lockGroupAction: LockGroupActionControlElement,\n removeGroupAction: RemoveGroupActionControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n <CombinatorSelectorControlElement\n key={TestID.combinators}\n testID={TestID.combinators}\n options={ruleGroup.schema.combinators}\n value={ruleGroup.combinator}\n title={ruleGroup.translations.combinators.title}\n className={ruleGroup.classNames.combinators}\n handleOnChange={ruleGroup.onCombinatorChange}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n />\n {shouldShowClone && (\n <div>\n <CloneGroupActionControlElement\n key={TestID.cloneGroup}\n testID={TestID.cloneGroup}\n label={ruleGroup.translations.cloneRuleGroup.label}\n title={ruleGroup.translations.cloneRuleGroup.title}\n className={ruleGroup.classNames.cloneGroup}\n handleOnClick={ruleGroup.cloneGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {shouldShowLock && (\n <div>\n <LockGroupActionControlElement\n key={TestID.lockGroup}\n testID={TestID.lockGroup}\n label={ruleGroup.translations.lockGroup.label}\n title={ruleGroup.translations.lockGroup.title}\n className={ruleGroup.classNames.lockGroup}\n handleOnClick={ruleGroup.toggleLockGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n disabledTranslation={\n ruleGroup.parentDisabled\n ? undefined\n : ruleGroup.translations.lockGroupDisabled\n }\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {isNotRoot && (\n <div>\n <RemoveGroupActionControlElement\n key={TestID.removeGroup}\n testID={TestID.removeGroup}\n label={ruleGroup.translations.removeGroup.label}\n title={ruleGroup.translations.removeGroup.title}\n className={ruleGroup.classNames.removeGroup}\n handleOnClick={ruleGroup.removeGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n </>\n );\n}\n\nexport function RuleGroupFooterComponent(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const {\n schema: {\n controls: {\n addGroupAction: AddGroupActionControlElement,\n addRuleAction: AddRuleActionControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n <AddRuleActionControlElement\n key={TestID.addRule}\n testID={TestID.addRule}\n label={ruleGroup.translations.addRule.label}\n title={ruleGroup.translations.addRule.title}\n className={ruleGroup.classNames.addRule}\n handleOnClick={ruleGroup.addRule}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n <AddGroupActionControlElement\n key={TestID.addGroup}\n testID={TestID.addGroup}\n label={ruleGroup.translations.addGroup.label}\n title={ruleGroup.translations.addGroup.title}\n className={ruleGroup.classNames.addGroup}\n handleOnClick={ruleGroup.addGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </>\n );\n}\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/group.tsx"],"names":["RuleGroup","group","useRuleGroup","props","r","useStopEventPropagation","addGroup","l","cloneGroup","addRule","removeGroup","toggleLockGroup","jsxs","b","cn","h","jsx","e","elementProps","RuleGroupHeaderComponent","shouldShowLock","ruleGroup","shouldShowClone","Fragment","R","TestID","o","RuleGroupFooterComponent"],"mappings":"qNAwBgBA,SACd,CAAMC,EAAQC,CAAAA,CAAaC,MAGzB,CAAA,CAAAC,YAAA,CAAA,CAAQ,CACN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,CAAA,KAAK,CAAA,CAAA,CAAA,IACtB,CAAA,MAAgB,CAAA,IAChB,CAAA,CAAA,CAAA,IAAUA,CAAAA,QAAU,CAAA,CACpB,CAAA,QAASA,CAAU,OAAA,CACnB,CAAA,CAAA,OAAA,CAAA,UAAsB,CAAA,CAAA,CAAA,gBACtB,CAAA,WAAuB,CAAA,CAAA,CACvB,SAAkB,CAAA,MAAA,CAbbI,EAAO,MAAA,CAcd,CAAAC,MACAV,CAAAA,OAEE,CAAA,CAAAC,GAAA,CAAQQ,CAAAA,CAAO,CAAA,MAAA,CAAAC,MACf,SAAiB,CAAA,KAAA,CAAA,CAAA,CAAA,YAAsB,CAAA,QACvC,CAAA,KAAiB,CAAA,KAAA,CAAA,CAAA,CAAA,YAAsB,SACvC,CAAA,KAAA,CAAWL,SAAU,CAAA,CAAA,CAAA,UACrB,CAAA,QAAA,CAAA,aAAyB,CAAA,CACzB,CAAA,QAAiB,CAAA,KAAA,CAAA,CAAA,CAAU,SAC3B,CAAA,KAAiB,CAAA,KAAK,CAAA,CAAA,CAAA,IACtB,CAAA,WACA,CAAA,CAAA,CAAA,IAAUA,CAAAA,QAAU,CAAA,CACpB,CAAA,QAASA,CAAU,OAAA,CACnB,CAAA,CAAA,OAAA,CAAA,6BACA,CAAA,WAAuB,CAAA,CAAA,CACvB,SAAkB,CAAA,MAAA,CAbbI,CAAAA,CAAO,MAAA,CAAA,CAcdC,eAGN,CAAA,CAAA,CAAA,CAAA","file":"group.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { cn } from '@/lib/utils';\nimport { useMemo } from 'react';\nimport {\n type RuleGroupProps,\n TestID,\n useRuleGroup,\n useStopEventPropagation,\n} from 'react-querybuilder';\n\nexport function RuleGroup(props: RuleGroupProps) {\n const group = useRuleGroup(props);\n\n const {\n schema: {\n controls: { ruleGroupBodyElements: RuleGroupBodyElements },\n },\n } = group;\n\n const {\n schema: { classNames },\n } = props;\n\n const addRule = useStopEventPropagation(group.addRule);\n const addGroup = useStopEventPropagation(group.addGroup);\n const cloneGroup = useStopEventPropagation(group.cloneGroup);\n const toggleLockGroup = useStopEventPropagation(group.toggleLockGroup);\n const removeGroup = useStopEventPropagation(group.removeGroup);\n\n const elementProps = useMemo(\n () => ({\n ...group,\n addGroup,\n addRule,\n cloneGroup,\n removeGroup,\n toggleLockGroup,\n }),\n [addGroup, addRule, cloneGroup, group, removeGroup, toggleLockGroup],\n );\n\n return (\n <div className={cn(classNames.ruleGroup)}>\n <div className={cn(classNames.header)}>\n <RuleGroupHeaderComponent {...elementProps} />\n </div>\n <div className={cn(classNames.body)}>\n <RuleGroupBodyElements {...elementProps} />\n </div>\n <div className={cn(classNames.header)}>\n <RuleGroupFooterComponent {...elementProps} />\n </div>\n </div>\n );\n}\n\nexport function RuleGroupHeaderComponent(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const shouldShowLock = ruleGroup.schema.showLockButtons;\n const isNotRoot = ruleGroup.path.length > 0;\n const shouldShowClone = ruleGroup.schema.showCloneButtons && isNotRoot;\n\n const {\n schema: {\n controls: {\n combinatorSelector: CombinatorSelectorControlElement,\n cloneGroupAction: CloneGroupActionControlElement,\n lockGroupAction: LockGroupActionControlElement,\n removeGroupAction: RemoveGroupActionControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n <CombinatorSelectorControlElement\n key={TestID.combinators}\n testID={TestID.combinators}\n options={ruleGroup.schema.combinators}\n value={ruleGroup.combinator}\n title={ruleGroup.translations.combinators.title}\n className={ruleGroup.classNames.combinators}\n handleOnChange={ruleGroup.onCombinatorChange}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n schema={ruleGroup.schema}\n />\n {shouldShowClone && (\n <div>\n <CloneGroupActionControlElement\n key={TestID.cloneGroup}\n testID={TestID.cloneGroup}\n label={ruleGroup.translations.cloneRuleGroup.label}\n title={ruleGroup.translations.cloneRuleGroup.title}\n className={ruleGroup.classNames.cloneGroup}\n handleOnClick={ruleGroup.cloneGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {shouldShowLock && (\n <div>\n <LockGroupActionControlElement\n key={TestID.lockGroup}\n testID={TestID.lockGroup}\n label={ruleGroup.translations.lockGroup.label}\n title={ruleGroup.translations.lockGroup.title}\n className={ruleGroup.classNames.lockGroup}\n handleOnClick={ruleGroup.toggleLockGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n disabledTranslation={\n ruleGroup.parentDisabled\n ? undefined\n : ruleGroup.translations.lockGroupDisabled\n }\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n {isNotRoot && (\n <div>\n <RemoveGroupActionControlElement\n key={TestID.removeGroup}\n testID={TestID.removeGroup}\n label={ruleGroup.translations.removeGroup.label}\n title={ruleGroup.translations.removeGroup.title}\n className={ruleGroup.classNames.removeGroup}\n handleOnClick={ruleGroup.removeGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </div>\n )}\n </>\n );\n}\n\nexport function RuleGroupFooterComponent(\n ruleGroup: RuleGroupProps & ReturnType<typeof useRuleGroup>,\n) {\n const {\n schema: {\n controls: {\n addGroupAction: AddGroupActionControlElement,\n addRuleAction: AddRuleActionControlElement,\n },\n },\n } = ruleGroup;\n\n return (\n <>\n <AddRuleActionControlElement\n key={TestID.addRule}\n testID={TestID.addRule}\n label={ruleGroup.translations.addRule.label}\n title={ruleGroup.translations.addRule.title}\n className={ruleGroup.classNames.addRule}\n handleOnClick={ruleGroup.addRule}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n <AddGroupActionControlElement\n key={TestID.addGroup}\n testID={TestID.addGroup}\n label={ruleGroup.translations.addGroup.label}\n title={ruleGroup.translations.addGroup.title}\n className={ruleGroup.classNames.addGroup}\n handleOnClick={ruleGroup.addGroup}\n rules={ruleGroup.ruleGroup.rules}\n level={ruleGroup.path.length}\n path={ruleGroup.path}\n disabled={ruleGroup.disabled}\n context={ruleGroup.context}\n validation={ruleGroup.validationResult}\n ruleOrGroup={ruleGroup.ruleGroup}\n schema={ruleGroup.schema}\n />\n </>\n );\n}\n"]}
|
@@ -1,30 +1,15 @@
|
|
1
1
|
import { ValueSelector } from './value-selector.js';
|
2
2
|
import { ValueEditor } from './value-editor.js';
|
3
3
|
import * as react_querybuilder from 'react-querybuilder';
|
4
|
-
import {
|
4
|
+
import { CombinatorSelectorProps, ActionProps } from 'react-querybuilder';
|
5
5
|
import { RuleGroup, RuleGroupHeaderComponent, RuleGroupFooterComponent } from './group.js';
|
6
6
|
import { Rule } from './rule.js';
|
7
7
|
import { ActionElement } from './action-element.js';
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
9
|
-
import {
|
10
|
-
import
|
9
|
+
import { QueryBuilderProps } from './types.js';
|
10
|
+
import 'react';
|
11
|
+
import 'type-fest';
|
11
12
|
|
12
|
-
type RuleGroupType = RuleGroupType$1;
|
13
|
-
type Field = Field$1;
|
14
|
-
type DefaultRQBProps = QueryBuilderProps$1<RuleGroupType, FullField, FullOperator, FullCombinator>;
|
15
|
-
type QueryBuilderValueEditors = Record<LiteralUnion<Exclude<ValueEditorProps['type'], null | undefined | 'multiselect'>, string>, (props: ValueEditorProps) => ReactElement>;
|
16
|
-
/**
|
17
|
-
* Omitted props are currently unsupported functionality
|
18
|
-
*/
|
19
|
-
type QueryBuilderProps = Partial<Omit<DefaultRQBProps, 'showCombinatorsBetweenRules' | 'independentCombinators' | 'listsAsArrays' | 'enableDragAndDrop' | 'showNotToggle' | 'showShiftActions'> & {
|
20
|
-
orientation?: 'horizontal' | 'vertical';
|
21
|
-
showRuleLines?: boolean;
|
22
|
-
}>;
|
23
|
-
/**
|
24
|
-
* Omitted classnames are for unsupported features
|
25
|
-
*/
|
26
|
-
type ClassNames = Omit<Classnames, 'betweenRules' | 'branches' | 'dndDragging' | 'dndOver' | 'dndCopy' | 'dndGroup' | 'dragHandle' | 'shiftActions' | 'notToggle'>;
|
27
|
-
type QueryBuilderContextType = Pick<QueryBuilderProps, 'showRuleLines' | 'orientation'>;
|
28
13
|
declare function QueryBuilder({ controlClassnames, controlElements, orientation, showRuleLines, ...rest }: QueryBuilderProps): react_jsx_runtime.JSX.Element;
|
29
14
|
declare namespace QueryBuilder {
|
30
15
|
var CombinatorSelector: ({ options, value, handleOnChange, }: CombinatorSelectorProps) => react_jsx_runtime.JSX.Element;
|
@@ -41,4 +26,4 @@ declare namespace QueryBuilder {
|
|
41
26
|
var ValueSelector: typeof ValueSelector;
|
42
27
|
}
|
43
28
|
|
44
|
-
export {
|
29
|
+
export { QueryBuilder };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import'client-only';import {LockFill,Delete,Duplicate}from'@accelint/icons';import {useMemo,createContext,useCallback}from'react';import {QueryBuilder}from'react-querybuilder';import {cn}from'../../lib/utils.js';import {Button}from'../button/index.js';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {Radio}from'../radio/index.js';import {Tooltip}from'../tooltip/index.js';import {ActionElement}from'./action-element.js';import {RuleGroup,RuleGroupHeaderComponent,RuleGroupFooterComponent}from'./group.js';import {Rule}from'./rule.js';import {getValidationResult,pressToMouseEvent}from'./utils.js';import {ValueEditor}from'./value-editor.js';import {ValueSelector}from'./value-selector.js';const w={AND:"All rules below must be true for a match",OR:"One of the rules below must be true for a match"};function x({options:r,value:n,handleOnChange:l}){return jsxs(Radio.Group,{value:n,onChange:l,orientation:"horizontal",children:[jsx(Label,{children:"Combinator"}),r.map(o=>jsx(Radio,{value:o.label,children:jsxs(Tooltip,{children:[jsx(Tooltip.Trigger,{children:jsx("span",{children:o.label})}),jsx(Tooltip.Body,{placement:"top",children:w[o.label]})]})},o.label))]})}function C({handleOnClick:r,className:n,...l}){const o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(Button,{size:"small",variant:"icon",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(Delete,{})})})}function d({handleOnClick:r,className:n,...l}){const o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(Button,{size:"small",variant:"icon",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(LockFill,{})})})}function f({handleOnClick:r,className:n,...l}){const o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(Button,{size:"small",variant:"icon",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(Duplicate,{})})})}function t({controlClassnames:r,controlElements:n,orientation:l="horizontal",showRuleLines:o=true,...i}){const G=useMemo(()=>({combinatorSelector:x,cloneGroupAction:f,cloneRuleAction:f,removeRuleAction:C,lockGroupAction:d,lockRuleAction:d,ruleGroup:RuleGroup,rule:Rule,actionElement:ActionElement,valueSelector:ValueSelector,valueEditor:ValueEditor,...n}),[n]),v=useMemo(()=>({queryBuilder:"border border-transparent",ruleGroup:"group col-span-full flex flex-col gap-s p-s border border-info rounded-medium",header:"flex gap-s",body:cn("group grid gap-x-s empty:hidden",o?"grid-cols-[10px_minmax(100px,_1fr)_min-content]":"grid-cols-[minmax(100px,_1fr)_min-content]"),combinators:"my-s",addRule:"",addGroup:"",cloneRule:"fg-interactive hover:fg-interactive-hover",cloneGroup:"fg-interactive hover:fg-interactive-hover",removeGroup:"",rule:cn("flex gap-xs py-s",l==="vertical"?"flex-col":"min-height-[50px] items-start"),fields:"w-full",operators:"",value:"w-full",removeRule:"",valid:"",invalid:"",disabled:"",lockRule:"fg-interactive hover:fg-interactive-hover",lockGroup:"fg-interactive hover:fg-interactive-hover",valueSource:"",valueListItem:""}),[l,o]),E=useMemo(()=>({...v,...r}),[r,v]),S=createContext({orientation:l,showRuleLines:o});return jsx(QueryBuilder,{showNotToggle:false,showShiftActions:false,enableDragAndDrop:false,controlClassnames:E,controlElements:G,context:S,listsAsArrays:true,...i})}t.CombinatorSelector=x,t.RemoveRuleAction=C,t.LockAction=d,t.CloneAction=f,t.ActionElement=ActionElement,t.Rule=Rule,t.RuleGroup=RuleGroup,t.RuleGroupHeaderComponent=RuleGroupHeaderComponent,t.RuleGroupFooterComponent=RuleGroupFooterComponent,t.getValidationResult=getValidationResult,t.ValueEditor=ValueEditor,t.ValueSelector=ValueSelector;export{t as QueryBuilder};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/index.tsx"],"names":["CombinatorSelector","options","jsxs","Radio","v","g","handleOnChange","jsx","Label","e","V","option","Tooltip","a","RemoveRuleAction","className","handlePress","event","handleOnClick","m","f","Button","c","Icon","Delete","T","LockAction","LockFill","w","CloneAction","Duplicate","F","QueryBuilder","orientation","mergedElements","s","RuleGroup","B","P","b","A","ValueEditor","h","defaultClassnames","useMemo","R","mergedClassnames","QueryBuilderContext","createContext","D","RQBBuilder","S","k","L","N","ValueSelector"],"mappings":"4vBA4GO,IAAA,CAAA,CAAA,CAAA,GAAA,CAAA,0CACD,CAAA,EAAA,CAAA,iDAGGA,CAAmB,CAC1B,SAAAC,CACA,CAAA,CAAA,OACA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,cAGEC,CAAAA,CAACC,CAAAA,CAAM,CAAA,OACLC,IAAA,CAAAC,KAAA,CAAA,KACA,CAAA,CAAA,KAAUC,CAAAA,CACV,CAAA,QAAA,CAAA,CAAA,CAAY,WAAA,CAAA,YAEZC,CAACC,QAAM,CAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,CAAA,QAAA,CAAA,YAELH,CAAAA,CAACJ,CAAAA,CAAA,CAAyB,GAAA,CAAA,CAAA,EAAOQ,GAAO,CAAAN,KAAA,CAAA,CAAA,KACtC,CAAA,CAAA,CAAA,KAACO,CAAAA,QACC,CAAAR,IAAA,CAAAS,OAAAN,CAAAA,CAACK,QAAQ,CAAA,CAARH,GACC,CAAAI,OAAA,CAAA,OAAAN,CAAC,CAAA,QAAM,CAAAE,GAAA,CAAA,MAAAE,CAAO,CAAA,QAChB,CACAJ,CAAAA,CAACK,KAAQ,CAAA,CAAR,CAAa,CAAA,CAAAH,GAAA,CAAAI,OAAA,CAAA,IAAU,CAAA,CAAA,SACrB,CAAA,KAAqBF,CAAAA,QACxB,CAAA,CAAA,CACF,CAAA,CAAA,KARiB,CAAA,CAAA,CASnB,CACD,CAAA,CAAA,CACH,CAEJ,CAEA,CAAA,KAAA,CAAA,CAAA,CAASG,CAAAA,CAAiB,CAAE,SAAA,CAAA,CAAA,CAAA,aAAe,CAAAC,CAAAA,CAAW,SAEpD,CAAA,CAAMC,CAAAA,GACHC,CAAAA,CAAAA,CAAsBC,CAAAA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Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\nimport { Delete, Duplicate, LockFill } from '@accelint/icons';\nimport type { PressEvent } from '@react-types/shared';\nimport 'client-only';\nimport { type ReactElement, createContext, useCallback, useMemo } from 'react';\nimport {\n type ActionProps,\n type Classnames,\n type CombinatorSelectorProps,\n type FullCombinator,\n type FullField,\n type FullOperator,\n QueryBuilder as RQBBuilder,\n type Classnames as RQBClassnames,\n type Field as RQBField,\n type QueryBuilderProps as RQBProps,\n type RuleGroupType as RQBRuleGroupType,\n type ValueEditorProps,\n} from 'react-querybuilder';\nimport type { LiteralUnion } from 'type-fest';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\nimport { Radio } from '../radio';\nimport { Tooltip } from '../tooltip';\nimport { ActionElement } from './action-element';\nimport {\n RuleGroup,\n RuleGroupFooterComponent,\n RuleGroupHeaderComponent,\n} from './group';\nimport { Rule } from './rule';\nimport { getValidationResult, pressToMouseEvent } from './utils';\nimport { ValueEditor } from './value-editor';\nimport { ValueSelector } from './value-selector';\n\nexport type RuleGroupType = RQBRuleGroupType;\nexport type Field = RQBField;\n\nexport type DefaultRQBProps = RQBProps<\n RuleGroupType,\n FullField,\n FullOperator,\n FullCombinator\n>;\n\n// TODO: need to add multiselect back in when we have a compatible component\nexport type QueryBuilderValueEditors = Record<\n LiteralUnion<\n Exclude<ValueEditorProps['type'], null | undefined | 'multiselect'>,\n string\n >,\n (props: ValueEditorProps) => ReactElement\n>;\n\n/**\n * Omitted props are currently unsupported functionality\n */\nexport type QueryBuilderProps = Partial<\n Omit<\n DefaultRQBProps,\n | 'showCombinatorsBetweenRules'\n | 'independentCombinators'\n | 'listsAsArrays'\n | 'enableDragAndDrop'\n | 'showNotToggle'\n | 'showShiftActions'\n > & {\n orientation?: 'horizontal' | 'vertical';\n showRuleLines?: boolean;\n }\n>;\n\n/**\n * Omitted classnames are for unsupported features\n */\nexport type ClassNames = Omit<\n RQBClassnames,\n | 'betweenRules'\n | 'branches'\n | 'dndDragging'\n | 'dndOver'\n | 'dndCopy'\n | 'dndGroup'\n | 'dragHandle'\n | 'shiftActions'\n | 'notToggle'\n>;\n\nexport type QueryBuilderContextType = Pick<\n QueryBuilderProps,\n 'showRuleLines' | 'orientation'\n>;\n\nconst operatorDescriptions: Record<string, string> = {\n AND: 'All rules below must be true for a match',\n OR: 'One of the rules below must be true for a match',\n};\n\nfunction CombinatorSelector({\n options,\n value,\n handleOnChange,\n}: CombinatorSelectorProps) {\n return (\n <Radio.Group\n value={value}\n onChange={handleOnChange}\n orientation='horizontal'\n >\n <Label>Combinator</Label>\n {options.map((option) => (\n <Radio key={option.label} value={option.label}>\n <Tooltip>\n <Tooltip.Trigger>\n <span>{option.label}</span>\n </Tooltip.Trigger>\n <Tooltip.Body placement='top'>\n {operatorDescriptions[option.label]}\n </Tooltip.Body>\n </Tooltip>\n </Radio>\n ))}\n </Radio.Group>\n );\n}\n\nfunction RemoveRuleAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <Button\n size='small'\n variant='icon'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Delete />\n </Icon>\n </Button>\n );\n}\n\nfunction LockAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <Button\n size='small'\n variant='icon'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <LockFill />\n </Icon>\n </Button>\n );\n}\n\nfunction CloneAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <Button\n size='small'\n variant='icon'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Duplicate />\n </Icon>\n </Button>\n );\n}\n\nexport function QueryBuilder({\n controlClassnames,\n controlElements,\n orientation = 'horizontal',\n showRuleLines = true,\n ...rest\n}: QueryBuilderProps) {\n /**\n * Represents the list of available controls that the component can use as a custom\n * component override.Passed in as a map of our custom defaults, but can be\n * overridden by using the controlElements prop\n */\n const mergedElements = useMemo(\n () => ({\n combinatorSelector: CombinatorSelector,\n cloneGroupAction: CloneAction,\n cloneRuleAction: CloneAction,\n removeRuleAction: RemoveRuleAction,\n lockGroupAction: LockAction,\n lockRuleAction: LockAction,\n ruleGroup: RuleGroup,\n rule: Rule,\n actionElement: ActionElement,\n valueSelector: ValueSelector,\n valueEditor: ValueEditor,\n ...controlElements,\n }),\n [controlElements],\n );\n\n /**\n * Represents the list of available classnames that the component will recognize.\n * Passed in as a map as all the default styling, but can be overridden by using the\n * controlClassnames prop\n */\n const defaultClassnames: Partial<Classnames> = useMemo(\n () => ({\n queryBuilder: 'border border-transparent',\n ruleGroup:\n 'group col-span-full flex flex-col gap-s p-s border border-info rounded-medium',\n header: 'flex gap-s',\n body: cn(\n 'group grid gap-x-s empty:hidden',\n showRuleLines\n ? 'grid-cols-[10px_minmax(100px,_1fr)_min-content]'\n : 'grid-cols-[minmax(100px,_1fr)_min-content]',\n ),\n combinators: 'my-s',\n addRule: '',\n addGroup: '',\n cloneRule: 'fg-interactive hover:fg-interactive-hover',\n cloneGroup: 'fg-interactive hover:fg-interactive-hover',\n removeGroup: '',\n rule: cn(\n 'flex gap-xs py-s',\n orientation === 'vertical'\n ? 'flex-col'\n : 'min-height-[50px] items-start',\n ),\n fields: 'w-full',\n operators: '',\n value: 'w-full',\n removeRule: '',\n valid: '',\n invalid: '',\n disabled: '',\n lockRule: 'fg-interactive hover:fg-interactive-hover',\n lockGroup: 'fg-interactive hover:fg-interactive-hover',\n valueSource: '',\n valueListItem: '',\n }),\n [orientation, showRuleLines],\n );\n\n const mergedClassnames = useMemo(() => {\n return {\n ...defaultClassnames,\n ...controlClassnames,\n };\n }, [controlClassnames, defaultClassnames]);\n\n const QueryBuilderContext = createContext<QueryBuilderContextType>({\n orientation,\n showRuleLines,\n });\n\n return (\n <RQBBuilder\n showNotToggle={false}\n showShiftActions={false}\n enableDragAndDrop={false}\n controlClassnames={mergedClassnames}\n controlElements={mergedElements}\n context={QueryBuilderContext}\n listsAsArrays\n {...rest}\n />\n );\n}\n\nQueryBuilder.CombinatorSelector = CombinatorSelector;\nQueryBuilder.RemoveRuleAction = RemoveRuleAction;\nQueryBuilder.LockAction = LockAction;\nQueryBuilder.CloneAction = CloneAction;\nQueryBuilder.ActionElement = ActionElement;\nQueryBuilder.Rule = Rule;\nQueryBuilder.RuleGroup = RuleGroup;\nQueryBuilder.RuleGroupHeaderComponent = RuleGroupHeaderComponent;\nQueryBuilder.RuleGroupFooterComponent = RuleGroupFooterComponent;\nQueryBuilder.getValidationResult = getValidationResult;\nQueryBuilder.ValueEditor = ValueEditor;\nQueryBuilder.ValueSelector = ValueSelector;\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/index.tsx"],"names":["jsx","Label","B","b","options","Radio","jsxs","Tooltip","e","z","m","operatorDescriptions","option","RemoveRuleAction","className","event","handleOnClick","pressToMouseEvent","handlePress","rest","p","Icon","u","LockAction","useCallback","T","CloneAction","k","QueryBuilder","c","Q","mergedElements","CombinatorSelector","s","defaultClassnames","R","A","y","P","h","g","RQBBuilder","D","V","mergedClassnames","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AAA,CAAA,2CAEX,CAAA,SACF,CACA,2CAWA,CAAA,WACA,CAAA,EAAA,CAAA,aACD,CAED,EAAA,CAAA,CAAA,CAAA,CAAA,CACExC,CAAAA,CAACyC,CAAAA,CAAA,CACC,CAAA,CAAAR,OAAA,CAAA,KAAA,CAAA,GAAA,CAAe,CAAA,GACf,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAS,aAAA,CAAA,CAAkB,WAClB,CAAA,CAAA,CAAA,aACA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAAlC,GAAA,CAAAmC,YAAmBC,CAAAA,CACnB,aAAA,CAAA,KAAiBb,CAAAA,gBAEjB,CAAA,KAAA,CAAA,iBAMO,CAAA,KAAA,CAAA,iBACbH,CAAAA,CAAa,CAAA,eAAA,CAAmBf,CAAAA,CAChCe,OAAa,CAAA,CAAA,CAAA,aACA,CAAA,IAAA,CAAA,GAAcF,CAC3BE,CAAAA,CAAa,CAAA,CAAA,CAAA,kBACA,CAAA,CAAOiB,CAAAA,CACpBjB,CAAAA,gBACa,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,CAAA,CAAA,aAAA,CAAAS,aAAA,CAAA,CAA2BS,CAAAA,IAC3B,CAAAV,IAAA,CAAA,CAAA,CAAA,SAAA,CAAAD,SAAA,CAAA,CAAA,CAAsBY,wBAEtB,CAAAC,wBAAA,CAAA,CAAA,CAAA,wBAAgBC,CAAAA,wBAAAA,CAAAA,CAAAA,CAAAA,mBAAAA,CAAAA,mBAAAA,CAAAA,CAAAA,CAAAA,WAAAA,CAAAA,WAAAA,CAAAA,CAAAA,CAAAA,aAAAA,CAAAA,aAAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { Delete, Duplicate, LockFill } from '@accelint/icons';\nimport type { PressEvent } from '@react-types/shared';\nimport { createContext, useCallback, useMemo } from 'react';\nimport {\n type ActionProps,\n type Classnames,\n type CombinatorSelectorProps,\n QueryBuilder as RQBBuilder,\n} from 'react-querybuilder';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\nimport { Radio } from '../radio';\nimport { Tooltip } from '../tooltip';\nimport { ActionElement } from './action-element';\nimport {\n RuleGroup,\n RuleGroupFooterComponent,\n RuleGroupHeaderComponent,\n} from './group';\nimport { Rule } from './rule';\nimport type { QueryBuilderContextType, QueryBuilderProps } from './types';\nimport { getValidationResult, pressToMouseEvent } from './utils';\nimport { ValueEditor } from './value-editor';\nimport { ValueSelector } from './value-selector';\n\nconst operatorDescriptions: Record<string, string> = {\n AND: 'All rules below must be true for a match',\n OR: 'One of the rules below must be true for a match',\n};\n\nfunction CombinatorSelector({\n options,\n value,\n handleOnChange,\n}: CombinatorSelectorProps) {\n return (\n <Radio.Group\n value={value}\n onChange={handleOnChange}\n orientation='horizontal'\n >\n <Label>Combinator</Label>\n {options.map((option) => (\n <Radio key={option.label} value={option.label}>\n <Tooltip>\n <Tooltip.Trigger>\n <span>{option.label}</span>\n </Tooltip.Trigger>\n <Tooltip.Body placement='top'>\n {operatorDescriptions[option.label]}\n </Tooltip.Body>\n </Tooltip>\n </Radio>\n ))}\n </Radio.Group>\n );\n}\n\nfunction RemoveRuleAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <Button\n size='small'\n variant='icon'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Delete />\n </Icon>\n </Button>\n );\n}\n\nfunction LockAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <Button\n size='small'\n variant='icon'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <LockFill />\n </Icon>\n </Button>\n );\n}\n\nfunction CloneAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <Button\n size='small'\n variant='icon'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Duplicate />\n </Icon>\n </Button>\n );\n}\n\nexport function QueryBuilder({\n controlClassnames,\n controlElements,\n orientation = 'horizontal',\n showRuleLines = true,\n ...rest\n}: QueryBuilderProps) {\n /**\n * Represents the list of available controls that the component can use as a custom\n * component override.Passed in as a map of our custom defaults, but can be\n * overridden by using the controlElements prop\n */\n const mergedElements = useMemo(\n () => ({\n combinatorSelector: CombinatorSelector,\n cloneGroupAction: CloneAction,\n cloneRuleAction: CloneAction,\n removeRuleAction: RemoveRuleAction,\n lockGroupAction: LockAction,\n lockRuleAction: LockAction,\n ruleGroup: RuleGroup,\n rule: Rule,\n actionElement: ActionElement,\n valueSelector: ValueSelector,\n valueEditor: ValueEditor,\n ...controlElements,\n }),\n [controlElements],\n );\n\n /**\n * Represents the list of available classnames that the component will recognize.\n * Passed in as a map as all the default styling, but can be overridden by using the\n * controlClassnames prop\n */\n const defaultClassnames: Partial<Classnames> = useMemo(\n () => ({\n queryBuilder: 'border border-transparent',\n ruleGroup:\n 'group col-span-full flex flex-col gap-s p-s border border-info rounded-medium',\n header: 'flex gap-s',\n body: cn(\n 'group grid gap-x-s empty:hidden',\n showRuleLines\n ? 'grid-cols-[10px_minmax(100px,_1fr)_min-content]'\n : 'grid-cols-[minmax(100px,_1fr)_min-content]',\n ),\n combinators: 'my-s',\n addRule: '',\n addGroup: '',\n cloneRule: 'fg-interactive hover:fg-interactive-hover',\n cloneGroup: 'fg-interactive hover:fg-interactive-hover',\n removeGroup: '',\n rule: cn(\n 'flex gap-xs py-s',\n orientation === 'vertical'\n ? 'flex-col'\n : 'min-height-[50px] items-start',\n ),\n fields: 'w-full',\n operators: '',\n value: 'w-full',\n removeRule: '',\n valid: '',\n invalid: '',\n disabled: '',\n lockRule: 'fg-interactive hover:fg-interactive-hover',\n lockGroup: 'fg-interactive hover:fg-interactive-hover',\n valueSource: '',\n valueListItem: '',\n }),\n [orientation, showRuleLines],\n );\n\n const mergedClassnames = useMemo(() => {\n return {\n ...defaultClassnames,\n ...controlClassnames,\n };\n }, [controlClassnames, defaultClassnames]);\n\n const QueryBuilderContext = createContext<QueryBuilderContextType>({\n orientation,\n showRuleLines,\n });\n\n return (\n <RQBBuilder\n showNotToggle={false}\n showShiftActions={false}\n enableDragAndDrop={false}\n controlClassnames={mergedClassnames}\n controlElements={mergedElements}\n context={QueryBuilderContext}\n listsAsArrays\n {...rest}\n />\n );\n}\n\nQueryBuilder.CombinatorSelector = CombinatorSelector;\nQueryBuilder.RemoveRuleAction = RemoveRuleAction;\nQueryBuilder.LockAction = LockAction;\nQueryBuilder.CloneAction = CloneAction;\nQueryBuilder.ActionElement = ActionElement;\nQueryBuilder.Rule = Rule;\nQueryBuilder.RuleGroup = RuleGroup;\nQueryBuilder.RuleGroupHeaderComponent = RuleGroupHeaderComponent;\nQueryBuilder.RuleGroupFooterComponent = RuleGroupFooterComponent;\nQueryBuilder.getValidationResult = getValidationResult;\nQueryBuilder.ValueEditor = ValueEditor;\nQueryBuilder.ValueSelector = ValueSelector;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
1
|
+
import {jsxs,Fragment,jsx}from'react/jsx-runtime';import'client-only';import {useContext}from'react';import {useRule,useStopEventPropagation,TestID}from'react-querybuilder';function Z(d){const e=useRule(d),v=useContext(d.context),{classNames:r,disabled:C,operators:S,outerClassName:p,rule:{field:u,operator:n,value:f,valueSource:m},schema:{controls:{fieldSelector:N,operatorSelector:g,valueSourceSelector:k,valueEditor:D,cloneRuleAction:O,lockRuleAction:y,removeRuleAction:E},fields:b,listsAsArrays:A,parseNumbers:I,showCloneButtons:T,showLockButtons:x},fieldData:R,generateOnChangeHandler:s,inputType:L,parentDisabled:B,path:h,translations:l,valueEditorType:P,valueEditorSeparator:w,values:G,valueSources:V,valueSourceOptions:H,validationResult:Q}=e,F=useStopEventPropagation(e.cloneRule),q=useStopEventPropagation(e.toggleLockRule),z=useStopEventPropagation(e.removeRule),o={context:v,disabled:C,level:h.length,path:h,schema:e.schema,validation:Q},J=!["null","notNull"].includes(n)&&V.length>1;return jsxs(Fragment,{children:[v.showRuleLines&&jsx("span",{className:"rule-lines relative"}),jsxs("div",{className:p,children:[jsx(N,{testID:TestID.fields,options:b,title:l.fields.title,value:u,operator:n,className:r.fields,handleOnChange:s("field"),rule:e.rule,...o}),jsx(g,{testID:TestID.operators,field:u,fieldData:e.fieldData,title:e.translations.operators.title,options:S,value:n,className:e.classNames.operators,handleOnChange:e.generateOnChangeHandler("operator"),rule:e.rule,...o}),jsx(D,{testID:TestID.valueEditor,field:u,fieldData:R,title:l.value.title,operator:n,value:f,valueSource:m??"value",type:P,inputType:L,values:G,listsAsArrays:A,parseNumbers:I,separator:w,className:r.value,handleOnChange:s("value"),rule:e.rule,...o}),J&&jsx(k,{testID:TestID.valueSourceSelector,field:u,fieldData:R,title:l.valueSourceSelector.title,options:H,value:m??"value",className:r.valueSource,handleOnChange:s("valueSource"),rule:e.rule,...o})]}),jsxs("div",{className:p,children:[jsx(E,{testID:TestID.removeRule,label:l.removeRule.label??"remove",title:l.removeRule.title??"remove",className:r.removeRule,handleOnClick:z,ruleOrGroup:e.rule,...o}),T&&jsx(O,{testID:TestID.cloneRule,label:l.cloneRule.label??"clone",title:l.cloneRule.title??"clone",className:r.cloneRule,handleOnClick:F,ruleOrGroup:e.rule,...o}),x&&jsx(y,{testID:TestID.lockRule,label:l.lockRule.label??"lock",title:l.lockRule.title??"lock",className:r.lockRule,handleOnClick:q,disabledTranslation:B?void 0:l.lockRuleDisabled,ruleOrGroup:e.rule,...o})]})]})}export{Z as Rule};//# sourceMappingURL=rule.js.map
|
2
2
|
//# sourceMappingURL=rule.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/rule.tsx"],"names":["Rule","props","rule","useRule","context","useContext","classNames","disabled","operators","outerClassName","field","operator","value","valueSource","FieldSelectorControlElement","OperatorSelectorControlElement","ValueSourceSelectorControlElement","ValueEditorControlElement","CloneRuleActionControlElement","LockRuleActionControlElement","RemoveRuleActionControlElement","fields","listsAsArrays","parseNumbers","showCloneButtons","showLockButtons","fieldData","generateOnChangeHandler","inputType","parentDisabled","path","translations","valueEditorType","valueEditorSeparator","values","valueSources","valueSourceOptions","validationResult","cloneRule","useStopEventPropagation","toggleLockRule","removeRule","coreRuleProps","renderValueSources","jsxs","Fragment","jsx","TestID"],"mappings":"yJAsBO,SAASA,CAAAA,CAAKC,CAAAA,CAAkB,CACrC,IAAMC,EAAOC,OAAAA,CAAQF,CAAK,EACpBG,CAAAA,CAAmCC,UAAAA,CAAWJ,EAAM,OAAO,CAAA,CAE3D,CACJ,UAAA,CAAAK,CAAAA,CACA,QAAA,CAAAC,EACA,SAAA,CAAAC,CAAAA,CACA,eAAAC,CAAAA,CACA,IAAA,CAAM,CAAE,KAAA,CAAAC,CAAAA,CAAO,QAAA,CAAAC,CAAAA,CAAU,KAAA,CAAAC,CAAAA,CAAO,YAAAC,CAAY,CAAA,CAC5C,OAAQ,CACN,QAAA,CAAU,CACR,aAAA,CAAeC,C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a,QAAA,CAAS,KAAA,EAAS,OACtC,SAAA,CAAWzB,CAAAA,CAAW,QAAA,CACtB,aAAA,CAAekC,CAAAA,CACf,mBAAA,CACEX,EAAiB,MAAA,CAAYE,CAAAA,CAAa,iBAE5C,WAAA,CAAa7B,CAAAA,CAAK,KACjB,GAAGwC,CAAAA,CACN,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,CAEJ","file":"rule.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useContext } from 'react';\nimport {\n type RuleProps,\n TestID,\n useRule,\n useStopEventPropagation,\n} from 'react-querybuilder';\nimport type { QueryBuilderContextType } from './';\n\nexport function Rule(props: RuleProps) {\n const rule = useRule(props);\n const context: QueryBuilderContextType = useContext(props.context);\n\n const {\n classNames,\n disabled,\n operators,\n outerClassName,\n rule: { field, operator, value, valueSource },\n schema: {\n controls: {\n fieldSelector: FieldSelectorControlElement,\n operatorSelector: OperatorSelectorControlElement,\n valueSourceSelector: ValueSourceSelectorControlElement,\n valueEditor: ValueEditorControlElement,\n cloneRuleAction: CloneRuleActionControlElement,\n lockRuleAction: LockRuleActionControlElement,\n removeRuleAction: RemoveRuleActionControlElement,\n },\n fields,\n listsAsArrays,\n parseNumbers,\n showCloneButtons,\n showLockButtons,\n },\n fieldData,\n generateOnChangeHandler,\n inputType,\n parentDisabled,\n path,\n translations,\n valueEditorType,\n valueEditorSeparator,\n values,\n valueSources,\n valueSourceOptions,\n validationResult,\n } = rule;\n\n const cloneRule = useStopEventPropagation(rule.cloneRule);\n const toggleLockRule = useStopEventPropagation(rule.toggleLockRule);\n const removeRule = useStopEventPropagation(rule.removeRule);\n\n const coreRuleProps = {\n context,\n disabled,\n level: path.length,\n path,\n schema: rule.schema,\n validation: validationResult,\n };\n\n const renderValueSources =\n !['null', 'notNull'].includes(operator) && valueSources.length > 1;\n\n return (\n <>\n {context.showRuleLines && <span className='rule-lines relative' />}\n <div className={outerClassName}>\n <FieldSelectorControlElement\n testID={TestID.fields}\n options={fields}\n title={translations.fields.title}\n value={field}\n operator={operator}\n className={classNames.fields}\n handleOnChange={generateOnChangeHandler('field')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n <OperatorSelectorControlElement\n testID={TestID.operators}\n field={field}\n fieldData={rule.fieldData}\n title={rule.translations.operators.title}\n options={operators}\n value={operator}\n className={rule.classNames.operators}\n handleOnChange={rule.generateOnChangeHandler('operator')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n <ValueEditorControlElement\n testID={TestID.valueEditor}\n field={field}\n fieldData={fieldData}\n title={translations.value.title}\n operator={operator}\n value={value}\n valueSource={valueSource ?? 'value'}\n type={valueEditorType}\n inputType={inputType}\n values={values}\n listsAsArrays={listsAsArrays}\n parseNumbers={parseNumbers}\n separator={valueEditorSeparator}\n className={classNames.value}\n handleOnChange={generateOnChangeHandler('value')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n {renderValueSources && (\n <ValueSourceSelectorControlElement\n testID={TestID.valueSourceSelector}\n field={field}\n fieldData={fieldData}\n title={translations.valueSourceSelector.title}\n options={valueSourceOptions}\n value={valueSource ?? 'value'}\n className={classNames.valueSource}\n handleOnChange={generateOnChangeHandler('valueSource')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n )}\n </div>\n <div className={outerClassName}>\n <RemoveRuleActionControlElement\n testID={TestID.removeRule}\n label={translations.removeRule.label ?? 'remove'}\n title={translations.removeRule.title ?? 'remove'}\n className={classNames.removeRule}\n handleOnClick={removeRule}\n ruleOrGroup={rule.rule}\n {...coreRuleProps}\n />\n {showCloneButtons && (\n <CloneRuleActionControlElement\n testID={TestID.cloneRule}\n label={translations.cloneRule.label ?? 'clone'}\n title={translations.cloneRule.title ?? 'clone'}\n className={classNames.cloneRule}\n handleOnClick={cloneRule}\n ruleOrGroup={rule.rule}\n {...coreRuleProps}\n />\n )}\n {showLockButtons && (\n <LockRuleActionControlElement\n testID={TestID.lockRule}\n label={translations.lockRule.label ?? 'lock'}\n title={translations.lockRule.title ?? 'lock'}\n className={classNames.lockRule}\n handleOnClick={toggleLockRule}\n disabledTranslation={\n parentDisabled ? undefined : translations.lockRuleDisabled\n }\n ruleOrGroup={rule.rule}\n {...coreRuleProps}\n />\n )}\n </div>\n </>\n );\n}\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/rule.tsx"],"names":["Rule","props","rule","useRule","context","useContext","classNames","disabled","operators","outerClassName","field","operator","value","valueSource","FieldSelectorControlElement","OperatorSelectorControlElement","ValueSourceSelectorControlElement","ValueEditorControlElement","CloneRuleActionControlElement","LockRuleActionControlElement","RemoveRuleActionControlElement","fields","listsAsArrays","parseNumbers","showCloneButtons","showLockButtons","fieldData","generateOnChangeHandler","inputType","parentDisabled","path","translations","valueEditorType","valueEditorSeparator","values","valueSources","valueSourceOptions","validationResult","cloneRule","useStopEventPropagation","toggleLockRule","removeRule","coreRuleProps","renderValueSources","jsxs","Fragment","jsx","TestID"],"mappings":"6KAwBO,SAASA,CAAAA,CAAKC,CAAAA,CAAkB,CACrC,MAAMC,CAAAA,CAAOC,QAAQF,CAAK,CAAA,CACpBG,EAAmCC,UAAAA,CAAWJ,CAAAA,CAAM,OAAO,CAAA,CAE3D,CACJ,UAAA,CAAAK,EACA,QAAA,CAAAC,CAAAA,CACA,UAAAC,CAAAA,CACA,cAAA,CAAAC,EACA,IAAA,CAAM,CAAE,KAAA,CAAAC,CAAAA,CAAO,QAAA,CAAAC,CAAAA,CAAU,MAAAC,CAAAA,CAAO,WAAA,CAAAC,CAAY,CAAA,CAC5C,MAAA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Aa,QAAA,CAAS,OAAS,MAAA,CACtC,KAAA,CAAOA,EAAa,QAAA,CAAS,KAAA,EAAS,OACtC,SAAA,CAAWzB,CAAAA,CAAW,QAAA,CACtB,aAAA,CAAekC,CAAAA,CACf,mBAAA,CACEX,EAAiB,MAAA,CAAYE,CAAAA,CAAa,iBAE5C,WAAA,CAAa7B,CAAAA,CAAK,KACjB,GAAGwC,CAAAA,CACN,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,CAEJ","file":"rule.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { useContext } from 'react';\nimport {\n type RuleProps,\n TestID,\n useRule,\n useStopEventPropagation,\n} from 'react-querybuilder';\nimport type { QueryBuilderContextType } from './types';\n\nexport function Rule(props: RuleProps) {\n const rule = useRule(props);\n const context: QueryBuilderContextType = useContext(props.context);\n\n const {\n classNames,\n disabled,\n operators,\n outerClassName,\n rule: { field, operator, value, valueSource },\n schema: {\n controls: {\n fieldSelector: FieldSelectorControlElement,\n operatorSelector: OperatorSelectorControlElement,\n valueSourceSelector: ValueSourceSelectorControlElement,\n valueEditor: ValueEditorControlElement,\n cloneRuleAction: CloneRuleActionControlElement,\n lockRuleAction: LockRuleActionControlElement,\n removeRuleAction: RemoveRuleActionControlElement,\n },\n fields,\n listsAsArrays,\n parseNumbers,\n showCloneButtons,\n showLockButtons,\n },\n fieldData,\n generateOnChangeHandler,\n inputType,\n parentDisabled,\n path,\n translations,\n valueEditorType,\n valueEditorSeparator,\n values,\n valueSources,\n valueSourceOptions,\n validationResult,\n } = rule;\n\n const cloneRule = useStopEventPropagation(rule.cloneRule);\n const toggleLockRule = useStopEventPropagation(rule.toggleLockRule);\n const removeRule = useStopEventPropagation(rule.removeRule);\n\n const coreRuleProps = {\n context,\n disabled,\n level: path.length,\n path,\n schema: rule.schema,\n validation: validationResult,\n };\n\n const renderValueSources =\n !['null', 'notNull'].includes(operator) && valueSources.length > 1;\n\n return (\n <>\n {context.showRuleLines && <span className='rule-lines relative' />}\n <div className={outerClassName}>\n <FieldSelectorControlElement\n testID={TestID.fields}\n options={fields}\n title={translations.fields.title}\n value={field}\n operator={operator}\n className={classNames.fields}\n handleOnChange={generateOnChangeHandler('field')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n <OperatorSelectorControlElement\n testID={TestID.operators}\n field={field}\n fieldData={rule.fieldData}\n title={rule.translations.operators.title}\n options={operators}\n value={operator}\n className={rule.classNames.operators}\n handleOnChange={rule.generateOnChangeHandler('operator')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n <ValueEditorControlElement\n testID={TestID.valueEditor}\n field={field}\n fieldData={fieldData}\n title={translations.value.title}\n operator={operator}\n value={value}\n valueSource={valueSource ?? 'value'}\n type={valueEditorType}\n inputType={inputType}\n values={values}\n listsAsArrays={listsAsArrays}\n parseNumbers={parseNumbers}\n separator={valueEditorSeparator}\n className={classNames.value}\n handleOnChange={generateOnChangeHandler('value')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n {renderValueSources && (\n <ValueSourceSelectorControlElement\n testID={TestID.valueSourceSelector}\n field={field}\n fieldData={fieldData}\n title={translations.valueSourceSelector.title}\n options={valueSourceOptions}\n value={valueSource ?? 'value'}\n className={classNames.valueSource}\n handleOnChange={generateOnChangeHandler('valueSource')}\n rule={rule.rule}\n {...coreRuleProps}\n />\n )}\n </div>\n <div className={outerClassName}>\n <RemoveRuleActionControlElement\n testID={TestID.removeRule}\n label={translations.removeRule.label ?? 'remove'}\n title={translations.removeRule.title ?? 'remove'}\n className={classNames.removeRule}\n handleOnClick={removeRule}\n ruleOrGroup={rule.rule}\n {...coreRuleProps}\n />\n {showCloneButtons && (\n <CloneRuleActionControlElement\n testID={TestID.cloneRule}\n label={translations.cloneRule.label ?? 'clone'}\n title={translations.cloneRule.title ?? 'clone'}\n className={classNames.cloneRule}\n handleOnClick={cloneRule}\n ruleOrGroup={rule.rule}\n {...coreRuleProps}\n />\n )}\n {showLockButtons && (\n <LockRuleActionControlElement\n testID={TestID.lockRule}\n label={translations.lockRule.label ?? 'lock'}\n title={translations.lockRule.title ?? 'lock'}\n className={classNames.lockRule}\n handleOnClick={toggleLockRule}\n disabledTranslation={\n parentDisabled ? undefined : translations.lockRuleDisabled\n }\n ruleOrGroup={rule.rule}\n {...coreRuleProps}\n />\n )}\n </div>\n </>\n );\n}\n"]}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
import { QueryBuilderProps as QueryBuilderProps$1, RuleGroupType as RuleGroupType$1, FullField, FullOperator, FullCombinator, Classnames, Field as Field$1, ValueEditorProps } from 'react-querybuilder';
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
4
|
+
|
5
|
+
type RuleGroupType = RuleGroupType$1;
|
6
|
+
type Field = Field$1;
|
7
|
+
type DefaultRQBProps = QueryBuilderProps$1<RuleGroupType, FullField, FullOperator, FullCombinator>;
|
8
|
+
type QueryBuilderValueEditors = Record<LiteralUnion<Exclude<ValueEditorProps['type'], null | undefined | 'multiselect'>, string>, (props: ValueEditorProps) => ReactElement>;
|
9
|
+
/**
|
10
|
+
* Omitted props are currently unsupported functionality
|
11
|
+
*/
|
12
|
+
type QueryBuilderProps = Partial<Omit<DefaultRQBProps, 'showCombinatorsBetweenRules' | 'independentCombinators' | 'listsAsArrays' | 'enableDragAndDrop' | 'showNotToggle' | 'showShiftActions'> & {
|
13
|
+
orientation?: 'horizontal' | 'vertical';
|
14
|
+
showRuleLines?: boolean;
|
15
|
+
}>;
|
16
|
+
/**
|
17
|
+
* Omitted classnames are for unsupported features
|
18
|
+
*/
|
19
|
+
type ClassNames = Omit<Classnames, 'betweenRules' | 'branches' | 'dndDragging' | 'dndOver' | 'dndCopy' | 'dndGroup' | 'dragHandle' | 'shiftActions' | 'notToggle'>;
|
20
|
+
type QueryBuilderContextType = Pick<QueryBuilderProps, 'showRuleLines' | 'orientation'>;
|
21
|
+
|
22
|
+
export type { ClassNames, DefaultRQBProps, Field, QueryBuilderContextType, QueryBuilderProps, QueryBuilderValueEditors, RuleGroupType };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {noop}from'@accelint/core';
|
1
|
+
import {noop}from'@accelint/core';const s=(t,o)=>{if(!o)return {valid:true};const e=o(t);return typeof e=="boolean"?{valid:e}:{valid:e.valid,reasons:e.valid?[]:e.reasons}},n=t=>({...t,preventDefault:noop,stopPropagation:noop});export{s as getValidationResult,n as pressToMouseEvent};//# sourceMappingURL=utils.js.map
|
2
2
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/utils.ts"],"names":["getValidationResult","rule","validator","result","pressToMouseEvent","event","noop"],"mappings":"kCAsBO,
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/utils.ts"],"names":["getValidationResult","rule","validator","result","pressToMouseEvent","event","noop"],"mappings":"kCAsBO,MAAMA,EAAsB,CACjCC,CAAAA,CACAC,CAAAA,GACqB,CACrB,GAAI,CAACA,EACH,OAAO,CAAE,KAAA,CAAO,IAAK,CAAA,CAGvB,MAAMC,EAASD,CAAAA,CAAUD,CAAI,CAAA,CAE7B,OAAI,OAAOE,CAAAA,EAAW,UACb,CAAE,KAAA,CAAOA,CAAO,CAAA,CAGlB,CACL,KAAA,CAAOA,EAAO,KAAA,CACd,OAAA,CAASA,CAAAA,CAAO,KAAA,CAAQ,EAAC,CAAIA,EAAO,OACtC,CACF,CAAA,CAQaC,CAAAA,CAAqBC,CAAAA,GAC/B,CACC,GAAGA,CAAAA,CACH,cAAA,CAAgBC,IAAAA,CAChB,eAAA,CAAiBA,IACnB,CAAA","file":"utils.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { noop } from '@accelint/core';\nimport type { PressEvent } from '@react-types/shared';\nimport type { MouseEvent } from 'react';\nimport type {\n RuleType,\n RuleValidator,\n ValidationResult,\n} from 'react-querybuilder';\n\nexport const getValidationResult = (\n rule: RuleType,\n validator?: RuleValidator,\n): ValidationResult => {\n if (!validator) {\n return { valid: true };\n }\n\n const result = validator(rule);\n\n if (typeof result === 'boolean') {\n return { valid: result };\n }\n\n return {\n valid: result.valid,\n reasons: result.valid ? [] : result.reasons,\n };\n};\n\n/**\n * This is required because the design system Button supports an onPress event but\n * QueryBuilder provides a callback that expects a MouseEvent and will error\n * out if preventDefault is not available as a method.\n * @param event\n */\nexport const pressToMouseEvent = (event: PressEvent) =>\n ({\n ...event,\n preventDefault: noop,\n stopPropagation: noop,\n }) as unknown as MouseEvent;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {useCallback}from'react';import {useValueEditor}from'react-querybuilder';import {Checkbox}from'../checkbox/index.js';import {Radio}from'../radio/index.js';import {Switch}from'../switch/index.js';import {TextAreaField}from'../text-area-field/index.js';import {TextField}from'../text-field/index.js';import {multiValueOperators}from'./constants.js';import {getValidationResult}from'./utils.js';import {ValueSelector}from'./value-selector.js';
|
1
|
+
import {jsx,Fragment}from'react/jsx-runtime';import'client-only';import {useCallback}from'react';import {useValueEditor}from'react-querybuilder';import {Checkbox}from'../checkbox/index.js';import {Radio}from'../radio/index.js';import {Switch}from'../switch/index.js';import {TextAreaField}from'../text-area-field/index.js';import {TextField}from'../text-field/index.js';import {multiValueOperators}from'./constants.js';import {getValidationResult}from'./utils.js';import {ValueSelector}from'./value-selector.js';function k({disabled:a,fieldData:{name:e,validator:t},handleOnChange:i,rule:o,value:r}){const{valid:l}=getValidationResult(o,t);return jsx(Checkbox,{isDisabled:a,isSelected:r,onChange:i,"aria-invalid":!l,"aria-label":e})}function x({disabled:a,fieldData:{name:e,validator:t},handleOnChange:i,rule:o,value:r,values:l}){const{valid:d}=getValidationResult(o,t);return jsx(Radio.Group,{value:r,isDisabled:a,onChange:i,"aria-invalid":!d,"aria-label":e,"aria-labelledby":e,children:l?.map(n=>jsx(Radio,{value:n.value,children:n.label},n.name))})}const R=[];function S({disabled:a,fieldData:{name:e,validator:t},handleOnChange:i,rule:o,type:r,value:l,values:d=R,...n}){const{valid:c}=getValidationResult(o,t);return jsx(ValueSelector,{...n,disabled:a,multiple:r==="multiselect",options:d,title:e,validation:!c,value:l,handleOnChange:i,"aria-labelledby":e})}function T({disabled:a,fieldData:{name:e,validator:t},handleOnChange:i,rule:o,value:r}){const{valid:l}=getValidationResult(o,t);return jsx(Switch,{isDisabled:a,isSelected:!!r,onChange:i,"aria-invalid":!l,"aria-label":e,"aria-labelledby":e})}function w({disabled:a,fieldData:{name:e,placeholder:t,validator:i},handleOnChange:o,inputType:r,rule:l,value:d}){const{valid:n,reasons:c}=getValidationResult(l,i);return jsx(TextField,{inputProps:{placeholder:t,type:r??"text"},size:"small",value:d,isDisabled:a,isInvalid:!n,onChange:o,"aria-invalid":!n,"aria-label":e,"aria-labelledby":e,errorMessage:c?.join("/n")})}function I({disabled:a,fieldData:{name:e,placeholder:t,validator:i},handleOnChange:o,rule:r,value:l}){const{valid:d,reasons:n}=getValidationResult(r,i);return jsx(TextAreaField,{size:"small",errorMessage:n?.join("/n"),inputProps:{placeholder:t},value:l,isDisabled:a,isInvalid:!d,onChange:o,"aria-label":e,"aria-invalid":!d,"aria-labelledby":e})}const O={checkbox:k,radio:x,select:S,switch:T,text:w,textarea:I};function J(a){const{fieldData:{name:e,valueEditorType:t},operator:i,rule:o}=a,{valueAsArray:r,multiValueHandler:l}=useValueEditor({...a,skipHook:true}),d=useCallback(s=>({...o,value:r[s]}),[o,r]),n=useCallback(s=>l(s,0),[l]),c=useCallback(s=>l(s,1),[l]),E=(typeof t=="function"?t(i):t)??"text",f=O?.[E];return i==="null"||i==="notNull"||!f?null:multiValueOperators.includes(i)?jsx(Fragment,{children:["start","end"].map((s,m)=>jsx("div",{children:jsx(f,{...a,rule:d(m),value:r[m],handleOnChange:m?c:n})},`${e}-${s}`))}):jsx("div",{children:jsx(f,{...a})})}export{J as ValueEditor};//# sourceMappingURL=value-editor.js.map
|
2
2
|
//# sourceMappingURL=value-editor.js.map
|