@nurix/ui-component-library 1.1.4-stage.127 → 1.1.4-stage.128
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/index.d.mts +146 -1
- package/dist/index.d.ts +146 -1
- package/dist/index.js +187 -0
- package/dist/index.mjs +189 -0
- package/dist/styles.css +29 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3418,4 +3418,149 @@ interface MultiSelectProps<T extends string = string> {
|
|
|
3418
3418
|
*/
|
|
3419
3419
|
declare function MultiSelect<T extends string = string>({ value, onValueChange, items, placeholder, label, showSearch, searchPlaceholder, showSelectAll, size, bg, disabled, maxHeight, id, className, "data-testid": dataTestId, }: MultiSelectProps<T>): react_jsx_runtime.JSX.Element;
|
|
3420
3420
|
|
|
3421
|
-
|
|
3421
|
+
interface RuleBuilderProps {
|
|
3422
|
+
/**
|
|
3423
|
+
* Badge label shown in the header (e.g. "Rule 1").
|
|
3424
|
+
*/
|
|
3425
|
+
title: string;
|
|
3426
|
+
/**
|
|
3427
|
+
* Controlled open state. When provided, `defaultOpen` is ignored and
|
|
3428
|
+
* the consumer is responsible for toggling via `onOpenChange`.
|
|
3429
|
+
*/
|
|
3430
|
+
open?: boolean;
|
|
3431
|
+
/**
|
|
3432
|
+
* Initial open state for the uncontrolled mode. Defaults to `true`.
|
|
3433
|
+
*/
|
|
3434
|
+
defaultOpen?: boolean;
|
|
3435
|
+
/**
|
|
3436
|
+
* Called when the user toggles the chevron in the header.
|
|
3437
|
+
*/
|
|
3438
|
+
onOpenChange?: (open: boolean) => void;
|
|
3439
|
+
/**
|
|
3440
|
+
* Called when the user clicks the trash icon in the header. Omit to
|
|
3441
|
+
* hide the delete button entirely.
|
|
3442
|
+
*/
|
|
3443
|
+
onDelete?: () => void;
|
|
3444
|
+
/**
|
|
3445
|
+
* Optional icon shown in the title badge before the label. Defaults to
|
|
3446
|
+
* a `Workflow` glyph matching the Figma reference.
|
|
3447
|
+
*/
|
|
3448
|
+
titleIcon?: React$1.ReactNode;
|
|
3449
|
+
/**
|
|
3450
|
+
* Bottom strip rendered in the grey wrapper area below the white card.
|
|
3451
|
+
* Pass an `<Input />` (or similar) — the label, icon, and layout are
|
|
3452
|
+
* provided by RuleBuilder. Omit to hide the strip entirely (e.g. for
|
|
3453
|
+
* rules that don't set a field value).
|
|
3454
|
+
*/
|
|
3455
|
+
thenContent?: React$1.ReactNode;
|
|
3456
|
+
/**
|
|
3457
|
+
* Override the default "Then set field value to" label.
|
|
3458
|
+
*/
|
|
3459
|
+
thenLabel?: React$1.ReactNode;
|
|
3460
|
+
/**
|
|
3461
|
+
* Override the default leading icon in the Then strip (`FileOutput`).
|
|
3462
|
+
*/
|
|
3463
|
+
thenIcon?: React$1.ReactNode;
|
|
3464
|
+
/**
|
|
3465
|
+
* Body content — typically `<RuleBuilderClause />` with conditions and
|
|
3466
|
+
* connectors composed inside. Rendered only when the card is open.
|
|
3467
|
+
*/
|
|
3468
|
+
children?: React$1.ReactNode;
|
|
3469
|
+
className?: string;
|
|
3470
|
+
style?: React$1.CSSProperties;
|
|
3471
|
+
/**
|
|
3472
|
+
* Optional `data-testid` for Playwright. Defaults to `"rule-builder"`.
|
|
3473
|
+
*/
|
|
3474
|
+
"data-testid"?: string;
|
|
3475
|
+
}
|
|
3476
|
+
interface RuleBuilderClauseProps {
|
|
3477
|
+
/**
|
|
3478
|
+
* Clause label shown above the conditions (e.g. "IF", "WHEN"). Pass a
|
|
3479
|
+
* string or any node for full custom control.
|
|
3480
|
+
*/
|
|
3481
|
+
label?: React$1.ReactNode;
|
|
3482
|
+
/**
|
|
3483
|
+
* Conditions, connectors, and the `<RuleBuilderAddCondition />` button.
|
|
3484
|
+
*/
|
|
3485
|
+
children?: React$1.ReactNode;
|
|
3486
|
+
className?: string;
|
|
3487
|
+
}
|
|
3488
|
+
interface RuleBuilderConditionProps {
|
|
3489
|
+
/**
|
|
3490
|
+
* The cells of the condition row — typically 3 `<Select />` triggers
|
|
3491
|
+
* (field, operator, value). Rendered with `gap-2` between them.
|
|
3492
|
+
*/
|
|
3493
|
+
children?: React$1.ReactNode;
|
|
3494
|
+
/**
|
|
3495
|
+
* Called when the trash icon at the end of the row is clicked. Omit to
|
|
3496
|
+
* hide the icon entirely (e.g. for the only / first condition).
|
|
3497
|
+
*/
|
|
3498
|
+
onDelete?: () => void;
|
|
3499
|
+
className?: string;
|
|
3500
|
+
}
|
|
3501
|
+
interface RuleBuilderConnectorProps {
|
|
3502
|
+
/**
|
|
3503
|
+
* Connector control — usually a `<Select />` showing "AND" / "OR".
|
|
3504
|
+
* Rendered between two condition rows with vertical lines above and
|
|
3505
|
+
* below for visual continuity.
|
|
3506
|
+
*/
|
|
3507
|
+
children?: React$1.ReactNode;
|
|
3508
|
+
className?: string;
|
|
3509
|
+
}
|
|
3510
|
+
interface RuleBuilderAddConditionProps {
|
|
3511
|
+
/**
|
|
3512
|
+
* Button label — defaults to "Add Condition".
|
|
3513
|
+
*/
|
|
3514
|
+
label?: React$1.ReactNode;
|
|
3515
|
+
onClick?: () => void;
|
|
3516
|
+
disabled?: boolean;
|
|
3517
|
+
className?: string;
|
|
3518
|
+
"data-testid"?: string;
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
/**
|
|
3522
|
+
* RuleBuilder — composable card for defining a single rule.
|
|
3523
|
+
*
|
|
3524
|
+
* Figma reference: 6587:462
|
|
3525
|
+
*
|
|
3526
|
+
* Layout: a grey-wrapped card with a header (badge + delete + collapse
|
|
3527
|
+
* toggle), a collapsible body that hosts the IF clause(s), and an
|
|
3528
|
+
* optional bottom strip ("Then set field value to ...") in the grey
|
|
3529
|
+
* wrapper area below the white card.
|
|
3530
|
+
*
|
|
3531
|
+
* Children compose the body using the sibling exports:
|
|
3532
|
+
* - `<RuleBuilderClause label="IF">` — wraps a group of conditions
|
|
3533
|
+
* - `<RuleBuilderCondition>` — a single row, typically 3 Selects
|
|
3534
|
+
* - `<RuleBuilderConnector>` — AND/OR pill between two conditions
|
|
3535
|
+
* - `<RuleBuilderAddCondition onClick={...} />` — outline pill button
|
|
3536
|
+
*
|
|
3537
|
+
* Open state is controlled (`open` + `onOpenChange`) or uncontrolled
|
|
3538
|
+
* (`defaultOpen`), mirroring the pattern used by `<Accordion />`.
|
|
3539
|
+
*/
|
|
3540
|
+
declare const RuleBuilder: React$1.ForwardRefExoticComponent<RuleBuilderProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3541
|
+
/**
|
|
3542
|
+
* Group of conditions under a labelled clause (e.g. "IF"). Typically
|
|
3543
|
+
* holds `<RuleBuilderCondition />` rows separated by
|
|
3544
|
+
* `<RuleBuilderConnector />`, terminated by `<RuleBuilderAddCondition />`.
|
|
3545
|
+
*/
|
|
3546
|
+
declare const RuleBuilderClause: React$1.ForwardRefExoticComponent<RuleBuilderClauseProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3547
|
+
/**
|
|
3548
|
+
* A single condition row. Children are usually 3 Selects (field,
|
|
3549
|
+
* operator, value); the row appends a trailing trash icon when
|
|
3550
|
+
* `onDelete` is provided. Use `className="w-[144px]"` on the
|
|
3551
|
+
* `<SelectTrigger />` for the wide cells to match the Figma layout.
|
|
3552
|
+
*/
|
|
3553
|
+
declare const RuleBuilderCondition: React$1.ForwardRefExoticComponent<RuleBuilderConditionProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3554
|
+
/**
|
|
3555
|
+
* AND/OR connector pill rendered between two conditions. Wraps the
|
|
3556
|
+
* connector control with vertical lines above and below to mirror the
|
|
3557
|
+
* Figma reference. Pass a `<Select />` (or any node) as children.
|
|
3558
|
+
*/
|
|
3559
|
+
declare const RuleBuilderConnector: React$1.ForwardRefExoticComponent<RuleBuilderConnectorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3560
|
+
/**
|
|
3561
|
+
* "+ Add Condition" outline-pill button. Forwards all native button
|
|
3562
|
+
* props (`onClick`, `disabled`, etc.) — `label` overrides the text.
|
|
3563
|
+
*/
|
|
3564
|
+
declare const RuleBuilderAddCondition: React$1.ForwardRefExoticComponent<RuleBuilderAddConditionProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
3565
|
+
|
|
3566
|
+
export { Accordion, AccordionContent, AccordionContentPlaceholder, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionSectionTrigger, type AccordionSectionTriggerProps, AccordionTrigger, type AccordionTriggerProps, type AccordionType, type AccordionValue, AudioPlayer, type AudioPlayerProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarShape, type AvatarSize, type BackButtonPosition, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonBorderRadius, ButtonList, type ButtonListItem, type ButtonListProps, type ButtonProps, type ButtonSize, type ButtonVariant, type CellContent, type CellTextContent, ChatBubbleAgent, type ChatBubbleAgentProps, ChatBubbleUser, type ChatBubbleUserProps, Checkbox, type CheckboxProps, type ColumnDef, ColumnWidth, CompoundFilterSelect, type CompoundFilterSelectProps, type CompoundFilterToggleOption, DEFAULT_THEME, DataTable, type DataTableProps, type DatePreset, Dialog, DialogBody, type DialogBodyProps, DialogFooter, type DialogFooterProps, DialogHeader, DialogHeaderNavigation, type DialogHeaderNavigationProps, type DialogHeaderNavigationVariant, type DialogHeaderProps, DialogIcon, type DialogIconProps, type DialogProps, type DialogSize, type DialogType, EmptyState, type EmptyStateIllustrationPosition, type EmptyStateIllustrationSize, type EmptyStateProps, FileInput, type FileInputProps, type FilterItem, type FilterItemWithSection, FilterListItem, type FilterListItemProps, FilterSelect, type FilterSelectProps, type IconColor, IconPicker, type IconPickerProps, type IconSize, IconWrapper, type IconWrapperProps, Input, type InputBorderRadius, type InputForceState, InputGroup, type InputGroupBorderRadius, type InputGroupForceState, type InputGroupProps, type InputProps, type InputVariant, JSON_EDITOR_LANGUAGE_OPTIONS, JsonEditor, type JsonEditorLanguage, type JsonEditorProps, KeyValueEditor, type KeyValueEditorProps, type KeyValuePair, LegoLandWrapper, type LegoLandWrapperProps, List, type ListBorderRadius, type ListNavItemProps, ListNavigation, type ListNavigationProps, type ListProps, type ListType, type ListVariant, MONACO_OPTIONS, MONACO_OPTIONS_DIALOG, MultiSelect, type MultiSelectItem, type MultiSelectProps, NestedButtonGroup, type NestedButtonGroupProps, NumberBadge, type NumberBadgeProps, type NumberBadgeVariant, NurixThemeProvider, Pagination, type PaginationProps, PlaySelect, type PlaySelectAudioItem, type PlaySelectProps, PlaybackControl, type PlaybackControlProps, type PlaybackState, Popover, type PopoverAlign, type PopoverProps, type PopoverShadow, type PopoverSide, ProgressBar, type ProgressBarProps, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, RuleBuilder, RuleBuilderAddCondition, type RuleBuilderAddConditionProps, RuleBuilderClause, type RuleBuilderClauseProps, RuleBuilderCondition, type RuleBuilderConditionProps, RuleBuilderConnector, type RuleBuilderConnectorProps, type RuleBuilderProps, Select, SelectContent, type SelectContentItem, SelectFormLabel, SelectGroup, type SelectGroupProps, SelectItem, SelectLabel, type SelectLabelProps, type SelectMenuItemProps, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, ShadowDOMWrapper, type ShowToastOptions, SidePanel, type SidePanelProps, type SidePanelSize, Slider, type SliderProps, type SortDirection, type SortState, Spinner, type SpinnerProps, type SpinnerSize, type StepItem, type StepState, Stepper, StepperBar, type StepperBarProps, type StepperProps, type SupportingTextType, Surface, type SurfaceBackground, SurfaceBody, type SurfaceBodyProps, SurfaceFooter, type SurfaceFooterProps, SurfaceHeader, type SurfaceHeaderProps, type SurfaceProps, Switch, type SwitchProps, type SwitchSize, type TabVariant, type TableAction, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, TagBadge, type TagBadgeProps, type TagOption, Textarea, type TextareaBorderRadius, type TextareaForceState, type TextareaProps, ThemeProvider, Toast, type ToastProps, type ToastVariant, Toaster, Toggle, ToggleItem, type ToggleItemProps, type ToggleProps, type ToggleType, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, Typography, type TypographyProps, type TypographySize, type TypographyTone, type TypographyVariant, type TypographyWeight, type UsePlaySelectProps, type UseSelectProps, enhanceJsonError, showToast, useJsonEditor, usePlaySelect, useSelect, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -3418,4 +3418,149 @@ interface MultiSelectProps<T extends string = string> {
|
|
|
3418
3418
|
*/
|
|
3419
3419
|
declare function MultiSelect<T extends string = string>({ value, onValueChange, items, placeholder, label, showSearch, searchPlaceholder, showSelectAll, size, bg, disabled, maxHeight, id, className, "data-testid": dataTestId, }: MultiSelectProps<T>): react_jsx_runtime.JSX.Element;
|
|
3420
3420
|
|
|
3421
|
-
|
|
3421
|
+
interface RuleBuilderProps {
|
|
3422
|
+
/**
|
|
3423
|
+
* Badge label shown in the header (e.g. "Rule 1").
|
|
3424
|
+
*/
|
|
3425
|
+
title: string;
|
|
3426
|
+
/**
|
|
3427
|
+
* Controlled open state. When provided, `defaultOpen` is ignored and
|
|
3428
|
+
* the consumer is responsible for toggling via `onOpenChange`.
|
|
3429
|
+
*/
|
|
3430
|
+
open?: boolean;
|
|
3431
|
+
/**
|
|
3432
|
+
* Initial open state for the uncontrolled mode. Defaults to `true`.
|
|
3433
|
+
*/
|
|
3434
|
+
defaultOpen?: boolean;
|
|
3435
|
+
/**
|
|
3436
|
+
* Called when the user toggles the chevron in the header.
|
|
3437
|
+
*/
|
|
3438
|
+
onOpenChange?: (open: boolean) => void;
|
|
3439
|
+
/**
|
|
3440
|
+
* Called when the user clicks the trash icon in the header. Omit to
|
|
3441
|
+
* hide the delete button entirely.
|
|
3442
|
+
*/
|
|
3443
|
+
onDelete?: () => void;
|
|
3444
|
+
/**
|
|
3445
|
+
* Optional icon shown in the title badge before the label. Defaults to
|
|
3446
|
+
* a `Workflow` glyph matching the Figma reference.
|
|
3447
|
+
*/
|
|
3448
|
+
titleIcon?: React$1.ReactNode;
|
|
3449
|
+
/**
|
|
3450
|
+
* Bottom strip rendered in the grey wrapper area below the white card.
|
|
3451
|
+
* Pass an `<Input />` (or similar) — the label, icon, and layout are
|
|
3452
|
+
* provided by RuleBuilder. Omit to hide the strip entirely (e.g. for
|
|
3453
|
+
* rules that don't set a field value).
|
|
3454
|
+
*/
|
|
3455
|
+
thenContent?: React$1.ReactNode;
|
|
3456
|
+
/**
|
|
3457
|
+
* Override the default "Then set field value to" label.
|
|
3458
|
+
*/
|
|
3459
|
+
thenLabel?: React$1.ReactNode;
|
|
3460
|
+
/**
|
|
3461
|
+
* Override the default leading icon in the Then strip (`FileOutput`).
|
|
3462
|
+
*/
|
|
3463
|
+
thenIcon?: React$1.ReactNode;
|
|
3464
|
+
/**
|
|
3465
|
+
* Body content — typically `<RuleBuilderClause />` with conditions and
|
|
3466
|
+
* connectors composed inside. Rendered only when the card is open.
|
|
3467
|
+
*/
|
|
3468
|
+
children?: React$1.ReactNode;
|
|
3469
|
+
className?: string;
|
|
3470
|
+
style?: React$1.CSSProperties;
|
|
3471
|
+
/**
|
|
3472
|
+
* Optional `data-testid` for Playwright. Defaults to `"rule-builder"`.
|
|
3473
|
+
*/
|
|
3474
|
+
"data-testid"?: string;
|
|
3475
|
+
}
|
|
3476
|
+
interface RuleBuilderClauseProps {
|
|
3477
|
+
/**
|
|
3478
|
+
* Clause label shown above the conditions (e.g. "IF", "WHEN"). Pass a
|
|
3479
|
+
* string or any node for full custom control.
|
|
3480
|
+
*/
|
|
3481
|
+
label?: React$1.ReactNode;
|
|
3482
|
+
/**
|
|
3483
|
+
* Conditions, connectors, and the `<RuleBuilderAddCondition />` button.
|
|
3484
|
+
*/
|
|
3485
|
+
children?: React$1.ReactNode;
|
|
3486
|
+
className?: string;
|
|
3487
|
+
}
|
|
3488
|
+
interface RuleBuilderConditionProps {
|
|
3489
|
+
/**
|
|
3490
|
+
* The cells of the condition row — typically 3 `<Select />` triggers
|
|
3491
|
+
* (field, operator, value). Rendered with `gap-2` between them.
|
|
3492
|
+
*/
|
|
3493
|
+
children?: React$1.ReactNode;
|
|
3494
|
+
/**
|
|
3495
|
+
* Called when the trash icon at the end of the row is clicked. Omit to
|
|
3496
|
+
* hide the icon entirely (e.g. for the only / first condition).
|
|
3497
|
+
*/
|
|
3498
|
+
onDelete?: () => void;
|
|
3499
|
+
className?: string;
|
|
3500
|
+
}
|
|
3501
|
+
interface RuleBuilderConnectorProps {
|
|
3502
|
+
/**
|
|
3503
|
+
* Connector control — usually a `<Select />` showing "AND" / "OR".
|
|
3504
|
+
* Rendered between two condition rows with vertical lines above and
|
|
3505
|
+
* below for visual continuity.
|
|
3506
|
+
*/
|
|
3507
|
+
children?: React$1.ReactNode;
|
|
3508
|
+
className?: string;
|
|
3509
|
+
}
|
|
3510
|
+
interface RuleBuilderAddConditionProps {
|
|
3511
|
+
/**
|
|
3512
|
+
* Button label — defaults to "Add Condition".
|
|
3513
|
+
*/
|
|
3514
|
+
label?: React$1.ReactNode;
|
|
3515
|
+
onClick?: () => void;
|
|
3516
|
+
disabled?: boolean;
|
|
3517
|
+
className?: string;
|
|
3518
|
+
"data-testid"?: string;
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
/**
|
|
3522
|
+
* RuleBuilder — composable card for defining a single rule.
|
|
3523
|
+
*
|
|
3524
|
+
* Figma reference: 6587:462
|
|
3525
|
+
*
|
|
3526
|
+
* Layout: a grey-wrapped card with a header (badge + delete + collapse
|
|
3527
|
+
* toggle), a collapsible body that hosts the IF clause(s), and an
|
|
3528
|
+
* optional bottom strip ("Then set field value to ...") in the grey
|
|
3529
|
+
* wrapper area below the white card.
|
|
3530
|
+
*
|
|
3531
|
+
* Children compose the body using the sibling exports:
|
|
3532
|
+
* - `<RuleBuilderClause label="IF">` — wraps a group of conditions
|
|
3533
|
+
* - `<RuleBuilderCondition>` — a single row, typically 3 Selects
|
|
3534
|
+
* - `<RuleBuilderConnector>` — AND/OR pill between two conditions
|
|
3535
|
+
* - `<RuleBuilderAddCondition onClick={...} />` — outline pill button
|
|
3536
|
+
*
|
|
3537
|
+
* Open state is controlled (`open` + `onOpenChange`) or uncontrolled
|
|
3538
|
+
* (`defaultOpen`), mirroring the pattern used by `<Accordion />`.
|
|
3539
|
+
*/
|
|
3540
|
+
declare const RuleBuilder: React$1.ForwardRefExoticComponent<RuleBuilderProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3541
|
+
/**
|
|
3542
|
+
* Group of conditions under a labelled clause (e.g. "IF"). Typically
|
|
3543
|
+
* holds `<RuleBuilderCondition />` rows separated by
|
|
3544
|
+
* `<RuleBuilderConnector />`, terminated by `<RuleBuilderAddCondition />`.
|
|
3545
|
+
*/
|
|
3546
|
+
declare const RuleBuilderClause: React$1.ForwardRefExoticComponent<RuleBuilderClauseProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3547
|
+
/**
|
|
3548
|
+
* A single condition row. Children are usually 3 Selects (field,
|
|
3549
|
+
* operator, value); the row appends a trailing trash icon when
|
|
3550
|
+
* `onDelete` is provided. Use `className="w-[144px]"` on the
|
|
3551
|
+
* `<SelectTrigger />` for the wide cells to match the Figma layout.
|
|
3552
|
+
*/
|
|
3553
|
+
declare const RuleBuilderCondition: React$1.ForwardRefExoticComponent<RuleBuilderConditionProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3554
|
+
/**
|
|
3555
|
+
* AND/OR connector pill rendered between two conditions. Wraps the
|
|
3556
|
+
* connector control with vertical lines above and below to mirror the
|
|
3557
|
+
* Figma reference. Pass a `<Select />` (or any node) as children.
|
|
3558
|
+
*/
|
|
3559
|
+
declare const RuleBuilderConnector: React$1.ForwardRefExoticComponent<RuleBuilderConnectorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
3560
|
+
/**
|
|
3561
|
+
* "+ Add Condition" outline-pill button. Forwards all native button
|
|
3562
|
+
* props (`onClick`, `disabled`, etc.) — `label` overrides the text.
|
|
3563
|
+
*/
|
|
3564
|
+
declare const RuleBuilderAddCondition: React$1.ForwardRefExoticComponent<RuleBuilderAddConditionProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
3565
|
+
|
|
3566
|
+
export { Accordion, AccordionContent, AccordionContentPlaceholder, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionSectionTrigger, type AccordionSectionTriggerProps, AccordionTrigger, type AccordionTriggerProps, type AccordionType, type AccordionValue, AudioPlayer, type AudioPlayerProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarShape, type AvatarSize, type BackButtonPosition, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonBorderRadius, ButtonList, type ButtonListItem, type ButtonListProps, type ButtonProps, type ButtonSize, type ButtonVariant, type CellContent, type CellTextContent, ChatBubbleAgent, type ChatBubbleAgentProps, ChatBubbleUser, type ChatBubbleUserProps, Checkbox, type CheckboxProps, type ColumnDef, ColumnWidth, CompoundFilterSelect, type CompoundFilterSelectProps, type CompoundFilterToggleOption, DEFAULT_THEME, DataTable, type DataTableProps, type DatePreset, Dialog, DialogBody, type DialogBodyProps, DialogFooter, type DialogFooterProps, DialogHeader, DialogHeaderNavigation, type DialogHeaderNavigationProps, type DialogHeaderNavigationVariant, type DialogHeaderProps, DialogIcon, type DialogIconProps, type DialogProps, type DialogSize, type DialogType, EmptyState, type EmptyStateIllustrationPosition, type EmptyStateIllustrationSize, type EmptyStateProps, FileInput, type FileInputProps, type FilterItem, type FilterItemWithSection, FilterListItem, type FilterListItemProps, FilterSelect, type FilterSelectProps, type IconColor, IconPicker, type IconPickerProps, type IconSize, IconWrapper, type IconWrapperProps, Input, type InputBorderRadius, type InputForceState, InputGroup, type InputGroupBorderRadius, type InputGroupForceState, type InputGroupProps, type InputProps, type InputVariant, JSON_EDITOR_LANGUAGE_OPTIONS, JsonEditor, type JsonEditorLanguage, type JsonEditorProps, KeyValueEditor, type KeyValueEditorProps, type KeyValuePair, LegoLandWrapper, type LegoLandWrapperProps, List, type ListBorderRadius, type ListNavItemProps, ListNavigation, type ListNavigationProps, type ListProps, type ListType, type ListVariant, MONACO_OPTIONS, MONACO_OPTIONS_DIALOG, MultiSelect, type MultiSelectItem, type MultiSelectProps, NestedButtonGroup, type NestedButtonGroupProps, NumberBadge, type NumberBadgeProps, type NumberBadgeVariant, NurixThemeProvider, Pagination, type PaginationProps, PlaySelect, type PlaySelectAudioItem, type PlaySelectProps, PlaybackControl, type PlaybackControlProps, type PlaybackState, Popover, type PopoverAlign, type PopoverProps, type PopoverShadow, type PopoverSide, ProgressBar, type ProgressBarProps, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, RuleBuilder, RuleBuilderAddCondition, type RuleBuilderAddConditionProps, RuleBuilderClause, type RuleBuilderClauseProps, RuleBuilderCondition, type RuleBuilderConditionProps, RuleBuilderConnector, type RuleBuilderConnectorProps, type RuleBuilderProps, Select, SelectContent, type SelectContentItem, SelectFormLabel, SelectGroup, type SelectGroupProps, SelectItem, SelectLabel, type SelectLabelProps, type SelectMenuItemProps, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, ShadowDOMWrapper, type ShowToastOptions, SidePanel, type SidePanelProps, type SidePanelSize, Slider, type SliderProps, type SortDirection, type SortState, Spinner, type SpinnerProps, type SpinnerSize, type StepItem, type StepState, Stepper, StepperBar, type StepperBarProps, type StepperProps, type SupportingTextType, Surface, type SurfaceBackground, SurfaceBody, type SurfaceBodyProps, SurfaceFooter, type SurfaceFooterProps, SurfaceHeader, type SurfaceHeaderProps, type SurfaceProps, Switch, type SwitchProps, type SwitchSize, type TabVariant, type TableAction, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, TagBadge, type TagBadgeProps, type TagOption, Textarea, type TextareaBorderRadius, type TextareaForceState, type TextareaProps, ThemeProvider, Toast, type ToastProps, type ToastVariant, Toaster, Toggle, ToggleItem, type ToggleItemProps, type ToggleProps, type ToggleType, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, Typography, type TypographyProps, type TypographySize, type TypographyTone, type TypographyVariant, type TypographyWeight, type UsePlaySelectProps, type UseSelectProps, enhanceJsonError, showToast, useJsonEditor, usePlaySelect, useSelect, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -6537,6 +6537,11 @@ __export(index_exports, {
|
|
|
6537
6537
|
ProgressBar: () => ProgressBar,
|
|
6538
6538
|
RadioGroup: () => RadioGroup,
|
|
6539
6539
|
RadioGroupItem: () => RadioGroupItem,
|
|
6540
|
+
RuleBuilder: () => RuleBuilder,
|
|
6541
|
+
RuleBuilderAddCondition: () => RuleBuilderAddCondition,
|
|
6542
|
+
RuleBuilderClause: () => RuleBuilderClause,
|
|
6543
|
+
RuleBuilderCondition: () => RuleBuilderCondition,
|
|
6544
|
+
RuleBuilderConnector: () => RuleBuilderConnector,
|
|
6540
6545
|
Select: () => Select,
|
|
6541
6546
|
SelectContent: () => SelectContent,
|
|
6542
6547
|
SelectFormLabel: () => SelectFormLabel,
|
|
@@ -17353,6 +17358,183 @@ function MultiSelectRow({
|
|
|
17353
17358
|
}
|
|
17354
17359
|
);
|
|
17355
17360
|
}
|
|
17361
|
+
|
|
17362
|
+
// src/rule-builder/rule-builder.tsx
|
|
17363
|
+
var React48 = __toESM(require("react"));
|
|
17364
|
+
var import_lucide_react25 = require("lucide-react");
|
|
17365
|
+
|
|
17366
|
+
// src/rule-builder/variables.ts
|
|
17367
|
+
var RULE_BUILDER_TOKENS = {
|
|
17368
|
+
// Outer grey wrapper — Figma: bg-grey, rounded-[16px], p-1, gap-1
|
|
17369
|
+
root: "flex flex-col gap-1 p-1 rounded-2xl bg-token-grey w-full",
|
|
17370
|
+
// White card — Figma: bg-white, rounded-[12px], overflow-clip
|
|
17371
|
+
card: "flex flex-col gap-2 overflow-clip pb-2 rounded-xl bg-token-white w-full",
|
|
17372
|
+
cardCollapsed: "flex flex-col overflow-clip rounded-xl bg-token-white w-full",
|
|
17373
|
+
// Header row — Figma: p-2, justify-between, items-center
|
|
17374
|
+
header: "flex items-center justify-between p-2 w-full bg-token-white",
|
|
17375
|
+
headerActions: "flex items-center gap-3 shrink-0",
|
|
17376
|
+
// Body — Figma: flex-col, gap-2, px-2
|
|
17377
|
+
body: "flex flex-col gap-2 px-2 w-full",
|
|
17378
|
+
// IF / clause label row — Figma: pl-3, pr-1 around the label
|
|
17379
|
+
clauseLabel: "flex items-center pl-3 pr-1 text-sm font-semibold leading-5 text-fg-grey-secondary",
|
|
17380
|
+
// Conditions group — connects rows with vertical line tokens
|
|
17381
|
+
conditionsGroup: "flex flex-col w-full",
|
|
17382
|
+
// Single condition row — Figma: gap-2, items-start
|
|
17383
|
+
conditionRow: "flex items-start gap-2 w-full",
|
|
17384
|
+
// Vertical connector line — Figma: 16px tall, 1px wide line at px-7
|
|
17385
|
+
connectorLine: "flex items-center px-7 w-full",
|
|
17386
|
+
connectorLineInner: "w-px h-4 bg-token-input",
|
|
17387
|
+
// AND/OR connector row — same layout as conditionRow so the connector
|
|
17388
|
+
// dropdown aligns with the first select in the row above/below.
|
|
17389
|
+
connectorRow: "flex items-start gap-2 w-full",
|
|
17390
|
+
// Add Condition button slot — Figma: pt-3
|
|
17391
|
+
addConditionRow: "flex items-start w-full pt-3",
|
|
17392
|
+
// "Then" strip in the grey wrapper area — Figma: px-2 py-3, items-center, gap-2
|
|
17393
|
+
thenStrip: "flex items-center gap-2 px-2 py-3 w-full",
|
|
17394
|
+
thenLabel: "flex items-center gap-2 px-1 text-sm font-semibold leading-5 text-fg-black shrink-0 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
17395
|
+
thenContent: "flex flex-1 min-w-0",
|
|
17396
|
+
// Phantom slot — invisible placeholder used to keep the AND row aligned
|
|
17397
|
+
// with the 3-column condition rows above and below (matches the
|
|
17398
|
+
// `opacity-0` Selects in the Figma).
|
|
17399
|
+
phantomSlot: "invisible shrink-0"
|
|
17400
|
+
};
|
|
17401
|
+
|
|
17402
|
+
// src/rule-builder/rule-builder.tsx
|
|
17403
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
17404
|
+
var RuleBuilder = React48.forwardRef(
|
|
17405
|
+
({
|
|
17406
|
+
title,
|
|
17407
|
+
open: openProp,
|
|
17408
|
+
defaultOpen = true,
|
|
17409
|
+
onOpenChange,
|
|
17410
|
+
onDelete,
|
|
17411
|
+
titleIcon,
|
|
17412
|
+
thenContent,
|
|
17413
|
+
thenLabel = "Then set field value to",
|
|
17414
|
+
thenIcon,
|
|
17415
|
+
children,
|
|
17416
|
+
className,
|
|
17417
|
+
style,
|
|
17418
|
+
"data-testid": dataTestId
|
|
17419
|
+
}, ref) => {
|
|
17420
|
+
const [openState, setOpenState] = React48.useState(defaultOpen);
|
|
17421
|
+
const isControlled = openProp !== void 0;
|
|
17422
|
+
const open = isControlled ? openProp : openState;
|
|
17423
|
+
const handleToggle = React48.useCallback(() => {
|
|
17424
|
+
const next = !open;
|
|
17425
|
+
if (!isControlled) setOpenState(next);
|
|
17426
|
+
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
17427
|
+
}, [open, isControlled, onOpenChange]);
|
|
17428
|
+
const titleIconNode = titleIcon != null ? titleIcon : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Workflow, {});
|
|
17429
|
+
const thenIconNode = thenIcon != null ? thenIcon : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.FileOutput, {});
|
|
17430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
17431
|
+
"div",
|
|
17432
|
+
{
|
|
17433
|
+
ref,
|
|
17434
|
+
className: cn(RULE_BUILDER_TOKENS.root, className),
|
|
17435
|
+
style,
|
|
17436
|
+
"data-testid": dataTestId != null ? dataTestId : "rule-builder",
|
|
17437
|
+
"data-state": open ? "open" : "closed",
|
|
17438
|
+
children: [
|
|
17439
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
17440
|
+
"div",
|
|
17441
|
+
{
|
|
17442
|
+
className: open ? RULE_BUILDER_TOKENS.card : RULE_BUILDER_TOKENS.cardCollapsed,
|
|
17443
|
+
children: [
|
|
17444
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: RULE_BUILDER_TOKENS.header, children: [
|
|
17445
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Badge, { variant: "default", interactive: false, leadingIcon: titleIconNode, children: title }),
|
|
17446
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: RULE_BUILDER_TOKENS.headerActions, children: [
|
|
17447
|
+
onDelete ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17448
|
+
Button,
|
|
17449
|
+
{
|
|
17450
|
+
variant: "iconLink",
|
|
17451
|
+
size: "iconXs",
|
|
17452
|
+
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Trash2, {}),
|
|
17453
|
+
onClick: onDelete,
|
|
17454
|
+
"aria-label": "Delete rule",
|
|
17455
|
+
"data-testid": "rule-builder-delete"
|
|
17456
|
+
}
|
|
17457
|
+
) : null,
|
|
17458
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17459
|
+
Button,
|
|
17460
|
+
{
|
|
17461
|
+
variant: "iconLink",
|
|
17462
|
+
size: "iconXs",
|
|
17463
|
+
leadingIcon: open ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.ChevronDown, {}),
|
|
17464
|
+
onClick: handleToggle,
|
|
17465
|
+
"aria-expanded": open,
|
|
17466
|
+
"aria-label": open ? "Collapse rule" : "Expand rule",
|
|
17467
|
+
"data-testid": "rule-builder-toggle"
|
|
17468
|
+
}
|
|
17469
|
+
)
|
|
17470
|
+
] })
|
|
17471
|
+
] }),
|
|
17472
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.body, children }) : null
|
|
17473
|
+
]
|
|
17474
|
+
}
|
|
17475
|
+
),
|
|
17476
|
+
open && thenContent ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: RULE_BUILDER_TOKENS.thenStrip, children: [
|
|
17477
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: RULE_BUILDER_TOKENS.thenLabel, children: [
|
|
17478
|
+
thenIconNode,
|
|
17479
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: thenLabel })
|
|
17480
|
+
] }),
|
|
17481
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.thenContent, children: thenContent })
|
|
17482
|
+
] }) : null
|
|
17483
|
+
]
|
|
17484
|
+
}
|
|
17485
|
+
);
|
|
17486
|
+
}
|
|
17487
|
+
);
|
|
17488
|
+
RuleBuilder.displayName = "RuleBuilder";
|
|
17489
|
+
var RuleBuilderClause = React48.forwardRef(({ label = "IF", children, className }, ref) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ref, className: cn("flex flex-col gap-2 w-full", className), children: [
|
|
17490
|
+
label !== null && label !== void 0 && label !== "" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.clauseLabel, children: label }) : null,
|
|
17491
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.conditionsGroup, children })
|
|
17492
|
+
] }));
|
|
17493
|
+
RuleBuilderClause.displayName = "RuleBuilderClause";
|
|
17494
|
+
var RuleBuilderCondition = React48.forwardRef(({ children, onDelete, className }, ref) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ref, className: cn(RULE_BUILDER_TOKENS.conditionRow, className), children: [
|
|
17495
|
+
children,
|
|
17496
|
+
onDelete ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17497
|
+
Button,
|
|
17498
|
+
{
|
|
17499
|
+
variant: "iconLink",
|
|
17500
|
+
size: "iconXs",
|
|
17501
|
+
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Trash2, {}),
|
|
17502
|
+
onClick: onDelete,
|
|
17503
|
+
"aria-label": "Delete condition",
|
|
17504
|
+
"data-testid": "rule-builder-condition-delete"
|
|
17505
|
+
}
|
|
17506
|
+
) : null
|
|
17507
|
+
] }));
|
|
17508
|
+
RuleBuilderCondition.displayName = "RuleBuilderCondition";
|
|
17509
|
+
var RuleBuilderConnector = React48.forwardRef(({ children, className }, ref) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ref, className: cn("flex flex-col w-full", className), children: [
|
|
17510
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.connectorLine, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.connectorLineInner }) }),
|
|
17511
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.connectorRow, children }),
|
|
17512
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.connectorLine, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.connectorLineInner }) })
|
|
17513
|
+
] }));
|
|
17514
|
+
RuleBuilderConnector.displayName = "RuleBuilderConnector";
|
|
17515
|
+
var RuleBuilderAddCondition = React48.forwardRef(
|
|
17516
|
+
({
|
|
17517
|
+
label = "Add Condition",
|
|
17518
|
+
onClick,
|
|
17519
|
+
disabled,
|
|
17520
|
+
className,
|
|
17521
|
+
"data-testid": dataTestId
|
|
17522
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: RULE_BUILDER_TOKENS.addConditionRow, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17523
|
+
Button,
|
|
17524
|
+
{
|
|
17525
|
+
ref,
|
|
17526
|
+
variant: "outline",
|
|
17527
|
+
size: "xs",
|
|
17528
|
+
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Plus, {}),
|
|
17529
|
+
onClick,
|
|
17530
|
+
disabled,
|
|
17531
|
+
className,
|
|
17532
|
+
"data-testid": dataTestId != null ? dataTestId : "rule-builder-add-condition",
|
|
17533
|
+
children: label
|
|
17534
|
+
}
|
|
17535
|
+
) })
|
|
17536
|
+
);
|
|
17537
|
+
RuleBuilderAddCondition.displayName = "RuleBuilderAddCondition";
|
|
17356
17538
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17357
17539
|
0 && (module.exports = {
|
|
17358
17540
|
Accordion,
|
|
@@ -17407,6 +17589,11 @@ function MultiSelectRow({
|
|
|
17407
17589
|
ProgressBar,
|
|
17408
17590
|
RadioGroup,
|
|
17409
17591
|
RadioGroupItem,
|
|
17592
|
+
RuleBuilder,
|
|
17593
|
+
RuleBuilderAddCondition,
|
|
17594
|
+
RuleBuilderClause,
|
|
17595
|
+
RuleBuilderCondition,
|
|
17596
|
+
RuleBuilderConnector,
|
|
17410
17597
|
Select,
|
|
17411
17598
|
SelectContent,
|
|
17412
17599
|
SelectFormLabel,
|
package/dist/index.mjs
CHANGED
|
@@ -17261,6 +17261,190 @@ function MultiSelectRow({
|
|
|
17261
17261
|
}
|
|
17262
17262
|
);
|
|
17263
17263
|
}
|
|
17264
|
+
|
|
17265
|
+
// src/rule-builder/rule-builder.tsx
|
|
17266
|
+
import * as React48 from "react";
|
|
17267
|
+
import {
|
|
17268
|
+
ChevronDown as ChevronDown9,
|
|
17269
|
+
ChevronUp as ChevronUp2,
|
|
17270
|
+
FileOutput,
|
|
17271
|
+
Plus,
|
|
17272
|
+
Trash2 as Trash23,
|
|
17273
|
+
Workflow
|
|
17274
|
+
} from "lucide-react";
|
|
17275
|
+
|
|
17276
|
+
// src/rule-builder/variables.ts
|
|
17277
|
+
var RULE_BUILDER_TOKENS = {
|
|
17278
|
+
// Outer grey wrapper — Figma: bg-grey, rounded-[16px], p-1, gap-1
|
|
17279
|
+
root: "flex flex-col gap-1 p-1 rounded-2xl bg-token-grey w-full",
|
|
17280
|
+
// White card — Figma: bg-white, rounded-[12px], overflow-clip
|
|
17281
|
+
card: "flex flex-col gap-2 overflow-clip pb-2 rounded-xl bg-token-white w-full",
|
|
17282
|
+
cardCollapsed: "flex flex-col overflow-clip rounded-xl bg-token-white w-full",
|
|
17283
|
+
// Header row — Figma: p-2, justify-between, items-center
|
|
17284
|
+
header: "flex items-center justify-between p-2 w-full bg-token-white",
|
|
17285
|
+
headerActions: "flex items-center gap-3 shrink-0",
|
|
17286
|
+
// Body — Figma: flex-col, gap-2, px-2
|
|
17287
|
+
body: "flex flex-col gap-2 px-2 w-full",
|
|
17288
|
+
// IF / clause label row — Figma: pl-3, pr-1 around the label
|
|
17289
|
+
clauseLabel: "flex items-center pl-3 pr-1 text-sm font-semibold leading-5 text-fg-grey-secondary",
|
|
17290
|
+
// Conditions group — connects rows with vertical line tokens
|
|
17291
|
+
conditionsGroup: "flex flex-col w-full",
|
|
17292
|
+
// Single condition row — Figma: gap-2, items-start
|
|
17293
|
+
conditionRow: "flex items-start gap-2 w-full",
|
|
17294
|
+
// Vertical connector line — Figma: 16px tall, 1px wide line at px-7
|
|
17295
|
+
connectorLine: "flex items-center px-7 w-full",
|
|
17296
|
+
connectorLineInner: "w-px h-4 bg-token-input",
|
|
17297
|
+
// AND/OR connector row — same layout as conditionRow so the connector
|
|
17298
|
+
// dropdown aligns with the first select in the row above/below.
|
|
17299
|
+
connectorRow: "flex items-start gap-2 w-full",
|
|
17300
|
+
// Add Condition button slot — Figma: pt-3
|
|
17301
|
+
addConditionRow: "flex items-start w-full pt-3",
|
|
17302
|
+
// "Then" strip in the grey wrapper area — Figma: px-2 py-3, items-center, gap-2
|
|
17303
|
+
thenStrip: "flex items-center gap-2 px-2 py-3 w-full",
|
|
17304
|
+
thenLabel: "flex items-center gap-2 px-1 text-sm font-semibold leading-5 text-fg-black shrink-0 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
17305
|
+
thenContent: "flex flex-1 min-w-0",
|
|
17306
|
+
// Phantom slot — invisible placeholder used to keep the AND row aligned
|
|
17307
|
+
// with the 3-column condition rows above and below (matches the
|
|
17308
|
+
// `opacity-0` Selects in the Figma).
|
|
17309
|
+
phantomSlot: "invisible shrink-0"
|
|
17310
|
+
};
|
|
17311
|
+
|
|
17312
|
+
// src/rule-builder/rule-builder.tsx
|
|
17313
|
+
import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
17314
|
+
var RuleBuilder = React48.forwardRef(
|
|
17315
|
+
({
|
|
17316
|
+
title,
|
|
17317
|
+
open: openProp,
|
|
17318
|
+
defaultOpen = true,
|
|
17319
|
+
onOpenChange,
|
|
17320
|
+
onDelete,
|
|
17321
|
+
titleIcon,
|
|
17322
|
+
thenContent,
|
|
17323
|
+
thenLabel = "Then set field value to",
|
|
17324
|
+
thenIcon,
|
|
17325
|
+
children,
|
|
17326
|
+
className,
|
|
17327
|
+
style,
|
|
17328
|
+
"data-testid": dataTestId
|
|
17329
|
+
}, ref) => {
|
|
17330
|
+
const [openState, setOpenState] = React48.useState(defaultOpen);
|
|
17331
|
+
const isControlled = openProp !== void 0;
|
|
17332
|
+
const open = isControlled ? openProp : openState;
|
|
17333
|
+
const handleToggle = React48.useCallback(() => {
|
|
17334
|
+
const next = !open;
|
|
17335
|
+
if (!isControlled) setOpenState(next);
|
|
17336
|
+
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
17337
|
+
}, [open, isControlled, onOpenChange]);
|
|
17338
|
+
const titleIconNode = titleIcon != null ? titleIcon : /* @__PURE__ */ jsx44(Workflow, {});
|
|
17339
|
+
const thenIconNode = thenIcon != null ? thenIcon : /* @__PURE__ */ jsx44(FileOutput, {});
|
|
17340
|
+
return /* @__PURE__ */ jsxs34(
|
|
17341
|
+
"div",
|
|
17342
|
+
{
|
|
17343
|
+
ref,
|
|
17344
|
+
className: cn(RULE_BUILDER_TOKENS.root, className),
|
|
17345
|
+
style,
|
|
17346
|
+
"data-testid": dataTestId != null ? dataTestId : "rule-builder",
|
|
17347
|
+
"data-state": open ? "open" : "closed",
|
|
17348
|
+
children: [
|
|
17349
|
+
/* @__PURE__ */ jsxs34(
|
|
17350
|
+
"div",
|
|
17351
|
+
{
|
|
17352
|
+
className: open ? RULE_BUILDER_TOKENS.card : RULE_BUILDER_TOKENS.cardCollapsed,
|
|
17353
|
+
children: [
|
|
17354
|
+
/* @__PURE__ */ jsxs34("div", { className: RULE_BUILDER_TOKENS.header, children: [
|
|
17355
|
+
/* @__PURE__ */ jsx44(Badge, { variant: "default", interactive: false, leadingIcon: titleIconNode, children: title }),
|
|
17356
|
+
/* @__PURE__ */ jsxs34("div", { className: RULE_BUILDER_TOKENS.headerActions, children: [
|
|
17357
|
+
onDelete ? /* @__PURE__ */ jsx44(
|
|
17358
|
+
Button,
|
|
17359
|
+
{
|
|
17360
|
+
variant: "iconLink",
|
|
17361
|
+
size: "iconXs",
|
|
17362
|
+
leadingIcon: /* @__PURE__ */ jsx44(Trash23, {}),
|
|
17363
|
+
onClick: onDelete,
|
|
17364
|
+
"aria-label": "Delete rule",
|
|
17365
|
+
"data-testid": "rule-builder-delete"
|
|
17366
|
+
}
|
|
17367
|
+
) : null,
|
|
17368
|
+
/* @__PURE__ */ jsx44(
|
|
17369
|
+
Button,
|
|
17370
|
+
{
|
|
17371
|
+
variant: "iconLink",
|
|
17372
|
+
size: "iconXs",
|
|
17373
|
+
leadingIcon: open ? /* @__PURE__ */ jsx44(ChevronUp2, {}) : /* @__PURE__ */ jsx44(ChevronDown9, {}),
|
|
17374
|
+
onClick: handleToggle,
|
|
17375
|
+
"aria-expanded": open,
|
|
17376
|
+
"aria-label": open ? "Collapse rule" : "Expand rule",
|
|
17377
|
+
"data-testid": "rule-builder-toggle"
|
|
17378
|
+
}
|
|
17379
|
+
)
|
|
17380
|
+
] })
|
|
17381
|
+
] }),
|
|
17382
|
+
open ? /* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.body, children }) : null
|
|
17383
|
+
]
|
|
17384
|
+
}
|
|
17385
|
+
),
|
|
17386
|
+
open && thenContent ? /* @__PURE__ */ jsxs34("div", { className: RULE_BUILDER_TOKENS.thenStrip, children: [
|
|
17387
|
+
/* @__PURE__ */ jsxs34("div", { className: RULE_BUILDER_TOKENS.thenLabel, children: [
|
|
17388
|
+
thenIconNode,
|
|
17389
|
+
/* @__PURE__ */ jsx44("span", { children: thenLabel })
|
|
17390
|
+
] }),
|
|
17391
|
+
/* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.thenContent, children: thenContent })
|
|
17392
|
+
] }) : null
|
|
17393
|
+
]
|
|
17394
|
+
}
|
|
17395
|
+
);
|
|
17396
|
+
}
|
|
17397
|
+
);
|
|
17398
|
+
RuleBuilder.displayName = "RuleBuilder";
|
|
17399
|
+
var RuleBuilderClause = React48.forwardRef(({ label = "IF", children, className }, ref) => /* @__PURE__ */ jsxs34("div", { ref, className: cn("flex flex-col gap-2 w-full", className), children: [
|
|
17400
|
+
label !== null && label !== void 0 && label !== "" ? /* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.clauseLabel, children: label }) : null,
|
|
17401
|
+
/* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.conditionsGroup, children })
|
|
17402
|
+
] }));
|
|
17403
|
+
RuleBuilderClause.displayName = "RuleBuilderClause";
|
|
17404
|
+
var RuleBuilderCondition = React48.forwardRef(({ children, onDelete, className }, ref) => /* @__PURE__ */ jsxs34("div", { ref, className: cn(RULE_BUILDER_TOKENS.conditionRow, className), children: [
|
|
17405
|
+
children,
|
|
17406
|
+
onDelete ? /* @__PURE__ */ jsx44(
|
|
17407
|
+
Button,
|
|
17408
|
+
{
|
|
17409
|
+
variant: "iconLink",
|
|
17410
|
+
size: "iconXs",
|
|
17411
|
+
leadingIcon: /* @__PURE__ */ jsx44(Trash23, {}),
|
|
17412
|
+
onClick: onDelete,
|
|
17413
|
+
"aria-label": "Delete condition",
|
|
17414
|
+
"data-testid": "rule-builder-condition-delete"
|
|
17415
|
+
}
|
|
17416
|
+
) : null
|
|
17417
|
+
] }));
|
|
17418
|
+
RuleBuilderCondition.displayName = "RuleBuilderCondition";
|
|
17419
|
+
var RuleBuilderConnector = React48.forwardRef(({ children, className }, ref) => /* @__PURE__ */ jsxs34("div", { ref, className: cn("flex flex-col w-full", className), children: [
|
|
17420
|
+
/* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.connectorLine, "aria-hidden": "true", children: /* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.connectorLineInner }) }),
|
|
17421
|
+
/* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.connectorRow, children }),
|
|
17422
|
+
/* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.connectorLine, "aria-hidden": "true", children: /* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.connectorLineInner }) })
|
|
17423
|
+
] }));
|
|
17424
|
+
RuleBuilderConnector.displayName = "RuleBuilderConnector";
|
|
17425
|
+
var RuleBuilderAddCondition = React48.forwardRef(
|
|
17426
|
+
({
|
|
17427
|
+
label = "Add Condition",
|
|
17428
|
+
onClick,
|
|
17429
|
+
disabled,
|
|
17430
|
+
className,
|
|
17431
|
+
"data-testid": dataTestId
|
|
17432
|
+
}, ref) => /* @__PURE__ */ jsx44("div", { className: RULE_BUILDER_TOKENS.addConditionRow, children: /* @__PURE__ */ jsx44(
|
|
17433
|
+
Button,
|
|
17434
|
+
{
|
|
17435
|
+
ref,
|
|
17436
|
+
variant: "outline",
|
|
17437
|
+
size: "xs",
|
|
17438
|
+
leadingIcon: /* @__PURE__ */ jsx44(Plus, {}),
|
|
17439
|
+
onClick,
|
|
17440
|
+
disabled,
|
|
17441
|
+
className,
|
|
17442
|
+
"data-testid": dataTestId != null ? dataTestId : "rule-builder-add-condition",
|
|
17443
|
+
children: label
|
|
17444
|
+
}
|
|
17445
|
+
) })
|
|
17446
|
+
);
|
|
17447
|
+
RuleBuilderAddCondition.displayName = "RuleBuilderAddCondition";
|
|
17264
17448
|
export {
|
|
17265
17449
|
Accordion,
|
|
17266
17450
|
AccordionContent,
|
|
@@ -17314,6 +17498,11 @@ export {
|
|
|
17314
17498
|
ProgressBar,
|
|
17315
17499
|
RadioGroup,
|
|
17316
17500
|
RadioGroupItem,
|
|
17501
|
+
RuleBuilder,
|
|
17502
|
+
RuleBuilderAddCondition,
|
|
17503
|
+
RuleBuilderClause,
|
|
17504
|
+
RuleBuilderCondition,
|
|
17505
|
+
RuleBuilderConnector,
|
|
17317
17506
|
Select,
|
|
17318
17507
|
SelectContent,
|
|
17319
17508
|
SelectFormLabel,
|
package/dist/styles.css
CHANGED
|
@@ -225,6 +225,9 @@
|
|
|
225
225
|
.lego-land .collapse {
|
|
226
226
|
visibility: collapse;
|
|
227
227
|
}
|
|
228
|
+
.lego-land .invisible {
|
|
229
|
+
visibility: hidden;
|
|
230
|
+
}
|
|
228
231
|
.lego-land .visible {
|
|
229
232
|
visibility: visible;
|
|
230
233
|
}
|
|
@@ -725,6 +728,9 @@
|
|
|
725
728
|
.lego-land .w-\[120px\] {
|
|
726
729
|
width: 120px;
|
|
727
730
|
}
|
|
731
|
+
.lego-land .w-\[144px\] {
|
|
732
|
+
width: 144px;
|
|
733
|
+
}
|
|
728
734
|
.lego-land .w-\[196px\] {
|
|
729
735
|
width: 196px;
|
|
730
736
|
}
|
|
@@ -746,6 +752,9 @@
|
|
|
746
752
|
.lego-land .w-\[336px\] {
|
|
747
753
|
width: 336px;
|
|
748
754
|
}
|
|
755
|
+
.lego-land .w-\[380px\] {
|
|
756
|
+
width: 380px;
|
|
757
|
+
}
|
|
749
758
|
.lego-land .w-\[390px\] {
|
|
750
759
|
width: 390px;
|
|
751
760
|
}
|
|
@@ -1381,6 +1390,9 @@
|
|
|
1381
1390
|
background-color: color-mix(in oklab, hsl(var(--bg-grey)) 50%, transparent);
|
|
1382
1391
|
}
|
|
1383
1392
|
}
|
|
1393
|
+
.lego-land .bg-token-input {
|
|
1394
|
+
background-color: hsl(var(--border-input));
|
|
1395
|
+
}
|
|
1384
1396
|
.lego-land .bg-token-light {
|
|
1385
1397
|
background-color: hsl(var(--border-light));
|
|
1386
1398
|
}
|
|
@@ -1512,6 +1524,9 @@
|
|
|
1512
1524
|
.lego-land .px-6 {
|
|
1513
1525
|
padding-inline: calc(var(--spacing) * 6);
|
|
1514
1526
|
}
|
|
1527
|
+
.lego-land .px-7 {
|
|
1528
|
+
padding-inline: calc(var(--spacing) * 7);
|
|
1529
|
+
}
|
|
1515
1530
|
.lego-land .px-8 {
|
|
1516
1531
|
padding-inline: calc(var(--spacing) * 8);
|
|
1517
1532
|
}
|
|
@@ -1593,12 +1608,18 @@
|
|
|
1593
1608
|
.lego-land .pt-1 {
|
|
1594
1609
|
padding-top: calc(var(--spacing) * 1);
|
|
1595
1610
|
}
|
|
1611
|
+
.lego-land .pt-3 {
|
|
1612
|
+
padding-top: calc(var(--spacing) * 3);
|
|
1613
|
+
}
|
|
1596
1614
|
.lego-land .pt-4 {
|
|
1597
1615
|
padding-top: calc(var(--spacing) * 4);
|
|
1598
1616
|
}
|
|
1599
1617
|
.lego-land .pt-6 {
|
|
1600
1618
|
padding-top: calc(var(--spacing) * 6);
|
|
1601
1619
|
}
|
|
1620
|
+
.lego-land .pr-1 {
|
|
1621
|
+
padding-right: calc(var(--spacing) * 1);
|
|
1622
|
+
}
|
|
1602
1623
|
.lego-land .pr-2 {
|
|
1603
1624
|
padding-right: calc(var(--spacing) * 2);
|
|
1604
1625
|
}
|
|
@@ -1623,6 +1644,9 @@
|
|
|
1623
1644
|
.lego-land .pl-2 {
|
|
1624
1645
|
padding-left: calc(var(--spacing) * 2);
|
|
1625
1646
|
}
|
|
1647
|
+
.lego-land .pl-3 {
|
|
1648
|
+
padding-left: calc(var(--spacing) * 3);
|
|
1649
|
+
}
|
|
1626
1650
|
.lego-land .pl-5 {
|
|
1627
1651
|
padding-left: calc(var(--spacing) * 5);
|
|
1628
1652
|
}
|
|
@@ -3073,6 +3097,11 @@
|
|
|
3073
3097
|
width: 100%;
|
|
3074
3098
|
}
|
|
3075
3099
|
}
|
|
3100
|
+
.lego-land .\[\&\>svg\]\:shrink-0 {
|
|
3101
|
+
.lego-land &>svg {
|
|
3102
|
+
flex-shrink: 0;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3076
3105
|
.lego-land .\[\&\>svg\]\:fill-current {
|
|
3077
3106
|
.lego-land &>svg {
|
|
3078
3107
|
fill: currentcolor;
|