Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uxf/ui

Package Overview
Dependencies
Maintainers
1
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uxf/ui - npm Package Compare versions

Comparing version 1.0.0-beta.35 to 1.0.0-beta.37

form-control/form-control.d.ts

4

combobox/combobox.js

@@ -51,8 +51,8 @@ "use strict";

renderProps.open ? (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronUpIcon, size: 12 })) : (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronDownIcon, size: 12 }))),
props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID) }, props.helperText)),
react_2.default.createElement(react_1.Combobox.Options, { className: "uxf-dropdown", ref: dropdown.floating, style: dropdown.style }, filteredData.map((option) => {
var _a, _b, _c, _d;
return (react_2.default.createElement(react_1.Combobox.Option, { key: (_b = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.id, value: option, className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED) }, (_d = (_c = props.renderOption) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.label));
})),
react_2.default.createElement("div", { className: "uxf-combobox__helper-text" }, props.isInvalid && props.error ? props.error : props.helperText)))));
}))))));
}
exports.default = (0, forwardRef_1.forwardRef)("Combobox", Combobox);
import React from "react";
import { IconsSet } from "./theme";
import { IconsSet } from "@uxf/ui/icon/theme";
declare type NameOrComponentType = {

@@ -4,0 +4,0 @@ name: IconsSet;

@@ -34,3 +34,5 @@ "use strict";

const react_1 = __importStar(require("react"));
const resizer_1 = require("@uxf/core/utils/resizer");
function Gallery(props) {
var _a;
(0, react_1.useEffect)(() => {

@@ -58,2 +60,3 @@ const onKeyDown = (event) => {

}, []);
const imageSrc = props.images[props.imageIndex].src;
return (react_1.default.createElement("div", { className: "fixed inset-0 top-0 bottom-0 z-50 flex flex-col bg-black bg-opacity-75 transition-opacity" },

@@ -64,8 +67,8 @@ react_1.default.createElement("div", { className: "flex justify-end" },

react_1.default.createElement("div", { className: "relative flex flex-1 items-center justify-center" },
react_1.default.createElement("img", { alt: "", className: "absolute left-0 right-0 top-0 h-full w-full object-contain", src: props.images[props.imageIndex].src }),
react_1.default.createElement("img", { alt: "", className: "absolute left-0 right-0 top-0 h-full w-full object-contain", src: typeof imageSrc === "string" ? imageSrc : (_a = (0, resizer_1.resizerImageUrl)(imageSrc)) !== null && _a !== void 0 ? _a : "" }),
react_1.default.createElement("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-between p-2" },
react_1.default.createElement(previous_button_1.default, { onClick: props.onPrevious }),
react_1.default.createElement(next_button_1.default, { onClick: props.onNext })))),
react_1.default.createElement("div", { className: "row mx-auto flex space-x-2 p-4" }, props.images.map((url, index) => (react_1.default.createElement(dot_1.default, { key: url.src, active: index === props.imageIndex }))))));
react_1.default.createElement("div", { className: "row mx-auto flex space-x-2 p-4" }, props.images.map((image, index) => (react_1.default.createElement(dot_1.default, { key: typeof image.src === "string" ? image.src : image.src.uuid, active: index === props.imageIndex }))))));
}
exports.default = Gallery;

@@ -35,5 +35,5 @@ "use strict";

const [imageIndex, setImageIndex] = (0, react_1.useState)(null);
const registerImage = (0, react_1.useMemo)(() => (image) => setImages((v) => [...v, image]), []);
const unregisterImage = (0, react_1.useMemo)(() => (image) => setImages((v) => v.filter((u) => u.src !== image.src)), []);
const openGallery = (image) => setImageIndex(images.findIndex((i) => i.src === image.src));
const registerImage = (0, react_1.useCallback)((image) => setImages((v) => [...v, image]), []);
const unregisterImage = (0, react_1.useCallback)((image) => setImages((v) => v.filter((u) => u.src !== image.src)), []);
const openGallery = (0, react_1.useCallback)((image) => setImageIndex(images.findIndex((i) => i.src === image.src)), [images]);
const onPrevious = (0, react_1.useCallback)(() => {

@@ -40,0 +40,0 @@ setImageIndex((v) => (v === null ? null : v - 1));

@@ -24,4 +24,4 @@ "use strict";

return (react_1.default.createElement(image_gallery_1.default, null,
react_1.default.createElement("div", { className: "flex-direction flex gap-2" }, images.map((src) => (react_1.default.createElement(image_1.default, { key: src, src: src, className: "h-56 w-56 cursor-pointer object-cover transition-transform hover:scale-105" }))))));
react_1.default.createElement("div", { className: "flex-direction flex gap-2" }, images.map((src) => (react_1.default.createElement(image_1.default, { key: typeof src === "string" ? src : src.uuid, src: src, className: "h-56 w-56 cursor-pointer object-cover transition-transform hover:scale-105" }))))));
}
exports.Default = Default;

