@teamturing/react-kit 2.4.0 → 2.6.0
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/dist/core/Button/index.d.ts +1 -1
- package/dist/core/Dialog/index.d.ts +16 -0
- package/dist/core/DialogHandler/index.d.ts +13 -0
- package/dist/core/GradientText/index.d.ts +11 -12
- package/dist/core/Grid/index.d.ts +2 -2
- package/dist/core/IconButton/index.d.ts +1 -1
- package/dist/core/ItemList/index.d.ts +2 -2
- package/dist/core/MotionView/index.d.ts +3 -0
- package/dist/core/Spinner/index.d.ts +116 -116
- package/dist/core/Stack/index.d.ts +2 -2
- package/dist/core/TextInput/index.d.ts +39 -0
- package/dist/core/Textarea/index.d.ts +9 -0
- package/dist/hook/useDialogHandler.d.ts +6 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +10732 -593
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/isFunction.d.ts +1 -0
- package/esm/_virtual/index.js +3 -0
- package/esm/_virtual/react-is.development.js +3 -0
- package/esm/_virtual/react-is.production.min.js +3 -0
- package/esm/core/Dialog/index.js +188 -0
- package/esm/core/DialogHandler/index.js +33 -0
- package/esm/core/MotionView/index.js +6 -0
- package/esm/core/TextInput/index.js +220 -0
- package/esm/core/Textarea/index.js +158 -0
- package/esm/hook/useDialogHandler.js +14 -0
- package/esm/index.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/animation/animators/instant.js +40 -0
- package/esm/node_modules/framer-motion/dist/es/animation/animators/js/driver-frameloop.js +16 -0
- package/esm/node_modules/framer-motion/dist/es/animation/animators/js/index.js +303 -0
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/create-accelerated-animation.js +199 -0
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/easing.js +31 -0
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/index.js +23 -0
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/animation/generators/inertia.js +87 -0
- package/esm/node_modules/framer-motion/dist/es/animation/generators/keyframes.js +51 -0
- package/esm/node_modules/framer-motion/dist/es/animation/generators/spring/find.js +89 -0
- package/esm/node_modules/framer-motion/dist/es/animation/generators/spring/index.js +129 -0
- package/esm/node_modules/framer-motion/dist/es/animation/generators/utils/calc-duration.js +17 -0
- package/esm/node_modules/framer-motion/dist/es/animation/generators/utils/velocity.js +9 -0
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/motion-value.js +101 -0
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/single-value.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-target.js +71 -0
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-variant.js +63 -0
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/visual-element.js +24 -0
- package/esm/node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/animation/utils/default-transitions.js +40 -0
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-animatable.js +30 -0
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-none.js +12 -0
- package/esm/node_modules/framer-motion/dist/es/animation/utils/keyframes.js +45 -0
- package/esm/node_modules/framer-motion/dist/es/animation/utils/transitions.js +13 -0
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +71 -0
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +56 -0
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +158 -0
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.js +40 -0
- package/esm/node_modules/framer-motion/dist/es/context/LayoutGroupContext.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/context/LazyContext.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/context/MotionConfigContext.js +12 -0
- package/esm/node_modules/framer-motion/dist/es/context/MotionContext/create.js +13 -0
- package/esm/node_modules/framer-motion/dist/es/context/MotionContext/index.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +17 -0
- package/esm/node_modules/framer-motion/dist/es/context/PresenceContext.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/debug/record.js +7 -0
- package/esm/node_modules/framer-motion/dist/es/easing/anticipate.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/easing/back.js +9 -0
- package/esm/node_modules/framer-motion/dist/es/easing/circ.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/easing/cubic-bezier.js +51 -0
- package/esm/node_modules/framer-motion/dist/es/easing/ease.js +7 -0
- package/esm/node_modules/framer-motion/dist/es/easing/modifiers/mirror.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/easing/modifiers/reverse.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/easing/utils/is-bezier-definition.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/easing/utils/is-easing-array.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/easing/utils/map.js +37 -0
- package/esm/node_modules/framer-motion/dist/es/events/add-dom-event.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/events/add-pointer-event.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/events/event-info.js +15 -0
- package/esm/node_modules/framer-motion/dist/es/events/utils/is-primary-pointer.js +18 -0
- package/esm/node_modules/framer-motion/dist/es/frameloop/batcher.js +60 -0
- package/esm/node_modules/framer-motion/dist/es/frameloop/frame.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/frameloop/render-step.js +104 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +457 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/index.js +27 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +125 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/utils/lock.js +53 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/focus.js +41 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/hover.js +32 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +148 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/pan/index.js +46 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/press.js +120 -0
- package/esm/node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.js +20 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/Feature.js +9 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +31 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/animation/index.js +38 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/animations.js +13 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/definitions.js +28 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/drag.js +17 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/gestures.js +21 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +131 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/layout.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/load-features.js +12 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +72 -0
- package/esm/node_modules/framer-motion/dist/es/motion/features/viewport/observers.js +49 -0
- package/esm/node_modules/framer-motion/dist/es/motion/index.js +79 -0
- package/esm/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/motion/utils/symbol.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +33 -0
- package/esm/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +75 -0
- package/esm/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +81 -0
- package/esm/node_modules/framer-motion/dist/es/motion/utils/valid-prop.js +59 -0
- package/esm/node_modules/framer-motion/dist/es/projection/animation/mix-values.js +93 -0
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/conversion.js +33 -0
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/copy.js +20 -0
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/delta-apply.js +122 -0
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/delta-calc.js +41 -0
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/delta-remove.js +54 -0
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/models.js +17 -0
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/utils.js +25 -0
- package/esm/node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.js +13 -0
- package/esm/node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.js +27 -0
- package/esm/node_modules/framer-motion/dist/es/projection/node/create-projection-node.js +1494 -0
- package/esm/node_modules/framer-motion/dist/es/projection/node/state.js +19 -0
- package/esm/node_modules/framer-motion/dist/es/projection/shared/stack.js +112 -0
- package/esm/node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.js +41 -0
- package/esm/node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.js +35 -0
- package/esm/node_modules/framer-motion/dist/es/projection/styles/scale-correction.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/projection/styles/transform.js +42 -0
- package/esm/node_modules/framer-motion/dist/es/projection/utils/each-axis.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/projection/utils/has-transform.js +24 -0
- package/esm/node_modules/framer-motion/dist/es/projection/utils/measure.js +17 -0
- package/esm/node_modules/framer-motion/dist/es/render/VisualElement.js +507 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/DOMVisualElement.js +48 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/motion-proxy.js +47 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/motion.js +23 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/use-render.js +35 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/create-config.js +19 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.js +89 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.js +57 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.js +30 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-element.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.js +15 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.js +230 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.js +15 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/defaults.js +30 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.js +15 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/find.js +15 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.js +10 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/number.js +72 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/test.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.js +9 -0
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/type-int.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.js +55 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/config-motion.js +12 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/use-props.js +57 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/build-styles.js +74 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/build-transform.js +45 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/render.js +9 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.js +17 -0
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/transform.js +28 -0
- package/esm/node_modules/framer-motion/dist/es/render/store.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.js +46 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/config-motion.js +40 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.js +33 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/use-props.js +24 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.js +52 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.js +30 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/path.js +32 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/render.js +12 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.js +18 -0
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.js +18 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/animation-state.js +319 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/compare-by-depth.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/flat-tree.js +24 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.js +13 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/is-variant-label.js +8 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/motion-values.js +63 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/resolve-dynamic-variants.js +24 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/resolve-variants.js +26 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/setters.js +101 -0
- package/esm/node_modules/framer-motion/dist/es/render/utils/variant-props.js +12 -0
- package/esm/node_modules/framer-motion/dist/es/utils/array.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/utils/clamp.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/utils/delay.js +19 -0
- package/esm/node_modules/framer-motion/dist/es/utils/distance.js +9 -0
- package/esm/node_modules/framer-motion/dist/es/utils/errors.js +18 -0
- package/esm/node_modules/framer-motion/dist/es/utils/hsla-to-rgba.js +42 -0
- package/esm/node_modules/framer-motion/dist/es/utils/interpolate.js +92 -0
- package/esm/node_modules/framer-motion/dist/es/utils/is-browser.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/utils/is-numerical-string.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/utils/is-ref-object.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/utils/is-zero-value-string.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/utils/memo.js +10 -0
- package/esm/node_modules/framer-motion/dist/es/utils/mix-color.js +40 -0
- package/esm/node_modules/framer-motion/dist/es/utils/mix-complex.js +64 -0
- package/esm/node_modules/framer-motion/dist/es/utils/mix.js +24 -0
- package/esm/node_modules/framer-motion/dist/es/utils/noop.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/utils/offsets/default.js +9 -0
- package/esm/node_modules/framer-motion/dist/es/utils/offsets/fill.js +12 -0
- package/esm/node_modules/framer-motion/dist/es/utils/offsets/time.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/utils/pipe.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/utils/progress.js +18 -0
- package/esm/node_modules/framer-motion/dist/es/utils/reduced-motion/index.js +19 -0
- package/esm/node_modules/framer-motion/dist/es/utils/reduced-motion/state.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/utils/resolve-value.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/utils/shallow-compare.js +14 -0
- package/esm/node_modules/framer-motion/dist/es/utils/subscription-manager.js +40 -0
- package/esm/node_modules/framer-motion/dist/es/utils/time-conversion.js +10 -0
- package/esm/node_modules/framer-motion/dist/es/utils/use-constant.js +18 -0
- package/esm/node_modules/framer-motion/dist/es/utils/use-force-update.js +19 -0
- package/esm/node_modules/framer-motion/dist/es/utils/use-instant-transition-state.js +5 -0
- package/esm/node_modules/framer-motion/dist/es/utils/use-is-mounted.js +15 -0
- package/esm/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.js +6 -0
- package/esm/node_modules/framer-motion/dist/es/utils/use-unmount-effect.js +7 -0
- package/esm/node_modules/framer-motion/dist/es/utils/velocity-per-second.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/utils/warn-once.js +11 -0
- package/esm/node_modules/framer-motion/dist/es/value/index.js +331 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/color/hex.js +40 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/color/hsla.js +22 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/color/index.js +28 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/color/rgba.js +25 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/color/utils.js +23 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/complex/filter.js +30 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/complex/index.js +92 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/numbers/index.js +17 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/numbers/units.js +19 -0
- package/esm/node_modules/framer-motion/dist/es/value/types/utils.js +15 -0
- package/esm/node_modules/framer-motion/dist/es/value/use-will-change/is.js +7 -0
- package/esm/node_modules/framer-motion/dist/es/value/utils/is-motion-value.js +3 -0
- package/esm/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.js +16 -0
- package/esm/node_modules/react-is/cjs/react-is.development.js +211 -0
- package/esm/node_modules/react-is/cjs/react-is.production.min.js +123 -0
- package/esm/node_modules/react-is/index.js +12 -0
- package/esm/packages/icons/esm/Close.js +17 -0
- package/esm/packages/token-studio/esm/token/elevation/index.js +5 -1
- package/esm/utils/isFunction.js +3 -0
- package/package.json +5 -3
package/dist/utils/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isFunction: (value: any) => value is (...args: any[]) => any;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useRef, useImperativeHandle, useEffect } from 'react';
|
|
2
|
+
import SvgClose from '../../packages/icons/esm/Close.js';
|
|
3
|
+
import color from '../../packages/token-studio/esm/token/color/index.js';
|
|
4
|
+
import elevation from '../../packages/token-studio/esm/token/elevation/index.js';
|
|
5
|
+
import '../../packages/token-studio/esm/token/typography/index.js';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import IconButton from '../IconButton/index.js';
|
|
8
|
+
import View from '../View/index.js';
|
|
9
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
10
|
+
import MotionView from '../MotionView/index.js';
|
|
11
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
12
|
+
import { AnimatePresence } from '../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js';
|
|
13
|
+
import { cubicBezier } from '../../node_modules/framer-motion/dist/es/easing/cubic-bezier.js';
|
|
14
|
+
|
|
15
|
+
function visible(el) {
|
|
16
|
+
return !el.hidden && (!el.type || el.type !== 'hidden') && (el.offsetWidth > 0 || el.offsetHeight > 0);
|
|
17
|
+
}
|
|
18
|
+
function focusable(el) {
|
|
19
|
+
const inputEl = el;
|
|
20
|
+
return inputEl.tabIndex >= 0 && !inputEl.disabled && visible(inputEl);
|
|
21
|
+
}
|
|
22
|
+
const Dialog = ({
|
|
23
|
+
children,
|
|
24
|
+
isOpen,
|
|
25
|
+
onDismiss,
|
|
26
|
+
size,
|
|
27
|
+
sx
|
|
28
|
+
}, ref) => {
|
|
29
|
+
const dialogRoot = typeof document !== 'undefined' ? document.getElementById('dialog_root') : null;
|
|
30
|
+
if (dialogRoot === null) return null;
|
|
31
|
+
const handleDismiss = useCallback(() => onDismiss?.(), [onDismiss]);
|
|
32
|
+
const overlayRef = useRef(null);
|
|
33
|
+
const dialogRef = useRef(null);
|
|
34
|
+
const closeButtonRef = useRef(null);
|
|
35
|
+
useImperativeHandle(ref, () => dialogRef.current);
|
|
36
|
+
const handleOutsideClick = useCallback(e => {
|
|
37
|
+
if (dialogRef.current && overlayRef.current && e.target instanceof Node && !dialogRef.current.contains(e.target) && overlayRef.current.contains(e.target)) {
|
|
38
|
+
handleDismiss?.();
|
|
39
|
+
}
|
|
40
|
+
}, [handleDismiss, dialogRef, overlayRef]);
|
|
41
|
+
const getFocusableItem = useCallback((e, movement) => {
|
|
42
|
+
if (dialogRef.current) {
|
|
43
|
+
const items = Array.from(dialogRef.current.querySelectorAll('*')).filter(focusable);
|
|
44
|
+
if (items.length === 0) return;
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
const focusedElement = document.activeElement;
|
|
47
|
+
if (!focusedElement) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const index = items.indexOf(focusedElement);
|
|
51
|
+
const offsetIndex = index + movement;
|
|
52
|
+
const fallbackIndex = movement === 1 ? 0 : items.length - 1;
|
|
53
|
+
const focusableItem = items[offsetIndex] || items[fallbackIndex];
|
|
54
|
+
return focusableItem;
|
|
55
|
+
}
|
|
56
|
+
}, [dialogRef]);
|
|
57
|
+
const handleTab = useCallback(e => {
|
|
58
|
+
const movement = e.shiftKey ? -1 : 1;
|
|
59
|
+
const focusableItem = getFocusableItem(e, movement);
|
|
60
|
+
if (!focusableItem) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
focusableItem.focus();
|
|
64
|
+
}, [getFocusableItem]);
|
|
65
|
+
const handleKeyDown = useCallback(event => {
|
|
66
|
+
switch (event.key) {
|
|
67
|
+
case 'Tab':
|
|
68
|
+
handleTab(event);
|
|
69
|
+
break;
|
|
70
|
+
case 'Escape':
|
|
71
|
+
handleDismiss?.();
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}, [handleDismiss]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (isOpen) {
|
|
78
|
+
document.addEventListener('click', handleOutsideClick);
|
|
79
|
+
return () => {
|
|
80
|
+
document.removeEventListener('click', handleOutsideClick);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}, [isOpen, handleOutsideClick]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (isOpen) {
|
|
86
|
+
if (closeButtonRef && closeButtonRef.current) {
|
|
87
|
+
closeButtonRef.current.focus();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, [isOpen, closeButtonRef]);
|
|
91
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
|
|
92
|
+
children: isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(MotionView, {
|
|
93
|
+
initial: {
|
|
94
|
+
opacity: 0,
|
|
95
|
+
scale: 1.1
|
|
96
|
+
},
|
|
97
|
+
animate: {
|
|
98
|
+
opacity: 1,
|
|
99
|
+
scale: 1
|
|
100
|
+
},
|
|
101
|
+
exit: {
|
|
102
|
+
opacity: 0,
|
|
103
|
+
scale: 1.1
|
|
104
|
+
},
|
|
105
|
+
transition: {
|
|
106
|
+
duration: 0.25,
|
|
107
|
+
/**
|
|
108
|
+
* easeOutQuad by https://easings.net/ko#easeOutQuad
|
|
109
|
+
*/
|
|
110
|
+
ease: cubicBezier(0.5, 1, 0.89, 1)
|
|
111
|
+
},
|
|
112
|
+
sx: {
|
|
113
|
+
position: 'fixed',
|
|
114
|
+
display: 'flex',
|
|
115
|
+
top: 0,
|
|
116
|
+
left: 0,
|
|
117
|
+
width: '100%',
|
|
118
|
+
height: '100%',
|
|
119
|
+
zIndex: 9999
|
|
120
|
+
},
|
|
121
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Overlay, {
|
|
122
|
+
ref: overlayRef
|
|
123
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDialog, {
|
|
124
|
+
ref: dialogRef,
|
|
125
|
+
"aria-modal": 'true',
|
|
126
|
+
role: 'dialog',
|
|
127
|
+
tabIndex: -1,
|
|
128
|
+
sx: {
|
|
129
|
+
...(size === 's' ? {
|
|
130
|
+
maxHeight: 'calc(100vh - 32px)',
|
|
131
|
+
width: ['100%', 400, 400],
|
|
132
|
+
marginX: [8, 'auto', 'auto'],
|
|
133
|
+
marginY: 'auto',
|
|
134
|
+
borderRadius: 'l'
|
|
135
|
+
} : size === 'l' ? {
|
|
136
|
+
maxHeight: '100vh',
|
|
137
|
+
height: ['100%', '100%', 'auto'],
|
|
138
|
+
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
139
|
+
width: ['100%', '100%', 820],
|
|
140
|
+
marginX: [0, 0, 'auto'],
|
|
141
|
+
marginY: 'auto',
|
|
142
|
+
borderRadius: ['none', 'none', 'l']
|
|
143
|
+
} : {}),
|
|
144
|
+
...sx
|
|
145
|
+
},
|
|
146
|
+
onKeyDown: handleKeyDown,
|
|
147
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
148
|
+
sx: {
|
|
149
|
+
position: 'absolute',
|
|
150
|
+
top: 4,
|
|
151
|
+
right: 4
|
|
152
|
+
},
|
|
153
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
|
|
154
|
+
ref: closeButtonRef,
|
|
155
|
+
icon: SvgClose,
|
|
156
|
+
variant: 'plain',
|
|
157
|
+
size: 'm',
|
|
158
|
+
onClick: handleDismiss
|
|
159
|
+
})
|
|
160
|
+
}), children]
|
|
161
|
+
})]
|
|
162
|
+
}) : null
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
const Overlay = styled.span`
|
|
166
|
+
&:before {
|
|
167
|
+
position: fixed;
|
|
168
|
+
top: 0;
|
|
169
|
+
right: 0;
|
|
170
|
+
bottom: 0;
|
|
171
|
+
left: 0;
|
|
172
|
+
display: block;
|
|
173
|
+
cursor: default;
|
|
174
|
+
content: '';
|
|
175
|
+
background: ${color.dim};
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
const BaseDialog = styled.div(() => ({
|
|
179
|
+
position: 'relative',
|
|
180
|
+
boxShadow: elevation['shadow/overlay'],
|
|
181
|
+
backgroundColor: elevation['surface/overlay'],
|
|
182
|
+
outline: 'none',
|
|
183
|
+
overflow: 'hidden',
|
|
184
|
+
margin: 'auto'
|
|
185
|
+
}), sx);
|
|
186
|
+
var index = /*#__PURE__*/forwardRef(Dialog);
|
|
187
|
+
|
|
188
|
+
export { index as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Children, cloneElement } from 'react';
|
|
2
|
+
import useDialogHandler from '../../hook/useDialogHandler.js';
|
|
3
|
+
import { isFunction } from '../../utils/isFunction.js';
|
|
4
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
5
|
+
|
|
6
|
+
const DialogHandler = ({
|
|
7
|
+
renderDialog,
|
|
8
|
+
onClick,
|
|
9
|
+
children: propChildren
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
isOpen,
|
|
13
|
+
openDialog,
|
|
14
|
+
closeDialog
|
|
15
|
+
} = useDialogHandler();
|
|
16
|
+
const handleClick = e => {
|
|
17
|
+
onClick?.(e);
|
|
18
|
+
openDialog();
|
|
19
|
+
};
|
|
20
|
+
const children = isFunction(propChildren) ? propChildren({
|
|
21
|
+
openDialog
|
|
22
|
+
}) : Children.map(propChildren, child => /*#__PURE__*/cloneElement(child, {
|
|
23
|
+
onClick: handleClick
|
|
24
|
+
}));
|
|
25
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
26
|
+
children: [children, renderDialog({
|
|
27
|
+
isOpen,
|
|
28
|
+
closeDialog
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { DialogHandler as default };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import color from '../../packages/token-studio/esm/token/color/index.js';
|
|
2
|
+
import '../../packages/token-studio/esm/token/typography/index.js';
|
|
3
|
+
import { forwardRef, cloneElement } from 'react';
|
|
4
|
+
import { r as reactIsExports } from '../../node_modules/react-is/index.js';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import useProvidedOrCreatedRef from '../../hook/useProvidedOrCreatedRef.js';
|
|
7
|
+
import { forcePixelValue } from '../../utils/forcePixelValue.js';
|
|
8
|
+
import { isFunction } from '../../utils/isFunction.js';
|
|
9
|
+
import { isNullable } from '../../utils/isNullable.js';
|
|
10
|
+
import View from '../View/index.js';
|
|
11
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
12
|
+
|
|
13
|
+
const TextInput = /*#__PURE__*/forwardRef(({
|
|
14
|
+
type = 'text',
|
|
15
|
+
disabled,
|
|
16
|
+
validationStatus,
|
|
17
|
+
leadingVisual: LeadingVisual,
|
|
18
|
+
trailingVisual: TrailingVisual,
|
|
19
|
+
trailingAction,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
22
|
+
const inputRef = useProvidedOrCreatedRef(ref);
|
|
23
|
+
const focusInput = () => {
|
|
24
|
+
inputRef.current?.focus();
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(TextInputWrapper, {
|
|
27
|
+
disabled: disabled,
|
|
28
|
+
onClick: focusInput,
|
|
29
|
+
hasLeadingVisual: !isNullable(LeadingVisual),
|
|
30
|
+
hasTrailingVisual: !isNullable(TrailingVisual),
|
|
31
|
+
hasTrailingAction: !isNullable(trailingAction),
|
|
32
|
+
validationStatus: validationStatus,
|
|
33
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
34
|
+
sx: {
|
|
35
|
+
'flexShrink': 0,
|
|
36
|
+
'fontSize': 'xxs',
|
|
37
|
+
'fontWeight': 'medium',
|
|
38
|
+
'color': color['text/neutral'],
|
|
39
|
+
'& > svg': {
|
|
40
|
+
display: 'block',
|
|
41
|
+
width: 24,
|
|
42
|
+
height: 24,
|
|
43
|
+
color: color['icon/neutral/bold']
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
children: typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual
|
|
47
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsx(BaseInput, {
|
|
48
|
+
ref: e => {
|
|
49
|
+
isFunction(ref) ? ref(e) : null;
|
|
50
|
+
inputRef.current = e;
|
|
51
|
+
},
|
|
52
|
+
type: type,
|
|
53
|
+
disabled: disabled,
|
|
54
|
+
...props
|
|
55
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsxs(View, {
|
|
56
|
+
sx: {
|
|
57
|
+
'display': 'flex',
|
|
58
|
+
'alignItems': 'center',
|
|
59
|
+
'columnGap': 2,
|
|
60
|
+
'flexShrink': 0,
|
|
61
|
+
'fontSize': 'xxs',
|
|
62
|
+
'fontWeight': 'medium',
|
|
63
|
+
'color': color['text/neutral'],
|
|
64
|
+
'& > svg': {
|
|
65
|
+
display: 'block',
|
|
66
|
+
width: 24,
|
|
67
|
+
height: 24,
|
|
68
|
+
color: color['icon/neutral/bold']
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
children: [typeof TrailingVisual !== 'string' && reactIsExports.isValidElementType(TrailingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(TrailingVisual, {}) : TrailingVisual, trailingAction ? /*#__PURE__*/cloneElement(trailingAction, {
|
|
72
|
+
disabled: disabled
|
|
73
|
+
}) : null]
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
const TextInputWrapper = styled.div`
|
|
78
|
+
position: relative;
|
|
79
|
+
width: ${forcePixelValue('100%')};
|
|
80
|
+
border-width: ${forcePixelValue(1)};
|
|
81
|
+
border-style: solid;
|
|
82
|
+
border-radius: ${({
|
|
83
|
+
theme
|
|
84
|
+
}) => forcePixelValue(theme.radii.s)};
|
|
85
|
+
border-color: ${({
|
|
86
|
+
theme
|
|
87
|
+
}) => theme.colors['border/input']};
|
|
88
|
+
background-color: ${({
|
|
89
|
+
theme
|
|
90
|
+
}) => theme.colors['bg/input']};
|
|
91
|
+
cursor: text;
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
|
|
95
|
+
font-size: ${({
|
|
96
|
+
theme
|
|
97
|
+
}) => forcePixelValue(theme.fontSizes.xs)};
|
|
98
|
+
font-weight: ${({
|
|
99
|
+
theme
|
|
100
|
+
}) => theme.fontWeights.medium};
|
|
101
|
+
line-height: ${({
|
|
102
|
+
theme
|
|
103
|
+
}) => theme.lineHeights[2]};
|
|
104
|
+
color: ${({
|
|
105
|
+
theme
|
|
106
|
+
}) => theme.colors['text/neutral']};
|
|
107
|
+
input::placeholder {
|
|
108
|
+
color: ${({
|
|
109
|
+
theme
|
|
110
|
+
}) => theme.colors['text/neutral/subtlest']};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:after {
|
|
114
|
+
content: '';
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: ${forcePixelValue(-1)};
|
|
117
|
+
right: ${forcePixelValue(-1)};
|
|
118
|
+
bottom: ${forcePixelValue(-1)};
|
|
119
|
+
left: ${forcePixelValue(-1)};
|
|
120
|
+
|
|
121
|
+
border: ${forcePixelValue(2)} solid transparent;
|
|
122
|
+
border-radius: ${({
|
|
123
|
+
theme
|
|
124
|
+
}) => forcePixelValue(theme.radii.s)};
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
${props => props.validationStatus !== 'error' && !props.disabled && css`
|
|
129
|
+
&:hover:not(:focus-within) {
|
|
130
|
+
&:after {
|
|
131
|
+
border-color: ${({
|
|
132
|
+
theme
|
|
133
|
+
}) => theme.colors['border/hovered']};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`}
|
|
137
|
+
|
|
138
|
+
${props => props.validationStatus === 'error' && css`
|
|
139
|
+
&:after {
|
|
140
|
+
border-color: ${({
|
|
141
|
+
theme
|
|
142
|
+
}) => theme.colors['border/danger']};
|
|
143
|
+
}
|
|
144
|
+
`}
|
|
145
|
+
|
|
146
|
+
${props => props.validationStatus !== 'error' && css`
|
|
147
|
+
&:focus-within {
|
|
148
|
+
&:after {
|
|
149
|
+
border-color: ${({
|
|
150
|
+
theme
|
|
151
|
+
}) => theme.colors['border/focused']};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`}
|
|
155
|
+
|
|
156
|
+
${props => props.disabled && css`
|
|
157
|
+
border-color: ${props.theme.colors['border/input']};
|
|
158
|
+
background-color: ${props.theme.colors['bg/disabled']};
|
|
159
|
+
color: ${props.theme.colors['text/disabled']};
|
|
160
|
+
|
|
161
|
+
input::placeholder {
|
|
162
|
+
color: ${props.theme.colors['text/disabled']};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
input {
|
|
166
|
+
cursor: not-allowed;
|
|
167
|
+
}
|
|
168
|
+
`};
|
|
169
|
+
|
|
170
|
+
${props => props.hasLeadingVisual && css`
|
|
171
|
+
padding-left: ${forcePixelValue(props.theme.space[5])};
|
|
172
|
+
input {
|
|
173
|
+
padding-left: ${forcePixelValue(props.theme.space[3])};
|
|
174
|
+
}
|
|
175
|
+
`}
|
|
176
|
+
|
|
177
|
+
${props => (props.hasTrailingVisual || props.hasTrailingAction) && css`
|
|
178
|
+
padding-right: ${forcePixelValue(props.theme.space[3])};
|
|
179
|
+
input {
|
|
180
|
+
padding-right: ${forcePixelValue(props.theme.space[3])};
|
|
181
|
+
}
|
|
182
|
+
`}
|
|
183
|
+
|
|
184
|
+
transition: color 100ms, background-color 100ms;
|
|
185
|
+
&:after {
|
|
186
|
+
transition: border-color 100ms;
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
const UnstyledInput = styled.input`
|
|
190
|
+
font-size: inherit;
|
|
191
|
+
font-weight: inherit;
|
|
192
|
+
line-height: inherit;
|
|
193
|
+
font-family: inherit;
|
|
194
|
+
border-radius: inherit;
|
|
195
|
+
color: inherit;
|
|
196
|
+
transition: inherit;
|
|
197
|
+
|
|
198
|
+
border: 0;
|
|
199
|
+
background-color: transparent;
|
|
200
|
+
width: 100%;
|
|
201
|
+
&:focus {
|
|
202
|
+
outline: 0;
|
|
203
|
+
}
|
|
204
|
+
`;
|
|
205
|
+
const BaseInput = styled(UnstyledInput)`
|
|
206
|
+
padding-top: ${({
|
|
207
|
+
theme
|
|
208
|
+
}) => forcePixelValue(theme.space['4'])};
|
|
209
|
+
padding-right: ${({
|
|
210
|
+
theme
|
|
211
|
+
}) => forcePixelValue(theme.space['4'])};
|
|
212
|
+
padding-bottom: ${({
|
|
213
|
+
theme
|
|
214
|
+
}) => forcePixelValue(theme.space['4'])};
|
|
215
|
+
padding-left: ${({
|
|
216
|
+
theme
|
|
217
|
+
}) => forcePixelValue(theme.space['5'])};
|
|
218
|
+
`;
|
|
219
|
+
|
|
220
|
+
export { TextInput as default };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import useProvidedOrCreatedRef from '../../hook/useProvidedOrCreatedRef.js';
|
|
4
|
+
import { forcePixelValue } from '../../utils/forcePixelValue.js';
|
|
5
|
+
import { isFunction } from '../../utils/isFunction.js';
|
|
6
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
7
|
+
|
|
8
|
+
const Textarea = /*#__PURE__*/forwardRef(({
|
|
9
|
+
disabled,
|
|
10
|
+
...props
|
|
11
|
+
}, ref) => {
|
|
12
|
+
const inputRef = useProvidedOrCreatedRef(ref);
|
|
13
|
+
const focusInput = () => {
|
|
14
|
+
inputRef.current?.focus();
|
|
15
|
+
};
|
|
16
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(TextareaWrapper, {
|
|
17
|
+
disabled: disabled,
|
|
18
|
+
onClick: focusInput,
|
|
19
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(BaseTextarea, {
|
|
20
|
+
ref: e => {
|
|
21
|
+
isFunction(ref) ? ref(e) : null;
|
|
22
|
+
inputRef.current = e;
|
|
23
|
+
},
|
|
24
|
+
disabled: disabled,
|
|
25
|
+
...props
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
const TextareaWrapper = styled.div`
|
|
30
|
+
position: relative;
|
|
31
|
+
width: ${forcePixelValue('100%')};
|
|
32
|
+
border-width: ${forcePixelValue(1)};
|
|
33
|
+
border-style: solid;
|
|
34
|
+
border-radius: ${({
|
|
35
|
+
theme
|
|
36
|
+
}) => forcePixelValue(theme.radii.s)};
|
|
37
|
+
border-color: ${({
|
|
38
|
+
theme
|
|
39
|
+
}) => theme.colors['border/input']};
|
|
40
|
+
background-color: ${({
|
|
41
|
+
theme
|
|
42
|
+
}) => theme.colors['bg/input']};
|
|
43
|
+
cursor: text;
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
|
|
47
|
+
padding-top: ${({
|
|
48
|
+
theme
|
|
49
|
+
}) => forcePixelValue(theme.space['4'])};
|
|
50
|
+
padding-right: ${({
|
|
51
|
+
theme
|
|
52
|
+
}) => forcePixelValue(theme.space['4'])};
|
|
53
|
+
padding-bottom: ${({
|
|
54
|
+
theme
|
|
55
|
+
}) => forcePixelValue(theme.space['4'])};
|
|
56
|
+
padding-left: ${({
|
|
57
|
+
theme
|
|
58
|
+
}) => forcePixelValue(theme.space['5'])};
|
|
59
|
+
|
|
60
|
+
font-size: ${({
|
|
61
|
+
theme
|
|
62
|
+
}) => forcePixelValue(theme.fontSizes.xs)};
|
|
63
|
+
font-weight: ${({
|
|
64
|
+
theme
|
|
65
|
+
}) => theme.fontWeights.medium};
|
|
66
|
+
line-height: ${({
|
|
67
|
+
theme
|
|
68
|
+
}) => theme.lineHeights[2]};
|
|
69
|
+
color: ${({
|
|
70
|
+
theme
|
|
71
|
+
}) => theme.colors['text/neutral']};
|
|
72
|
+
input::placeholder {
|
|
73
|
+
color: ${({
|
|
74
|
+
theme
|
|
75
|
+
}) => theme.colors['text/neutral/subtlest']};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
height: 74px;
|
|
79
|
+
|
|
80
|
+
&:after {
|
|
81
|
+
content: '';
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: ${forcePixelValue(-1)};
|
|
84
|
+
right: ${forcePixelValue(-1)};
|
|
85
|
+
bottom: ${forcePixelValue(-1)};
|
|
86
|
+
left: ${forcePixelValue(-1)};
|
|
87
|
+
|
|
88
|
+
border: ${forcePixelValue(2)} solid transparent;
|
|
89
|
+
border-radius: ${({
|
|
90
|
+
theme
|
|
91
|
+
}) => forcePixelValue(theme.radii.s)};
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
${props => props.validationStatus !== 'error' && !props.disabled && css`
|
|
96
|
+
&:hover:not(:focus-within) {
|
|
97
|
+
&:after {
|
|
98
|
+
border-color: ${({
|
|
99
|
+
theme
|
|
100
|
+
}) => theme.colors['border/hovered']};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`}
|
|
104
|
+
|
|
105
|
+
${props => props.validationStatus === 'error' && css`
|
|
106
|
+
&:after {
|
|
107
|
+
border-color: ${({
|
|
108
|
+
theme
|
|
109
|
+
}) => theme.colors['border/danger']};
|
|
110
|
+
}
|
|
111
|
+
`}
|
|
112
|
+
|
|
113
|
+
${props => props.validationStatus !== 'error' && css`
|
|
114
|
+
&:focus-within {
|
|
115
|
+
&:after {
|
|
116
|
+
border-color: ${({
|
|
117
|
+
theme
|
|
118
|
+
}) => theme.colors['border/focused']};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`}
|
|
122
|
+
|
|
123
|
+
${props => props.disabled && css`
|
|
124
|
+
border-color: ${props.theme.colors['border/input']};
|
|
125
|
+
background-color: ${props.theme.colors['bg/disabled']};
|
|
126
|
+
color: ${props.theme.colors['text/disabled']};
|
|
127
|
+
|
|
128
|
+
textarea::placeholder {
|
|
129
|
+
color: ${props.theme.colors['text/disabled']};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&,
|
|
133
|
+
textarea {
|
|
134
|
+
cursor: not-allowed;
|
|
135
|
+
}
|
|
136
|
+
`};
|
|
137
|
+
`;
|
|
138
|
+
const UnstyledTextarea = styled.textarea`
|
|
139
|
+
font-size: inherit;
|
|
140
|
+
font-weight: inherit;
|
|
141
|
+
line-height: inherit;
|
|
142
|
+
font-family: inherit;
|
|
143
|
+
border-radius: inherit;
|
|
144
|
+
color: inherit;
|
|
145
|
+
transition: inherit;
|
|
146
|
+
|
|
147
|
+
border: 0;
|
|
148
|
+
background-color: transparent;
|
|
149
|
+
width: 100%;
|
|
150
|
+
&:focus {
|
|
151
|
+
outline: 0;
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
const BaseTextarea = styled(UnstyledTextarea)`
|
|
155
|
+
resize: none;
|
|
156
|
+
`;
|
|
157
|
+
|
|
158
|
+
export { Textarea as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const useDialogHandler = () => {
|
|
4
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
5
|
+
const openDialog = () => setIsOpen(true);
|
|
6
|
+
const closeDialog = () => setIsOpen(false);
|
|
7
|
+
return {
|
|
8
|
+
isOpen,
|
|
9
|
+
openDialog,
|
|
10
|
+
closeDialog
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { useDialogHandler as default };
|
package/esm/index.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
export { default as Button } from './core/Button/index.js';
|
|
2
2
|
export { default as Chip } from './core/Chip/index.js';
|
|
3
|
+
export { default as Dialog } from './core/Dialog/index.js';
|
|
4
|
+
export { default as DialogHandler } from './core/DialogHandler/index.js';
|
|
3
5
|
export { default as GradientText } from './core/GradientText/index.js';
|
|
4
6
|
export { default as Grid } from './core/Grid/index.js';
|
|
5
7
|
export { default as IconButton } from './core/IconButton/index.js';
|
|
6
8
|
export { default as IconToggleButton } from './core/IconToggleButton/index.js';
|
|
7
9
|
export { default as Image } from './core/Image/index.js';
|
|
8
10
|
export { default as ItemList } from './core/ItemList/index.js';
|
|
11
|
+
export { default as MotionView } from './core/MotionView/index.js';
|
|
9
12
|
export { default as Space } from './core/Space/index.js';
|
|
10
13
|
export { default as Spinner } from './core/Spinner/index.js';
|
|
11
14
|
export { default as Stack } from './core/Stack/index.js';
|
|
12
15
|
export { default as StyledIcon } from './core/StyledIcon/index.js';
|
|
13
16
|
export { default as Text } from './core/Text/index.js';
|
|
17
|
+
export { default as Textarea } from './core/Textarea/index.js';
|
|
18
|
+
export { default as TextInput } from './core/TextInput/index.js';
|
|
14
19
|
export { default as ThemeProvider } from './core/ThemeProvider/index.js';
|
|
15
20
|
export { default as View } from './core/View/index.js';
|
|
16
21
|
export { default as UnstyledButton } from './core/_UnstyledButton.js';
|