🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@flywire/react-headlessui

Package Overview
Dependencies
Maintainers
11
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flywire/react-headlessui - npm Package Compare versions

Comparing version

to
0.0.11

7

dist/cjs/components/Field/components/File.js

@@ -21,11 +21,12 @@ "use strict";

async function handleOnChange(evt) {
var _a, _b, _c;
setIsLoading(true);
const file = evt.target.files?.[0];
const file = (_a = evt.target.files) === null || _a === void 0 ? void 0 : _a[0];
const invalidFileSize = file && file.size > maxFileSizeInBytes;
if (invalidFileSize) {
inputFileRef?.current?.setCustomValidity('Invalid file size');
(_b = inputFileRef === null || inputFileRef === void 0 ? void 0 : inputFileRef.current) === null || _b === void 0 ? void 0 : _b.setCustomValidity('Invalid file size');
setIsLoading(false);
return onError(new InvalidFileSizeError('Invalid file size'));
}
inputFileRef?.current?.setCustomValidity('');
(_c = inputFileRef === null || inputFileRef === void 0 ? void 0 : inputFileRef.current) === null || _c === void 0 ? void 0 : _c.setCustomValidity('');
await Promise.allSettled([

@@ -32,0 +33,0 @@ onChange(evt),

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

function handleOnChange({ evt, index, }) {
var _a;
const newValues = [...values];
newValues[index] = evt.target?.value;
newValues[index] = (_a = evt.target) === null || _a === void 0 ? void 0 : _a.value;
setValues(newValues);

@@ -17,0 +18,0 @@ const event = new CustomEvent('change', {

@@ -10,7 +10,7 @@ "use strict";

const NO_VALUE = '';
function useMaskInput({ initialValue = NO_VALUE, mask, onChange = () => {
function useMaskInput({ mask, onChange = () => {
// does nothing
}, ...rest }) {
const inputRef = (0, react_1.useRef)(null);
const [value, setValue] = (0, react_1.useState)(initialValue);
const [value, setValue] = (0, react_1.useState)(NO_VALUE);
const runAfterUpdate = (0, useRunAfterUpdate_1.default)();

@@ -17,0 +17,0 @@ function handleInputChange(evt) {

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

const afterPaintRef = (0, react_1.useRef)();
(0, react_1.useEffect)(() => {
(0, react_1.useLayoutEffect)(() => {
var _a;
if (afterPaintRef.current) {
afterPaintRef.current?.();
(_a = afterPaintRef.current) === null || _a === void 0 ? void 0 : _a.call(afterPaintRef);
afterPaintRef.current = undefined;

@@ -11,0 +12,0 @@ }

import { ChangeEvent, InputHTMLAttributes } from 'react';
interface Props extends InputHTMLAttributes<HTMLInputElement> {
initialValue?: string;
mask: string;
}
declare function useMaskInput({ initialValue, mask, onChange, ...rest }: Props): {
declare function useMaskInput({ mask, onChange, ...rest }: Props): {
inputProps: {

@@ -8,0 +7,0 @@ accept?: string | undefined;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyPattern = void 0;
const applyPattern = ({ text, pattern, cursor = text?.length || 0, }) => {
const applyPattern = ({ text, pattern, cursor = (text === null || text === void 0 ? void 0 : text.length) || 0, }) => {
if (!text || text.length === 0 || !pattern || cursor < text.length) {

@@ -6,0 +6,0 @@ return [text, cursor];

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

return function (...args) {
fns.forEach((fn) => fn?.(...args));
fns.forEach((fn) => fn === null || fn === void 0 ? void 0 : fn(...args));
};
}
exports.default = callAll;

@@ -16,11 +16,12 @@ import { jsx as _jsx } from "react/jsx-runtime";

async function handleOnChange(evt) {
var _a, _b, _c;
setIsLoading(true);
const file = evt.target.files?.[0];
const file = (_a = evt.target.files) === null || _a === void 0 ? void 0 : _a[0];
const invalidFileSize = file && file.size > maxFileSizeInBytes;
if (invalidFileSize) {
inputFileRef?.current?.setCustomValidity('Invalid file size');
(_b = inputFileRef === null || inputFileRef === void 0 ? void 0 : inputFileRef.current) === null || _b === void 0 ? void 0 : _b.setCustomValidity('Invalid file size');
setIsLoading(false);
return onError(new InvalidFileSizeError('Invalid file size'));
}
inputFileRef?.current?.setCustomValidity('');
(_c = inputFileRef === null || inputFileRef === void 0 ? void 0 : inputFileRef.current) === null || _c === void 0 ? void 0 : _c.setCustomValidity('');
await Promise.allSettled([

@@ -27,0 +28,0 @@ onChange(evt),

@@ -11,4 +11,5 @@ import { jsx as _jsx } from "react/jsx-runtime";

function handleOnChange({ evt, index, }) {
var _a;
const newValues = [...values];
newValues[index] = evt.target?.value;
newValues[index] = (_a = evt.target) === null || _a === void 0 ? void 0 : _a.value;
setValues(newValues);

@@ -15,0 +16,0 @@ const event = new CustomEvent('change', {

@@ -5,7 +5,7 @@ import { useRef, useState } from 'react';

const NO_VALUE = '';
function useMaskInput({ initialValue = NO_VALUE, mask, onChange = () => {
function useMaskInput({ mask, onChange = () => {
// does nothing
}, ...rest }) {
const inputRef = useRef(null);
const [value, setValue] = useState(initialValue);
const [value, setValue] = useState(NO_VALUE);
const runAfterUpdate = useRunAfterUpdate();

@@ -12,0 +12,0 @@ function handleInputChange(evt) {

@@ -1,7 +0,8 @@

import { useRef, useEffect } from 'react';
import { useRef, useLayoutEffect } from 'react';
function useRunAfterUpdate() {
const afterPaintRef = useRef();
useEffect(() => {
useLayoutEffect(() => {
var _a;
if (afterPaintRef.current) {
afterPaintRef.current?.();
(_a = afterPaintRef.current) === null || _a === void 0 ? void 0 : _a.call(afterPaintRef);
afterPaintRef.current = undefined;

@@ -8,0 +9,0 @@ }

import { ChangeEvent, InputHTMLAttributes } from 'react';
interface Props extends InputHTMLAttributes<HTMLInputElement> {
initialValue?: string;
mask: string;
}
declare function useMaskInput({ initialValue, mask, onChange, ...rest }: Props): {
declare function useMaskInput({ mask, onChange, ...rest }: Props): {
inputProps: {

@@ -8,0 +7,0 @@ accept?: string | undefined;

@@ -1,2 +0,2 @@

export const applyPattern = ({ text, pattern, cursor = text?.length || 0, }) => {
export const applyPattern = ({ text, pattern, cursor = (text === null || text === void 0 ? void 0 : text.length) || 0, }) => {
if (!text || text.length === 0 || !pattern || cursor < text.length) {

@@ -3,0 +3,0 @@ return [text, cursor];

function callAll(...fns) {
return function (...args) {
fns.forEach((fn) => fn?.(...args));
fns.forEach((fn) => fn === null || fn === void 0 ? void 0 : fn(...args));
};
}
export default callAll;

@@ -30,11 +30,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

async function handleOnChange(evt) {
var _a, _b, _c;
setIsLoading(true);
const file = evt.target.files?.[0];
const file = (_a = evt.target.files) === null || _a === void 0 ? void 0 : _a[0];
const invalidFileSize = file && file.size > maxFileSizeInBytes;
if (invalidFileSize) {
inputFileRef?.current?.setCustomValidity('Invalid file size');
(_b = inputFileRef === null || inputFileRef === void 0 ? void 0 : inputFileRef.current) === null || _b === void 0 ? void 0 : _b.setCustomValidity('Invalid file size');
setIsLoading(false);
return onError(new InvalidFileSizeError('Invalid file size'));
}
inputFileRef?.current?.setCustomValidity('');
(_c = inputFileRef === null || inputFileRef === void 0 ? void 0 : inputFileRef.current) === null || _c === void 0 ? void 0 : _c.setCustomValidity('');
await Promise.allSettled([

@@ -41,0 +42,0 @@ onChange(evt),

@@ -22,4 +22,5 @@ (function (factory) {

function handleOnChange({ evt, index, }) {
var _a;
const newValues = [...values];
newValues[index] = evt.target?.value;
newValues[index] = (_a = evt.target) === null || _a === void 0 ? void 0 : _a.value;
setValues(newValues);

@@ -26,0 +27,0 @@ const event = new CustomEvent('change', {

@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

const NO_VALUE = '';
function useMaskInput({ initialValue = NO_VALUE, mask, onChange = () => {
function useMaskInput({ mask, onChange = () => {
// does nothing
}, ...rest }) {
const inputRef = (0, react_1.useRef)(null);
const [value, setValue] = (0, react_1.useState)(initialValue);
const [value, setValue] = (0, react_1.useState)(NO_VALUE);
const runAfterUpdate = (0, useRunAfterUpdate_1.default)();

@@ -26,0 +26,0 @@ function handleInputChange(evt) {

@@ -15,5 +15,6 @@ (function (factory) {

const afterPaintRef = (0, react_1.useRef)();
(0, react_1.useEffect)(() => {
(0, react_1.useLayoutEffect)(() => {
var _a;
if (afterPaintRef.current) {
afterPaintRef.current?.();
(_a = afterPaintRef.current) === null || _a === void 0 ? void 0 : _a.call(afterPaintRef);
afterPaintRef.current = undefined;

@@ -20,0 +21,0 @@ }

import { ChangeEvent, InputHTMLAttributes } from 'react';
interface Props extends InputHTMLAttributes<HTMLInputElement> {
initialValue?: string;
mask: string;
}
declare function useMaskInput({ initialValue, mask, onChange, ...rest }: Props): {
declare function useMaskInput({ mask, onChange, ...rest }: Props): {
inputProps: {

@@ -8,0 +7,0 @@ accept?: string | undefined;

@@ -13,3 +13,3 @@ (function (factory) {

exports.applyPattern = void 0;
const applyPattern = ({ text, pattern, cursor = text?.length || 0, }) => {
const applyPattern = ({ text, pattern, cursor = (text === null || text === void 0 ? void 0 : text.length) || 0, }) => {
if (!text || text.length === 0 || !pattern || cursor < text.length) {

@@ -16,0 +16,0 @@ return [text, cursor];

@@ -14,3 +14,3 @@ (function (factory) {

return function (...args) {
fns.forEach((fn) => fn?.(...args));
fns.forEach((fn) => fn === null || fn === void 0 ? void 0 : fn(...args));
};

@@ -17,0 +17,0 @@ }

{
"name": "@flywire/react-headlessui",
"version": "0.0.11-0",
"version": "0.0.11",
"description": "Headless UI components",

@@ -34,2 +34,4 @@ "main": "./dist/umd/index.js",

"scripts": {
"audit": "npm audit fix --dry-run --json",
"audit:fix": "npm audit fix",
"build": "npm run build:js",

@@ -36,0 +38,0 @@ "build:cjs": "tsc -p ./tsconfig.cjs.json",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet