@wonderflow/react-components 2.40.0 → 3.0.0-beta.4
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/avatar/avatar.d.ts +15 -3
- package/avatar/avatar.js +4 -7
- package/avatar/avatar.module.css +1 -31
- package/button/button.d.ts +39 -4
- package/button/button.js +8 -12
- package/button/button.module.css +1 -154
- package/card/card.d.ts +25 -1
- package/card/card.js +4 -7
- package/card/card.module.css +1 -51
- package/chip/chip.d.ts +34 -3
- package/chip/chip.js +4 -6
- package/chip/chip.module.css +1 -60
- package/circular-progress/circular-progress.d.ts +33 -3
- package/circular-progress/circular-progress.js +4 -3
- package/circular-progress/circular-progress.module.css +1 -55
- package/clamp-text/clamp-text.d.ts +7 -1
- package/clamp-text/clamp-text.js +4 -4
- package/clamp-text/clamp-text.module.css +1 -7
- package/container/container.d.ts +6 -0
- package/container/container.js +4 -4
- package/container/container.module.css +1 -35
- package/core/basic.css +1 -49
- package/core/elevations.css +1 -56
- package/core/typography.css +1 -122
- package/core/{media.css → utils/media.css} +0 -0
- package/core/{vibrancy.css → utils/vibrancy.css} +0 -0
- package/core.css +1 -5
- package/disclosure/disclosure.d.ts +55 -3
- package/disclosure/disclosure.js +5 -8
- package/disclosure/disclosure.module.css +1 -93
- package/dropdown/dropdown.d.ts +21 -2
- package/dropdown/dropdown.js +20 -21
- package/dropdown/dropdown.module.css +1 -9
- package/dropdown/index.d.ts +2 -1
- package/dropdown/item/dropdown-item.d.ts +47 -0
- package/dropdown/item/dropdown-item.js +23 -0
- package/dropdown/item/dropdown-item.module.css +1 -0
- package/dropdown/item-checkbox/dropdown-item-checkbox.d.ts +11 -0
- package/dropdown/item-checkbox/dropdown-item-checkbox.js +5 -0
- package/dropdown/menu/dropdown-menu.d.ts +13 -0
- package/dropdown/menu/dropdown-menu.js +13 -0
- package/dropdown/menu/dropdown-menu.module.css +1 -0
- package/elevator/elevator.d.ts +13 -2
- package/elevator/elevator.js +6 -5
- package/grid/grid.d.ts +32 -2
- package/grid/grid.js +5 -4
- package/grid/grid.module.css +1 -29
- package/grid/index.d.ts +1 -1
- package/grid/item/grid-item.d.ts +41 -0
- package/grid/item/grid-item.js +12 -0
- package/grid/item/grid-item.module.css +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useFocusWithin.d.ts +20 -0
- package/hooks/useFocusWithin.js +37 -0
- package/icon/icon.d.ts +29 -3
- package/icon/icon.js +4 -4
- package/icon-button/icon-button.d.ts +1 -1
- package/icon-button/icon-button.js +3 -3
- package/icon-button/icon-button.module.css +1 -22
- package/icons/svgs/16/arrow-down-16.svg +3 -0
- package/icons/svgs/16/arrow-down-left-16.svg +3 -0
- package/icons/svgs/16/arrow-down-right-16.svg +3 -0
- package/icons/svgs/16/arrow-down-to-bracket-16.svg +3 -0
- package/icons/svgs/16/arrow-left-16.svg +3 -0
- package/icons/svgs/16/arrow-right-16.svg +3 -0
- package/icons/svgs/16/arrow-rotate-right-16.svg +3 -0
- package/icons/svgs/16/arrow-trend-down-16.svg +3 -0
- package/icons/svgs/16/arrow-trend-up-16.svg +3 -0
- package/icons/svgs/16/arrow-up-16.svg +3 -0
- package/icons/svgs/16/arrow-up-left-16.svg +3 -0
- package/icons/svgs/16/arrow-up-right-16.svg +3 -0
- package/icons/svgs/16/backward-step-16.svg +3 -0
- package/icons/svgs/16/ban-16.svg +3 -0
- package/icons/svgs/16/bars-16.svg +3 -0
- package/icons/svgs/16/bars-sort-down-16.svg +3 -0
- package/icons/svgs/16/bars-sort-up-16.svg +3 -0
- package/icons/svgs/16/bell-16.svg +3 -0
- package/icons/svgs/16/bookmark-16.svg +3 -0
- package/icons/svgs/16/calendar-16.svg +3 -0
- package/icons/svgs/16/calendar-plus-16.svg +3 -0
- package/icons/svgs/16/cart-shopping-16.svg +3 -0
- package/icons/svgs/16/check-16.svg +3 -0
- package/icons/svgs/16/chevron-down-16.svg +3 -0
- package/icons/svgs/16/chevron-left-16.svg +3 -0
- package/icons/svgs/16/chevron-right-16.svg +3 -0
- package/icons/svgs/16/chevron-up-16.svg +3 -0
- package/icons/svgs/16/circle-16.svg +3 -0
- package/icons/svgs/16/circle-check-16.svg +3 -0
- package/icons/svgs/16/circle-exclamation-16.svg +3 -0
- package/icons/svgs/16/circle-info-16.svg +3 -0
- package/icons/svgs/16/circle-question-16.svg +3 -0
- package/icons/svgs/16/circle-x-16.svg +3 -0
- package/icons/svgs/16/clock-rotate-left-16.svg +3 -0
- package/icons/svgs/16/code-16.svg +3 -0
- package/icons/svgs/16/comment-16.svg +3 -0
- package/icons/svgs/16/compass-16.svg +3 -0
- package/icons/svgs/16/crown-16.svg +3 -0
- package/icons/svgs/16/earth-europa-16.svg +3 -0
- package/icons/svgs/16/envelope-16.svg +3 -0
- package/icons/svgs/16/eye-16.svg +3 -0
- package/icons/svgs/16/eye-slash-16.svg +10 -0
- package/icons/svgs/16/facebook-16.svg +3 -0
- package/icons/svgs/16/file-16.svg +3 -0
- package/icons/svgs/16/file-alt-16.svg +3 -0
- package/icons/svgs/16/file-image-16.svg +3 -0
- package/icons/svgs/16/file-pdf-16.svg +3 -0
- package/icons/svgs/16/file-xmark-16.svg +3 -0
- package/icons/svgs/16/filter-16.svg +3 -0
- package/icons/svgs/16/forward-step-16.svg +3 -0
- package/icons/svgs/16/frown-16.svg +3 -0
- package/icons/svgs/16/gear-16.svg +3 -0
- package/icons/svgs/16/github-16.svg +3 -0
- package/icons/svgs/16/graduation-cap-16.svg +10 -0
- package/icons/svgs/16/grid-2-16.svg +3 -0
- package/icons/svgs/16/grip-vertical-16.svg +3 -0
- package/icons/svgs/16/hand-pointer-16.svg +3 -0
- package/icons/svgs/16/house-16.svg +3 -0
- package/icons/svgs/16/layer-group-16.svg +3 -0
- package/icons/svgs/16/link-16.svg +3 -0
- package/icons/svgs/16/linkedin-16.svg +3 -0
- package/icons/svgs/16/lock-16.svg +3 -0
- package/icons/svgs/16/lock-open-16.svg +10 -0
- package/icons/svgs/16/magnifying-glass-16.svg +3 -0
- package/icons/svgs/16/meh-16.svg +3 -0
- package/icons/svgs/16/message-16.svg +3 -0
- package/icons/svgs/16/minus-16.svg +3 -0
- package/icons/svgs/16/moon-16.svg +3 -0
- package/icons/svgs/16/nps-16.svg +3 -0
- package/icons/svgs/16/pause-16.svg +3 -0
- package/icons/svgs/16/pc-16.svg +3 -0
- package/icons/svgs/16/play-16.svg +3 -0
- package/icons/svgs/16/plus-16.svg +3 -0
- package/icons/svgs/16/rectangle-barcode-16.svg +3 -0
- package/icons/svgs/16/right-from-bracket-16.svg +3 -0
- package/icons/svgs/16/share-from-square-16.svg +10 -0
- package/icons/svgs/16/signal-stream-16.svg +3 -0
- package/icons/svgs/16/smile-16.svg +3 -0
- package/icons/svgs/16/smile-rotate-right-16.svg +10 -0
- package/icons/svgs/16/sort-16.svg +3 -0
- package/icons/svgs/16/sort-alt-16.svg +3 -0
- package/icons/svgs/16/sort-down-16.svg +3 -0
- package/icons/svgs/16/sort-left-16.svg +3 -0
- package/icons/svgs/16/sort-right-16.svg +3 -0
- package/icons/svgs/16/sort-up-16.svg +3 -0
- package/icons/svgs/16/star-16.svg +3 -0
- package/icons/svgs/16/stop-16.svg +3 -0
- package/icons/svgs/16/sun-bright-16.svg +3 -0
- package/icons/svgs/16/tags-16.svg +3 -0
- package/icons/svgs/16/text-slash-16.svg +10 -0
- package/icons/svgs/16/thumbs-down-16.svg +3 -0
- package/icons/svgs/16/thumbs-up-16.svg +3 -0
- package/icons/svgs/16/thumbtack-16.svg +3 -0
- package/icons/svgs/16/triangle-exclamation-16.svg +3 -0
- package/icons/svgs/16/turn-down-right-16.svg +3 -0
- package/icons/svgs/16/twitter-16.svg +10 -0
- package/icons/svgs/16/user-16.svg +3 -0
- package/icons/svgs/16/wave-sine-16.svg +3 -0
- package/icons/svgs/16/xmark-16.svg +3 -0
- package/icons/svgs/24/arrow-down-24.svg +3 -0
- package/icons/svgs/24/arrow-down-left-24.svg +3 -0
- package/icons/svgs/24/arrow-down-right-24.svg +3 -0
- package/icons/svgs/24/arrow-down-to-bracket-24.svg +3 -0
- package/icons/svgs/24/arrow-left-24.svg +3 -0
- package/icons/svgs/24/arrow-right-24.svg +3 -0
- package/icons/svgs/24/arrow-rotate-right-24.svg +3 -0
- package/icons/svgs/24/arrow-trend-down-24.svg +3 -0
- package/icons/svgs/24/arrow-trend-up-24.svg +3 -0
- package/icons/svgs/24/arrow-up-24.svg +3 -0
- package/icons/svgs/24/arrow-up-left-24.svg +3 -0
- package/icons/svgs/24/arrow-up-right-24.svg +3 -0
- package/icons/svgs/24/backward-step-24.svg +3 -0
- package/icons/svgs/24/ban-24.svg +3 -0
- package/icons/svgs/24/bars-24.svg +3 -0
- package/icons/svgs/24/bars-sort-down-24.svg +3 -0
- package/icons/svgs/24/bars-sort-up-24.svg +3 -0
- package/icons/svgs/24/bell-24.svg +3 -0
- package/icons/svgs/24/bookmark-24.svg +3 -0
- package/icons/svgs/24/calendar-24.svg +3 -0
- package/icons/svgs/24/calendar-plus-24.svg +3 -0
- package/icons/svgs/24/cart-shopping-24.svg +3 -0
- package/icons/svgs/24/check-24.svg +3 -0
- package/icons/svgs/24/chevron-down-24.svg +3 -0
- package/icons/svgs/24/chevron-left-24.svg +3 -0
- package/icons/svgs/24/chevron-right-24.svg +3 -0
- package/icons/svgs/24/chevron-up-24.svg +3 -0
- package/icons/svgs/24/circle-24.svg +3 -0
- package/icons/svgs/24/circle-check-24.svg +3 -0
- package/icons/svgs/24/circle-exclamation-24.svg +3 -0
- package/icons/svgs/24/circle-info-24.svg +3 -0
- package/icons/svgs/24/circle-question-24.svg +3 -0
- package/icons/svgs/24/circle-x-24.svg +3 -0
- package/icons/svgs/24/clock-rotate-left-24.svg +3 -0
- package/icons/svgs/24/code-24.svg +3 -0
- package/icons/svgs/24/comment-24.svg +3 -0
- package/icons/svgs/24/compass-24.svg +3 -0
- package/icons/svgs/24/crown-24.svg +3 -0
- package/icons/svgs/24/earth-europa-24.svg +3 -0
- package/icons/svgs/24/envelope-24.svg +3 -0
- package/icons/svgs/24/eye-24.svg +3 -0
- package/icons/svgs/24/eye-slash-24.svg +3 -0
- package/icons/svgs/24/facebook-24.svg +3 -0
- package/icons/svgs/24/file-24.svg +3 -0
- package/icons/svgs/24/file-alt-24.svg +3 -0
- package/icons/svgs/24/file-image-24.svg +3 -0
- package/icons/svgs/24/file-pdf-24.svg +3 -0
- package/icons/svgs/24/file-xmark-24.svg +3 -0
- package/icons/svgs/24/filter-24.svg +3 -0
- package/icons/svgs/24/forward-step-24.svg +3 -0
- package/icons/svgs/24/frown-24.svg +3 -0
- package/icons/svgs/24/gear-24.svg +3 -0
- package/icons/svgs/24/github-24.svg +3 -0
- package/icons/svgs/24/graduation-cap-24.svg +3 -0
- package/icons/svgs/24/grid-2-24.svg +3 -0
- package/icons/svgs/24/grip-vertical-24.svg +3 -0
- package/icons/svgs/24/hand-pointer-24.svg +3 -0
- package/icons/svgs/24/house-24.svg +3 -0
- package/icons/svgs/24/layer-group-24.svg +3 -0
- package/icons/svgs/24/link-24.svg +3 -0
- package/icons/svgs/24/linkedin-24.svg +3 -0
- package/icons/svgs/24/lock-24.svg +3 -0
- package/icons/svgs/24/lock-open-24.svg +3 -0
- package/icons/svgs/24/magnifying-glass-24.svg +3 -0
- package/icons/svgs/24/meh-24.svg +3 -0
- package/icons/svgs/24/message-24.svg +3 -0
- package/icons/svgs/24/minus-24.svg +3 -0
- package/icons/svgs/24/moon-24.svg +3 -0
- package/icons/svgs/24/nps-24.svg +3 -0
- package/icons/svgs/24/pause-24.svg +3 -0
- package/icons/svgs/24/pc-24.svg +3 -0
- package/icons/svgs/24/play-24.svg +3 -0
- package/icons/svgs/24/plus-24.svg +3 -0
- package/icons/svgs/24/rectangle-barcode-24.svg +3 -0
- package/icons/svgs/24/right-from-bracket-24.svg +3 -0
- package/icons/svgs/24/share-from-square-24.svg +3 -0
- package/icons/svgs/24/signal-stream-24.svg +3 -0
- package/icons/svgs/24/smile-24.svg +3 -0
- package/icons/svgs/24/smile-rotate-right-24.svg +3 -0
- package/icons/svgs/24/sort-24.svg +3 -0
- package/icons/svgs/24/sort-alt-24.svg +3 -0
- package/icons/svgs/24/sort-down-24.svg +3 -0
- package/icons/svgs/24/sort-left-24.svg +3 -0
- package/icons/svgs/24/sort-right-24.svg +3 -0
- package/icons/svgs/24/sort-up-24.svg +3 -0
- package/icons/svgs/24/star-24.svg +3 -0
- package/icons/svgs/24/stop-24.svg +3 -0
- package/icons/svgs/24/sun-bright-24.svg +3 -0
- package/icons/svgs/24/tags-24.svg +3 -0
- package/icons/svgs/24/text-slash-24.svg +3 -0
- package/icons/svgs/24/thumbs-down-24.svg +3 -0
- package/icons/svgs/24/thumbs-up-24.svg +3 -0
- package/icons/svgs/24/thumbtack-24.svg +3 -0
- package/icons/svgs/24/triangle-exclamation-24.svg +3 -0
- package/icons/svgs/24/turn-down-right-24.svg +3 -0
- package/icons/svgs/24/twitter-24.svg +3 -0
- package/icons/svgs/24/user-24.svg +3 -0
- package/icons/svgs/24/wave-sine-24.svg +3 -0
- package/icons/svgs/24/xmark-24.svg +3 -0
- package/index.d.ts +78 -40
- package/index.js +3 -4
- package/info-state/info-state.d.ts +57 -4
- package/info-state/info-state.js +4 -10
- package/info-state/info-state.module.css +1 -77
- package/input-group/input-group.d.ts +33 -3
- package/input-group/input-group.js +11 -15
- package/input-group/input-group.module.css +1 -36
- package/linear-progress/linear-progress.d.ts +34 -4
- package/linear-progress/linear-progress.js +7 -8
- package/linear-progress/linear-progress.module.css +1 -81
- package/list/list.d.ts +14 -1
- package/list/list.js +4 -6
- package/list/list.module.css +1 -55
- package/masonry/masonry.d.ts +24 -2
- package/masonry/masonry.js +6 -5
- package/masonry/masonry.module.css +1 -14
- package/modal/content/modal-content.d.ts +25 -0
- package/modal/content/modal-content.js +11 -0
- package/modal/content/modal-content.module.css +1 -0
- package/modal/index.d.ts +0 -1
- package/modal/index.js +0 -1
- package/modal/modal.d.ts +7 -5
- package/modal/modal.js +10 -25
- package/modal/modal.module.css +1 -48
- package/overlay-container/index.d.ts +3 -0
- package/overlay-container/index.js +2 -0
- package/overlay-container/overlay-container.d.ts +29 -0
- package/overlay-container/overlay-container.js +17 -0
- package/overlay-container/overlay-container.module.css +1 -0
- package/overlay-container/overlay-context.d.ts +9 -0
- package/overlay-container/overlay-context.js +23 -0
- package/package.json +86 -37
- package/pagination/pagination.d.ts +26 -4
- package/pagination/pagination.js +6 -5
- package/pagination/pagination.module.css +1 -31
- package/polymorphic/polymorphic.d.ts +26 -1
- package/prose/prose.js +4 -4
- package/prose/prose.module.css +1 -23
- package/select/select.d.ts +45 -3
- package/select/select.js +4 -7
- package/select/select.module.css +1 -108
- package/selection-controls/checkbox.d.ts +31 -3
- package/selection-controls/checkbox.js +4 -3
- package/selection-controls/radio.d.ts +23 -3
- package/selection-controls/radio.js +4 -3
- package/selection-controls/selection-controls.module.css +1 -119
- package/selection-controls/toggle.d.ts +23 -3
- package/selection-controls/toggle.js +4 -3
- package/separator/index.d.ts +2 -1
- package/separator/index.js +1 -1
- package/separator/separator.d.ts +3 -3
- package/separator/separator.js +5 -5
- package/separator/separator.module.css +1 -6
- package/skeleton-block/skeleton-block.d.ts +5 -1
- package/skeleton-block/skeleton-block.js +3 -3
- package/slider/slider.d.ts +65 -3
- package/slider/slider.js +4 -8
- package/slider/slider.module.css +1 -101
- package/snackbar/snackbar.d.ts +27 -1
- package/snackbar/snackbar.js +4 -12
- package/snackbar/snackbar.module.css +1 -46
- package/spinner/spinner.d.ts +16 -1
- package/spinner/spinner.js +7 -9
- package/split-button/split-button.d.ts +4 -2
- package/split-button/split-button.js +4 -6
- package/split-button/split-button.module.css +1 -28
- package/stack/stack.d.ts +33 -0
- package/stack/stack.js +4 -4
- package/stack/stack.module.css +1 -27
- package/star-meter/star-meter.d.ts +22 -1
- package/star-meter/star-meter.js +8 -16
- package/star-meter/star-meter.module.css +1 -30
- package/tab/primitive-tab.d.ts +1 -1
- package/tab/primitive-tab.js +3 -3
- package/tab/tab-item.d.ts +17 -3
- package/tab/tab-item.js +4 -5
- package/tab/tab-list.d.ts +6 -2
- package/tab/tab-list.js +3 -3
- package/tab/tab-panel.d.ts +25 -3
- package/tab/tab-panel.js +5 -3
- package/tab/tab.d.ts +18 -1
- package/tab/tab.js +8 -9
- package/tab/tab.module.css +1 -103
- package/table/table.d.ts +16 -3
- package/table/table.js +9 -12
- package/table/table.module.css +1 -32
- package/text/text.d.ts +27 -1
- package/text/text.js +4 -4
- package/text/text.module.css +1 -89
- package/textfield/base-field/base-field.d.ts +10 -0
- package/textfield/base-field/base-field.js +4 -3
- package/textfield/base-field/base-field.module.css +1 -119
- package/textfield/base-field/index.d.ts +1 -1
- package/textfield/textfield.d.ts +78 -8
- package/textfield/textfield.js +6 -10
- package/textfield/textfield.module.css +1 -103
- package/themes/dark.css +1 -1
- package/themes/light.css +1 -1
- package/themes.css +1 -143
- package/title/title.d.ts +21 -1
- package/title/title.js +4 -4
- package/title/title.module.css +1 -85
- package/toggle-button/toggle-button.d.ts +10 -0
- package/toggle-button/toggle-button.js +7 -7
- package/toggle-button/toggle-button.module.css +1 -51
- package/tooltip/tooltip.d.ts +34 -3
- package/tooltip/tooltip.js +9 -13
- package/tooltip/tooltip.module.css +1 -72
- package/dropdown/dropdown-item.d.ts +0 -21
- package/dropdown/dropdown-item.js +0 -26
- package/dropdown/dropdown-item.module.css +0 -63
- package/dropdown/dropdown-menu.d.ts +0 -7
- package/dropdown/dropdown-menu.js +0 -18
- package/dropdown/dropdown-menu.module.css +0 -13
- package/grid/grid-item.d.ts +0 -11
- package/grid/grid-item.js +0 -11
- package/modal/modal-content.d.ts +0 -7
- package/modal/modal-content.js +0 -15
- package/modal/modal-content.module.css +0 -40
- package/modal/modal-context.d.ts +0 -9
- package/modal/modal-context.js +0 -13
- package/theme-switch/index.d.ts +0 -2
- package/theme-switch/index.js +0 -1
- package/theme-switch/theme-switch.d.ts +0 -9
- package/theme-switch/theme-switch.js +0 -14
package/table/table.d.ts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { TableProps as ReactTableProps } from 'react-data-table-component';
|
|
3
3
|
import { IconNames } from '../icons/types';
|
|
4
4
|
export declare type TableProps<T> = ReactTableProps<T> & {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A react component that add additional content when the row is expanded.
|
|
7
|
+
* By passing this prop, the row will be expandable.
|
|
8
|
+
*/
|
|
9
|
+
ExpandableRowsComponent?: FC<{
|
|
6
10
|
data: T;
|
|
7
11
|
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Set the icon to use when the expandable rows are collapsed.
|
|
14
|
+
*/
|
|
8
15
|
collapsedRowIcon?: IconNames;
|
|
16
|
+
/**
|
|
17
|
+
* Set the icon to use when the expandable rows are expanded.
|
|
18
|
+
*/
|
|
9
19
|
expandedRowIcon?: IconNames;
|
|
20
|
+
/**
|
|
21
|
+
* Set minimum height for each row.
|
|
22
|
+
*/
|
|
10
23
|
minRowHeight?: string;
|
|
11
24
|
};
|
|
12
|
-
export declare const Table: <T>({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination, responsive, fixedHeader, noHeader, paginationPerPage, striped, theme, collapsedRowIcon, expandedRowIcon, minRowHeight, ...
|
|
25
|
+
export declare const Table: <T>({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination, responsive, fixedHeader, noHeader, paginationPerPage, striped, theme, collapsedRowIcon, expandedRowIcon, minRowHeight, ...otherProps }: TableProps<T>) => JSX.Element;
|
package/table/table.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import ReactDataTable from 'react-data-table-component';
|
|
3
4
|
import { Icon, SkeletonBlock, Checkbox } from '..';
|
|
4
5
|
import { customStyle } from './theme';
|
|
5
|
-
import {
|
|
6
|
+
import { SortIcon, ExpandWrapper, ExpandContent } from './table.module.css';
|
|
6
7
|
import clsx from 'clsx';
|
|
7
|
-
export const Table = ({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination = false, responsive = true, fixedHeader = false, noHeader = true, paginationPerPage = 8, striped = false, theme = 'default', collapsedRowIcon = 'chevron-right', expandedRowIcon = 'chevron-down', minRowHeight = '48px', ...
|
|
8
|
+
export const Table = ({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination = false, responsive = true, fixedHeader = false, noHeader = true, paginationPerPage = 8, striped = false, theme = 'default', collapsedRowIcon = 'chevron-right', expandedRowIcon = 'chevron-down', minRowHeight = '48px', ...otherProps }) => {
|
|
8
9
|
const selectProps = {
|
|
9
10
|
indeterminate: (isIndeterminate) => isIndeterminate,
|
|
10
11
|
dimension: 'small'
|
|
11
12
|
};
|
|
12
|
-
const ExpandComponent = useMemo(() => ({ data: innerData }) => (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
collapsed: React.createElement(Icon, { name: collapsedRowIcon, fill: "var(--global-foreground)", dimension: 16 }),
|
|
18
|
-
expanded: React.createElement(Icon, { name: expandedRowIcon, fill: "var(--global-foreground)", dimension: 16 })
|
|
19
|
-
}, paginationIconFirstPage: React.createElement(Icon, { name: "backward-step", dimension: 24 }), paginationIconPrevious: React.createElement(Icon, { name: "chevron-left", dimension: 24 }), paginationIconNext: React.createElement(Icon, { name: "chevron-right", dimension: 24 }), paginationIconLastPage: React.createElement(Icon, { name: "forward-step", dimension: 24 }), sortIcon: (React.createElement("span", { className: SortIcon },
|
|
20
|
-
React.createElement(Icon, { name: "arrow-up", dimension: 16 }))), ...props })));
|
|
13
|
+
const ExpandComponent = useMemo(() => ({ data: innerData }) => (_jsx("div", { className: ExpandWrapper, children: _jsx("div", { className: ExpandContent, children: ExpandableRowsComponent ? _jsx(ExpandableRowsComponent, { data: innerData }, void 0) : null }, void 0) }, void 0)), [ExpandableRowsComponent]);
|
|
14
|
+
return (_jsx(ReactDataTable, { className: clsx(className), pagination: pagination, responsive: responsive, fixedHeader: fixedHeader, paginationPerPage: paginationPerPage, expandableRows: Boolean(ExpandableRowsComponent), expandOnRowClicked: Boolean(ExpandableRowsComponent), expandableRowsComponent: ExpandComponent, theme: theme, noHeader: noHeader, progressComponent: progressComponent || _jsx("div", { style: { width: '100%' }, children: _jsx(SkeletonBlock, { height: 40, count: 8 }, void 0) }, void 0), striped: striped, customStyles: customStyles || customStyle(minRowHeight), selectableRowsComponent: Checkbox, selectableRowsComponentProps: selectProps, expandableIcon: {
|
|
15
|
+
collapsed: _jsx(Icon, { name: collapsedRowIcon, fill: "var(--global-foreground)", dimension: 16 }, void 0),
|
|
16
|
+
expanded: _jsx(Icon, { name: expandedRowIcon, fill: "var(--global-foreground)", dimension: 16 }, void 0)
|
|
17
|
+
}, paginationIconFirstPage: _jsx(Icon, { name: "backward-step", dimension: 24 }, void 0), paginationIconPrevious: _jsx(Icon, { name: "chevron-left", dimension: 24 }, void 0), paginationIconNext: _jsx(Icon, { name: "chevron-right", dimension: 24 }, void 0), paginationIconLastPage: _jsx(Icon, { name: "forward-step", dimension: 24 }, void 0), sortIcon: (_jsx("span", { className: SortIcon, children: _jsx(Icon, { name: "arrow-up" }, void 0) }, void 0)), ...otherProps }, void 0));
|
|
21
18
|
};
|
package/table/table.module.css
CHANGED
|
@@ -1,32 +1 @@
|
|
|
1
|
-
.
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.SortIcon {
|
|
6
|
-
margin-left: 4px;
|
|
7
|
-
transform: scale(0.7);
|
|
8
|
-
display: block;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.ExpandWrapper {
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.ExpandContent {
|
|
16
|
-
--fade-from-y: -5px;
|
|
17
|
-
|
|
18
|
-
animation: fade-in env(--duration-200);
|
|
19
|
-
animation-timing-function: env(--easing-entrance);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@keyframes fade-in {
|
|
23
|
-
0% {
|
|
24
|
-
opacity: 0%;
|
|
25
|
-
transform: translate(var(--fade-from-x, 0), var(--fade-from-y, 0));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
100% {
|
|
29
|
-
opacity: unset;
|
|
30
|
-
transform: none;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
.SortIcon{display:block;margin-left:4px;transform:scale(.7)}.ExpandWrapper{overflow:hidden}.ExpandContent{--fade-from-y:-5px;animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1)}@keyframes fade-in{0%{opacity:0;transform:translate(var(--fade-from-x,0),var(--fade-from-y,0))}to{opacity:unset;transform:none}}
|
package/text/text.d.ts
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
import { Polymorphic } from '../';
|
|
2
2
|
import { TokensTypes } from '@wonderflow/tokens/platforms/web/types';
|
|
3
3
|
export declare type TextProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Set the dimension of the text from one of
|
|
6
|
+
* the typography system values
|
|
7
|
+
*/
|
|
4
8
|
size?: TokensTypes['font']['size'];
|
|
9
|
+
/**
|
|
10
|
+
* Set the sentiment of the text.
|
|
11
|
+
*/
|
|
5
12
|
sentiment?: 'positive' | 'informative' | 'danger' | 'warning';
|
|
13
|
+
/**
|
|
14
|
+
* Set the dimmed color of the text. To keep readability and contrast,
|
|
15
|
+
* you can only use dimmed colors `5`, `6`, and `7`.
|
|
16
|
+
*/
|
|
6
17
|
dimmed?: 5 | 6 | 7;
|
|
18
|
+
/**
|
|
19
|
+
* Set the font weight of the text. The values are
|
|
20
|
+
* consistent with the typography system.
|
|
21
|
+
*/
|
|
7
22
|
weight?: 'thin' | 'bold';
|
|
8
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Set the maximum width of the text after which it will wrap.
|
|
25
|
+
*/
|
|
9
26
|
maxWidth?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Set the text alignment of the text. This is a logical property
|
|
29
|
+
* based on the direction of the text.
|
|
30
|
+
*/
|
|
10
31
|
textAlign?: 'start' | 'center' | 'end';
|
|
32
|
+
/**
|
|
33
|
+
* Enable or disable the responsiveness of the text. If disabled,
|
|
34
|
+
* the text will be always the same size across all breakpoints.
|
|
35
|
+
*/
|
|
36
|
+
responsive?: boolean;
|
|
11
37
|
};
|
|
12
38
|
declare type PolymorphicText = Polymorphic.ForwardRefComponent<'p', TextProps>;
|
|
13
39
|
export declare const Text: PolymorphicText;
|
package/text/text.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
2
3
|
import { Text as TextClass } from './text.module.css';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
|
-
export const Text = forwardRef(({ children, className, size, sentiment, dimmed, weight, maxWidth, textAlign = 'start', as: Wrapper = 'p',
|
|
5
|
+
export const Text = forwardRef(({ children, className, size, sentiment, dimmed, weight, maxWidth, textAlign = 'start', as: Wrapper = 'p', responsive = true, style, ...otherProps }, forwardedRef) => {
|
|
5
6
|
const dynamicStyle = {
|
|
6
7
|
'--maxW': maxWidth,
|
|
7
8
|
'--tAlign': textAlign
|
|
8
9
|
};
|
|
9
|
-
return (
|
|
10
|
+
return (_jsx(Wrapper, { ref: forwardedRef, "data-text-size": size, "data-text-weight": weight, "data-text-sentiment": sentiment, "data-text-dimmed": dimmed, "data-text-responsive": responsive, className: clsx(TextClass, className), style: { ...dynamicStyle, ...style }, ...otherProps, children: children }, void 0));
|
|
10
11
|
});
|
|
11
|
-
Text.displayName = 'Text';
|
package/text/text.module.css
CHANGED
|
@@ -1,89 +1 @@
|
|
|
1
|
-
.Text {
|
|
2
|
-
line-height: 1.5;
|
|
3
|
-
min-block-size: 0.01vh;
|
|
4
|
-
font-size: var(--fluid-type-max);
|
|
5
|
-
max-inline-size: var(--maxW, initial);
|
|
6
|
-
text-align: var(--tAlign);
|
|
7
|
-
|
|
8
|
-
&[data-text-is-fluid='true'] {
|
|
9
|
-
font-size:
|
|
10
|
-
clamp(
|
|
11
|
-
var(--fluid-type-min, env(--font-size-16)),
|
|
12
|
-
var(--fluid-type-factor, calc(0.6rem + 0.92vw)),
|
|
13
|
-
var(--fluid-type-max, 1rem)
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* Colors */
|
|
18
|
-
|
|
19
|
-
&[data-text-dimmed='5'] {
|
|
20
|
-
color: var(--dimmed-5);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&[data-text-dimmed='6'] {
|
|
24
|
-
color: var(--dimmed-6);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&[data-text-dimmed='7'] {
|
|
28
|
-
color: var(--dimmed-7);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&[data-text-sentiment='positive'] {
|
|
32
|
-
color: var(--highlight-green-foreground);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&[data-text-sentiment='informative'] {
|
|
36
|
-
color: var(--highlight-blue-foreground);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&[data-text-sentiment='danger'] {
|
|
40
|
-
color: var(--highlight-red-foreground);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&[data-text-sentiment='warning'] {
|
|
44
|
-
color: var(--highlight-yellow-foreground);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/* Sizes */
|
|
48
|
-
|
|
49
|
-
&[data-text-size='14'] {
|
|
50
|
-
font-size: env(--font-size-14);
|
|
51
|
-
line-height: 1.2;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&[data-text-size='16'] {
|
|
55
|
-
--fluid-type-min: env(--font-size-14);
|
|
56
|
-
--fluid-type-factor: calc(0.69rem + 0.44vw);
|
|
57
|
-
--fluid-type-max: env(--font-size-16);
|
|
58
|
-
|
|
59
|
-
line-height: 1.2;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&[data-text-size='18'] {
|
|
63
|
-
--fluid-type-min: env(--font-size-16);
|
|
64
|
-
--fluid-type-factor: calc(0.79rem + 0.48vw);
|
|
65
|
-
--fluid-type-max: env(--font-size-18);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&[data-text-size='22'] {
|
|
69
|
-
--fluid-type-min: env(--font-size-18);
|
|
70
|
-
--fluid-type-factor: calc(0.84rem + 0.88vw);
|
|
71
|
-
--fluid-type-max: env(--font-size-22);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&[data-text-size='28'] {
|
|
75
|
-
--fluid-type-min: env(--font-size-22);
|
|
76
|
-
--fluid-type-factor: calc(0.98rem + 1.32vw);
|
|
77
|
-
--fluid-type-max: env(--font-size-28);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/* Weights */
|
|
81
|
-
|
|
82
|
-
&[data-text-weight='thin'] {
|
|
83
|
-
font-weight: 100;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&[data-text-weight='bold'] {
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
1
|
+
.Text{font-size:var(--fs-max);line-height:1.5;max-inline-size:var(--maxW,initial);min-block-size:.01vh;text-align:var(--tAlign)}.Text[data-text-dimmed="5"]{color:var(--dimmed-5)}.Text[data-text-dimmed="6"]{color:var(--dimmed-6)}.Text[data-text-dimmed="7"]{color:var(--dimmed-7)}.Text[data-text-sentiment=positive]{color:var(--highlight-green-foreground)}.Text[data-text-sentiment=informative]{color:var(--highlight-blue-foreground)}.Text[data-text-sentiment=danger]{color:var(--highlight-red-foreground)}.Text[data-text-sentiment=warning]{color:var(--highlight-yellow-foreground)}.Text[data-text-size="14"]{font-size:.78rem;line-height:1.2}.Text[data-text-size="16"]{--fs-min:0.78rem;--fs-max:0.89rem;line-height:1.2}.Text[data-text-size="18"]{--fs-min:0.89rem;--fs-max:1.00rem}.Text[data-text-size="22"]{--fs-min:1.00rem;--fs-max:1.22rem}.Text[data-text-size="28"]{--fs-min:1.22rem;--fs-max:1.56rem}.Text[data-text-weight=thin]{font-weight:100}.Text[data-text-weight=bold]{font-weight:600}.Text[data-text-responsive=true]{font-size:var(--fs-min)}@media (min-width:48em){.Text[data-text-responsive=true]{font-size:var(--fs-max)}}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { Polymorphic } from '../../';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare type PrimitiveInputType = HTMLInputElement | HTMLTextAreaElement;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
3
10
|
export declare type BaseFieldProps = InputHTMLAttributes<HTMLInputElement> & InputHTMLAttributes<HTMLTextAreaElement> & {
|
|
4
11
|
invalid?: boolean;
|
|
5
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
6
16
|
declare type PolymorphicBaseField = Polymorphic.ForwardRefComponent<'input', BaseFieldProps>;
|
|
7
17
|
export declare const BaseField: PolymorphicBaseField;
|
|
8
18
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
2
3
|
import { BaseField as BaseFieldClass } from './base-field.module.css';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
|
-
export const BaseField = forwardRef(({ as: Wrapper = 'input', invalid, className, ...
|
|
5
|
-
return (
|
|
5
|
+
export const BaseField = forwardRef(({ as: Wrapper = 'input', invalid, className, ...otherProps }, forwardedRef) => {
|
|
6
|
+
return (_jsx(Wrapper, { ref: forwardedRef, "data-basefield-invalid": invalid, className: clsx(BaseFieldClass, className), ...otherProps }, void 0));
|
|
6
7
|
});
|
|
7
8
|
BaseField.displayName = 'BaseField';
|
|
@@ -1,119 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.BaseField {
|
|
4
|
-
margin: 0;
|
|
5
|
-
text-overflow: ellipsis;
|
|
6
|
-
font-size: var(--font-size);
|
|
7
|
-
border-radius: env(--radius-4);
|
|
8
|
-
font-family: inherit;
|
|
9
|
-
line-height: 1;
|
|
10
|
-
appearance: none;
|
|
11
|
-
inline-size: 100%;
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
color: inherit;
|
|
15
|
-
background-color: var(--global-background);
|
|
16
|
-
border: 1px solid var(--dimmed-2);
|
|
17
|
-
block-size: var(--field-height);
|
|
18
|
-
padding: 0 var(--field-padding);
|
|
19
|
-
display: flex;
|
|
20
|
-
caret-color: var(--cta-default);
|
|
21
|
-
outline-offset: 2px;
|
|
22
|
-
|
|
23
|
-
@nest [data-textfield-has-icon='true'] &::-webkit-calendar-picker-indicator {
|
|
24
|
-
opacity: 0%;
|
|
25
|
-
position: absolute;
|
|
26
|
-
right: calc(var(--field-padding) / 2);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&:-moz-ui-invalid {
|
|
30
|
-
box-shadow: none;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&::placeholder {
|
|
34
|
-
color: var(--dimmed-5);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&:focus-visible {
|
|
38
|
-
border-color: var(--dimmed-5);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&:disabled {
|
|
42
|
-
|
|
43
|
-
@mixin vibrancy-disabled;
|
|
44
|
-
|
|
45
|
-
cursor: not-allowed;
|
|
46
|
-
border-color: transparent;
|
|
47
|
-
|
|
48
|
-
&::placeholder {
|
|
49
|
-
color: var(--dimmed-6);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&[readonly] {
|
|
54
|
-
border-style: dashed;
|
|
55
|
-
box-shadow: none;
|
|
56
|
-
cursor: default;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&:autofill,
|
|
60
|
-
&:autofill:hover,
|
|
61
|
-
&:autofill:focus,
|
|
62
|
-
&:autofill:active {
|
|
63
|
-
border: 1px solid var(--dimmed-2);
|
|
64
|
-
box-shadow: 0 0 0 100px var(--global-background) inset;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&:is(:invalid, [data-basefield-invalid='true'], :out-of-range),
|
|
68
|
-
&:is(:invalid, [data-basefield-invalid='true'], :out-of-range):focus-visible {
|
|
69
|
-
border-color: var(--highlight-red-foreground);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
&[type='number'] {
|
|
74
|
-
appearance: textfield;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&[type='number']::-webkit-inner-spin-button,
|
|
78
|
-
&[type='number']::-webkit-outer-spin-button {
|
|
79
|
-
display: none;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&[type='search'] {
|
|
83
|
-
appearance: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&[type='search']::-webkit-search-cancel-button,
|
|
87
|
-
&[type='search']::-webkit-search-decoration {
|
|
88
|
-
appearance: none;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
textarea.BaseField {
|
|
94
|
-
block-size: auto;
|
|
95
|
-
min-block-size: env(--space-32);
|
|
96
|
-
line-height: env(--font-lh-standard);
|
|
97
|
-
resize: vertical;
|
|
98
|
-
padding:
|
|
99
|
-
calc(var(--field-padding) / 2)
|
|
100
|
-
calc(var(--field-padding) + env(--space-16))
|
|
101
|
-
calc(var(--field-padding) / 2)
|
|
102
|
-
var(--field-padding);
|
|
103
|
-
|
|
104
|
-
&::-webkit-datetime-edit-text {
|
|
105
|
-
opacity: 30%;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
&::-webkit-calendar-picker-indicator {
|
|
109
|
-
color: var(--global-foreground);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&:-moz-ui-invalid {
|
|
113
|
-
box-shadow: none;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&::-webkit-calendar-picker-indicator:hover {
|
|
117
|
-
background-color: transparent;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
1
|
+
.BaseField{-webkit-appearance:none;appearance:none;background-color:var(--global-background);block-size:var(--field-height);border:1px solid var(--dimmed-2);border-radius:.22rem;box-sizing:border-box;caret-color:var(--cta-default);color:inherit;display:flex;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:1;margin:0;outline-offset:2px;overflow:hidden;padding:0 var(--field-padding);text-overflow:ellipsis}[data-textfield-has-icon=true] .BaseField::-webkit-calendar-picker-indicator{opacity:0;position:absolute;right:calc(var(--field-padding)/2)}.BaseField:-moz-ui-invalid{box-shadow:none}.BaseField::placeholder{color:var(--dimmed-5)}.BaseField.focus-visible{border-color:var(--dimmed-5)}.BaseField:focus-visible{border-color:var(--dimmed-5)}.BaseField:disabled{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:#0000;color:var(--global-disabled-foreground);cursor:not-allowed}.BaseField:disabled::placeholder{color:var(--dimmed-6)}.BaseField[readonly]{border-style:dashed;box-shadow:none;cursor:default}.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:active,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:hover{border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}.BaseField:autofill,.BaseField:autofill:active,.BaseField:autofill:focus,.BaseField:autofill:hover{border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range).focus-visible{border-color:var(--highlight-red-foreground)}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range):focus-visible{border-color:var(--highlight-red-foreground)}.BaseField[type=number]{-webkit-appearance:textfield;appearance:textfield}.BaseField[type=number]::-webkit-inner-spin-button,.BaseField[type=number]::-webkit-outer-spin-button{display:none}.BaseField[type=search]{-webkit-appearance:none;appearance:none}.BaseField[type=search]::-webkit-search-cancel-button,.BaseField[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}textarea.BaseField{block-size:auto;line-height:1.5;min-block-size:1.78rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + .89rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:30%}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField::-webkit-calendar-picker-indicator:hover{background-color:initial}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { BaseField } from './base-field';
|
|
2
|
-
export type { BaseFieldProps } from './base-field';
|
|
2
|
+
export type { BaseFieldProps, PrimitiveInputType } from './base-field';
|
package/textfield/textfield.d.ts
CHANGED
|
@@ -1,27 +1,97 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
2
|
import { IconNames } from '../icons/types';
|
|
3
|
-
import { BaseFieldProps } from './base-field';
|
|
3
|
+
import { BaseFieldProps, PrimitiveInputType } from './base-field';
|
|
4
4
|
export declare type TextfieldProps = BaseFieldProps & {
|
|
5
|
+
/**
|
|
6
|
+
* Set the icon to show on the left or right side of the input.
|
|
7
|
+
*/
|
|
5
8
|
icon?: IconNames;
|
|
9
|
+
/**
|
|
10
|
+
* Set in which side of the field the icon should be displayed.
|
|
11
|
+
*/
|
|
12
|
+
iconPosition?: 'left' | 'right';
|
|
13
|
+
/**
|
|
14
|
+
* Define the accessible label of the input. While this is not
|
|
15
|
+
* mandatory, an input should always have a label. If not using this property
|
|
16
|
+
* you can bind a custom label to the input by using an id.
|
|
17
|
+
*/
|
|
6
18
|
label?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Set the input type. The value can be anything that
|
|
21
|
+
* is supported by the HTML input element.
|
|
22
|
+
*
|
|
23
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Learn/Forms/HTML5_input_types
|
|
24
|
+
*/
|
|
7
25
|
type?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Set the input to be a textarea instead of a single line field.
|
|
28
|
+
* This property completely changes the rendered element from an input to a textarea.
|
|
29
|
+
*/
|
|
8
30
|
textarea?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Set the size of the field
|
|
33
|
+
*/
|
|
9
34
|
dimension?: 'regular' | 'small' | 'big';
|
|
35
|
+
/**
|
|
36
|
+
* Set the field into a readonly state. When readonly, the field value
|
|
37
|
+
* cannot be edited but it can still be selected and copied.
|
|
38
|
+
*/
|
|
10
39
|
readOnly?: boolean;
|
|
11
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Set the field into a disabled state. When disabled, the field value cannot be
|
|
42
|
+
* edited, selected or copied, but it can still be focused and navigated by AT.
|
|
43
|
+
*/
|
|
12
44
|
disabled?: boolean;
|
|
13
|
-
|
|
45
|
+
/**
|
|
46
|
+
* The callback function that is called when the input value changes.
|
|
47
|
+
*/
|
|
48
|
+
onChange?: (event: ChangeEvent<PrimitiveInputType>) => void;
|
|
14
49
|
};
|
|
15
|
-
export declare const Textfield:
|
|
50
|
+
export declare const Textfield: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLTextAreaElement> & {
|
|
16
51
|
invalid?: boolean | undefined;
|
|
17
52
|
} & {
|
|
53
|
+
/**
|
|
54
|
+
* Set the icon to show on the left or right side of the input.
|
|
55
|
+
*/
|
|
18
56
|
icon?: IconNames | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Set in which side of the field the icon should be displayed.
|
|
59
|
+
*/
|
|
60
|
+
iconPosition?: "left" | "right" | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Define the accessible label of the input. While this is not
|
|
63
|
+
* mandatory, an input should always have a label. If not using this property
|
|
64
|
+
* you can bind a custom label to the input by using an id.
|
|
65
|
+
*/
|
|
19
66
|
label?: string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Set the input type. The value can be anything that
|
|
69
|
+
* is supported by the HTML input element.
|
|
70
|
+
*
|
|
71
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Learn/Forms/HTML5_input_types
|
|
72
|
+
*/
|
|
20
73
|
type?: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Set the input to be a textarea instead of a single line field.
|
|
76
|
+
* This property completely changes the rendered element from an input to a textarea.
|
|
77
|
+
*/
|
|
21
78
|
textarea?: boolean | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Set the size of the field
|
|
81
|
+
*/
|
|
22
82
|
dimension?: "big" | "small" | "regular" | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Set the field into a readonly state. When readonly, the field value
|
|
85
|
+
* cannot be edited but it can still be selected and copied.
|
|
86
|
+
*/
|
|
23
87
|
readOnly?: boolean | undefined;
|
|
24
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Set the field into a disabled state. When disabled, the field value cannot be
|
|
90
|
+
* edited, selected or copied, but it can still be focused and navigated by AT.
|
|
91
|
+
*/
|
|
25
92
|
disabled?: boolean | undefined;
|
|
26
|
-
|
|
27
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The callback function that is called when the input value changes.
|
|
95
|
+
*/
|
|
96
|
+
onChange?: ((event: ChangeEvent<PrimitiveInputType>) => void) | undefined;
|
|
97
|
+
} & import("react").RefAttributes<PrimitiveInputType>>;
|
package/textfield/textfield.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useState } from 'react';
|
|
2
3
|
import { Text, Stack, Icon, IconButton } from '../';
|
|
3
4
|
import { BaseField } from './base-field';
|
|
4
5
|
import clsx from 'clsx';
|
|
5
6
|
import { useUIDSeed } from 'react-uid';
|
|
6
7
|
import { Textfield as TextfieldClass, FieldContainer, InputField, Icon as IconClass, IconButton as IconButtonClass } from './textfield.module.css';
|
|
7
|
-
export const Textfield = forwardRef(({ children, className, disabled = false, icon, label, textarea, readOnly, invalid, iconPosition = 'right', dimension = 'regular', type, onChange, ...
|
|
8
|
+
export const Textfield = forwardRef(({ children, className, disabled = false, icon, label, textarea, readOnly, invalid, iconPosition = 'right', dimension = 'regular', type, onChange, ...otherProps }, forwardedRef) => {
|
|
8
9
|
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
9
10
|
const uid = useUIDSeed();
|
|
10
11
|
const isPassword = type === 'password';
|
|
@@ -27,13 +28,8 @@ export const Textfield = forwardRef(({ children, className, disabled = false, ic
|
|
|
27
28
|
disabled,
|
|
28
29
|
onChange
|
|
29
30
|
};
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
textarea
|
|
34
|
-
? (React.createElement(BaseField, { ref: forwardedRef, as: "textarea", id: uid('field'), ...commonProps, ...props }))
|
|
35
|
-
: (React.createElement(BaseField, { className: InputField, id: uid('field'), ref: forwardedRef, type: passwordVisible ? 'text' : type, ...commonProps, ...props })),
|
|
36
|
-
isPassword && (React.createElement(IconButton, { className: IconButtonClass, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", icon: passwordVisible ? 'eye-slash' : 'eye' })),
|
|
37
|
-
!textarea && icon && type !== 'password' && (React.createElement(Icon, { className: IconClass, name: icon, dimension: iconSizes[dimension] })))));
|
|
31
|
+
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(TextfieldClass, className), "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid, "aria-disabled": disabled, horizontalAlign: "stretch", verticalAlign: "start", tabIndex: disabled ? 0 : undefined, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: uid('field'), children: label }, void 0), _jsxs("div", { className: FieldContainer, children: [textarea
|
|
32
|
+
? (_jsx(BaseField, { ref: forwardedRef, as: "textarea", id: uid('field'), ...commonProps, ...otherProps }, void 0))
|
|
33
|
+
: (_jsx(BaseField, { className: InputField, id: uid('field'), ref: forwardedRef, type: passwordVisible ? 'text' : type, ...commonProps, ...otherProps }, void 0)), isPassword && (_jsx(IconButton, { className: IconButtonClass, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", icon: passwordVisible ? 'eye-slash' : 'eye' }, void 0)), !textarea && icon && type !== 'password' && (_jsx(Icon, { className: IconClass, name: icon, dimension: iconSizes[dimension] }, void 0))] }, void 0)] }, void 0));
|
|
38
34
|
});
|
|
39
35
|
Textfield.displayName = 'Textfield';
|
|
@@ -1,103 +1 @@
|
|
|
1
|
-
.Textfield {
|
|
2
|
-
appearance: none;
|
|
3
|
-
position: relative;
|
|
4
|
-
padding: 0;
|
|
5
|
-
|
|
6
|
-
&[data-textfield-dimension='small'] {
|
|
7
|
-
--field-height: env(--space-24);
|
|
8
|
-
--field-padding: 0.33rem;
|
|
9
|
-
--font-size: env(--font-size-14);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&[data-textfield-dimension='regular'] {
|
|
13
|
-
--field-height: env(--space-40);
|
|
14
|
-
--field-padding: env(--space-16);
|
|
15
|
-
--font-size: env(--font-size-16);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&[data-textfield-dimension='big'] {
|
|
19
|
-
--field-height: env(--space-48);
|
|
20
|
-
--field-padding: env(--space-16);
|
|
21
|
-
--font-size: env(--font-size-18);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.FieldContainer {
|
|
26
|
-
position: relative;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.InputField {
|
|
30
|
-
--factor: 4;
|
|
31
|
-
|
|
32
|
-
@nest [data-textfield-has-icon='true'][data-textfield-icon-position='right'] & {
|
|
33
|
-
padding:
|
|
34
|
-
0
|
|
35
|
-
calc(var(--field-padding) * var(--factor))
|
|
36
|
-
0
|
|
37
|
-
var(--field-padding);
|
|
38
|
-
}
|
|
39
|
-
@nest [data-textfield-has-icon='true'][data-textfield-icon-position='left'] & {
|
|
40
|
-
padding:
|
|
41
|
-
0
|
|
42
|
-
var(--field-padding)
|
|
43
|
-
0
|
|
44
|
-
calc(var(--field-padding) * var(--factor));
|
|
45
|
-
}
|
|
46
|
-
@nest [data-textfield-dimension*='regular'] &,
|
|
47
|
-
[data-textfield-dimension*='big'] & {
|
|
48
|
-
--factor: 3;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.Icon {
|
|
53
|
-
border-radius: env(--radius-4);
|
|
54
|
-
pointer-events: none;
|
|
55
|
-
position: absolute;
|
|
56
|
-
top: 50%;
|
|
57
|
-
transform: translateY(-50%);
|
|
58
|
-
|
|
59
|
-
@nest [data-textfield-icon-position='left'] & {
|
|
60
|
-
right: auto;
|
|
61
|
-
left: var(--field-padding);
|
|
62
|
-
}
|
|
63
|
-
@nest [data-textfield-icon-position='right'] & {
|
|
64
|
-
left: auto;
|
|
65
|
-
right: var(--field-padding);
|
|
66
|
-
}
|
|
67
|
-
@nest .Textfield[data-textfield-invalid='true'] & {
|
|
68
|
-
fill: var(--highlight-red-foreground);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.IconButton.IconButton.IconButton {
|
|
73
|
-
--x: 19%;
|
|
74
|
-
|
|
75
|
-
position: absolute;
|
|
76
|
-
top: 50%;
|
|
77
|
-
transform: translateY(-50%) translateX(var(--x));
|
|
78
|
-
outline-offset: -0.25em;
|
|
79
|
-
|
|
80
|
-
&[data-button-kind='flat']:is(:hover, :active, :focus, [data-button-disabled='true']) {
|
|
81
|
-
background-color: transparent;
|
|
82
|
-
backdrop-filter: none;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@nest [data-textfield-icon-position='left'] & {
|
|
86
|
-
--x: -19%;
|
|
87
|
-
|
|
88
|
-
right: auto;
|
|
89
|
-
left: var(--field-padding);
|
|
90
|
-
}
|
|
91
|
-
@nest [data-textfield-icon-position='right'] & {
|
|
92
|
-
left: auto;
|
|
93
|
-
right: var(--field-padding);
|
|
94
|
-
}
|
|
95
|
-
@nest .Textfield[data-textfield-invalid='true'] & {
|
|
96
|
-
color: var(--highlight-red-foreground);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.InputField:invalid + .Icon {
|
|
101
|
-
fill: var(--highlight-red-foreground);
|
|
102
|
-
}
|
|
103
|
-
|
|
1
|
+
.Textfield{-webkit-appearance:none;appearance:none;padding:0;position:relative}.Textfield[data-textfield-dimension=small]{--field-height:1.33rem;--field-padding:0.33rem;--font-size:0.78rem}.Textfield[data-textfield-dimension=regular]{--field-height:2.22rem;--field-padding:0.89rem;--font-size:0.89rem}.Textfield[data-textfield-dimension=big]{--field-height:2.67rem;--field-padding:0.89rem;--font-size:1.00rem}.FieldContainer{position:relative}.InputField{--factor:4}[data-textfield-has-icon=true][data-textfield-icon-position=right] .InputField{padding:0 calc(var(--field-padding)*var(--factor)) 0 var(--field-padding)}[data-textfield-has-icon=true][data-textfield-icon-position=left] .InputField{padding:0 var(--field-padding) 0 calc(var(--field-padding)*var(--factor))}[data-textfield-dimension*=big] .InputField,[data-textfield-dimension*=regular] .InputField{--factor:3}.Icon{border-radius:.22rem;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}[data-textfield-icon-position=left] .Icon{left:var(--field-padding);right:auto}[data-textfield-icon-position=right] .Icon{left:auto;right:var(--field-padding)}.Textfield[data-textfield-invalid=true] .Icon{fill:var(--highlight-red-foreground)}.IconButton.IconButton.IconButton{--x:19%;outline-offset:-.25em;position:absolute;top:50%;transform:translateY(-50%) translateX(var(--x))}.IconButton.IconButton.IconButton[data-button-kind=flat]:is(:hover,:active,:focus,[data-button-disabled=true]){-webkit-backdrop-filter:none;backdrop-filter:none;background-color:initial}[data-textfield-icon-position=left] .IconButton.IconButton.IconButton{--x:-19%;left:var(--field-padding);right:auto}[data-textfield-icon-position=right] .IconButton.IconButton.IconButton{left:auto;right:var(--field-padding)}.Textfield[data-textfield-invalid=true] .IconButton.IconButton.IconButton{color:var(--highlight-red-foreground)}.InputField:invalid+.Icon{fill:var(--highlight-red-foreground)}
|