superdesk-ui-framework 7.0.0-dev3 → 7.0.0-dev4
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/.github/scripts/use-ui-framework-build.sh +71 -0
- package/.github/workflows/consumer-e2e.yml +73 -0
- package/.github/workflows/publish-to-npm.yml +55 -9
- package/README.md +16 -0
- package/app/styles/form-elements/_input-preview.scss +5 -0
- package/app/styles/form-elements/_inputs.scss +19 -0
- package/app-typescript/components/TextArea.spec.tsx +186 -0
- package/app-typescript/components/TextArea.stories.tsx +118 -0
- package/app-typescript/components/TextArea.tsx +145 -0
- package/app-typescript/index.ts +1 -0
- package/dist/examples.bundle.js +1 -1
- package/dist/storybook/components-TextArea-stories.dd4730b4.iframe.bundle.js +2 -0
- package/dist/storybook/components-TextArea-stories.dd4730b4.iframe.bundle.js.LICENSE.txt +5 -0
- package/dist/storybook/iframe.html +2 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/main.92b4b0af.iframe.bundle.js +1 -0
- package/dist/storybook/manifests/components.html +188 -2
- package/dist/storybook/manifests/components.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/runtime~main.e94a9ed9.iframe.bundle.js +1 -0
- package/dist/superdesk-ui.bundle.css +1 -1
- package/dist/superdesk-ui.bundle.js +1 -1
- package/package.json +1 -1
- package/react/components/TextArea.d.ts +18 -0
- package/react/components/TextArea.js +109 -0
- package/react/index.d.ts +1 -0
- package/react/index.js +5 -3
- package/storybook-static/components-TextArea-stories.dd4730b4.iframe.bundle.js +2 -0
- package/storybook-static/components-TextArea-stories.dd4730b4.iframe.bundle.js.LICENSE.txt +5 -0
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/index.json +1 -1
- package/storybook-static/main.92b4b0af.iframe.bundle.js +1 -0
- package/storybook-static/manifests/components.html +188 -2
- package/storybook-static/manifests/components.json +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/runtime~main.e94a9ed9.iframe.bundle.js +1 -0
- package/.claude/settings.local.json +0 -32
- package/ESM_MIGRATION_PLAN.md +0 -414
- package/debug-storybook.log +0 -20
- package/dist/storybook/main.18fb8930.iframe.bundle.js +0 -1
- package/dist/storybook/main.f0d64657.iframe.bundle.js +0 -1
- package/dist/storybook/runtime~main.9da32ffd.iframe.bundle.js +0 -1
- package/react/components/Alert.d.ts.map +0 -1
- package/react/components/Alert.js.map +0 -1
- package/react/components/Autocomplete.d.ts.map +0 -1
- package/react/components/Autocomplete.js.map +0 -1
- package/react/components/Badge.d.ts.map +0 -1
- package/react/components/Badge.js.map +0 -1
- package/react/components/Button.d.ts.map +0 -1
- package/react/components/Button.js.map +0 -1
- package/react/components/ButtonGroup.d.ts.map +0 -1
- package/react/components/ButtonGroup.js.map +0 -1
- package/react/components/Card.d.ts.map +0 -1
- package/react/components/Card.js.map +0 -1
- package/react/components/Carousel.d.ts.map +0 -1
- package/react/components/Carousel.js.map +0 -1
- package/react/components/CheckButtonGroup.d.ts.map +0 -1
- package/react/components/CheckButtonGroup.js.map +0 -1
- package/react/components/CheckGroup.d.ts.map +0 -1
- package/react/components/CheckGroup.js.map +0 -1
- package/react/components/Checkbox.d.ts.map +0 -1
- package/react/components/Checkbox.js.map +0 -1
- package/react/components/CheckboxButton.d.ts.map +0 -1
- package/react/components/CheckboxButton.js.map +0 -1
- package/react/components/ContentDivider.d.ts.map +0 -1
- package/react/components/ContentDivider.js.map +0 -1
- package/react/components/CopyableTextBox.d.ts.map +0 -1
- package/react/components/CopyableTextBox.js.map +0 -1
- package/react/components/CreateButton.d.ts.map +0 -1
- package/react/components/CreateButton.js.map +0 -1
- package/react/components/DatePicker.d.ts.map +0 -1
- package/react/components/DatePicker.js.map +0 -1
- package/react/components/DateTimePicker.d.ts.map +0 -1
- package/react/components/DateTimePicker.js.map +0 -1
- package/react/components/Divider.d.ts.map +0 -1
- package/react/components/Divider.js.map +0 -1
- package/react/components/DonutChart.d.ts.map +0 -1
- package/react/components/DonutChart.js.map +0 -1
- package/react/components/DragHandle.d.ts.map +0 -1
- package/react/components/DragHandle.js.map +0 -1
- package/react/components/DragHandleDots.d.ts.map +0 -1
- package/react/components/DragHandleDots.js.map +0 -1
- package/react/components/DropZone.d.ts.map +0 -1
- package/react/components/DropZone.js.map +0 -1
- package/react/components/Dropdown.d.ts.map +0 -1
- package/react/components/Dropdown.js.map +0 -1
- package/react/components/DropdownFirst.d.ts.map +0 -1
- package/react/components/DropdownFirst.js.map +0 -1
- package/react/components/DurationInput.d.ts.map +0 -1
- package/react/components/DurationInput.js.map +0 -1
- package/react/components/EmptyState.d.ts.map +0 -1
- package/react/components/EmptyState.js.map +0 -1
- package/react/components/Form/FormGroup.d.ts.map +0 -1
- package/react/components/Form/FormGroup.js.map +0 -1
- package/react/components/Form/FormGroupItem.d.ts.map +0 -1
- package/react/components/Form/FormGroupItem.js.map +0 -1
- package/react/components/Form/FormGroupV2.d.ts.map +0 -1
- package/react/components/Form/FormGroupV2.js.map +0 -1
- package/react/components/Form/FormItem.d.ts.map +0 -1
- package/react/components/Form/FormItem.js.map +0 -1
- package/react/components/Form/FormLabel.d.ts.map +0 -1
- package/react/components/Form/FormLabel.js.map +0 -1
- package/react/components/Form/FormLayout.d.ts.map +0 -1
- package/react/components/Form/FormLayout.js.map +0 -1
- package/react/components/Form/FormRow.d.ts.map +0 -1
- package/react/components/Form/FormRow.js.map +0 -1
- package/react/components/Form/FormRowNew.d.ts.map +0 -1
- package/react/components/Form/FormRowNew.js.map +0 -1
- package/react/components/Form/FormText.d.ts.map +0 -1
- package/react/components/Form/FormText.js.map +0 -1
- package/react/components/Form/InputBase.d.ts.map +0 -1
- package/react/components/Form/InputBase.js.map +0 -1
- package/react/components/Form/InputNew.d.ts.map +0 -1
- package/react/components/Form/InputNew.js.map +0 -1
- package/react/components/Form/InputWrapper.d.ts.map +0 -1
- package/react/components/Form/InputWrapper.js.map +0 -1
- package/react/components/Form/index.d.ts.map +0 -1
- package/react/components/Form/index.js.map +0 -1
- package/react/components/FormLabel.d.ts.map +0 -1
- package/react/components/FormLabel.js.map +0 -1
- package/react/components/GridItem.d.ts.map +0 -1
- package/react/components/GridItem.js.map +0 -1
- package/react/components/GridList.d.ts.map +0 -1
- package/react/components/GridList.js.map +0 -1
- package/react/components/HeadingText.d.ts.map +0 -1
- package/react/components/HeadingText.js.map +0 -1
- package/react/components/HeadlessButton.d.ts.map +0 -1
- package/react/components/HeadlessButton.js.map +0 -1
- package/react/components/HelloWorld.d.ts.map +0 -1
- package/react/components/HelloWorld.js.map +0 -1
- package/react/components/Icon.d.ts.map +0 -1
- package/react/components/Icon.js.map +0 -1
- package/react/components/IconButton.d.ts.map +0 -1
- package/react/components/IconButton.js.map +0 -1
- package/react/components/IconLabel.d.ts.map +0 -1
- package/react/components/IconLabel.js.map +0 -1
- package/react/components/IconPicker.d.ts.map +0 -1
- package/react/components/IconPicker.js.map +0 -1
- package/react/components/IllustrationButton.d.ts.map +0 -1
- package/react/components/IllustrationButton.js.map +0 -1
- package/react/components/Input.d.ts.map +0 -1
- package/react/components/Input.js.map +0 -1
- package/react/components/Label.d.ts.map +0 -1
- package/react/components/Label.js.map +0 -1
- package/react/components/Layouts/AuthorinInnerSideBar.d.ts.map +0 -1
- package/react/components/Layouts/AuthorinInnerSideBar.js.map +0 -1
- package/react/components/Layouts/AuthoringContainer.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringContainer.js.map +0 -1
- package/react/components/Layouts/AuthoringFrame.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrame.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameContainer.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameContainer.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameLeftBar.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameLeftBar.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameMain.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameMain.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameNavBar.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameNavBar.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameOverlay.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameOverlay.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameRightBar.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameRightBar.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameSidePanel.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameSidePanel.js.map +0 -1
- package/react/components/Layouts/AuthoringFrameSidePanelOverlay.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringFrameSidePanelOverlay.js.map +0 -1
- package/react/components/Layouts/AuthoringInnerBody.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringInnerBody.js.map +0 -1
- package/react/components/Layouts/AuthoringInnerHeader.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringInnerHeader.js.map +0 -1
- package/react/components/Layouts/AuthoringMain.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringMain.js.map +0 -1
- package/react/components/Layouts/AuthoringMainContainer.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringMainContainer.js.map +0 -1
- package/react/components/Layouts/AuthoringMainContent.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringMainContent.js.map +0 -1
- package/react/components/Layouts/AuthoringMainToolBar.d.ts.map +0 -1
- package/react/components/Layouts/AuthoringMainToolBar.js.map +0 -1
- package/react/components/Layouts/BottomBarAction.d.ts.map +0 -1
- package/react/components/Layouts/BottomBarAction.js.map +0 -1
- package/react/components/Layouts/Container.d.ts.map +0 -1
- package/react/components/Layouts/Container.js.map +0 -1
- package/react/components/Layouts/ContentSplitter.d.ts.map +0 -1
- package/react/components/Layouts/ContentSplitter.js.map +0 -1
- package/react/components/Layouts/CoreLayout.d.ts.map +0 -1
- package/react/components/Layouts/CoreLayout.js.map +0 -1
- package/react/components/Layouts/CoreLayoutContainer.d.ts.map +0 -1
- package/react/components/Layouts/CoreLayoutContainer.js.map +0 -1
- package/react/components/Layouts/CoreLayoutFooter.d.ts.map +0 -1
- package/react/components/Layouts/CoreLayoutFooter.js.map +0 -1
- package/react/components/Layouts/CoreLayoutMain.d.ts.map +0 -1
- package/react/components/Layouts/CoreLayoutMain.js.map +0 -1
- package/react/components/Layouts/CoreLayoutOverlay.d.ts.map +0 -1
- package/react/components/Layouts/CoreLayoutOverlay.js.map +0 -1
- package/react/components/Layouts/CoreLayoutSlideInMenu.d.ts.map +0 -1
- package/react/components/Layouts/CoreLayoutSlideInMenu.js.map +0 -1
- package/react/components/Layouts/CoreLayoutTopMenu.d.ts.map +0 -1
- package/react/components/Layouts/CoreLayoutTopMenu.js.map +0 -1
- package/react/components/Layouts/HamburgerButton.d.ts.map +0 -1
- package/react/components/Layouts/HamburgerButton.js.map +0 -1
- package/react/components/Layouts/HeaderPanel.d.ts.map +0 -1
- package/react/components/Layouts/HeaderPanel.js.map +0 -1
- package/react/components/Layouts/Layout.d.ts.map +0 -1
- package/react/components/Layouts/Layout.js.map +0 -1
- package/react/components/Layouts/LayoutContainer.d.ts.map +0 -1
- package/react/components/Layouts/LayoutContainer.js.map +0 -1
- package/react/components/Layouts/LeftPanel.d.ts.map +0 -1
- package/react/components/Layouts/LeftPanel.js.map +0 -1
- package/react/components/Layouts/MainMenu.d.ts.map +0 -1
- package/react/components/Layouts/MainMenu.js.map +0 -1
- package/react/components/Layouts/MainPanel.d.ts.map +0 -1
- package/react/components/Layouts/MainPanel.js.map +0 -1
- package/react/components/Layouts/NotificationPanel.d.ts.map +0 -1
- package/react/components/Layouts/NotificationPanel.js.map +0 -1
- package/react/components/Layouts/OverlayPanel.d.ts.map +0 -1
- package/react/components/Layouts/OverlayPanel.js.map +0 -1
- package/react/components/Layouts/PageLayout.d.ts.map +0 -1
- package/react/components/Layouts/PageLayout.js.map +0 -1
- package/react/components/Layouts/Panel.d.ts.map +0 -1
- package/react/components/Layouts/Panel.js.map +0 -1
- package/react/components/Layouts/RightPanel.d.ts.map +0 -1
- package/react/components/Layouts/RightPanel.js.map +0 -1
- package/react/components/Layouts/index.d.ts.map +0 -1
- package/react/components/Layouts/index.js.map +0 -1
- package/react/components/LeftMenu.d.ts.map +0 -1
- package/react/components/LeftMenu.js.map +0 -1
- package/react/components/ListItemLoader.d.ts.map +0 -1
- package/react/components/ListItemLoader.js.map +0 -1
- package/react/components/Lists/BoxedList.d.ts.map +0 -1
- package/react/components/Lists/BoxedList.js.map +0 -1
- package/react/components/Lists/CalendarWeekDayItem.d.ts.map +0 -1
- package/react/components/Lists/CalendarWeekDayItem.js.map +0 -1
- package/react/components/Lists/ContentList.d.ts.map +0 -1
- package/react/components/Lists/ContentList.js.map +0 -1
- package/react/components/Lists/LoadMoreIndicator.d.ts.map +0 -1
- package/react/components/Lists/LoadMoreIndicator.js.map +0 -1
- package/react/components/Lists/SimpleList.d.ts.map +0 -1
- package/react/components/Lists/SimpleList.js.map +0 -1
- package/react/components/Lists/TableList.d.ts.map +0 -1
- package/react/components/Lists/TableList.js.map +0 -1
- package/react/components/Lists/index.d.ts.map +0 -1
- package/react/components/Lists/index.js.map +0 -1
- package/react/components/Loader.d.ts.map +0 -1
- package/react/components/Loader.js.map +0 -1
- package/react/components/Menu.d.ts.map +0 -1
- package/react/components/Menu.js.map +0 -1
- package/react/components/Modal.d.ts.map +0 -1
- package/react/components/Modal.js.map +0 -1
- package/react/components/MultiSelect.d.ts.map +0 -1
- package/react/components/MultiSelect.js.map +0 -1
- package/react/components/NavButton.d.ts.map +0 -1
- package/react/components/NavButton.js.map +0 -1
- package/react/components/Navigation/BottomNav.d.ts.map +0 -1
- package/react/components/Navigation/BottomNav.js.map +0 -1
- package/react/components/Navigation/QuickNavBar.d.ts.map +0 -1
- package/react/components/Navigation/QuickNavBar.js.map +0 -1
- package/react/components/Navigation/SideBarMenu.d.ts.map +0 -1
- package/react/components/Navigation/SideBarMenu.js.map +0 -1
- package/react/components/Navigation/SideBarTabs.d.ts.map +0 -1
- package/react/components/Navigation/SideBarTabs.js.map +0 -1
- package/react/components/Navigation/index.d.ts.map +0 -1
- package/react/components/Navigation/index.js.map +0 -1
- package/react/components/OverflowStack/OverflowStack.d.ts.map +0 -1
- package/react/components/OverflowStack/OverflowStack.js.map +0 -1
- package/react/components/OverflowStack/OverflowStackPopover.d.ts.map +0 -1
- package/react/components/OverflowStack/OverflowStackPopover.js.map +0 -1
- package/react/components/OverflowStack/utils.d.ts.map +0 -1
- package/react/components/OverflowStack/utils.js.map +0 -1
- package/react/components/Popover.d.ts.map +0 -1
- package/react/components/Popover.js.map +0 -1
- package/react/components/PropsList.d.ts.map +0 -1
- package/react/components/PropsList.js.map +0 -1
- package/react/components/RadioButtonGroup.d.ts.map +0 -1
- package/react/components/RadioButtonGroup.js.map +0 -1
- package/react/components/RadioGroup.d.ts.map +0 -1
- package/react/components/RadioGroup.js.map +0 -1
- package/react/components/ResizablePanels.d.ts.map +0 -1
- package/react/components/ResizablePanels.js.map +0 -1
- package/react/components/ResizeObserverComponent.d.ts.map +0 -1
- package/react/components/ResizeObserverComponent.js.map +0 -1
- package/react/components/Rotate.d.ts.map +0 -1
- package/react/components/Rotate.js.map +0 -1
- package/react/components/SearchBar.d.ts.map +0 -1
- package/react/components/SearchBar.js.map +0 -1
- package/react/components/Select.d.ts.map +0 -1
- package/react/components/Select.js.map +0 -1
- package/react/components/SelectGrid.d.ts.map +0 -1
- package/react/components/SelectGrid.js.map +0 -1
- package/react/components/SelectPreview.d.ts.map +0 -1
- package/react/components/SelectPreview.js.map +0 -1
- package/react/components/SelectWithTemplate.d.ts.map +0 -1
- package/react/components/SelectWithTemplate.js.map +0 -1
- package/react/components/ShowPopup.d.ts.map +0 -1
- package/react/components/ShowPopup.js.map +0 -1
- package/react/components/SingleAndDoubleClickFunction.d.ts.map +0 -1
- package/react/components/SingleAndDoubleClickFunction.js.map +0 -1
- package/react/components/Skeleton.d.ts.map +0 -1
- package/react/components/Skeleton.js.map +0 -1
- package/react/components/SlidingToolbar.d.ts.map +0 -1
- package/react/components/SlidingToolbar.js.map +0 -1
- package/react/components/Spinner.d.ts.map +0 -1
- package/react/components/Spinner.js.map +0 -1
- package/react/components/StateLabel.d.ts.map +0 -1
- package/react/components/StateLabel.js.map +0 -1
- package/react/components/StrechBar.d.ts.map +0 -1
- package/react/components/StrechBar.js.map +0 -1
- package/react/components/SubNav.d.ts.map +0 -1
- package/react/components/SubNav.js.map +0 -1
- package/react/components/SvgIconIllustration.d.ts.map +0 -1
- package/react/components/SvgIconIllustration.js.map +0 -1
- package/react/components/Switch.d.ts.map +0 -1
- package/react/components/Switch.js.map +0 -1
- package/react/components/SwitchGroup.d.ts.map +0 -1
- package/react/components/SwitchGroup.js.map +0 -1
- package/react/components/TabCustom.d.ts.map +0 -1
- package/react/components/TabCustom.js.map +0 -1
- package/react/components/TabList.d.ts.map +0 -1
- package/react/components/TabList.js.map +0 -1
- package/react/components/Tag.d.ts.map +0 -1
- package/react/components/Tag.js.map +0 -1
- package/react/components/TagInput.d.ts.map +0 -1
- package/react/components/TagInput.js.map +0 -1
- package/react/components/Text/Heading.d.ts.map +0 -1
- package/react/components/Text/Heading.js.map +0 -1
- package/react/components/Text/Text.d.ts.map +0 -1
- package/react/components/Text/Text.js.map +0 -1
- package/react/components/Text/Time.d.ts.map +0 -1
- package/react/components/Text/Time.js.map +0 -1
- package/react/components/ThemeSelector.d.ts.map +0 -1
- package/react/components/ThemeSelector.js.map +0 -1
- package/react/components/TimePicker/TimePickerPopover.d.ts.map +0 -1
- package/react/components/TimePicker/TimePickerPopover.js.map +0 -1
- package/react/components/TimePicker/TimeValueHolder.d.ts.map +0 -1
- package/react/components/TimePicker/TimeValueHolder.js.map +0 -1
- package/react/components/TimePicker/index.d.ts.map +0 -1
- package/react/components/TimePicker/index.js.map +0 -1
- package/react/components/TimePickerV2.d.ts.map +0 -1
- package/react/components/TimePickerV2.js.map +0 -1
- package/react/components/Toast.d.ts.map +0 -1
- package/react/components/Toast.js.map +0 -1
- package/react/components/ToastMessage.d.ts.map +0 -1
- package/react/components/ToastMessage.js.map +0 -1
- package/react/components/ToastText.d.ts.map +0 -1
- package/react/components/ToastText.js.map +0 -1
- package/react/components/ToastWrapper.d.ts.map +0 -1
- package/react/components/ToastWrapper.js.map +0 -1
- package/react/components/ToggleBox/CustomHeaderToggleBox.d.ts.map +0 -1
- package/react/components/ToggleBox/CustomHeaderToggleBox.js.map +0 -1
- package/react/components/ToggleBox/SimpleToggleBox.d.ts.map +0 -1
- package/react/components/ToggleBox/SimpleToggleBox.js.map +0 -1
- package/react/components/ToggleBox/index.d.ts.map +0 -1
- package/react/components/ToggleBox/index.js.map +0 -1
- package/react/components/Tooltip.d.ts.map +0 -1
- package/react/components/Tooltip.js.map +0 -1
- package/react/components/TooltipV2.d.ts.map +0 -1
- package/react/components/TooltipV2.js.map +0 -1
- package/react/components/TreeMenu.d.ts.map +0 -1
- package/react/components/TreeMenu.js.map +0 -1
- package/react/components/TreeSelect/KeyboardNavigation.d.ts.map +0 -1
- package/react/components/TreeSelect/KeyboardNavigation.js.map +0 -1
- package/react/components/TreeSelect/TreeSelect.d.ts.map +0 -1
- package/react/components/TreeSelect/TreeSelect.js.map +0 -1
- package/react/components/TreeSelect/TreeSelectItem.d.ts.map +0 -1
- package/react/components/TreeSelect/TreeSelectItem.js.map +0 -1
- package/react/components/TreeSelect/TreeSelectPill.d.ts.map +0 -1
- package/react/components/TreeSelect/TreeSelectPill.js.map +0 -1
- package/react/components/WithPagination.d.ts.map +0 -1
- package/react/components/WithPagination.js.map +0 -1
- package/react/components/WithPopover.d.ts.map +0 -1
- package/react/components/WithPopover.js.map +0 -1
- package/react/components/WithPortal.d.ts.map +0 -1
- package/react/components/WithPortal.js.map +0 -1
- package/react/components/WithSizeObserver.d.ts.map +0 -1
- package/react/components/WithSizeObserver.js.map +0 -1
- package/react/components/_Positioner.d.ts.map +0 -1
- package/react/components/_Positioner.js.map +0 -1
- package/react/components/avatar/avatar-action-add.d.ts.map +0 -1
- package/react/components/avatar/avatar-action-add.js.map +0 -1
- package/react/components/avatar/avatar-group.d.ts.map +0 -1
- package/react/components/avatar/avatar-group.js.map +0 -1
- package/react/components/avatar/avatar-image.d.ts.map +0 -1
- package/react/components/avatar/avatar-image.js.map +0 -1
- package/react/components/avatar/avatar-number.d.ts.map +0 -1
- package/react/components/avatar/avatar-number.js.map +0 -1
- package/react/components/avatar/avatar-placeholder.d.ts.map +0 -1
- package/react/components/avatar/avatar-placeholder.js.map +0 -1
- package/react/components/avatar/avatar-text.d.ts.map +0 -1
- package/react/components/avatar/avatar-text.js.map +0 -1
- package/react/components/avatar/avatar-with-inline-text-wrapper.d.ts.map +0 -1
- package/react/components/avatar/avatar-with-inline-text-wrapper.js.map +0 -1
- package/react/components/avatar/avatar-wrapper.d.ts.map +0 -1
- package/react/components/avatar/avatar-wrapper.js.map +0 -1
- package/react/components/avatar/avatar.d.ts.map +0 -1
- package/react/components/avatar/avatar.js.map +0 -1
- package/react/components/avatar/interfaces.d.ts.map +0 -1
- package/react/components/avatar/interfaces.js.map +0 -1
- package/react/helpers.d.ts.map +0 -1
- package/react/helpers.js.map +0 -1
- package/react/index.d.ts.map +0 -1
- package/react/index.js.map +0 -1
- package/react/localization.d.ts.map +0 -1
- package/react/localization.js.map +0 -1
- package/react/translations.d.ts.map +0 -1
- package/react/translations.js.map +0 -1
- package/react/utils/time.d.ts.map +0 -1
- package/react/utils/time.js.map +0 -1
- package/react/zIndex.d.ts.map +0 -1
- package/react/zIndex.js.map +0 -1
- package/storybook-static/main.18fb8930.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.9da32ffd.iframe.bundle.js +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Usage: use-ui-framework-build.sh <search-root> <build-dir>
|
|
3
|
+
#
|
|
4
|
+
# Runs inside a consumer repo (superdesk-client-core, superdesk-planning) after its dependencies
|
|
5
|
+
# are installed. Replaces every installed superdesk-ui-framework under <search-root> with the
|
|
6
|
+
# tarball next to this script, then checks that the copy client-core's webpack config aliases
|
|
7
|
+
# when building from <build-dir> is that build.
|
|
8
|
+
#
|
|
9
|
+
# The folders are swapped directly instead of going through npm: client-core pins an exact
|
|
10
|
+
# ui-framework version, so a version bump would make npm nest a registry copy under
|
|
11
|
+
# superdesk-core/node_modules, which is the path webpack prefers.
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
|
|
14
|
+
search_root=$1
|
|
15
|
+
build_dir=$2
|
|
16
|
+
|
|
17
|
+
here=$(cd "$(dirname "$0")" && pwd)
|
|
18
|
+
tarball=$(ls "$here"/superdesk-ui-framework-*.tgz)
|
|
19
|
+
expected=$(cat "$here/bundle.sha256")
|
|
20
|
+
|
|
21
|
+
sha256() {
|
|
22
|
+
if command -v sha256sum > /dev/null; then
|
|
23
|
+
sha256sum "$1" | cut -d' ' -f1
|
|
24
|
+
else
|
|
25
|
+
shasum -a 256 "$1" | cut -d' ' -f1
|
|
26
|
+
fi
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
copies=$(find "$search_root" -path '*/node_modules/superdesk-ui-framework/package.json' -exec dirname {} \;)
|
|
30
|
+
|
|
31
|
+
if [ -z "$copies" ]; then
|
|
32
|
+
echo "::error::No installed superdesk-ui-framework found under $search_root"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
echo "Replacing installed superdesk-ui-framework with $(basename "$tarball") (bundle sha256 $expected)"
|
|
37
|
+
|
|
38
|
+
for dir in $copies; do
|
|
39
|
+
before=$(sha256 "$dir/dist/superdesk-ui.bundle.js")
|
|
40
|
+
rm -rf "$dir"
|
|
41
|
+
mkdir -p "$dir"
|
|
42
|
+
tar -xzf "$tarball" -C "$dir" --strip-components=1
|
|
43
|
+
echo " $dir: $before -> $(sha256 "$dir/dist/superdesk-ui.bundle.js")"
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
cd "$build_dir"
|
|
47
|
+
|
|
48
|
+
EXPECTED_SHA256="$expected" node - << 'EOF'
|
|
49
|
+
const crypto = require('crypto');
|
|
50
|
+
const fs = require('fs');
|
|
51
|
+
const path = require('path');
|
|
52
|
+
|
|
53
|
+
// Mirrors how superdesk-client-core's webpack.config.js resolves the `superdesk-ui-framework` alias.
|
|
54
|
+
const moduleDir = (name, paths) => path.dirname(require.resolve(`${name}/package.json`, {paths}));
|
|
55
|
+
const coreDir = moduleDir('superdesk-core', [process.cwd()]);
|
|
56
|
+
const nested = path.join(coreDir, 'node_modules/superdesk-ui-framework');
|
|
57
|
+
const uiDir = fs.existsSync(nested) ? nested : moduleDir('superdesk-ui-framework', [coreDir, process.cwd()]);
|
|
58
|
+
|
|
59
|
+
const bundle = fs.readFileSync(path.join(uiDir, 'dist/superdesk-ui.bundle.js'));
|
|
60
|
+
const actual = crypto.createHash('sha256').update(bundle).digest('hex');
|
|
61
|
+
const expected = process.env.EXPECTED_SHA256;
|
|
62
|
+
|
|
63
|
+
console.log(`webpack will alias superdesk-ui-framework to ${fs.realpathSync(uiDir)}`);
|
|
64
|
+
console.log(` bundle sha256: ${actual}`);
|
|
65
|
+
console.log(` expected: ${expected}`);
|
|
66
|
+
|
|
67
|
+
if (actual !== expected) {
|
|
68
|
+
console.log('::error::webpack would bundle a superdesk-ui-framework other than the caller build');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
EOF
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: Consumer E2E
|
|
2
|
+
|
|
3
|
+
# Runs the superdesk-client-core and superdesk-planning e2e suites against this branch's build,
|
|
4
|
+
# to catch ui-framework changes that break its consumers.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
client-core-ref:
|
|
11
|
+
description: 'superdesk-client-core branch to test against'
|
|
12
|
+
default: 'develop'
|
|
13
|
+
planning-ref:
|
|
14
|
+
description: 'superdesk-planning branch to test against'
|
|
15
|
+
default: 'develop'
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
concurrency:
|
|
21
|
+
group: consumer-e2e-${{ github.ref }}
|
|
22
|
+
cancel-in-progress: true
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
pack:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v6
|
|
29
|
+
|
|
30
|
+
- uses: actions/setup-node@v6
|
|
31
|
+
with:
|
|
32
|
+
node-version: '22'
|
|
33
|
+
cache: 'npm'
|
|
34
|
+
|
|
35
|
+
- run: npm ci
|
|
36
|
+
|
|
37
|
+
# The parts of `npm run build` that consumers use; Storybook is skipped.
|
|
38
|
+
- name: Build package
|
|
39
|
+
run: |
|
|
40
|
+
export PATH="$PWD/node_modules/.bin:$PATH"
|
|
41
|
+
tsc -p tsconfig.json --noEmit
|
|
42
|
+
webpack --config tasks/webpack.prod.js
|
|
43
|
+
tsc
|
|
44
|
+
|
|
45
|
+
- name: Pack
|
|
46
|
+
run: |
|
|
47
|
+
out="$RUNNER_TEMP/ui-framework"
|
|
48
|
+
mkdir -p "$out"
|
|
49
|
+
npm pack --pack-destination "$out"
|
|
50
|
+
sha256sum dist/superdesk-ui.bundle.js | cut -d' ' -f1 > "$out/bundle.sha256"
|
|
51
|
+
cp .github/scripts/use-ui-framework-build.sh "$out/"
|
|
52
|
+
ls -la "$out"
|
|
53
|
+
cat "$out/bundle.sha256"
|
|
54
|
+
|
|
55
|
+
- uses: actions/upload-artifact@v7
|
|
56
|
+
with:
|
|
57
|
+
name: ui-framework-package
|
|
58
|
+
path: ${{ runner.temp }}/ui-framework
|
|
59
|
+
retention-days: 1
|
|
60
|
+
|
|
61
|
+
client-core:
|
|
62
|
+
needs: pack
|
|
63
|
+
uses: superdesk/superdesk-client-core/.github/workflows/e2e.yml@develop
|
|
64
|
+
with:
|
|
65
|
+
ui-framework-artifact: ui-framework-package
|
|
66
|
+
ref: ${{ inputs.client-core-ref || 'develop' }}
|
|
67
|
+
|
|
68
|
+
planning:
|
|
69
|
+
needs: pack
|
|
70
|
+
uses: superdesk/superdesk-planning/.github/workflows/ci-e2e.yml@develop
|
|
71
|
+
with:
|
|
72
|
+
ui-framework-artifact: ui-framework-package
|
|
73
|
+
ref: ${{ inputs.planning-ref || 'develop' }}
|
|
@@ -13,6 +13,20 @@ on:
|
|
|
13
13
|
- patch
|
|
14
14
|
- minor
|
|
15
15
|
- major
|
|
16
|
+
- prepatch
|
|
17
|
+
- preminor
|
|
18
|
+
- premajor
|
|
19
|
+
- prerelease
|
|
20
|
+
preid:
|
|
21
|
+
description: 'Prerelease id for the pre* bumps, e.g. alpha, beta, rc (6.1.6 + preminor + beta = 6.2.0-beta.0)'
|
|
22
|
+
required: false
|
|
23
|
+
type: string
|
|
24
|
+
default: ''
|
|
25
|
+
version:
|
|
26
|
+
description: 'Exact version to publish instead of a bump, e.g. 7.0.0-dev4'
|
|
27
|
+
required: false
|
|
28
|
+
type: string
|
|
29
|
+
default: ''
|
|
16
30
|
|
|
17
31
|
jobs:
|
|
18
32
|
publish:
|
|
@@ -20,6 +34,10 @@ jobs:
|
|
|
20
34
|
permissions:
|
|
21
35
|
contents: write
|
|
22
36
|
id-token: write
|
|
37
|
+
env:
|
|
38
|
+
BUMP: ${{ inputs.bump }}
|
|
39
|
+
PREID: ${{ inputs.preid }}
|
|
40
|
+
EXACT_VERSION: ${{ inputs.version }}
|
|
23
41
|
steps:
|
|
24
42
|
- uses: actions/checkout@v6
|
|
25
43
|
with:
|
|
@@ -32,24 +50,51 @@ jobs:
|
|
|
32
50
|
- run: npm ci
|
|
33
51
|
|
|
34
52
|
- name: Bump version
|
|
35
|
-
|
|
53
|
+
id: bump
|
|
36
54
|
run: |
|
|
55
|
+
if [ -n "$EXACT_VERSION" ] && [ "$BUMP" != "none" ]; then
|
|
56
|
+
echo "::error::Set either a bump or an exact version, not both."
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
if [ -n "$EXACT_VERSION" ]; then
|
|
61
|
+
NEW_VERSION="$EXACT_VERSION"
|
|
62
|
+
elif [ "$BUMP" != "none" ]; then
|
|
63
|
+
NEW_VERSION="$BUMP"
|
|
64
|
+
else
|
|
65
|
+
echo "bumped=false" >> $GITHUB_OUTPUT
|
|
66
|
+
exit 0
|
|
67
|
+
fi
|
|
68
|
+
|
|
37
69
|
git config user.name "github-actions[bot]"
|
|
38
70
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
39
|
-
npm version ${
|
|
71
|
+
npm version "$NEW_VERSION" ${PREID:+--preid "$PREID"} -m "Bump version to %s and release"
|
|
72
|
+
echo "bumped=true" >> $GITHUB_OUTPUT
|
|
40
73
|
|
|
41
|
-
|
|
74
|
+
# A prerelease goes out under its id without the trailing number (7.0.0-dev4 under "dev",
|
|
75
|
+
# 6.2.0-beta.0 under "beta"), so `npm install superdesk-ui-framework` keeps the stable one.
|
|
76
|
+
- name: Resolve target version and dist-tag
|
|
42
77
|
id: package-version
|
|
43
|
-
run:
|
|
78
|
+
run: |
|
|
79
|
+
node -e '
|
|
80
|
+
const version = require("./package.json").version;
|
|
81
|
+
const prerelease = version.split("+")[0].split("-").slice(1).join("-");
|
|
82
|
+
const tag = prerelease === "" ? "latest" : prerelease.split(".")[0].replace(/\d+$/, "") || "next";
|
|
83
|
+
require("fs").appendFileSync(process.env.GITHUB_OUTPUT, [
|
|
84
|
+
`version=${version}`,
|
|
85
|
+
`tag=${tag}`,
|
|
86
|
+
`prerelease=${prerelease !== ""}`,
|
|
87
|
+
].join("\n") + "\n");
|
|
88
|
+
'
|
|
44
89
|
|
|
45
90
|
- name: Ensure version is not already published
|
|
46
91
|
run: |
|
|
47
92
|
VERSION="${{ steps.package-version.outputs.version }}"
|
|
48
93
|
if [ -n "$(npm view superdesk-ui-framework@"$VERSION" version 2>/dev/null)" ]; then
|
|
49
|
-
echo "::error::superdesk-ui-framework@$VERSION is already published to npm. Choose a version bump
|
|
94
|
+
echo "::error::superdesk-ui-framework@$VERSION is already published to npm. Choose a version bump or an exact version and re-run."
|
|
50
95
|
exit 1
|
|
51
96
|
fi
|
|
52
|
-
echo "::notice::superdesk-ui-framework@$VERSION is available;
|
|
97
|
+
echo "::notice::superdesk-ui-framework@$VERSION is available; publishing under the '${{ steps.package-version.outputs.tag }}' dist-tag."
|
|
53
98
|
|
|
54
99
|
- run: npm run lint
|
|
55
100
|
- run: npm run build
|
|
@@ -57,7 +102,7 @@ jobs:
|
|
|
57
102
|
# Push the bump commit and tag BEFORE publishing, so a push failure
|
|
58
103
|
# aborts the run before the irreversible npm publish.
|
|
59
104
|
- name: Push version bump and tag
|
|
60
|
-
if:
|
|
105
|
+
if: steps.bump.outputs.bumped == 'true'
|
|
61
106
|
run: |
|
|
62
107
|
git push origin "HEAD:${{ github.ref_name }}"
|
|
63
108
|
git push origin "v${{ steps.package-version.outputs.version }}"
|
|
@@ -69,6 +114,7 @@ jobs:
|
|
|
69
114
|
id: publish
|
|
70
115
|
with:
|
|
71
116
|
provenance: true
|
|
117
|
+
tag: ${{ steps.package-version.outputs.tag }}
|
|
72
118
|
|
|
73
119
|
- name: Create GitHub Release
|
|
74
120
|
uses: softprops/action-gh-release@v3
|
|
@@ -77,6 +123,6 @@ jobs:
|
|
|
77
123
|
name: v${{ steps.package-version.outputs.version }}
|
|
78
124
|
generate_release_notes: true
|
|
79
125
|
body: |
|
|
80
|
-
Published to npm: https://www.npmjs.com/package/superdesk-ui-framework/v/${{ steps.package-version.outputs.version }}
|
|
126
|
+
Published to npm under the `${{ steps.package-version.outputs.tag }}` tag: https://www.npmjs.com/package/superdesk-ui-framework/v/${{ steps.package-version.outputs.version }}
|
|
81
127
|
draft: false
|
|
82
|
-
prerelease:
|
|
128
|
+
prerelease: ${{ steps.package-version.outputs.prerelease == 'true' }}
|
package/README.md
CHANGED
|
@@ -150,3 +150,19 @@ Runing `e2e&unit` tests
|
|
|
150
150
|
```
|
|
151
151
|
npm run lint
|
|
152
152
|
```
|
|
153
|
+
|
|
154
|
+
#### Consumer e2e
|
|
155
|
+
|
|
156
|
+
The `Consumer E2E` workflow (`.github/workflows/consumer-e2e.yml`) builds this branch and runs the Playwright e2e suites of [superdesk-client-core](https://github.com/superdesk/superdesk-client-core) and [superdesk-planning](https://github.com/superdesk/superdesk-planning) against that build instead of the npm release. It runs on every pull request.
|
|
157
|
+
|
|
158
|
+
To run it manually, open Actions > Consumer E2E > Run workflow, pick the ui-framework branch to build, and optionally the client-core and planning branches to test against (both default to `develop`). From the command line:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
gh workflow run consumer-e2e.yml --ref <ui-framework-branch> -f client-core-ref=develop -f planning-ref=develop
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Things to know:
|
|
165
|
+
|
|
166
|
+
- Manual runs only work once the workflow is on `develop`, since GitHub only offers "Run workflow" for workflows on the default branch.
|
|
167
|
+
- The branch inputs pick which consumer code is tested, but the consumer workflows themselves always come from their `develop` (the `uses:` lines). To try a change to a consumer's e2e workflow, point the matching `uses:` line at that branch temporarily.
|
|
168
|
+
- To check that a run used this build and not the npm one, look at the "Use superdesk-ui-framework build" step in the client-core and planning jobs. It prints the bundle hash before and after the swap, and fails if webpack would bundle anything other than this build.
|
|
@@ -815,6 +815,25 @@ input[type="color" i].sd-input__color-input::-webkit-color-swatch {
|
|
|
815
815
|
&.sd-input__input {
|
|
816
816
|
height: auto;
|
|
817
817
|
min-height: var(--form-element-height-default);
|
|
818
|
+
// A single row is as tall as a single-line input: 0.6rem + 2rem + 0.6rem.
|
|
819
|
+
padding-block: 0.6rem;
|
|
820
|
+
line-height: 2rem;
|
|
821
|
+
resize: vertical;
|
|
822
|
+
// Height changes come from the resize handle or autoHeight and must follow instantly.
|
|
823
|
+
transition-property: background-color, border-color, box-shadow;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
&.sd-input__input--auto-height {
|
|
827
|
+
resize: none;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
&:not(.sd-input--boxed-style) textarea.sd-input__input[readonly] {
|
|
832
|
+
border-block-end-style: dotted;
|
|
833
|
+
|
|
834
|
+
&:hover {
|
|
835
|
+
background-color: var(--color-input-bg);
|
|
836
|
+
border-color: var(--color-input-border);
|
|
818
837
|
}
|
|
819
838
|
}
|
|
820
839
|
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import {describe, it, beforeEach, afterEach} from 'mocha';
|
|
2
|
+
import * as assert from 'assert';
|
|
3
|
+
import {mount, ReactWrapper} from 'enzyme';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import {TextArea} from './TextArea';
|
|
6
|
+
|
|
7
|
+
const noop = () => undefined;
|
|
8
|
+
|
|
9
|
+
function getTextarea(wrapper: ReactWrapper): HTMLTextAreaElement {
|
|
10
|
+
return wrapper.find('textarea').getDOMNode() as HTMLTextAreaElement;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe('TextArea', () => {
|
|
14
|
+
it('renders label, hint and required marker through the input wrapper', () => {
|
|
15
|
+
const wrapper = mount(<TextArea label="Notes" info="Some hint" required={true} onChange={noop} />);
|
|
16
|
+
const textarea = getTextarea(wrapper);
|
|
17
|
+
|
|
18
|
+
assert.strictEqual(wrapper.find('label.sd-input__label').text(), 'Notes');
|
|
19
|
+
assert.strictEqual(wrapper.find('label.sd-input__label').prop('htmlFor'), textarea.id);
|
|
20
|
+
assert.strictEqual(wrapper.find('.sd-input__hint').text(), 'Some hint');
|
|
21
|
+
assert.ok(wrapper.find('.sd-input').hasClass('sd-input--required'));
|
|
22
|
+
assert.ok(textarea.classList.contains('sd-input__input'));
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('shows the error instead of the hint and marks the field invalid', () => {
|
|
26
|
+
const wrapper = mount(<TextArea label="Notes" info="Some hint" error="Too vague" onChange={noop} />);
|
|
27
|
+
|
|
28
|
+
assert.ok(wrapper.find('.sd-input').hasClass('sd-input--invalid'));
|
|
29
|
+
assert.strictEqual(wrapper.find('.sd-input__message').text(), 'Too vague');
|
|
30
|
+
assert.strictEqual(wrapper.find('.sd-input__hint').length, 0);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('calls onChange with the new string value', () => {
|
|
34
|
+
const values: Array<string> = [];
|
|
35
|
+
const wrapper = mount(<TextArea value="" onChange={(value) => values.push(value)} />);
|
|
36
|
+
const textarea = getTextarea(wrapper);
|
|
37
|
+
|
|
38
|
+
textarea.value = 'first line\nsecond line';
|
|
39
|
+
wrapper.find('textarea').simulate('change');
|
|
40
|
+
|
|
41
|
+
assert.strictEqual(values.length, 1);
|
|
42
|
+
assert.strictEqual(typeof values[0], 'string');
|
|
43
|
+
assert.strictEqual(values[0], 'first line\nsecond line');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('limits the length natively and shows a character counter', () => {
|
|
47
|
+
const wrapper = mount(<TextArea value="hello" maxLength={10} onChange={noop} />);
|
|
48
|
+
|
|
49
|
+
assert.strictEqual(getTextarea(wrapper).maxLength, 10);
|
|
50
|
+
assert.strictEqual(wrapper.find('.sd-input__char-count').text(), '5 / 10');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('counts from zero when there is no value yet', () => {
|
|
54
|
+
const wrapper = mount(<TextArea maxLength={10} onChange={noop} />);
|
|
55
|
+
|
|
56
|
+
assert.strictEqual(wrapper.find('.sd-input__char-count').text(), '0 / 10');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('defaults to 3 rows', () => {
|
|
60
|
+
assert.strictEqual(getTextarea(mount(<TextArea onChange={noop} />)).rows, 3);
|
|
61
|
+
assert.strictEqual(getTextarea(mount(<TextArea rows={6} onChange={noop} />)).rows, 6);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('is read-only without being disabled', () => {
|
|
65
|
+
const textarea = getTextarea(mount(<TextArea value="text" readonly={true} onChange={noop} />));
|
|
66
|
+
|
|
67
|
+
assert.strictEqual(textarea.readOnly, true);
|
|
68
|
+
assert.strictEqual(textarea.disabled, false);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('disables the textarea and the wrapper', () => {
|
|
72
|
+
const wrapper = mount(<TextArea value="text" disabled={true} onChange={noop} />);
|
|
73
|
+
|
|
74
|
+
assert.strictEqual(getTextarea(wrapper).disabled, true);
|
|
75
|
+
assert.ok(wrapper.find('.sd-input').hasClass('sd-input--disabled'));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('renders only the value in preview mode', () => {
|
|
79
|
+
const wrapper = mount(<TextArea label="Notes" value={'one\ntwo'} preview={true} onChange={noop} />);
|
|
80
|
+
|
|
81
|
+
assert.strictEqual(wrapper.find('textarea').length, 0);
|
|
82
|
+
assert.strictEqual(wrapper.find('.sd-input__textarea-preview').text(), 'one\ntwo');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('autoHeight', () => {
|
|
86
|
+
// jsdom does no layout, so `scrollHeight` is always 0 unless stubbed.
|
|
87
|
+
let scrollHeight: number;
|
|
88
|
+
|
|
89
|
+
beforeEach(() => {
|
|
90
|
+
scrollHeight = 0;
|
|
91
|
+
Object.defineProperty(window.HTMLTextAreaElement.prototype, 'scrollHeight', {
|
|
92
|
+
configurable: true,
|
|
93
|
+
get: () => scrollHeight,
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
afterEach(() => {
|
|
98
|
+
delete (window.HTMLTextAreaElement.prototype as any).scrollHeight;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('sets the height from the content on mount', () => {
|
|
102
|
+
scrollHeight = 120;
|
|
103
|
+
const textarea = getTextarea(mount(<TextArea value="text" autoHeight={true} onChange={noop} />));
|
|
104
|
+
|
|
105
|
+
assert.strictEqual(textarea.style.height, '120px');
|
|
106
|
+
assert.strictEqual(textarea.style.overflowY, 'hidden');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('adds the borders to the content height', () => {
|
|
110
|
+
scrollHeight = 120;
|
|
111
|
+
const prototype = window.HTMLTextAreaElement.prototype;
|
|
112
|
+
|
|
113
|
+
Object.defineProperty(prototype, 'offsetHeight', {configurable: true, get: () => 44});
|
|
114
|
+
Object.defineProperty(prototype, 'clientHeight', {configurable: true, get: () => 40});
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
const textarea = getTextarea(mount(<TextArea value="text" autoHeight={true} onChange={noop} />));
|
|
118
|
+
|
|
119
|
+
assert.strictEqual(textarea.style.height, '124px');
|
|
120
|
+
} finally {
|
|
121
|
+
delete (prototype as any).offsetHeight;
|
|
122
|
+
delete (prototype as any).clientHeight;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('follows the value when it changes', () => {
|
|
127
|
+
scrollHeight = 60;
|
|
128
|
+
const wrapper = mount(<TextArea value="a" autoHeight={true} onChange={noop} />);
|
|
129
|
+
|
|
130
|
+
scrollHeight = 140;
|
|
131
|
+
wrapper.setProps({value: 'a\nb\nc\nd'});
|
|
132
|
+
assert.strictEqual(getTextarea(wrapper).style.height, '140px');
|
|
133
|
+
|
|
134
|
+
scrollHeight = 40;
|
|
135
|
+
wrapper.setProps({value: ''});
|
|
136
|
+
assert.strictEqual(getTextarea(wrapper).style.height, '40px');
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('stops growing at maxRows and scrolls instead', () => {
|
|
140
|
+
scrollHeight = 60;
|
|
141
|
+
const wrapper = mount(<TextArea value="a" autoHeight={true} maxRows={4} onChange={noop} />);
|
|
142
|
+
const textarea = getTextarea(wrapper);
|
|
143
|
+
|
|
144
|
+
// The stylesheet is not loaded in jsdom; these mirror what it sets.
|
|
145
|
+
textarea.style.lineHeight = '20px';
|
|
146
|
+
textarea.style.paddingTop = '6px';
|
|
147
|
+
textarea.style.paddingBottom = '6px';
|
|
148
|
+
|
|
149
|
+
scrollHeight = 300;
|
|
150
|
+
wrapper.setProps({value: 'long text'});
|
|
151
|
+
|
|
152
|
+
assert.strictEqual(textarea.style.height, `${20 * 4 + 6 + 6}px`);
|
|
153
|
+
assert.strictEqual(textarea.style.overflowY, 'auto');
|
|
154
|
+
|
|
155
|
+
scrollHeight = 50;
|
|
156
|
+
wrapper.setProps({value: 'short'});
|
|
157
|
+
|
|
158
|
+
assert.strictEqual(textarea.style.height, '50px');
|
|
159
|
+
assert.strictEqual(textarea.style.overflowY, 'hidden');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('keeps the previous height while the field is hidden', () => {
|
|
163
|
+
scrollHeight = 80;
|
|
164
|
+
const wrapper = mount(<TextArea value="a" autoHeight={true} onChange={noop} />);
|
|
165
|
+
|
|
166
|
+
scrollHeight = 0;
|
|
167
|
+
wrapper.setProps({value: 'ab'});
|
|
168
|
+
|
|
169
|
+
assert.strictEqual(getTextarea(wrapper).style.height, '80px');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('leaves the height alone without autoHeight, and clears it when turned off', () => {
|
|
173
|
+
scrollHeight = 120;
|
|
174
|
+
const wrapper = mount(<TextArea value="a" onChange={noop} />);
|
|
175
|
+
|
|
176
|
+
assert.strictEqual(getTextarea(wrapper).style.height, '');
|
|
177
|
+
|
|
178
|
+
wrapper.setProps({autoHeight: true});
|
|
179
|
+
assert.strictEqual(getTextarea(wrapper).style.height, '120px');
|
|
180
|
+
|
|
181
|
+
wrapper.setProps({autoHeight: false});
|
|
182
|
+
assert.strictEqual(getTextarea(wrapper).style.height, '');
|
|
183
|
+
assert.strictEqual(getTextarea(wrapper).style.overflowY, '');
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type {Meta, StoryObj} from '@storybook/react';
|
|
3
|
+
import {TextArea} from './TextArea';
|
|
4
|
+
|
|
5
|
+
type ITextAreaProps = React.ComponentProps<typeof TextArea>;
|
|
6
|
+
|
|
7
|
+
// Holds the value so the controlled component can be typed into.
|
|
8
|
+
function StatefulTextArea(props: ITextAreaProps) {
|
|
9
|
+
const [value, setValue] = React.useState(props.value ?? '');
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<TextArea
|
|
13
|
+
{...props}
|
|
14
|
+
value={value}
|
|
15
|
+
onChange={(newValue) => {
|
|
16
|
+
setValue(newValue);
|
|
17
|
+
props.onChange(newValue);
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const noop = () => undefined;
|
|
24
|
+
|
|
25
|
+
const meta = {
|
|
26
|
+
title: 'Form Components/TextArea',
|
|
27
|
+
component: TextArea,
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
description: {
|
|
31
|
+
component:
|
|
32
|
+
'Multi-line text input with the same label, hint, error and character counter as `Input`. Use `autoHeight` to grow the field with its content, optionally capped by `maxRows`.',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
tags: ['autodocs'],
|
|
37
|
+
render: (args) => <StatefulTextArea {...args} />,
|
|
38
|
+
argTypes: {
|
|
39
|
+
value: {control: 'text', description: 'Current value'},
|
|
40
|
+
onChange: {action: 'changed', description: 'Called with the new string value'},
|
|
41
|
+
label: {control: 'text'},
|
|
42
|
+
info: {control: 'text', description: 'Hint shown under the field'},
|
|
43
|
+
error: {control: 'text', description: 'Error message; marks the field as invalid'},
|
|
44
|
+
placeholder: {control: 'text'},
|
|
45
|
+
maxLength: {control: 'number', description: 'Shows a character counter and stops input at this length'},
|
|
46
|
+
rows: {
|
|
47
|
+
control: 'number',
|
|
48
|
+
description: 'Number of visible text lines; the minimum height with autoHeight',
|
|
49
|
+
table: {defaultValue: {summary: '3'}},
|
|
50
|
+
},
|
|
51
|
+
autoHeight: {control: 'boolean', description: 'Grow with the content instead of scrolling'},
|
|
52
|
+
maxRows: {control: 'number', description: 'With autoHeight, stop growing at this many lines'},
|
|
53
|
+
required: {control: 'boolean'},
|
|
54
|
+
disabled: {control: 'boolean'},
|
|
55
|
+
readonly: {control: 'boolean'},
|
|
56
|
+
preview: {control: 'boolean'},
|
|
57
|
+
inlineLabel: {control: 'boolean'},
|
|
58
|
+
labelHidden: {control: 'boolean'},
|
|
59
|
+
fullWidth: {control: 'boolean', table: {defaultValue: {summary: 'true'}}},
|
|
60
|
+
boxedStyle: {control: 'boolean'},
|
|
61
|
+
boxedLable: {control: 'boolean'},
|
|
62
|
+
},
|
|
63
|
+
} satisfies Meta<typeof TextArea>;
|
|
64
|
+
|
|
65
|
+
export default meta;
|
|
66
|
+
type Story = StoryObj<typeof meta>;
|
|
67
|
+
|
|
68
|
+
export const Playground: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
label: 'Extra instructions',
|
|
71
|
+
info: 'Added to the prompt sent to the model.',
|
|
72
|
+
placeholder: 'Write in British English.',
|
|
73
|
+
value: '',
|
|
74
|
+
onChange: noop,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const AutoHeight: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
label: 'Grows with content',
|
|
81
|
+
info: 'Starts at 2 rows and stops growing at 6, then scrolls.',
|
|
82
|
+
rows: 2,
|
|
83
|
+
autoHeight: true,
|
|
84
|
+
maxRows: 6,
|
|
85
|
+
value: 'Line one\nLine two\nLine three',
|
|
86
|
+
onChange: noop,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const WithCharacterCounter: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
label: 'Short description',
|
|
93
|
+
maxLength: 140,
|
|
94
|
+
value: '',
|
|
95
|
+
onChange: noop,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const States: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
value: '',
|
|
102
|
+
onChange: noop,
|
|
103
|
+
},
|
|
104
|
+
render: () => (
|
|
105
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: '24px'}}>
|
|
106
|
+
<StatefulTextArea label="Required" required={true} onChange={noop} />
|
|
107
|
+
<StatefulTextArea label="Invalid" error="This field is required" required={true} onChange={noop} />
|
|
108
|
+
<StatefulTextArea label="Disabled" disabled={true} value="Cannot be changed" onChange={noop} />
|
|
109
|
+
<StatefulTextArea label="Read only" readonly={true} value="Can be selected and copied" onChange={noop} />
|
|
110
|
+
<StatefulTextArea label="Inline label" inlineLabel={true} onChange={noop} />
|
|
111
|
+
<StatefulTextArea label="Boxed" boxedStyle={true} boxedLable={true} onChange={noop} />
|
|
112
|
+
<TextArea label="Preview" preview={true} value={'First line\nSecond line'} onChange={noop} />
|
|
113
|
+
</div>
|
|
114
|
+
),
|
|
115
|
+
parameters: {
|
|
116
|
+
controls: {disable: true},
|
|
117
|
+
},
|
|
118
|
+
};
|