@scaleflex/ui-tw 0.0.2 → 0.0.3
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/LICENSE +1 -33
- package/README.md +2 -16
- package/{core/button → button}/button.component.d.ts +2 -3
- package/{core/button → button}/button.component.js +8 -9
- package/{core/button → button}/button.const.d.ts +0 -2
- package/{core/button → button}/button.const.js +2 -2
- package/{core/button → button}/button.types.d.ts +3 -5
- package/{core/button → button}/button.types.js +2 -4
- package/{core/button → button}/button.utils.d.ts +1 -1
- package/{core/button → button}/button.utils.js +1 -1
- package/{core/button → button}/components/end-icon.d.ts +1 -1
- package/{core/button → button}/components/end-icon.js +3 -3
- package/{core/button → button}/components/start-icon.d.ts +2 -2
- package/{core/button → button}/components/start-icon.js +3 -3
- package/button/index.d.ts +3 -0
- package/button/index.js +2 -0
- package/form/components/form-field-group.component.d.ts +19 -0
- package/form/components/form-field-group.component.js +41 -0
- package/form/form.component.d.ts +30 -0
- package/form/form.component.js +123 -0
- package/form/form.types.d.ts +7 -0
- package/{core/switcher/switcher-size.js → form/form.types.js} +1 -1
- package/form/index.d.ts +2 -0
- package/form/index.js +2 -0
- package/input/index.d.ts +3 -0
- package/input/index.js +2 -0
- package/input/input.component.d.ts +7 -0
- package/input/input.component.js +42 -0
- package/input/input.types.d.ts +17 -0
- package/input/input.types.js +10 -0
- package/label/components/info-outline-icon.d.ts +3 -0
- package/label/components/info-outline-icon.js +30 -0
- package/label/components/label-icon.d.ts +7 -0
- package/label/components/label-icon.js +43 -0
- package/label/index.d.ts +1 -0
- package/label/index.js +1 -0
- package/label/label.component.d.ts +4 -0
- package/label/label.component.js +44 -0
- package/label/label.types.d.ts +14 -0
- package/{core/tab/types/size.js → label/label.types.js} +1 -1
- package/label/label.utils.d.ts +2 -0
- package/label/label.utils.js +16 -0
- package/package.json +8 -4
- package/{theme/theme.css → theme.css} +4 -4
- package/tooltip/index.d.ts +1 -0
- package/tooltip/index.js +1 -0
- package/tooltip/tooltip.component.d.ts +10 -0
- package/tooltip/tooltip.component.js +51 -0
- package/tooltip/tooltip.types.d.ts +5 -0
- package/core/accordion/accordion.component.d.ts +0 -3
- package/core/accordion/accordion.component.js +0 -50
- package/core/accordion/accordion.props.d.ts +0 -13
- package/core/accordion/accordion.props.js +0 -1
- package/core/accordion/index.d.ts +0 -2
- package/core/accordion/index.js +0 -1
- package/core/accordion-details/accordion-details.component.d.ts +0 -3
- package/core/accordion-details/accordion-details.component.js +0 -16
- package/core/accordion-details/accordion-details.props.d.ts +0 -4
- package/core/accordion-details/index.d.ts +0 -2
- package/core/accordion-details/index.js +0 -1
- package/core/accordion-header/accordion-header.component.d.ts +0 -3
- package/core/accordion-header/accordion-header.component.js +0 -48
- package/core/accordion-header/accordion-header.props.d.ts +0 -11
- package/core/accordion-header/accordion-header.props.js +0 -1
- package/core/accordion-header/index.d.ts +0 -2
- package/core/accordion-header/index.js +0 -1
- package/core/arrow/arrow.component.d.ts +0 -3
- package/core/arrow/arrow.component.js +0 -22
- package/core/arrow/arrow.props.d.ts +0 -14
- package/core/arrow/arrow.props.js +0 -6
- package/core/arrow/index.d.ts +0 -2
- package/core/arrow/index.js +0 -1
- package/core/arrow-tick/arrow-tick.component.d.ts +0 -3
- package/core/arrow-tick/arrow-tick.component.js +0 -21
- package/core/arrow-tick/arrow-tick.props.d.ts +0 -14
- package/core/arrow-tick/arrow-tick.props.js +0 -6
- package/core/arrow-tick/index.d.ts +0 -2
- package/core/arrow-tick/index.js +0 -1
- package/core/button/index.d.ts +0 -4
- package/core/button/index.js +0 -3
- package/core/check-box/check-box.component.d.ts +0 -0
- package/core/check-box/check-box.component.js +0 -77
- package/core/check-box/check-box.props.d.ts +0 -15
- package/core/check-box/check-box.props.js +0 -1
- package/core/check-box/check-box.utils.d.ts +0 -3
- package/core/check-box/check-box.utils.js +0 -21
- package/core/check-box/index.d.ts +0 -0
- package/core/check-box/index.js +0 -2
- package/core/check-box/types/index.d.ts +0 -2
- package/core/check-box/types/index.js +0 -2
- package/core/check-box/types/size.d.ts +0 -4
- package/core/check-box/types/size.js +0 -4
- package/core/check-box/types/type.d.ts +0 -4
- package/core/check-box/types/type.js +0 -4
- package/core/check-box-group/check-box-group.component.d.ts +0 -0
- package/core/check-box-group/check-box-group.component.js +0 -75
- package/core/check-box-group/check-box-group.props.d.ts +0 -0
- package/core/check-box-group/check-box-group.props.js +0 -23
- package/core/check-box-group/index.d.ts +0 -0
- package/core/check-box-group/index.js +0 -2
- package/core/check-box-group/types/index.d.ts +0 -1
- package/core/check-box-group/types/index.js +0 -1
- package/core/check-box-group/types/label-position.d.ts +0 -4
- package/core/check-box-group/types/label-position.js +0 -4
- package/core/cross-button/cross-button.component.d.ts +0 -3
- package/core/cross-button/cross-button.component.js +0 -37
- package/core/cross-button/cross-button.props.d.ts +0 -8
- package/core/cross-button/cross-button.props.js +0 -1
- package/core/cross-button/index.d.ts +0 -2
- package/core/cross-button/index.js +0 -1
- package/core/cross-button/types/index.d.ts +0 -1
- package/core/cross-button/types/index.js +0 -1
- package/core/cross-button/types/size.d.ts +0 -6
- package/core/cross-button/types/size.js +0 -6
- package/core/dot/dot.component.d.ts +0 -3
- package/core/dot/dot.component.js +0 -15
- package/core/dot/dot.props.d.ts +0 -4
- package/core/dot/dot.props.js +0 -1
- package/core/dot/index.d.ts +0 -2
- package/core/dot/index.js +0 -1
- package/core/dots-navigation/dots-navigation.component.d.ts +0 -3
- package/core/dots-navigation/dots-navigation.component.js +0 -24
- package/core/dots-navigation/dots-navigation.props.d.ts +0 -5
- package/core/dots-navigation/dots-navigation.props.js +0 -1
- package/core/dots-navigation/index.d.ts +0 -2
- package/core/dots-navigation/index.js +0 -1
- package/core/input/components/clear-icon.d.ts +0 -6
- package/core/input/components/clear-icon.js +0 -12
- package/core/input/components/copy-icon.d.ts +0 -6
- package/core/input/components/copy-icon.js +0 -13
- package/core/input/components/password-icon.d.ts +0 -7
- package/core/input/components/password-icon.js +0 -24
- package/core/input/components/render-icon.d.ts +0 -7
- package/core/input/components/render-icon.js +0 -26
- package/core/input/index.d.ts +0 -2
- package/core/input/index.js +0 -1
- package/core/input/input.component.d.ts +0 -3
- package/core/input/input.component.js +0 -233
- package/core/input/input.const.d.ts +0 -6
- package/core/input/input.const.js +0 -6
- package/core/input/input.types.d.ts +0 -56
- package/core/input/input.types.js +0 -16
- package/core/input/input.utils.d.ts +0 -2
- package/core/input/input.utils.js +0 -13
- package/core/modal/index.d.ts +0 -2
- package/core/modal/index.js +0 -1
- package/core/modal/modal-menu-context.d.ts +0 -5
- package/core/modal/modal-menu-context.js +0 -10
- package/core/modal/modal.component.d.ts +0 -3
- package/core/modal/modal.component.js +0 -97
- package/core/modal/modal.props.d.ts +0 -16
- package/core/modal/modal.props.js +0 -1
- package/core/modal/modal.utils.d.ts +0 -1
- package/core/modal/modal.utils.js +0 -4
- package/core/modal/types/index.d.ts +0 -1
- package/core/modal/types/index.js +0 -1
- package/core/modal/types/size.d.ts +0 -7
- package/core/modal/types/size.js +0 -7
- package/core/modal-actions/index.d.ts +0 -2
- package/core/modal-actions/index.js +0 -1
- package/core/modal-actions/modal-actions.component.d.ts +0 -3
- package/core/modal-actions/modal-actions.component.js +0 -18
- package/core/modal-actions/modal-actions.props.d.ts +0 -8
- package/core/modal-actions/modal-actions.props.js +0 -1
- package/core/modal-actions/types/align.d.ts +0 -5
- package/core/modal-actions/types/align.js +0 -5
- package/core/modal-actions/types/index.d.ts +0 -1
- package/core/modal-actions/types/index.js +0 -1
- package/core/modal-content/index.d.ts +0 -2
- package/core/modal-content/index.js +0 -1
- package/core/modal-content/modal-content.component.d.ts +0 -3
- package/core/modal-content/modal-content.component.js +0 -15
- package/core/modal-content/modal-content.props.d.ts +0 -4
- package/core/modal-content/modal-content.props.js +0 -1
- package/core/modal-title/index.d.ts +0 -2
- package/core/modal-title/index.js +0 -1
- package/core/modal-title/modal-title.component.d.ts +0 -6
- package/core/modal-title/modal-title.component.js +0 -37
- package/core/modal-title/modal-title.props.d.ts +0 -14
- package/core/modal-title/modal-title.props.js +0 -1
- package/core/modal-title/types/index.d.ts +0 -1
- package/core/modal-title/types/index.js +0 -1
- package/core/modal-title/types/variant.d.ts +0 -4
- package/core/modal-title/types/variant.js +0 -4
- package/core/pagination/index.d.ts +0 -2
- package/core/pagination/index.js +0 -1
- package/core/pagination/pagination.component.d.ts +0 -3
- package/core/pagination/pagination.component.js +0 -81
- package/core/pagination/pagination.props.d.ts +0 -11
- package/core/pagination/pagination.props.js +0 -1
- package/core/popper/index.d.ts +0 -2
- package/core/popper/index.js +0 -1
- package/core/popper/popper.component.d.ts +0 -3
- package/core/popper/popper.component.js +0 -113
- package/core/popper/popper.props.d.ts +0 -41
- package/core/popper/popper.props.js +0 -1
- package/core/popper/popper.utils.d.ts +0 -1
- package/core/popper/popper.utils.js +0 -10
- package/core/popper/types/index.d.ts +0 -3
- package/core/popper/types/index.js +0 -3
- package/core/popper/types/phases.d.ts +0 -11
- package/core/popper/types/phases.js +0 -11
- package/core/popper/types/position.d.ts +0 -17
- package/core/popper/types/position.js +0 -17
- package/core/popper/types/strategy.d.ts +0 -4
- package/core/popper/types/strategy.js +0 -4
- package/core/radio/index.d.ts +0 -3
- package/core/radio/index.js +0 -2
- package/core/radio/radio.component.d.ts +0 -3
- package/core/radio/radio.component.js +0 -38
- package/core/radio/radio.props.d.ts +0 -13
- package/core/radio/radio.props.js +0 -1
- package/core/radio/size.d.ts +0 -4
- package/core/radio/size.js +0 -4
- package/core/radio-group/index.d.ts +0 -2
- package/core/radio-group/index.js +0 -1
- package/core/radio-group/radio-group.component.d.ts +0 -3
- package/core/radio-group/radio-group.component.js +0 -48
- package/core/radio-group/radio-group.props.d.ts +0 -15
- package/core/radio-group/radio-group.props.js +0 -1
- package/core/switcher/index.d.ts +0 -3
- package/core/switcher/index.js +0 -2
- package/core/switcher/switcher-size.d.ts +0 -5
- package/core/switcher/switcher.component.d.ts +0 -3
- package/core/switcher/switcher.component.js +0 -54
- package/core/switcher/switcher.props.d.ts +0 -14
- package/core/switcher/switcher.props.js +0 -1
- package/core/switcher/switcher.utils.d.ts +0 -4
- package/core/switcher/switcher.utils.js +0 -37
- package/core/switcher-group/index.d.ts +0 -2
- package/core/switcher-group/index.js +0 -1
- package/core/switcher-group/switcher-group.component.d.ts +0 -3
- package/core/switcher-group/switcher-group.component.js +0 -41
- package/core/switcher-group/switcher-group.props.d.ts +0 -13
- package/core/switcher-group/switcher-group.props.js +0 -1
- package/core/tab/index.d.ts +0 -2
- package/core/tab/index.js +0 -1
- package/core/tab/tab.component.d.ts +0 -6
- package/core/tab/tab.component.js +0 -52
- package/core/tab/tab.props.d.ts +0 -15
- package/core/tab/tab.props.js +0 -1
- package/core/tab/types/index.d.ts +0 -1
- package/core/tab/types/index.js +0 -1
- package/core/tab/types/size.d.ts +0 -5
- package/core/tab-panel/index.d.ts +0 -2
- package/core/tab-panel/index.js +0 -1
- package/core/tab-panel/tab-panel.component.d.ts +0 -3
- package/core/tab-panel/tab-panel.component.js +0 -18
- package/core/tab-panel/tab-panel.props.d.ts +0 -6
- package/core/tab-panel/tab-panel.props.js +0 -1
- package/core/upload-input/index.d.ts +0 -2
- package/core/upload-input/index.js +0 -1
- package/core/upload-input/upload-input.component.d.ts +0 -3
- package/core/upload-input/upload-input.component.js +0 -68
- package/core/upload-input/upload-input.props.d.ts +0 -9
- package/core/upload-input/upload-input.props.js +0 -1
- package/hooks/README.md +0 -26
- package/hooks/use-controlled.d.ts +0 -1
- package/hooks/use-controlled.js +0 -20
- package/hooks/use-debounce.d.ts +0 -2
- package/hooks/use-debounce.js +0 -19
- package/hooks/use-drag.d.ts +0 -5
- package/hooks/use-drag.js +0 -37
- package/hooks/use-enhanced-effect.d.ts +0 -3
- package/hooks/use-enhanced-effect.js +0 -3
- package/hooks/use-event-callback.d.ts +0 -4
- package/hooks/use-event-callback.js +0 -19
- package/hooks/use-pagination.d.ts +0 -3
- package/hooks/use-pagination.js +0 -106
- package/hooks/use-portal.d.ts +0 -14
- package/hooks/use-portal.js +0 -75
- package/theme/README.md +0 -9
- package/utils/README.md +0 -11
- package/utils/functions/apply-display-names.d.ts +0 -6
- package/utils/functions/apply-display-names.js +0 -12
- package/utils/functions/apply-polymorphic-function-prop.d.ts +0 -6
- package/utils/functions/apply-polymorphic-function-prop.js +0 -11
- package/utils/functions/color-picker/color-converters.d.ts +0 -11
- package/utils/functions/color-picker/color-converters.js +0 -159
- package/utils/functions/convert-to-string.d.ts +0 -1
- package/utils/functions/convert-to-string.js +0 -3
- package/utils/functions/escape-regexp.d.ts +0 -1
- package/utils/functions/escape-regexp.js +0 -3
- package/utils/functions/generate-class-names.d.ts +0 -1
- package/utils/functions/generate-class-names.js +0 -22
- package/utils/functions/get-elem-document-coords.d.ts +0 -6
- package/utils/functions/get-elem-document-coords.js +0 -21
- package/utils/functions/ignore-event.d.ts +0 -1
- package/utils/functions/ignore-event.js +0 -9
- package/utils/functions/index.d.ts +0 -11
- package/utils/functions/index.js +0 -12
- package/utils/functions/intrinsic-component.d.ts +0 -0
- package/utils/functions/intrinsic-component.js +0 -28
- package/utils/functions/object-keys.d.ts +0 -6
- package/utils/functions/object-keys.js +0 -6
- package/utils/functions/object-values.d.ts +0 -7
- package/utils/functions/object-values.js +0 -6
- package/utils/functions/on-click-by-mouse-down.d.ts +0 -2
- package/utils/functions/on-click-by-mouse-down.js +0 -9
- package/utils/functions/set-ref.d.ts +0 -8
- package/utils/functions/set-ref.js +0 -13
- package/utils/functions/slider/utils.d.ts +0 -47
- package/utils/functions/slider/utils.js +0 -124
- package/utils/functions/use-fork-ref.d.ts +0 -2
- package/utils/functions/use-fork-ref.js +0 -18
- package/utils/types/color/icon-button-color.d.ts +0 -5
- package/utils/types/color/icon-button-color.js +0 -5
- package/utils/types/color/index.d.ts +0 -0
- package/utils/types/color/index.js +0 -2
- package/utils/types/color/input-background-color.d.ts +0 -4
- package/utils/types/color/input-background-color.js +0 -4
- package/utils/types/css/align.d.ts +0 -11
- package/utils/types/css/align.js +0 -11
- package/utils/types/css/breakpoint.d.ts +0 -18
- package/utils/types/css/breakpoint.js +0 -18
- package/utils/types/css/direction.d.ts +0 -8
- package/utils/types/css/direction.js +0 -4
- package/utils/types/css/index.d.ts +0 -4
- package/utils/types/css/index.js +0 -4
- package/utils/types/css/position.d.ts +0 -6
- package/utils/types/css/position.js +0 -6
- package/utils/types/index.d.ts +0 -6
- package/utils/types/index.js +0 -3
- package/utils/types/intrinsic-component.d.ts +0 -1
- package/utils/types/keys.d.ts +0 -4
- package/utils/types/palette/color.d.ts +0 -133
- package/utils/types/palette/color.js +0 -133
- package/utils/types/palette/index.d.ts +0 -1
- package/utils/types/palette/index.js +0 -1
- package/utils/types/position/index.d.ts +0 -1
- package/utils/types/position/index.js +0 -1
- package/utils/types/position/position.d.ts +0 -6
- package/utils/types/position/position.js +0 -6
- package/utils/types/prop-types/index.d.ts +0 -1
- package/utils/types/prop-types/index.js +0 -1
- package/utils/types/prop-types/record.d.ts +0 -1
- package/utils/types/prop-types/record.js +0 -6
- package/utils/types/shadows/index.d.ts +0 -1
- package/utils/types/shadows/index.js +0 -1
- package/utils/types/shadows/shadows.d.ts +0 -14
- package/utils/types/shadows/shadows.js +0 -14
- package/utils/types/shape/border-radius-size.d.ts +0 -5
- package/utils/types/shape/border-radius-size.js +0 -5
- package/utils/types/shape/index.d.ts +0 -1
- package/utils/types/shape/index.js +0 -1
- package/utils/types/stylable-component.d.ts +0 -7
- package/utils/types/typography/font-variant.d.ts +0 -58
- package/utils/types/typography/font-variant.js +0 -58
- package/utils/types/typography/font-weight.d.ts +0 -11
- package/utils/types/typography/font-weight.js +0 -11
- package/utils/types/typography/index.d.ts +0 -4
- package/utils/types/typography/index.js +0 -4
- package/utils/types/typography/text-align.d.ts +0 -5
- package/utils/types/typography/text-align.js +0 -5
- package/utils/types/typography/text-decoration.d.ts +0 -5
- package/utils/types/typography/text-decoration.js +0 -5
- package/utils/types/with.d.ts +0 -4
- /package/{core/accordion-details/accordion-details.props.js → tooltip/tooltip.types.js} +0 -0
- /package/{utils/types → types}/values.d.ts +0 -0
- /package/utils/{functions/shadcn-utils.d.ts → cn.d.ts} +0 -0
- /package/utils/{functions/shadcn-utils.js → cn.js} +0 -0
package/hooks/use-pagination.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["boundaryCount", "count", "defaultPage", "disabled", "onChange", "page", "siblingCount"];
|
|
6
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
/**
|
|
9
|
-
* Borrows heavily from and inspired by material-ui https://github.com/mui-org/material-ui
|
|
10
|
-
* basically a stripped-down version of it. Uing only the core functionalities and using what we need from it
|
|
11
|
-
*/
|
|
12
|
-
import useControlled from './use-controlled';
|
|
13
|
-
function usePagination(_ref) {
|
|
14
|
-
var _ref$boundaryCount = _ref.boundaryCount,
|
|
15
|
-
boundaryCount = _ref$boundaryCount === void 0 ? 1 : _ref$boundaryCount,
|
|
16
|
-
_ref$count = _ref.count,
|
|
17
|
-
count = _ref$count === void 0 ? 1 : _ref$count,
|
|
18
|
-
_ref$defaultPage = _ref.defaultPage,
|
|
19
|
-
defaultPage = _ref$defaultPage === void 0 ? 1 : _ref$defaultPage,
|
|
20
|
-
_ref$disabled = _ref.disabled,
|
|
21
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
22
|
-
handleChange = _ref.onChange,
|
|
23
|
-
pageProp = _ref.page,
|
|
24
|
-
_ref$siblingCount = _ref.siblingCount,
|
|
25
|
-
siblingCount = _ref$siblingCount === void 0 ? 1 : _ref$siblingCount,
|
|
26
|
-
other = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
-
var _useControlled = useControlled({
|
|
28
|
-
controlled: pageProp,
|
|
29
|
-
"default": defaultPage
|
|
30
|
-
}),
|
|
31
|
-
_useControlled2 = _slicedToArray(_useControlled, 2),
|
|
32
|
-
page = _useControlled2[0],
|
|
33
|
-
setPageState = _useControlled2[1];
|
|
34
|
-
var handleClick = function handleClick(event, value) {
|
|
35
|
-
if (!pageProp) {
|
|
36
|
-
setPageState(value);
|
|
37
|
-
}
|
|
38
|
-
if (handleChange) {
|
|
39
|
-
handleChange(event, value);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
var range = function range(start, end) {
|
|
43
|
-
var length = end - start + 1;
|
|
44
|
-
return Array.from({
|
|
45
|
-
length: length
|
|
46
|
-
}, function (_, i) {
|
|
47
|
-
return start + i;
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
var startPages = range(1, Math.min(boundaryCount, count));
|
|
51
|
-
var endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
|
|
52
|
-
var siblingsStart = Math.max(Math.min(
|
|
53
|
-
// Natural start
|
|
54
|
-
page - siblingCount,
|
|
55
|
-
// Lower boundary when page is high
|
|
56
|
-
count - boundaryCount - siblingCount * 2 - 1),
|
|
57
|
-
// Greater than startPages
|
|
58
|
-
boundaryCount + 2);
|
|
59
|
-
var siblingsEnd = Math.min(Math.max(
|
|
60
|
-
// Natural end
|
|
61
|
-
page + siblingCount,
|
|
62
|
-
// Upper boundary when page is low
|
|
63
|
-
boundaryCount + siblingCount * 2 + 2),
|
|
64
|
-
// Less than endPages
|
|
65
|
-
endPages.length > 0 ? endPages[0] - 2 : count - 1);
|
|
66
|
-
var itemList = ['first'].concat(['previous'], _toConsumableArray(startPages), _toConsumableArray(siblingsStart > boundaryCount + 2 ? ['start-ellipsis'] : boundaryCount + 1 < count - boundaryCount ? [boundaryCount + 1] : []), _toConsumableArray(range(siblingsStart, siblingsEnd)), _toConsumableArray(siblingsEnd < count - boundaryCount - 1 ? ['end-ellipsis'] : count - boundaryCount > boundaryCount ? [count - boundaryCount] : []), _toConsumableArray(endPages), ['next'], ['last']);
|
|
67
|
-
var buttonPage = function buttonPage(type) {
|
|
68
|
-
switch (type) {
|
|
69
|
-
case 'first':
|
|
70
|
-
return 1;
|
|
71
|
-
case 'previous':
|
|
72
|
-
return page - 1;
|
|
73
|
-
case 'next':
|
|
74
|
-
return page + 1;
|
|
75
|
-
case 'last':
|
|
76
|
-
return count;
|
|
77
|
-
default:
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
var items = itemList.map(function (item) {
|
|
82
|
-
return typeof item === 'number' ? {
|
|
83
|
-
onClick: function onClick(event) {
|
|
84
|
-
handleClick(event, item);
|
|
85
|
-
},
|
|
86
|
-
type: 'page',
|
|
87
|
-
page: item,
|
|
88
|
-
selected: item === page,
|
|
89
|
-
disabled: disabled,
|
|
90
|
-
'aria-current': item === page ? 'true' : undefined
|
|
91
|
-
} : {
|
|
92
|
-
onClick: function onClick(event) {
|
|
93
|
-
handleClick(event, buttonPage(item));
|
|
94
|
-
},
|
|
95
|
-
type: item,
|
|
96
|
-
page: buttonPage(item),
|
|
97
|
-
selected: false,
|
|
98
|
-
disabled: disabled || !item.includes('ellipsis') && (item === 'next' || item === 'last' ? page >= count : page <= 1)
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
return _objectSpread({
|
|
102
|
-
items: items
|
|
103
|
-
}, other);
|
|
104
|
-
}
|
|
105
|
-
export default usePagination;
|
|
106
|
-
export { usePagination };
|
package/hooks/use-portal.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to create a React Portal.
|
|
3
|
-
* Automatically handles creating and tearing-down the root elements (no SRR
|
|
4
|
-
* makes this trivial), so there is no need to ensure the parent target already
|
|
5
|
-
* exists.
|
|
6
|
-
* @example
|
|
7
|
-
* const target = usePortal(id, [id]);
|
|
8
|
-
* return createPortal(children, target);
|
|
9
|
-
* @param {String} id The id of the target container, e.g 'modal' or 'spotlight'
|
|
10
|
-
* @returns {HTMLElement} The DOM node to use as the Portal target.
|
|
11
|
-
*/
|
|
12
|
-
declare function usePortal(id: string): HTMLElement;
|
|
13
|
-
export default usePortal;
|
|
14
|
-
export { usePortal };
|
package/hooks/use-portal.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Creates DOM element to be used as React root.
|
|
4
|
-
*/
|
|
5
|
-
function createRootElement(id) {
|
|
6
|
-
var rootContainer = document.createElement('div');
|
|
7
|
-
rootContainer.setAttribute('id', id);
|
|
8
|
-
return rootContainer;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Appends element as last child of body.
|
|
13
|
-
*/
|
|
14
|
-
function addRootElement(rootElem) {
|
|
15
|
-
document.body.append(rootElem);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Hook to create a React Portal.
|
|
20
|
-
* Automatically handles creating and tearing-down the root elements (no SRR
|
|
21
|
-
* makes this trivial), so there is no need to ensure the parent target already
|
|
22
|
-
* exists.
|
|
23
|
-
* @example
|
|
24
|
-
* const target = usePortal(id, [id]);
|
|
25
|
-
* return createPortal(children, target);
|
|
26
|
-
* @param {String} id The id of the target container, e.g 'modal' or 'spotlight'
|
|
27
|
-
* @returns {HTMLElement} The DOM node to use as the Portal target.
|
|
28
|
-
*/
|
|
29
|
-
function usePortal(id) {
|
|
30
|
-
var rootElemRef = useRef(null);
|
|
31
|
-
useEffect(function () {
|
|
32
|
-
// Look for existing target dom element to append to
|
|
33
|
-
var existingParent = document.querySelector("#".concat(id));
|
|
34
|
-
// Parent is either a new root or the existing dom element
|
|
35
|
-
var parentElem = existingParent || createRootElement(id);
|
|
36
|
-
|
|
37
|
-
// If there is no existing DOM element, add a new one.
|
|
38
|
-
if (!existingParent) {
|
|
39
|
-
addRootElement(parentElem);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Add the detached element to the parent
|
|
43
|
-
if (rootElemRef.current) {
|
|
44
|
-
parentElem.append(rootElemRef.current);
|
|
45
|
-
}
|
|
46
|
-
return function removeElement() {
|
|
47
|
-
if (rootElemRef.current) {
|
|
48
|
-
rootElemRef.current.remove();
|
|
49
|
-
}
|
|
50
|
-
if (parentElem.childNodes.length === -1) {
|
|
51
|
-
parentElem.remove();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* It's important we evaluate this lazily:
|
|
58
|
-
* - We need first render to contain the DOM element, so it shouldn't happen
|
|
59
|
-
* in useEffect. We would normally put this in the constructor().
|
|
60
|
-
* - We can't do 'const rootElemRef = useRef(document.createElement('div))',
|
|
61
|
-
* since this will run every single render (that's a lot).
|
|
62
|
-
* - We want the ref to consistently point to the same DOM element and only
|
|
63
|
-
* ever run once.
|
|
64
|
-
* @link https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
|
|
65
|
-
*/
|
|
66
|
-
function getRootElem() {
|
|
67
|
-
if (!rootElemRef.current) {
|
|
68
|
-
rootElemRef.current = document.createElement('div');
|
|
69
|
-
}
|
|
70
|
-
return rootElemRef.current;
|
|
71
|
-
}
|
|
72
|
-
return getRootElem();
|
|
73
|
-
}
|
|
74
|
-
export default usePortal;
|
|
75
|
-
export { usePortal };
|
package/theme/README.md
DELETED
package/utils/README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# @scaleflex/ui-tw/utils
|
|
2
|
-
|
|
3
|
-
Utility functions and types for Scaleflex UI.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
This package provides two parts: `functions` and `types`. The latter is intended to be used with TypeScript only, the former contains different utilities that are used under the hood of most of our packages.
|
|
10
|
-
|
|
11
|
-
Using those consider their predisposition for internal usage in the Scaleflex UI ecosystem.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IStyledComponent } from 'styled-components';
|
|
2
|
-
/**
|
|
3
|
-
* If you are using a namespace for your styled components, this can come in handy giving each
|
|
4
|
-
* styled component in this namespace a displayName which gives better debugging experience
|
|
5
|
-
*/
|
|
6
|
-
export declare function applyDisplayNames<S extends Record<string, IStyledComponent<any, any>>>(styledObject: S): S;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
/**
|
|
3
|
-
* If you are using a namespace for your styled components, this can come in handy giving each
|
|
4
|
-
* styled component in this namespace a displayName which gives better debugging experience
|
|
5
|
-
*/
|
|
6
|
-
export function applyDisplayNames(styledObject) {
|
|
7
|
-
return Object.keys(styledObject).reduce(function (newStyledObject, styledComponentName) {
|
|
8
|
-
var styledComponent = styledObject[styledComponentName];
|
|
9
|
-
styledComponent.displayName = "".concat(styledComponentName);
|
|
10
|
-
return Object.assign(newStyledObject, _defineProperty({}, styledComponentName, styledComponent));
|
|
11
|
-
}, {});
|
|
12
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If your prop can be either a function or a plain value, this function handles
|
|
3
|
-
* its usage for you – just provide the reference for a 'maybe function' and the arguments
|
|
4
|
-
* to call it with
|
|
5
|
-
*/
|
|
6
|
-
export declare function applyPolymorphicFunctionProp<T, F extends (...args: any[]) => T>(prop: F | T | undefined, ...args: Parameters<F>): Exclude<typeof prop, F>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If your prop can be either a function or a plain value, this function handles
|
|
3
|
-
* its usage for you – just provide the reference for a 'maybe function' and the arguments
|
|
4
|
-
* to call it with
|
|
5
|
-
*/
|
|
6
|
-
export function applyPolymorphicFunctionProp(prop) {
|
|
7
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
8
|
-
args[_key - 1] = arguments[_key];
|
|
9
|
-
}
|
|
10
|
-
return typeof prop === 'function' ? prop.apply(void 0, args) : prop;
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const rgbStringToArray: (rgbColorString: string) => number[];
|
|
2
|
-
export declare const hexToRgb: (hexColor: string) => number[];
|
|
3
|
-
export declare const rgbToHex: (...rgbColor: any) => string;
|
|
4
|
-
export declare const hslToHex: (h: number, s: number, l: number) => string;
|
|
5
|
-
export declare const rgbToHsl: (...rgbColor: any) => number[];
|
|
6
|
-
export declare const colorToHsl: (color: string) => number[];
|
|
7
|
-
export declare const colorToRgb: (color: string) => number[];
|
|
8
|
-
export declare const colorToHex: (color: string) => string;
|
|
9
|
-
export declare const hsvToHsl: (h: number, s: number, v: number) => number[];
|
|
10
|
-
export declare const hslToHsv: (h: number, s: number, l: number) => Array<number>;
|
|
11
|
-
export declare const validateHex: (color: string) => boolean;
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
export var rgbStringToArray = function rgbStringToArray(rgbColorString) {
|
|
3
|
-
return rgbColorString.replaceAll(/[^\d,]/gi, '').split(',').map(function (n) {
|
|
4
|
-
return +n;
|
|
5
|
-
});
|
|
6
|
-
};
|
|
7
|
-
export var hexToRgb = function hexToRgb(hexColor) {
|
|
8
|
-
// if (!hexColor) return { r: 0, g: 0, b: 0 };
|
|
9
|
-
if (!hexColor) return [0, 0, 0];
|
|
10
|
-
return [Number.parseInt(hexColor.slice(1, 3), 16), Number.parseInt(hexColor.slice(3, 5), 16), Number.parseInt(hexColor.slice(5, 7), 16)];
|
|
11
|
-
};
|
|
12
|
-
var rgbChannelToHex = function rgbChannelToHex(channel) {
|
|
13
|
-
return channel.toString(16).padStart(2, '0');
|
|
14
|
-
};
|
|
15
|
-
export var rgbToHex = function rgbToHex() {
|
|
16
|
-
for (var _len = arguments.length, rgbColor = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17
|
-
rgbColor[_key] = arguments[_key];
|
|
18
|
-
}
|
|
19
|
-
return "#".concat(rgbColor.map(rgbChannelToHex).join(''));
|
|
20
|
-
};
|
|
21
|
-
export var hslToHex = function hslToHex(h, s, l) {
|
|
22
|
-
var dividedL = l / 100;
|
|
23
|
-
var a = s * Math.min(dividedL, 1 - dividedL) / 100;
|
|
24
|
-
var f = function f(n) {
|
|
25
|
-
var k = (n + h / 30) % 12;
|
|
26
|
-
var color = dividedL - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
27
|
-
return rgbChannelToHex(Math.round(255 * color));
|
|
28
|
-
};
|
|
29
|
-
return "#".concat(f(0)).concat(f(8)).concat(f(4));
|
|
30
|
-
};
|
|
31
|
-
export var rgbToHsl = function rgbToHsl() {
|
|
32
|
-
for (var _len2 = arguments.length, rgbColor = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
33
|
-
rgbColor[_key2] = arguments[_key2];
|
|
34
|
-
}
|
|
35
|
-
var r = rgbColor[0],
|
|
36
|
-
g = rgbColor[1],
|
|
37
|
-
b = rgbColor[2];
|
|
38
|
-
r /= 255;
|
|
39
|
-
g /= 255;
|
|
40
|
-
b /= 255;
|
|
41
|
-
var min = Math.min(r, g, b);
|
|
42
|
-
var max = Math.max(r, g, b);
|
|
43
|
-
var h;
|
|
44
|
-
var s;
|
|
45
|
-
var l = (max + min) / 2;
|
|
46
|
-
if (max === min) {
|
|
47
|
-
h = 0;
|
|
48
|
-
s = 0;
|
|
49
|
-
} else {
|
|
50
|
-
var diff = max - min;
|
|
51
|
-
s = l > 0.5 ? diff / (2 - max - min) : diff / (max + min);
|
|
52
|
-
switch (max) {
|
|
53
|
-
case r:
|
|
54
|
-
h = (g - b) / diff + (g < b ? 6 : 0);
|
|
55
|
-
break;
|
|
56
|
-
case g:
|
|
57
|
-
h = (b - r) / diff + 2;
|
|
58
|
-
break;
|
|
59
|
-
case b:
|
|
60
|
-
h = (r - g) / diff + 4;
|
|
61
|
-
break;
|
|
62
|
-
default:
|
|
63
|
-
h = 0;
|
|
64
|
-
}
|
|
65
|
-
h /= 6;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// * 360 for having the hue in degrees
|
|
69
|
-
return [Math.round(h * 360), Math.round(s * 100), Math.round(l * 100)];
|
|
70
|
-
};
|
|
71
|
-
export var colorToHsl = function colorToHsl(color) {
|
|
72
|
-
if (color.startsWith('#')) {
|
|
73
|
-
var hex = color;
|
|
74
|
-
if (color.length === 4) {
|
|
75
|
-
hex = "#".concat(color[1]).concat(color[1]).concat(color[2]).concat(color[2]).concat(color[3]).concat(color[3]);
|
|
76
|
-
}
|
|
77
|
-
return rgbToHsl.apply(void 0, _toConsumableArray(hexToRgb(hex)));
|
|
78
|
-
}
|
|
79
|
-
if (color.startsWith('rgb')) {
|
|
80
|
-
var colorInRgb = rgbStringToArray(color);
|
|
81
|
-
return rgbToHsl.apply(void 0, _toConsumableArray(colorInRgb));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// if the color is in text and no one from previous then return the default color which is black
|
|
85
|
-
if (typeof color === 'string') {
|
|
86
|
-
return [0, 0, 0];
|
|
87
|
-
}
|
|
88
|
-
return color;
|
|
89
|
-
};
|
|
90
|
-
export var colorToRgb = function colorToRgb(color) {
|
|
91
|
-
// we are not handling (hsl/color name) here cause we are accepting only HEX and RGB colors as default colors from user.
|
|
92
|
-
if (color.startsWith('#')) {
|
|
93
|
-
return hexToRgb(color);
|
|
94
|
-
}
|
|
95
|
-
if (color.startsWith('rgb')) {
|
|
96
|
-
return rgbStringToArray(color);
|
|
97
|
-
}
|
|
98
|
-
if (typeof color === 'string') {
|
|
99
|
-
return [0, 0, 0];
|
|
100
|
-
}
|
|
101
|
-
return color;
|
|
102
|
-
};
|
|
103
|
-
export var colorToHex = function colorToHex(color) {
|
|
104
|
-
if (color.startsWith('#')) {
|
|
105
|
-
if (color.length === 7) {
|
|
106
|
-
return color;
|
|
107
|
-
}
|
|
108
|
-
return "#".concat(color[0]).concat(color[0]).concat(color[1]).concat(color[1]).concat(color[2]).concat(color[2]);
|
|
109
|
-
}
|
|
110
|
-
if (color.startsWith('rgb')) {
|
|
111
|
-
return rgbToHex.apply(void 0, _toConsumableArray(rgbStringToArray(color)));
|
|
112
|
-
}
|
|
113
|
-
if (typeof color === 'string') {
|
|
114
|
-
return '#000000';
|
|
115
|
-
}
|
|
116
|
-
return color;
|
|
117
|
-
};
|
|
118
|
-
var checkIsBlack = function checkIsBlack(s, l) {
|
|
119
|
-
return l === 0 && (s === 0 || s === 1);
|
|
120
|
-
};
|
|
121
|
-
var checkIsWhite = function checkIsWhite(s, l) {
|
|
122
|
-
return s === 0 && l === 1;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// both hsv and hsl values are in [0, 1] except h is in [0, 360]
|
|
126
|
-
export var hsvToHsl = function hsvToHsl(h, s, v) {
|
|
127
|
-
var newS = s;
|
|
128
|
-
var l = (2 - s) * v / 2;
|
|
129
|
-
if (l !== 0) {
|
|
130
|
-
if (l === 1) {
|
|
131
|
-
newS = 0;
|
|
132
|
-
} else if (l < 0.5) {
|
|
133
|
-
newS = newS * v / (l * 2);
|
|
134
|
-
} else {
|
|
135
|
-
newS = newS * v / (2 - l * 2);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
var isBlack = checkIsBlack(newS, l);
|
|
139
|
-
return [isBlack || checkIsWhite(newS, l) ? 0 : h, isBlack ? 0 : Math.round(newS * 100), Math.round(l * 100)];
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// both hsv and hsl values are in [0, 1] except h is in [0, 360]
|
|
143
|
-
export var hslToHsv = function hslToHsv(h, s, l) {
|
|
144
|
-
var newS = s;
|
|
145
|
-
var newL = l * 2;
|
|
146
|
-
newS *= newL <= 1 ? newL : 2 - newL;
|
|
147
|
-
var v = (newL + newS) / 2;
|
|
148
|
-
newS = 2 * newS / (newL + newS);
|
|
149
|
-
|
|
150
|
-
// return [h, newS, v];
|
|
151
|
-
var isBlack = checkIsBlack(newS, l);
|
|
152
|
-
return [isBlack || checkIsWhite(newS, l) ? 0 : h, isBlack ? 0 : Math.round(newS * 100), Math.round(v * 100)];
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// TODO: validating 3 color code for Hex
|
|
156
|
-
// /^#([\da-f]{3}){1,2}$/i.test(color)colorToHex
|
|
157
|
-
export var validateHex = function validateHex(color) {
|
|
158
|
-
return /^#[\da-f]{6}$/i.test(color);
|
|
159
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function convertToString(text: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function escapeRegExp(text: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateClassNames(componentName: string, subClassNames?: string | string[]): string;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
export function generateClassNames(componentName, subClassNames) {
|
|
3
|
-
var generateClassName = function generateClassName(subClassName) {
|
|
4
|
-
return "Sfx".concat(componentName).concat(subClassName ? "-".concat(subClassName) : '');
|
|
5
|
-
};
|
|
6
|
-
var classNameArray = [];
|
|
7
|
-
if (subClassNames) {
|
|
8
|
-
if (Array.isArray(subClassNames)) {
|
|
9
|
-
classNameArray.push.apply(classNameArray, _toConsumableArray(subClassNames.filter(function (subClassName) {
|
|
10
|
-
return typeof subClassName === 'string';
|
|
11
|
-
}).map(function (subClassName) {
|
|
12
|
-
return generateClassName(subClassName);
|
|
13
|
-
})));
|
|
14
|
-
} else if (typeof subClassNames === 'string') {
|
|
15
|
-
classNameArray.push(generateClassName(subClassNames));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (classNameArray.length === 0) {
|
|
19
|
-
classNameArray.push(generateClassName());
|
|
20
|
-
}
|
|
21
|
-
return classNameArray.join(' ');
|
|
22
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function getElemDocumentCoords(elem) {
|
|
2
|
-
if (!elem) {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
var box = elem.getBoundingClientRect();
|
|
6
|
-
var _document = document,
|
|
7
|
-
body = _document.body;
|
|
8
|
-
var docEl = document.documentElement;
|
|
9
|
-
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
|
|
10
|
-
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
|
|
11
|
-
var clientTop = docEl.clientTop || body.clientTop || 0;
|
|
12
|
-
var clientLeft = docEl.clientLeft || body.clientLeft || 0;
|
|
13
|
-
var top = box.top + scrollTop - clientTop;
|
|
14
|
-
var left = box.left + scrollLeft - clientLeft;
|
|
15
|
-
return {
|
|
16
|
-
top: Math.round(top),
|
|
17
|
-
left: Math.round(left),
|
|
18
|
-
width: box.width,
|
|
19
|
-
height: box.height
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ignoreEvent: (event: any) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './generate-class-names';
|
|
2
|
-
export * from './object-keys';
|
|
3
|
-
export * from './object-values';
|
|
4
|
-
export * from './apply-polymorphic-function-prop';
|
|
5
|
-
export * from './apply-display-names';
|
|
6
|
-
export * from './use-fork-ref';
|
|
7
|
-
export * from './color-picker/color-converters';
|
|
8
|
-
export * from './get-elem-document-coords';
|
|
9
|
-
export * from './slider/utils';
|
|
10
|
-
export * from './escape-regexp';
|
|
11
|
-
export * from './ignore-event';
|
package/utils/functions/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './generate-class-names';
|
|
2
|
-
// export * from './intrinsic-component';
|
|
3
|
-
export * from './object-keys';
|
|
4
|
-
export * from './object-values';
|
|
5
|
-
export * from './apply-polymorphic-function-prop';
|
|
6
|
-
export * from './apply-display-names';
|
|
7
|
-
export * from './use-fork-ref';
|
|
8
|
-
export * from './color-picker/color-converters';
|
|
9
|
-
export * from './get-elem-document-coords';
|
|
10
|
-
export * from './slider/utils';
|
|
11
|
-
export * from './escape-regexp';
|
|
12
|
-
export * from './ignore-event';
|
|
File without changes
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// DEPRECATED after React upgrade to v19
|
|
2
|
-
// import {
|
|
3
|
-
// forwardRef,
|
|
4
|
-
// ForwardRefExoticComponent,
|
|
5
|
-
// ForwardRefRenderFunction,
|
|
6
|
-
// MutableRefObject,
|
|
7
|
-
// PropsWithoutRef,
|
|
8
|
-
// ReactElement,
|
|
9
|
-
// RefAttributes,
|
|
10
|
-
// } from 'react';
|
|
11
|
-
|
|
12
|
-
// interface RenderFunction<P, E>
|
|
13
|
-
// extends Pick<ForwardRefRenderFunction<E, P>, 'defaultProps' | 'displayName' | 'propTypes'> {
|
|
14
|
-
// (props: P, ref: ((instance: E | null) => void) | MutableRefObject<E | null> | null): ReactElement | null;
|
|
15
|
-
// }
|
|
16
|
-
|
|
17
|
-
// /**
|
|
18
|
-
// * Wrapper around React's `forwardRef` function, which adds a `displayName` to each component
|
|
19
|
-
// * created using it
|
|
20
|
-
// */
|
|
21
|
-
// export function intrinsicComponent<P = Record<string, unknown>, E = HTMLElement>(
|
|
22
|
-
// render: RenderFunction<P, E>,
|
|
23
|
-
// displayName?: string
|
|
24
|
-
// ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<E>> {
|
|
25
|
-
// const component = forwardRef<E, P>(render);
|
|
26
|
-
// component.displayName = displayName || render.name;
|
|
27
|
-
// return component;
|
|
28
|
-
// }
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* passes {value} to {ref}
|
|
4
|
-
* Useful if you want to expose the ref of an inner component to the public API
|
|
5
|
-
* while still using it inside the component.
|
|
6
|
-
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
7
|
-
*/
|
|
8
|
-
export default function setRef<T>(ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined, value: T | null): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* passes {value} to {ref}
|
|
3
|
-
* Useful if you want to expose the ref of an inner component to the public API
|
|
4
|
-
* while still using it inside the component.
|
|
5
|
-
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
6
|
-
*/
|
|
7
|
-
export default function setRef(ref, value) {
|
|
8
|
-
if (typeof ref === 'function') {
|
|
9
|
-
ref(value);
|
|
10
|
-
} else if (ref) {
|
|
11
|
-
ref.current = value;
|
|
12
|
-
}
|
|
13
|
-
}
|