torch-glare 2.5.6 → 2.6.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/README.md +4 -3
- package/dist/bin/index.js +9 -24
- package/dist/bin/index.js.map +1 -1
- package/dist/src/commands/add.d.ts +2 -2
- package/dist/src/commands/add.d.ts.map +1 -1
- package/dist/src/commands/add.js +4 -70
- package/dist/src/commands/add.js.map +1 -1
- package/dist/src/commands/hook.d.ts +5 -4
- package/dist/src/commands/hook.d.ts.map +1 -1
- package/dist/src/commands/hook.js +7 -75
- package/dist/src/commands/hook.js.map +1 -1
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/layout.d.ts +5 -4
- package/dist/src/commands/layout.d.ts.map +1 -1
- package/dist/src/commands/layout.js +7 -75
- package/dist/src/commands/layout.js.map +1 -1
- package/dist/src/commands/provider.d.ts +5 -4
- package/dist/src/commands/provider.d.ts.map +1 -1
- package/dist/src/commands/provider.js +7 -75
- package/dist/src/commands/provider.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +78 -43
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/utils.d.ts +5 -4
- package/dist/src/commands/utils.d.ts.map +1 -1
- package/dist/src/commands/utils.js +7 -80
- package/dist/src/commands/utils.js.map +1 -1
- package/dist/src/shared/addFromRegistry.d.ts +16 -0
- package/dist/src/shared/addFromRegistry.d.ts.map +1 -0
- package/dist/src/shared/addFromRegistry.js +88 -0
- package/dist/src/shared/addFromRegistry.js.map +1 -0
- package/dist/src/shared/getInstallCommand.d.ts.map +1 -1
- package/dist/src/shared/getInstallCommand.js +5 -0
- package/dist/src/shared/getInstallCommand.js.map +1 -1
- package/dist/src/shared/installDependencies.d.ts +0 -10
- package/dist/src/shared/installDependencies.d.ts.map +1 -1
- package/dist/src/shared/installDependencies.js +0 -17
- package/dist/src/shared/installDependencies.js.map +1 -1
- package/dist/src/shared/installFromPlan.d.ts +7 -5
- package/dist/src/shared/installFromPlan.d.ts.map +1 -1
- package/dist/src/shared/installFromPlan.js +103 -36
- package/dist/src/shared/installFromPlan.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +12 -3
- package/dist/src/shared/loadRegistry.d.ts.map +1 -1
- package/dist/src/shared/loadRegistry.js +19 -20
- package/dist/src/shared/loadRegistry.js.map +1 -1
- package/dist/src/shared/registryClient.d.ts +19 -0
- package/dist/src/shared/registryClient.d.ts.map +1 -0
- package/dist/src/shared/registryClient.js +128 -0
- package/dist/src/shared/registryClient.js.map +1 -0
- package/dist/src/shared/resolveEntry.d.ts +10 -7
- package/dist/src/shared/resolveEntry.d.ts.map +1 -1
- package/dist/src/shared/resolveEntry.js +18 -13
- package/dist/src/shared/resolveEntry.js.map +1 -1
- package/dist/src/shared/suggestOtherCommand.d.ts +7 -1
- package/dist/src/shared/suggestOtherCommand.d.ts.map +1 -1
- package/dist/src/shared/suggestOtherCommand.js +29 -23
- package/dist/src/shared/suggestOtherCommand.js.map +1 -1
- package/dist/src/types/main.d.ts +31 -2
- package/dist/src/types/main.d.ts.map +1 -1
- package/package.json +6 -11
- package/apps/lib/components/ActionButton.tsx +0 -93
- package/apps/lib/components/ActionsGroup.tsx +0 -27
- package/apps/lib/components/AlertDialog.tsx +0 -204
- package/apps/lib/components/Avatar.tsx +0 -46
- package/apps/lib/components/Badge.tsx +0 -250
- package/apps/lib/components/BadgeField.tsx +0 -403
- package/apps/lib/components/Breadcrumb.tsx +0 -280
- package/apps/lib/components/Button.tsx +0 -325
- package/apps/lib/components/ButtonGroup.tsx +0 -190
- package/apps/lib/components/Calendar.tsx +0 -115
- package/apps/lib/components/Card.tsx +0 -95
- package/apps/lib/components/Checkbox.tsx +0 -42
- package/apps/lib/components/ColorPicker.tsx +0 -441
- package/apps/lib/components/ConclusionHeader.tsx +0 -148
- package/apps/lib/components/ContextMenu.tsx +0 -571
- package/apps/lib/components/CountBadge.tsx +0 -52
- package/apps/lib/components/DataTable.tsx +0 -213
- package/apps/lib/components/DataViews/badge.ts +0 -49
- package/apps/lib/components/DataViews/cell.tsx +0 -324
- package/apps/lib/components/DataViews/context.ts +0 -144
- package/apps/lib/components/DataViews/data-views.tsx +0 -395
- package/apps/lib/components/DataViews/filters/children.tsx +0 -98
- package/apps/lib/components/DataViews/filters/custom.tsx +0 -34
- package/apps/lib/components/DataViews/filters/filters.tsx +0 -157
- package/apps/lib/components/DataViews/filters/index.ts +0 -4
- package/apps/lib/components/DataViews/filters/labelled.tsx +0 -20
- package/apps/lib/components/DataViews/filters/presets.tsx +0 -65
- package/apps/lib/components/DataViews/filters/sync.tsx +0 -35
- package/apps/lib/components/DataViews/filters/values.ts +0 -173
- package/apps/lib/components/DataViews/header.tsx +0 -220
- package/apps/lib/components/DataViews/hooks/index.ts +0 -5
- package/apps/lib/components/DataViews/hooks/useActiveRow.ts +0 -22
- package/apps/lib/components/DataViews/hooks/useControllable.ts +0 -52
- package/apps/lib/components/DataViews/index.ts +0 -88
- package/apps/lib/components/DataViews/panel/columns.tsx +0 -153
- package/apps/lib/components/DataViews/panel/controls.tsx +0 -106
- package/apps/lib/components/DataViews/panel/index.ts +0 -3
- package/apps/lib/components/DataViews/panel/panel.tsx +0 -164
- package/apps/lib/components/DataViews/panel/saved-views.tsx +0 -67
- package/apps/lib/components/DataViews/panel/section.tsx +0 -81
- package/apps/lib/components/DataViews/panel/sort.tsx +0 -42
- package/apps/lib/components/DataViews/panel/tab.tsx +0 -31
- package/apps/lib/components/DataViews/slots.ts +0 -72
- package/apps/lib/components/DataViews/states.tsx +0 -73
- package/apps/lib/components/DataViews/types.ts +0 -510
- package/apps/lib/components/DataViews/views/board-view.tsx +0 -381
- package/apps/lib/components/DataViews/views/card-rows.tsx +0 -36
- package/apps/lib/components/DataViews/views/inbox-view.tsx +0 -260
- package/apps/lib/components/DataViews/views/pane-views.tsx +0 -196
- package/apps/lib/components/DataViews/views/table-view.tsx +0 -493
- package/apps/lib/components/DataViews/views/tree-view.tsx +0 -367
- package/apps/lib/components/DatePicker.tsx +0 -232
- package/apps/lib/components/Dialog.tsx +0 -116
- package/apps/lib/components/Divider.tsx +0 -28
- package/apps/lib/components/Drawer.tsx +0 -451
- package/apps/lib/components/DropdownMenu.tsx +0 -554
- package/apps/lib/components/FieldHint.tsx +0 -69
- package/apps/lib/components/Form.tsx +0 -182
- package/apps/lib/components/FormBuilder/context.ts +0 -85
- package/apps/lib/components/FormBuilder/field-kind.ts +0 -28
- package/apps/lib/components/FormBuilder/fields/ChoiceFields.tsx +0 -60
- package/apps/lib/components/FormBuilder/fields/ColorField.tsx +0 -59
- package/apps/lib/components/FormBuilder/fields/CustomField.tsx +0 -11
- package/apps/lib/components/FormBuilder/fields/DateField.tsx +0 -32
- package/apps/lib/components/FormBuilder/fields/FieldArray.tsx +0 -74
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +0 -168
- package/apps/lib/components/FormBuilder/fields/FileField.tsx +0 -39
- package/apps/lib/components/FormBuilder/fields/OptionListFields.tsx +0 -132
- package/apps/lib/components/FormBuilder/fields/OtpField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +0 -109
- package/apps/lib/components/FormBuilder/fields/RichTextEditorField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/SelectField.tsx +0 -114
- package/apps/lib/components/FormBuilder/fields/SignatureField.tsx +0 -157
- package/apps/lib/components/FormBuilder/fields/SliderField.tsx +0 -67
- package/apps/lib/components/FormBuilder/fields/SwitchBoxField.tsx +0 -41
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +0 -336
- package/apps/lib/components/FormBuilder/fields/TextField.tsx +0 -213
- package/apps/lib/components/FormBuilder/fields/TreeSelectField.tsx +0 -43
- package/apps/lib/components/FormBuilder/fields/countries.ts +0 -303
- package/apps/lib/components/FormBuilder/fields/index.ts +0 -25
- package/apps/lib/components/FormBuilder/form-builder.tsx +0 -198
- package/apps/lib/components/FormBuilder/index.ts +0 -31
- package/apps/lib/components/FormBuilder/numberFormat.ts +0 -16
- package/apps/lib/components/FormBuilder/submit.tsx +0 -67
- package/apps/lib/components/FormBuilder/types.ts +0 -316
- package/apps/lib/components/FormRenderer/FormDrawer.tsx +0 -250
- package/apps/lib/components/FormRenderer/detail.tsx +0 -256
- package/apps/lib/components/FormRenderer/form-renderer.tsx +0 -358
- package/apps/lib/components/FormRenderer/header.tsx +0 -88
- package/apps/lib/components/FormRenderer/index.ts +0 -17
- package/apps/lib/components/FormRenderer/notch-action.tsx +0 -64
- package/apps/lib/components/FormRenderer/section.tsx +0 -39
- package/apps/lib/components/FormRenderer/stepper.tsx +0 -393
- package/apps/lib/components/FormRenderer/types.ts +0 -115
- package/apps/lib/components/FormSummary.tsx +0 -282
- package/apps/lib/components/HeaderBar.tsx +0 -117
- package/apps/lib/components/ImageAttachment.tsx +0 -209
- package/apps/lib/components/InnerLabelField.tsx +0 -154
- package/apps/lib/components/Input.tsx +0 -224
- package/apps/lib/components/InputField.tsx +0 -147
- package/apps/lib/components/InputOTP.tsx +0 -84
- package/apps/lib/components/Label.tsx +0 -129
- package/apps/lib/components/LabelField.tsx +0 -76
- package/apps/lib/components/LabeledCheckBox.tsx +0 -51
- package/apps/lib/components/LabeledRadio.tsx +0 -51
- package/apps/lib/components/LinkButton.tsx +0 -94
- package/apps/lib/components/LoginButton.tsx +0 -51
- package/apps/lib/components/PasswordLevel.tsx +0 -58
- package/apps/lib/components/Popover.tsx +0 -312
- package/apps/lib/components/ProfileMenu.tsx +0 -85
- package/apps/lib/components/Radio.tsx +0 -59
- package/apps/lib/components/RadioCard.tsx +0 -50
- package/apps/lib/components/ScrollArea.tsx +0 -54
- package/apps/lib/components/SearchField.tsx +0 -62
- package/apps/lib/components/SearchableSelect.tsx +0 -318
- package/apps/lib/components/SearchableTable.tsx +0 -344
- package/apps/lib/components/SearchableTree.tsx +0 -485
- package/apps/lib/components/SearchableTreeDialog.tsx +0 -502
- package/apps/lib/components/SectionBlock.tsx +0 -168
- package/apps/lib/components/Select.tsx +0 -347
- package/apps/lib/components/SimpleSelect.tsx +0 -225
- package/apps/lib/components/Skeleton.tsx +0 -12
- package/apps/lib/components/SlideDatePicker.tsx +0 -255
- package/apps/lib/components/SpinLoading.tsx +0 -174
- package/apps/lib/components/Stepper.tsx +0 -480
- package/apps/lib/components/Switch.tsx +0 -82
- package/apps/lib/components/TabFormItem.tsx +0 -153
- package/apps/lib/components/TabSwitch.tsx +0 -172
- package/apps/lib/components/Table.tsx +0 -597
- package/apps/lib/components/TextEditor/ChartBlockTool.ts +0 -676
- package/apps/lib/components/TextEditor/RichTextField.tsx +0 -46
- package/apps/lib/components/TextEditor/TableDnDWrapper.ts +0 -462
- package/apps/lib/components/TextEditor/TextEditor.tsx +0 -1164
- package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +0 -429
- package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +0 -70
- package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +0 -50
- package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +0 -48
- package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +0 -98
- package/apps/lib/components/TextEditor/editorjs.d.ts +0 -60
- package/apps/lib/components/TextEditor/index.ts +0 -7
- package/apps/lib/components/TextEditor/markdownParser.ts +0 -346
- package/apps/lib/components/Textarea.tsx +0 -117
- package/apps/lib/components/Timeline.tsx +0 -263
- package/apps/lib/components/Toast.tsx +0 -87
- package/apps/lib/components/Toggle.tsx +0 -125
- package/apps/lib/components/ToggleButton.tsx +0 -140
- package/apps/lib/components/Tooltip.tsx +0 -116
- package/apps/lib/components/TransparentLabel.tsx +0 -71
- package/apps/lib/components/TreeDropDown.tsx +0 -115
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +0 -380
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +0 -75
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +0 -354
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +0 -60
- package/apps/lib/components/TreeFolder/icons.tsx +0 -60
- package/apps/lib/components/TreeFolder/index.ts +0 -24
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +0 -109
- package/apps/lib/components/TreeFolder/types.ts +0 -77
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +0 -118
- package/apps/lib/hooks/useActiveTreeItem.ts +0 -61
- package/apps/lib/hooks/useClickOutside.ts +0 -27
- package/apps/lib/hooks/useDragDrop.tsx +0 -365
- package/apps/lib/hooks/useHtmlDir.ts +0 -31
- package/apps/lib/hooks/useInfiniteScroll.ts +0 -108
- package/apps/lib/hooks/useIsMobile.ts +0 -21
- package/apps/lib/hooks/useResize.ts +0 -67
- package/apps/lib/hooks/useTagSelection.ts +0 -300
- package/apps/lib/layouts/CNLayout.tsx +0 -372
- package/apps/lib/layouts/DataViewCard.tsx +0 -62
- package/apps/lib/layouts/FieldSection.tsx +0 -91
- package/apps/lib/layouts/TreeSubLayout.tsx +0 -173
- package/apps/lib/providers/ThemeProvider.tsx +0 -84
- package/apps/lib/registry.json +0 -1217
- package/apps/lib/tsconfig.json +0 -9
- package/apps/lib/tsconfig.tsbuildinfo +0 -1
- package/apps/lib/utils/cn.ts +0 -6
- package/apps/lib/utils/color.ts +0 -175
- package/apps/lib/utils/dataViews/path.ts +0 -67
- package/apps/lib/utils/dataViews/query.ts +0 -73
- package/apps/lib/utils/dataViews/types.ts +0 -187
- package/apps/lib/utils/dateFormat.ts +0 -108
- package/apps/lib/utils/resize.ts +0 -31
- package/apps/lib/utils/scroller.ts +0 -26
- package/apps/lib/utils/types.ts +0 -16
- package/docs/BLOCKS.md +0 -129
- package/docs/CHANGELOG-1.1.16.md +0 -108
- package/docs/Cover.png +0 -0
- package/docs/README.md +0 -215
- package/docs/components/action-button.md +0 -638
- package/docs/components/actions-group.md +0 -708
- package/docs/components/alert-dialog.md +0 -920
- package/docs/components/avatar.md +0 -709
- package/docs/components/badge-field.md +0 -738
- package/docs/components/badge.md +0 -301
- package/docs/components/breadcrumb.md +0 -930
- package/docs/components/button-group.md +0 -650
- package/docs/components/button.md +0 -639
- package/docs/components/calendar.md +0 -555
- package/docs/components/card.md +0 -622
- package/docs/components/chart-block-tool.md +0 -129
- package/docs/components/checkbox.md +0 -699
- package/docs/components/cn-layout.md +0 -854
- package/docs/components/color-picker.md +0 -101
- package/docs/components/conclusion-header.md +0 -80
- package/docs/components/context-menu.md +0 -483
- package/docs/components/count-badge.md +0 -560
- package/docs/components/data-table.md +0 -854
- package/docs/components/data-views/backend-response.md +0 -324
- package/docs/components/data-views/examples/a11y-rtl.md +0 -250
- package/docs/components/data-views/examples/api-orders-route.md +0 -130
- package/docs/components/data-views/examples/fields.md +0 -362
- package/docs/components/data-views/examples/filters.md +0 -307
- package/docs/components/data-views/examples/inbox-routing.md +0 -218
- package/docs/components/data-views/examples/index.md +0 -29
- package/docs/components/data-views/examples/overview.md +0 -244
- package/docs/components/data-views/examples/panel.md +0 -212
- package/docs/components/data-views/examples/scale.md +0 -231
- package/docs/components/data-views/examples/server-side.md +0 -210
- package/docs/components/data-views/examples/state.md +0 -250
- package/docs/components/data-views/examples/tree-custom.md +0 -388
- package/docs/components/data-views/examples/view-registry.md +0 -313
- package/docs/components/data-views/examples/views.md +0 -534
- package/docs/components/data-views/guide.md +0 -405
- package/docs/components/data-views/index.md +0 -1521
- package/docs/components/data-views/migration.md +0 -81
- package/docs/components/date-picker.md +0 -857
- package/docs/components/dialog.md +0 -929
- package/docs/components/divider.md +0 -766
- package/docs/components/drawer.md +0 -654
- package/docs/components/dropdown-menu.md +0 -668
- package/docs/components/field-hint.md +0 -898
- package/docs/components/field-section.md +0 -781
- package/docs/components/form-builder.md +0 -284
- package/docs/components/form-renderer.md +0 -396
- package/docs/components/form-summary.md +0 -138
- package/docs/components/form.md +0 -785
- package/docs/components/header-bar.md +0 -188
- package/docs/components/image-attachment.md +0 -906
- package/docs/components/inner-label-field.md +0 -819
- package/docs/components/input-field.md +0 -623
- package/docs/components/input-otp.md +0 -756
- package/docs/components/input.md +0 -634
- package/docs/components/label-field.md +0 -770
- package/docs/components/label.md +0 -761
- package/docs/components/labeled-check-box.md +0 -642
- package/docs/components/labeled-radio.md +0 -796
- package/docs/components/link-button.md +0 -685
- package/docs/components/login-button.md +0 -872
- package/docs/components/password-level.md +0 -803
- package/docs/components/popover.md +0 -649
- package/docs/components/profile-menu.md +0 -656
- package/docs/components/radio-card.md +0 -801
- package/docs/components/radio.md +0 -735
- package/docs/components/scroll-area.md +0 -691
- package/docs/components/search-field.md +0 -702
- package/docs/components/searchable-select.md +0 -368
- package/docs/components/searchable-table.md +0 -438
- package/docs/components/searchable-tree-dialog.md +0 -190
- package/docs/components/searchable-tree.md +0 -200
- package/docs/components/section-block.md +0 -483
- package/docs/components/select.md +0 -709
- package/docs/components/simple-select.md +0 -741
- package/docs/components/skeleton.md +0 -706
- package/docs/components/slide-date-picker.md +0 -837
- package/docs/components/spin-loading.md +0 -696
- package/docs/components/stepper.md +0 -316
- package/docs/components/switch.md +0 -770
- package/docs/components/tab-form-item.md +0 -773
- package/docs/components/tab-switch.md +0 -170
- package/docs/components/table-dnd-wrapper.md +0 -107
- package/docs/components/table.md +0 -1088
- package/docs/components/text-editor.md +0 -735
- package/docs/components/textarea.md +0 -681
- package/docs/components/timeline.md +0 -254
- package/docs/components/toast.md +0 -773
- package/docs/components/toggle-button.md +0 -643
- package/docs/components/toggle.md +0 -882
- package/docs/components/tooltip.md +0 -513
- package/docs/components/transparent-label.md +0 -721
- package/docs/components/tree-drop-down.md +0 -740
- package/docs/components/tree-folder.md +0 -110
- package/docs/components/tree-sub-layout.md +0 -707
- package/docs/explanation/architecture.md +0 -54
- package/docs/explanation/design-system.md +0 -52
- package/docs/how-to/form-and-list-recipes.md +0 -386
- package/docs/how-to/forms-with-form-builder.md +0 -472
- package/docs/how-to/guides.md +0 -1027
- package/docs/migration/changelog.md +0 -60
- package/docs/migration/form-builder-2.5.2.md +0 -113
- package/docs/reference/cli.md +0 -112
- package/docs/reference/components.md +0 -572
- package/docs/reference/hooks.md +0 -1523
- package/docs/reference/providers.md +0 -866
- package/docs/reference/tailwind-plugins.md +0 -942
- package/docs/reference/theme.md +0 -85
- package/docs/reference/types.md +0 -1016
- package/docs/reference/utilities.md +0 -726
- package/docs/tutorials/building-first-form.md +0 -846
- package/docs/tutorials/component-composition.md +0 -882
- package/docs/tutorials/getting-started.md +0 -302
- package/docs/tutorials/theming-basics.md +0 -785
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { ReactNode, HTMLAttributes } from "react";
|
|
2
|
-
import { cva, VariantProps } from "class-variance-authority";
|
|
3
|
-
import { cn } from "../utils/cn";
|
|
4
|
-
import { Themes } from "../utils/types";
|
|
5
|
-
|
|
6
|
-
const SOLID_TEXT =
|
|
7
|
-
"text-content-presentation-global-primary-light [&_i]:text-content-presentation-global-primary-light";
|
|
8
|
-
|
|
9
|
-
const solidCompoundVariants = [
|
|
10
|
-
{
|
|
11
|
-
badgeStyle: "solid" as const,
|
|
12
|
-
color: "gray" as const,
|
|
13
|
-
className: `bg-background-presentation-badge-gray-solid ${SOLID_TEXT}`,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
badgeStyle: "solid" as const,
|
|
17
|
-
color: "slate" as const,
|
|
18
|
-
className: `bg-background-presentation-badge-slate-solid ${SOLID_TEXT}`,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
badgeStyle: "solid" as const,
|
|
22
|
-
color: "red" as const,
|
|
23
|
-
className: `bg-background-presentation-badge-red-solid ${SOLID_TEXT}`,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
badgeStyle: "solid" as const,
|
|
27
|
-
color: "orange" as const,
|
|
28
|
-
className: `bg-background-presentation-badge-orange-solid ${SOLID_TEXT}`,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
badgeStyle: "solid" as const,
|
|
32
|
-
color: "yellow" as const,
|
|
33
|
-
className: `bg-background-presentation-badge-yellow-solid ${SOLID_TEXT}`,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
badgeStyle: "solid" as const,
|
|
37
|
-
color: "green" as const,
|
|
38
|
-
className: `bg-background-presentation-badge-green-solid ${SOLID_TEXT}`,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
badgeStyle: "solid" as const,
|
|
42
|
-
color: "ocean" as const,
|
|
43
|
-
className: `bg-background-presentation-badge-ocean-solid ${SOLID_TEXT}`,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
badgeStyle: "solid" as const,
|
|
47
|
-
color: "blue" as const,
|
|
48
|
-
className: `bg-background-presentation-badge-blue-solid ${SOLID_TEXT}`,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
badgeStyle: "solid" as const,
|
|
52
|
-
color: "purple" as const,
|
|
53
|
-
className: `bg-background-presentation-badge-purple-solid ${SOLID_TEXT}`,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
badgeStyle: "solid" as const,
|
|
57
|
-
color: "rose" as const,
|
|
58
|
-
className: `bg-background-presentation-badge-rose-solid ${SOLID_TEXT}`,
|
|
59
|
-
},
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
const SUBTLE_TEXT =
|
|
63
|
-
"text-content-presentation-global-subtle [&>div]:mix-blend-luminosity [&_i]:text-content-presentation-global-subtle [&_i]:mix-blend-luminosity [&>button]:mix-blend-luminosity";
|
|
64
|
-
|
|
65
|
-
const subtleCompoundVariants = [
|
|
66
|
-
{
|
|
67
|
-
badgeStyle: "subtle" as const,
|
|
68
|
-
color: "gray" as const,
|
|
69
|
-
className: `bg-background-presentation-badge-gray-subtle ${SUBTLE_TEXT}`,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
badgeStyle: "subtle" as const,
|
|
73
|
-
color: "slate" as const,
|
|
74
|
-
className: `bg-background-presentation-badge-slate-subtle ${SUBTLE_TEXT}`,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
badgeStyle: "subtle" as const,
|
|
78
|
-
color: "red" as const,
|
|
79
|
-
className: `bg-background-presentation-badge-red-subtle ${SUBTLE_TEXT}`,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
badgeStyle: "subtle" as const,
|
|
83
|
-
color: "orange" as const,
|
|
84
|
-
className: `bg-background-presentation-badge-orange-subtle ${SUBTLE_TEXT}`,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
badgeStyle: "subtle" as const,
|
|
88
|
-
color: "yellow" as const,
|
|
89
|
-
className: `bg-background-presentation-badge-yellow-subtle ${SUBTLE_TEXT}`,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
badgeStyle: "subtle" as const,
|
|
93
|
-
color: "green" as const,
|
|
94
|
-
className: `bg-background-presentation-badge-green-subtle ${SUBTLE_TEXT}`,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
badgeStyle: "subtle" as const,
|
|
98
|
-
color: "ocean" as const,
|
|
99
|
-
className: `bg-background-presentation-badge-ocean-subtle ${SUBTLE_TEXT}`,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
badgeStyle: "subtle" as const,
|
|
103
|
-
color: "blue" as const,
|
|
104
|
-
className: `bg-background-presentation-badge-blue-subtle ${SUBTLE_TEXT}`,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
badgeStyle: "subtle" as const,
|
|
108
|
-
color: "purple" as const,
|
|
109
|
-
className: `bg-background-presentation-badge-purple-subtle ${SUBTLE_TEXT}`,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
badgeStyle: "subtle" as const,
|
|
113
|
-
color: "rose" as const,
|
|
114
|
-
className: `bg-background-presentation-badge-rose-subtle ${SUBTLE_TEXT}`,
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
export const badgeStyles = cva(
|
|
119
|
-
[
|
|
120
|
-
"inline-flex items-center justify-center w-fit",
|
|
121
|
-
// `radius/md` (6px), read off the Badge master component in Figma. Note the badge instances
|
|
122
|
-
// nested inside InnerLabelField render at `radius/lg` — that is an instance override, not the
|
|
123
|
-
// component's own value, and reading it as the spec is how this briefly shipped as 8px.
|
|
124
|
-
"rounded-radius-md",
|
|
125
|
-
"transition-all duration-200 ease-in-out",
|
|
126
|
-
"whitespace-nowrap",
|
|
127
|
-
"[&_i]:!leading-none",
|
|
128
|
-
// The subtle variants blend their label/icon with `mix-blend-luminosity`.
|
|
129
|
-
// `isolate` opens a new stacking context so that blend only composites
|
|
130
|
-
// against the badge's own background — not against arbitrary page layers
|
|
131
|
-
// behind it (semi-transparent rows, gradients, masks), which otherwise
|
|
132
|
-
// ghosts/double-strokes the text in "random" places.
|
|
133
|
-
"isolate",
|
|
134
|
-
],
|
|
135
|
-
{
|
|
136
|
-
variants: {
|
|
137
|
-
badgeStyle: {
|
|
138
|
-
solid: "",
|
|
139
|
-
subtle: "",
|
|
140
|
-
},
|
|
141
|
-
color: {
|
|
142
|
-
gray: "",
|
|
143
|
-
slate: "",
|
|
144
|
-
red: "",
|
|
145
|
-
orange: "",
|
|
146
|
-
yellow: "",
|
|
147
|
-
green: "",
|
|
148
|
-
ocean: "",
|
|
149
|
-
blue: "",
|
|
150
|
-
purple: "",
|
|
151
|
-
rose: "",
|
|
152
|
-
},
|
|
153
|
-
size: {
|
|
154
|
-
XS: "h-[18px] px-[6px] py-0 [&_i]:text-[12px] [&>div]:typography-body-small-medium",
|
|
155
|
-
S: "h-[22px] px-[6px] py-[2px] [&_i]:text-[12px] [&>div]:typography-body-small-medium",
|
|
156
|
-
M: "h-[26px] px-[8px] py-[2px] [&_i]:text-[16px] [&>div]:typography-body-medium-medium",
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
compoundVariants: [...solidCompoundVariants, ...subtleCompoundVariants],
|
|
160
|
-
defaultVariants: {
|
|
161
|
-
badgeStyle: "subtle",
|
|
162
|
-
color: "gray",
|
|
163
|
-
size: "S",
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
interface BadgeProps
|
|
169
|
-
extends Omit<HTMLAttributes<HTMLSpanElement>, "color">, VariantProps<typeof badgeStyles> {
|
|
170
|
-
label?: string;
|
|
171
|
-
badgeIcon?: ReactNode;
|
|
172
|
-
showIcon?: boolean;
|
|
173
|
-
isClosable?: boolean;
|
|
174
|
-
onClose?: () => void;
|
|
175
|
-
theme?: Themes;
|
|
176
|
-
className?: string;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export const Badge: React.FC<BadgeProps> = ({
|
|
180
|
-
label,
|
|
181
|
-
badgeIcon,
|
|
182
|
-
showIcon = true,
|
|
183
|
-
isClosable,
|
|
184
|
-
onClose,
|
|
185
|
-
theme,
|
|
186
|
-
badgeStyle,
|
|
187
|
-
color,
|
|
188
|
-
size,
|
|
189
|
-
className,
|
|
190
|
-
...props
|
|
191
|
-
}) => {
|
|
192
|
-
return (
|
|
193
|
-
<span
|
|
194
|
-
{...props}
|
|
195
|
-
data-theme={theme}
|
|
196
|
-
className={cn(
|
|
197
|
-
badgeStyles({ badgeStyle, color, size }),
|
|
198
|
-
{ "cursor-default": isClosable },
|
|
199
|
-
className,
|
|
200
|
-
)}
|
|
201
|
-
>
|
|
202
|
-
{showIcon && (
|
|
203
|
-
<div className="flex items-center justify-center">
|
|
204
|
-
{badgeIcon ?? <i className="ri-circle-fill !text-[8px]" />}
|
|
205
|
-
</div>
|
|
206
|
-
)}
|
|
207
|
-
|
|
208
|
-
{label && <div className="px-[3px]">{label}</div>}
|
|
209
|
-
|
|
210
|
-
{isClosable && (
|
|
211
|
-
<button
|
|
212
|
-
type="button"
|
|
213
|
-
onClick={onClose}
|
|
214
|
-
onKeyDown={(e) => {
|
|
215
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
216
|
-
e.preventDefault();
|
|
217
|
-
onClose?.();
|
|
218
|
-
}
|
|
219
|
-
}}
|
|
220
|
-
className={cn(
|
|
221
|
-
"rounded-radius-sm",
|
|
222
|
-
"flex items-center justify-center cursor-pointer",
|
|
223
|
-
"hover:bg-background-presentation-action-secondary",
|
|
224
|
-
"transition-colors duration-150",
|
|
225
|
-
size === "M"
|
|
226
|
-
? "w-[16px] h-[16px]"
|
|
227
|
-
: size === "S"
|
|
228
|
-
? "w-[14px] h-[14px]"
|
|
229
|
-
: "w-[12px] h-[12px]",
|
|
230
|
-
)}
|
|
231
|
-
aria-label="Remove badge"
|
|
232
|
-
>
|
|
233
|
-
<svg
|
|
234
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
235
|
-
width="100%"
|
|
236
|
-
height="100%"
|
|
237
|
-
viewBox="0 0 12 12"
|
|
238
|
-
fill="none"
|
|
239
|
-
aria-hidden="true"
|
|
240
|
-
>
|
|
241
|
-
<path
|
|
242
|
-
d="M6.00002 5.33336L8.33334 3L9 3.66667L6.66668 6.00002L9 8.33334L8.33334 9L6.00002 6.66668L3.66667 9L3 8.33334L5.33336 6.00002L3 3.66667L3.66667 3L6.00002 5.33336Z"
|
|
243
|
-
fill="currentColor"
|
|
244
|
-
/>
|
|
245
|
-
</svg>
|
|
246
|
-
</button>
|
|
247
|
-
)}
|
|
248
|
-
</span>
|
|
249
|
-
);
|
|
250
|
-
};
|
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
forwardRef,
|
|
4
|
-
InputHTMLAttributes,
|
|
5
|
-
ReactNode,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
ChangeEvent,
|
|
9
|
-
FocusEvent,
|
|
10
|
-
} from "react";
|
|
11
|
-
import { cn } from "../utils/cn";
|
|
12
|
-
import { ToolTipSide } from "./Tooltip";
|
|
13
|
-
import { Popover, PopoverContent, PopoverTrigger } from "./Popover";
|
|
14
|
-
import { Themes } from "../utils/types";
|
|
15
|
-
import { Icon, Input, Group, Trilling } from "./Input";
|
|
16
|
-
import { useClickOutside } from "../hooks/useClickOutside";
|
|
17
|
-
import { Badge, badgeStyles } from "./Badge";
|
|
18
|
-
import { Tag, useTagSelection } from "../hooks/useTagSelection";
|
|
19
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
20
|
-
|
|
21
|
-
interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "variant"> {
|
|
22
|
-
size?: "XS" | "S" | "M"; // this is used to change the size style of the component
|
|
23
|
-
variant?: "SystemStyle" | "PresentationStyle";
|
|
24
|
-
icon?: ReactNode; // to add left side icon if you pass it
|
|
25
|
-
/** Marks the field invalid: any non-undefined value turns on the negative border. */
|
|
26
|
-
errorMessage?: string;
|
|
27
|
-
onTable?: boolean; // to change the border style of the component when it is on table
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Ignored. The error tooltip was removed — an invalid field is shown by its negative
|
|
30
|
-
* border alone. Kept so existing call sites keep compiling; it will go in a future major.
|
|
31
|
-
*/
|
|
32
|
-
toolTipSide?: ToolTipSide;
|
|
33
|
-
label?: string;
|
|
34
|
-
required?: boolean;
|
|
35
|
-
theme?: Themes;
|
|
36
|
-
actionButton?: ReactNode;
|
|
37
|
-
tags: Tag[];
|
|
38
|
-
onValueChange?: (tags: Tag[]) => void;
|
|
39
|
-
addLabel?: string;
|
|
40
|
-
/**
|
|
41
|
-
* LOCAL PATCH (Contact Center): let the user TYPE a value and have it become a selected badge,
|
|
42
|
-
* rather than only picking from `tags`. Enter or comma commits what is in the box; Backspace on
|
|
43
|
-
* an empty box removes the last badge. This is what makes a free-text list (emails, aliases,
|
|
44
|
-
* tags) expressible as a badge field instead of a one-column table.
|
|
45
|
-
*/
|
|
46
|
-
creatable?: boolean;
|
|
47
|
-
/** Label for the "create this text" row. Receives the typed text. */
|
|
48
|
-
createLabel?: (value: string) => string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const BadgeField = forwardRef<HTMLInputElement, Props>(
|
|
52
|
-
({
|
|
53
|
-
size = "M",
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- excluded from {...props} spread
|
|
55
|
-
label,
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- excluded from {...props} spread
|
|
57
|
-
required,
|
|
58
|
-
icon,
|
|
59
|
-
errorMessage,
|
|
60
|
-
onTable,
|
|
61
|
-
variant = "PresentationStyle",
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- deprecated no-op, destructured to keep it out of the {...props} spread
|
|
63
|
-
toolTipSide,
|
|
64
|
-
className,
|
|
65
|
-
actionButton,
|
|
66
|
-
theme,
|
|
67
|
-
tags,
|
|
68
|
-
addLabel = "add",
|
|
69
|
-
creatable = false,
|
|
70
|
-
createLabel = (value: string) => `Create "${value}"`,
|
|
71
|
-
dir,
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- excluded from {...props} spread
|
|
73
|
-
children,
|
|
74
|
-
onValueChange,
|
|
75
|
-
...props
|
|
76
|
-
}) => {
|
|
77
|
-
const [dropDownListWidth, setDropDownListWidth] = useState(0);
|
|
78
|
-
const popoverContentRef = useRef<HTMLDivElement>(null);
|
|
79
|
-
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
80
|
-
// this is used to close the popover when the user clicks outside the input group
|
|
81
|
-
const inputGroupRef = useClickOutside<HTMLDivElement>((e) => {
|
|
82
|
-
if (
|
|
83
|
-
!inputGroupRef?.current?.contains(e?.target as Node) &&
|
|
84
|
-
!popoverContentRef?.current?.contains(e?.target as Node)
|
|
85
|
-
)
|
|
86
|
-
setIsPopoverOpen(false);
|
|
87
|
-
else setIsPopoverOpen(true);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// this is used to handle the tag selection and the search and filter and keyboard navigation functionality
|
|
91
|
-
const {
|
|
92
|
-
selectedTagsStack,
|
|
93
|
-
handleSelectTag,
|
|
94
|
-
handleUnselectTag,
|
|
95
|
-
handleCreateTag,
|
|
96
|
-
handleKeyDown,
|
|
97
|
-
setFocusedTagIndex,
|
|
98
|
-
filterTagsBySearch,
|
|
99
|
-
filteredTags,
|
|
100
|
-
focusedTagIndex,
|
|
101
|
-
focusedPopoverIndex,
|
|
102
|
-
isPopoverOpen,
|
|
103
|
-
setIsPopoverOpen,
|
|
104
|
-
searchTags,
|
|
105
|
-
} = useTagSelection({
|
|
106
|
-
Tags: tags,
|
|
107
|
-
creatable,
|
|
108
|
-
onTagsChange: (e) => {
|
|
109
|
-
// Native onChange keeps the event-shaped API (Tag[] in target.value)
|
|
110
|
-
// for react-hook-form / Controller; onValueChange is the typed, direct
|
|
111
|
-
// callback consumers and the docs use.
|
|
112
|
-
props.onChange?.({
|
|
113
|
-
target: {
|
|
114
|
-
value: e,
|
|
115
|
-
},
|
|
116
|
-
} as unknown as ChangeEvent<HTMLInputElement>);
|
|
117
|
-
onValueChange?.(e);
|
|
118
|
-
},
|
|
119
|
-
inputRef,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// LOCAL PATCH (Contact Center): offer the typed text as a new badge, unless it already exists
|
|
123
|
-
// (selected or listed) — in which case the normal rows already cover it.
|
|
124
|
-
const typedValue = searchTags.trim();
|
|
125
|
-
const alreadyExists = [...selectedTagsStack, ...filteredTags].some(
|
|
126
|
-
(tag) => tag.name.toLowerCase() === typedValue.toLowerCase(),
|
|
127
|
-
);
|
|
128
|
-
const showCreateRow = creatable && typedValue !== "" && !alreadyExists;
|
|
129
|
-
|
|
130
|
-
return (
|
|
131
|
-
<Popover open={isPopoverOpen}>
|
|
132
|
-
<PopoverTrigger asChild>
|
|
133
|
-
<Group
|
|
134
|
-
dir={dir}
|
|
135
|
-
error={errorMessage !== undefined}
|
|
136
|
-
onTable={onTable}
|
|
137
|
-
data-theme={theme}
|
|
138
|
-
variant={variant}
|
|
139
|
-
tabIndex={isPopoverOpen ? 0 : -1}
|
|
140
|
-
onKeyDown={handleKeyDown}
|
|
141
|
-
size={size === "XS" ? "S" : size}
|
|
142
|
-
ref={inputGroupRef}
|
|
143
|
-
onFocus={(e: FocusEvent<HTMLDivElement>) => {
|
|
144
|
-
setDropDownListWidth(e.currentTarget.offsetWidth);
|
|
145
|
-
}}
|
|
146
|
-
className={cn(
|
|
147
|
-
"flex gap-1 flex-row w-full relative p-1 flex-nowrap overflow-hidden justify-end items-center",
|
|
148
|
-
{
|
|
149
|
-
"flex-wrap justify-start": isPopoverOpen,
|
|
150
|
-
"h-fit": isPopoverOpen,
|
|
151
|
-
},
|
|
152
|
-
className,
|
|
153
|
-
)}
|
|
154
|
-
>
|
|
155
|
-
{icon && <Icon>{icon}</Icon>}
|
|
156
|
-
|
|
157
|
-
{selectedTagsStack.map((tag, index) => (
|
|
158
|
-
<Badge
|
|
159
|
-
key={tag.id}
|
|
160
|
-
size={size}
|
|
161
|
-
color={tag.variant as VariantProps<typeof badgeStyles>["color"]}
|
|
162
|
-
label={tag.name}
|
|
163
|
-
isClosable={true}
|
|
164
|
-
onClose={() => handleUnselectTag(tag.id)}
|
|
165
|
-
className={focusedTagIndex === index ? "ring-2 ring-blue-500" : ""}
|
|
166
|
-
tabIndex={focusedTagIndex === index ? 0 : -1}
|
|
167
|
-
/>
|
|
168
|
-
))}
|
|
169
|
-
|
|
170
|
-
<Input
|
|
171
|
-
{...props}
|
|
172
|
-
value={searchTags}
|
|
173
|
-
onChange={(e) => {
|
|
174
|
-
filterTagsBySearch(e.target.value);
|
|
175
|
-
}}
|
|
176
|
-
// LOCAL PATCH (Contact Center): commit typed text as a badge. Handled here rather
|
|
177
|
-
// than in the Group's `handleKeyDown` because that one only ever navigates the
|
|
178
|
-
// existing list — and because `preventDefault` on Enter has to stop the surrounding
|
|
179
|
-
// `<form>` submitting before the badge is added.
|
|
180
|
-
onKeyDown={(e) => {
|
|
181
|
-
if (!creatable) return;
|
|
182
|
-
if (e.key === "Enter" || e.key === ",") {
|
|
183
|
-
// Let Enter pick the highlighted row when the user is arrowing the list.
|
|
184
|
-
if (e.key === "Enter" && focusedPopoverIndex !== null) return;
|
|
185
|
-
if (!searchTags.trim()) return;
|
|
186
|
-
e.preventDefault();
|
|
187
|
-
e.stopPropagation();
|
|
188
|
-
handleCreateTag(searchTags);
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
if (e.key === "Backspace" && searchTags === "" && selectedTagsStack.length > 0) {
|
|
192
|
-
e.preventDefault();
|
|
193
|
-
handleUnselectTag(selectedTagsStack[selectedTagsStack.length - 1].id);
|
|
194
|
-
}
|
|
195
|
-
}}
|
|
196
|
-
onFocus={(e) => {
|
|
197
|
-
props.onFocus?.(e);
|
|
198
|
-
setFocusedTagIndex(null);
|
|
199
|
-
setIsPopoverOpen(true);
|
|
200
|
-
}}
|
|
201
|
-
ref={inputRef}
|
|
202
|
-
className={cn(
|
|
203
|
-
"min-w-[100px] w-full", // Added w-full to Input
|
|
204
|
-
{
|
|
205
|
-
"!h-[18px]": size === "XS",
|
|
206
|
-
"!h-[22px]": size === "S",
|
|
207
|
-
"!h-[24px]": size === "M",
|
|
208
|
-
},
|
|
209
|
-
)}
|
|
210
|
-
/>
|
|
211
|
-
{actionButton && (
|
|
212
|
-
<Trilling className="py-0">
|
|
213
|
-
{/* Keep the ActionButton right aligned */}
|
|
214
|
-
{actionButton}
|
|
215
|
-
</Trilling>
|
|
216
|
-
)}
|
|
217
|
-
</Group>
|
|
218
|
-
</PopoverTrigger>
|
|
219
|
-
|
|
220
|
-
<PopoverContent
|
|
221
|
-
dir={dir}
|
|
222
|
-
data-theme={theme}
|
|
223
|
-
ref={popoverContentRef}
|
|
224
|
-
style={{ width: dropDownListWidth }}
|
|
225
|
-
variant={variant}
|
|
226
|
-
onKeyDown={handleKeyDown}
|
|
227
|
-
className={cn(
|
|
228
|
-
menuContentContinerStyles({ variant: "PresentationStyle" }),
|
|
229
|
-
"p-1 rounded-[17px]",
|
|
230
|
-
)}
|
|
231
|
-
|
|
232
|
-
// Reuse the DropdownMenu surface so the list matches the menu design.
|
|
233
|
-
>
|
|
234
|
-
<div className={cn(menuContentStyles({ variant: "PresentationStyle" }), "p-0")}>
|
|
235
|
-
{/* LOCAL PATCH (Contact Center): the create-from-typed-text row. */}
|
|
236
|
-
{showCreateRow && (
|
|
237
|
-
<button
|
|
238
|
-
type="button"
|
|
239
|
-
onClick={() => handleCreateTag(searchTags)}
|
|
240
|
-
className={cn(
|
|
241
|
-
MenuItemStyles({ variant: "Default", size: "M" }),
|
|
242
|
-
"w-full p-1 shrink-0 h-fit",
|
|
243
|
-
)}
|
|
244
|
-
>
|
|
245
|
-
<div className="flex items-center gap-1 w-full">
|
|
246
|
-
<i className="ri-add-line text-[14px]" />
|
|
247
|
-
<span className="truncate">{createLabel(typedValue)}</span>
|
|
248
|
-
</div>
|
|
249
|
-
</button>
|
|
250
|
-
)}
|
|
251
|
-
{filteredTags.length > 0 ? (
|
|
252
|
-
filteredTags.map((tag, index) => (
|
|
253
|
-
<button
|
|
254
|
-
type="button"
|
|
255
|
-
key={tag.id}
|
|
256
|
-
onClick={() => handleSelectTag(tag.id)}
|
|
257
|
-
data-highlighted={focusedPopoverIndex === index ? "" : undefined}
|
|
258
|
-
tabIndex={focusedPopoverIndex === index ? 0 : -1}
|
|
259
|
-
className={cn(
|
|
260
|
-
MenuItemStyles({ variant: "Default", size: "M" }),
|
|
261
|
-
"w-full p-1 shrink-0 h-fit",
|
|
262
|
-
)}
|
|
263
|
-
>
|
|
264
|
-
<div className="flex items-center justify-between w-full">
|
|
265
|
-
<Badge
|
|
266
|
-
size={size}
|
|
267
|
-
badgeStyle={"solid"}
|
|
268
|
-
color={tag.variant as VariantProps<typeof badgeStyles>["color"]}
|
|
269
|
-
label={tag.name}
|
|
270
|
-
/>
|
|
271
|
-
|
|
272
|
-
<div className="flex group-hover:opacity-100 opacity-0 px-[4px] py-[2px] items-center rounded-[6px] bg-white-50">
|
|
273
|
-
<svg
|
|
274
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
275
|
-
width="12"
|
|
276
|
-
height="12"
|
|
277
|
-
viewBox="0 0 12 12"
|
|
278
|
-
className="rtl:rotate-180"
|
|
279
|
-
fill="none"
|
|
280
|
-
>
|
|
281
|
-
<path
|
|
282
|
-
d="M3.91422 5.49995H10V6.49995H3.91422L6.5962 9.1819L5.8891 9.889L2 5.99995L5.8891 2.11084L6.5962 2.81794L3.91422 5.49995Z"
|
|
283
|
-
fill="black"
|
|
284
|
-
/>
|
|
285
|
-
</svg>
|
|
286
|
-
<p className="text-black-1000 text-end text-[12px] font-[510] leading-[148%]">
|
|
287
|
-
{addLabel}
|
|
288
|
-
</p>
|
|
289
|
-
</div>
|
|
290
|
-
</div>
|
|
291
|
-
</button>
|
|
292
|
-
))
|
|
293
|
-
) : (
|
|
294
|
-
// The create row already tells the user what will happen, so don't also say
|
|
295
|
-
// "no matching tags found" underneath it.
|
|
296
|
-
!showCreateRow && (
|
|
297
|
-
<div className="px-3 py-2 typography-body-small-regular text-white-alpha-75">
|
|
298
|
-
{creatable
|
|
299
|
-
? "Type a value and press Enter"
|
|
300
|
-
: tags.length === 0
|
|
301
|
-
? "All tags selected"
|
|
302
|
-
: "No matching tags found"}
|
|
303
|
-
</div>
|
|
304
|
-
)
|
|
305
|
-
)}{" "}
|
|
306
|
-
</div>
|
|
307
|
-
</PopoverContent>
|
|
308
|
-
</Popover>
|
|
309
|
-
);
|
|
310
|
-
},
|
|
311
|
-
);
|
|
312
|
-
BadgeField.displayName = "BadgeField";
|
|
313
|
-
|
|
314
|
-
// Local copies of the menu surface styles so the dropdown list matches the
|
|
315
|
-
// DropdownMenu/ContextMenu design (self-contained — no shared module).
|
|
316
|
-
const menuContentStyles = cva(
|
|
317
|
-
[
|
|
318
|
-
"rounded-[10px]",
|
|
319
|
-
"min-w-[240px]",
|
|
320
|
-
"outline-none",
|
|
321
|
-
"overflow-scroll",
|
|
322
|
-
"data-[state=open]:animate-in",
|
|
323
|
-
"data-[state=open]:fade-in-0",
|
|
324
|
-
"overflow-x-hidden",
|
|
325
|
-
"scrollbar-hide",
|
|
326
|
-
"flex gap-[1px] flex-col",
|
|
327
|
-
],
|
|
328
|
-
{
|
|
329
|
-
variants: {
|
|
330
|
-
variant: {
|
|
331
|
-
PresentationStyle: [],
|
|
332
|
-
},
|
|
333
|
-
defaultVariants: {
|
|
334
|
-
variant: "PresentationStyle",
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
);
|
|
339
|
-
const menuContentContinerStyles = cva(
|
|
340
|
-
[
|
|
341
|
-
"rounded-[14px]",
|
|
342
|
-
"min-w-[240px]",
|
|
343
|
-
"outline-none",
|
|
344
|
-
"overflow-scroll",
|
|
345
|
-
"data-[state=open]:animate-in",
|
|
346
|
-
"data-[state=open]:fade-in-0",
|
|
347
|
-
"overflow-x-hidden",
|
|
348
|
-
"scrollbar-hide",
|
|
349
|
-
"backdrop-blur-[21px]",
|
|
350
|
-
"flex gap-1 flex-col",
|
|
351
|
-
],
|
|
352
|
-
{
|
|
353
|
-
variants: {
|
|
354
|
-
variant: {
|
|
355
|
-
PresentationStyle: [
|
|
356
|
-
"bg-[rgba(61,64,69,0.72)]",
|
|
357
|
-
"shadow-[0_0_32px_2px_rgba(0,0,0,0.20),0_0_48px_2px_rgba(0,0,0,0.05)]",
|
|
358
|
-
],
|
|
359
|
-
},
|
|
360
|
-
defaultVariants: {
|
|
361
|
-
variant: "PresentationStyle",
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
|
-
},
|
|
365
|
-
);
|
|
366
|
-
|
|
367
|
-
const MenuItemStyles = cva(
|
|
368
|
-
[
|
|
369
|
-
"text-content-presentation-global-primary-light typography-body-medium-regular",
|
|
370
|
-
"outline-none",
|
|
371
|
-
"border",
|
|
372
|
-
"border-transparent",
|
|
373
|
-
"flex",
|
|
374
|
-
"items-center",
|
|
375
|
-
"justify-start",
|
|
376
|
-
"text-overflow",
|
|
377
|
-
"overflow-hidden",
|
|
378
|
-
"transition-all",
|
|
379
|
-
"bg-[rgba(184,192,204,0.36)]",
|
|
380
|
-
"ease-in-out",
|
|
381
|
-
"duration-300",
|
|
382
|
-
"flex",
|
|
383
|
-
"p-1",
|
|
384
|
-
"w-full",
|
|
385
|
-
"items-center ",
|
|
386
|
-
"group",
|
|
387
|
-
],
|
|
388
|
-
{
|
|
389
|
-
variants: {
|
|
390
|
-
variant: {
|
|
391
|
-
Default: ["hover:bg-[rgba(184,192,204,0.50)] "],
|
|
392
|
-
},
|
|
393
|
-
size: {
|
|
394
|
-
S: ["typography-body-small-regular", "h-[24px]"],
|
|
395
|
-
M: ["typography-body-medium-regular", "h-[32px]"],
|
|
396
|
-
},
|
|
397
|
-
defaultVariants: {
|
|
398
|
-
variant: "Default",
|
|
399
|
-
size: "M",
|
|
400
|
-
},
|
|
401
|
-
},
|
|
402
|
-
},
|
|
403
|
-
);
|