@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
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["secondary", "onClose", "primaryLabelStyles", "variant", "ref"];
|
|
4
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import CrossButton from '../cross-button';
|
|
7
|
-
import { Variant } from './types';
|
|
8
|
-
var ModalTitle = function ModalTitle(_ref) {
|
|
9
|
-
var secondary = _ref.secondary,
|
|
10
|
-
onClose = _ref.onClose,
|
|
11
|
-
primaryLabelStyles = _ref.primaryLabelStyles,
|
|
12
|
-
_ref$variant = _ref.variant,
|
|
13
|
-
variant = _ref$variant === void 0 ? Variant.Default : _ref$variant,
|
|
14
|
-
ref = _ref.ref,
|
|
15
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
var modalTitleClasses = cn('relative text-textprimary rounded-tl-sm rounded-tr-sm', variant === Variant.WithIcon ? 'flex flex-col items-center pt-6 pb-3 pl-4.5 pr-4.5' : 'pt-3.5 pb-3.5 pl-4.5 pr-10', variant === Variant.Default ? 'bg-background-primary border-b-1 border-solid border-borders-secondary' : '');
|
|
17
|
-
var closeClasses = cn('absolute flex cursor-pointer text-icons-secondary hover:text-accent-primary', variant === Variant.WithIcon ? 'top-0.5 right-0.5' : 'top-2 right-2');
|
|
18
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
19
|
-
className: modalTitleClasses
|
|
20
|
-
}, rest, {
|
|
21
|
-
ref: ref
|
|
22
|
-
}), rest.icon && /*#__PURE__*/React.createElement("div", {
|
|
23
|
-
className: "bg-accent-1-2-opacity text-accent-primary mb-2 flex rounded-full p-3.5"
|
|
24
|
-
}, rest.icon), /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className: "text-lg ".concat(variant === Variant.Default ? 'font-normal' : 'font-medium'),
|
|
26
|
-
style: primaryLabelStyles
|
|
27
|
-
}, rest.primary), variant === Variant.WithIcon && secondary && /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className: "font-xs mt-1"
|
|
29
|
-
}, secondary), /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
className: closeClasses
|
|
31
|
-
}, /*#__PURE__*/React.createElement(CrossButton, {
|
|
32
|
-
size: "lg",
|
|
33
|
-
onClick: onClose
|
|
34
|
-
})));
|
|
35
|
-
};
|
|
36
|
-
ModalTitle.displayName = 'ModalTitle';
|
|
37
|
-
export default ModalTitle;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'react';
|
|
2
|
-
import type { Values } from '../../utils/types';
|
|
3
|
-
import { Variant } from './types';
|
|
4
|
-
export type ModalTitleVariantType = Values<typeof Variant>;
|
|
5
|
-
export interface ModalTitleProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
primary: React.ReactNode;
|
|
7
|
-
secondary?: React.ReactNode;
|
|
8
|
-
primaryLabelStyles?: object;
|
|
9
|
-
icon?: React.ReactNode;
|
|
10
|
-
iconShadow?: boolean;
|
|
11
|
-
onClose?: () => void;
|
|
12
|
-
variant?: ModalTitleVariantType;
|
|
13
|
-
ref?: Ref<HTMLDivElement>;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './variant';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './variant';
|
package/core/pagination/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './pagination.component';
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["getItemAriaLabel", "ref"],
|
|
5
|
-
_excluded2 = ["disabled", "page", "selected", "type"];
|
|
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
|
-
import React from 'react';
|
|
9
|
-
import { usePagination } from '../../hooks/use-pagination';
|
|
10
|
-
import Arrow from '../arrow';
|
|
11
|
-
function defaultGetAriaLabel(type, page, selected) {
|
|
12
|
-
if (type === 'page') {
|
|
13
|
-
return "".concat(selected ? '' : 'Go to ', "page ").concat(page);
|
|
14
|
-
}
|
|
15
|
-
return "Go to ".concat(type, " page");
|
|
16
|
-
}
|
|
17
|
-
var Pagination = function Pagination(props) {
|
|
18
|
-
var _usePagination = usePagination(_objectSpread({}, props)),
|
|
19
|
-
items = _usePagination.items;
|
|
20
|
-
var _props$getItemAriaLab = props.getItemAriaLabel,
|
|
21
|
-
getItemAriaLabel = _props$getItemAriaLab === void 0 ? defaultGetAriaLabel : _props$getItemAriaLab,
|
|
22
|
-
ref = props.ref,
|
|
23
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
24
|
-
var paginationItem = function paginationItem(paginationitems) {
|
|
25
|
-
var _paginationitems$disa = paginationitems.disabled,
|
|
26
|
-
disabled = _paginationitems$disa === void 0 ? false : _paginationitems$disa,
|
|
27
|
-
page = paginationitems.page,
|
|
28
|
-
_paginationitems$sele = paginationitems.selected,
|
|
29
|
-
selected = _paginationitems$sele === void 0 ? false : _paginationitems$sele,
|
|
30
|
-
_paginationitems$type = paginationitems.type,
|
|
31
|
-
type = _paginationitems$type === void 0 ? 'page' : _paginationitems$type,
|
|
32
|
-
other = _objectWithoutProperties(paginationitems, _excluded2);
|
|
33
|
-
var Icons = {
|
|
34
|
-
previous: function previous() {
|
|
35
|
-
return /*#__PURE__*/React.createElement(Arrow, {
|
|
36
|
-
type: "left",
|
|
37
|
-
IconProps: {
|
|
38
|
-
size: '0.5rem'
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
next: function next() {
|
|
43
|
-
return /*#__PURE__*/React.createElement(Arrow, {
|
|
44
|
-
type: "right",
|
|
45
|
-
IconProps: {
|
|
46
|
-
size: '0.5rem'
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
// first: FirstPageIcon,
|
|
51
|
-
// last: LastPageIcon,
|
|
52
|
-
};
|
|
53
|
-
var paginationItemClasses = "mx-1 my-0 inline-flex h-6 min-w-6 cursor-pointer items-center justify-center border-0 bg-transparent px-1.5 py-0 text-center outline-0 transition-all duration-100 ease-out select-none text-xs font-normal ".concat(selected ? 'text-primary-hover' : 'text-textprimary');
|
|
54
|
-
var Icon = Icons[type];
|
|
55
|
-
return type === 'start-ellipsis' || type === 'end-ellipsis' ? /*#__PURE__*/React.createElement("button", _extends({
|
|
56
|
-
className: paginationItemClasses,
|
|
57
|
-
disabled: disabled,
|
|
58
|
-
selected: selected
|
|
59
|
-
}, other), "\u2026") : /*#__PURE__*/React.createElement("button", _extends({
|
|
60
|
-
className: paginationItemClasses,
|
|
61
|
-
ref: ref,
|
|
62
|
-
disabled: disabled,
|
|
63
|
-
selected: selected
|
|
64
|
-
}, other), type === 'page' && page, Icon ? /*#__PURE__*/React.createElement(Icon, null) : null);
|
|
65
|
-
};
|
|
66
|
-
return /*#__PURE__*/React.createElement("nav", {
|
|
67
|
-
className: "pagination-nav",
|
|
68
|
-
ref: ref,
|
|
69
|
-
style: rest.style
|
|
70
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
className: "m-0 flex list-none flex-wrap items-center p-0"
|
|
72
|
-
}, items.map(function (item, index) {
|
|
73
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
74
|
-
key: index
|
|
75
|
-
}, paginationItem(_objectSpread(_objectSpread({}, item), {}, {
|
|
76
|
-
'aria-label': getItemAriaLabel(item.type, item.page, item.selected),
|
|
77
|
-
varaint: 'text'
|
|
78
|
-
})));
|
|
79
|
-
})));
|
|
80
|
-
};
|
|
81
|
-
export default Pagination;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
2
|
-
boundaryCount?: number;
|
|
3
|
-
count?: number;
|
|
4
|
-
defaultPage?: number;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
onChange?: (event: any, value: any) => void;
|
|
7
|
-
getItemAriaLabel?: (type: string, page: number, selected: boolean) => string;
|
|
8
|
-
page?: number;
|
|
9
|
-
siblingCount?: number;
|
|
10
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/core/popper/index.d.ts
DELETED
package/core/popper/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './popper.component';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { PopperProps } from './popper.props';
|
|
2
|
-
declare const Popper: ({ anchorEl, children, open, warning, position: initialPlacement, arrow, popperOptions, overlay, zIndex, enableUnderlayingEvent, wrapperStyles, disablePortal, onClick, ref, ...rest }: PopperProps) => JSX.Element;
|
|
3
|
-
export default Popper;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["anchorEl", "children", "open", "warning", "position", "arrow", "popperOptions", "overlay", "zIndex", "enableUnderlayingEvent", "wrapperStyles", "disablePortal", "onClick", "ref"];
|
|
5
|
-
var _popperArrowPosition;
|
|
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
|
-
import { createPopper } from '@popperjs/core';
|
|
9
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
10
|
-
import React, { useEffect, useRef } from 'react';
|
|
11
|
-
import { createPortal } from 'react-dom';
|
|
12
|
-
import usePortal from '../../hooks/use-portal';
|
|
13
|
-
import { generateClassNames, useForkRef } from '../../utils/functions';
|
|
14
|
-
import { passEventToUnderLayingEvent } from './popper.utils';
|
|
15
|
-
import { Position } from './types';
|
|
16
|
-
var popperArrowPosition = (_popperArrowPosition = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_popperArrowPosition, Position.Auto, 'top-0 left-0 right-0 bottom-0'), Position.AutoStart, 'top-0 left-0 right-0 bottom-0'), Position.AutoEnd, 'top-0 left-0 right-0 bottom-0'), Position.Right, '-left-1'), Position.RightStart, '-left-1'), Position.RightEnd, '-left-1'), Position.Left, '-right-1'), Position.LeftStart, '-right-1'), Position.LeftEnd, '-right-1'), Position.Top, '-bottom-1'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_popperArrowPosition, Position.TopStart, '-bottom-1'), Position.TopEnd, '-bottom-1'), Position.Bottom, '-top-1'), Position.BottomStart, '-top-1'), Position.BottomEnd, '-top-1'));
|
|
17
|
-
var Popper = function Popper(_ref) {
|
|
18
|
-
var anchorEl = _ref.anchorEl,
|
|
19
|
-
children = _ref.children,
|
|
20
|
-
open = _ref.open,
|
|
21
|
-
_ref$warning = _ref.warning,
|
|
22
|
-
warning = _ref$warning === void 0 ? false : _ref$warning,
|
|
23
|
-
_ref$position = _ref.position,
|
|
24
|
-
initialPlacement = _ref$position === void 0 ? Position.Bottom : _ref$position,
|
|
25
|
-
_ref$arrow = _ref.arrow,
|
|
26
|
-
arrow = _ref$arrow === void 0 ? true : _ref$arrow,
|
|
27
|
-
_ref$popperOptions = _ref.popperOptions,
|
|
28
|
-
popperOptions = _ref$popperOptions === void 0 ? {} : _ref$popperOptions,
|
|
29
|
-
_ref$overlay = _ref.overlay,
|
|
30
|
-
overlay = _ref$overlay === void 0 ? false : _ref$overlay,
|
|
31
|
-
_ref$zIndex = _ref.zIndex,
|
|
32
|
-
zIndex = _ref$zIndex === void 0 ? 1300 : _ref$zIndex,
|
|
33
|
-
_ref$enableUnderlayin = _ref.enableUnderlayingEvent,
|
|
34
|
-
enableUnderlayingEvent = _ref$enableUnderlayin === void 0 ? false : _ref$enableUnderlayin,
|
|
35
|
-
_ref$wrapperStyles = _ref.wrapperStyles,
|
|
36
|
-
wrapperStyles = _ref$wrapperStyles === void 0 ? {} : _ref$wrapperStyles,
|
|
37
|
-
_ref$disablePortal = _ref.disablePortal,
|
|
38
|
-
disablePortal = _ref$disablePortal === void 0 ? false : _ref$disablePortal,
|
|
39
|
-
onClick = _ref.onClick,
|
|
40
|
-
ref = _ref.ref,
|
|
41
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
-
var target = usePortal(generateClassNames('Popper'));
|
|
43
|
-
var popperRef = useRef(null);
|
|
44
|
-
var handlePopperRef = useForkRef(popperRef, ref);
|
|
45
|
-
useEffect(function () {
|
|
46
|
-
if (!anchorEl || !open || popperRef.current === null) {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
var defaultModifiers = [{
|
|
50
|
-
name: 'arrow',
|
|
51
|
-
options: {
|
|
52
|
-
element: '[data-popper-arrow]'
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
name: 'offset',
|
|
56
|
-
options: {
|
|
57
|
-
offset: [0, 10]
|
|
58
|
-
}
|
|
59
|
-
}];
|
|
60
|
-
var popperModifiers = arrow ? defaultModifiers : [];
|
|
61
|
-
if (popperOptions && popperOptions.modifiers != null) {
|
|
62
|
-
popperModifiers = popperModifiers.concat(popperOptions.modifiers);
|
|
63
|
-
}
|
|
64
|
-
var popper = createPopper(anchorEl, popperRef.current, _objectSpread(_objectSpread({
|
|
65
|
-
placement: initialPlacement
|
|
66
|
-
}, popperOptions), {}, {
|
|
67
|
-
modifiers: popperModifiers
|
|
68
|
-
}));
|
|
69
|
-
handlePopperRef.current = popper;
|
|
70
|
-
return function () {
|
|
71
|
-
popper.destroy();
|
|
72
|
-
handlePopperRef.current = null;
|
|
73
|
-
};
|
|
74
|
-
}, [anchorEl, open, popperOptions, initialPlacement, arrow]);
|
|
75
|
-
var handleOnClicking = function handleOnClicking(event) {
|
|
76
|
-
event.persist();
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
event.stopPropagation();
|
|
79
|
-
if (onClick) {
|
|
80
|
-
onClick(event);
|
|
81
|
-
}
|
|
82
|
-
if (enableUnderlayingEvent) {
|
|
83
|
-
passEventToUnderLayingEvent(event);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var renderOverlay = function renderOverlay() {
|
|
87
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
className: "fixed top-0 right-0 bottom-0 left-0 bg-transparent",
|
|
89
|
-
onClick: handleOnClicking,
|
|
90
|
-
onContextMenu: handleOnClicking
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
var zIndexAdjusted = 1;
|
|
94
|
-
if (zIndex === 0) zIndexAdjusted = 0;
|
|
95
|
-
if (zIndex > 50) zIndexAdjusted = 50;
|
|
96
|
-
if (zIndex > 10 && zIndex < 50) zIndexAdjusted = Math.floor(zIndex / 10) * 10;
|
|
97
|
-
if (zIndex !== 0 && zIndex < 10) zIndexAdjusted = 10;
|
|
98
|
-
var popperWrapClasses = "relative z-".concat(zIndexAdjusted);
|
|
99
|
-
var render = function render() {
|
|
100
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
101
|
-
className: popperWrapClasses,
|
|
102
|
-
style: _objectSpread({}, wrapperStyles)
|
|
103
|
-
}, overlay && open && renderOverlay(), /*#__PURE__*/React.createElement("div", _extends({
|
|
104
|
-
className: !open ? 'hidden' : '',
|
|
105
|
-
ref: handlePopperRef
|
|
106
|
-
}, rest), children, arrow && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
107
|
-
"data-popper-arrow": true,
|
|
108
|
-
className: cn('absolute h-2 w-2 before:absolute before:top-0 before:left-0 before:-z-1 before:h-2 before:w-2 before:rotate-45 before:content-[""]', warning ? 'before:bg-background-orange' : 'before:bg-background-grey', popperArrowPosition[initialPlacement])
|
|
109
|
-
}))));
|
|
110
|
-
};
|
|
111
|
-
return disablePortal ? render() : /*#__PURE__*/createPortal(render(), target);
|
|
112
|
-
};
|
|
113
|
-
export default Popper;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Values } from '../../utils/types';
|
|
3
|
-
import { Phases, Position, Strategy } from './types';
|
|
4
|
-
export type PopperPositionType = Values<typeof Position>;
|
|
5
|
-
export type PopperStrategyType = Values<typeof Strategy>;
|
|
6
|
-
export type PopperPhasesType = Values<typeof Phases>;
|
|
7
|
-
export type VirtualElement = {
|
|
8
|
-
getBoundingClientRect: () => DOMRect;
|
|
9
|
-
contextElement?: Element;
|
|
10
|
-
};
|
|
11
|
-
export type Modifiers = {
|
|
12
|
-
data?: object;
|
|
13
|
-
effect?: () => void;
|
|
14
|
-
enabled?: boolean;
|
|
15
|
-
fn?: () => void;
|
|
16
|
-
name?: any;
|
|
17
|
-
options?: object;
|
|
18
|
-
phase?: PopperPhasesType;
|
|
19
|
-
requires?: string[];
|
|
20
|
-
requiresIfExists?: string[];
|
|
21
|
-
}[];
|
|
22
|
-
export type PopperOptions = {
|
|
23
|
-
modifiers?: Modifiers;
|
|
24
|
-
onFirstUpdate?: () => void;
|
|
25
|
-
placement?: PopperPositionType;
|
|
26
|
-
strategy?: PopperStrategyType;
|
|
27
|
-
};
|
|
28
|
-
export interface PopperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
|
-
open: boolean;
|
|
30
|
-
anchorEl?: Element | VirtualElement | null;
|
|
31
|
-
position: PopperPositionType;
|
|
32
|
-
popperOptions?: PopperOptions;
|
|
33
|
-
wrapperStyles?: object;
|
|
34
|
-
warning?: boolean;
|
|
35
|
-
overlay?: boolean;
|
|
36
|
-
arrow?: boolean;
|
|
37
|
-
zIndex?: number;
|
|
38
|
-
enableUnderlayingEvent?: boolean;
|
|
39
|
-
disablePortal?: boolean;
|
|
40
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const passEventToUnderLayingEvent: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export var passEventToUnderLayingEvent = function passEventToUnderLayingEvent(event) {
|
|
2
|
-
setTimeout(function () {
|
|
3
|
-
if (event.clientX && event.clientY) {
|
|
4
|
-
var elem = document.elementFromPoint(event.clientX, event.clientY);
|
|
5
|
-
if (elem) {
|
|
6
|
-
elem.dispatchEvent(event.nativeEvent);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}, 0);
|
|
10
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const Phases: {
|
|
2
|
-
readonly AfterMain: "afterMain";
|
|
3
|
-
readonly AfterRead: "afterRead";
|
|
4
|
-
readonly AfterWrite: "afterWrite";
|
|
5
|
-
readonly BeforeMain: "beforeMain";
|
|
6
|
-
readonly BeforeRead: "beforeRead";
|
|
7
|
-
readonly BeforeWrite: "beforeWrite";
|
|
8
|
-
readonly Main: "main";
|
|
9
|
-
readonly Read: "read";
|
|
10
|
-
readonly Write: "write";
|
|
11
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const Position: {
|
|
2
|
-
readonly AutoStart: "auto-start";
|
|
3
|
-
readonly Auto: "auto";
|
|
4
|
-
readonly AutoEnd: "auto-end";
|
|
5
|
-
readonly TopStart: "top-start";
|
|
6
|
-
readonly Top: "top";
|
|
7
|
-
readonly TopEnd: "top-end";
|
|
8
|
-
readonly BottomStart: "bottom-start";
|
|
9
|
-
readonly Bottom: "bottom";
|
|
10
|
-
readonly BottomEnd: "bottom-end";
|
|
11
|
-
readonly LeftStart: "left-start";
|
|
12
|
-
readonly Left: "left";
|
|
13
|
-
readonly LeftEnd: "left-end";
|
|
14
|
-
readonly RightStart: "right-start";
|
|
15
|
-
readonly Right: "right";
|
|
16
|
-
readonly RightEnd: "right-end";
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export var Position = {
|
|
2
|
-
AutoStart: 'auto-start',
|
|
3
|
-
Auto: 'auto',
|
|
4
|
-
AutoEnd: 'auto-end',
|
|
5
|
-
TopStart: 'top-start',
|
|
6
|
-
Top: 'top',
|
|
7
|
-
TopEnd: 'top-end',
|
|
8
|
-
BottomStart: 'bottom-start',
|
|
9
|
-
Bottom: 'bottom',
|
|
10
|
-
BottomEnd: 'bottom-end',
|
|
11
|
-
LeftStart: 'left-start',
|
|
12
|
-
Left: 'left',
|
|
13
|
-
LeftEnd: 'left-end',
|
|
14
|
-
RightStart: 'right-start',
|
|
15
|
-
Right: 'right',
|
|
16
|
-
RightEnd: 'right-end'
|
|
17
|
-
};
|
package/core/radio/index.d.ts
DELETED
package/core/radio/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["size", "checked", "onChange", "radioProps", "readOnly", "disabled", "ref"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { cn } from '../../utils/functions/shadcn-utils';
|
|
6
|
-
import { RadioSize } from './size';
|
|
7
|
-
var Radio = function Radio(_ref) {
|
|
8
|
-
var _ref$size = _ref.size,
|
|
9
|
-
size = _ref$size === void 0 ? RadioSize.Sm : _ref$size,
|
|
10
|
-
_ref$checked = _ref.checked,
|
|
11
|
-
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
12
|
-
onChange = _ref.onChange,
|
|
13
|
-
radioProps = _ref.radioProps,
|
|
14
|
-
readOnly = _ref.readOnly,
|
|
15
|
-
disabled = _ref.disabled,
|
|
16
|
-
ref = _ref.ref,
|
|
17
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
-
var cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer';
|
|
19
|
-
var radioInputClasses = cn('peer border-borders-primary-stateless absolute z-50 m-0 rounded-full border-1 border-solid opacity-0', cursorStyleClasses, "".concat(size == RadioSize.Sm && 'w-4 h-4'), "".concat(size == RadioSize.Md && 'w-5 h-5'));
|
|
20
|
-
var radioBoxTransitionClasses = cn('peer-hover:before:transition-all peer-hover:before:duration-100 peer-hover:before:ease-out', 'peer-checked:before:transition-all peer-checked:before:duration-100 peer-checked:before:ease-out', 'peer-checked:after:transition-all peer-checked:after:duration-100 peer-checked:after:ease-out');
|
|
21
|
-
var radioBoxClasses = cn('rounded-full border-1 border-solid box-content relative', "".concat(disabled ? 'border-borders-secondary' : 'border-borders-primary-stateless'), "".concat(size == RadioSize.Sm ? 'w-4 h-4' : ''), "".concat(size == RadioSize.Md ? 'w-5 h-5' : ''), 'before:bg-accent-stateless-0-4-opacity before:absolute before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:block before:rounded-full before:opacity-0 before:content-[""] before:z-10', "".concat(size == RadioSize.Sm ? 'before:w-1.5 before:h-1.5' : ''), "".concat(size == RadioSize.Md ? 'before:w-2 before:h-2' : ''), "".concat(disabled ? 'before:cursor-default' : 'before:cursor-pointer'), 'after:absolute after:top-1/2 after:left-1/2 after:-translate-x-1/2 after:-translate-y-1/2 after:block after:rounded-full after:opacity-0 after:content-[""]', "".concat(size == RadioSize.Sm ? 'after:w-4 after:h-4' : ''), "".concat(size == RadioSize.Md ? 'after:w-5 after:h-5' : ''), "".concat(disabled ? 'after:cursor-default' : 'after:cursor-pointer'), "".concat(disabled ? 'after:bg-background-active' : 'after:bg-accent-primary'), "".concat(disabled ? 'after:opacity-100' : 'after:opacity-0'), 'peer-checked:before:opacity-100 peer-checked:before:bg-icons-invert peer-checked:after:opacity-100', "".concat(disabled ? 'peer-checked:after:bg-background-grey' : 'peer-checked:after:bg-accent-primary'), radioBoxTransitionClasses, 'peer-hover:before:opacity-100 ');
|
|
22
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
23
|
-
className: cn('items-[inherit] justify-[inherit] relative inline-flex', cursorStyleClasses)
|
|
24
|
-
}, rest, {
|
|
25
|
-
ref: ref
|
|
26
|
-
}), /*#__PURE__*/React.createElement("input", _extends({
|
|
27
|
-
className: radioInputClasses,
|
|
28
|
-
type: "radio",
|
|
29
|
-
checked: checked,
|
|
30
|
-
onChange: readOnly || disabled ? undefined : onChange,
|
|
31
|
-
disabled: disabled
|
|
32
|
-
}, radioProps)), /*#__PURE__*/React.createElement("span", {
|
|
33
|
-
className: "peer-checked:before:bg-icons-invert -order-1"
|
|
34
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
35
|
-
className: radioBoxClasses
|
|
36
|
-
}));
|
|
37
|
-
};
|
|
38
|
-
export default Radio;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, Ref } from 'react';
|
|
2
|
-
import { Values } from '../../utils/types';
|
|
3
|
-
import { RadioSize } from './size';
|
|
4
|
-
export type RadioSizeType = Values<typeof RadioSize>;
|
|
5
|
-
export interface RadioProps extends React.HTMLAttributes<HTMLInputElement> {
|
|
6
|
-
checked?: boolean;
|
|
7
|
-
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
-
radioProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
|
9
|
-
readOnly?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
size?: RadioSizeType;
|
|
12
|
-
ref?: Ref<HTMLDivElement>;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/core/radio/size.d.ts
DELETED
package/core/radio/size.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './radio-group.component';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { RadioGroupProps } from './radio-group.props';
|
|
2
|
-
declare const RadioGroup: ({ label, radioProps, readOnly, disabled, radioStyles, labelStyles, onChange, size, checked, labelReverseOrder, ref, ...rest }: RadioGroupProps) => JSX.Element;
|
|
3
|
-
export default RadioGroup;
|
|
@@ -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