@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
|
@@ -0,0 +1,43 @@
|
|
|
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 = ["size", "icon", "tooltip"];
|
|
5
|
+
import InfoOutlineIcon from '@scaleflex/ui-tw/label/components/info-outline-icon';
|
|
6
|
+
import { LabelSize } from '@scaleflex/ui-tw/label/label.types';
|
|
7
|
+
import { getLabelIconSizeInRem } from '@scaleflex/ui-tw/label/label.utils';
|
|
8
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@scaleflex/ui-tw/tooltip';
|
|
9
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
10
|
+
import { cva } from 'class-variance-authority';
|
|
11
|
+
import React, { cloneElement, useMemo } from 'react';
|
|
12
|
+
var labelIconSizes = _defineProperty(_defineProperty(_defineProperty({}, LabelSize.Sm, 'ml-1'), LabelSize.Md, 'ml-1.5'), LabelSize.Lg, 'ml-1.5');
|
|
13
|
+
var labelIconVariants = cva('', {
|
|
14
|
+
variants: {
|
|
15
|
+
size: labelIconSizes
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var LabelIcon = function LabelIcon(props) {
|
|
19
|
+
var size = props.size,
|
|
20
|
+
icon = props.icon,
|
|
21
|
+
tooltip = props.tooltip,
|
|
22
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
23
|
+
var sizeInRem = useMemo(function () {
|
|
24
|
+
return getLabelIconSizeInRem(size);
|
|
25
|
+
}, [size]);
|
|
26
|
+
if (!icon && !tooltip) return null;
|
|
27
|
+
var iconElement = /*#__PURE__*/React.createElement("span", _extends({
|
|
28
|
+
className: cn('text-muted-foreground', labelIconVariants({
|
|
29
|
+
size: size
|
|
30
|
+
}))
|
|
31
|
+
}, rest), /*#__PURE__*/cloneElement(icon || /*#__PURE__*/React.createElement(InfoOutlineIcon, null), {
|
|
32
|
+
size: sizeInRem,
|
|
33
|
+
style: {
|
|
34
|
+
width: sizeInRem,
|
|
35
|
+
height: sizeInRem
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
if (!tooltip) return iconElement;
|
|
39
|
+
return /*#__PURE__*/React.createElement(Tooltip, null, /*#__PURE__*/React.createElement(TooltipTrigger, {
|
|
40
|
+
asChild: true
|
|
41
|
+
}, iconElement), /*#__PURE__*/React.createElement(TooltipContent, null, tooltip));
|
|
42
|
+
};
|
|
43
|
+
export { LabelIcon };
|
package/label/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from './label.component';
|
package/label/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from './label.component';
|
|
@@ -0,0 +1,44 @@
|
|
|
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 = ["className", "size", "children", "icon", "tooltip"];
|
|
5
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
6
|
+
import { ButtonSize } from '@scaleflex/ui-tw/button';
|
|
7
|
+
import { InputSize } from '@scaleflex/ui-tw/input';
|
|
8
|
+
import { LabelIcon } from '@scaleflex/ui-tw/label/components/label-icon';
|
|
9
|
+
import { LabelSize } from '@scaleflex/ui-tw/label/label.types';
|
|
10
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
11
|
+
import { cva } from 'class-variance-authority';
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
var labelSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, InputSize.Sm, 'text-xs'), InputSize.Md, 'text-sm'), InputSize.Lg, 'text-base');
|
|
14
|
+
var labelVariants = cva('', {
|
|
15
|
+
variants: {
|
|
16
|
+
size: labelSizeOptions
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: ButtonSize.Md
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
function Label(_ref) {
|
|
23
|
+
var className = _ref.className,
|
|
24
|
+
_ref$size = _ref.size,
|
|
25
|
+
size = _ref$size === void 0 ? LabelSize.Md : _ref$size,
|
|
26
|
+
children = _ref.children,
|
|
27
|
+
icon = _ref.icon,
|
|
28
|
+
tooltip = _ref.tooltip,
|
|
29
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
return /*#__PURE__*/React.createElement(LabelPrimitive.Root, _extends({
|
|
31
|
+
"data-slot": "label",
|
|
32
|
+
className: cn('text-secondary-foreground flex items-center gap-2 leading-none font-normal select-none', 'peer-disabled:cursor-not-allowed peer-disabled:opacity-50', 'group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50', 'group-data-[highlight=true]:text-warning', labelVariants({
|
|
33
|
+
size: size,
|
|
34
|
+
className: className
|
|
35
|
+
}))
|
|
36
|
+
}, props), icon || tooltip ? /*#__PURE__*/React.createElement("span", {
|
|
37
|
+
className: "flex items-center"
|
|
38
|
+
}, children, /*#__PURE__*/React.createElement(LabelIcon, {
|
|
39
|
+
size: size,
|
|
40
|
+
icon: icon,
|
|
41
|
+
tooltip: tooltip
|
|
42
|
+
})) : children);
|
|
43
|
+
}
|
|
44
|
+
export { Label };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
+
import type { Values } from 'packages/ui/src/types/values';
|
|
3
|
+
import { ComponentProps, ReactElement } from 'react';
|
|
4
|
+
export declare const LabelSize: {
|
|
5
|
+
readonly Sm: "sm";
|
|
6
|
+
readonly Md: "md";
|
|
7
|
+
readonly Lg: "lg";
|
|
8
|
+
};
|
|
9
|
+
export type LabelSizeType = Values<typeof LabelSize>;
|
|
10
|
+
export interface LabelProps extends Omit<ComponentProps<typeof LabelPrimitive.Root>, 'size'> {
|
|
11
|
+
size?: LabelSizeType;
|
|
12
|
+
icon?: ReactElement;
|
|
13
|
+
tooltip?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LabelSize } from '@scaleflex/ui-tw/label/label.types';
|
|
2
|
+
export var getLabelIconSizeInRem = function getLabelIconSizeInRem(sizeName) {
|
|
3
|
+
switch (sizeName) {
|
|
4
|
+
case LabelSize.Lg:
|
|
5
|
+
return '1rem';
|
|
6
|
+
// 16px
|
|
7
|
+
case LabelSize.Md:
|
|
8
|
+
return '0.875rem';
|
|
9
|
+
// 14px
|
|
10
|
+
case LabelSize.Sm:
|
|
11
|
+
return '0.75rem';
|
|
12
|
+
// 14px
|
|
13
|
+
default:
|
|
14
|
+
return '0.875rem';
|
|
15
|
+
}
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
"main": "lib/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@popperjs/core": "^2.6.0",
|
|
16
|
+
"@radix-ui/react-label": "^2.1.6",
|
|
16
17
|
"@radix-ui/react-slot": "^1.1.2",
|
|
17
|
-
"@
|
|
18
|
+
"@radix-ui/react-tooltip": "^1.2.6",
|
|
19
|
+
"@scaleflex/icons-tw": "^0.0.3",
|
|
18
20
|
"@types/lodash.merge": "^4.6.9",
|
|
19
21
|
"class-variance-authority": "^0.7.1",
|
|
20
22
|
"lodash.merge": "^4.6.2",
|
|
@@ -28,14 +30,16 @@
|
|
|
28
30
|
"typescript": "^5.2.2"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
33
|
+
"@hookform/resolvers": ">=5.0.0",
|
|
31
34
|
"@types/react": ">=19.0.0",
|
|
32
35
|
"@types/react-dom": ">=19.0.0",
|
|
33
36
|
"clsx": ">=2.0.0",
|
|
34
37
|
"react": ">=19.0.0",
|
|
35
38
|
"react-dom": ">=19.0.0",
|
|
36
|
-
"
|
|
39
|
+
"react-hook-form": ">=7.0.0",
|
|
37
40
|
"tailwind-merge": ">=1.14.0",
|
|
38
|
-
"tailwindcss": ">=4.0.0"
|
|
41
|
+
"tailwindcss": ">=4.0.0",
|
|
42
|
+
"zod": ">=3.0.0"
|
|
39
43
|
},
|
|
40
44
|
"sideEffects": false,
|
|
41
45
|
"browserslist": {
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
--secondary-foreground: oklch(53.03% 0.039 249.89);
|
|
15
15
|
--muted: oklch(0.95 0.01 285); /* Background active #F3F7FA */
|
|
16
16
|
--muted-foreground: oklch(0.685 0.033 249.82);
|
|
17
|
-
--accent: oklch(0.578 0.198 268.129
|
|
17
|
+
--accent: oklch(0.578 0.198 268.129 / 0.07); /* Background active #F3F7FA */
|
|
18
18
|
--accent-foreground: oklch(0.578 0.198 268.129); /* Text Primary #37414B */
|
|
19
19
|
--success: oklch(0.7487 0.1799 154.83); /* #26C17A */
|
|
20
20
|
--success-foreground: oklch(0.4238 0.1235 165.45); /* #006D3B */
|
|
21
|
-
--destructive: oklch(0.
|
|
21
|
+
--destructive: oklch(0.577 0.215 27.325); /* #DC2626 */
|
|
22
22
|
--destructive-foreground: oklch(0.3963 0.1994 27.40); /* #82181A */
|
|
23
23
|
--info: oklch(0.6632 0.1896 241.34); /* #0090E4 */
|
|
24
24
|
--info-foreground: oklch(0.3902 0.1177 248.61); /* #024A71 */
|
|
25
|
-
--warning: oklch(0.
|
|
25
|
+
--warning: oklch(0.734 0.157 69.419); /* #E7940F */
|
|
26
26
|
--warning-foreground: oklch(0.4429 0.1617 63.95); /* #733E0A */
|
|
27
27
|
--border: oklch(92.86% 0.009 247.92); /* Borders Secondary #E3E8ED */
|
|
28
28
|
--input: oklch(0.8625 0.0257 248.73); /* Border Primary Stateless #CCD6DE */
|
|
29
|
-
--ring: oklch(0.
|
|
29
|
+
--ring: oklch(0.578 0.198 268.129 / 0.7); /* Borders Base #6879EB */
|
|
30
30
|
--shadow: oklch(26.18% 0.024 256.43 / 0.1);
|
|
31
31
|
--chart-1: oklch(0.646 0.222 41.116); /* Chart 1 - Orange/Yellow Base - approx #DA9834 */
|
|
32
32
|
--chart-2: oklch(0.6 0.118 184.704); /* Chart 2 - Teal/Greenish-Blue Base - approx #4BA3AD */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, WithTooltip } from './tooltip.component';
|
package/tooltip/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, WithTooltip } from './tooltip.component';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
|
+
import { WithTooltipProps } from '@scaleflex/ui-tw/tooltip/tooltip.types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ComponentProps } from 'react';
|
|
5
|
+
declare function TooltipProvider({ delayDuration, ...props }: ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
|
|
6
|
+
declare function Tooltip({ ...props }: ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
|
|
7
|
+
declare function TooltipTrigger({ ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
|
|
8
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element;
|
|
9
|
+
declare function WithTooltip({ content, children }: WithTooltipProps): React.JSX.Element;
|
|
10
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, WithTooltip };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["delayDuration"],
|
|
5
|
+
_excluded2 = ["className", "sideOffset", "children"];
|
|
6
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
7
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
function TooltipProvider(_ref) {
|
|
10
|
+
var _ref$delayDuration = _ref.delayDuration,
|
|
11
|
+
delayDuration = _ref$delayDuration === void 0 ? 0 : _ref$delayDuration,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement(TooltipPrimitive.Provider, _extends({
|
|
14
|
+
"data-slot": "tooltip-provider",
|
|
15
|
+
delayDuration: delayDuration
|
|
16
|
+
}, props));
|
|
17
|
+
}
|
|
18
|
+
function Tooltip(_ref2) {
|
|
19
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
|
20
|
+
return /*#__PURE__*/React.createElement(TooltipProvider, null, /*#__PURE__*/React.createElement(TooltipPrimitive.Root, _extends({
|
|
21
|
+
"data-slot": "tooltip"
|
|
22
|
+
}, props)));
|
|
23
|
+
}
|
|
24
|
+
function TooltipTrigger(_ref3) {
|
|
25
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref3), _ref3));
|
|
26
|
+
return /*#__PURE__*/React.createElement(TooltipPrimitive.Trigger, _extends({
|
|
27
|
+
"data-slot": "tooltip-trigger"
|
|
28
|
+
}, props));
|
|
29
|
+
}
|
|
30
|
+
function TooltipContent(_ref4) {
|
|
31
|
+
var className = _ref4.className,
|
|
32
|
+
_ref4$sideOffset = _ref4.sideOffset,
|
|
33
|
+
sideOffset = _ref4$sideOffset === void 0 ? 0 : _ref4$sideOffset,
|
|
34
|
+
children = _ref4.children,
|
|
35
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
36
|
+
return /*#__PURE__*/React.createElement(TooltipPrimitive.Portal, null, /*#__PURE__*/React.createElement(TooltipPrimitive.Content, _extends({
|
|
37
|
+
"data-slot": "tooltip-content",
|
|
38
|
+
sideOffset: sideOffset,
|
|
39
|
+
className: cn('bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance', className)
|
|
40
|
+
}, props), children, /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
|
|
41
|
+
className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"
|
|
42
|
+
})));
|
|
43
|
+
}
|
|
44
|
+
function WithTooltip(_ref5) {
|
|
45
|
+
var content = _ref5.content,
|
|
46
|
+
children = _ref5.children;
|
|
47
|
+
return /*#__PURE__*/React.createElement(Tooltip, null, /*#__PURE__*/React.createElement(TooltipTrigger, {
|
|
48
|
+
asChild: true
|
|
49
|
+
}, children), /*#__PURE__*/React.createElement(TooltipContent, null, content));
|
|
50
|
+
}
|
|
51
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, WithTooltip };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { AccordionProps } from './accordion.props';
|
|
2
|
-
declare const Accordion: ({ label, expanded, children, detailStyle, headerStyle, fullWidth, iconProps: iconPropsData, onClick, onChange, onContextMenu, hideIcon, ref, ...rest }: AccordionProps) => JSX.Element;
|
|
3
|
-
export default Accordion;
|
|
@@ -1,50 +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", "expanded", "children", "detailStyle", "headerStyle", "fullWidth", "iconProps", "onClick", "onChange", "onContextMenu", "hideIcon", "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 AccordionDetails from '../accordion-details';
|
|
9
|
-
import AccordionHeader from '../accordion-header';
|
|
10
|
-
var Accordion = function Accordion(_ref) {
|
|
11
|
-
var label = _ref.label,
|
|
12
|
-
_ref$expanded = _ref.expanded,
|
|
13
|
-
expanded = _ref$expanded === void 0 ? false : _ref$expanded,
|
|
14
|
-
children = _ref.children,
|
|
15
|
-
detailStyle = _ref.detailStyle,
|
|
16
|
-
headerStyle = _ref.headerStyle,
|
|
17
|
-
fullWidth = _ref.fullWidth,
|
|
18
|
-
iconPropsData = _ref.iconProps,
|
|
19
|
-
onClick = _ref.onClick,
|
|
20
|
-
onChange = _ref.onChange,
|
|
21
|
-
onContextMenu = _ref.onContextMenu,
|
|
22
|
-
_ref$hideIcon = _ref.hideIcon,
|
|
23
|
-
hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
|
|
24
|
-
ref = _ref.ref,
|
|
25
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
var handleOnClick = function handleOnClick(event) {
|
|
27
|
-
if (typeof onChange === 'function') {
|
|
28
|
-
onChange(!expanded, event);
|
|
29
|
-
}
|
|
30
|
-
if (typeof onClick === 'function') {
|
|
31
|
-
onClick(event);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
35
|
-
ref: ref
|
|
36
|
-
}, rest), /*#__PURE__*/React.createElement(AccordionHeader, {
|
|
37
|
-
label: label,
|
|
38
|
-
expanded: expanded,
|
|
39
|
-
style: _objectSpread({}, headerStyle),
|
|
40
|
-
hideIcon: hideIcon,
|
|
41
|
-
onClick: handleOnClick,
|
|
42
|
-
onContextMenu: onContextMenu,
|
|
43
|
-
iconProps: iconPropsData,
|
|
44
|
-
fullWidth: fullWidth
|
|
45
|
-
}), /*#__PURE__*/React.createElement(AccordionDetails, {
|
|
46
|
-
expanded: expanded,
|
|
47
|
-
style: _objectSpread({}, detailStyle)
|
|
48
|
-
}, children));
|
|
49
|
-
};
|
|
50
|
-
export default Accordion;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
|
-
import React, { MouseEvent, Ref } from 'react';
|
|
3
|
-
export interface AccordionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
4
|
-
label: React.ReactNode;
|
|
5
|
-
expanded?: boolean;
|
|
6
|
-
detailStyle?: object;
|
|
7
|
-
headerStyle?: object;
|
|
8
|
-
hideIcon?: boolean;
|
|
9
|
-
fullWidth?: boolean;
|
|
10
|
-
onChange?: (value: boolean, event: MouseEvent<HTMLDivElement>) => void;
|
|
11
|
-
iconProps?: IconProps;
|
|
12
|
-
ref?: Ref<HTMLDivElement>;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/core/accordion/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './accordion.component';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["expanded", "children", "ref"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
var AccordionDetails = function AccordionDetails(_ref) {
|
|
6
|
-
var _ref$expanded = _ref.expanded,
|
|
7
|
-
expanded = _ref$expanded === void 0 ? false : _ref$expanded,
|
|
8
|
-
children = _ref.children,
|
|
9
|
-
ref = _ref.ref,
|
|
10
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, expanded && /*#__PURE__*/React.createElement("div", _extends({
|
|
12
|
-
className: "mx-0 my-4",
|
|
13
|
-
ref: ref
|
|
14
|
-
}, rest), children));
|
|
15
|
-
};
|
|
16
|
-
export default AccordionDetails;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './accordion-details.component';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { AccordionHeaderProps } from './accordion-header.props';
|
|
2
|
-
declare const AccordionHeader: ({ expanded, label, onChange, onClick, onContextMenu, hideIcon, fullWidth, iconProps: iconPropsData, ref, ...rest }: AccordionHeaderProps) => JSX.Element;
|
|
3
|
-
export default AccordionHeader;
|
|
@@ -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 = ["expanded", "label", "onChange", "onClick", "onContextMenu", "hideIcon", "fullWidth", "iconProps", "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 { Position as ArrowTickType } from '../../utils/types';
|
|
9
|
-
import ArrowTick from '../arrow-tick';
|
|
10
|
-
var AccordionHeader = function AccordionHeader(_ref) {
|
|
11
|
-
var _ref$expanded = _ref.expanded,
|
|
12
|
-
expanded = _ref$expanded === void 0 ? false : _ref$expanded,
|
|
13
|
-
label = _ref.label,
|
|
14
|
-
onChange = _ref.onChange,
|
|
15
|
-
_onClick = _ref.onClick,
|
|
16
|
-
onContextMenu = _ref.onContextMenu,
|
|
17
|
-
_ref$hideIcon = _ref.hideIcon,
|
|
18
|
-
hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
|
|
19
|
-
_ref$fullWidth = _ref.fullWidth,
|
|
20
|
-
fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
|
|
21
|
-
iconPropsData = _ref.iconProps,
|
|
22
|
-
ref = _ref.ref,
|
|
23
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
-
var accordionHeaderClasses = "inline-flex items-center justify-between box-border cursor-pointer select-none text-secondary ".concat(fullWidth ? 'w-full' : 'w-auto');
|
|
25
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
26
|
-
className: accordionHeaderClasses,
|
|
27
|
-
ref: ref,
|
|
28
|
-
onClick: function onClick(event) {
|
|
29
|
-
if (typeof onChange === 'function') {
|
|
30
|
-
onChange(!expanded);
|
|
31
|
-
}
|
|
32
|
-
if (typeof _onClick === 'function') {
|
|
33
|
-
_onClick(event);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}, rest), /*#__PURE__*/React.createElement("span", {
|
|
37
|
-
onContextMenu: onContextMenu
|
|
38
|
-
}, label), !hideIcon && /*#__PURE__*/React.createElement("span", {
|
|
39
|
-
className: "inline-flex pl-2",
|
|
40
|
-
onContextMenu: onContextMenu
|
|
41
|
-
}, /*#__PURE__*/React.createElement(ArrowTick, {
|
|
42
|
-
type: expanded ? ArrowTickType.Top : ArrowTickType.Bottom,
|
|
43
|
-
IconProps: _objectSpread({
|
|
44
|
-
size: '0.6875rem'
|
|
45
|
-
}, iconPropsData)
|
|
46
|
-
})));
|
|
47
|
-
};
|
|
48
|
-
export default AccordionHeader;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
|
-
import { Ref } from 'react';
|
|
3
|
-
export interface AccordionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
4
|
-
label: React.ReactNode;
|
|
5
|
-
expanded?: boolean;
|
|
6
|
-
hideIcon?: boolean;
|
|
7
|
-
fullWidth?: boolean;
|
|
8
|
-
onChange?: (value: boolean) => void;
|
|
9
|
-
iconProps?: IconProps;
|
|
10
|
-
ref?: Ref<HTMLDivElement>;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './accordion-header.component';
|
|
@@ -1,22 +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 = ["type", "IconProps", "ref"];
|
|
5
|
-
import ArrowIcon from '@scaleflex/icons-tw/arrow';
|
|
6
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { Position } from '../../utils/types';
|
|
9
|
-
var arrowDirection = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, Position.Bottom, 'rotate-90'), Position.Left, 'rotate-180'), Position.Right, ''), Position.Top, '-rotate-90');
|
|
10
|
-
var Arrow = function Arrow(_ref) {
|
|
11
|
-
var _ref$type = _ref.type,
|
|
12
|
-
type = _ref$type === void 0 ? Position.Right : _ref$type,
|
|
13
|
-
IconPropsData = _ref.IconProps,
|
|
14
|
-
ref = _ref.ref,
|
|
15
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
return /*#__PURE__*/React.createElement("span", _extends({
|
|
17
|
-
className: cn('inline-flex transition-transform duration-150', arrowDirection[type])
|
|
18
|
-
}, rest, {
|
|
19
|
-
ref: ref
|
|
20
|
-
}), /*#__PURE__*/React.createElement(ArrowIcon, IconPropsData));
|
|
21
|
-
};
|
|
22
|
-
export default Arrow;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
|
-
import type { Values } from '../../utils/types';
|
|
3
|
-
export declare const Type: {
|
|
4
|
-
readonly Left: "left";
|
|
5
|
-
readonly Right: "right";
|
|
6
|
-
readonly Top: "top";
|
|
7
|
-
readonly Bottom: "bottom";
|
|
8
|
-
};
|
|
9
|
-
export type ArrowTypesType = Values<typeof Type>;
|
|
10
|
-
export interface ArrowProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
11
|
-
type?: ArrowTypesType;
|
|
12
|
-
IconProps?: IconProps;
|
|
13
|
-
ref?: React.Ref<HTMLSpanElement>;
|
|
14
|
-
}
|
package/core/arrow/index.d.ts
DELETED
package/core/arrow/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './arrow.component';
|
|
@@ -1,21 +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 = ["type", "IconProps", "ref"];
|
|
5
|
-
import ArrowBottom from '@scaleflex/icons-tw/arrow-bottom';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { Position } from '../../utils/types';
|
|
8
|
-
var arrowTickDirection = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, Position.Bottom, ''), Position.Left, 'rotate-90'), Position.Right, '-rotate-90'), Position.Top, 'rotate-180');
|
|
9
|
-
var ArrowTick = function ArrowTick(_ref) {
|
|
10
|
-
var _ref$type = _ref.type,
|
|
11
|
-
type = _ref$type === void 0 ? Position.Bottom : _ref$type,
|
|
12
|
-
IconPropsData = _ref.IconProps,
|
|
13
|
-
ref = _ref.ref,
|
|
14
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
16
|
-
ref: ref
|
|
17
|
-
}), /*#__PURE__*/React.createElement(ArrowBottom, _extends({
|
|
18
|
-
className: arrowTickDirection[type]
|
|
19
|
-
}, IconPropsData)));
|
|
20
|
-
};
|
|
21
|
-
export default ArrowTick;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
|
-
import type { Values } from '../../utils/types';
|
|
3
|
-
export declare const Type: {
|
|
4
|
-
readonly Left: "left";
|
|
5
|
-
readonly Right: "right";
|
|
6
|
-
readonly Top: "top";
|
|
7
|
-
readonly Bottom: "bottom";
|
|
8
|
-
};
|
|
9
|
-
export type ArrowTickTypesType = Values<typeof Type>;
|
|
10
|
-
export interface ArrowTickProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
11
|
-
type?: ArrowTickTypesType;
|
|
12
|
-
IconProps?: IconProps;
|
|
13
|
-
ref?: React.Ref<HTMLSpanElement>;
|
|
14
|
-
}
|
package/core/arrow-tick/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './arrow-tick.component';
|
package/core/button/index.d.ts
DELETED
package/core/button/index.js
DELETED
|
File without changes
|