@@ -8,6 +8,8 @@ "use strict";

const use_image_1 = require("./use-image");
const resizer_1 = require("@uxf/core/utils/resizer");
function Image(props) {
var _a;
const openGallery = (0, use_image_1.useImage)(props);
return (react_1.default.createElement("img", { src: props.src, alt: props.alt, title: props.title, className: props.className, onClick: () => openGallery(props) }));
return (react_1.default.createElement("img", { src: typeof props.src === "string" ? props.src : (_a = (0, resizer_1.resizerImageUrl)(props.src)) !== null && _a !== void 0 ? _a : "", alt: props.alt, title: props.title, className: props.className, onClick: openGallery }));
}
exports.default = Image;
export { default as Image } from "./image";
export { default as ImageGallery } from "./image-gallery";
export * from "./use-image";
export * from "./types";

@@ -26,1 +26,2 @@ "use strict";

__exportStar(require("./use-image"), exports);
__exportStar(require("./types"), exports);

@@ -0,3 +1,4 @@

import { FileResponse } from "../utils/image";
export interface ImageGalleryImageProps {
src: string;
src: string | FileResponse;
title?: string;

@@ -4,0 +5,0 @@ alt?: string;

import { ImageGalleryImageProps } from "./types";
export declare function useImage(props: ImageGalleryImageProps): (props: ImageGalleryImageProps) => void;
export declare function useImage(props: ImageGalleryImageProps): () => void;

@@ -14,4 +14,4 @@ "use strict";

}, [props, registerImage, unregisterImage]);
return openGallery;
return (0, react_1.useCallback)(() => openGallery(props), [props, openGallery]);
}
exports.useImage = useImage;
import React, { MouseEventHandler, ReactNode } from "react";
export interface LabelProps {
children?: ReactNode;
className?: string;
htmlFor?: string;
form?: string;
onClick?: MouseEventHandler<HTMLLabelElement>;
className?: string;
isRequired?: boolean;
}
declare const _default: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
export default _default;

@@ -10,4 +10,5 @@ "use strict";

function Label(props, ref) {
return (react_1.default.createElement("label", { className: (0, cx_1.cx)("uxf-label", props.className), ref: ref, htmlFor: props.htmlFor, form: props.form, onClick: props.onClick }, props.children));
const className = (0, cx_1.cx)("uxf-label", props.isRequired && "is-required", props.className);
return (react_1.default.createElement("label", { className: className, ref: ref, htmlFor: props.htmlFor, form: props.form, onClick: props.onClick }, props.children));
}
exports.default = (0, forwardRef_1.forwardRef)("Label", Label);
{
"name": "@uxf/ui",
"version": "1.0.0-beta.35",
"version": "1.0.0-beta.37",
"description": "",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -42,5 +42,5 @@ "use strict";

!hiddenLabel && (react_1.default.createElement(react_2.RadioGroup.Label, { as: label_1.Label, className: "mb-2" }, label)),
react_1.default.createElement("div", { className: `flex ${forceColumn ? "flex-col" : "flex-wrap items-center"} focus-visible:ring-gray-dark outline-none focus-visible:ring-2`, onBlur: onBlur, onFocus: onFocus, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), tabIndex: disabled ? -1 : 0 }, options.map((option) => (react_1.default.createElement(react_2.RadioGroup.Option, { as: react_1.Fragment, disabled: option.disabled, key: option.value.toString(), value: option.value }, (o) => (react_1.default.createElement(radio_1.Radio, { active: o.active, checked: o.checked, disabled: disabled || o.disabled, invalid: invalid, label: option.label })))))),
react_1.default.createElement("div", { className: `flex ${forceColumn ? "flex-col" : "flex-wrap items-center"} focus-visible:ring-gray-dark outline-none focus-visible:ring-2`, onBlur: onBlur, onFocus: onFocus, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), tabIndex: disabled ? -1 : 0 }, options.map((option) => (react_1.default.createElement(react_2.RadioGroup.Option, { as: react_1.Fragment, disabled: option.disabled, key: option.value.toString(), value: option.value }, (o) => react_1.default.createElement(radio_1.Radio, { value: o.checked, isDisabled: disabled || o.disabled, isInvalid: invalid }))))),
invalid && error && react_1.default.createElement(error_message_1.ErrorMessage, { id: errorId }, error)));
}
exports.default = (0, forwardRef_1.forwardRef)("RadioGroup", RadioGroup);
import React from "react";
export interface RadioProps {
active?: boolean;
checked?: boolean;
disabled?: boolean;
invalid?: boolean;
label: string;
className?: string;
}
import { FormControlProps } from "../types";
export declare type RadioProps = FormControlProps<boolean>;
declare const _default: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLDivElement>>;
export default _default;

@@ -11,9 +11,5 @@ "use strict";

