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,721 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: TransparentLabel
|
|
3
|
-
description: Text label with gradient fade-out effect and comprehensive typography size options
|
|
4
|
-
group: Labels & Text
|
|
5
|
-
keywords: [transparent-label, text, typography, gradient, fade, truncate]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# TransparentLabel
|
|
9
|
-
|
|
10
|
-
> A specialized text label component with a built-in gradient fade-out effect (mask-image) that creates a smooth transition to transparency at the end. Supports all typography variants from display to labels with extensive customization.
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
15
|
-
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx torch-glare@latest init
|
|
19
|
-
npx torch-glare@latest add TransparentLabel
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
`add` also copies any components, hooks, and utilities that `TransparentLabel` depends on.
|
|
23
|
-
|
|
24
|
-
## Import
|
|
25
|
-
|
|
26
|
-
Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
|
|
27
|
-
|
|
28
|
-
```tsx
|
|
29
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Quick Examples
|
|
33
|
-
|
|
34
|
-
### Basic Usage
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
38
|
-
|
|
39
|
-
function Example() {
|
|
40
|
-
return (
|
|
41
|
-
<TransparentLabel>
|
|
42
|
-
This text will fade out at the end with a gradient effect
|
|
43
|
-
</TransparentLabel>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Different Sizes
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
52
|
-
|
|
53
|
-
function Sizes() {
|
|
54
|
-
return (
|
|
55
|
-
<div className="space-y-2">
|
|
56
|
-
<TransparentLabel size="display-large-bold">
|
|
57
|
-
Large Display Text
|
|
58
|
-
</TransparentLabel>
|
|
59
|
-
|
|
60
|
-
<TransparentLabel size="headers-medium-semibold">
|
|
61
|
-
Medium Header
|
|
62
|
-
</TransparentLabel>
|
|
63
|
-
|
|
64
|
-
<TransparentLabel size="body-medium-regular">
|
|
65
|
-
Regular Body Text
|
|
66
|
-
</TransparentLabel>
|
|
67
|
-
|
|
68
|
-
<TransparentLabel size="labels-small-regular">
|
|
69
|
-
Small Label
|
|
70
|
-
</TransparentLabel>
|
|
71
|
-
</div>
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Truncating Long Text
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
80
|
-
|
|
81
|
-
function TruncatedText() {
|
|
82
|
-
const longText = "This is a very long text that needs to be truncated gracefully with a fade-out effect instead of showing ellipsis or cutting off abruptly"
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div className="w-64">
|
|
86
|
-
<TransparentLabel size="body-medium-regular">
|
|
87
|
-
{longText}
|
|
88
|
-
</TransparentLabel>
|
|
89
|
-
</div>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Typography Variants
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
98
|
-
|
|
99
|
-
function TypographyShowcase() {
|
|
100
|
-
return (
|
|
101
|
-
<div className="space-y-4">
|
|
102
|
-
<div>
|
|
103
|
-
<p className="text-sm text-gray-500 mb-1">Display Large Bold</p>
|
|
104
|
-
<TransparentLabel size="display-large-bold">
|
|
105
|
-
Welcome to Torch
|
|
106
|
-
</TransparentLabel>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
<div>
|
|
110
|
-
<p className="text-sm text-gray-500 mb-1">Headers Medium Semibold</p>
|
|
111
|
-
<TransparentLabel size="headers-medium-semibold">
|
|
112
|
-
Section Header
|
|
113
|
-
</TransparentLabel>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<div>
|
|
117
|
-
<p className="text-sm text-gray-500 mb-1">Body Large Regular</p>
|
|
118
|
-
<TransparentLabel size="body-large-regular">
|
|
119
|
-
This is body text with a fade-out effect
|
|
120
|
-
</TransparentLabel>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<div>
|
|
124
|
-
<p className="text-sm text-gray-500 mb-1">Labels Medium Medium</p>
|
|
125
|
-
<TransparentLabel size="labels-medium-medium">
|
|
126
|
-
Field Label
|
|
127
|
-
</TransparentLabel>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Card with Fade Effect
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
138
|
-
import { Card } from "@/components/Card";
|
|
139
|
-
|
|
140
|
-
function ProductCard() {
|
|
141
|
-
return (
|
|
142
|
-
<Card className="p-4 w-64">
|
|
143
|
-
<img
|
|
144
|
-
src="/product.jpg"
|
|
145
|
-
alt="Product"
|
|
146
|
-
className="w-full h-32 object-cover rounded mb-2"
|
|
147
|
-
/>
|
|
148
|
-
<TransparentLabel size="headers-small-bold">
|
|
149
|
-
Premium Wireless Headphones with Active Noise Cancellation
|
|
150
|
-
</TransparentLabel>
|
|
151
|
-
<p className="text-sm text-gray-500 mt-2">$299.99</p>
|
|
152
|
-
</Card>
|
|
153
|
-
)
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### List with Truncated Items
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
161
|
-
|
|
162
|
-
function TruncatedList() {
|
|
163
|
-
const items = [
|
|
164
|
-
"Short item",
|
|
165
|
-
"This is a medium length item that fits",
|
|
166
|
-
"This is a very long item that will definitely need truncation with the fade effect to look good",
|
|
167
|
-
"Another item",
|
|
168
|
-
]
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<div className="w-64 space-y-2">
|
|
172
|
-
{items.map((item, index) => (
|
|
173
|
-
<div key={index} className="p-2 bg-gray-50 rounded">
|
|
174
|
-
<TransparentLabel size="body-medium-regular">
|
|
175
|
-
{item}
|
|
176
|
-
</TransparentLabel>
|
|
177
|
-
</div>
|
|
178
|
-
))}
|
|
179
|
-
</div>
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Navigation with Fade
|
|
185
|
-
|
|
186
|
-
```typescript
|
|
187
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
188
|
-
|
|
189
|
-
function Navigation() {
|
|
190
|
-
const navItems = [
|
|
191
|
-
{ label: "Dashboard", icon: "ri-dashboard-line" },
|
|
192
|
-
{ label: "Analytics and Reporting", icon: "ri-bar-chart-line" },
|
|
193
|
-
{ label: "User Management System", icon: "ri-user-line" },
|
|
194
|
-
{ label: "Settings", icon: "ri-settings-line" },
|
|
195
|
-
]
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<nav className="w-48 space-y-1">
|
|
199
|
-
{navItems.map((item) => (
|
|
200
|
-
<a
|
|
201
|
-
key={item.label}
|
|
202
|
-
href="#"
|
|
203
|
-
className="flex items-center gap-2 p-2 hover:bg-gray-100 rounded"
|
|
204
|
-
>
|
|
205
|
-
<i className={item.icon} />
|
|
206
|
-
<TransparentLabel size="body-medium-regular">
|
|
207
|
-
{item.label}
|
|
208
|
-
</TransparentLabel>
|
|
209
|
-
</a>
|
|
210
|
-
))}
|
|
211
|
-
</nav>
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Breadcrumbs
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
220
|
-
|
|
221
|
-
function Breadcrumbs() {
|
|
222
|
-
const crumbs = [
|
|
223
|
-
"Home",
|
|
224
|
-
"Products",
|
|
225
|
-
"Electronics",
|
|
226
|
-
"Computers and Laptops",
|
|
227
|
-
"Gaming Laptops",
|
|
228
|
-
"High Performance Gaming Laptops"
|
|
229
|
-
]
|
|
230
|
-
|
|
231
|
-
return (
|
|
232
|
-
<div className="flex items-center gap-2 max-w-lg">
|
|
233
|
-
{crumbs.map((crumb, index) => (
|
|
234
|
-
<div key={index} className="flex items-center gap-2">
|
|
235
|
-
{index > 0 && <span>/</span>}
|
|
236
|
-
<TransparentLabel
|
|
237
|
-
size="labels-medium-regular"
|
|
238
|
-
className={index === crumbs.length - 1 ? 'font-semibold' : ''}
|
|
239
|
-
>
|
|
240
|
-
{crumb}
|
|
241
|
-
</TransparentLabel>
|
|
242
|
-
</div>
|
|
243
|
-
))}
|
|
244
|
-
</div>
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### Table Cell with Fade
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
253
|
-
|
|
254
|
-
function DataTable() {
|
|
255
|
-
const data = [
|
|
256
|
-
{ name: "Alice Johnson", email: "alice.johnson@verylongdomain.com", role: "Administrator" },
|
|
257
|
-
{ name: "Bob Smith", email: "bob.smith@company.com", role: "Editor" },
|
|
258
|
-
{ name: "Carol Williams with a very long name", email: "carol@email.com", role: "Viewer" },
|
|
259
|
-
]
|
|
260
|
-
|
|
261
|
-
return (
|
|
262
|
-
<table className="w-full">
|
|
263
|
-
<thead>
|
|
264
|
-
<tr className="border-b">
|
|
265
|
-
<th className="text-left p-2">Name</th>
|
|
266
|
-
<th className="text-left p-2">Email</th>
|
|
267
|
-
<th className="text-left p-2">Role</th>
|
|
268
|
-
</tr>
|
|
269
|
-
</thead>
|
|
270
|
-
<tbody>
|
|
271
|
-
{data.map((row, index) => (
|
|
272
|
-
<tr key={index} className="border-b">
|
|
273
|
-
<td className="p-2">
|
|
274
|
-
<TransparentLabel size="body-medium-regular">
|
|
275
|
-
{row.name}
|
|
276
|
-
</TransparentLabel>
|
|
277
|
-
</td>
|
|
278
|
-
<td className="p-2">
|
|
279
|
-
<TransparentLabel size="body-medium-regular">
|
|
280
|
-
{row.email}
|
|
281
|
-
</TransparentLabel>
|
|
282
|
-
</td>
|
|
283
|
-
<td className="p-2">
|
|
284
|
-
<TransparentLabel size="labels-medium-regular">
|
|
285
|
-
{row.role}
|
|
286
|
-
</TransparentLabel>
|
|
287
|
-
</td>
|
|
288
|
-
</tr>
|
|
289
|
-
))}
|
|
290
|
-
</tbody>
|
|
291
|
-
</table>
|
|
292
|
-
)
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### Custom Color with Fade
|
|
297
|
-
|
|
298
|
-
```typescript
|
|
299
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
300
|
-
|
|
301
|
-
function ColoredLabels() {
|
|
302
|
-
return (
|
|
303
|
-
<div className="space-y-2">
|
|
304
|
-
<TransparentLabel
|
|
305
|
-
size="body-medium-semibold"
|
|
306
|
-
className="text-blue-600"
|
|
307
|
-
>
|
|
308
|
-
This is a blue label with fade effect
|
|
309
|
-
</TransparentLabel>
|
|
310
|
-
|
|
311
|
-
<TransparentLabel
|
|
312
|
-
size="body-medium-semibold"
|
|
313
|
-
className="text-green-600"
|
|
314
|
-
>
|
|
315
|
-
This is a green label with fade effect
|
|
316
|
-
</TransparentLabel>
|
|
317
|
-
|
|
318
|
-
<TransparentLabel
|
|
319
|
-
size="body-medium-semibold"
|
|
320
|
-
className="text-red-600"
|
|
321
|
-
>
|
|
322
|
-
This is a red label with fade effect
|
|
323
|
-
</TransparentLabel>
|
|
324
|
-
</div>
|
|
325
|
-
)
|
|
326
|
-
}
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### RTL Support
|
|
330
|
-
|
|
331
|
-
```typescript
|
|
332
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
333
|
-
|
|
334
|
-
function RTLExample() {
|
|
335
|
-
return (
|
|
336
|
-
<div dir="rtl" className="space-y-2">
|
|
337
|
-
<TransparentLabel size="body-medium-regular">
|
|
338
|
-
هذا نص باللغة العربية سيتلاشى في النهاية
|
|
339
|
-
</TransparentLabel>
|
|
340
|
-
|
|
341
|
-
<TransparentLabel size="headers-medium-bold">
|
|
342
|
-
عنوان باللغة العربية
|
|
343
|
-
</TransparentLabel>
|
|
344
|
-
</div>
|
|
345
|
-
)
|
|
346
|
-
}
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
## API Reference
|
|
350
|
-
|
|
351
|
-
### TransparentLabel Props
|
|
352
|
-
|
|
353
|
-
Extends all standard HTML paragraph attributes.
|
|
354
|
-
|
|
355
|
-
| Prop | Type | Default | Description |
|
|
356
|
-
|------|------|---------|-------------|
|
|
357
|
-
| `size` | `TypographySize` | `'body-medium-regular'` | Typography variant |
|
|
358
|
-
| `className` | `string` | - | Additional CSS classes |
|
|
359
|
-
| `children` | `ReactNode` | - | Text content |
|
|
360
|
-
| ...HTMLParagraphElement | - | - | All paragraph attributes |
|
|
361
|
-
|
|
362
|
-
### Typography Sizes
|
|
363
|
-
|
|
364
|
-
The component supports all typography sizes from the design system:
|
|
365
|
-
|
|
366
|
-
#### Display Sizes
|
|
367
|
-
- `display-large-bold`
|
|
368
|
-
- `display-large-semibold`
|
|
369
|
-
- `display-large-medium`
|
|
370
|
-
- `display-large-regular`
|
|
371
|
-
- `display-medium-bold`
|
|
372
|
-
- `display-medium-semibold`
|
|
373
|
-
- `display-medium-medium`
|
|
374
|
-
- `display-medium-regular`
|
|
375
|
-
- `display-small-bold`
|
|
376
|
-
- `display-small-semibold`
|
|
377
|
-
- `display-small-medium`
|
|
378
|
-
- `display-small-regular`
|
|
379
|
-
|
|
380
|
-
#### Header Sizes
|
|
381
|
-
- `headers-large-bold`
|
|
382
|
-
- `headers-large-semibold`
|
|
383
|
-
- `headers-large-medium`
|
|
384
|
-
- `headers-large-regular`
|
|
385
|
-
- `headers-medium-bold`
|
|
386
|
-
- `headers-medium-semibold`
|
|
387
|
-
- `headers-medium-medium`
|
|
388
|
-
- `headers-medium-regular`
|
|
389
|
-
- `headers-small-bold`
|
|
390
|
-
- `headers-small-semibold`
|
|
391
|
-
- `headers-small-medium`
|
|
392
|
-
- `headers-small-regular`
|
|
393
|
-
|
|
394
|
-
#### Body Sizes
|
|
395
|
-
- `body-large-bold`
|
|
396
|
-
- `body-large-semibold`
|
|
397
|
-
- `body-large-medium`
|
|
398
|
-
- `body-large-regular`
|
|
399
|
-
- `body-medium-bold`
|
|
400
|
-
- `body-medium-semibold`
|
|
401
|
-
- `body-medium-medium`
|
|
402
|
-
- `body-medium-regular`
|
|
403
|
-
- `body-small-bold`
|
|
404
|
-
- `body-small-semibold`
|
|
405
|
-
- `body-small-medium`
|
|
406
|
-
- `body-small-regular`
|
|
407
|
-
|
|
408
|
-
#### Label Sizes
|
|
409
|
-
- `labels-large-bold`
|
|
410
|
-
- `labels-large-semibold`
|
|
411
|
-
- `labels-large-medium`
|
|
412
|
-
- `labels-large-regular`
|
|
413
|
-
- `labels-medium-bold`
|
|
414
|
-
- `labels-medium-semibold`
|
|
415
|
-
- `labels-medium-medium`
|
|
416
|
-
- `labels-medium-regular`
|
|
417
|
-
- `labels-small-bold`
|
|
418
|
-
- `labels-small-semibold`
|
|
419
|
-
- `labels-small-medium`
|
|
420
|
-
- `labels-small-regular`
|
|
421
|
-
|
|
422
|
-
### Gradient Fade Details
|
|
423
|
-
|
|
424
|
-
The component uses CSS mask-image to create the fade effect:
|
|
425
|
-
- **LTR**: Fades from 85% to 100% on the right
|
|
426
|
-
- **RTL**: Fades from 85% to 100% on the left
|
|
427
|
-
- **Gradient**: `linear-gradient(to right, black 0%, black 85%, transparent 100%)`
|
|
428
|
-
|
|
429
|
-
## TypeScript
|
|
430
|
-
|
|
431
|
-
### Full Type Definitions
|
|
432
|
-
|
|
433
|
-
```typescript
|
|
434
|
-
import { HTMLAttributes } from 'react'
|
|
435
|
-
import { VariantProps } from 'class-variance-authority'
|
|
436
|
-
|
|
437
|
-
type TypographySize =
|
|
438
|
-
| 'display-large-bold' | 'display-large-semibold' | 'display-large-medium' | 'display-large-regular'
|
|
439
|
-
| 'display-medium-bold' | 'display-medium-semibold' | 'display-medium-medium' | 'display-medium-regular'
|
|
440
|
-
| 'display-small-bold' | 'display-small-semibold' | 'display-small-medium' | 'display-small-regular'
|
|
441
|
-
| 'headers-large-bold' | 'headers-large-semibold' | 'headers-large-medium' | 'headers-large-regular'
|
|
442
|
-
| 'headers-medium-bold' | 'headers-medium-semibold' | 'headers-medium-medium' | 'headers-medium-regular'
|
|
443
|
-
| 'headers-small-bold' | 'headers-small-semibold' | 'headers-small-medium' | 'headers-small-regular'
|
|
444
|
-
| 'body-large-bold' | 'body-large-semibold' | 'body-large-medium' | 'body-large-regular'
|
|
445
|
-
| 'body-medium-bold' | 'body-medium-semibold' | 'body-medium-medium' | 'body-medium-regular'
|
|
446
|
-
| 'body-small-bold' | 'body-small-semibold' | 'body-small-medium' | 'body-small-regular'
|
|
447
|
-
| 'labels-large-bold' | 'labels-large-semibold' | 'labels-large-medium' | 'labels-large-regular'
|
|
448
|
-
| 'labels-medium-bold' | 'labels-medium-semibold' | 'labels-medium-medium' | 'labels-medium-regular'
|
|
449
|
-
| 'labels-small-bold' | 'labels-small-semibold' | 'labels-small-medium' | 'labels-small-regular'
|
|
450
|
-
|
|
451
|
-
interface TransparentLabelProps
|
|
452
|
-
extends HTMLAttributes<HTMLParagraphElement>,
|
|
453
|
-
VariantProps<typeof TransparentLabelStyles> {
|
|
454
|
-
size?: TypographySize
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
export const TransparentLabel: React.FC<TransparentLabelProps>
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
### Usage with Types
|
|
461
|
-
|
|
462
|
-
```typescript
|
|
463
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
464
|
-
import { useState } from 'react'
|
|
465
|
-
|
|
466
|
-
type Size = 'body-medium-regular' | 'body-large-bold' | 'headers-medium-semibold'
|
|
467
|
-
|
|
468
|
-
function TypedExample() {
|
|
469
|
-
const [size, setSize] = useState<Size>('body-medium-regular')
|
|
470
|
-
|
|
471
|
-
return (
|
|
472
|
-
<div>
|
|
473
|
-
<TransparentLabel size={size}>
|
|
474
|
-
This text uses typed size prop
|
|
475
|
-
</TransparentLabel>
|
|
476
|
-
|
|
477
|
-
<select
|
|
478
|
-
value={size}
|
|
479
|
-
onChange={(e) => setSize(e.target.value as Size)}
|
|
480
|
-
>
|
|
481
|
-
<option value="body-medium-regular">Body Regular</option>
|
|
482
|
-
<option value="body-large-bold">Body Bold</option>
|
|
483
|
-
<option value="headers-medium-semibold">Header</option>
|
|
484
|
-
</select>
|
|
485
|
-
</div>
|
|
486
|
-
)
|
|
487
|
-
}
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
## Common Patterns
|
|
491
|
-
|
|
492
|
-
### Truncated Text Component
|
|
493
|
-
|
|
494
|
-
```typescript
|
|
495
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
496
|
-
import { useState } from 'react'
|
|
497
|
-
|
|
498
|
-
interface TruncatedTextProps {
|
|
499
|
-
text: string
|
|
500
|
-
maxWidth?: string
|
|
501
|
-
size?: ComponentProps<typeof TransparentLabel>['size']
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
function TruncatedText({ text, maxWidth = '200px', size = 'body-medium-regular' }: TruncatedTextProps) {
|
|
505
|
-
const [showFull, setShowFull] = useState(false)
|
|
506
|
-
|
|
507
|
-
return (
|
|
508
|
-
<div>
|
|
509
|
-
<div style={{ maxWidth }} className={showFull ? '' : 'overflow-hidden'}>
|
|
510
|
-
<TransparentLabel size={size}>
|
|
511
|
-
{text}
|
|
512
|
-
</TransparentLabel>
|
|
513
|
-
</div>
|
|
514
|
-
{text.length > 50 && (
|
|
515
|
-
<button
|
|
516
|
-
onClick={() => setShowFull(!showFull)}
|
|
517
|
-
className="text-sm text-blue-600 mt-1"
|
|
518
|
-
>
|
|
519
|
-
{showFull ? 'Show less' : 'Show more'}
|
|
520
|
-
</button>
|
|
521
|
-
)}
|
|
522
|
-
</div>
|
|
523
|
-
)
|
|
524
|
-
}
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
### Responsive Typography
|
|
528
|
-
|
|
529
|
-
```typescript
|
|
530
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
531
|
-
import { useMediaQuery } from '@/hooks/useMediaQuery'
|
|
532
|
-
|
|
533
|
-
function ResponsiveText() {
|
|
534
|
-
const isMobile = useMediaQuery('(max-width: 768px)')
|
|
535
|
-
|
|
536
|
-
return (
|
|
537
|
-
<TransparentLabel
|
|
538
|
-
size={isMobile ? 'body-medium-regular' : 'body-large-regular'}
|
|
539
|
-
>
|
|
540
|
-
This text adjusts size based on screen width
|
|
541
|
-
</TransparentLabel>
|
|
542
|
-
)
|
|
543
|
-
}
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
## Testing
|
|
547
|
-
|
|
548
|
-
### Unit Test Examples
|
|
549
|
-
|
|
550
|
-
```typescript
|
|
551
|
-
import { render, screen } from '@testing-library/react'
|
|
552
|
-
import { TransparentLabel } from "@/components/TransparentLabel";
|
|
553
|
-
|
|
554
|
-
describe('TransparentLabel', () => {
|
|
555
|
-
it('renders text content', () => {
|
|
556
|
-
render(<TransparentLabel>Test Text</TransparentLabel>)
|
|
557
|
-
|
|
558
|
-
expect(screen.getByText('Test Text')).toBeInTheDocument()
|
|
559
|
-
})
|
|
560
|
-
|
|
561
|
-
it('applies typography class', () => {
|
|
562
|
-
const { container } = render(
|
|
563
|
-
<TransparentLabel size="body-large-bold">
|
|
564
|
-
Bold Text
|
|
565
|
-
</TransparentLabel>
|
|
566
|
-
)
|
|
567
|
-
|
|
568
|
-
expect(container.querySelector('.typography-body-large-bold')).toBeInTheDocument()
|
|
569
|
-
})
|
|
570
|
-
|
|
571
|
-
it('applies gradient mask', () => {
|
|
572
|
-
const { container } = render(
|
|
573
|
-
<TransparentLabel>Fading Text</TransparentLabel>
|
|
574
|
-
)
|
|
575
|
-
|
|
576
|
-
const element = container.querySelector('p')
|
|
577
|
-
const styles = window.getComputedStyle(element!)
|
|
578
|
-
expect(styles.maskImage).toContain('linear-gradient')
|
|
579
|
-
})
|
|
580
|
-
|
|
581
|
-
it('applies custom className', () => {
|
|
582
|
-
const { container } = render(
|
|
583
|
-
<TransparentLabel className="custom-class">
|
|
584
|
-
Text
|
|
585
|
-
</TransparentLabel>
|
|
586
|
-
)
|
|
587
|
-
|
|
588
|
-
expect(container.querySelector('.custom-class')).toBeInTheDocument()
|
|
589
|
-
})
|
|
590
|
-
|
|
591
|
-
it('renders as paragraph element', () => {
|
|
592
|
-
const { container } = render(
|
|
593
|
-
<TransparentLabel>Text</TransparentLabel>
|
|
594
|
-
)
|
|
595
|
-
|
|
596
|
-
expect(container.querySelector('p')).toBeInTheDocument()
|
|
597
|
-
})
|
|
598
|
-
|
|
599
|
-
it('supports all HTML paragraph attributes', () => {
|
|
600
|
-
render(
|
|
601
|
-
<TransparentLabel
|
|
602
|
-
id="test-id"
|
|
603
|
-
data-testid="test-label"
|
|
604
|
-
aria-label="Test Label"
|
|
605
|
-
>
|
|
606
|
-
Text
|
|
607
|
-
</TransparentLabel>
|
|
608
|
-
)
|
|
609
|
-
|
|
610
|
-
const element = screen.getByTestId('test-label')
|
|
611
|
-
expect(element).toHaveAttribute('id', 'test-id')
|
|
612
|
-
expect(element).toHaveAttribute('aria-label', 'Test Label')
|
|
613
|
-
})
|
|
614
|
-
})
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
## Accessibility
|
|
618
|
-
|
|
619
|
-
- **Semantic HTML**: Uses `<p>` element
|
|
620
|
-
- **Screen Readers**: Content announced normally
|
|
621
|
-
- **Keyboard Navigation**: Not interactive, doesn't affect navigation
|
|
622
|
-
- **Color Independence**: Fade effect is visual enhancement only
|
|
623
|
-
- **Text Readability**: Ensure sufficient contrast for visible portion
|
|
624
|
-
|
|
625
|
-
### Accessibility Best Practices
|
|
626
|
-
|
|
627
|
-
```typescript
|
|
628
|
-
// Provide full text in aria-label for screen readers
|
|
629
|
-
<TransparentLabel aria-label="Full text without fade">
|
|
630
|
-
Visible truncated text
|
|
631
|
-
</TransparentLabel>
|
|
632
|
-
|
|
633
|
-
// Use appropriate semantic elements
|
|
634
|
-
<TransparentLabel as="h2" size="headers-large-bold">
|
|
635
|
-
Section Heading
|
|
636
|
-
</TransparentLabel>
|
|
637
|
-
|
|
638
|
-
// Don't hide critical information
|
|
639
|
-
<TransparentLabel>
|
|
640
|
-
Important: Read this completely {/* ❌ Bad - might fade important info */}
|
|
641
|
-
</TransparentLabel>
|
|
642
|
-
```
|
|
643
|
-
|
|
644
|
-
## Performance
|
|
645
|
-
|
|
646
|
-
| Metric | Value |
|
|
647
|
-
|--------|-------|
|
|
648
|
-
| Bundle size (minified) | ~2kb |
|
|
649
|
-
| Bundle size (gzipped) | ~0.8kb |
|
|
650
|
-
| Dependencies | class-variance-authority |
|
|
651
|
-
| CSS mask support | 98% browsers |
|
|
652
|
-
| Re-renders | Minimal |
|
|
653
|
-
| Tree-shakeable | ✅ |
|
|
654
|
-
|
|
655
|
-
### Performance Tips
|
|
656
|
-
|
|
657
|
-
1. **Use appropriate size**: Don't over-size text
|
|
658
|
-
2. **Avoid re-renders**: Memoize content when possible
|
|
659
|
-
```typescript
|
|
660
|
-
const memoizedText = useMemo(() => generateText(), [deps])
|
|
661
|
-
<TransparentLabel>{memoizedText}</TransparentLabel>
|
|
662
|
-
```
|
|
663
|
-
3. **Consider container width**: Fade effect works best with constrained width
|
|
664
|
-
|
|
665
|
-
## Styling
|
|
666
|
-
|
|
667
|
-
### Gradient Customization
|
|
668
|
-
|
|
669
|
-
```typescript
|
|
670
|
-
// Custom fade point
|
|
671
|
-
<TransparentLabel
|
|
672
|
-
className="[mask-image:linear-gradient(to_right,black_0%,black_70%,transparent_100%)]"
|
|
673
|
-
>
|
|
674
|
-
Fades earlier at 70%
|
|
675
|
-
</TransparentLabel>
|
|
676
|
-
|
|
677
|
-
// No fade
|
|
678
|
-
<TransparentLabel className="[mask-image:none]">
|
|
679
|
-
No fade effect
|
|
680
|
-
</TransparentLabel>
|
|
681
|
-
|
|
682
|
-
// Different gradient
|
|
683
|
-
<TransparentLabel
|
|
684
|
-
className="[mask-image:linear-gradient(to_bottom,black_0%,transparent_100%)]"
|
|
685
|
-
>
|
|
686
|
-
Vertical fade
|
|
687
|
-
</TransparentLabel>
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
### Default Styling
|
|
691
|
-
|
|
692
|
-
- Mask Image: Linear gradient from left to right (or right to left for RTL)
|
|
693
|
-
- Fade Start: 85% of text width
|
|
694
|
-
- Fade End: 100% of text width
|
|
695
|
-
- Typography: Design system typography classes
|
|
696
|
-
|
|
697
|
-
## Best Practices
|
|
698
|
-
|
|
699
|
-
1. **Use for truncation**: Ideal for long text in constrained spaces
|
|
700
|
-
2. **Constrain width**: Works best with defined container width
|
|
701
|
-
3. **Don't hide critical info**: Ensure important text isn't in fade zone
|
|
702
|
-
4. **Match typography**: Use appropriate size for context
|
|
703
|
-
5. **Test with long text**: Verify fade appears naturally
|
|
704
|
-
6. **Consider hover states**: Optionally show full text on hover
|
|
705
|
-
7. **RTL support**: Component automatically handles RTL languages
|
|
706
|
-
|
|
707
|
-
## Comparison with Standard Truncation
|
|
708
|
-
|
|
709
|
-
| Feature | TransparentLabel | text-ellipsis |
|
|
710
|
-
|---------|-----------------|---------------|
|
|
711
|
-
| Visual Effect | Gradual fade | Abrupt cutoff |
|
|
712
|
-
| Customization | Full gradient control | Limited |
|
|
713
|
-
| Multi-line | Works well | single-line-clamp needed |
|
|
714
|
-
| Performance | CSS mask | CSS overflow |
|
|
715
|
-
| Browser Support | 98% | 100% |
|
|
716
|
-
|
|
717
|
-
## Related Components
|
|
718
|
-
|
|
719
|
-
- [Label](./label.md) - Form label component
|
|
720
|
-
- [LabelField](./label-field.md) - Combined label and input
|
|
721
|
-
- [InnerLabelField](./inner-label-field.md) - Floating label input
|