@scaleflex/ui-tw 0.0.2 → 0.0.5
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/card/card.component.d.ts +9 -0
- package/card/card.component.js +59 -0
- package/card/index.d.ts +1 -0
- package/card/index.js +1 -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
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["label", "radioProps", "readOnly", "disabled", "radioStyles", "labelStyles", "onChange", "size", "checked", "labelReverseOrder", "ref"];
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { cn } from '../../utils/functions/shadcn-utils';
|
|
9
|
-
import Radio, { RadioSize } from '../radio';
|
|
10
|
-
var RadioGroup = function RadioGroup(_ref) {
|
|
11
|
-
var label = _ref.label,
|
|
12
|
-
radioProps = _ref.radioProps,
|
|
13
|
-
readOnly = _ref.readOnly,
|
|
14
|
-
disabled = _ref.disabled,
|
|
15
|
-
radioStyles = _ref.radioStyles,
|
|
16
|
-
labelStyles = _ref.labelStyles,
|
|
17
|
-
onChange = _ref.onChange,
|
|
18
|
-
_ref$size = _ref.size,
|
|
19
|
-
size = _ref$size === void 0 ? RadioSize.Sm : _ref$size,
|
|
20
|
-
_ref$checked = _ref.checked,
|
|
21
|
-
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
22
|
-
_ref$labelReverseOrde = _ref.labelReverseOrder,
|
|
23
|
-
labelReverseOrder = _ref$labelReverseOrde === void 0 ? false : _ref$labelReverseOrde,
|
|
24
|
-
ref = _ref.ref,
|
|
25
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
var cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer';
|
|
27
|
-
var labelClasses = cn("flex items-center gap-2 ".concat(disabled ? 'text-textplaceholder' : 'text-textprimary'), cursorStyleClasses);
|
|
28
|
-
var labelTextClasses = "".concat(labelReverseOrder ? 'order-2' : '');
|
|
29
|
-
var radioGroupWraperClasses = cn('relative box-content inline-flex items-center', cursorStyleClasses);
|
|
30
|
-
return /*#__PURE__*/React.createElement("span", _extends({
|
|
31
|
-
className: radioGroupWraperClasses,
|
|
32
|
-
ref: ref
|
|
33
|
-
}, rest), /*#__PURE__*/React.createElement("label", {
|
|
34
|
-
className: labelClasses,
|
|
35
|
-
style: _objectSpread({}, labelStyles)
|
|
36
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
37
|
-
className: labelTextClasses
|
|
38
|
-
}, label), /*#__PURE__*/React.createElement(Radio, {
|
|
39
|
-
radioProps: radioProps,
|
|
40
|
-
readOnly: readOnly,
|
|
41
|
-
disabled: disabled,
|
|
42
|
-
checked: checked,
|
|
43
|
-
onChange: onChange,
|
|
44
|
-
size: size,
|
|
45
|
-
style: _objectSpread({}, radioStyles)
|
|
46
|
-
})));
|
|
47
|
-
};
|
|
48
|
-
export default RadioGroup;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'react';
|
|
2
|
-
import { RadioSizeType } from '../radio/radio.props';
|
|
3
|
-
export interface RadioGroupProps extends React.HTMLAttributes<HTMLLabelElement> {
|
|
4
|
-
label?: React.ReactNode;
|
|
5
|
-
radioProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
6
|
-
radioStyles?: object;
|
|
7
|
-
labelStyles?: object;
|
|
8
|
-
readOnly?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
labelReverseOrder?: boolean;
|
|
11
|
-
checked?: boolean;
|
|
12
|
-
size?: RadioSizeType;
|
|
13
|
-
onChange?: (event: any) => void;
|
|
14
|
-
ref?: Ref<HTMLLabelElement>;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/core/switcher/index.d.ts
DELETED
package/core/switcher/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["size", "checked", "onChange", "SwitcherPropsData", "switcherProps", "readOnly", "disabled", "children", "ref"];
|
|
4
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { ignoreEvent } from '../../utils/functions';
|
|
7
|
-
import { SwitcherSize } from './switcher-size';
|
|
8
|
-
var Switcher = function Switcher(_ref) {
|
|
9
|
-
var _ref$size = _ref.size,
|
|
10
|
-
size = _ref$size === void 0 ? SwitcherSize.Sm : _ref$size,
|
|
11
|
-
_ref$checked = _ref.checked,
|
|
12
|
-
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
13
|
-
onChange = _ref.onChange,
|
|
14
|
-
SwitcherPropsData = _ref.SwitcherPropsData,
|
|
15
|
-
switcherProps = _ref.switcherProps,
|
|
16
|
-
readOnly = _ref.readOnly,
|
|
17
|
-
disabled = _ref.disabled,
|
|
18
|
-
children = _ref.children,
|
|
19
|
-
ref = _ref.ref,
|
|
20
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
var cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer';
|
|
22
|
-
var switcherWrapperClasses = "switcher-wrapper relative inline-flex ".concat(cursorStyleClasses);
|
|
23
|
-
var switcherSize = size === SwitcherSize.Lg ? 'w-15 h-7.5' : size === SwitcherSize.Md ? 'w-10 h-5' : size === SwitcherSize.Sm ? 'w-8 h-4' : 'w-8 h-4';
|
|
24
|
-
var switcherIconSize = size === SwitcherSize.Lg ? 'before:w-6 before:h-6' : size === SwitcherSize.Md ? 'before:w-4 before:h-4' : size === SwitcherSize.Sm ? 'before:w-3 before:h-3' : 'before:w-3 before:h-3';
|
|
25
|
-
var inputClasses = cn('peer opacity-0 absolute z-50 ', cursorStyleClasses, switcherSize);
|
|
26
|
-
var switcherIconClasses = cn('before:content-[""] before:absolute before:rounded-3xl before:top-1/2 before:-translate-y-1/2 peer-not-checked:before:translate-x-1/2', // `${size === SwitcherSize.Lg ? 'before:left-0.75' : 'before:left-0.5'}`,
|
|
27
|
-
// `${size === SwitcherSize.Lg ? 'peer-not-checked:before:left-0.75 peer-checked:before:right-0.75' : 'peer-not-checked:before:left-0.5 peer-checked:before:right-0.5'}`,
|
|
28
|
-
"".concat(size === SwitcherSize.Lg ? 'peer-not-checked:before:right-3/4 peer-checked:before:right-0.75' : ''), "".concat(size === SwitcherSize.Md ? 'peer-not-checked:before:right-3/4 peer-checked:before:right-0.5' : ''), "".concat(size === SwitcherSize.Sm ? 'peer-not-checked:before:right-3/4 peer-checked:before:right-0.5' : ''), "".concat(disabled ? 'before:bg-background-grey' : 'before:bg-icons-muted'), 'peer-checked:before:bg-background-stateless', 'before:transition-[right,opacity] before:duration-[300ms,500ms] before:ease-[ease,ease] before:delay-[0s,0s]', switcherIconSize);
|
|
29
|
-
var switcherIconInnerSize = size === SwitcherSize.Lg ? 'after:w-2 after:h-2' : size === SwitcherSize.Md ? 'after:w-1.5 after:h-1.5' : size === SwitcherSize.Sm ? 'after:w-1 after:h-1' : 'after:w-1 after:h-1';
|
|
30
|
-
var switcherIconInnerCircleClasses = cn('after:content-[""] after:absolute after:rounded-2xl after:top-1/2 after:bg-icons-invert after:-translate-y-1/2 peer-not-checked:after:translate-x-1/2 after:opacity-0', // `${size === SwitcherSize.Lg ? 'peer-not-checked:after:left-[6px] peer-checked:after:right-[9.5px]' : ''}`,
|
|
31
|
-
// `${size === SwitcherSize.Md ? 'peer-not-checked:after:left-[3.5px] peer-checked:after:right-[6px]' : ''}`,
|
|
32
|
-
// `${size === SwitcherSize.Sm ? 'peer-not-checked:after:left-[3.5px] peer-checked:after:right-[5px]' : ''}`,
|
|
33
|
-
"".concat(size === SwitcherSize.Lg ? 'peer-not-checked:after:right-3/4 peer-checked:after:right-[9.5px]' : ''), "".concat(size === SwitcherSize.Md ? 'peer-not-checked:after:right-3/4 peer-checked:after:right-[6px]' : ''), "".concat(size === SwitcherSize.Sm ? 'peer-not-checked:after:right-3/4 peer-checked:after:right-[5px]' : ''), 'after:transition-[right,opacity] after:duration-[300ms,500ms] after:ease-[ease,ease] after:delay-[0s,0s]', "".concat(disabled ? '' : 'peer-hover:after:opacity-100'), "".concat(disabled ? 'peer-checked:bg-accent-2-8-Opacity' : 'peer-checked:bg-accent-primary'), 'peer-checked:after:bg-accent-2-8-Opacity', switcherIconInnerSize);
|
|
34
|
-
var switcherClasses = cn('switcher relative rounded-2xl', switcherSize, switcherIconClasses, switcherIconInnerCircleClasses, "".concat(disabled ? 'bg-background-active' : 'bg-background-grey'));
|
|
35
|
-
var switcherContentWrapperFontSize = size === SwitcherSize.Lg ? 'text-sm' : size === SwitcherSize.Md ? 'text-[10px]' : size === SwitcherSize.Sm ? 'text-[8px]' : 'text-sm';
|
|
36
|
-
var switcherContentMaxWidth = size === SwitcherSize.Lg ? 'max-w-6' : size === SwitcherSize.Md ? 'max-w-4' : size === SwitcherSize.Sm ? 'max-w-3' : 'max-w-3';
|
|
37
|
-
var switcherContentWrapperClasses = cn('inline-flex absolute top-1/2 -translate-y-1/2 -translate-x-1/2 duration-100 overflow-hidden', "".concat(checked ? 'left-[30%]' : 'left-[65%]'), switcherContentWrapperFontSize, switcherContentMaxWidth);
|
|
38
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
39
|
-
className: switcherWrapperClasses,
|
|
40
|
-
ref: ref
|
|
41
|
-
}, SwitcherPropsData, rest), /*#__PURE__*/React.createElement("input", _extends({
|
|
42
|
-
checked: checked,
|
|
43
|
-
type: "checkbox",
|
|
44
|
-
className: inputClasses,
|
|
45
|
-
onChange: readOnly || disabled ? ignoreEvent : onChange,
|
|
46
|
-
readOnly: readOnly,
|
|
47
|
-
disabled: disabled
|
|
48
|
-
}, switcherProps)), /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: switcherClasses
|
|
50
|
-
}, children && /*#__PURE__*/React.createElement("span", {
|
|
51
|
-
className: switcherContentWrapperClasses
|
|
52
|
-
}, children)));
|
|
53
|
-
};
|
|
54
|
-
export default Switcher;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { ChangeEvent, Ref } from 'react';
|
|
2
|
-
import { Values } from '../../utils/types';
|
|
3
|
-
import { SwitcherSize } from './switcher-size';
|
|
4
|
-
export type SwitcherSizeType = Values<typeof SwitcherSize>;
|
|
5
|
-
export interface SwitcherProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
checked?: boolean;
|
|
7
|
-
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
-
switcherProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
|
9
|
-
SwitcherPropsData?: React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
-
readOnly?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
size?: SwitcherSizeType;
|
|
13
|
-
ref?: Ref<HTMLDivElement>;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SwitcherSizeType } from './switcher.props';
|
|
2
|
-
export declare const getSwitcherSize: (sizeName?: SwitcherSizeType) => number;
|
|
3
|
-
export declare const getSwitcherFont: (sizeName?: SwitcherSizeType) => number;
|
|
4
|
-
export declare const getSwitcherIconSize: (sizeName?: SwitcherSizeType) => number;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SwitcherSize } from './switcher-size';
|
|
2
|
-
export var getSwitcherSize = function getSwitcherSize(sizeName) {
|
|
3
|
-
switch (sizeName) {
|
|
4
|
-
case SwitcherSize.Lg:
|
|
5
|
-
return 30;
|
|
6
|
-
case SwitcherSize.Md:
|
|
7
|
-
return 20;
|
|
8
|
-
case SwitcherSize.Sm:
|
|
9
|
-
return 16;
|
|
10
|
-
default:
|
|
11
|
-
return 16;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
export var getSwitcherFont = function getSwitcherFont(sizeName) {
|
|
15
|
-
switch (sizeName) {
|
|
16
|
-
case SwitcherSize.Lg:
|
|
17
|
-
return 14;
|
|
18
|
-
case SwitcherSize.Md:
|
|
19
|
-
return 10;
|
|
20
|
-
case SwitcherSize.Sm:
|
|
21
|
-
return 8;
|
|
22
|
-
default:
|
|
23
|
-
return 14;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export var getSwitcherIconSize = function getSwitcherIconSize(sizeName) {
|
|
27
|
-
switch (sizeName) {
|
|
28
|
-
case SwitcherSize.Lg:
|
|
29
|
-
return 24;
|
|
30
|
-
case SwitcherSize.Md:
|
|
31
|
-
return 16;
|
|
32
|
-
case SwitcherSize.Sm:
|
|
33
|
-
return 12;
|
|
34
|
-
default:
|
|
35
|
-
return 12;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './switcher-group.component';
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["size", "label", "switcherProps", "SwitcherProps", "checked", "onChange", "readOnly", "disabled", "ref"];
|
|
4
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import Switcher from '../switcher';
|
|
7
|
-
import { SwitcherSize } from '../switcher/switcher-size';
|
|
8
|
-
var SwitcherGroup = function SwitcherGroup(_ref) {
|
|
9
|
-
var _ref$size = _ref.size,
|
|
10
|
-
size = _ref$size === void 0 ? SwitcherSize.Sm : _ref$size,
|
|
11
|
-
label = _ref.label,
|
|
12
|
-
switcherProps = _ref.switcherProps,
|
|
13
|
-
SwitcherProps = _ref.SwitcherProps,
|
|
14
|
-
_ref$checked = _ref.checked,
|
|
15
|
-
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
16
|
-
onChange = _ref.onChange,
|
|
17
|
-
readOnly = _ref.readOnly,
|
|
18
|
-
disabled = _ref.disabled,
|
|
19
|
-
ref = _ref.ref,
|
|
20
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
var cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer';
|
|
22
|
-
var switcherGroupLabelClasses = cn('relative inline-flex items-center', cursorStyleClasses);
|
|
23
|
-
var switcherGroupLabelTextClasses = cn('flex items-center ml-2', "".concat(disabled ? 'text-icons-muted' : 'text-textprimary'),
|
|
24
|
-
// TODO: add styles from ${fontSizeSwitcherMixin[size]}
|
|
25
|
-
cursorStyleClasses);
|
|
26
|
-
return /*#__PURE__*/React.createElement("label", _extends({
|
|
27
|
-
className: switcherGroupLabelClasses,
|
|
28
|
-
ref: ref
|
|
29
|
-
}, rest), /*#__PURE__*/React.createElement(Switcher, {
|
|
30
|
-
size: size,
|
|
31
|
-
SwitcherPropsData: SwitcherProps,
|
|
32
|
-
switcherProps: switcherProps,
|
|
33
|
-
readOnly: readOnly,
|
|
34
|
-
disabled: disabled,
|
|
35
|
-
onChange: onChange,
|
|
36
|
-
checked: checked
|
|
37
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
38
|
-
className: switcherGroupLabelTextClasses
|
|
39
|
-
}, label));
|
|
40
|
-
};
|
|
41
|
-
export default SwitcherGroup;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, Ref } from 'react';
|
|
2
|
-
import { SwitcherSizeType } from '../switcher/switcher.props';
|
|
3
|
-
export interface SwitcherGroupProps extends Omit<React.HTMLAttributes<HTMLLabelElement>, 'onChange'> {
|
|
4
|
-
label?: string;
|
|
5
|
-
switcherProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
|
6
|
-
SwitcherProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
7
|
-
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
-
readOnly?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
checked?: boolean;
|
|
11
|
-
size?: SwitcherSizeType;
|
|
12
|
-
ref?: Ref<HTMLLabelElement>;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/core/tab/index.d.ts
DELETED
package/core/tab/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './tab.component';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["icon", "label", "active", "disabled", "notification", "className", "size", "ref"];
|
|
4
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { Size } from './types';
|
|
7
|
-
var Tab = function Tab(_ref) {
|
|
8
|
-
var _ref$icon = _ref.icon,
|
|
9
|
-
icon = _ref$icon === void 0 ? false : _ref$icon,
|
|
10
|
-
label = _ref.label,
|
|
11
|
-
active = _ref.active,
|
|
12
|
-
disabled = _ref.disabled,
|
|
13
|
-
notification = _ref.notification,
|
|
14
|
-
className = _ref.className,
|
|
15
|
-
_ref$size = _ref.size,
|
|
16
|
-
size = _ref$size === void 0 ? Size.Md : _ref$size,
|
|
17
|
-
ref = _ref.ref,
|
|
18
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
-
var transitionClasses = 'transition-all duration-100 ease-out';
|
|
20
|
-
var fontClasses = '';
|
|
21
|
-
var svgSizeClasses = '';
|
|
22
|
-
if (size === Size.Lg) {
|
|
23
|
-
fontClasses = 'text-lg';
|
|
24
|
-
svgSizeClasses = '[&_svg]:h-5 [&_svg]:w-5';
|
|
25
|
-
}
|
|
26
|
-
if (size === Size.Md) {
|
|
27
|
-
fontClasses = 'text-base';
|
|
28
|
-
svgSizeClasses = '[&_svg]:h-4 [&_svg]:w-4';
|
|
29
|
-
}
|
|
30
|
-
if (size === Size.Sm) {
|
|
31
|
-
fontClasses = 'text-sm';
|
|
32
|
-
svgSizeClasses = '[&_svg]:h-3.5 [&_svg]:w-3.5';
|
|
33
|
-
}
|
|
34
|
-
var tabClasses = cn(className, 'group/tab relative inline-flex items-center text-center py-2', disabled ? 'text-icons-muted' : 'text-textprimary', active ? 'active text-primary-active' : '', !disabled ? 'cursor-pointer hover:text-primary-hover active:text-primary-active hover:border-b-2 hover:border-accent-1-8-Opacity active:border-b-2 active:border-primary-active' : '', transitionClasses, fontClasses);
|
|
35
|
-
var groupChildrenColorClasses = !disabled ? 'group-hover/tab:text-primary-hover group-active/tab:text-primary-active' : '';
|
|
36
|
-
var iconClasses = "".concat(disabled ? 'text-icons-muted' : active ? 'text-accent-primary' : 'text-icons-primary', " ").concat(groupChildrenColorClasses, " ").concat(transitionClasses, " ").concat(fontClasses, " ").concat(svgSizeClasses);
|
|
37
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
38
|
-
ref: ref
|
|
39
|
-
}, rest, {
|
|
40
|
-
className: tabClasses
|
|
41
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
42
|
-
className: "relative"
|
|
43
|
-
}, icon && /*#__PURE__*/React.createElement("div", {
|
|
44
|
-
className: iconClasses /*size={size}*/
|
|
45
|
-
}, icon), notification && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
46
|
-
className: "bg-icons-free absolute -top-0.5 -right-1 box-content h-1.5 w-1.5 rounded-full border-1 border-solid border-white group-active/tab:hidden ".concat(active ? 'hidden' : '')
|
|
47
|
-
})), label && /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: "ml-2 ".concat(transitionClasses, " ").concat(active ? 'text-accent-primary' : '')
|
|
49
|
-
}, label));
|
|
50
|
-
};
|
|
51
|
-
Tab.displayName = 'Tab';
|
|
52
|
-
export default Tab;
|
package/core/tab/tab.props.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'react';
|
|
2
|
-
import type { Values } from '../../utils/types';
|
|
3
|
-
import { Size } from './types';
|
|
4
|
-
export type TabSizeType = Values<typeof Size>;
|
|
5
|
-
export interface TabProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
size?: TabSizeType;
|
|
7
|
-
icon?: React.ReactNode;
|
|
8
|
-
label?: React.ReactNode;
|
|
9
|
-
badge?: React.ReactNode;
|
|
10
|
-
value?: string | number;
|
|
11
|
-
active?: boolean;
|
|
12
|
-
notification?: string;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
ref?: Ref<HTMLDivElement>;
|
|
15
|
-
}
|
package/core/tab/tab.props.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './size';
|
package/core/tab/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './size';
|
package/core/tab/types/size.d.ts
DELETED
package/core/tab-panel/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './tab-panel.component';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["value", "index", "ref"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
var TabPanel = function TabPanel(_ref) {
|
|
6
|
-
var value = _ref.value,
|
|
7
|
-
index = _ref.index,
|
|
8
|
-
ref = _ref.ref,
|
|
9
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
10
|
-
if (value !== index) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
14
|
-
className: "mt-4",
|
|
15
|
-
ref: ref
|
|
16
|
-
}, rest));
|
|
17
|
-
};
|
|
18
|
-
export default TabPanel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './upload-input.component';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["error", "buttonLabel", "buttonVariant", "placeholder", "onChange", "ref"];
|
|
5
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import Button, { ButtonVariant } from '../button';
|
|
8
|
-
var UploadInput = function UploadInput(_ref) {
|
|
9
|
-
var error = _ref.error,
|
|
10
|
-
_ref$buttonLabel = _ref.buttonLabel,
|
|
11
|
-
buttonLabel = _ref$buttonLabel === void 0 ? 'Choose file' : _ref$buttonLabel,
|
|
12
|
-
_ref$buttonVariant = _ref.buttonVariant,
|
|
13
|
-
buttonVariant = _ref$buttonVariant === void 0 ? ButtonVariant.Primary : _ref$buttonVariant,
|
|
14
|
-
_ref$placeholder = _ref.placeholder,
|
|
15
|
-
placeholder = _ref$placeholder === void 0 ? 'No file chosen' : _ref$placeholder,
|
|
16
|
-
_onChange = _ref.onChange,
|
|
17
|
-
ref = _ref.ref,
|
|
18
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
-
var _useState = useState(''),
|
|
20
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
-
valueState = _useState2[0],
|
|
22
|
-
setValueState = _useState2[1];
|
|
23
|
-
var uploadInputWrapClasses = cn('upload-input-wrap relative border-1 border-solid w-75 flex items-center pl-2 justify-end rounded-sm overflow-hidden', 'transition-all duration-100 ease-out', 'hover:border-borders-primary-hover', 'active:border-accent-primary', "".concat(error ? 'bg-background-secondary border-error' : 'border-borders-primary-stateless'));
|
|
24
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className: uploadInputWrapClasses,
|
|
26
|
-
ref: ref,
|
|
27
|
-
onClick: function onClick(_ref2) {
|
|
28
|
-
var currentTarget = _ref2.currentTarget;
|
|
29
|
-
var fileInputElem = currentTarget.querySelector('input[type=file]');
|
|
30
|
-
if (fileInputElem) {
|
|
31
|
-
fileInputElem.click();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
35
|
-
className: "pointer-events-none absolute left-3 ".concat(valueState ? 'text-textprimary' : 'text-textplaceholder')
|
|
36
|
-
}, valueState ? valueState : placeholder), /*#__PURE__*/React.createElement(Button, {
|
|
37
|
-
variant: buttonVariant
|
|
38
|
-
// border left added to simulate button hover event and change it's color
|
|
39
|
-
// margin-right is to hide white gap between button and wraper div border
|
|
40
|
-
,
|
|
41
|
-
className: "my-0 -mr-1 ml-0 rounded-tl-none rounded-bl-none border-l-230 pr-5",
|
|
42
|
-
style: {
|
|
43
|
-
borderColor: 'unset'
|
|
44
|
-
}
|
|
45
|
-
}, buttonLabel), /*#__PURE__*/React.createElement("input", _extends({
|
|
46
|
-
className: "file-input-field hidden"
|
|
47
|
-
}, rest, {
|
|
48
|
-
type: "file",
|
|
49
|
-
onChange: function onChange(event) {
|
|
50
|
-
var files = event.target.files;
|
|
51
|
-
if (files) {
|
|
52
|
-
if (files.length === 0) {
|
|
53
|
-
setValueState('');
|
|
54
|
-
} else if (files.length === 1) {
|
|
55
|
-
setValueState(files[0].name);
|
|
56
|
-
} else if (files.length > 1) {
|
|
57
|
-
setValueState("".concat(files.length, " files"));
|
|
58
|
-
} else {
|
|
59
|
-
setValueState(event.target.value);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (typeof _onChange === 'function') {
|
|
63
|
-
_onChange(event);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
})));
|
|
67
|
-
};
|
|
68
|
-
export default UploadInput;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ButtonVariantType } from '@scaleflex/ui-tw/core/button/button.types';
|
|
2
|
-
import { HTMLAttributes, Ref } from 'react';
|
|
3
|
-
export interface UploadInputProps extends HTMLAttributes<HTMLInputElement> {
|
|
4
|
-
buttonLabel?: string;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
buttonVariant?: ButtonVariantType;
|
|
7
|
-
error?: boolean;
|
|
8
|
-
ref?: Ref<HTMLInputElement>;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/hooks/README.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# @scaleflex/ui-tw/hooks
|
|
2
|
-
|
|
3
|
-
Batch of useful UI-related React hooks.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
Every hook functions is exported by default and should be used inside React components with respect to the
|
|
10
|
-
[rules of hooks](https://reactjs.org/docs/hooks-rules.html).
|
|
11
|
-
|
|
12
|
-
```typescript jsx
|
|
13
|
-
import useMediaQuery from '@scaleflex/ui-tw/hooks/use-portal'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @example
|
|
17
|
-
* <PortalComponent>
|
|
18
|
-
* <p>Portal content</p>
|
|
19
|
-
* </PortalComponent>
|
|
20
|
-
*/
|
|
21
|
-
const PortalComponent = ({ id, children }) => {
|
|
22
|
-
const target = usePortal(id)
|
|
23
|
-
|
|
24
|
-
return createPortal(children, target)
|
|
25
|
-
}
|
|
26
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useControlled({ controlled, default: defaultProp }: any): any;
|
package/hooks/use-controlled.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { useCallback, useRef, useState } from 'react';
|
|
3
|
-
export default function useControlled(_ref) {
|
|
4
|
-
var controlled = _ref.controlled,
|
|
5
|
-
defaultProp = _ref["default"];
|
|
6
|
-
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
7
|
-
var _useRef = useRef(controlled !== undefined),
|
|
8
|
-
isControlled = _useRef.current;
|
|
9
|
-
var _useState = useState(defaultProp),
|
|
10
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
11
|
-
valueState = _useState2[0],
|
|
12
|
-
setValue = _useState2[1];
|
|
13
|
-
var value = isControlled ? controlled : valueState;
|
|
14
|
-
var setValueIfUncontrolled = useCallback(function (newValue) {
|
|
15
|
-
if (!isControlled) {
|
|
16
|
-
setValue(newValue);
|
|
17
|
-
}
|
|
18
|
-
}, []);
|
|
19
|
-
return [value, setValueIfUncontrolled];
|
|
20
|
-
}
|
package/hooks/use-debounce.d.ts
DELETED
package/hooks/use-debounce.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
function useDebounce(value) {
|
|
4
|
-
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
5
|
-
var _useState = useState(value),
|
|
6
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
7
|
-
debouncedValue = _useState2[0],
|
|
8
|
-
setDebouncedValue = _useState2[1];
|
|
9
|
-
useEffect(function () {
|
|
10
|
-
var handler = setTimeout(function () {
|
|
11
|
-
setDebouncedValue(value);
|
|
12
|
-
}, delay);
|
|
13
|
-
return function () {
|
|
14
|
-
clearTimeout(handler);
|
|
15
|
-
};
|
|
16
|
-
}, [value]);
|
|
17
|
-
return debouncedValue;
|
|
18
|
-
}
|
|
19
|
-
export { useDebounce };
|