@preply/ds-web-core
Advanced tools
Comparing version 0.99.1-beta.22520120a5c75760a7e3556443f375b03c4fe7c1.0 to 0.99.1-beta.6fcddb3f3b82fb62293b4c54958750a8ce252183.0
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
@@ -0,0 +0,0 @@ import { InputCommonProps } from '../../input/private/types'; |
@@ -1,22 +0,31 @@ | ||
const SUFIX = '-desc'; | ||
const SUFIX = "-desc"; | ||
const removeFalsyProperties = (props) => { | ||
return Object.keys(props).reduce((acc, key) => { | ||
if (props[key]) { | ||
acc[key] = props[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
return Object.keys(props).reduce((acc, key) => { | ||
if (props[key]) { | ||
acc[key] = props[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
}; | ||
const makeDescId = (id) => `${id}${SUFIX}`; | ||
const getAriaProps = ({ 'aria-describedby': ariaDescribedBy, 'aria-disabled': ariaDisabled, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, required, disabled, hasError, }) => { | ||
const props = { | ||
'aria-describedby': ariaDescribedBy || '', | ||
'aria-disabled': !!ariaDisabled || !!disabled, | ||
'aria-invalid': !!ariaInvalid || !!hasError, | ||
'aria-required': !!ariaRequired || !!required, | ||
}; | ||
return removeFalsyProperties(props); | ||
const getAriaProps = ({ | ||
"aria-describedby": ariaDescribedBy, | ||
"aria-disabled": ariaDisabled, | ||
"aria-invalid": ariaInvalid, | ||
"aria-required": ariaRequired, | ||
required, | ||
disabled, | ||
hasError | ||
}) => { | ||
const props = { | ||
"aria-describedby": ariaDescribedBy || "", | ||
"aria-disabled": !!ariaDisabled || !!disabled, | ||
"aria-invalid": !!ariaInvalid || !!hasError, | ||
"aria-required": !!ariaRequired || !!required | ||
}; | ||
return removeFalsyProperties(props); | ||
}; | ||
export { getAriaProps, makeDescId }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hY2Nlc3NpYmlsaXR5L2FyaWEvdXRpbHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5wdXRDb21tb25Qcm9wcyB9IGZyb20gJy4uLy4uL2lucHV0L3ByaXZhdGUvdHlwZXMnO1xuXG5pbXBvcnQgeyBBUklBSW5wdXRQcm9wcywgQVJJQUlucHV0UHJvcHNNYXAgfSBmcm9tICcuL3R5cGVzJztcblxuY29uc3QgU1VGSVggPSAnLWRlc2MnO1xuXG5jb25zdCByZW1vdmVGYWxzeVByb3BlcnRpZXMgPSAocHJvcHM6IEFSSUFJbnB1dFByb3BzTWFwKTogQVJJQUlucHV0UHJvcHMgPT4ge1xuICAgIHJldHVybiBPYmplY3Qua2V5cyhwcm9wcykucmVkdWNlKChhY2MsIGtleSkgPT4ge1xuICAgICAgICBpZiAocHJvcHNba2V5XSkge1xuICAgICAgICAgICAgYWNjW2tleV0gPSBwcm9wc1trZXldO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBhY2M7XG4gICAgfSwge30pO1xufTtcblxuZXhwb3J0IGNvbnN0IG1ha2VEZXNjSWQgPSAoaWQ6IHN0cmluZyk6IHN0cmluZyA9PiBgJHtpZH0ke1NVRklYfWA7XG5cbmV4cG9ydCBjb25zdCBnZXRBcmlhUHJvcHMgPSAoe1xuICAgICdhcmlhLWRlc2NyaWJlZGJ5JzogYXJpYURlc2NyaWJlZEJ5LFxuICAgICdhcmlhLWRpc2FibGVkJzogYXJpYURpc2FibGVkLFxuICAgICdhcmlhLWludmFsaWQnOiBhcmlhSW52YWxpZCxcbiAgICAnYXJpYS1yZXF1aXJlZCc6IGFyaWFSZXF1aXJlZCxcbiAgIC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UFHO0FBRTNELE1BQU0sWUFBWSxHQUFHLENBQUMsRUFDekIsa0JBQWtCLEVBQUUsZUFBZSxFQUNuQyxlQUFlLEVBQUUsWUFBWSxFQUM3QixjQUFjLEVBQUUsV0FBVyxFQUMzQixlQUFlLEVBQUUsWUFBWSxFQUM3QixRQUFRLEVBQ1IsUUFBUSxFQUNSLFFBQVEsR0FDTyxLQUFvQjtBQUNuQyxJQUFBLE1BQU0sS0FBSyxHQUFHO1FBQ1Ysa0JBQWtCLEVBQUUsZUFBZSxJQUFJLEVBQUU7QUFDekMsUUFBQSxlQUFlLEVBQUUsQ0FBQyxDQUFDLFlBQVksSUFBSSxDQUFDLENBQUMsUUFBUTtBQUM3QyxRQUFBLGNBQWMsRUFBRSxDQUFDLENBQUMsV0FBVyxJQUFJLENBQUMsQ0FBQyxRQUFRO0FBQzNDLFFBQUEsZUFBZSxFQUFFLENBQUMsQ0FBQyxZQUFZLElBQUksQ0FBQyxDQUFDLFFBQVE7S0FDaEQsQ0FBQztBQUVGLElBQUEsT0FBTyxxQkFBcUIsQ0FBQyxLQUFLLENBQUMsQ0FBQztBQUN4Qzs7OzsifQ== | ||
export { | ||
getAriaProps, | ||
makeDescId | ||
}; |
export { getAriaProps } from './aria/utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,4 @@ | ||
export { getAriaProps } from './aria/utils.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= | ||
import { getAriaProps } from "./aria/utils.js"; | ||
export { | ||
getAriaProps | ||
}; |
export declare const flatten: <T>(arr: (T | T[])[]) => T[]; | ||
//# sourceMappingURL=flatten.d.ts.map |
const flatten = (arr) => { | ||
return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatten(val) : val), []); | ||
return arr.reduce( | ||
(acc, val) => acc.concat(Array.isArray(val) ? flatten(val) : val), | ||
[] | ||
); | ||
}; | ||
export { flatten }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmxhdHRlbi5qcyIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FycmF5L2ZsYXR0ZW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IGZsYXR0ZW4gPSA8VD4oYXJyOiBBcnJheTxUIHwgVFtdPik6IFRbXSA9PiB7XG4gICAgcmV0dXJuIGFyci5yZWR1Y2UoXG4gICAgICAgIChhY2M6IFRbXSwgdmFsOiBUIHwgVFtdKSA9PiBhY2MuY29uY2F0KEFycmF5LmlzQXJyYXkodmFsKSA/IGZsYXR0ZW4odmFsKSA6IHZhbCksXG4gICAgICAgIFtdIGFzIFRbXSxcbiAgICApO1xufTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYSxNQUFBLE9BQU8sR0FBRyxDQUFJLEdBQW1CLEtBQVM7QUFDbkQsSUFBQSxPQUFPLEdBQUcsQ0FBQyxNQUFNLENBQ2IsQ0FBQyxHQUFRLEVBQUUsR0FBWSxLQUFLLEdBQUcsQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsR0FBRyxDQUFDLEVBQy9FLEVBQVMsQ0FDWixDQUFDO0FBQ047Ozs7In0= | ||
export { | ||
flatten | ||
}; |
@@ -1,4 +0,4 @@ | ||
import type { ColorSchemeName } from '@preply/ds-core'; | ||
import type { CSSModule } from '../../css-module/types'; | ||
import type { ColorSchemeInterface } from '../types'; | ||
import { ColorSchemeName } from '@preply/ds-core'; | ||
import { CSSModule } from '../../css-module/types'; | ||
import { ColorSchemeInterface } from '../types'; | ||
export declare class ColorScheme implements ColorSchemeInterface { | ||
@@ -5,0 +5,0 @@ static PREFIX: string; |
@@ -1,34 +0,33 @@ | ||
import { moduleClassName } from '../../css-module/classNames.js'; | ||
class ColorScheme { | ||
constructor(styles, name, extend) { | ||
this.styles = styles; | ||
this.name = name; | ||
this.extend = extend; | ||
} | ||
getClassName(options) { | ||
const extendedClasses = this.extend || []; | ||
const backgroundClass = (options === null || options === void 0 ? void 0 : options.withBackground) ? ColorScheme.BACKGROUND_CLASS_NAME : ''; | ||
const classNames = [...extendedClasses, this.name, backgroundClass]; | ||
return classNames | ||
.filter(className => !!className) | ||
.map(className => moduleClassName(this.styles, `${ColorScheme.PREFIX}scheme--${className}`)) | ||
.join(' '); | ||
} | ||
/** | ||
* all color schemes share a single style file (global scheme class names) | ||
* actual scheme tokens are implemented in each theme's stylesheet | ||
*/ | ||
getStyles() { | ||
return [this.styles]; | ||
} | ||
getNames() { | ||
const extendedNames = this.extend || []; | ||
return [this.name, ...extendedNames]; | ||
} | ||
} | ||
ColorScheme.PREFIX = 'ds-'; | ||
ColorScheme.BACKGROUND_CLASS_NAME = '--bg'; | ||
export { ColorScheme }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29sb3JTY2hlbWUuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb2xvci1zY2hlbWUvY2xhc3Nlcy9Db2xvclNjaGVtZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IENvbG9yU2NoZW1lTmFtZSB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZSc7XG5cbmltcG9ydCB7IG1vZHVsZUNsYXNzTmFtZSB9IGZyb20gJy4uLy4uL2Nzcy1tb2R1bGUnO1xuaW1wb3J0IHR5cGUgeyBDU1NNb2R1bGUgfSBmcm9tICcuLi8uLi9jc3MtbW9kdWxlL3R5cGVzJztcbmltcG9ydCB0eXBlIHsgQ29sb3JTY2hlbWVJbnRlcmZhY2UgfSB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||
const _ColorScheme = class _ColorScheme { | ||
constructor(styles, name, extend) { | ||
this.styles = styles; | ||
this.name = name; | ||
this.extend = extend; | ||
} | ||
getClassName(options) { | ||
const extendedClasses = this.extend || []; | ||
const backgroundClass = (options == null ? void 0 : options.withBackground) ? _ColorScheme.BACKGROUND_CLASS_NAME : ""; | ||
const classNames = [...extendedClasses, this.name, backgroundClass]; | ||
return classNames.filter((className) => !!className).map( | ||
(className) => moduleClassName(this.styles, `${_ColorScheme.PREFIX}scheme--${className}`) | ||
).join(" "); | ||
} | ||
/** | ||
* all color schemes share a single style file (global scheme class names) | ||
* actual scheme tokens are implemented in each theme's stylesheet | ||
*/ | ||
getStyles() { | ||
return [this.styles]; | ||
} | ||
getNames() { | ||
const extendedNames = this.extend || []; | ||
return [this.name, ...extendedNames]; | ||
} | ||
}; | ||
_ColorScheme.PREFIX = "ds-"; | ||
_ColorScheme.BACKGROUND_CLASS_NAME = "--bg"; | ||
let ColorScheme = _ColorScheme; | ||
export { | ||
ColorScheme | ||
}; |
import { ColorScheme } from './classes/ColorScheme'; | ||
export declare const colorSchemes: ColorScheme[]; | ||
//# sourceMappingURL=colorSchemes.d.ts.map |
@@ -1,12 +0,13 @@ | ||
import { colorSchemeConfig } from '@preply/ds-core'; | ||
import { ColorScheme } from './classes/ColorScheme.js'; | ||
import styles from './styles/index.module.less.js'; | ||
Object.keys(colorSchemeConfig).forEach(scheme => { | ||
styles[`ds-scheme--${scheme}`] = `ds-scheme--${scheme}`; | ||
styles[`ds-scheme----bg`] = `ds-scheme----bg`; | ||
import { colorSchemeConfig } from "@preply/ds-core"; | ||
import { ColorScheme } from "./classes/ColorScheme.js"; | ||
import '../assets/colorSchemes.css';const styles = {}; | ||
Object.keys(colorSchemeConfig).forEach((scheme) => { | ||
styles[`ds-scheme--${scheme}`] = `ds-scheme--${scheme}`; | ||
styles[`ds-scheme----bg`] = `ds-scheme----bg`; | ||
}); | ||
const colorSchemes = Object.entries(colorSchemeConfig).map(([name, value]) => new ColorScheme(styles, name, value === null || value === void 0 ? void 0 : value.extend)); | ||
export { colorSchemes }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sb3JTY2hlbWVzLmpzIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29sb3Itc2NoZW1lL2NvbG9yU2NoZW1lcy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IENvbG9yU2NoZW1lTmFtZSB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZSc7XG5pbXBvcnQgeyBjb2xvclNjaGVtZUNvbmZpZyB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZSc7XG5cbmltcG9ydCB7IENvbG9yU2NoZW1lIH0gZnJvbSAnLi9jbGFzc2VzL0NvbG9yU2NoZW1lJztcbmltcG9ydCBzdHlsZXMgZnJvbSAnLi9zdHlsZXMvaW5kZXgubW9kdWxlLmxlc3MnO1xuXG5PYmplY3Qua2V5cyhjb2xvclNjaGVtZUNvbmZpZykuZm9yRWFjaChzY2hlbWUgPT4ge1xuICAgIHN0eWxlc1tgZHMtc2NoZW1lLS0ke3NjaGVtZX1gXSA9IGBkcy1zY2hlbWUtLSR7c2NoZW1lfWA7XG4gICAgc3R5bGVzW2Bkcy1zY2hlbWUtLS0tYmdgXSA9IGBkcy1zY2hlbWUtLS0tYmdgO1xufSk7XG5cbmV4cG9ydCBjb25zdCBjb2xvclNjaGVtZXMgPSBPYmplY3QuZW50cmllcyhjb2xvclNjaGVtZUNvbmZpZykubWFwKFxuICAgIChbbmFtZSwgdmFsdWVdKSA9PiBuZXcgQ29sb3JTY2hlbWUoc3R5bGVzLCBuYW1lIGFzIENvbG9yU2NoZW1lTmFtZSwgdmFsdWU/LmV4dGVuZCksXG4pO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFNQSxNQUFNLENBQUMsSUFBSSxDQUFDLGlCQUFpQixDQUFDLENBQUMsT0FBTyxDQUFDLE1BQU0sSUFBRztJQUM1QyxNQUFNLENBQUMsY0FBYyxNQUFNLENBQUEsQ0FBRSxDQUFDLEdBQUcsQ0FBQSxXQUFBLEVBQWMsTUFBTSxDQUFBLENBQUUsQ0FBQztBQUN4RCxJQUFBLE1BQU0sQ0FBQyxDQUFBLGVBQUEsQ0FBaUIsQ0FBQyxHQUFHLGlCQUFpQixDQUFDO0FBQ2xELENBQUMsQ0FBQyxDQUFDO0FBRVUsTUFBQSxZQUFZLEdBQUcsTUFBTSxDQUFDLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDLEdBQUcsQ0FDN0QsQ0FBQyxDQUFDLElBQUksRUFBRSxLQUFLLENBQUMsS0FBSyxJQUFJLFdBQVcsQ0FBQyxNQUFNLEVBQUUsSUFBdUIsRUFBRSxLQUFLLEtBQUEsSUFBQSxJQUFMLEtBQUssS0FBTCxLQUFBLENBQUEsR0FBQSxLQUFBLENBQUEsR0FBQSxLQUFLLENBQUUsTUFBTSxDQUFDOzs7OyJ9 | ||
const colorSchemes = Object.entries(colorSchemeConfig).map( | ||
([name, value]) => new ColorScheme(styles, name, value == null ? void 0 : value.extend) | ||
); | ||
export { | ||
colorSchemes | ||
}; |
@@ -0,0 +0,0 @@ import { ColorSchemeName } from '@preply/ds-core'; |
@@ -1,28 +0,26 @@ | ||
'use client'; | ||
import { COLOR_SCHEME_DEFAULT } from '@preply/ds-core'; | ||
import React from 'react'; | ||
import { useThemes } from '../../theme/hooks/useThemes.js'; | ||
import { useColorScheme } from '../hooks/useColorScheme.js'; | ||
import { ColorSchemeProvider } from '../providers/ColorSchemeProvider.js'; | ||
import { useTheme } from '../../theme/hooks/useTheme.js'; | ||
"use client"; | ||
import { jsx } from "react/jsx-runtime"; | ||
import { COLOR_SCHEME_DEFAULT } from "@preply/ds-core"; | ||
import { useThemes } from "../../theme/hooks/useThemes.js"; | ||
import { useColorScheme } from "../hooks/useColorScheme.js"; | ||
import { ColorSchemeProvider } from "../providers/ColorSchemeProvider.js"; | ||
function withColorScheme(Component) { | ||
const Wrapper = ({ colorScheme: colorSchemeName = COLOR_SCHEME_DEFAULT, ...props }) => { | ||
const { findColorScheme } = useThemes(); | ||
const { theme } = useTheme(); | ||
const { colorScheme: currentColorScheme } = useColorScheme(); | ||
const newColorScheme = colorSchemeName && findColorScheme(colorSchemeName); | ||
if (newColorScheme && newColorScheme !== currentColorScheme) { | ||
const className = newColorScheme.getClassName({ withBackground: true }); | ||
const classNames = `${className} ${theme.getClassName()}`; | ||
return (React.createElement(ColorSchemeProvider, { colorScheme: colorSchemeName }, | ||
React.createElement(Component, { colorSchemeClassName: classNames, ...props }))); | ||
} | ||
return React.createElement(Component, { ...props }); | ||
}; | ||
Wrapper.displayName = `withColorScheme(${Component.displayName})`; | ||
return Wrapper; | ||
const Wrapper = ({ | ||
colorScheme: colorSchemeName = COLOR_SCHEME_DEFAULT, | ||
...props | ||
}) => { | ||
const { findColorScheme } = useThemes(); | ||
const { colorScheme: currentColorScheme } = useColorScheme(); | ||
const newColorScheme = colorSchemeName && findColorScheme(colorSchemeName); | ||
if (newColorScheme && newColorScheme !== currentColorScheme) { | ||
const className = newColorScheme.getClassName({ withBackground: true }); | ||
return /* @__PURE__ */ jsx(ColorSchemeProvider, { colorScheme: colorSchemeName, children: /* @__PURE__ */ jsx(Component, { colorSchemeClassName: className, ...props }) }); | ||
} | ||
return /* @__PURE__ */ jsx(Component, { ...props }); | ||
}; | ||
Wrapper.displayName = `withColorScheme(${Component.displayName})`; | ||
return Wrapper; | ||
} | ||
export { withColorScheme }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2l0aENvbG9yU2NoZW1lLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29sb3Itc2NoZW1lL2hvY3Mvd2l0aENvbG9yU2NoZW1lLnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIGNsaWVudCc7XG5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0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBcUMsR0FBSSxDQUFDLENBQUE7QUFDckUsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFDLENBQUMsQ0FBQTtJQUVGLENBQU8sQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQyxDQUFXLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUcsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQW1CLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQVMsQ0FBQyxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQVcsR0FBRyxDQUFDLENBQUE7QUFDbEUsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFPLE9BQU8sQ0FBQyxDQUFBO0FBQ25CLENBQUE7OyJ9 | ||
export { | ||
withColorScheme | ||
}; |
import { ColorSchemeContextState } from '../providers/ColorSchemeProvider'; | ||
export declare const useColorScheme: () => ColorSchemeContextState; | ||
//# sourceMappingURL=useColorScheme.d.ts.map |
@@ -1,16 +0,12 @@ | ||
import { useContext } from 'react'; | ||
import { useStyleExtract } from '../../ssr/hooks/useStyleExtract.js'; | ||
import { ColorSchemeContext } from '../providers/ColorSchemeProvider.js'; | ||
import { useContext } from "react"; | ||
import { ColorSchemeContext } from "../providers/ColorSchemeProvider.js"; | ||
const useColorScheme = () => { | ||
const { colorScheme } = useContext(ColorSchemeContext); | ||
if (!colorScheme) { | ||
throw new Error('useColorScheme() must be used within a ColorSchemeProvider'); | ||
} | ||
const styles = colorScheme.getStyles(); | ||
useStyleExtract(styles); | ||
return { colorScheme }; | ||
const { colorScheme } = useContext(ColorSchemeContext); | ||
if (!colorScheme) { | ||
throw new Error("useColorScheme() must be used within a ColorSchemeProvider"); | ||
} | ||
return { colorScheme }; | ||
}; | ||
export { useColorScheme }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlQ29sb3JTY2hlbWUuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb2xvci1zY2hlbWUvaG9va3MvdXNlQ29sb3JTY2hlbWUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdXNlQ29udGV4dCB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHsgdXNlU3R5bGVFeHRyYWN0IH0gZnJvbSAnLi4vLi4vc3NyL2hvb2tzL3VzZVN0eWxlRXh0cmFjdCc7XG5pbXBvcnQgeyBDb2xvclNjaGVtZUNvbnRleHQsIENvbG9yU2NoZW1lQ29udGV4dFN0YXRlIH0gZnJvbSAnLi4vcHJvdmlkZXJzL0NvbG9yU2NoZW1lUHJvdmlkZXInO1xuXG5leHBvcnQgY29uc3QgdXNlQ29sb3JTY2hlbWUgPSAoKTogQ29sb3JTY2hlbWVDb250ZXh0U3RhdGUgPT4ge1xuICAgIGNvbnN0IHsgY29sb3JTY2hlbWUgfSA9IHVzZUNvbnRleHQoQ29sb3JTY2hlbWVDb250ZXh0KTtcbiAgICBpZiAoIWNvbG9yU2NoZW1lKSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcigndXNlQ29sb3JTY2hlbWUoKSBtdXN0IGJlIHVzZWQgd2l0aGluIGEgQ29sb3JTY2hlbWVQcm92aWRlcicpO1xuICAgIH1cblxuICAgIGNvbnN0IHN0eWxlcyA9IGNvbG9yU2NoZW1lLmdldFN0eWxlcygpO1xuICAgIHVzZVN0eWxlRXh0cmFjdChzdHlsZXMpO1xuXG4gICAgcmV0dXJuIHsgY29sb3JTY2hlbWUgfTtcbn07XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUtPLE1BQU0sY0FBYyxHQUFHLE1BQThCO0lBQ3hELE1BQU0sRUFBRSxXQUFXLEVBQUUsR0FBRyxVQUFVLENBQUMsa0JBQWtCLENBQUMsQ0FBQztJQUN2RCxJQUFJLENBQUMsV0FBVyxFQUFFO0FBQ2QsUUFBQSxNQUFNLElBQUksS0FBSyxDQUFDLDREQUE0RCxDQUFDLENBQUM7QUFDakYsS0FBQTtBQUVELElBQUEsTUFBTSxNQUFNLEdBQUcsV0FBVyxDQUFDLFNBQVMsRUFBRSxDQUFDO0lBQ3ZDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUV4QixPQUFPLEVBQUUsV0FBVyxFQUFFLENBQUM7QUFDM0I7Ozs7In0= | ||
export { | ||
useColorScheme | ||
}; |
@@ -5,3 +5,3 @@ export type { ColorSchemeInterface } from './types'; | ||
export type { ColorSchemeProviderProps } from './providers/ColorSchemeProvider'; | ||
export { ColorSchemeProvider } from './providers/ColorSchemeProvider'; | ||
export { ColorSchemeProvider, ColorSchemeContext } from './providers/ColorSchemeProvider'; | ||
export { useColorScheme } from './hooks/useColorScheme'; | ||
@@ -8,0 +8,0 @@ export type { ColorSchemeProps, WithColorSchemeProps } from './hocs/withColorScheme'; |
@@ -1,6 +0,13 @@ | ||
export { colorSchemes } from './colorSchemes.js'; | ||
export { ColorScheme } from './classes/ColorScheme.js'; | ||
export { ColorSchemeProvider } from './providers/ColorSchemeProvider.js'; | ||
export { useColorScheme } from './hooks/useColorScheme.js'; | ||
export { withColorScheme } from './hocs/withColorScheme.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OyJ9 | ||
import { colorSchemes } from "./colorSchemes.js"; | ||
import { ColorScheme } from "./classes/ColorScheme.js"; | ||
import { ColorSchemeContext, ColorSchemeProvider } from "./providers/ColorSchemeProvider.js"; | ||
import { useColorScheme } from "./hooks/useColorScheme.js"; | ||
import { withColorScheme } from "./hocs/withColorScheme.js"; | ||
export { | ||
ColorScheme, | ||
ColorSchemeContext, | ||
ColorSchemeProvider, | ||
colorSchemes, | ||
useColorScheme, | ||
withColorScheme | ||
}; |
@@ -1,4 +0,4 @@ | ||
import type { ColorSchemeName } from '@preply/ds-core'; | ||
import React, { ReactElement, ReactNode } from 'react'; | ||
import type { ColorSchemeInterface } from '../types'; | ||
import { ColorSchemeName } from '@preply/ds-core'; | ||
import { default as React, ReactElement, ReactNode } from 'react'; | ||
import { ColorSchemeInterface } from '../types'; | ||
export declare const SCHEME_DEFAULT = "base"; | ||
@@ -5,0 +5,0 @@ export interface ColorSchemeProviderProps { |
@@ -1,14 +0,21 @@ | ||
'use client'; | ||
import React, { createContext } from 'react'; | ||
import { useThemes } from '../../theme/hooks/useThemes.js'; | ||
const SCHEME_DEFAULT = 'base'; | ||
const ColorSchemeContext = createContext({}); | ||
const ColorSchemeProvider = ({ colorScheme: colorSchemeName, children, }) => { | ||
const { findColorScheme } = useThemes(); | ||
const colorScheme = findColorScheme(colorSchemeName); | ||
return (React.createElement(ColorSchemeContext.Provider, { value: { colorScheme } }, children)); | ||
"use client"; | ||
import { jsx } from "react/jsx-runtime"; | ||
import { createContext } from "react"; | ||
import { useThemes } from "../../theme/hooks/useThemes.js"; | ||
const SCHEME_DEFAULT = "base"; | ||
const ColorSchemeContext = createContext( | ||
{} | ||
); | ||
const ColorSchemeProvider = ({ | ||
colorScheme: colorSchemeName, | ||
children | ||
}) => { | ||
const { findColorScheme } = useThemes(); | ||
const colorScheme = findColorScheme(colorSchemeName); | ||
return /* @__PURE__ */ jsx(ColorSchemeContext.Provider, { value: { colorScheme }, children }); | ||
}; | ||
export { ColorSchemeContext, ColorSchemeProvider, SCHEME_DEFAULT }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29sb3JTY2hlbWVQcm92aWRlci5qcyIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbG9yLXNjaGVtZS9wcm92aWRlcnMvQ29sb3JTY2hlbWVQcm92aWRlci50c3giXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBjbGllbnQnO1xuXG5pbXBvcnQgdHlwZSB7IENvbG9yU2NoZW1lTmFtZSB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZSc7XG5pbXBvcnQgUmVhY3QsIHsgUmVhY3RFbGVtZW50LCBSZWFjdE5vZGUsIGNyZWF0ZUNvbnRleHQgfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB7IHVzZVRoZW1lcyB9IGZyb20gJy4uLy4uL3RoZW1lL2hvb2tzL3VzZVRoZW1lcyc7XG5pbXBvcnQgdHlwZSB7IENvbG9yU2NoZW1lSW50ZXJmYWNlIH0gZnJvbSAnLi4vdHlwZXMnO1xuXG5leHBvcnQgY29uc3QgU0NIRU1FX0RFRkFVTFQgPSAnYmFzZSc7XG5cbmV4cG9ydCBpbnRlcmZhY2UgQ29sb3JTY2hlbWVQcm92aWRlclByb3BzIHtcbiAgICBjb2xvclNjaGVtZTogQ29sb3JTY2hlbWVOYW1lO1xuICAgIGNoaWxkcmVuPzogUmVhY3ROb2RlO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIENvbG9yU2NoZW1lQ29udGV4dFN0YXRlIHtcbiAgICBjb2xvclNjaGVtZTogQ29sb3JTY2hlbWVJbnRlcmZhY2U7XG59XG5cbmV4cG9ydCBjb25zdCBDb2xvclNjaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0PENvbG9yU2NoZW1lQ29udGV4dFN0YXRlPihcbiAgICB7fSBhcyBDb2xvclNjaG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LENBQUEsQ0FBQSxDQUFlLENBQUMsQ0FBQyxDQUFBO0FBRXJELENBQUEsQ0FBQSxDQUFBLENBQUEsUUFDSSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxhQUFBLENBQUMsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQWtCLENBQUMsQ0FBUSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQyxFQUFBLENBQUssQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUUsRUFBRSxDQUFXLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFFLEVBQUEsQ0FDOUMsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQVEsQ0FDaUIsQ0FDaEMsQ0FBQSxDQUFBO0FBQ04sQ0FBQSxDQUFBOzsifQ== | ||
export { | ||
ColorSchemeContext, | ||
ColorSchemeProvider, | ||
SCHEME_DEFAULT | ||
}; |
@@ -0,0 +0,0 @@ import { ColorSchemeName } from '@preply/ds-core'; |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
@@ -0,0 +0,0 @@ import { Responsive, ShortHand } from '@preply/ds-core'; |
@@ -1,79 +0,79 @@ | ||
import { normalizeShorthand } from '@preply/ds-core'; | ||
import { flatten } from '../array/flatten.js'; | ||
const filterEmptyClassNames = (className) => className !== undefined; | ||
import { normalizeShorthand } from "@preply/ds-core"; | ||
import { flatten } from "../array/flatten.js"; | ||
const filterEmptyClassNames = (className) => className !== void 0; | ||
const globalClassNames = (globals = []) => globals.filter(filterEmptyClassNames); | ||
const moduleClassName = (cssModule, name) => { | ||
if (!cssModule[name]) { | ||
console.log(new Error(`Unknow classname ${name}`)); | ||
return ''; | ||
} | ||
return cssModule[name]; | ||
if (!cssModule[name]) { | ||
console.log(new Error(`Unknow classname ${name}`)); | ||
return ""; | ||
} | ||
return cssModule[name]; | ||
}; | ||
const moduleLocals = (cssModule, namespace, locals = []) => flatten(locals) | ||
.filter(filterEmptyClassNames) | ||
.map(classname => `${namespace}--${classname}`) | ||
.map(classname => moduleClassName(cssModule, classname)); | ||
const moduleLocals = (cssModule, namespace, locals = []) => flatten(locals).filter(filterEmptyClassNames).map((classname) => `${namespace}--${classname}`).map((classname) => moduleClassName(cssModule, classname)); | ||
const moduleClassNames = (cssModule, namespace, locals = []) => [ | ||
moduleClassName(cssModule, namespace), | ||
...moduleLocals(cssModule, namespace, locals), | ||
moduleClassName(cssModule, namespace), | ||
...moduleLocals(cssModule, namespace, locals) | ||
]; | ||
const stringClassNames = (prefix, value) => { | ||
if (typeof value === 'object') { | ||
return Object.entries(value).map(([breakpoint, option]) => { | ||
const breakpointPrefix = breakpoint === '_' ? '' : `${breakpoint}--`; | ||
const classname = stringClassNames(prefix, option); | ||
return `${breakpointPrefix}${classname}`; | ||
}); | ||
} | ||
if (value) { | ||
return [`${prefix}-${value}`]; | ||
} | ||
return []; | ||
if (typeof value === "object") { | ||
return Object.entries(value).map(([breakpoint, option]) => { | ||
const breakpointPrefix = breakpoint === "_" ? "" : `${breakpoint}--`; | ||
const classname = stringClassNames(prefix, option); | ||
return `${breakpointPrefix}${classname}`; | ||
}); | ||
} | ||
if (value) { | ||
return [`${prefix}-${value}`]; | ||
} | ||
return []; | ||
}; | ||
const longhandClassNames = (prefix, value) => { | ||
if (typeof value === 'object' && !Array.isArray(value)) { | ||
return Object.entries(value).flatMap(([breakpoint, option]) => { | ||
const breakpointPrefix = breakpoint === '_' ? '' : `${breakpoint}--`; | ||
const classnames = longhandClassNames(prefix, option); | ||
return classnames.map(c => `${breakpointPrefix}${c}`); | ||
}); | ||
} | ||
if (value) { | ||
const [top, right, bottom, left] = normalizeShorthand(value); | ||
return [ | ||
`${prefix}-top-${top}`, | ||
`${prefix}-right-${right}`, | ||
`${prefix}-bottom-${bottom}`, | ||
`${prefix}-left-${left}`, | ||
]; | ||
} | ||
return []; | ||
if (typeof value === "object" && !Array.isArray(value)) { | ||
return Object.entries(value).flatMap(([breakpoint, option]) => { | ||
const breakpointPrefix = breakpoint === "_" ? "" : `${breakpoint}--`; | ||
const classnames = longhandClassNames(prefix, option); | ||
return classnames.map((c) => `${breakpointPrefix}${c}`); | ||
}); | ||
} | ||
if (value) { | ||
const [top, right, bottom, left] = normalizeShorthand(value); | ||
return [ | ||
`${prefix}-top-${top}`, | ||
`${prefix}-right-${right}`, | ||
`${prefix}-bottom-${bottom}`, | ||
`${prefix}-left-${left}` | ||
]; | ||
} | ||
return []; | ||
}; | ||
const booleanClassNames = (ifTrue, ifFalse, value) => { | ||
if (typeof value === 'object') { | ||
// The following errors could be removed if the function' params are replaced with a discriminated union | ||
// see https://www.typescriptlang.org/play?#code/C4TwDgpgBACghgJzgWwM4EEoF4oG0CWAZgCoICuEAXFKsAvgHYDmANAFBSdREBicANqio06jVhy4A3ARWoAjAPYL+EOAwC6bNqEixEKVACFseIqVkj6zKAB8oZBgBMIhRhEfsu3Qn0HDaVky29k4ubh4SnNL8Fg7OrgzummyEDgDGwPgKDFCKyqoMAML8cKioAHIoEKgAFAB0DWD6aNTwSGiYdm0GhgCUUADeWgC+WgD0Y1CFCggIEBn2qHBM1Wx5KmrFpRVVtXFhiR4h8eEsxwfuvWtKG0UlZZXI1TUA5IRKL2f7Ce5foT+OK7rApbB67V7vBSfKAvOSIaHfcJAm4g+47J57f6nGFwhAIrGHZH5TZox7PN4fM6w+FnOgUK5sCZQACSDDSMzmCzISxWqEZkwAAsBUABaCAAD0gGTFsxm12Jd22ZNqFKhfxOh1p5AgVyZQtFEqlwBlCDlwJJSvBiM1OJpUDpOv5UH1Ysl82NEFlCHlt1B6Oe1t+5wBWvpQA | ||
if (ifTrue === undefined) { | ||
throw new Error('"ifTrue" param is mandatory in responsive props'); | ||
} | ||
if (ifFalse === undefined) { | ||
throw new Error('"ifFalse" param is mandatory in responsive props'); | ||
} | ||
return Object.entries(value).map(([breakpoint, option]) => { | ||
const breakpointPrefix = breakpoint === '_' ? '' : `${breakpoint}--`; | ||
const classname = booleanClassNames(ifTrue, ifFalse, option); | ||
return `${breakpointPrefix}${classname}`; | ||
}); | ||
if (typeof value === "object") { | ||
if (ifTrue === void 0) { | ||
throw new Error('"ifTrue" param is mandatory in responsive props'); | ||
} | ||
if (value && ifTrue !== undefined) { | ||
return [`${ifTrue}`]; | ||
if (ifFalse === void 0) { | ||
throw new Error('"ifFalse" param is mandatory in responsive props'); | ||
} | ||
if (value === false && ifFalse !== undefined) { | ||
return [`${ifFalse}`]; | ||
} | ||
return []; | ||
return Object.entries(value).map(([breakpoint, option]) => { | ||
const breakpointPrefix = breakpoint === "_" ? "" : `${breakpoint}--`; | ||
const classname = booleanClassNames(ifTrue, ifFalse, option); | ||
return `${breakpointPrefix}${classname}`; | ||
}); | ||
} | ||
if (value && ifTrue !== void 0) { | ||
return [`${ifTrue}`]; | ||
} | ||
if (value === false && ifFalse !== void 0) { | ||
return [`${ifFalse}`]; | ||
} | ||
return []; | ||
}; | ||
export { booleanClassNames, globalClassNames, longhandClassNames, moduleClassName, moduleClassNames, moduleLocals, stringClassNames }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3NOYW1lcy5qcyIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Nzcy1tb2R1bGUvY2xhc3NOYW1lcy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBSZXNwb25zaXZlLCBTaG9ydE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QztBQUM3QyxTQUFDLENBQUMsQ0FBQztBQUNOLEtBQUE7QUFDRCxJQUFBLElBQUksS0FBSyxJQUFJLE1BQU0sS0FBSyxTQUFTLEVBQUU7QUFDL0IsUUFBQSxPQUFPLENBQUMsQ0FBQSxFQUFHLE1BQU0sQ0FBQSxDQUFFLENBQUMsQ0FBQztBQUN4QixLQUFBO0FBQ0QsSUFBQSxJQUFJLEtBQUssS0FBSyxLQUFLLElBQUksT0FBTyxLQUFLLFNBQVMsRUFBRTtBQUMxQyxRQUFBLE9BQU8sQ0FBQyxDQUFBLEVBQUcsT0FBTyxDQUFBLENBQUUsQ0FBQyxDQUFDO0FBQ3pCLEtBQUE7QUFDRCxJQUFBLE9BQU8sRUFBRSxDQUFDO0FBQ2Q7Ozs7In0= | ||
export { | ||
booleanClassNames, | ||
globalClassNames, | ||
longhandClassNames, | ||
moduleClassName, | ||
moduleClassNames, | ||
moduleLocals, | ||
stringClassNames | ||
}; |
export * from './classNames'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,10 @@ | ||
export { booleanClassNames, globalClassNames, longhandClassNames, moduleClassName, moduleClassNames, moduleLocals, stringClassNames } from './classNames.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= | ||
import { booleanClassNames, globalClassNames, longhandClassNames, moduleClassName, moduleClassNames, moduleLocals, stringClassNames } from "./classNames.js"; | ||
export { | ||
booleanClassNames, | ||
globalClassNames, | ||
longhandClassNames, | ||
moduleClassName, | ||
moduleClassNames, | ||
moduleLocals, | ||
stringClassNames | ||
}; |
@@ -5,5 +5,3 @@ export type CSSModuleId = string; | ||
[key: string]: string; | ||
__id: CSSModuleId; | ||
__css: CSSModuleContent; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
@@ -0,0 +0,0 @@ export declare const REL_VALUES_EXTERNAL_URL: string[]; |
@@ -1,6 +0,8 @@ | ||
const REL_VALUES_EXTERNAL_URL = ['noreferrer', 'noopener']; | ||
const REL_VALUES_NO_FOLLOW = ['nofollow']; | ||
const PROPS_EXTERNAL_TARGET = { target: '_blank' }; | ||
export { PROPS_EXTERNAL_TARGET, REL_VALUES_EXTERNAL_URL, REL_VALUES_NO_FOLLOW }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZG9tL3Byb3BzL2NvbnN0YW50cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgUkVMX1ZBTFVFU19FWFRFUk5BTF9VUkwgPSBbJ25vcmVmZXJyZXInLCAnbm9vcGVuZXInXTtcbmV4cG9ydCBjb25zdCBSRUxfVkFMVUVTX05PX0ZPTExPVyA9IFsnbm9mb2xsb3cnXTtcbmV4cG9ydCBjb25zdCBQUk9QU19FWFRFUk5BTF9UQVJHRVQgPSB7IHRhcmdldDogJ19ibGFuaycgfTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiTUFBYSx1QkFBdUIsR0FBRyxDQUFDLFlBQVksRUFBRSxVQUFVLEVBQUU7QUFDckQsTUFBQSxvQkFBb0IsR0FBRyxDQUFDLFVBQVUsRUFBRTtNQUNwQyxxQkFBcUIsR0FBRyxFQUFFLE1BQU0sRUFBRSxRQUFROzs7OyJ9 | ||
const REL_VALUES_EXTERNAL_URL = ["noreferrer", "noopener"]; | ||
const REL_VALUES_NO_FOLLOW = ["nofollow"]; | ||
const PROPS_EXTERNAL_TARGET = { target: "_blank" }; | ||
export { | ||
PROPS_EXTERNAL_TARGET, | ||
REL_VALUES_EXTERNAL_URL, | ||
REL_VALUES_NO_FOLLOW | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { Dataset } from '@preply/ds-core'; | ||
import type { AnchorProps } from '../../types'; | ||
import { Dataset } from '@preply/ds-core'; | ||
import { AnchorProps } from '../../types'; | ||
export declare const getDatasetProps: (dataset?: Dataset, dsDataset?: { | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,42 +0,39 @@ | ||
import { currentHostname } from '../../location/index.js'; | ||
import { domainOf } from '../../url/index.js'; | ||
import { REL_VALUES_EXTERNAL_URL, REL_VALUES_NO_FOLLOW, PROPS_EXTERNAL_TARGET } from './constants.js'; | ||
import { currentHostname } from "../../location/index.js"; | ||
import { domainOf } from "../../url/index.js"; | ||
import { REL_VALUES_EXTERNAL_URL, REL_VALUES_NO_FOLLOW, PROPS_EXTERNAL_TARGET } from "./constants.js"; | ||
const getDatasetProps = (dataset, dsDataset) => { | ||
var _a; | ||
const receivedDataset = dataset !== null && dataset !== void 0 ? dataset : {}; | ||
const elementDataset = Object.keys(receivedDataset).reduce((acc, key) => { | ||
if (key === 'preply-ds-component') { | ||
console.warn(`The "preply-ds-component" dataset attribute is intended for internal usages only. (${receivedDataset[key]})`); | ||
return acc; | ||
} | ||
// See @preply/visual-coverage-core/src/core/constants | ||
// Originally added for the DS coverage, allows any data- attributes to be passed through | ||
// since it's not really clear that you should them without the data- prefix. | ||
// attributes should be passed without the | ||
const attributeKey = key.startsWith('data-') ? key : `data-${key}`; | ||
acc[attributeKey] = receivedDataset[key]; | ||
return acc; | ||
}, {}); | ||
if (!dsDataset) | ||
return elementDataset; | ||
return { | ||
...elementDataset, | ||
'data-preply-ds-component': (_a = dsDataset.preplyDsComponent) !== null && _a !== void 0 ? _a : '', | ||
}; | ||
var _a; | ||
const receivedDataset = dataset != null ? dataset : {}; | ||
const elementDataset = Object.keys(receivedDataset).reduce((acc, key) => { | ||
if (key === "preply-ds-component") { | ||
console.warn( | ||
`The "preply-ds-component" dataset attribute is intended for internal usages only. (${receivedDataset[key]})` | ||
); | ||
return acc; | ||
} | ||
const attributeKey = key.startsWith("data-") ? key : `data-${key}`; | ||
acc[attributeKey] = receivedDataset[key]; | ||
return acc; | ||
}, {}); | ||
if (!dsDataset) return elementDataset; | ||
return { | ||
...elementDataset, | ||
"data-preply-ds-component": (_a = dsDataset.preplyDsComponent) != null ? _a : "" | ||
}; | ||
}; | ||
const getExternalUrlProps = (hostname, url, opensInNewTab, nofollow) => { | ||
const local = hostname || currentHostname(); | ||
const isAbsolute = /^[a-z]+:/.test(url) || url.startsWith('//'); | ||
const isExternal = isAbsolute && domainOf(url) !== local; | ||
const relValuesNoFollow = isExternal ? REL_VALUES_EXTERNAL_URL : []; | ||
const relValuesExternalUrl = nofollow ? REL_VALUES_NO_FOLLOW : []; | ||
const relValues = [...relValuesNoFollow, ...relValuesExternalUrl].join(' '); | ||
const propsRel = relValues ? { rel: relValues } : {}; | ||
const useExternalTarget = opensInNewTab === undefined ? isExternal : opensInNewTab; | ||
const propsTarget = useExternalTarget ? PROPS_EXTERNAL_TARGET : {}; | ||
return { ...propsRel, ...propsTarget }; | ||
const local = hostname || currentHostname(); | ||
const isAbsolute = /^[a-z]+:/.test(url) || url.startsWith("//"); | ||
const isExternal = isAbsolute && domainOf(url) !== local; | ||
const relValuesNoFollow = isExternal ? REL_VALUES_EXTERNAL_URL : []; | ||
const relValuesExternalUrl = nofollow ? REL_VALUES_NO_FOLLOW : []; | ||
const relValues = [...relValuesNoFollow, ...relValuesExternalUrl].join(" "); | ||
const propsRel = relValues ? { rel: relValues } : {}; | ||
const useExternalTarget = opensInNewTab === void 0 ? isExternal : opensInNewTab; | ||
const propsTarget = useExternalTarget ? PROPS_EXTERNAL_TARGET : {}; | ||
return { ...propsRel, ...propsTarget }; | ||
}; | ||
export { getDatasetProps, getExternalUrlProps }; | ||
//#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sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDNUUsSUFBQSxNQUFNLFFBQVEsR0FBRyxTQUFTLEdBQUcsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLEdBQUcsRUFBRSxDQUFDO0FBRXJELElBQUEsTUFBTSxpQkFBaUIsR0FBRyxhQUFhLEtBQUssU0FBUyxHQUFHLFVBQVUsR0FBRyxhQUFhLENBQUM7SUFDbkYsTUFBTSxXQUFXLEdBQUcsaUJBQWlCLEdBQUcscUJBQXFCLEdBQUcsRUFBRSxDQUFDO0FBRW5FLElBQUEsT0FBTyxFQUFFLEdBQUcsUUFBUSxFQUFFLEdBQUcsV0FBVyxFQUFFLENBQUM7QUFDM0M7Ozs7In0= | ||
export { | ||
getDatasetProps, | ||
getExternalUrlProps | ||
}; |
@@ -0,0 +0,0 @@ import { FocusEventHandlers } from '..'; |
@@ -1,27 +0,31 @@ | ||
import { useMemo } from 'react'; | ||
import { useMemo } from "react"; | ||
const makeEventHandler = (onFocus, captureChildEvents) => { | ||
if (!onFocus) { | ||
return undefined; | ||
if (!onFocus) { | ||
return void 0; | ||
} | ||
return (event) => { | ||
if (!captureChildEvents && event.target !== event.currentTarget) { | ||
return; | ||
} | ||
return (event) => { | ||
if (!captureChildEvents && event.target !== event.currentTarget) { | ||
return; | ||
} | ||
onFocus(event); | ||
onFocus(event); | ||
}; | ||
}; | ||
const useFocusEvents = ({ | ||
disabled, | ||
captureChildEvents, | ||
onFocus, | ||
onBlur | ||
}) => { | ||
return useMemo(() => { | ||
if (disabled) { | ||
return {}; | ||
} | ||
return { | ||
onFocus: makeEventHandler(onFocus, captureChildEvents), | ||
onBlur: makeEventHandler(onBlur, captureChildEvents) | ||
}; | ||
}, [disabled, captureChildEvents, onFocus, onBlur]); | ||
}; | ||
const useFocusEvents = ({ disabled, captureChildEvents, onFocus, onBlur, }) => { | ||
return useMemo(() => { | ||
if (disabled) { | ||
return {}; | ||
} | ||
return { | ||
onFocus: makeEventHandler(onFocus, captureChildEvents), | ||
onBlur: makeEventHandler(onBlur, captureChildEvents), | ||
}; | ||
}, [disabled, captureChildEvents, onFocus, onBlur]); | ||
export { | ||
useFocusEvents | ||
}; | ||
export { useFocusEvents }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlRm9jdXNFdmVudHMuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9ldmVudHMvaG9va3MvdXNlRm9jdXNFdmVudHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgRm9jdXNFdmVudCwgRm9jdXNFdmVudEhhbmRsZXIsIHVzZU1lbW8gfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB7IEZvY3VzRXZlbnRIYW5kbGVycyB9IGZyb20gJy4uJztcblxudHlwZSBGb2N1c09wdGlvbnMgPSBGb2N1c0V2ZW50SGFuZGxlcnMgJiB7XG4gICAgZGlzYWJsZWQ/OiBib29sZWFuO1xuICAgIGNhcHR1cmVDaGlsZEV2ZW50czogYm9vbGVhbjtcbn07XG5cbmNvbnN0IG1ha2VFdmVudEhhbmRsZXIgPSAoXG4gICAgb25Gb2N1czogRm9jdXNFdmVudEhhbmRsZXIgfCB1bmRlZmluZWQsXG4gICAgY2FwdHVyZUNoaWxkRXZlbnRzOiBib29sZWFuLFxuKTogRm9jdXNFdmVudEhhbmRsZXIgfCB1bmRlZmluZWQgPT4ge1xuICAgIGlmICghb25Gb2N1cykge1xuICAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgIH1cbiAgICByZXR1cm4gKGV2ZW50OiBGb2N1c0V2ZW50KSA9PiB7XG4gICAgICAgIGlmICghY2FwdHVyZUNoaWxkRXZlbnRzICYmIGV2ZW50LnRhcmdldCAhPT0gZXZlbnQuY3VycmVudFRhcmdldCkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIG9uRm9jdXMoZXZ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QWMsR0FBRyxDQUFDLEVBQzNCLFFBQVEsRUFDUixrQkFBa0IsRUFDbEIsT0FBTyxFQUNQLE1BQU0sR0FDSyxLQUF3QjtJQUNuQyxPQUFPLE9BQU8sQ0FBQyxNQUFLO0FBQ2hCLFFBQUEsSUFBSSxRQUFRLEVBQUU7QUFDVixZQUFBLE9BQU8sRUFBRSxDQUFDO0FBQ2IsU0FBQTtRQUNELE9BQU87QUFDSCxZQUFBLE9BQU8sRUFBRSxnQkFBZ0IsQ0FBQyxPQUFPLEVBQUUsa0JBQWtCLENBQUM7QUFDdEQsWUFBQSxNQUFNLEVBQUUsZ0JBQWdCLENBQUMsTUFBTSxFQUFFLGtCQUFrQixDQUFDO1NBQ3ZELENBQUM7S0FDTCxFQUFFLENBQUMsUUFBUSxFQUFFLGtCQUFrQixFQUFFLE9BQU8sRUFBRSxNQUFNLENBQUMsQ0FBQyxDQUFDO0FBQ3hEOzs7OyJ9 |
export * from './hooks/useFocusEvents'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,4 @@ | ||
export { useFocusEvents } from './hooks/useFocusEvents.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= | ||
import { useFocusEvents } from "./hooks/useFocusEvents.js"; | ||
export { | ||
useFocusEvents | ||
}; |
@@ -0,0 +0,0 @@ import { FocusEvent } from 'react'; |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
@@ -0,0 +0,0 @@ import { FieldAdditionalTextVariant } from './types'; |
@@ -1,5 +0,6 @@ | ||
const FIELD_TYPE_DEFAULT = 'text'; | ||
const FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT = 'normal'; | ||
export { FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, FIELD_TYPE_DEFAULT }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmllbGQvY29uc3RhbnRzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEZpZWxkQWRkaXRpb25hbFRleHRWYXJpYW50IH0gZnJvbSAnLi90eXBlcyc7XG5cbmV4cG9ydCBjb25zdCBGSUVMRF9UWVBFX0RFRkFVTFQgPSAndGV4dCc7XG5leHBvcnQgY29uc3QgRklFTERfQURESVRJT05BTF9URVhUX1ZBUklBTlRfREVGQVVMVDogRmllbGRBZGRpdGlvbmFsVGV4dFZhcmlhbnQgPSAnbm9ybWFsJztcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFTyxNQUFNLGtCQUFrQixHQUFHLE9BQU87QUFDbEMsTUFBTSxxQ0FBcUMsR0FBK0I7Ozs7In0= | ||
const FIELD_TYPE_DEFAULT = "text"; | ||
const FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT = "normal"; | ||
export { | ||
FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, | ||
FIELD_TYPE_DEFAULT | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { InputNumberProps } from '../../input'; | ||
import type { FieldLayoutProps, NumberFieldProps } from '../types'; | ||
import { InputNumberProps } from '../../input'; | ||
import { FieldLayoutProps, NumberFieldProps } from '../types'; | ||
type UseNumberFieldState = { | ||
@@ -4,0 +4,0 @@ layoutProps: Omit<FieldLayoutProps, 'input' | 'className' | 'inputHandle' | 'button'>; |
@@ -1,67 +0,88 @@ | ||
'use client'; | ||
import { useId, useState, useCallback } from 'react'; | ||
import { makeDescId } from '../../accessibility/aria/utils.js'; | ||
"use client"; | ||
import { useId, useState, useCallback } from "react"; | ||
import { makeDescId } from "../../accessibility/aria/utils.js"; | ||
const useNumberField = (props, preplyDsComponent) => { | ||
const { id, value, label, hideLabel, wrapLabel, preserveSpace, required, requiredLabel, additionalText, disabled, hasError, errorMessage, icon, onFocus, onBlur, onChange, inputDataset, dataset, max, min, ...rest } = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback(ev => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback(ev => { | ||
setIsFocused(false); | ||
onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback(ev => { | ||
setIsChanged(false); | ||
onChange === null || onChange === void 0 ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : undefined; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== 'undefined', | ||
hasError: actualHasError, | ||
icon, | ||
dataset, | ||
preplyDsComponent, | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
dataset: inputDataset, | ||
'aria-describedby': describeId, | ||
max, | ||
min, | ||
...rest, | ||
}, | ||
}; | ||
const { | ||
id, | ||
value, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
preserveSpace, | ||
required, | ||
requiredLabel, | ||
additionalText, | ||
disabled, | ||
hasError, | ||
errorMessage, | ||
icon, | ||
onFocus, | ||
onBlur, | ||
onChange, | ||
inputDataset, | ||
dataset, | ||
max, | ||
min, | ||
...rest | ||
} = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback((ev) => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus == null ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback((ev) => { | ||
setIsFocused(false); | ||
onBlur == null ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback((ev) => { | ||
setIsChanged(false); | ||
onChange == null ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : void 0; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== "undefined", | ||
hasError: actualHasError, | ||
icon, | ||
dataset, | ||
preplyDsComponent | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
dataset: inputDataset, | ||
"aria-describedby": describeId, | ||
max, | ||
min, | ||
...rest | ||
} | ||
}; | ||
}; | ||
export { useNumberField }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlTnVtYmVyRmllbGQuanMiLCJzb3VyY2Vz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QUEsQ0FBQSxDQUFBLENBQUE7QUFDckIsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQWtCLEVBQUUsQ0FBVSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUE7WUFDOUIsQ0FBRyxDQUFBLENBQUEsQ0FBQSxDQUFBO1lBQ0gsQ0FBRyxDQUFBLENBQUEsQ0FBQSxDQUFBO0FBQ0gsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsR0FBRyxDQUFJLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTtBQUNWLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTtLQUNKLENBQUMsQ0FBQTtBQUNOLENBQUEsQ0FBQTs7In0= | ||
export { | ||
useNumberField | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { InputPasswordProps } from '../../input'; | ||
import type { FieldLayoutProps, PasswordFieldProps } from '../types'; | ||
import { InputPasswordProps } from '../../input'; | ||
import { FieldLayoutProps, PasswordFieldProps } from '../types'; | ||
type UsePasswordFieldState = { | ||
@@ -4,0 +4,0 @@ layoutProps: Omit<FieldLayoutProps, 'input' | 'className' | 'inputHandle'>; |
@@ -1,66 +0,86 @@ | ||
'use client'; | ||
import { useId, useState, useCallback } from 'react'; | ||
import { makeDescId } from '../../accessibility/aria/utils.js'; | ||
import { AUTO_COMPLETE_TEXT_DEFAULT } from '../../input/constants.js'; | ||
"use client"; | ||
import { useId, useState, useCallback } from "react"; | ||
import { makeDescId } from "../../accessibility/aria/utils.js"; | ||
import { AUTO_COMPLETE_TEXT_DEFAULT } from "../../input/constants.js"; | ||
import "../../input/options.js"; | ||
const usePasswordField = (props, preplyDsComponent) => { | ||
const { id, value, label, hideLabel, wrapLabel, preserveSpace, required, requiredLabel, additionalText, disabled, hasError, errorMessage, onFocus, onBlur, onChange, autoComplete = AUTO_COMPLETE_TEXT_DEFAULT, inputDataset, dataset, ...rest } = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback(ev => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback(ev => { | ||
setIsFocused(false); | ||
onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback(ev => { | ||
setIsChanged(false); | ||
onChange === null || onChange === void 0 ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : undefined; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== 'undefined', | ||
hasError: actualHasError, | ||
dataset, | ||
preplyDsComponent, | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
autoComplete, | ||
dataset: inputDataset, | ||
'aria-describedby': describeId, | ||
...rest, | ||
}, | ||
}; | ||
const { | ||
id, | ||
value, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
preserveSpace, | ||
required, | ||
requiredLabel, | ||
additionalText, | ||
disabled, | ||
hasError, | ||
errorMessage, | ||
onFocus, | ||
onBlur, | ||
onChange, | ||
autoComplete = AUTO_COMPLETE_TEXT_DEFAULT, | ||
inputDataset, | ||
dataset, | ||
...rest | ||
} = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback((ev) => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus == null ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback((ev) => { | ||
setIsFocused(false); | ||
onBlur == null ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback((ev) => { | ||
setIsChanged(false); | ||
onChange == null ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : void 0; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== "undefined", | ||
hasError: actualHasError, | ||
dataset, | ||
preplyDsComponent | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
autoComplete, | ||
dataset: inputDataset, | ||
"aria-describedby": describeId, | ||
...rest | ||
} | ||
}; | ||
}; | ||
export { usePasswordField }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uI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BLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBTyxFQUFFLENBQVksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTtBQUNyQixDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBa0IsRUFBRSxDQUFVLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTtBQUM5QixDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxHQUFHLENBQUksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0FBQ1YsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0tBQ0osQ0FBQyxDQUFBO0FBQ04sQ0FBQSxDQUFBOzsifQ== | ||
export { | ||
usePasswordField | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { SelectProps } from '../../input'; | ||
import type { FieldLayoutProps, SelectFieldProps } from '../types'; | ||
import { SelectProps } from '../../input'; | ||
import { FieldLayoutProps, SelectFieldProps } from '../types'; | ||
type UseSelectFieldState = { | ||
@@ -4,0 +4,0 @@ layoutProps: Omit<FieldLayoutProps, 'input' | 'className' | 'inputHandle'>; |
@@ -1,75 +0,95 @@ | ||
'use client'; | ||
import { useId, useState, useCallback, useEffect } from 'react'; | ||
import { makeDescId } from '../../accessibility/aria/utils.js'; | ||
"use client"; | ||
import { useId, useState, useCallback, useEffect } from "react"; | ||
import { makeDescId } from "../../accessibility/aria/utils.js"; | ||
const useSelectField = (props, preplyDsComponent) => { | ||
const { id, value, label, hideLabel, wrapLabel, preserveSpace, required, requiredLabel, additionalText, disabled, hasError, errorMessage, icon, onFocus, onBlur, onChange, inputDataset, dataset, placeholder, defaultValue, ...rest } = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const [hasValue, setHasValue] = useState(!!(value || defaultValue)); | ||
const handleFocus = useCallback(ev => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback(ev => { | ||
setIsFocused(false); | ||
onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback((ev) => { | ||
setIsChanged(true); | ||
setHasValue(!!ev.target.value); | ||
onChange === null || onChange === void 0 ? void 0 : onChange(ev); | ||
}, []); | ||
const hasControlledValue = !!value; | ||
useEffect(() => { | ||
if (defaultValue) | ||
return; | ||
setHasValue(hasControlledValue); | ||
}, [hasControlledValue]); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : undefined; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue, | ||
hasError: actualHasError, | ||
icon, | ||
dataset, | ||
preplyDsComponent, | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
dataset: inputDataset, | ||
'aria-describedby': describeId, | ||
placeholder, | ||
defaultValue, | ||
...rest, | ||
}, | ||
}; | ||
const { | ||
id, | ||
value, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
preserveSpace, | ||
required, | ||
requiredLabel, | ||
additionalText, | ||
disabled, | ||
hasError, | ||
errorMessage, | ||
icon, | ||
onFocus, | ||
onBlur, | ||
onChange, | ||
inputDataset, | ||
dataset, | ||
placeholder, | ||
defaultValue, | ||
...rest | ||
} = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const [hasValue, setHasValue] = useState(!!(value || defaultValue)); | ||
const handleFocus = useCallback((ev) => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus == null ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback((ev) => { | ||
setIsFocused(false); | ||
onBlur == null ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback((ev) => { | ||
setIsChanged(true); | ||
setHasValue(!!ev.target.value); | ||
onChange == null ? void 0 : onChange(ev); | ||
}, []); | ||
const hasControlledValue = !!value; | ||
useEffect(() => { | ||
if (defaultValue) return; | ||
setHasValue(hasControlledValue); | ||
}, [hasControlledValue]); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : void 0; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue, | ||
hasError: actualHasError, | ||
icon, | ||
dataset, | ||
preplyDsComponent | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
dataset: inputDataset, | ||
"aria-describedby": describeId, | ||
placeholder, | ||
defaultValue, | ||
...rest | ||
} | ||
}; | ||
}; | ||
export { useSelectField }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlU2VsZWN0RmllbGQuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9maWVsZC9ob29rcy91c2VTZWxlY3RGaWVsZC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIGNsaWVudCc7XG5cbmltcG9ydCB7IHVzZUNhbGxiYWNrLCB1c2VFZmZlY3QsIHVzZUlkLCB1c2VTdGF0ZSB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHsgbWFrZURlc2NJZCB9IGZyb20gJy4uLy4uL2FjY2Vzc2liaWxpdHkvYXJpYS91dGlscyc7XG5pbXBvcnQgdHlwZSB7IEZvY3VzRXZlbnRIYW5kbGVyIH0gZnJvbSAnLi4vLi4vZXZlbnRzJztcbmltcG9ydCB0eXBlIHsgU2VsZWN0UHJvcHMgfSBmcm9tICcuLi8uLi9pbnB1dCc7XG5pbXBvcnQgdHlwZSB7IEZpZWxkTGF5b3V0UHJvcHMsIFNlbGVjdEZpZWxkUHJvcHMgfSBmcm9tICcuLi90eXBlcyc7XG5cbnR5cGUgVXNlU2VsZWN0RmllbGRTdGF0ZSA9IHtcbiAgICBsYXlvdXRQcm9wczogT21pdDxGaWVsZExheW91dFByb3BzLCAnaW5wdXQnIHwgJ2NsYXNzTmFtZScgfCAnaW5wdXRIYW5kbGUnPjtcbiAgICBpbnB1dFByb3BzOiBTZWxlY3RQcm9wcztcbn07XG5cbmV4cG9ydCBjb25zdCB1c2VTZWxlY3RGaWVsZCA9IChcbiAgICBwcm9wczogU2VsZWN0RmllbGRQcm9wcyAmIE9taXQ8U2VsZWN0UHJvcHMsICdpZCc+LFxu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lvbmFsVGV4dDtcbiAgICBjb25zdCBkZXNjcmliZUlkID0gYWN0dWFsSGFzRXJyb3IgfHwgISFhZGRpdGlvbmFsVGV4dCA/IG1ha2VEZXNjSWQoYWN0dWFsSWQpIDogdW5kZWZpbmVkO1xuXG4gICAgcmV0dXJuIHtcbiAgICAgICAgbGF5b3V0UHJvcHM6IHtcbiAgICAgICAgICAgIGlkOiBhY3R1YWxJZCxcbiAgICAgICAgICAgIGxhYmVsLFxuICAgICAgICAgICAgaGlkZUxhYmVsLFxuICAgICAgICAgICAgd3JhcExhYmVsLFxuICAgICAgICAgICAgcmVxdWlyZWQsXG4gICAgICAgICAgICByZXF1aXJlZExhYmVsLFxuICAgICAgICAgICAgYWRkaXRpb25hbFRleHQ6IGFjdHVhbEFkZGl0aW9uYWxUZXh0LFxuICAgICAgICAgICAgcHJlc2VydmVTcGFjZSxcbiAgICAgICAgICAgIGRpc2FibGVkLFxuICAgICAgICAgICAgaXNGb2N1c2VkLFxuICAgICAgICAgICAgaXNUb3VjaGVkLFxuICAgICAgICAgICAgaXNDaGFuZ2VkLFxuICAgICAgICAgICAgaGFzVmFsdWUsXG4gICAgICAgICAgICBoYXNFcnJvcjogYWN0dWFsSGFzRXJyb3IsXG4gICAgICAgICAgICBpY29uLFxuICAgICAgICAgICAgZGF0YXNldCxcbiAgICAgICAgICAgIHByZXBseURzQ29tcG9uZW50LFxuICAgICAgICB9LFxuICAgICAgICBpbnB1dFByb3BzOiB7XG4gICAgICAgICAgICBpZDogYWN0dWFsSWQsXG4gICAgICAgICAgICB2YWx1ZSxcbiAgICAgICAgICAgIG9uRm9jdXM6IGhhbmRsZUZvY3VzLFxuICAgICAgICAgICAgb25CbHVyOiBoYW5kbGVCbHVyLFxuICAgICAgICAgICAgb25DaGFuZ2U6IGhhbmRsZUNoYW5nZSxcbiAgICAgICAgICAgIHJlcXVpcmVkLFxuICAgICAgICAgICAgZGlzYWJsZWQsXG4gICAgICAgICAgICBoYXNFcnJvcjogYWN0dW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QUFBLENBQUEsQ0FBQSxDQUFPLEVBQUUsQ0FBWSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0FBQ3JCLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFrQixFQUFFLENBQVUsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO1lBQzlCLENBQVcsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUE7WUFDWCxDQUFZLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUE7QUFDWixDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxHQUFHLENBQUksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0FBQ1YsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0tBQ0osQ0FBQyxDQUFBO0FBQ04sQ0FBQSxDQUFBOzsifQ== | ||
export { | ||
useSelectField | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { TextareaProps } from '../../input'; | ||
import type { FieldLayoutProps, TextareaFieldProps } from '../types'; | ||
import { TextareaProps } from '../../input'; | ||
import { FieldLayoutProps, TextareaFieldProps } from '../types'; | ||
type UseTextareaFieldState = { | ||
@@ -4,0 +4,0 @@ layoutProps: Omit<FieldLayoutProps, 'input' | 'className' | 'inputHandle'>; |
@@ -1,66 +0,86 @@ | ||
'use client'; | ||
import { useId, useState, useCallback } from 'react'; | ||
import { makeDescId } from '../../accessibility/aria/utils.js'; | ||
import { AUTO_COMPLETE_TEXT_DEFAULT } from '../../input/constants.js'; | ||
"use client"; | ||
import { useId, useState, useCallback } from "react"; | ||
import { makeDescId } from "../../accessibility/aria/utils.js"; | ||
import { AUTO_COMPLETE_TEXT_DEFAULT } from "../../input/constants.js"; | ||
import "../../input/options.js"; | ||
const useTextareaField = (props, preplyDsComponent) => { | ||
const { id, value, label, hideLabel, wrapLabel, preserveSpace, required, requiredLabel, additionalText, disabled, hasError, errorMessage, onFocus, onBlur, onChange, autoComplete = AUTO_COMPLETE_TEXT_DEFAULT, inputDataset, dataset, ...rest } = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback(ev => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback(ev => { | ||
setIsFocused(false); | ||
onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback(ev => { | ||
setIsChanged(false); | ||
onChange === null || onChange === void 0 ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : undefined; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== 'undefined', | ||
hasError: actualHasError, | ||
dataset, | ||
preplyDsComponent, | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
autoComplete, | ||
dataset: inputDataset, | ||
'aria-describedby': describeId, | ||
...rest, | ||
}, | ||
}; | ||
const { | ||
id, | ||
value, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
preserveSpace, | ||
required, | ||
requiredLabel, | ||
additionalText, | ||
disabled, | ||
hasError, | ||
errorMessage, | ||
onFocus, | ||
onBlur, | ||
onChange, | ||
autoComplete = AUTO_COMPLETE_TEXT_DEFAULT, | ||
inputDataset, | ||
dataset, | ||
...rest | ||
} = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback((ev) => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus == null ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback((ev) => { | ||
setIsFocused(false); | ||
onBlur == null ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback((ev) => { | ||
setIsChanged(false); | ||
onChange == null ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : void 0; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== "undefined", | ||
hasError: actualHasError, | ||
dataset, | ||
preplyDsComponent | ||
}, | ||
inputProps: { | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
autoComplete, | ||
dataset: inputDataset, | ||
"aria-describedby": describeId, | ||
...rest | ||
} | ||
}; | ||
}; | ||
export { useTextareaField }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlVGV4dGFyZWFGaWVsZC5qcyIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2ZpZWxkL2hvb2tzL3VzZVRleHRhcmVhRmllbGQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBjbGllbnQnO1xuXG5pbXBvcnQgeyBDaGFuZ2VFdmVudEhhbmRsZXIsIHVzZUNhbGxiYWNrLCB1c2VJZCwgdXNlU3RhdGUgfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB7IG1ha2VEZXNjSWQgfSBmcm9tICcuLi8uLi9hY2Nlc3NpYmlsaXR5L2FyaWEvdXRpbHMnO1xuaW1wb3J0IHR5cGUgeyBGb2N1c0V2ZW50SGFuZGxlciB9IGZyb20gJy4uLy4uL2V2ZW50cyc7XG5pbXBvcnQgdHlwZSB7IFRleHRhcmVhUHJvcHMgfSBmcm9tICcuLi8uLi9pbnB1dCc7XG5pbXBvcnQgeyBBVVRPX0NPTVBMRVRFX1RFWFRfREVGQVVMVCB9IGZyb20gJy4uLy4uL2lucHV0JztcbmltcG9ydCB0eXBlIHsgRmllbGRMYXlvdXRQcm9wcywgVGV4dGFyZWFGaWVsZFByb3BzIH0gZnJvbSAnLi4vdHlwZXMnO1xuXG50eXBlIFVzZVRleHRhcmVhRmllbGRTdGF0ZSA9IHtcbiAgICBsYXlvdXRQcm9wczogT21pdDxGaWVsZExheW91dFByb3BzLCAnaW5wdXQnIHwgJ2NsYXNzTmFtZScgfCAnaW5wdXRIYW5kbGUnPjtcbiAgICBpbnB1dFByb3BzOiBUZ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WJlbCxcbiAgICAgICAgICAgIHJlcXVpcmVkLFxuICAgICAgICAgICAgcmVxdWlyZWRMYWJlbCxcbiAgICAgICAgICAgIGFkZGl0aW9uYWxUZXh0OiBhY3R1YWxBZGRpdGlvbmFsVGV4dCxcbiAgICAgICAgICAgIHByZXNlcnZlU3BhY2UsXG4gICAgICAgICAgICBkaXNhYmxlZCxcbiAgICAgICAgICAgIGlzRm9jdXNlZCxcbiAgICAgICAgICAgIGlzVG91Y2hlZCxcbiAgICAgICAgICAgIGlzQ2hhbmdlZCxcbiAgICAgICAgICAgIGhhc1ZhbHVlOiB0eXBlb2YgdmFsdWUgIT09ICd1bmRlZmluZWQnLFxuICAgICAgICAgICAgaGFzRXJyb3I6IGFjdHVhbEhhc0Vycm9yLFxuICAgICAgICAgICAgZGF0YXNldCxcbiAgICAgICAgICAgIHByZXBseURzQ29tcG9uZW50LFxuICAgICAgICB9LFxuICAgICAgICBpbnB1dFByb3BzOiB7XG4gICAgICAgICAgICBpZDogYWN0dWFsSWQsXG4gICAgICAgICAgICB2YWx1ZSxcbiAgICAgICAgICAgIG9uRm9jdXM6IGhhbmRsZUZvY3VzLFxuICAgICAgICAgICAgb25CbHVyOiBoYW5kbGVCbHVyLFxuICAgICAgICAgICAgb25DaGFuZ2U6IGhhbmRsZUNoYW5nZSxcbiAgICAgICAgICAgIHJlcXVpcmVkLFxuICAgICAgICAgICAgZGlzYWJsZWQsXG4gICAgICAgICAgICBoYXNFcnJvcjogYWN0dWFsSGFzRXJyb3IsXG4gICAgICAgICAgICBhdXRvQ29tcGxldGUsXG4gICAgICAgICAgICBkYXRhc2V0OiBpbnB1dERhdGFzZXQsXG4gICAgICAgICAgICAnYXJpYS1kZXNjcmliZWRieSc6IGRlc2NyaWJlSWQsXG4gICAgICAgICAgICAuLi5yZXN0LFxuICAgICAgICB9LFxuICAgIH07XG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O01BZWEsZ0JBQWdCLENBQUcsQ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xDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUE7WUFDeEIsQ0FBWSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0FBQ1osQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBTyxFQUFFLENBQVksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTtBQUNyQixDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBa0IsRUFBRSxDQUFVLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTtBQUM5QixDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxHQUFHLENBQUksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0FBQ1YsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0tBQ0osQ0FBQyxDQUFBO0FBQ04sQ0FBQSxDQUFBOzsifQ== | ||
export { | ||
useTextareaField | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { InputTextProps } from '../../input'; | ||
import type { FieldLayoutProps, TextFieldProps } from '../types'; | ||
import { InputTextProps } from '../../input'; | ||
import { FieldLayoutProps, TextFieldProps } from '../types'; | ||
type UseTextFieldState = { | ||
@@ -4,0 +4,0 @@ layoutProps: Omit<FieldLayoutProps, 'input' | 'className' | 'inputHandle'>; |
@@ -1,71 +0,94 @@ | ||
'use client'; | ||
import { useId, useState, useCallback } from 'react'; | ||
import { makeDescId } from '../../accessibility/aria/utils.js'; | ||
import { FIELD_TYPE_DEFAULT } from '../constants.js'; | ||
import { AUTO_COMPLETE_TEXT_DEFAULT } from '../../input/constants.js'; | ||
"use client"; | ||
import { useId, useState, useCallback } from "react"; | ||
import { makeDescId } from "../../accessibility/aria/utils.js"; | ||
import { AUTO_COMPLETE_TEXT_DEFAULT } from "../../input/constants.js"; | ||
import "../../input/options.js"; | ||
import { FIELD_TYPE_DEFAULT } from "../constants.js"; | ||
const useTextField = (props, preplyDsComponent) => { | ||
const { type, id, value, label, hideLabel, wrapLabel, preserveSpace, required, requiredLabel, additionalText, disabled, hasError, errorMessage, icon, button, onFocus, onBlur, onChange, autoComplete = AUTO_COMPLETE_TEXT_DEFAULT, inputDataset, dataset, ...rest } = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const actualType = type !== null && type !== void 0 ? type : FIELD_TYPE_DEFAULT; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback(ev => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback(ev => { | ||
setIsFocused(false); | ||
onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback(ev => { | ||
setIsChanged(false); | ||
onChange === null || onChange === void 0 ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : undefined; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== 'undefined', | ||
hasError: actualHasError, | ||
icon, | ||
button, | ||
dataset, | ||
preplyDsComponent, | ||
}, | ||
inputProps: { | ||
type: actualType, | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
autoComplete, | ||
dataset: inputDataset, | ||
'aria-describedby': describeId, | ||
...rest, | ||
}, | ||
}; | ||
const { | ||
type, | ||
id, | ||
value, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
preserveSpace, | ||
required, | ||
requiredLabel, | ||
additionalText, | ||
disabled, | ||
hasError, | ||
errorMessage, | ||
icon, | ||
button, | ||
onFocus, | ||
onBlur, | ||
onChange, | ||
autoComplete = AUTO_COMPLETE_TEXT_DEFAULT, | ||
inputDataset, | ||
dataset, | ||
...rest | ||
} = props; | ||
const generatedId = useId(); | ||
const actualId = id || generatedId; | ||
const actualType = type != null ? type : FIELD_TYPE_DEFAULT; | ||
const [isFocused, setIsFocused] = useState(false); | ||
const [isTouched, setIsTouched] = useState(false); | ||
const [isChanged, setIsChanged] = useState(false); | ||
const handleFocus = useCallback((ev) => { | ||
setIsFocused(true); | ||
setIsTouched(true); | ||
onFocus == null ? void 0 : onFocus(ev); | ||
}, []); | ||
const handleBlur = useCallback((ev) => { | ||
setIsFocused(false); | ||
onBlur == null ? void 0 : onBlur(ev); | ||
}, []); | ||
const handleChange = useCallback((ev) => { | ||
setIsChanged(false); | ||
onChange == null ? void 0 : onChange(ev); | ||
}, []); | ||
const actualHasError = hasError || !!errorMessage; | ||
const actualAdditionalText = errorMessage || additionalText; | ||
const describeId = actualHasError || !!additionalText ? makeDescId(actualId) : void 0; | ||
return { | ||
layoutProps: { | ||
id: actualId, | ||
label, | ||
hideLabel, | ||
wrapLabel, | ||
required, | ||
requiredLabel, | ||
additionalText: actualAdditionalText, | ||
preserveSpace, | ||
disabled, | ||
isFocused, | ||
isTouched, | ||
isChanged, | ||
hasValue: typeof value !== "undefined", | ||
hasError: actualHasError, | ||
icon, | ||
button, | ||
dataset, | ||
preplyDsComponent | ||
}, | ||
inputProps: { | ||
type: actualType, | ||
id: actualId, | ||
value, | ||
onFocus: handleFocus, | ||
onBlur: handleBlur, | ||
onChange: handleChange, | ||
required, | ||
disabled, | ||
hasError: actualHasError, | ||
autoComplete, | ||
dataset: inputDataset, | ||
"aria-describedby": describeId, | ||
...rest | ||
} | ||
}; | ||
}; | ||
export { useTextField }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlVGV4dEZpZWxkLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZmllbGQvaG9va3MvdXNlVGV4dEZpZWxkLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2UgY2xpZW50JztcblxuaW1wb3J0IHsgQ2hhbmdlRXZlbnRIYW5kbGVyLCB1c2VDYWxsYmFjaywgdXNlSWQsIHVzZVN0YXRlIH0gZnJvbSAncmVhY3QnO1xuXG5pbXBvcnQgeyBtYWtlRGVzY0lkIH0gZnJvbSAnLi4vLi4vYWNjZXNzaWJpbGl0eS9hcmlhL3V0aWxzJztcbmltcG9ydCB0eXBlIHsgRm9jdXNFdmVudEhhbmRsZXIgfSBmcm9tICcuLi8uLi9ldmVudHMnO1xuaW1wb3J0IHR5cGUgeyBJbnB1dFRleHRQcm9wcyB9IGZyb20gJy4uLy4uL2lucHV0JztcbmltcG9ydCB7IEFVVE9fQ09NUExFVEVfVEVYVF9ERUZBVUxUIH0gZnJvbSAnLi4vLi4vaW5wdXQnO1xuaW1wb3J0IHsgRklFTERfVFl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0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBa0IsRUFBRSxDQUFVLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTtBQUM5QixDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxHQUFHLENBQUksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0FBQ1YsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0tBQ0osQ0FBQyxDQUFBO0FBQ04sQ0FBQSxDQUFBOzsifQ== | ||
export { | ||
useTextField | ||
}; |
@@ -0,0 +0,0 @@ export * from './constants'; |
@@ -1,8 +0,17 @@ | ||
export { FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, FIELD_TYPE_DEFAULT } from './constants.js'; | ||
export { usePasswordField } from './hooks/usePasswordField.js'; | ||
export { useTextField } from './hooks/useTextField.js'; | ||
export { useNumberField } from './hooks/useNumberField.js'; | ||
export { useSelectField } from './hooks/useSelectField.js'; | ||
export { useTextareaField } from './hooks/useTextareaField.js'; | ||
export { ADDITIONAL_TEXT_VARIANT_OPTIONS } from './options.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7In0= | ||
import { FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, FIELD_TYPE_DEFAULT } from "./constants.js"; | ||
import { usePasswordField } from "./hooks/usePasswordField.js"; | ||
import { useTextField } from "./hooks/useTextField.js"; | ||
import { useNumberField } from "./hooks/useNumberField.js"; | ||
import { useSelectField } from "./hooks/useSelectField.js"; | ||
import { useTextareaField } from "./hooks/useTextareaField.js"; | ||
import { ADDITIONAL_TEXT_VARIANT_OPTIONS } from "./options.js"; | ||
export { | ||
ADDITIONAL_TEXT_VARIANT_OPTIONS, | ||
FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, | ||
FIELD_TYPE_DEFAULT, | ||
useNumberField, | ||
usePasswordField, | ||
useSelectField, | ||
useTextField, | ||
useTextareaField | ||
}; |
@@ -1,4 +0,4 @@ | ||
import type { Option } from '@preply/ds-core-types'; | ||
import type { FieldAdditionalTextVariant } from './types'; | ||
import { Option } from '@preply/ds-core-types'; | ||
import { FieldAdditionalTextVariant } from './types'; | ||
export declare const ADDITIONAL_TEXT_VARIANT_OPTIONS: Option<FieldAdditionalTextVariant>[]; | ||
//# sourceMappingURL=options.d.ts.map |
const ADDITIONAL_TEXT_VARIANT_OPTIONS = [ | ||
{ id: 'normal' }, | ||
{ id: 'error' }, | ||
{ id: "normal" }, | ||
{ id: "error" } | ||
]; | ||
export { ADDITIONAL_TEXT_VARIANT_OPTIONS }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9ucy5qcyIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpZWxkL29wdGlvbnMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBPcHRpb24gfSBmcm9tICdAcHJlcGx5L2RzLWNvcmUtdHlwZXMnO1xuXG5pbXBvcnQgdHlwZSB7IEZpZWxkQWRkaXRpb25hbFRleHRWYXJpYW50IH0gZnJvbSAnLi90eXBlcyc7XG5cbmV4cG9ydCBjb25zdCBBRERJVElPTkFMX1RFWFRfVkFSSUFOVF9PUFRJT05TOiBPcHRpb248RmllbGRBZGRpdGlvbmFsVGV4dFZhcmlhbnQ+W10gPSBbXG4gICAgeyBpZDogJ25vcm1hbCcgfSxcbiAgICB7IGlkOiAnZXJyb3InIH0sXG5dO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlhLE1BQUEsK0JBQStCLEdBQXlDO0lBQ2pGLEVBQUUsRUFBRSxFQUFFLFFBQVEsRUFBRTtJQUNoQixFQUFFLEVBQUUsRUFBRSxPQUFPLEVBQUU7Ozs7OyJ9 | ||
export { | ||
ADDITIONAL_TEXT_VARIANT_OPTIONS | ||
}; |
@@ -1,7 +0,6 @@ | ||
import type { Dataset } from '@preply/ds-core'; | ||
import type { MouseEventHandler, ReactNode } from 'react'; | ||
import React from 'react'; | ||
import { Dataset } from '@preply/ds-core'; | ||
import { MouseEventHandler, ReactNode, default as React } from 'react'; | ||
import { IconProps } from '../icon/types'; | ||
import type { AutoCompletePasswordOptions, SimpleTextInputType, SingleLineInputType } from '../input/private/types'; | ||
import type { CombinableInputProps, InputNumberProps, InputPasswordProps, InputTextProps, SelectProps, TextareaProps } from '../input/types'; | ||
import { AutoCompletePasswordOptions, SimpleTextInputType, SingleLineInputType } from '../input/private/types'; | ||
import { CombinableInputProps, InputNumberProps, InputPasswordProps, InputTextProps, SelectProps, TextareaProps } from '../input/types'; | ||
import { ReactSVGComponentType } from '../svg/types'; | ||
@@ -8,0 +7,0 @@ export type FieldValue = string | number | boolean; |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
export { onHover } from './sc/mixins'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,4 @@ | ||
export { onHover } from './sc/mixins.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= | ||
import { onHover } from "./sc/mixins.js"; | ||
export { | ||
onHover | ||
}; |
export declare const onHover: (content: string) => string; | ||
//# sourceMappingURL=mixins.d.ts.map |
@@ -8,4 +8,4 @@ const onHover = (content) => ` | ||
`; | ||
export { onHover }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWl4aW5zLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaG92ZXIvc2MvbWl4aW5zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBvbkhvdmVyID0gKGNvbnRlbnQ6IHN0cmluZyk6IHN0cmluZyA9PiBgXG4gICAgQG1lZGlhIChob3ZlcjogaG92ZXIpIGFuZCAocG9pbnRlcjogZmluZSkge1xuICAgICAgICAmOmhvdmVyIHtcbiAgICAgICAgICAgICR7Y29udGVudH1cbiAgICAgICAgfVxuICAgIH1cbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ik1BQWEsT0FBTyxHQUFHLENBQUMsT0FBZSxLQUFhLENBQUE7OztjQUd0QyxPQUFPLENBQUE7Ozs7Ozs7In0= | ||
export { | ||
onHover | ||
}; |
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
@@ -1,2 +0,2 @@ | ||
import type { ColorName, Dataset, IconSize, TextAccent, TokyoUiIconSize } from '@preply/ds-core'; | ||
import { ColorName, Dataset, IconSize, TextAccent, TokyoUiIconSize } from '@preply/ds-core'; | ||
import { ReactSVGComponentType } from '../svg/types'; | ||
@@ -3,0 +3,0 @@ export type IconProps = { |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
export * from './accessibility'; | ||
export * from './color/module-color'; | ||
export * from './color-scheme'; | ||
@@ -4,0 +3,0 @@ export * from './css-module'; |
@@ -1,43 +0,92 @@ | ||
export { getDatasetProps, getExternalUrlProps } from './dom/props/index.js'; | ||
export { mapEdgeKeyToStandard } from './keyboard/index.js'; | ||
export { currentHostname, currentHref } from './location/index.js'; | ||
export { getAriaProps } from './accessibility/aria/utils.js'; | ||
export { useColorClassNames } from './color/module-color/hooks/useColorClassNames.js'; | ||
export { colorSchemes } from './color-scheme/colorSchemes.js'; | ||
export { ColorScheme } from './color-scheme/classes/ColorScheme.js'; | ||
export { ColorSchemeProvider } from './color-scheme/providers/ColorSchemeProvider.js'; | ||
export { useColorScheme } from './color-scheme/hooks/useColorScheme.js'; | ||
export { withColorScheme } from './color-scheme/hocs/withColorScheme.js'; | ||
export { booleanClassNames, globalClassNames, longhandClassNames, moduleClassName, moduleClassNames, moduleLocals, stringClassNames } from './css-module/classNames.js'; | ||
export { useFocusEvents } from './events/hooks/useFocusEvents.js'; | ||
export { FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, FIELD_TYPE_DEFAULT } from './field/constants.js'; | ||
export { usePasswordField } from './field/hooks/usePasswordField.js'; | ||
export { useTextField } from './field/hooks/useTextField.js'; | ||
export { useNumberField } from './field/hooks/useNumberField.js'; | ||
export { useSelectField } from './field/hooks/useSelectField.js'; | ||
export { useTextareaField } from './field/hooks/useTextareaField.js'; | ||
export { ADDITIONAL_TEXT_VARIANT_OPTIONS } from './field/options.js'; | ||
export { AUTO_COMPLETE_DATE_DEFAULT, AUTO_COMPLETE_PASSWORD_DEFAULT, AUTO_COMPLETE_TEXT_DEFAULT, INPUT_TYPE_DEFAULT } from './input/constants.js'; | ||
export { AUTO_COMPLETE_DATE_OPTIONS, AUTO_COMPLETE_PASSWORD_OPTIONS, AUTO_COMPLETE_TEXTAREA_OPTIONS, AUTO_COMPLETE_TEXT_OPTIONS, INPUT_TYPE_OPTIONS, INPUT_TYPE_SIMPLE_TEXT_OPTIONS } from './input/options.js'; | ||
export { getInputProps } from './input/utils/getInputProps.js'; | ||
export { useForcedRef } from './input/utils/useForcedRef.js'; | ||
export { minWidth } from './responsive/sc/mixins.js'; | ||
export { onHover } from './hover/sc/mixins.js'; | ||
export { ServerStyleSheet } from './ssr/classes/ServerStyleSheet.js'; | ||
export { HostnameContext } from './ssr/contexts/HostnameContext.js'; | ||
export { StyleExtractContext } from './ssr/contexts/StyleExtractContext.js'; | ||
export { withStyleExtract } from './ssr/hocs/withStyleExtract.js'; | ||
export { useClassNameExtract } from './ssr/hooks/useClassNameExtract.js'; | ||
export { useHostname } from './ssr/hooks/useHostname.js'; | ||
export { useStyleExtract } from './ssr/hooks/useStyleExtract.js'; | ||
export { Theme } from './theme/classes/Theme.js'; | ||
export { ThemesProvider } from './theme/providers/ThemesProvider.js'; | ||
export { ThemeProvider } from './theme/providers/ThemeProvider.js'; | ||
export { useTheme } from './theme/hooks/useTheme.js'; | ||
export { useThemes } from './theme/hooks/useThemes.js'; | ||
export { useSetTheme } from './theme/hooks/useSetTheme.js'; | ||
export { withTheme } from './theme/hocs/withTheme.js'; | ||
export { getTokenVar } from './token/util/getTokenVar.js'; | ||
export { useToken } from './token/hooks/useToken.js'; | ||
export { withGetToken } from './token/hocs/withGetToken.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ== | ||
import { getAriaProps } from "./accessibility/aria/utils.js"; | ||
import { colorSchemes } from "./color-scheme/colorSchemes.js"; | ||
import { ColorScheme } from "./color-scheme/classes/ColorScheme.js"; | ||
import { ColorSchemeContext, ColorSchemeProvider } from "./color-scheme/providers/ColorSchemeProvider.js"; | ||
import { useColorScheme } from "./color-scheme/hooks/useColorScheme.js"; | ||
import { withColorScheme } from "./color-scheme/hocs/withColorScheme.js"; | ||
import { booleanClassNames, globalClassNames, longhandClassNames, moduleClassName, moduleClassNames, moduleLocals, stringClassNames } from "./css-module/classNames.js"; | ||
import { getDatasetProps, getExternalUrlProps } from "./dom/props/index.js"; | ||
import { useFocusEvents } from "./events/hooks/useFocusEvents.js"; | ||
import { FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, FIELD_TYPE_DEFAULT } from "./field/constants.js"; | ||
import { usePasswordField } from "./field/hooks/usePasswordField.js"; | ||
import { useTextField } from "./field/hooks/useTextField.js"; | ||
import { useNumberField } from "./field/hooks/useNumberField.js"; | ||
import { useSelectField } from "./field/hooks/useSelectField.js"; | ||
import { useTextareaField } from "./field/hooks/useTextareaField.js"; | ||
import { ADDITIONAL_TEXT_VARIANT_OPTIONS } from "./field/options.js"; | ||
import { AUTO_COMPLETE_DATE_DEFAULT, AUTO_COMPLETE_PASSWORD_DEFAULT, AUTO_COMPLETE_TEXT_DEFAULT, INPUT_TYPE_DEFAULT } from "./input/constants.js"; | ||
import { AUTO_COMPLETE_DATE_OPTIONS, AUTO_COMPLETE_PASSWORD_OPTIONS, AUTO_COMPLETE_TEXTAREA_OPTIONS, AUTO_COMPLETE_TEXT_OPTIONS, INPUT_TYPE_OPTIONS, INPUT_TYPE_SIMPLE_TEXT_OPTIONS } from "./input/options.js"; | ||
import { getInputProps } from "./input/utils/getInputProps.js"; | ||
import { useForcedRef } from "./input/utils/useForcedRef.js"; | ||
import { mapEdgeKeyToStandard } from "./keyboard/index.js"; | ||
import { currentHostname, currentHref } from "./location/index.js"; | ||
import { minWidth } from "./responsive/sc/mixins.js"; | ||
import { onHover } from "./hover/sc/mixins.js"; | ||
import { HostnameContext } from "./ssr/contexts/HostnameContext.js"; | ||
import { useHostname } from "./ssr/hooks/useHostname.js"; | ||
import { Theme } from "./theme/classes/Theme.js"; | ||
import { ThemesContext, ThemesProvider } from "./theme/providers/ThemesProvider.js"; | ||
import { ThemeContext, ThemeContextProvider } from "./theme/providers/ThemeProvider.js"; | ||
import { useTheme } from "./theme/hooks/useTheme.js"; | ||
import { useThemes } from "./theme/hooks/useThemes.js"; | ||
import { useSetTheme } from "./theme/hooks/useSetTheme.js"; | ||
import { getTokenVar } from "./token/util/getTokenVar.js"; | ||
import { useToken } from "./token/hooks/useToken.js"; | ||
import { withGetToken } from "./token/hocs/withGetToken.js"; | ||
export { | ||
ADDITIONAL_TEXT_VARIANT_OPTIONS, | ||
AUTO_COMPLETE_DATE_DEFAULT, | ||
AUTO_COMPLETE_DATE_OPTIONS, | ||
AUTO_COMPLETE_PASSWORD_DEFAULT, | ||
AUTO_COMPLETE_PASSWORD_OPTIONS, | ||
AUTO_COMPLETE_TEXTAREA_OPTIONS, | ||
AUTO_COMPLETE_TEXT_DEFAULT, | ||
AUTO_COMPLETE_TEXT_OPTIONS, | ||
ColorScheme, | ||
ColorSchemeContext, | ||
ColorSchemeProvider, | ||
FIELD_ADDITIONAL_TEXT_VARIANT_DEFAULT, | ||
FIELD_TYPE_DEFAULT, | ||
HostnameContext, | ||
INPUT_TYPE_DEFAULT, | ||
INPUT_TYPE_OPTIONS, | ||
INPUT_TYPE_SIMPLE_TEXT_OPTIONS, | ||
Theme, | ||
ThemeContext, | ||
ThemeContextProvider, | ||
ThemesContext, | ||
ThemesProvider, | ||
booleanClassNames, | ||
colorSchemes, | ||
currentHostname, | ||
currentHref, | ||
getAriaProps, | ||
getDatasetProps, | ||
getExternalUrlProps, | ||
getInputProps, | ||
getTokenVar, | ||
globalClassNames, | ||
longhandClassNames, | ||
mapEdgeKeyToStandard, | ||
minWidth, | ||
moduleClassName, | ||
moduleClassNames, | ||
moduleLocals, | ||
onHover, | ||
stringClassNames, | ||
useColorScheme, | ||
useFocusEvents, | ||
useForcedRef, | ||
useHostname, | ||
useNumberField, | ||
usePasswordField, | ||
useSelectField, | ||
useSetTheme, | ||
useTextField, | ||
useTextareaField, | ||
useTheme, | ||
useThemes, | ||
useToken, | ||
withColorScheme, | ||
withGetToken | ||
}; |
@@ -0,0 +0,0 @@ export declare const INPUT_TYPE_DEFAULT = "text"; |
@@ -1,7 +0,10 @@ | ||
const INPUT_TYPE_DEFAULT = 'text'; | ||
const AUTO_COMPLETE_TEXT_DEFAULT = 'off'; | ||
const AUTO_COMPLETE_PASSWORD_DEFAULT = 'off'; | ||
const AUTO_COMPLETE_DATE_DEFAULT = 'off'; | ||
export { AUTO_COMPLETE_DATE_DEFAULT, AUTO_COMPLETE_PASSWORD_DEFAULT, AUTO_COMPLETE_TEXT_DEFAULT, INPUT_TYPE_DEFAULT }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5wdXQvY29uc3RhbnRzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBJTlBVVF9UWVBFX0RFRkFVTFQgPSAndGV4dCc7XG5cbmV4cG9ydCBjb25zdCBBVVRPX0NPTVBMRVRFX1RFWFRfREVGQVVMVCA9ICdvZmYnO1xuZXhwb3J0IGNvbnN0IEFVVE9fQ09NUExFVEVfUEFTU1dPUkRfREVGQVVMVCA9ICdvZmYnO1xuZXhwb3J0IGNvbnN0IEFVVE9fQ09NUExFVEVfREFURV9ERUZBVUxUID0gJ29mZic7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQU8sTUFBTSxrQkFBa0IsR0FBRyxPQUFPO0FBRWxDLE1BQU0sMEJBQTBCLEdBQUcsTUFBTTtBQUN6QyxNQUFNLDhCQUE4QixHQUFHLE1BQU07QUFDN0MsTUFBTSwwQkFBMEIsR0FBRzs7OzsifQ== | ||
const INPUT_TYPE_DEFAULT = "text"; | ||
const AUTO_COMPLETE_TEXT_DEFAULT = "off"; | ||
const AUTO_COMPLETE_PASSWORD_DEFAULT = "off"; | ||
const AUTO_COMPLETE_DATE_DEFAULT = "off"; | ||
export { | ||
AUTO_COMPLETE_DATE_DEFAULT, | ||
AUTO_COMPLETE_PASSWORD_DEFAULT, | ||
AUTO_COMPLETE_TEXT_DEFAULT, | ||
INPUT_TYPE_DEFAULT | ||
}; |
@@ -0,0 +0,0 @@ export * from './constants'; |
@@ -1,5 +0,18 @@ | ||
export { AUTO_COMPLETE_DATE_DEFAULT, AUTO_COMPLETE_PASSWORD_DEFAULT, AUTO_COMPLETE_TEXT_DEFAULT, INPUT_TYPE_DEFAULT } from './constants.js'; | ||
export { AUTO_COMPLETE_DATE_OPTIONS, AUTO_COMPLETE_PASSWORD_OPTIONS, AUTO_COMPLETE_TEXTAREA_OPTIONS, AUTO_COMPLETE_TEXT_OPTIONS, INPUT_TYPE_OPTIONS, INPUT_TYPE_SIMPLE_TEXT_OPTIONS } from './options.js'; | ||
export { getInputProps } from './utils/getInputProps.js'; | ||
export { useForcedRef } from './utils/useForcedRef.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7In0= | ||
import { AUTO_COMPLETE_DATE_DEFAULT, AUTO_COMPLETE_PASSWORD_DEFAULT, AUTO_COMPLETE_TEXT_DEFAULT, INPUT_TYPE_DEFAULT } from "./constants.js"; | ||
import { AUTO_COMPLETE_DATE_OPTIONS, AUTO_COMPLETE_PASSWORD_OPTIONS, AUTO_COMPLETE_TEXTAREA_OPTIONS, AUTO_COMPLETE_TEXT_OPTIONS, INPUT_TYPE_OPTIONS, INPUT_TYPE_SIMPLE_TEXT_OPTIONS } from "./options.js"; | ||
import { getInputProps } from "./utils/getInputProps.js"; | ||
import { useForcedRef } from "./utils/useForcedRef.js"; | ||
export { | ||
AUTO_COMPLETE_DATE_DEFAULT, | ||
AUTO_COMPLETE_DATE_OPTIONS, | ||
AUTO_COMPLETE_PASSWORD_DEFAULT, | ||
AUTO_COMPLETE_PASSWORD_OPTIONS, | ||
AUTO_COMPLETE_TEXTAREA_OPTIONS, | ||
AUTO_COMPLETE_TEXT_DEFAULT, | ||
AUTO_COMPLETE_TEXT_OPTIONS, | ||
INPUT_TYPE_DEFAULT, | ||
INPUT_TYPE_OPTIONS, | ||
INPUT_TYPE_SIMPLE_TEXT_OPTIONS, | ||
getInputProps, | ||
useForcedRef | ||
}; |
@@ -1,2 +0,2 @@ | ||
import type { Option } from '@preply/ds-core-types'; | ||
import { Option } from '@preply/ds-core-types'; | ||
import { AutoCompleteDateOptions, AutoCompletePasswordOptions, AutoCompleteTextOptions, AutoCompleteTextareaOptions, InputType } from './private/types'; | ||
@@ -3,0 +3,0 @@ export declare const INPUT_TYPE_SIMPLE_TEXT_OPTIONS: Option<InputType>[]; |
const INPUT_TYPE_SIMPLE_TEXT_OPTIONS = [ | ||
{ id: 'text' }, | ||
{ id: 'search' }, | ||
{ id: 'email' }, | ||
{ id: 'tel' }, | ||
{ id: 'url' }, | ||
{ id: "text" }, | ||
{ id: "search" }, | ||
{ id: "email" }, | ||
{ id: "tel" }, | ||
{ id: "url" } | ||
]; | ||
const INPUT_TYPE_OPTIONS = [ | ||
...INPUT_TYPE_SIMPLE_TEXT_OPTIONS, | ||
{ id: 'password' }, | ||
{ id: 'number' }, | ||
{ id: 'date' }, | ||
{ id: 'time' }, | ||
{ id: 'checkbox' }, | ||
{ id: 'radio' }, | ||
{ id: 'textarea' }, | ||
{ id: 'select' }, | ||
...INPUT_TYPE_SIMPLE_TEXT_OPTIONS, | ||
{ id: "password" }, | ||
{ id: "number" }, | ||
{ id: "date" }, | ||
{ id: "time" }, | ||
{ id: "checkbox" }, | ||
{ id: "radio" }, | ||
{ id: "textarea" }, | ||
{ id: "select" } | ||
]; | ||
const AUTO_COMPLETE_TEXT_OPTIONS = [ | ||
{ id: 'off' }, | ||
{ id: 'on' }, | ||
{ id: 'name' }, | ||
{ id: 'email' }, | ||
{ id: 'username' }, | ||
{ id: 'language' }, | ||
{ id: 'tel' }, | ||
{ id: 'url' }, | ||
{ id: 'new-password' }, | ||
{ id: 'current-password' }, | ||
{ id: "off" }, | ||
{ id: "on" }, | ||
{ id: "name" }, | ||
{ id: "email" }, | ||
{ id: "username" }, | ||
{ id: "language" }, | ||
{ id: "tel" }, | ||
{ id: "url" }, | ||
{ id: "new-password" }, | ||
{ id: "current-password" } | ||
]; | ||
const AUTO_COMPLETE_DATE_OPTIONS = [ | ||
{ id: 'off' }, | ||
{ id: 'on' }, | ||
{ id: "off" }, | ||
{ id: "on" } | ||
]; | ||
const AUTO_COMPLETE_PASSWORD_OPTIONS = [ | ||
{ id: 'off' }, | ||
{ id: 'new-password' }, | ||
{ id: 'current-password' }, | ||
{ id: "off" }, | ||
{ id: "new-password" }, | ||
{ id: "current-password" } | ||
]; | ||
const AUTO_COMPLETE_TEXTAREA_OPTIONS = [ | ||
{ id: 'off' }, | ||
{ id: 'on' }, | ||
{ id: "off" }, | ||
{ id: "on" } | ||
]; | ||
export { AUTO_COMPLETE_DATE_OPTIONS, AUTO_COMPLETE_PASSWORD_OPTIONS, AUTO_COMPLETE_TEXTAREA_OPTIONS, AUTO_COMPLETE_TEXT_OPTIONS, INPUT_TYPE_OPTIONS, INPUT_TYPE_SIMPLE_TEXT_OPTIONS }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9ucy5qcyIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2lucHV0L29wdGlvb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TtJQUNiLEVBQUUsRUFBRSxFQUFFLElBQUksRUFBRTtFQUNkO0FBRVcsTUFBQSw4QkFBOEIsR0FBMEM7SUFDakYsRUFBRSxFQUFFLEVBQUUsS0FBSyxFQUFFO0lBQ2IsRUFBRSxFQUFFLEVBQUUsY0FBYyxFQUFFO0lBQ3RCLEVBQUUsRUFBRSxFQUFFLGtCQUFrQixFQUFFO0VBQzVCO0FBRVcsTUFBQSw4QkFBOEIsR0FBMEM7SUFDakYsRUFBRSxFQUFFLEVBQUUsS0FBSyxFQUFFO0lBQ2IsRUFBRSxFQUFFLEVBQUUsSUFBSSxFQUFFOzs7OzsifQ== | ||
export { | ||
AUTO_COMPLETE_DATE_OPTIONS, | ||
AUTO_COMPLETE_PASSWORD_OPTIONS, | ||
AUTO_COMPLETE_TEXTAREA_OPTIONS, | ||
AUTO_COMPLETE_TEXT_OPTIONS, | ||
INPUT_TYPE_OPTIONS, | ||
INPUT_TYPE_SIMPLE_TEXT_OPTIONS | ||
}; |
@@ -1,4 +0,4 @@ | ||
import type { Dataset } from '@preply/ds-core'; | ||
import { Dataset } from '@preply/ds-core'; | ||
import { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react'; | ||
import type { ARIAInputProps } from '../../accessibility/aria/types'; | ||
import { ARIAInputProps } from '../../accessibility/aria/types'; | ||
export type SimpleTextInputType = 'text' | 'search' | 'email' | 'tel' | 'url'; | ||
@@ -5,0 +5,0 @@ export type SingleLineInputType = SimpleTextInputType | 'password' | 'number' | 'date' | 'time'; |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
import { InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react'; | ||
import type { InputBaseProps } from '../types'; | ||
import { InputBaseProps } from '../types'; | ||
export declare const getTextProps: (props: InputBaseProps) => InputHTMLAttributes<HTMLInputElement>; | ||
@@ -4,0 +4,0 @@ export declare const getDateTimeProps: (props: InputBaseProps) => InputHTMLAttributes<HTMLInputElement>; |
const isText = (props) => { | ||
const { type } = props; | ||
return (type === 'text' || | ||
type === 'search' || | ||
type === 'password' || | ||
type === 'email' || | ||
type === 'tel' || | ||
type === 'url' || | ||
type === 'number' || | ||
type === 'textarea'); | ||
const { type } = props; | ||
return type === "text" || type === "search" || type === "password" || type === "email" || type === "tel" || type === "url" || type === "number" || type === "textarea"; | ||
}; | ||
const isDateTime = (props) => { | ||
const { type } = props; | ||
return type === 'date' || type === 'time'; | ||
const { type } = props; | ||
return type === "date" || type === "time"; | ||
}; | ||
const isBounded = (props) => { | ||
const { type } = props; | ||
return type === 'number' || type === 'date' || type === 'time'; | ||
const { type } = props; | ||
return type === "number" || type === "date" || type === "time"; | ||
}; | ||
const isCheckable = (props) => { | ||
const { type } = props; | ||
return type === 'checkbox'; | ||
const { type } = props; | ||
return type === "checkbox"; | ||
}; | ||
const isRadio = (props) => { | ||
const { type } = props; | ||
return type === 'radio'; | ||
const { type } = props; | ||
return type === "radio"; | ||
}; | ||
const isTextarea = (props) => { | ||
const { type } = props; | ||
return type === 'textarea'; | ||
const { type } = props; | ||
return type === "textarea"; | ||
}; | ||
const isSelect = (props) => { | ||
const { type } = props; | ||
return type === 'select'; | ||
const { type } = props; | ||
return type === "select"; | ||
}; | ||
const getTextProps = (props) => { | ||
if (isText(props)) { | ||
const { value, defaultValue, placeholder, maxLength, autoComplete } = props; | ||
const forcedValue = defaultValue === undefined ? '' : undefined; | ||
const actualValue = value !== undefined ? value : forcedValue; | ||
return { value: actualValue, defaultValue, placeholder, maxLength, autoComplete }; | ||
} | ||
return {}; | ||
if (isText(props)) { | ||
const { value, defaultValue, placeholder, maxLength, autoComplete } = props; | ||
const forcedValue = defaultValue === void 0 ? "" : void 0; | ||
const actualValue = value !== void 0 ? value : forcedValue; | ||
return { value: actualValue, defaultValue, placeholder, maxLength, autoComplete }; | ||
} | ||
return {}; | ||
}; | ||
const getDateTimeProps = (props) => { | ||
if (isDateTime(props)) { | ||
const { value, defaultValue, placeholder, maxLength, autoComplete } = props; | ||
const forcedValue = defaultValue === undefined ? '' : undefined; | ||
const actualValue = value !== undefined ? value : forcedValue; | ||
return { value: actualValue, defaultValue, placeholder, maxLength, autoComplete }; | ||
} | ||
return {}; | ||
if (isDateTime(props)) { | ||
const { value, defaultValue, placeholder, maxLength, autoComplete } = props; | ||
const forcedValue = defaultValue === void 0 ? "" : void 0; | ||
const actualValue = value !== void 0 ? value : forcedValue; | ||
return { value: actualValue, defaultValue, placeholder, maxLength, autoComplete }; | ||
} | ||
return {}; | ||
}; | ||
const getBoundedProps = (props) => { | ||
if (isBounded(props)) { | ||
const { min, max } = props; | ||
return { min, max }; | ||
} | ||
return {}; | ||
if (isBounded(props)) { | ||
const { min, max } = props; | ||
return { min, max }; | ||
} | ||
return {}; | ||
}; | ||
const getTextareaProps = (props) => { | ||
if (isTextarea(props)) { | ||
const { value, defaultValue, rows, placeholder, autoComplete } = props; | ||
const forcedValue = defaultValue === undefined ? '' : undefined; | ||
const actualValue = value !== undefined ? value : forcedValue; | ||
return { value: actualValue, defaultValue, placeholder, rows, autoComplete }; | ||
} | ||
return {}; | ||
if (isTextarea(props)) { | ||
const { value, defaultValue, rows, placeholder, autoComplete } = props; | ||
const forcedValue = defaultValue === void 0 ? "" : void 0; | ||
const actualValue = value !== void 0 ? value : forcedValue; | ||
return { value: actualValue, defaultValue, placeholder, rows, autoComplete }; | ||
} | ||
return {}; | ||
}; | ||
const getCheckableProps = (props) => { | ||
if (isCheckable(props)) { | ||
const { checked } = props; | ||
return { checked }; | ||
} | ||
return {}; | ||
if (isCheckable(props)) { | ||
const { checked } = props; | ||
return { checked }; | ||
} | ||
return {}; | ||
}; | ||
const getRadioProps = (props) => { | ||
if (isRadio(props)) { | ||
const { checked, name } = props; | ||
return { defaultChecked: checked, name }; | ||
} | ||
return {}; | ||
if (isRadio(props)) { | ||
const { checked, name } = props; | ||
return { defaultChecked: checked, name }; | ||
} | ||
return {}; | ||
}; | ||
const getSelectProps = (props) => { | ||
if (isSelect(props)) { | ||
const { value, defaultValue, children } = props; | ||
const forcedValue = defaultValue === undefined ? '' : undefined; | ||
const actualValue = value !== undefined ? value : forcedValue; | ||
return { value: actualValue, defaultValue, children }; | ||
} | ||
return {}; | ||
if (isSelect(props)) { | ||
const { value, defaultValue, children } = props; | ||
const forcedValue = defaultValue === void 0 ? "" : void 0; | ||
const actualValue = value !== void 0 ? value : forcedValue; | ||
return { value: actualValue, defaultValue, children }; | ||
} | ||
return {}; | ||
}; | ||
export { getBoundedProps, getCheckableProps, getDateTimeProps, getRadioProps, getSelectProps, getTextProps, getTextareaProps }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9pbnB1dC9wcml2YXRlL3V0aWxzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IElucHV0SFRNTEF0dHJpYnV0ZXMsIFNlbGVjdEhUTUxBdHRyaWJ1dGVzLCBUZXh0YXJlYUhUTUxBdHRyaWJ1dGVzIH0gZnJvbSAncmVhY3QnO1xuXG5pbXBvcnQgdHlwZSB7IElucHV0QmFzZVByb3BzIH0gZnJvbSAnLi4vdHlwZXMnO1xuXG5pbXBvcnQgdHlwZSB7XG4gICAgSW5wdXRCb3VuZGVkUHJvcHMsXG4gICAgSW5wdXRDaGVja2FibGVQcm9wcyxcbiAgICBJbnB1dENvbW1vblByb3BzLFxuICAgIElucHV0VHlwZVNlbGVjdFByb3BzLFxuICAgIElucHV0VHlwZVRleHRQcm9wcyxcbiAgICBJbnB1dFR5cGVUZXh0YXJlYVByb3BzLFxufSBmcm9tICcuL3R5cGVzJztcblxuY29uc3QgaXNU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LQUFLLEtBQUssU0FBUyxHQUFHLEtBQUssR0FBRyxXQUFXLENBQUM7UUFDOUQsT0FBTyxFQUFFLEtBQUssRUFBRSxXQUFXLEVBQUUsWUFBWSxFQUFFLFFBQVEsRUFBRSxDQUFDO0FBQ3pELEtBQUE7QUFDRCxJQUFBLE9BQU8sRUFBRSxDQUFDO0FBQ2Q7Ozs7In0= | ||
export { | ||
getBoundedProps, | ||
getCheckableProps, | ||
getDateTimeProps, | ||
getRadioProps, | ||
getSelectProps, | ||
getTextProps, | ||
getTextareaProps | ||
}; |
import { ARIAAttributeNames } from '../accessibility/aria/types'; | ||
import type { ValueChangeEventHandler } from '../events'; | ||
import type { InputTypeCheckboxProps, InputTypeDateProps, InputTypeNumberProps, InputTypePasswordProps, InputTypeRadioProps, InputTypeSelectProps, InputTypeTextProps, InputTypeTextareaProps, InputTypeTimeProps, SimpleTextInputType, UnknownInputProps } from './private/types'; | ||
import { ValueChangeEventHandler } from '../events'; | ||
import { InputTypeCheckboxProps, InputTypeDateProps, InputTypeNumberProps, InputTypePasswordProps, InputTypeRadioProps, InputTypeSelectProps, InputTypeTextProps, InputTypeTextareaProps, InputTypeTimeProps, SimpleTextInputType, UnknownInputProps } from './private/types'; | ||
/** | ||
@@ -5,0 +5,0 @@ * private <Input*> components |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
import { HTMLAttributes } from 'react'; | ||
import type { InputBaseProps } from '../types'; | ||
import { InputBaseProps } from '../types'; | ||
export declare const getInputProps: (props: InputBaseProps) => HTMLAttributes<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>; | ||
//# sourceMappingURL=getInputProps.d.ts.map |
@@ -1,14 +0,13 @@ | ||
import { getTextProps, getDateTimeProps, getBoundedProps, getTextareaProps, getCheckableProps, getRadioProps, getSelectProps } from '../private/utils.js'; | ||
import { getTextProps, getDateTimeProps, getBoundedProps, getTextareaProps, getCheckableProps, getRadioProps, getSelectProps } from "../private/utils.js"; | ||
const getInputProps = (props) => ({ | ||
...getTextProps(props), | ||
...getDateTimeProps(props), | ||
...getBoundedProps(props), | ||
...getTextareaProps(props), | ||
...getCheckableProps(props), | ||
...getRadioProps(props), | ||
...getSelectProps(props), | ||
...getTextProps(props), | ||
...getDateTimeProps(props), | ||
...getBoundedProps(props), | ||
...getTextareaProps(props), | ||
...getCheckableProps(props), | ||
...getRadioProps(props), | ||
...getSelectProps(props) | ||
}); | ||
export { getInputProps }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0SW5wdXRQcm9wcy5qcyIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2lucHV0L3V0aWxzL2dldElucHV0UHJvcHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSFRNTEF0dHJpYnV0ZXMgfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB7XG4gICAgZ2V0Qm91bmRlZFByb3BzLFxuICAgIGdldENoZWNrYWJsZVByb3BzLFxuICAgIGdldERhdGVUaW1lUHJvcHMsXG4gICAgZ2V0UmFkaW9Qcm9wcyxcbiAgICBnZXRTZWxlY3RQcm9wcyxcbiAgICBnZXRUZXh0UHJvcHMsXG4gICAgZ2V0VGV4dGFyZWFQcm9wcyxcbn0gZnJvbSAnLi4vcHJpdmF0ZS91dGlscyc7XG5pbXBvcnQgdHlwZSB7IElucHV0QmFzZVByb3BzIH0gZnJvbSAnLi4vdHlwZXMnO1xuXG5leHBvcnQgY29uc3QgZ2V0SW5wdXRQcm9wcyA9IChcbiAgICBwcm9wczogSW5wdXRCYXNlUHJvcHMsXG4pOiBIVE1MQXR0cmlidXRlczxIVE1MSW5wdXRFbGVtZW50IHwgSFRNTFNlbGVjdEVsZW1lbnQgfCBIVE1MVGV4dEFyZWFFbGVtZW50PiA9PiAoe1xuICAgIC4uLmdldFRleHRQcm9wcyhwcm9wcyksXG4gICAgLi4uZ2V0RGF0ZVRpbWVQcm9wcyhwcm9wcyksXG4gICAgLi4uZ2V0Qm91bmRlZFByb3BzKHByb3BzKSxcbiAgICAuLi5nZXRUZXh0YXJlYVByb3BzKHByb3BzKSxcbiAgICAuLi5nZXRDaGVja2FibGVQcm9wcyhwcm9wcyksXG4gICAgLi4uZ2V0UmFkaW9Qcm9wcyhwcm9wcyksXG4gICAgLi4uZ2V0U2VsZWN0UHJvcHMocHJvcHMpLFxufSk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7TUFhYSxhQUFhLEdBQUcsQ0FDekIsS0FBcUIsTUFDeUQ7SUFDOUUsR0FBRyxZQUFZLENBQUMsS0FBSyxDQUFDO0lBQ3RCLEdBQUcsZ0JBQWdCLENBQUMsS0FBSyxDQUFDO0lBQzFCLEdBQUcsZUFBZSxDQUFDLEtBQUssQ0FBQztJQUN6QixHQUFHLGdCQUFnQixDQUFDLEtBQUssQ0FBQztJQUMxQixHQUFHLGlCQUFpQixDQUFDLEtBQUssQ0FBQztJQUMzQixHQUFHLGFBQWEsQ0FBQyxLQUFLLENBQUM7SUFDdkIsR0FBRyxjQUFjLENBQUMsS0FBSyxDQUFDO0FBQzNCLENBQUE7Ozs7In0= | ||
export { | ||
getInputProps | ||
}; |
import { RefObject } from 'react'; | ||
export declare function useForcedRef<T>(): RefObject<T>; | ||
//# sourceMappingURL=useForcedRef.d.ts.map |
@@ -1,12 +0,11 @@ | ||
'use client'; | ||
import { useState, useEffect, useRef } from 'react'; | ||
"use client"; | ||
import { useState, useEffect, useRef } from "react"; | ||
function useForcedRef() { | ||
const [init] = useState(true); | ||
const [, setFauxState] = useState(false); | ||
useEffect(() => setFauxState(init), [init]); | ||
return useRef(null); | ||
const [init] = useState(true); | ||
const [, setFauxState] = useState(false); | ||
useEffect(() => setFauxState(init), [init]); | ||
return useRef(null); | ||
} | ||
export { useForcedRef }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlRm9yY2VkUmVmLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaW5wdXQvdXRpbHMvdXNlRm9yY2VkUmVmLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2UgY2xpZW50JztcblxuaW1wb3J0IHsgUmVmT2JqZWN0LCB1c2VFZmZlY3QsIHVzZVJlZiwgdXNlU3RhdGUgfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBmdW5jdGlvbiB1c2VGb3JjZWRSZWY8VD4oKTogUmVmT2JqZWN0PFQ+IHtcbiAgICBjb25zdCBbaW5pdF0gPSB1c2VTdGF0ZTxib29sZWFuPih0cnVlKTtcbiAgICBjb25zdCBbLCBzZXRGYXV4U3RhdGVdID0gdXNlU3RhdGU8Ym9vbGVhbj4oZmFsc2UpO1xuXG4gICAgdXNlRWZmZWN0KCgpID0+IHNldEZhdXhTdGF0ZShpbml0KSwgW2luaXRdKTtcblxuICAgIHJldHVybiB1c2VSZWY8VD4obnVsbCk7XG59XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O1NBSWdCLFlBQVksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBO0NBQ3hCLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFNLENBQUMsQ0FBSSxDQUFBLENBQUEsQ0FBQSxDQUFDLEdBQUcsQ0FBUSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQVUsQ0FBSSxDQUFBLENBQUEsQ0FBQSxDQUFDLENBQUMsQ0FBQTtDQUN2QyxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBTSxHQUFHLENBQVksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUMsR0FBRyxDQUFRLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBVSxDQUFLLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQyxDQUFDLENBQUE7QUFFbEQsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFTLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFDLENBQU0sQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFZLENBQUMsQ0FBQSxDQUFBLENBQUEsQ0FBSSxDQUFDLENBQUEsQ0FBRSxDQUFDLENBQUEsQ0FBQSxDQUFBLENBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQTtBQUU1QyxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQU8sQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQU0sQ0FBSSxDQUFBLENBQUEsQ0FBQSxDQUFJLENBQUMsQ0FBQyxDQUFBO0FBQzNCLENBQUE7OyJ9 | ||
export { | ||
useForcedRef | ||
}; |
export declare const mapEdgeKeyToStandard: (key: string) => string; | ||
//# sourceMappingURL=index.d.ts.map |
const MAP_EDGE_KEY_TO_STANDARD = { | ||
Win: 'Meta', | ||
Scroll: 'ScrollLock', | ||
Spacebar: ' ', | ||
Down: 'ArrowDown', | ||
Left: 'ArrowLeft', | ||
Right: 'ArrowRight', | ||
Up: 'ArrowUp', | ||
Del: 'Delete', | ||
Apps: 'ContextMenu', | ||
Esc: 'Escape', | ||
Multiply: '*', | ||
Add: '+', | ||
Subtract: '-', | ||
Decimal: '.', | ||
Divide: '/', | ||
Win: "Meta", | ||
Scroll: "ScrollLock", | ||
Spacebar: " ", | ||
Down: "ArrowDown", | ||
Left: "ArrowLeft", | ||
Right: "ArrowRight", | ||
Up: "ArrowUp", | ||
Del: "Delete", | ||
Apps: "ContextMenu", | ||
Esc: "Escape", | ||
Multiply: "*", | ||
Add: "+", | ||
Subtract: "-", | ||
Decimal: ".", | ||
Divide: "/" | ||
}; | ||
const mapEdgeKeyToStandard = (key) => MAP_EDGE_KEY_TO_STANDARD[key] || key; | ||
export { mapEdgeKeyToStandard }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9rZXlib2FyZC9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJ0eXBlIEtleU1hcCA9IHsgW2tleTogc3RyaW5nXTogc3RyaW5nIH07XG5cbmNvbnN0IE1BUF9FREdFX0tFWV9UT19TVEFOREFSRDogS2V5TWFwID0ge1xuICAgIFdpbjogJ01ldGEnLFxuICAgIFNjcm9sbDogJ1Njcm9sbExvY2snLFxuICAgIFNwYWNlYmFyOiAnICcsXG4gICAgRG93bjogJ0Fycm93RG93bicsXG4gICAgTGVmdDogJ0Fycm93TGVmdCcsXG4gICAgUmlnaHQ6ICdBcnJvd1JpZ2h0JyxcbiAgICBVcDogJ0Fycm93VXAnLFxuICAgIERlbDogJ0RlbGV0ZScsXG4gICAgQXBwczogJ0NvbnRleHRNZW51JyxcbiAgICBFc2M6ICdFc2NhcGUnLFxuICAgIE11bHRpcGx5OiAnKicsXG4gICAgQWRkOiAnKycsXG4gICAgU3VidHJhY3Q6ICctJyxcbiAgICBEZWNpbWFsOiAnLicsXG4gICAgRGl2aWRlOiAnLycsXG59O1xuXG5leHBvcnQgY29uc3QgbWFwRWRnZUtleVRvU3RhbmRhcmQgPSAoa2V5OiBzdHJpbmcpOiBzdHJpbmcgPT4gTUFQX0VER0VfS0VZX1RPX1NUQU5EQVJEW2tleV0gfHwga2V5O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE1BQU0sd0JBQXdCLEdBQVc7QUFDckMsSUFBQSxHQUFHLEVBQUUsTUFBTTtBQUNYLElBQUEsTUFBTSxFQUFFLFlBQVk7QUFDcEIsSUFBQSxRQUFRLEVBQUUsR0FBRztBQUNiLElBQUEsSUFBSSxFQUFFLFdBQVc7QUFDakIsSUFBQSxJQUFJLEVBQUUsV0FBVztBQUNqQixJQUFBLEtBQUssRUFBRSxZQUFZO0FBQ25CLElBQUEsRUFBRSxFQUFFLFNBQVM7QUFDYixJQUFBLEdBQUcsRUFBRSxRQUFRO0FBQ2IsSUFBQSxJQUFJLEVBQUUsYUFBYTtBQUNuQixJQUFBLEdBQUcsRUFBRSxRQUFRO0FBQ2IsSUFBQSxRQUFRLEVBQUUsR0FBRztBQUNiLElBQUEsR0FBRyxFQUFFLEdBQUc7QUFDUixJQUFBLFFBQVEsRUFBRSxHQUFHO0FBQ2IsSUFBQSxPQUFPLEVBQUUsR0FBRztBQUNaLElBQUEsTUFBTSxFQUFFLEdBQUc7Q0FDZCxDQUFDO0FBRUssTUFBTSxvQkFBb0IsR0FBRyxDQUFDLEdBQVcsS0FBYSx3QkFBd0IsQ0FBQyxHQUFHLENBQUMsSUFBSTs7OzsifQ== | ||
export { | ||
mapEdgeKeyToStandard | ||
}; |
export declare const currentHref: () => string; | ||
export declare const currentHostname: () => string; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,6 @@ | ||
const currentHref = () => typeof window !== 'undefined' ? window.location.href : ''; | ||
const currentHostname = () => typeof window !== 'undefined' ? window.location.hostname : ''; | ||
export { currentHostname, currentHref }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2NhdGlvbi9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgY3VycmVudEhyZWYgPSAoKTogc3RyaW5nID0+XG4gICAgdHlwZW9mIHdpbmRvdyAhPT0gJ3VuZGVmaW5lZCcgPyB3aW5kb3cubG9jYXRpb24uaHJlZiA6ICcnO1xuXG5leHBvcnQgY29uc3QgY3VycmVudEhvc3RuYW1lID0gKCk6IHN0cmluZyA9PlxuICAgIHR5cGVvZiB3aW5kb3cgIT09ICd1bmRlZmluZWQnID8gd2luZG93LmxvY2F0aW9uLmhvc3RuYW1lIDogJyc7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ik1BQWEsV0FBVyxHQUFHLE1BQ3ZCLE9BQU8sTUFBTSxLQUFLLFdBQVcsR0FBRyxNQUFNLENBQUMsUUFBUSxDQUFDLElBQUksR0FBRyxHQUFHO01BRWpELGVBQWUsR0FBRyxNQUMzQixPQUFPLE1BQU0sS0FBSyxXQUFXLEdBQUcsTUFBTSxDQUFDLFFBQVEsQ0FBQyxRQUFRLEdBQUc7Ozs7In0= | ||
const currentHref = () => typeof window !== "undefined" ? window.location.href : ""; | ||
const currentHostname = () => typeof window !== "undefined" ? window.location.hostname : ""; | ||
export { | ||
currentHostname, | ||
currentHref | ||
}; |
export { minWidth } from './sc/mixins'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,4 @@ | ||
export { minWidth } from './sc/mixins.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= | ||
import { minWidth } from "./sc/mixins.js"; | ||
export { | ||
minWidth | ||
}; |
import { Breakpoint } from '@preply/ds-core'; | ||
export declare const minWidth: (bp: Breakpoint) => string; | ||
//# sourceMappingURL=mixins.d.ts.map |
@@ -1,6 +0,5 @@ | ||
import { BREAKPOINT } from '@preply/ds-core'; | ||
import { BREAKPOINT } from "@preply/ds-core"; | ||
const minWidth = (bp) => `@media (min-width: ${BREAKPOINT[bp]}px)`; | ||
export { minWidth }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWl4aW5zLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcmVzcG9uc2l2ZS9zYy9taXhpbnMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQlJFQUtQT0lOVCwgQnJlYWtwb2ludCB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZSc7XG5cbmV4cG9ydCBjb25zdCBtaW5XaWR0aCA9IChicDogQnJlYWtwb2ludCk6IHN0cmluZyA9PiBgQG1lZGlhIChtaW4td2lkdGg6ICR7QlJFQUtQT0lOVFticF19cHgpYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVPLE1BQU0sUUFBUSxHQUFHLENBQUMsRUFBYyxLQUFhLHNCQUFzQixVQUFVLENBQUMsRUFBRSxDQUFDOzs7OyJ9 | ||
export { | ||
minWidth | ||
}; |
/// <reference types="react" /> | ||
export type HostnameContextState = string | undefined; | ||
export declare const HostnameContext: import("react").Context<HostnameContextState>; | ||
export declare const HostnameContext: import('react').Context<HostnameContextState>; | ||
export interface HostnameContextProps { | ||
@@ -5,0 +5,0 @@ hostname: HostnameContextState; |
@@ -1,7 +0,6 @@ | ||
'use client'; | ||
import { createContext } from 'react'; | ||
const HostnameContext = createContext(undefined); | ||
export { HostnameContext }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSG9zdG5hbWVDb250ZXh0LmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3NyL2NvbnRleHRzL0hvc3RuYW1lQ29udGV4dC50c3giXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBjbGllbnQnO1xuXG5pbXBvcnQgeyBjcmVhdGVDb250ZXh0IH0gZnJvbSAncmVhY3QnO1xuXG5leHBvcnQgdHlwZSBIb3N0bmFtZUNvbnRleHRTdGF0ZSA9IHN0cmluZyB8IHVuZGVmaW5lZDtcblxuZXhwb3J0IGNvbnN0IEhvc3RuYW1lQ29udGV4dCA9IGNyZWF0ZUNvbnRleHQ8SG9zdG5hbWVDb250ZXh0U3RhdGU+KHVuZGVmaW5lZCk7XG5cbmV4cG9ydCBpbnRlcmZhY2UgSG9zdG5hbWVDb250ZXh0UHJvcHMge1xuICAgIGhvc3RuYW1lOiBIb3N0bmFtZUNvbnRleHRTdGF0ZTtcbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7TUFNYSxDQUFlLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBRyxDQUFhLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQXVCLENBQVMsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQTs7In0= | ||
"use client"; | ||
import { createContext } from "react"; | ||
const HostnameContext = createContext(void 0); | ||
export { | ||
HostnameContext | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { HostnameContextState } from '../contexts/HostnameContext'; | ||
import { HostnameContextState } from '../contexts/HostnameContext'; | ||
export declare const useHostname: () => HostnameContextState; | ||
//# sourceMappingURL=useHostname.d.ts.map |
@@ -1,10 +0,9 @@ | ||
import { useContext } from 'react'; | ||
import { HostnameContext } from '../contexts/HostnameContext.js'; | ||
import { useContext } from "react"; | ||
import { HostnameContext } from "../contexts/HostnameContext.js"; | ||
const useHostname = () => { | ||
const hostname = useContext(HostnameContext); | ||
return hostname; | ||
const hostname = useContext(HostnameContext); | ||
return hostname; | ||
}; | ||
export { useHostname }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlSG9zdG5hbWUuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zc3IvaG9va3MvdXNlSG9zdG5hbWUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdXNlQ29udGV4dCB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHR5cGUgeyBIb3N0bmFtZUNvbnRleHRTdGF0ZSB9IGZyb20gJy4uL2NvbnRleHRzL0hvc3RuYW1lQ29udGV4dCc7XG5pbXBvcnQgeyBIb3N0bmFtZUNvbnRleHQgfSBmcm9tICcuLi9jb250ZXh0cy9Ib3N0bmFtZUNvbnRleHQnO1xuXG5leHBvcnQgY29uc3QgdXNlSG9zdG5hbWUgPSAoKTogSG9zdG5hbWVDb250ZXh0U3RhdGUgPT4ge1xuICAgIGNvbnN0IGhvc3RuYW1lID0gdXNlQ29udGV4dChIb3N0bmFtZUNvbnRleHQpO1xuICAgIHJldHVybiBob3N0bmFtZTtcbn07XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBS08sTUFBTSxXQUFXLEdBQUcsTUFBMkI7QUFDbEQsSUFBQSxNQUFNLFFBQVEsR0FBRyxVQUFVLENBQUMsZUFBZSxDQUFDLENBQUM7QUFDN0MsSUFBQSxPQUFPLFFBQVEsQ0FBQztBQUNwQjs7OzsifQ== | ||
export { | ||
useHostname | ||
}; |
@@ -1,11 +0,4 @@ | ||
export type { ServerStyleSheetInterface } from './types'; | ||
export { ServerStyleSheet } from './classes/ServerStyleSheet'; | ||
export type { HostnameContextProps } from './contexts/HostnameContext'; | ||
export { HostnameContext } from './contexts/HostnameContext'; | ||
export type { StyleExtractContextProps } from './contexts/StyleExtractContext'; | ||
export { StyleExtractContext } from './contexts/StyleExtractContext'; | ||
export { withStyleExtract } from './hocs/withStyleExtract'; | ||
export { useClassNameExtract } from './hooks/useClassNameExtract'; | ||
export { useHostname } from './hooks/useHostname'; | ||
export { useStyleExtract } from './hooks/useStyleExtract'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,8 +0,6 @@ | ||
export { ServerStyleSheet } from './classes/ServerStyleSheet.js'; | ||
export { HostnameContext } from './contexts/HostnameContext.js'; | ||
export { StyleExtractContext } from './contexts/StyleExtractContext.js'; | ||
export { withStyleExtract } from './hocs/withStyleExtract.js'; | ||
export { useClassNameExtract } from './hooks/useClassNameExtract.js'; | ||
export { useHostname } from './hooks/useHostname.js'; | ||
export { useStyleExtract } from './hooks/useStyleExtract.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7In0= | ||
import { HostnameContext } from "./contexts/HostnameContext.js"; | ||
import { useHostname } from "./hooks/useHostname.js"; | ||
export { | ||
HostnameContext, | ||
useHostname | ||
}; |
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
import { SVGAttributes } from 'react'; | ||
export type ReactSVGComponentType = React.ComponentType<SVGAttributes<SVGElement>>; | ||
//# sourceMappingURL=types.d.ts.map |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
import { ThemeName } from '@preply/ds-core'; | ||
import type { ThemeTokenMap, Token, TokenValue } from '@preply/ds-core-types'; | ||
import { ThemeTokenMap, Token, TokenValue } from '@preply/ds-core-types'; | ||
import { ColorSchemeInterface } from '../../color-scheme'; | ||
import type { CSSModule } from '../../css-module/types'; | ||
import type { ThemeInterface } from '../types'; | ||
import { ThemeInterface } from '../types'; | ||
export declare class Theme implements ThemeInterface { | ||
static PREFIX: string; | ||
private styles; | ||
private tokens?; | ||
private extend; | ||
readonly name: ThemeName; | ||
constructor(styles: CSSModule, name: ThemeName, extend?: ThemeInterface[], tokens?: ThemeTokenMap); | ||
constructor(name: ThemeName, extend?: ThemeInterface[], tokens?: ThemeTokenMap); | ||
private inheritedToken; | ||
private colorSchemeToken; | ||
getClassName(): string; | ||
/** | ||
* order matters, self styles should follow inherited theme(s) | ||
*/ | ||
getStyles(): CSSModule[]; | ||
getToken(t: Token, colorScheme: ColorSchemeInterface): TokenValue | undefined; | ||
} | ||
//# sourceMappingURL=Theme.d.ts.map |
@@ -1,61 +0,44 @@ | ||
import { TOKEN_ID_FIELD, TOKEN_COLOR_SCHEME_AWARE_FIELD } from '@preply/ds-core-types'; | ||
import { flatten } from '../../array/flatten.js'; | ||
import { moduleClassName } from '../../css-module/classNames.js'; | ||
class Theme { | ||
constructor(styles, name, extend = [], tokens) { | ||
this.styles = styles; | ||
this.name = name; | ||
this.extend = extend; | ||
this.tokens = tokens; | ||
import { TOKEN_ID_FIELD, TOKEN_COLOR_SCHEME_AWARE_FIELD } from "@preply/ds-core-types"; | ||
const _Theme = class _Theme { | ||
constructor(name, extend = [], tokens) { | ||
this.name = name; | ||
this.extend = extend; | ||
this.tokens = tokens; | ||
} | ||
inheritedToken(t, colorScheme) { | ||
let value; | ||
this.extend.find((theme) => { | ||
value = theme.getToken(t, colorScheme); | ||
return value !== void 0; | ||
}); | ||
return value; | ||
} | ||
colorSchemeToken(t, colorScheme) { | ||
const id = t[TOKEN_ID_FIELD]; | ||
const token = this.tokens && this.tokens[`t${id}`]; | ||
if (token) { | ||
let value; | ||
colorScheme.getNames().find((schemeName) => { | ||
value = token[schemeName]; | ||
return value !== void 0; | ||
}); | ||
return value; | ||
} | ||
inheritedToken(t, colorScheme) { | ||
let value; | ||
this.extend.find(theme => { | ||
value = theme.getToken(t, colorScheme); | ||
return value !== undefined; | ||
}); | ||
return value; | ||
return void 0; | ||
} | ||
getToken(t, colorScheme) { | ||
const id = t[TOKEN_ID_FIELD]; | ||
const isColorSchemeAware = t[TOKEN_COLOR_SCHEME_AWARE_FIELD]; | ||
const token = this.tokens && this.tokens[`t${id}`]; | ||
const value = isColorSchemeAware ? this.colorSchemeToken(t, colorScheme) : token; | ||
if (value === void 0 && this.extend) { | ||
return this.inheritedToken(t, colorScheme); | ||
} | ||
colorSchemeToken(t, colorScheme) { | ||
const id = t[TOKEN_ID_FIELD]; | ||
const token = this.tokens && this.tokens[`t${id}`]; | ||
if (token) { | ||
let value; | ||
colorScheme.getNames().find(schemeName => { | ||
value = token[schemeName]; | ||
return value !== undefined; | ||
}); | ||
return value; | ||
} | ||
return undefined; | ||
} | ||
getClassName() { | ||
const extendedClasses = this.extend.map(theme => theme.getClassName()); | ||
const selfClass = moduleClassName(this.styles, Theme.PREFIX + this.name); | ||
return [...extendedClasses, selfClass].join(' '); | ||
} | ||
/** | ||
* order matters, self styles should follow inherited theme(s) | ||
*/ | ||
getStyles() { | ||
const extendedStyles = flatten(this.extend.map(theme => theme.getStyles())) || []; | ||
return [...extendedStyles, this.styles]; | ||
} | ||
getToken(t, colorScheme) { | ||
const id = t[TOKEN_ID_FIELD]; | ||
const isColorSchemeAware = t[TOKEN_COLOR_SCHEME_AWARE_FIELD]; | ||
const token = this.tokens && this.tokens[`t${id}`]; | ||
const value = isColorSchemeAware | ||
? this.colorSchemeToken(t, colorScheme) | ||
: token; | ||
if (value === undefined && this.extend) { | ||
return this.inheritedToken(t, colorScheme); | ||
} | ||
return value; | ||
} | ||
} | ||
Theme.PREFIX = 'ds-'; | ||
export { Theme }; | ||
//# sourceMappingUR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xLQUFLLFNBQVMsSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFO1lBQ3BDLE9BQU8sSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLEVBQUUsV0FBVyxDQUFDLENBQUM7QUFDOUMsU0FBQTtBQUVELFFBQUEsT0FBTyxLQUFLLENBQUM7S0FDaEI7O0FBdkVNLEtBQU0sQ0FBQSxNQUFBLEdBQUcsS0FBSzs7OzsifQ== | ||
return value; | ||
} | ||
}; | ||
_Theme.PREFIX = "ds-"; | ||
let Theme = _Theme; | ||
export { | ||
Theme | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { ThemeContextState } from '../providers/ThemeProvider'; | ||
import { ThemeContextState } from '../providers/ThemeProvider'; | ||
export declare const useSetTheme: () => Pick<ThemeContextState, 'setTheme'>; | ||
//# sourceMappingURL=useSetTheme.d.ts.map |
@@ -1,10 +0,9 @@ | ||
import { useContext } from 'react'; | ||
import { ThemeContext } from '../providers/ThemeProvider.js'; | ||
import { useContext } from "react"; | ||
import { ThemeContext } from "../providers/ThemeProvider.js"; | ||
const useSetTheme = () => { | ||
const { setTheme } = useContext(ThemeContext); | ||
return { setTheme }; | ||
const { setTheme } = useContext(ThemeContext); | ||
return { setTheme }; | ||
}; | ||
export { useSetTheme }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlU2V0VGhlbWUuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90aGVtZS9ob29rcy91c2VTZXRUaGVtZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB1c2VDb250ZXh0IH0gZnJvbSAncmVhY3QnO1xuXG5pbXBvcnQgdHlwZSB7IFRoZW1lQ29udGV4dFN0YXRlIH0gZnJvbSAnLi4vcHJvdmlkZXJzL1RoZW1lUHJvdmlkZXInO1xuaW1wb3J0IHsgVGhlbWVDb250ZXh0IH0gZnJvbSAnLi4vcHJvdmlkZXJzL1RoZW1lUHJvdmlkZXInO1xuXG5leHBvcnQgY29uc3QgdXNlU2V0VGhlbWUgPSAoKTogUGljazxUaGVtZUNvbnRleHRTdGF0ZSwgJ3NldFRoZW1lJz4gPT4ge1xuICAgIGNvbnN0IHsgc2V0VGhlbWUgfSA9IHVzZUNvbnRleHQoVGhlbWVDb250ZXh0KTtcbiAgICByZXR1cm4geyBzZXRUaGVtZSB9O1xufTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFLTyxNQUFNLFdBQVcsR0FBRyxNQUEwQztJQUNqRSxNQUFNLEVBQUUsUUFBUSxFQUFFLEdBQUcsVUFBVSxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQzlDLE9BQU8sRUFBRSxRQUFRLEVBQUUsQ0FBQztBQUN4Qjs7OzsifQ== | ||
export { | ||
useSetTheme | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { ThemeContextState } from '../providers/ThemeProvider'; | ||
import { ThemeContextState } from '../providers/ThemeProvider'; | ||
export declare const useTheme: () => ThemeContextState; | ||
//# sourceMappingURL=useTheme.d.ts.map |
@@ -1,16 +0,12 @@ | ||
import { useContext } from 'react'; | ||
import { useStyleExtract } from '../../ssr/hooks/useStyleExtract.js'; | ||
import { ThemeContext } from '../providers/ThemeProvider.js'; | ||
import { useContext } from "react"; | ||
import { ThemeContext } from "../providers/ThemeProvider.js"; | ||
const useTheme = () => { | ||
const { theme } = useContext(ThemeContext); | ||
if (!theme) { | ||
throw new Error('useTheme() must be used within a ThemeProvider'); | ||
} | ||
const styles = theme.getStyles(); | ||
useStyleExtract(styles); | ||
return { theme }; | ||
const { theme } = useContext(ThemeContext); | ||
if (!theme) { | ||
throw new Error("useTheme() must be used within a ThemeProvider"); | ||
} | ||
return { theme }; | ||
}; | ||
export { useTheme }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlVGhlbWUuanMiLCJzb3VyY2VzIj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QUEsTUFBTSxNQUFNLEdBQUcsS0FBSyxDQUFDLFNBQVMsRUFBRSxDQUFDO0lBQ2pDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUV4QixPQUFPLEVBQUUsS0FBSyxFQUFFLENBQUM7QUFDckI7Ozs7In0= | ||
export { | ||
useTheme | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { ThemesContextState } from '../providers/ThemesProvider'; | ||
import { ThemesContextState } from '../providers/ThemesProvider'; | ||
export declare const useThemes: () => ThemesContextState; | ||
//# sourceMappingURL=useThemes.d.ts.map |
@@ -1,13 +0,12 @@ | ||
import { useContext } from 'react'; | ||
import { ThemesContext } from '../providers/ThemesProvider.js'; | ||
import { useContext } from "react"; | ||
import { ThemesContext } from "../providers/ThemesProvider.js"; | ||
const useThemes = () => { | ||
const { themes, findTheme, findColorScheme } = useContext(ThemesContext); | ||
if (!themes) { | ||
throw new Error('useThemes() must be used within a ThemesProvider'); | ||
} | ||
return { themes, findTheme, findColorScheme }; | ||
const { themes, findTheme, findColorScheme } = useContext(ThemesContext); | ||
if (!themes) { | ||
throw new Error("useThemes() must be used within a ThemesProvider"); | ||
} | ||
return { themes, findTheme, findColorScheme }; | ||
}; | ||
export { useThemes }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlVGhlbWVzLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGhlbWUvaG9va3MvdXNlVGhlbWVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUNvbnRleHQgfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB0eXBlIHsgVGhlbWVzQ29udGV4dFN0YXRlIH0gZnJvbSAnLi4vcHJvdmlkZXJzL1RoZW1lc1Byb3ZpZGVyJztcbmltcG9ydCB7IFRoZW1lc0NvbnRleHQgfSBmcm9tICcuLi9wcm92aWRlcnMvVGhlbWVzUHJvdmlkZXInO1xuXG5leHBvcnQgY29uc3QgdXNlVGhlbWVzID0gKCk6IFRoZW1lc0NvbnRleHRTdGF0ZSA9PiB7XG4gICAgY29uc3QgeyB0aGVtZXMsIGZpbmRUaGVtZSwgZmluZENvbG9yU2NoZW1lIH0gPSB1c2VDb250ZXh0KFRoZW1lc0NvbnRleHQpO1xuICAgIGlmICghdGhlbWVzKSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcigndXNlVGhlbWVzKCkgbXVzdCBiZSB1c2VkIHdpdGhpbiBhIFRoZW1lc1Byb3ZpZGVyJyk7XG4gICAgfVxuICAgIHJldHVybiB7IHRoZW1lcywgZmluZFRoZW1lLCBmaW5kQ29sb3JTY2hlbWUgfTtcbn07XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBS08sTUFBTSxTQUFTLEdBQUcsTUFBeUI7QUFDOUMsSUFBQSxNQUFNLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxlQUFlLEVBQUUsR0FBRyxVQUFVLENBQUMsYUFBYSxDQUFDLENBQUM7SUFDekUsSUFBSSxDQUFDLE1BQU0sRUFBRTtBQUNULFFBQUEsTUFBTSxJQUFJLEtBQUssQ0FBQyxrREFBa0QsQ0FBQyxDQUFDO0FBQ3ZFLEtBQUE7QUFDRCxJQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFFLGVBQWUsRUFBRSxDQUFDO0FBQ2xEOzs7OyJ9 | ||
export { | ||
useThemes | ||
}; |
export type { ThemeInterface } from './types'; | ||
export { Theme } from './classes/Theme'; | ||
export type { ThemesProviderProps } from './providers/ThemesProvider'; | ||
export { ThemesProvider } from './providers/ThemesProvider'; | ||
export type { ThemeProviderProps } from './providers/ThemeProvider'; | ||
export { ThemeProvider } from './providers/ThemeProvider'; | ||
export { ThemesProvider, ThemesContext } from './providers/ThemesProvider'; | ||
export { ThemeContext, ThemeContextProvider } from './providers/ThemeProvider'; | ||
export { useTheme } from './hooks/useTheme'; | ||
export { useThemes } from './hooks/useThemes'; | ||
export { useSetTheme } from './hooks/useSetTheme'; | ||
export type { ThemeProps, WithThemeProps } from './hocs/withTheme'; | ||
export { withTheme } from './hocs/withTheme'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,8 +0,16 @@ | ||
export { Theme } from './classes/Theme.js'; | ||
export { ThemesProvider } from './providers/ThemesProvider.js'; | ||
export { ThemeProvider } from './providers/ThemeProvider.js'; | ||
export { useTheme } from './hooks/useTheme.js'; | ||
export { useThemes } from './hooks/useThemes.js'; | ||
export { useSetTheme } from './hooks/useSetTheme.js'; | ||
export { withTheme } from './hocs/withTheme.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7In0= | ||
import { Theme } from "./classes/Theme.js"; | ||
import { ThemesContext, ThemesProvider } from "./providers/ThemesProvider.js"; | ||
import { ThemeContext, ThemeContextProvider } from "./providers/ThemeProvider.js"; | ||
import { useTheme } from "./hooks/useTheme.js"; | ||
import { useThemes } from "./hooks/useThemes.js"; | ||
import { useSetTheme } from "./hooks/useSetTheme.js"; | ||
export { | ||
Theme, | ||
ThemeContext, | ||
ThemeContextProvider, | ||
ThemesContext, | ||
ThemesProvider, | ||
useSetTheme, | ||
useTheme, | ||
useThemes | ||
}; |
@@ -1,9 +0,4 @@ | ||
import type { ThemeName } from '@preply/ds-core'; | ||
import React, { ReactElement, ReactNode } from 'react'; | ||
import type { ThemeInterface } from '../types'; | ||
export interface ThemeProviderProps { | ||
theme: ThemeName; | ||
tag?: keyof JSX.IntrinsicElements; | ||
children?: ReactNode; | ||
} | ||
import { ThemeName } from '@preply/ds-core'; | ||
import { default as React, ReactNode, ReactElement } from 'react'; | ||
import { ThemeInterface } from '../types'; | ||
type SetTheme = (newTheme: ThemeInterface) => void; | ||
@@ -15,4 +10,8 @@ export interface ThemeContextState { | ||
export declare const ThemeContext: React.Context<ThemeContextState>; | ||
export declare const ThemeProvider: ({ theme: themeName, children, tag: Tag, }: ThemeProviderProps) => ReactElement; | ||
type ThemeContextProviderProps = { | ||
theme: ThemeName; | ||
children: ReactNode; | ||
}; | ||
export declare const ThemeContextProvider: ({ theme: themeName, children, }: ThemeContextProviderProps) => ReactElement; | ||
export {}; | ||
//# sourceMappingURL=ThemeProvider.d.ts.map |
@@ -1,21 +0,17 @@ | ||
'use client'; | ||
import React, { createContext, useContext, useState } from 'react'; | ||
import { ColorSchemeContext } from '../../color-scheme/providers/ColorSchemeProvider.js'; | ||
import { useThemes } from '../hooks/useThemes.js'; | ||
"use client"; | ||
import { jsx } from "react/jsx-runtime"; | ||
import { createContext, useState } from "react"; | ||
import { useThemes } from "../hooks/useThemes.js"; | ||
const ThemeContext = createContext({}); | ||
const ThemeProvider = ({ theme: themeName, children, tag: Tag, }) => { | ||
const { findTheme } = useThemes(); | ||
const { colorScheme } = useContext(ColorSchemeContext); | ||
const [theme, setTheme] = useState(findTheme(themeName)); | ||
if (Tag && !colorScheme) { | ||
throw new Error('ThemeProvider with "tag" prop must be used within a ColorSchemeProvider'); | ||
} | ||
const tagClassNames = Tag && `${theme.getClassName()} ${colorScheme.getClassName()}`; | ||
return (React.createElement(ThemeContext.Provider, { value: { theme, setTheme } }, | ||
Tag && React.createElement(Tag, { className: tagClassNames }, children), | ||
!Tag && children)); | ||
const ThemeContextProvider = ({ | ||
theme: themeName, | ||
children | ||
}) => { | ||
const { findTheme } = useThemes(); | ||
const [theme, setTheme] = useState(findTheme(themeName)); | ||
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { theme, setTheme }, children }); | ||
}; | ||
export { ThemeContext, ThemeProvider }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVGhlbWVQcm92aWRlci5qcyIsInNvdXJjZXMi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xDQUFBLENBQUMsS0FBSyxDQUFFLENBQUEsQ0FBQSxDQUFFLEtBQUssQ0FBRSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBUSxFQUFFLENBQUEsQ0FBQSxDQUFBLENBQUE7UUFDNUMsQ0FBRyxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBSSxvQkFBQyxDQUFBLENBQUEsQ0FBRyxDQUFBLENBQUEsQ0FBQSxDQUFDLFNBQVMsQ0FBRSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQWEsQ0FBRyxDQUFBLENBQUEsQ0FBQSxRQUFRLENBQU8sQ0FBQSxDQUFBO0FBQ3RELENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFDLENBQUEsQ0FBQSxDQUFHLENBQUksQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFRLENBQ0csQ0FDMUIsQ0FBQSxDQUFBO0FBQ04sQ0FBQSxDQUFBOzsifQ== | ||
export { | ||
ThemeContext, | ||
ThemeContextProvider | ||
}; |
@@ -1,5 +0,5 @@ | ||
import type { ColorSchemeName, ThemeName } from '@preply/ds-core'; | ||
import React, { FC, ReactNode } from 'react'; | ||
import type { ColorSchemeInterface } from '../../color-scheme/types'; | ||
import type { ThemeInterface } from '../types'; | ||
import { ColorSchemeName, ThemeName } from '@preply/ds-core'; | ||
import { default as React, FC, ReactNode } from 'react'; | ||
import { ColorSchemeInterface } from '../../color-scheme/types'; | ||
import { ThemeInterface } from '../types'; | ||
export interface ThemesProviderProps { | ||
@@ -6,0 +6,0 @@ themes: ThemeInterface[]; |
@@ -1,24 +0,25 @@ | ||
'use client'; | ||
import React, { createContext } from 'react'; | ||
"use client"; | ||
import { jsx } from "react/jsx-runtime"; | ||
import { createContext } from "react"; | ||
const ThemesContext = createContext({}); | ||
const ThemesProvider = ({ themes, colorSchemes, children }) => { | ||
const findTheme = (name) => { | ||
const t = themes.find(theme => theme.name === name); | ||
if (!t) { | ||
throw new Error(`Unknown theme ${name}`); | ||
} | ||
return t; | ||
}; | ||
const findColorScheme = (name) => { | ||
const s = colorSchemes.find(theme => theme.name === name); | ||
if (!s) { | ||
throw new Error(`Unknown color scheme ${name}`); | ||
} | ||
return s; | ||
}; | ||
return (React.createElement(ThemesContext.Provider, { value: { themes, findTheme, findColorScheme } }, children)); | ||
const findTheme = (name) => { | ||
const t = themes.find((theme) => theme.name === name); | ||
if (!t) { | ||
throw new Error(`Unknown theme ${name}`); | ||
} | ||
return t; | ||
}; | ||
const findColorScheme = (name) => { | ||
const s = colorSchemes.find((theme) => theme.name === name); | ||
if (!s) { | ||
throw new Error(`Unknown color scheme ${name}`); | ||
} | ||
return s; | ||
}; | ||
return /* @__PURE__ */ jsx(ThemesContext.Provider, { value: { themes, findTheme, findColorScheme }, children }); | ||
}; | ||
export { ThemesContext, ThemesProvider }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVGhlbWVzUHJvdmlkZXIuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90aGVtZS9wcm92aWRlcnMvVGhlbWVzUHJvdmlkZXIudHN4Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2UgY2xpZW50JztcblxuaW1wb3J0IHR5cGUgeyBDb2xvclNjaGVtZU5hbWUsIFRoZW1lTmFtZSB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZSc7XG5pbXBvcnQgUmVhY3QsIHsgRkMsIFJlYWN0Tm9kZSwgY3JlYXRlQ29udGV4dCB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHR5cGUgeyBDb2xvclNjaGVtZUludGVyZmFjZSB9IGZyb20gJy4uLy4uL2N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BQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQyxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBSyxFQUFFLENBQUUsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBTSxDQUFFLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQVMsQ0FBRSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFlLEVBQUUsSUFDaEUsQ0FBUSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQ1ksQ0FDM0IsQ0FBQSxDQUFBO0FBQ04sQ0FBQSxDQUFBOzsifQ== | ||
export { | ||
ThemesContext, | ||
ThemesProvider | ||
}; |
import { ThemeName } from '@preply/ds-core'; | ||
import { Token, TokenValue } from '@preply/ds-core-types'; | ||
import { ColorSchemeInterface } from '../color-scheme'; | ||
import { CSSModule } from '../css-module/types'; | ||
export interface ThemeInterface { | ||
name: ThemeName; | ||
getClassName(): string; | ||
getStyles(): CSSModule[]; | ||
getToken(token: Token, colorScheme: ColorSchemeInterface): TokenValue | undefined; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
@@ -1,2 +0,2 @@ | ||
import type { Token, TokenValue } from '@preply/ds-core-types'; | ||
import { Token, TokenValue } from '@preply/ds-core-types'; | ||
import { ComponentType, FC } from 'react'; | ||
@@ -3,0 +3,0 @@ export interface GetTokenProps { |
@@ -1,19 +0,26 @@ | ||
'use client'; | ||
import React from 'react'; | ||
import { getToken } from '../private/getToken.js'; | ||
import { useTheme } from '../../theme/hooks/useTheme.js'; | ||
import { useColorScheme } from '../../color-scheme/hooks/useColorScheme.js'; | ||
"use client"; | ||
import { jsx } from "react/jsx-runtime"; | ||
import "../../color-scheme/colorSchemes.js"; | ||
import "../../color-scheme/classes/ColorScheme.js"; | ||
import "../../color-scheme/providers/ColorSchemeProvider.js"; | ||
import { useColorScheme } from "../../color-scheme/hooks/useColorScheme.js"; | ||
import "@preply/ds-core"; | ||
import "react"; | ||
import "../../theme/providers/ThemesProvider.js"; | ||
import "../../theme/classes/Theme.js"; | ||
import "../../theme/providers/ThemeProvider.js"; | ||
import { useTheme } from "../../theme/hooks/useTheme.js"; | ||
import { getToken } from "../private/getToken.js"; | ||
function withGetToken(Component) { | ||
const Wrapper = ({ ...props }) => { | ||
const { theme } = useTheme(); | ||
const { colorScheme } = useColorScheme(); | ||
const getToken$1 = (token) => getToken(theme, colorScheme, token); | ||
return React.createElement(Component, { ...props, getToken: getToken$1 }); | ||
}; | ||
Wrapper.displayName = `withGetToken(${Component.displayName})`; | ||
return Wrapper; | ||
const Wrapper = ({ ...props }) => { | ||
const { theme } = useTheme(); | ||
const { colorScheme } = useColorScheme(); | ||
const getToken$1 = (token) => getToken(theme, colorScheme, token); | ||
return /* @__PURE__ */ jsx(Component, { ...props, getToken: getToken$1 }); | ||
}; | ||
Wrapper.displayName = `withGetToken(${Component.displayName})`; | ||
return Wrapper; | ||
} | ||
export { withGetToken }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2l0aEdldFRva2VuLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdG9rZW4vaG9jcy93aXRoR2V0VG9rZW4udHN4Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2UgY2xpZW50JztcblxuaW1wb3J0IHR5cGUgeyBUb2tlbiwgVG9rZW5WYWx1ZSB9IGZyb20gJ0BwcmVwbHkv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QUEsQ0FBQyxDQUFDLENBQUE7SUFFRixDQUFPLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUMsQ0FBVyxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFHLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFnQixDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFTLENBQUMsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFXLEdBQUcsQ0FBQyxDQUFBO0FBQy9ELENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBQSxDQUFBLENBQUEsQ0FBTyxPQUFPLENBQUMsQ0FBQTtBQUNuQixDQUFBOzsifQ== | ||
export { | ||
withGetToken | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { Token, TokenValue } from '@preply/ds-core-types'; | ||
import { Token, TokenValue } from '@preply/ds-core-types'; | ||
export declare function useToken<T extends TokenValue>(token: Token): T; | ||
//# sourceMappingURL=useToken.d.ts.map |
@@ -1,15 +0,23 @@ | ||
import { getToken } from '../private/getToken.js'; | ||
import { useTheme } from '../../theme/hooks/useTheme.js'; | ||
import { useColorScheme } from '../../color-scheme/hooks/useColorScheme.js'; | ||
import "../../color-scheme/colorSchemes.js"; | ||
import "../../color-scheme/classes/ColorScheme.js"; | ||
import "../../color-scheme/providers/ColorSchemeProvider.js"; | ||
import { useColorScheme } from "../../color-scheme/hooks/useColorScheme.js"; | ||
import "react/jsx-runtime"; | ||
import "@preply/ds-core"; | ||
import "react"; | ||
import "../../theme/providers/ThemesProvider.js"; | ||
import "../../theme/classes/Theme.js"; | ||
import "../../theme/providers/ThemeProvider.js"; | ||
import { useTheme } from "../../theme/hooks/useTheme.js"; | ||
import { getToken } from "../private/getToken.js"; | ||
function useToken(token) { | ||
const { theme } = useTheme(); | ||
const { colorScheme } = useColorScheme(); | ||
if (!theme) { | ||
throw new Error('useToken() must be used within a ThemeProvider'); | ||
} | ||
return getToken(theme, colorScheme, token); | ||
const { theme } = useTheme(); | ||
const { colorScheme } = useColorScheme(); | ||
if (!theme) { | ||
throw new Error("useToken() must be used within a ThemeProvider"); | ||
} | ||
return getToken(theme, colorScheme, token); | ||
} | ||
export { useToken }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlVG9rZW4uanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90b2tlbi9ob29rcy91c2VUb2tlbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFRva2VuLCBUb2tlblZhbHVlIH0gZnJvbSAnQHByZXBseS9kcy1jb3JlLXR5cGVzJztcblxuaW1wb3J0IHsgdXNlQ29sb3JTY2hlbWUgfSBmcm9tICcuLi8uLi9jb2xvci1zY2hlbWUnO1xuaW1wb3J0IHsgdXNlVGhlbWUgfSBmcm9tICcuLi8uLi90aGVtZSc7XG5pbXBvcnQgeyBnZXRUb2tlbiB9IGZyb20gJy4uL3ByaXZhdGUvZ2V0VG9rZW4nO1xuXG5leHBvcnQgZnVuY3Rpb24gdXNlVG9rZW48VCBleHRlbmRzIFRva2VuVmFsdWU+KHRva2VuOiBUb2tlbik6IFQge1xuICAgIGNvbnN0IHsgdGhlbWUgfSA9IHVzZVRoZW1lKCk7XG4gICAgY29uc3QgeyBjb2xvclNjaGVtZSB9ID0gdXNlQ29sb3JTY2hlbWUoKTtcblxuICAgIGlmICghdGhlbWUpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1c2VUb2tlbigpIG11c3QgYmUgdXNlZCB3aXRoaW4gYSBUaGVtZVByb3ZpZGVyJyk7XG4gICAgfVxuXG4gICAgcmV0dXJuIGdldFRva2VuPFQ+KHRoZW1lLCBjb2xvclNjaGVtZSwgdG9rZW4pO1xufVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFNTSxTQUFVLFFBQVEsQ0FBdUIsS0FBWSxFQUFBO0FBQ3ZELElBQUEsTUFBTSxFQUFFLEtBQUssRUFBRSxHQUFHLFFBQVEsRUFBRSxDQUFDO0FBQzdCLElBQUEsTUFBTSxFQUFFLFdBQVcsRUFBRSxHQUFHLGNBQWMsRUFBRSxDQUFDO0lBRXpDLElBQUksQ0FBQyxLQUFLLEVBQUU7QUFDUixRQUFBLE1BQU0sSUFBSSxLQUFLLENBQUMsZ0RBQWdELENBQUMsQ0FBQztBQUNyRSxLQUFBO0lBRUQsT0FBTyxRQUFRLENBQUksS0FBSyxFQUFFLFdBQVcsRUFBRSxLQUFLLENBQUMsQ0FBQztBQUNsRDs7OzsifQ== | ||
export { | ||
useToken | ||
}; |
@@ -0,0 +0,0 @@ export { getTokenVar } from './util/getTokenVar'; |
@@ -1,4 +0,8 @@ | ||
export { getTokenVar } from './util/getTokenVar.js'; | ||
export { useToken } from './hooks/useToken.js'; | ||
export { withGetToken } from './hocs/withGetToken.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzsifQ== | ||
import { getTokenVar } from "./util/getTokenVar.js"; | ||
import { useToken } from "./hooks/useToken.js"; | ||
import { withGetToken } from "./hocs/withGetToken.js"; | ||
export { | ||
getTokenVar, | ||
useToken, | ||
withGetToken | ||
}; |
@@ -0,0 +0,0 @@ import { Token, TokenValue } from '@preply/ds-core-types'; |
@@ -1,20 +0,19 @@ | ||
import { TOKEN_ID_FIELD } from '@preply/ds-core-types'; | ||
import { TOKEN_ID_FIELD } from "@preply/ds-core-types"; | ||
const ERROR_MESSAGE = 'Illegal "token" argument provided to getToken(). Are you using indexes? Example: "tokens.action.size[size]". Make sure it resolves to a token.'; | ||
const getToken = (theme, colorScheme, token) => { | ||
if (!token) { | ||
throw new Error(`No token provided. ${ERROR_MESSAGE}`); | ||
} | ||
if (!Array.isArray(token)) { | ||
throw new Error(`Value provided is not a token. ${ERROR_MESSAGE}`); | ||
} | ||
const value = theme.getToken(token, colorScheme); | ||
const id = token[TOKEN_ID_FIELD]; | ||
if (value === undefined) { | ||
throw new Error(`Token ${id} not found`); | ||
} | ||
return value; | ||
if (!token) { | ||
throw new Error(`No token provided. ${ERROR_MESSAGE}`); | ||
} | ||
if (!Array.isArray(token)) { | ||
throw new Error(`Value provided is not a token. ${ERROR_MESSAGE}`); | ||
} | ||
const value = theme.getToken(token, colorScheme); | ||
const id = token[TOKEN_ID_FIELD]; | ||
if (value === void 0) { | ||
throw new Error(`Token ${id} not found`); | ||
} | ||
return value; | ||
}; | ||
export { getToken }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0VG9rZW4uanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90b2tlbi9wcml2YXRlL2dldFRva2VuLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRPS0VOX0lEX0ZJRUxELCBUb2tlbiwgVG9rZW5WYWx1ZSB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZS10eXBlcyc7XG5cbmltcG9ydCB7IENvbG9yU2NoZW1lSW50ZXJmYWNlIH0gZnJvbSAnLi4vLi4vY29sb3Itc2NoZW1lJztcbmltcG9ydCB7IFRoZW1lSW50ZXJmYWNlIH0gZnJvbSAnLi4vLi4vdGhlbWUnO1xuXG5jb25zdCBFUlJPUl9NRVNTQUdFID1cbiAgICAnSWxsZWdhbCBcInRva2Vu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gbm90IGZvdW5kYCk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHZhbHVlIGFzIFQ7XG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBS0EsTUFBTSxhQUFhLEdBQ2YsZ0pBQWdKLENBQUM7QUFReEksTUFBQSxRQUFRLEdBQWEsQ0FDOUIsS0FBcUIsRUFDckIsV0FBaUMsRUFDakMsS0FBWSxLQUNaO0lBQ0EsSUFBSSxDQUFDLEtBQUssRUFBRTtBQUNSLFFBQUEsTUFBTSxJQUFJLEtBQUssQ0FBQyxzQkFBc0IsYUFBYSxDQUFBLENBQUUsQ0FBQyxDQUFDO0FBQzFELEtBQUE7QUFDRCxJQUFBLElBQUksQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxFQUFFO0FBQ3ZCLFFBQUEsTUFBTSxJQUFJLEtBQUssQ0FBQyxrQ0FBa0MsYUFBYSxDQUFBLENBQUUsQ0FBQyxDQUFDO0FBQ3RFLEtBQUE7SUFFRCxNQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxXQUFXLENBQUMsQ0FBQztBQUVqRCxJQUFBLE1BQU0sRUFBRSxHQUFHLEtBQUssQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUNqQyxJQUFJLEtBQUssS0FBSyxTQUFTLEVBQUU7QUFDckIsUUFBQSxNQUFNLElBQUksS0FBSyxDQUFDLFNBQVMsRUFBRSxDQUFBLFVBQUEsQ0FBWSxDQUFDLENBQUM7QUFDNUMsS0FBQTtBQUVELElBQUEsT0FBTyxLQUFVLENBQUM7QUFDdEI7Ozs7In0= | ||
export { | ||
getToken | ||
}; |
import { Token } from '@preply/ds-core-types'; | ||
export declare function getTokenVar(token: Token): string; | ||
//# sourceMappingURL=getTokenVar.d.ts.map |
@@ -1,9 +0,8 @@ | ||
import { TOKEN_ID_FIELD } from '@preply/ds-core-types'; | ||
import { TOKEN_ID_FIELD } from "@preply/ds-core-types"; | ||
function getTokenVar(token) { | ||
const id = token[TOKEN_ID_FIELD]; | ||
return `var(--${id})`; | ||
const id = token[TOKEN_ID_FIELD]; | ||
return `var(--${id})`; | ||
} | ||
export { getTokenVar }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0VG9rZW5WYXIuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90b2tlbi91dGlsL2dldFRva2VuVmFyLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRPS0VOX0lEX0ZJRUxELCBUb2tlbiB9IGZyb20gJ0BwcmVwbHkvZHMtY29yZS10eXBlcyc7XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRUb2tlblZhcih0b2tlbjogVG9rZW4pOiBzdHJpbmcge1xuICAgIGNvbnN0IGlkID0gdG9rZW5bVE9LRU5fSURfRklFTERdO1xuICAgIHJldHVybiBgdmFyKC0tJHtpZH0pYDtcbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVNLFNBQVUsV0FBVyxDQUFDLEtBQVksRUFBQTtBQUNwQyxJQUFBLE1BQU0sRUFBRSxHQUFHLEtBQUssQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUNqQyxPQUFPLENBQUEsTUFBQSxFQUFTLEVBQUUsQ0FBQSxDQUFBLENBQUcsQ0FBQztBQUMxQjs7OzsifQ== | ||
export { | ||
getTokenVar | ||
}; |
@@ -0,0 +0,0 @@ export type AnchorProps = { |
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= |
export declare const domainOf: (url: string | undefined) => string | undefined; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,9 +0,8 @@ | ||
// eslint-disable-next-line security/detect-unsafe-regex | ||
const BERNERS_LEE_REGEXP = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; | ||
const domainOf = (url) => { | ||
const matches = url && url.match(BERNERS_LEE_REGEXP); | ||
return matches && matches[4] ? matches[4] : undefined; | ||
const matches = url && url.match(BERNERS_LEE_REGEXP); | ||
return matches && matches[4] ? matches[4] : void 0; | ||
}; | ||
export { domainOf }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cmwvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIHNlY3VyaXR5L2RldGVjdC11bnNhZmUtcmVnZXhcbmNvbnN0IEJFUk5FUlNfTEVFX1JFR0VYUCA9IC9eKChbXjovPyNdKyk6KT8oXFwvXFwvKFteLz8jXSopKT8oW14/I10qKShcXD8oW14jXSopKT8oIyguKikpPy87XG5cbmV4cG9ydCBjb25zdCBkb21haW5PZiA9ICh1cmw6IHN0cmluZyB8IHVuZGVmaW5lZCk6IHN0cmluZyB8IHVuZGVmaW5lZCA9PiB7XG4gICAgY29uc3QgbWF0Y2hlcyA9IHVybCAmJiB1cmwubWF0Y2goQkVSTkVSU19MRUVfUkVHRVhQKTtcblxuICAgIHJldHVybiBtYXRjaGVzICYmIG1hdGNoZXNbNF0gPyBtYXRjaGVzWzRdIDogdW5kZWZpbmVkO1xufTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUNBLE1BQU0sa0JBQWtCLEdBQUcsNkRBQTZELENBQUM7QUFFNUUsTUFBQSxRQUFRLEdBQUcsQ0FBQyxHQUF1QixLQUF3QjtJQUNwRSxNQUFNLE9BQU8sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBRXJELElBQUEsT0FBTyxPQUFPLElBQUksT0FBTyxDQUFDLENBQUMsQ0FBQyxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsR0FBRyxTQUFTLENBQUM7QUFDMUQ7Ozs7In0= | ||
export { | ||
domainOf | ||
}; |
{ | ||
"name": "@preply/ds-web-core", | ||
"version": "0.99.1-beta.22520120a5c75760a7e3556443f375b03c4fe7c1.0+2252012", | ||
"version": "0.99.1-beta.6fcddb3f3b82fb62293b4c54958750a8ce252183.0+6fcddb3", | ||
"type": "module", | ||
@@ -16,10 +16,9 @@ "publishConfig": { | ||
"clean": "rm -rf dist && rm -rf src/generated", | ||
"test": "run --top-level vitest --coverage --watch=false", | ||
"build": "NODE_ENV=production && run build:rollup", | ||
"build:rollup": "run --top-level rollup -c rollup.config.cjs", | ||
"dev": "run build:rollup -w" | ||
"test": "run --top-level vitest --coverage --watch=false --config=../../vitest.config.ts", | ||
"build": "run --top-level vite build", | ||
"dev": "run --top-level vite build --watch" | ||
}, | ||
"dependencies": { | ||
"@preply/ds-core": "^0.99.1-beta.22520120a5c75760a7e3556443f375b03c4fe7c1.0+2252012", | ||
"@preply/ds-core-types": "^0.99.1-beta.22520120a5c75760a7e3556443f375b03c4fe7c1.0+2252012" | ||
"@preply/ds-core": "^0.99.1-beta.6fcddb3f3b82fb62293b4c54958750a8ce252183.0+6fcddb3", | ||
"@preply/ds-core-types": "^0.99.1-beta.6fcddb3f3b82fb62293b4c54958750a8ce252183.0+6fcddb3" | ||
}, | ||
@@ -32,3 +31,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "22520120a5c75760a7e3556443f375b03c4fe7c1" | ||
"gitHead": "6fcddb3f3b82fb62293b4c54958750a8ce252183" | ||
} |
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1
259947
215
2042
2