function Radio(props, ref) {
// eslint-disable-next-line react/destructuring-assignment
const { active, checked, className, disabled, invalid, label, ...restProps } = props;
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-radio__control", active && classes_1.CLASSES.IS_FOCUSED, checked && classes_1.CLASSES.IS_SELECTED, disabled && classes_1.CLASSES.IS_DISABLED, invalid && classes_1.CLASSES.IS_INVALID, className), ref: ref, ...restProps },
react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-radio", active && classes_1.CLASSES.IS_FOCUSED, checked && classes_1.CLASSES.IS_SELECTED, disabled && classes_1.CLASSES.IS_DISABLED, invalid && classes_1.CLASSES.IS_INVALID) },
react_1.default.createElement("div", { className: (0, cx_1.cx)(checked && classes_1.CLASSES.IS_SELECTED, "uxf-radio__inner") })),
react_1.default.createElement("p", { className: "cursor-default" }, label)));
return (react_1.default.createElement("div", { ref: ref, className: (0, cx_1.cx)("uxf-radio", props.value && classes_1.CLASSES.IS_SELECTED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY), onClick: () => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, !props.value); } },
react_1.default.createElement("div", { className: "uxf-radio__inner" })));
}
exports.default = (0, forwardRef_1.forwardRef)("Radio", Radio);

@@ -14,8 +14,16 @@ "use strict";

function Default() {
return (react_1.default.createElement("div", { className: "space-y-2" },
react_1.default.createElement(index_1.Radio, { label: "Radio", checked: true, active: true }),
react_1.default.createElement(index_1.Radio, { label: "Radio", checked: true, active: false }),
react_1.default.createElement(index_1.Radio, { label: "Radio", checked: false, active: true }),
react_1.default.createElement(index_1.Radio, { label: "Radio", checked: false, active: false })));
return (react_1.default.createElement("div", null,
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Default"),
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
react_1.default.createElement(index_1.Radio, { value: false }),
react_1.default.createElement(index_1.Radio, { value: true })),
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Invalid"),
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
react_1.default.createElement(index_1.Radio, { value: false, isInvalid: true }),
react_1.default.createElement(index_1.Radio, { value: true, isInvalid: true })),
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Disabled"),
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
react_1.default.createElement(index_1.Radio, { value: false, isDisabled: true }),
react_1.default.createElement(index_1.Radio, { value: true, isDisabled: true }))));
}
exports.Default = Default;

@@ -50,5 +50,4 @@ "use strict";

react_2.default.createElement("div", { className: "uxf-select__button-text" }, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || props.placeholder),
renderProps.open ? (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronUpIcon, size: 12 })) : (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronDownIcon, size: 12 })),
" "),
react_2.default.createElement("div", { className: "uxf-select__helper-text" }, props.helperText),
renderProps.open ? (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronUpIcon, size: 12 })) : (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronDownIcon, size: 12 }))),
props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID) }, props.helperText)),
react_2.default.createElement(react_1.Listbox.Options, { ref: dropdown.floating, style: dropdown.style, className: "uxf-dropdown" }, props.options.map((option) => {

@@ -55,0 +54,0 @@ var _a, _b, _c, _d;

@@ -30,2 +30,4 @@ "use strict";

const cx_1 = require("@uxf/core/utils/cx");
const form_control_1 = require("../form-control");
const classes_1 = require("@uxf/core/constants/classes");
function TextInput(props) {

@@ -37,3 +39,3 @@ var _a;

const errorId = props.isInvalid ? `${id}--error-message` : undefined;
const rootClassName = (0, cx_1.cx)("uxf-text-input", props.isInvalid && "uxf-text-input--invalid", props.isDisabled && "uxf-text-input--disabled", props.isRequired && "uxf-text-input--required", isFocused && "uxf-text-input--focused");
const rootClassName = (0, cx_1.cx)("uxf-text-input", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isRequired && "is-required", isFocused && classes_1.CLASSES.IS_FOCUSED);
const onFocus = (e) => {

@@ -49,4 +51,3 @@ var _a;

};
return (react_1.default.createElement("div", { className: rootClassName },
react_1.default.createElement("label", { className: "uxf-text-input__label", htmlFor: id }, props.label),
return (react_1.default.createElement(form_control_1.FormControl, { inputId: id, errorId: errorId, className: rootClassName, isRequired: props.isRequired, helperText: props.helperText, label: props.label, form: props.form },
react_1.default.createElement(input_1.Input, { size: props.size, variant: props.variant },

@@ -57,5 +58,4 @@ props.leftAddon && react_1.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),

props.rightElement && react_1.default.createElement(input_1.Input.RightElement, null, props.rightElement),
props.rightAddon && react_1.default.createElement(input_1.Input.RightAddon, null, props.rightAddon)),
react_1.default.createElement("div", { className: "uxf-text-input__helper-text", id: errorId }, props.helperText)));
props.rightAddon && react_1.default.createElement(input_1.Input.RightAddon, null, props.rightAddon))));
}
exports.TextInput = TextInput;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc