@jakubmazanec/ui 0.1.0-next.86bf251
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/build/components/Button.d.ts +40 -0
- package/build/components/Button.js +139 -0
- package/build/components/Button.js.map +7 -0
- package/build/components/Card.d.ts +19 -0
- package/build/components/Card.js +26 -0
- package/build/components/Card.js.map +7 -0
- package/build/components/Checkbox.d.ts +39 -0
- package/build/components/Checkbox.js +87 -0
- package/build/components/Checkbox.js.map +7 -0
- package/build/components/CheckboxField.d.ts +18 -0
- package/build/components/CheckboxField.js +22 -0
- package/build/components/CheckboxField.js.map +7 -0
- package/build/components/Combobox.d.ts +57 -0
- package/build/components/Combobox.js +178 -0
- package/build/components/Combobox.js.map +7 -0
- package/build/components/ComboboxOption.d.ts +33 -0
- package/build/components/ComboboxOption.js +59 -0
- package/build/components/ComboboxOption.js.map +7 -0
- package/build/components/Container.d.ts +36 -0
- package/build/components/Container.js +63 -0
- package/build/components/Container.js.map +7 -0
- package/build/components/Description.d.ts +19 -0
- package/build/components/Description.js +28 -0
- package/build/components/Description.js.map +7 -0
- package/build/components/Dialog.d.ts +32 -0
- package/build/components/Dialog.js +55 -0
- package/build/components/Dialog.js.map +7 -0
- package/build/components/DialogPanel.d.ts +19 -0
- package/build/components/DialogPanel.js +29 -0
- package/build/components/DialogPanel.js.map +7 -0
- package/build/components/DialogTitle.d.ts +19 -0
- package/build/components/DialogTitle.js +28 -0
- package/build/components/DialogTitle.js.map +7 -0
- package/build/components/Error.d.ts +19 -0
- package/build/components/Error.js +37 -0
- package/build/components/Error.js.map +7 -0
- package/build/components/Field.d.ts +22 -0
- package/build/components/Field.js +32 -0
- package/build/components/Field.js.map +7 -0
- package/build/components/Fieldset.d.ts +27 -0
- package/build/components/Fieldset.js +39 -0
- package/build/components/Fieldset.js.map +7 -0
- package/build/components/Form.d.ts +22 -0
- package/build/components/Form.js +41 -0
- package/build/components/Form.js.map +7 -0
- package/build/components/Icon.d.ts +32 -0
- package/build/components/Icon.js +65 -0
- package/build/components/Icon.js.map +7 -0
- package/build/components/Input.d.ts +37 -0
- package/build/components/Input.js +111 -0
- package/build/components/Input.js.map +7 -0
- package/build/components/Label.d.ts +19 -0
- package/build/components/Label.js +26 -0
- package/build/components/Label.js.map +7 -0
- package/build/components/Legend.d.ts +19 -0
- package/build/components/Legend.js +26 -0
- package/build/components/Legend.js.map +7 -0
- package/build/components/Listbox.d.ts +59 -0
- package/build/components/Listbox.js +254 -0
- package/build/components/Listbox.js.map +7 -0
- package/build/components/ListboxOption.d.ts +33 -0
- package/build/components/ListboxOption.js +59 -0
- package/build/components/ListboxOption.js.map +7 -0
- package/build/components/Menu.d.ts +21 -0
- package/build/components/Menu.js +29 -0
- package/build/components/Menu.js.map +7 -0
- package/build/components/MenuButton.d.ts +27 -0
- package/build/components/MenuButton.js +45 -0
- package/build/components/MenuButton.js.map +7 -0
- package/build/components/MenuHeading.d.ts +19 -0
- package/build/components/MenuHeading.js +28 -0
- package/build/components/MenuHeading.js.map +7 -0
- package/build/components/MenuItem.d.ts +27 -0
- package/build/components/MenuItem.js +39 -0
- package/build/components/MenuItem.js.map +7 -0
- package/build/components/MenuItems.d.ts +22 -0
- package/build/components/MenuItems.js +36 -0
- package/build/components/MenuItems.js.map +7 -0
- package/build/components/MenuSection.d.ts +19 -0
- package/build/components/MenuSection.js +28 -0
- package/build/components/MenuSection.js.map +7 -0
- package/build/components/MenuSeparator.d.ts +19 -0
- package/build/components/MenuSeparator.js +28 -0
- package/build/components/MenuSeparator.js.map +7 -0
- package/build/components/Popover.d.ts +19 -0
- package/build/components/Popover.js +28 -0
- package/build/components/Popover.js.map +7 -0
- package/build/components/PopoverBackdrop.d.ts +19 -0
- package/build/components/PopoverBackdrop.js +28 -0
- package/build/components/PopoverBackdrop.js.map +7 -0
- package/build/components/PopoverButton.d.ts +29 -0
- package/build/components/PopoverButton.js +47 -0
- package/build/components/PopoverButton.js.map +7 -0
- package/build/components/PopoverGroup.d.ts +19 -0
- package/build/components/PopoverGroup.js +28 -0
- package/build/components/PopoverGroup.js.map +7 -0
- package/build/components/PopoverPanel.d.ts +24 -0
- package/build/components/PopoverPanel.js +38 -0
- package/build/components/PopoverPanel.js.map +7 -0
- package/build/components/Radio.d.ts +33 -0
- package/build/components/Radio.js +57 -0
- package/build/components/Radio.js.map +7 -0
- package/build/components/RadioField.d.ts +11 -0
- package/build/components/RadioField.js +15 -0
- package/build/components/RadioField.js.map +7 -0
- package/build/components/RadioGroup.d.ts +34 -0
- package/build/components/RadioGroup.js +87 -0
- package/build/components/RadioGroup.js.map +7 -0
- package/build/components/Spinner.d.ts +21 -0
- package/build/components/Spinner.js +70 -0
- package/build/components/Spinner.js.map +7 -0
- package/build/components/Table.d.ts +19 -0
- package/build/components/Table.js +26 -0
- package/build/components/Table.js.map +7 -0
- package/build/components/TableBody.d.ts +19 -0
- package/build/components/TableBody.js +26 -0
- package/build/components/TableBody.js.map +7 -0
- package/build/components/TableCaption.d.ts +19 -0
- package/build/components/TableCaption.js +31 -0
- package/build/components/TableCaption.js.map +7 -0
- package/build/components/TableCell.d.ts +19 -0
- package/build/components/TableCell.js +26 -0
- package/build/components/TableCell.js.map +7 -0
- package/build/components/TableFoot.d.ts +19 -0
- package/build/components/TableFoot.js +26 -0
- package/build/components/TableFoot.js.map +7 -0
- package/build/components/TableHead.d.ts +19 -0
- package/build/components/TableHead.js +26 -0
- package/build/components/TableHead.js.map +7 -0
- package/build/components/TableHeader.d.ts +19 -0
- package/build/components/TableHeader.js +26 -0
- package/build/components/TableHeader.js.map +7 -0
- package/build/components/TableRow.d.ts +19 -0
- package/build/components/TableRow.js +26 -0
- package/build/components/TableRow.js.map +7 -0
- package/build/components/Text.d.ts +27 -0
- package/build/components/Text.js +43 -0
- package/build/components/Text.js.map +7 -0
- package/build/components/Textarea.d.ts +34 -0
- package/build/components/Textarea.js +78 -0
- package/build/components/Textarea.js.map +7 -0
- package/build/components/data-table/DataTable.d.ts +39 -0
- package/build/components/data-table/DataTable.js +276 -0
- package/build/components/data-table/DataTable.js.map +7 -0
- package/build/components/data-table/DataTableColumnOrder.d.ts +3 -0
- package/build/components/data-table/DataTableColumnOrder.js +4 -0
- package/build/components/data-table/DataTableColumnOrder.js.map +7 -0
- package/build/components/data-table/DataTableColumnPinning.d.ts +3 -0
- package/build/components/data-table/DataTableColumnPinning.js +4 -0
- package/build/components/data-table/DataTableColumnPinning.js.map +7 -0
- package/build/components/data-table/DataTableColumnVisibility.d.ts +3 -0
- package/build/components/data-table/DataTableColumnVisibility.js +4 -0
- package/build/components/data-table/DataTableColumnVisibility.js.map +7 -0
- package/build/components/data-table/DataTableFaceting.d.ts +15 -0
- package/build/components/data-table/DataTableFaceting.js +11 -0
- package/build/components/data-table/DataTableFaceting.js.map +7 -0
- package/build/components/data-table/DataTableFilters.d.ts +12 -0
- package/build/components/data-table/DataTableFilters.js +15 -0
- package/build/components/data-table/DataTableFilters.js.map +7 -0
- package/build/components/data-table/DataTablePagination.d.ts +16 -0
- package/build/components/data-table/DataTablePagination.js +16 -0
- package/build/components/data-table/DataTablePagination.js.map +7 -0
- package/build/components/data-table/DataTableSearch.d.ts +3 -0
- package/build/components/data-table/DataTableSearch.js +4 -0
- package/build/components/data-table/DataTableSearch.js.map +7 -0
- package/build/components/data-table/DataTableSorting.d.ts +12 -0
- package/build/components/data-table/DataTableSorting.js +10 -0
- package/build/components/data-table/DataTableSorting.js.map +7 -0
- package/build/components/data-table/internals/DataTableHeader.d.ts +15 -0
- package/build/components/data-table/internals/DataTableHeader.js +194 -0
- package/build/components/data-table/internals/DataTableHeader.js.map +7 -0
- package/build/components/data-table/internals/DataTableHeaderColumnCheckbox.d.ts +6 -0
- package/build/components/data-table/internals/DataTableHeaderColumnCheckbox.js +36 -0
- package/build/components/data-table/internals/DataTableHeaderColumnCheckbox.js.map +7 -0
- package/build/components/data-table/internals/DataTableHeaderFilter.d.ts +12 -0
- package/build/components/data-table/internals/DataTableHeaderFilter.js +264 -0
- package/build/components/data-table/internals/DataTableHeaderFilter.js.map +7 -0
- package/build/components/data-table/internals/DataTablePageButton.d.ts +6 -0
- package/build/components/data-table/internals/DataTablePageButton.js +11 -0
- package/build/components/data-table/internals/DataTablePageButton.js.map +7 -0
- package/build/components/data-table/internals/DataTablePagination.d.ts +12 -0
- package/build/components/data-table/internals/DataTablePagination.js +190 -0
- package/build/components/data-table/internals/DataTablePagination.js.map +7 -0
- package/build/components/data-table/internals/DataTableSearch.d.ts +9 -0
- package/build/components/data-table/internals/DataTableSearch.js +73 -0
- package/build/components/data-table/internals/DataTableSearch.js.map +7 -0
- package/build/components/data-table/internals/addFilter.d.ts +5 -0
- package/build/components/data-table/internals/addFilter.js +31 -0
- package/build/components/data-table/internals/addFilter.js.map +7 -0
- package/build/components/data-table/internals/constants.d.ts +3 -0
- package/build/components/data-table/internals/constants.js +5 -0
- package/build/components/data-table/internals/constants.js.map +7 -0
- package/build/components/data-table/internals/fromPinningState.d.ts +2 -0
- package/build/components/data-table/internals/fromPinningState.js +12 -0
- package/build/components/data-table/internals/fromPinningState.js.map +7 -0
- package/build/components/data-table/internals/fuzzyFilter.d.ts +2 -0
- package/build/components/data-table/internals/fuzzyFilter.js +8 -0
- package/build/components/data-table/internals/fuzzyFilter.js.map +7 -0
- package/build/components/data-table/internals/getCommonPinningClasses.d.ts +2 -0
- package/build/components/data-table/internals/getCommonPinningClasses.js +13 -0
- package/build/components/data-table/internals/getCommonPinningClasses.js.map +7 -0
- package/build/components/data-table/internals/getCommonPinningStyles.d.ts +3 -0
- package/build/components/data-table/internals/getCommonPinningStyles.js +10 -0
- package/build/components/data-table/internals/getCommonPinningStyles.js.map +7 -0
- package/build/components/data-table/internals/normalizeFilter.d.ts +3 -0
- package/build/components/data-table/internals/normalizeFilter.js +19 -0
- package/build/components/data-table/internals/normalizeFilter.js.map +7 -0
- package/build/components/data-table/internals/normalizeFilters.d.ts +3 -0
- package/build/components/data-table/internals/normalizeFilters.js +18 -0
- package/build/components/data-table/internals/normalizeFilters.js.map +7 -0
- package/build/components/data-table/internals/normalizeSorting.d.ts +4 -0
- package/build/components/data-table/internals/normalizeSorting.js +26 -0
- package/build/components/data-table/internals/normalizeSorting.js.map +7 -0
- package/build/components/data-table/internals/removeFilter.d.ts +5 -0
- package/build/components/data-table/internals/removeFilter.js +18 -0
- package/build/components/data-table/internals/removeFilter.js.map +7 -0
- package/build/components/data-table/internals.d.ts +16 -0
- package/build/components/data-table/internals.js +18 -0
- package/build/components/data-table/internals.js.map +7 -0
- package/build/components/data-table.d.ts +9 -0
- package/build/components/data-table.js +11 -0
- package/build/components/data-table.js.map +7 -0
- package/build/components/internals/fieldContext.d.ts +3 -0
- package/build/components/internals/fieldContext.js +4 -0
- package/build/components/internals/fieldContext.js.map +7 -0
- package/build/components/internals/fieldNameContext.d.ts +3 -0
- package/build/components/internals/fieldNameContext.js +4 -0
- package/build/components/internals/fieldNameContext.js.map +7 -0
- package/build/components/internals/filterProps.d.ts +4 -0
- package/build/components/internals/filterProps.js +9 -0
- package/build/components/internals/filterProps.js.map +7 -0
- package/build/components/internals/formIdContext.d.ts +2 -0
- package/build/components/internals/formIdContext.js +4 -0
- package/build/components/internals/formIdContext.js.map +7 -0
- package/build/components/internals/forwardRef.d.ts +4 -0
- package/build/components/internals/forwardRef.js +6 -0
- package/build/components/internals/forwardRef.js.map +7 -0
- package/build/components/internals/useFormId.d.ts +1 -0
- package/build/components/internals/useFormId.js +7 -0
- package/build/components/internals/useFormId.js.map +7 -0
- package/build/components/internals.d.ts +6 -0
- package/build/components/internals.js +8 -0
- package/build/components/internals.js.map +7 -0
- package/build/components/useField.d.ts +1 -0
- package/build/components/useField.js +7 -0
- package/build/components/useField.js.map +7 -0
- package/build/components/useFieldName.d.ts +1 -0
- package/build/components/useFieldName.js +7 -0
- package/build/components/useFieldName.js.map +7 -0
- package/build/components/useForm.d.ts +10 -0
- package/build/components/useForm.js +19 -0
- package/build/components/useForm.js.map +7 -0
- package/build/components.d.ts +51 -0
- package/build/components.js +53 -0
- package/build/components.js.map +7 -0
- package/build/development/createTailwindConfig.d.ts +18 -0
- package/build/development/createTailwindConfig.js +172 -0
- package/build/development/createTailwindConfig.js.map +7 -0
- package/build/development/createTailwindMerge.d.ts +2 -0
- package/build/development/createTailwindMerge.js +74 -0
- package/build/development/createTailwindMerge.js.map +7 -0
- package/build/development/internals/PaletteConfig.d.ts +6 -0
- package/build/development/internals/PaletteConfig.js +2 -0
- package/build/development/internals/PaletteConfig.js.map +7 -0
- package/build/development/internals/SwatchValue.d.ts +9 -0
- package/build/development/internals/SwatchValue.js +2 -0
- package/build/development/internals/SwatchValue.js.map +7 -0
- package/build/development/internals/clamp.d.ts +1 -0
- package/build/development/internals/clamp.js +5 -0
- package/build/development/internals/clamp.js.map +7 -0
- package/build/development/internals/constants.d.ts +2 -0
- package/build/development/internals/constants.js +22 -0
- package/build/development/internals/constants.js.map +7 -0
- package/build/development/internals/createDisplayColor.d.ts +1 -0
- package/build/development/internals/createDisplayColor.js +24 -0
- package/build/development/internals/createDisplayColor.js.map +7 -0
- package/build/development/internals/createDistributionValues.d.ts +4 -0
- package/build/development/internals/createDistributionValues.js +32 -0
- package/build/development/internals/createDistributionValues.js.map +7 -0
- package/build/development/internals/createHueScale.d.ts +4 -0
- package/build/development/internals/createHueScale.js +15 -0
- package/build/development/internals/createHueScale.js.map +7 -0
- package/build/development/internals/createPalette.d.ts +16 -0
- package/build/development/internals/createPalette.js +36 -0
- package/build/development/internals/createPalette.js.map +7 -0
- package/build/development/internals/createSaturationScale.d.ts +4 -0
- package/build/development/internals/createSaturationScale.js +18 -0
- package/build/development/internals/createSaturationScale.js.map +7 -0
- package/build/development/internals/createSwatches.d.ts +10 -0
- package/build/development/internals/createSwatches.js +31 -0
- package/build/development/internals/createSwatches.js.map +7 -0
- package/build/development/internals/hexToHsl.d.ts +5 -0
- package/build/development/internals/hexToHsl.js +37 -0
- package/build/development/internals/hexToHsl.js.map +7 -0
- package/build/development/internals/hexToRgb.d.ts +5 -0
- package/build/development/internals/hexToRgb.js +21 -0
- package/build/development/internals/hexToRgb.js.map +7 -0
- package/build/development/internals/hslToHex.d.ts +1 -0
- package/build/development/internals/hslToHex.js +19 -0
- package/build/development/internals/hslToHex.js.map +7 -0
- package/build/development/internals/hslToRgb.d.ts +5 -0
- package/build/development/internals/hslToRgb.js +42 -0
- package/build/development/internals/hslToRgb.js.map +7 -0
- package/build/development/internals/isHex.d.ts +1 -0
- package/build/development/internals/isHex.js +7 -0
- package/build/development/internals/isHex.js.map +7 -0
- package/build/development/internals/resolveModule.d.ts +1 -0
- package/build/development/internals/resolveModule.js +9 -0
- package/build/development/internals/resolveModule.js.map +7 -0
- package/build/development/internals/round.d.ts +1 -0
- package/build/development/internals/round.js +6 -0
- package/build/development/internals/round.js.map +7 -0
- package/build/development/internals/unsignedModulo.d.ts +1 -0
- package/build/development/internals/unsignedModulo.js +5 -0
- package/build/development/internals/unsignedModulo.js.map +7 -0
- package/build/development/internals.d.ts +18 -0
- package/build/development/internals.js +20 -0
- package/build/development/internals.js.map +7 -0
- package/build/development.d.ts +2 -0
- package/build/development.js +4 -0
- package/build/development.js.map +7 -0
- package/build/inter-variable-italic.woff2 +0 -0
- package/build/inter-variable.woff2 +0 -0
- package/build/main.d.ts +5 -0
- package/build/main.js +7 -0
- package/build/main.js.map +7 -0
- package/build/styles.css +23 -0
- package/build/styles.css.map +7 -0
- package/build/theme/Theme.d.ts +146 -0
- package/build/theme/Theme.js +2 -0
- package/build/theme/Theme.js.map +7 -0
- package/build/theme/ThemeProvider.d.ts +6 -0
- package/build/theme/ThemeProvider.js +7 -0
- package/build/theme/ThemeProvider.js.map +7 -0
- package/build/theme/defaultTheme.d.ts +2 -0
- package/build/theme/defaultTheme.js +102 -0
- package/build/theme/defaultTheme.js.map +7 -0
- package/build/theme/internals/ClassName.d.ts +1 -0
- package/build/theme/internals/ClassName.js +2 -0
- package/build/theme/internals/ClassName.js.map +7 -0
- package/build/theme/internals/ComponentProps.d.ts +7 -0
- package/build/theme/internals/ComponentProps.js +2 -0
- package/build/theme/internals/ComponentProps.js.map +7 -0
- package/build/theme/internals/ComponentTheme.d.ts +35 -0
- package/build/theme/internals/ComponentTheme.js +2 -0
- package/build/theme/internals/ComponentTheme.js.map +7 -0
- package/build/theme/internals/ComponentThemeCompoundVariants.d.ts +12 -0
- package/build/theme/internals/ComponentThemeCompoundVariants.js +2 -0
- package/build/theme/internals/ComponentThemeCompoundVariants.js.map +7 -0
- package/build/theme/internals/ComponentThemeDefinition.d.ts +6 -0
- package/build/theme/internals/ComponentThemeDefinition.js +2 -0
- package/build/theme/internals/ComponentThemeDefinition.js.map +7 -0
- package/build/theme/internals/ComponentThemeDefinitionElements.d.ts +1 -0
- package/build/theme/internals/ComponentThemeDefinitionElements.js +2 -0
- package/build/theme/internals/ComponentThemeDefinitionElements.js.map +7 -0
- package/build/theme/internals/ComponentThemeDefinitionVariants.d.ts +3 -0
- package/build/theme/internals/ComponentThemeDefinitionVariants.js +2 -0
- package/build/theme/internals/ComponentThemeDefinitionVariants.js.map +7 -0
- package/build/theme/internals/ComponentThemeProps.d.ts +5 -0
- package/build/theme/internals/ComponentThemeProps.js +2 -0
- package/build/theme/internals/ComponentThemeProps.js.map +7 -0
- package/build/theme/internals/ComponentThemeVariants.d.ts +14 -0
- package/build/theme/internals/ComponentThemeVariants.js +2 -0
- package/build/theme/internals/ComponentThemeVariants.js.map +7 -0
- package/build/theme/internals/ComponentWithTheme.d.ts +5 -0
- package/build/theme/internals/ComponentWithTheme.js +2 -0
- package/build/theme/internals/ComponentWithTheme.js.map +7 -0
- package/build/theme/internals/UseComponentTheme.d.ts +21 -0
- package/build/theme/internals/UseComponentTheme.js +2 -0
- package/build/theme/internals/UseComponentTheme.js.map +7 -0
- package/build/theme/internals/UseComponentThemeReturn.d.ts +6 -0
- package/build/theme/internals/UseComponentThemeReturn.js +2 -0
- package/build/theme/internals/UseComponentThemeReturn.js.map +7 -0
- package/build/theme/internals/booleanToString.d.ts +1 -0
- package/build/theme/internals/booleanToString.js +5 -0
- package/build/theme/internals/booleanToString.js.map +7 -0
- package/build/theme/internals/createComponentTheme.d.ts +3 -0
- package/build/theme/internals/createComponentTheme.js +39 -0
- package/build/theme/internals/createComponentTheme.js.map +7 -0
- package/build/theme/internals/createUseComponentThemeReturn.d.ts +15 -0
- package/build/theme/internals/createUseComponentThemeReturn.js +50 -0
- package/build/theme/internals/createUseComponentThemeReturn.js.map +7 -0
- package/build/theme/internals/pickPropertyIfExists.d.ts +4 -0
- package/build/theme/internals/pickPropertyIfExists.js +11 -0
- package/build/theme/internals/pickPropertyIfExists.js.map +7 -0
- package/build/theme/internals/themeContext.d.ts +354 -0
- package/build/theme/internals/themeContext.js +4 -0
- package/build/theme/internals/themeContext.js.map +7 -0
- package/build/theme/internals/useTheme.d.ts +353 -0
- package/build/theme/internals/useTheme.js +7 -0
- package/build/theme/internals/useTheme.js.map +7 -0
- package/build/theme/internals.d.ts +18 -0
- package/build/theme/internals.js +20 -0
- package/build/theme/internals.js.map +7 -0
- package/build/theme.d.ts +3 -0
- package/build/theme.js +5 -0
- package/build/theme.js.map +7 -0
- package/build/utilities/WithLocaleOrLocales.d.ts +5 -0
- package/build/utilities/WithLocaleOrLocales.js +2 -0
- package/build/utilities/WithLocaleOrLocales.js.map +7 -0
- package/build/utilities/formatDateTime.d.ts +3 -0
- package/build/utilities/formatDateTime.js +11 -0
- package/build/utilities/formatDateTime.js.map +7 -0
- package/build/utilities/formatNumber.d.ts +3 -0
- package/build/utilities/formatNumber.js +11 -0
- package/build/utilities/formatNumber.js.map +7 -0
- package/build/utilities/internals/cache.d.ts +1 -0
- package/build/utilities/internals/cache.js +3 -0
- package/build/utilities/internals/cache.js.map +7 -0
- package/build/utilities/internals/createCacheKey.d.ts +1 -0
- package/build/utilities/internals/createCacheKey.js +6 -0
- package/build/utilities/internals/createCacheKey.js.map +7 -0
- package/build/utilities/internals/getMemoized.d.ts +1 -0
- package/build/utilities/internals/getMemoized.js +12 -0
- package/build/utilities/internals/getMemoized.js.map +7 -0
- package/build/utilities/internals/normalizeLocales.d.ts +2 -0
- package/build/utilities/internals/normalizeLocales.js +12 -0
- package/build/utilities/internals/normalizeLocales.js.map +7 -0
- package/build/utilities/internals.d.ts +4 -0
- package/build/utilities/internals.js +6 -0
- package/build/utilities/internals.js.map +7 -0
- package/build/utilities.d.ts +3 -0
- package/build/utilities.js +5 -0
- package/build/utilities.js.map +7 -0
- package/package.json +101 -0
- package/source/components/Button.tsx +172 -0
- package/source/components/Card.ts +46 -0
- package/source/components/Checkbox.tsx +125 -0
- package/source/components/CheckboxField.tsx +61 -0
- package/source/components/Combobox.tsx +298 -0
- package/source/components/ComboboxOption.tsx +95 -0
- package/source/components/Container.ts +84 -0
- package/source/components/Description.tsx +52 -0
- package/source/components/Dialog.tsx +85 -0
- package/source/components/DialogPanel.tsx +54 -0
- package/source/components/DialogTitle.tsx +52 -0
- package/source/components/Error.tsx +58 -0
- package/source/components/Field.tsx +79 -0
- package/source/components/Fieldset.tsx +64 -0
- package/source/components/Form.tsx +72 -0
- package/source/components/Icon.tsx +102 -0
- package/source/components/Input.tsx +156 -0
- package/source/components/Label.tsx +49 -0
- package/source/components/Legend.tsx +49 -0
- package/source/components/Listbox.tsx +401 -0
- package/source/components/ListboxOption.tsx +95 -0
- package/source/components/Menu.tsx +50 -0
- package/source/components/MenuButton.tsx +69 -0
- package/source/components/MenuHeading.tsx +52 -0
- package/source/components/MenuItem.tsx +64 -0
- package/source/components/MenuItems.tsx +62 -0
- package/source/components/MenuSection.tsx +52 -0
- package/source/components/MenuSeparator.tsx +52 -0
- package/source/components/Popover.tsx +52 -0
- package/source/components/PopoverBackdrop.tsx +52 -0
- package/source/components/PopoverButton.tsx +72 -0
- package/source/components/PopoverGroup.tsx +52 -0
- package/source/components/PopoverPanel.tsx +65 -0
- package/source/components/Radio.tsx +88 -0
- package/source/components/RadioField.tsx +31 -0
- package/source/components/RadioGroup.tsx +147 -0
- package/source/components/Spinner.tsx +70 -0
- package/source/components/Table.ts +47 -0
- package/source/components/TableBody.ts +47 -0
- package/source/components/TableCaption.ts +52 -0
- package/source/components/TableCell.ts +47 -0
- package/source/components/TableFoot.ts +47 -0
- package/source/components/TableHead.ts +47 -0
- package/source/components/TableHeader.ts +47 -0
- package/source/components/TableRow.ts +47 -0
- package/source/components/Text.ts +64 -0
- package/source/components/Textarea.tsx +104 -0
- package/source/components/data-table/DataTable.tsx +377 -0
- package/source/components/data-table/DataTableColumnOrder.ts +5 -0
- package/source/components/data-table/DataTableColumnPinning.ts +5 -0
- package/source/components/data-table/DataTableColumnVisibility.ts +5 -0
- package/source/components/data-table/DataTableFaceting.ts +12 -0
- package/source/components/data-table/DataTableFilters.ts +18 -0
- package/source/components/data-table/DataTablePagination.ts +18 -0
- package/source/components/data-table/DataTableSearch.ts +5 -0
- package/source/components/data-table/DataTableSorting.ts +11 -0
- package/source/components/data-table/internals/DataTableHeader.tsx +254 -0
- package/source/components/data-table/internals/DataTableHeaderColumnCheckbox.tsx +44 -0
- package/source/components/data-table/internals/DataTableHeaderFilter.tsx +340 -0
- package/source/components/data-table/internals/DataTablePageButton.tsx +21 -0
- package/source/components/data-table/internals/DataTablePagination.tsx +220 -0
- package/source/components/data-table/internals/DataTableSearch.tsx +109 -0
- package/source/components/data-table/internals/addFilter.ts +42 -0
- package/source/components/data-table/internals/constants.ts +3 -0
- package/source/components/data-table/internals/fromPinningState.ts +17 -0
- package/source/components/data-table/internals/fuzzyFilter.ts +15 -0
- package/source/components/data-table/internals/getCommonPinningClasses.ts +19 -0
- package/source/components/data-table/internals/getCommonPinningStyles.ts +13 -0
- package/source/components/data-table/internals/normalizeFilter.ts +33 -0
- package/source/components/data-table/internals/normalizeFilters.ts +31 -0
- package/source/components/data-table/internals/normalizeSorting.ts +40 -0
- package/source/components/data-table/internals/removeFilter.ts +26 -0
- package/source/components/data-table/internals.ts +16 -0
- package/source/components/data-table.ts +9 -0
- package/source/components/internals/fieldContext.ts +4 -0
- package/source/components/internals/fieldNameContext.ts +5 -0
- package/source/components/internals/filterProps.ts +12 -0
- package/source/components/internals/formIdContext.ts +3 -0
- package/source/components/internals/forwardRef.ts +7 -0
- package/source/components/internals/useFormId.ts +7 -0
- package/source/components/internals.ts +6 -0
- package/source/components/useField.ts +7 -0
- package/source/components/useFieldName.ts +7 -0
- package/source/components/useForm.ts +24 -0
- package/source/components.ts +51 -0
- package/source/development/createTailwindConfig.ts +189 -0
- package/source/development/createTailwindMerge.ts +101 -0
- package/source/development/internals/PaletteConfig.ts +6 -0
- package/source/development/internals/SwatchValue.ts +9 -0
- package/source/development/internals/clamp.ts +3 -0
- package/source/development/internals/constants.ts +4 -0
- package/source/development/internals/createDisplayColor.ts +29 -0
- package/source/development/internals/createDistributionValues.ts +38 -0
- package/source/development/internals/createHueScale.ts +17 -0
- package/source/development/internals/createPalette.ts +54 -0
- package/source/development/internals/createSaturationScale.ts +21 -0
- package/source/development/internals/createSwatches.ts +34 -0
- package/source/development/internals/hexToHsl.ts +45 -0
- package/source/development/internals/hexToRgb.ts +23 -0
- package/source/development/internals/hslToHex.ts +23 -0
- package/source/development/internals/hslToRgb.ts +43 -0
- package/source/development/internals/isHex.ts +7 -0
- package/source/development/internals/resolveModule.ts +9 -0
- package/source/development/internals/round.ts +5 -0
- package/source/development/internals/unsignedModulo.ts +3 -0
- package/source/development/internals.ts +18 -0
- package/source/development.ts +2 -0
- package/source/inter-variable-italic.woff2 +0 -0
- package/source/inter-variable.woff2 +0 -0
- package/source/main.ts +5 -0
- package/source/styles.css +25 -0
- package/source/theme/Theme.ts +102 -0
- package/source/theme/ThemeProvider.tsx +12 -0
- package/source/theme/defaultTheme.ts +103 -0
- package/source/theme/internals/ClassName.ts +1 -0
- package/source/theme/internals/ComponentProps.ts +13 -0
- package/source/theme/internals/ComponentTheme.ts +50 -0
- package/source/theme/internals/ComponentThemeCompoundVariants.ts +20 -0
- package/source/theme/internals/ComponentThemeDefinition.ts +7 -0
- package/source/theme/internals/ComponentThemeDefinitionElements.ts +1 -0
- package/source/theme/internals/ComponentThemeDefinitionVariants.ts +3 -0
- package/source/theme/internals/ComponentThemeProps.ts +11 -0
- package/source/theme/internals/ComponentThemeVariants.ts +24 -0
- package/source/theme/internals/ComponentWithTheme.ts +6 -0
- package/source/theme/internals/UseComponentTheme.ts +22 -0
- package/source/theme/internals/UseComponentThemeReturn.ts +15 -0
- package/source/theme/internals/booleanToString.ts +6 -0
- package/source/theme/internals/createComponentTheme.ts +70 -0
- package/source/theme/internals/createUseComponentThemeReturn.ts +87 -0
- package/source/theme/internals/pickPropertyIfExists.ts +24 -0
- package/source/theme/internals/themeContext.ts +5 -0
- package/source/theme/internals/useTheme.ts +7 -0
- package/source/theme/internals.ts +18 -0
- package/source/theme.ts +3 -0
- package/source/utilities/WithLocaleOrLocales.ts +1 -0
- package/source/utilities/formatDateTime.ts +15 -0
- package/source/utilities/formatNumber.ts +15 -0
- package/source/utilities/internals/cache.ts +1 -0
- package/source/utilities/internals/createCacheKey.ts +9 -0
- package/source/utilities/internals/getMemoized.ts +14 -0
- package/source/utilities/internals/normalizeLocales.ts +15 -0
- package/source/utilities/internals.ts +4 -0
- package/source/utilities.ts +3 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {useForm as useBaseForm} from '@conform-to/react';
|
|
2
|
+
import {parseWithZod} from '@conform-to/zod';
|
|
3
|
+
import {type ZodTypeAny} from 'zod';
|
|
4
|
+
|
|
5
|
+
export type UseFormOptions<S extends ZodTypeAny> = {
|
|
6
|
+
schema: S;
|
|
7
|
+
onSubmit?: Parameters<typeof useBaseForm<S>>[0]['onSubmit'] | undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function useForm<S extends ZodTypeAny>({schema, onSubmit}: UseFormOptions<S>) {
|
|
11
|
+
let [form, fields] = useBaseForm({
|
|
12
|
+
shouldValidate: 'onBlur',
|
|
13
|
+
shouldRevalidate: 'onInput',
|
|
14
|
+
onValidate({formData}) {
|
|
15
|
+
return parseWithZod(formData, {schema});
|
|
16
|
+
},
|
|
17
|
+
onSubmit: onSubmit as NonNullable<typeof onSubmit>, // TODO: remove when this is fixed: https://github.com/edmundhung/conform/issues/697
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
form,
|
|
22
|
+
fields,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export * from './components/Button.js';
|
|
2
|
+
export * from './components/Card.js';
|
|
3
|
+
export * from './components/Checkbox.js';
|
|
4
|
+
export * from './components/CheckboxField.js';
|
|
5
|
+
export * from './components/Combobox.js';
|
|
6
|
+
export * from './components/ComboboxOption.js';
|
|
7
|
+
export * from './components/Container.js';
|
|
8
|
+
export * from './components/data-table.js';
|
|
9
|
+
export * from './components/Description.js';
|
|
10
|
+
export * from './components/Dialog.js';
|
|
11
|
+
export * from './components/DialogPanel.js';
|
|
12
|
+
export * from './components/DialogTitle.js';
|
|
13
|
+
export * from './components/Error.js';
|
|
14
|
+
export * from './components/Field.js';
|
|
15
|
+
export * from './components/Fieldset.js';
|
|
16
|
+
export * from './components/Form.js';
|
|
17
|
+
export * from './components/Icon.js';
|
|
18
|
+
export * from './components/Input.js';
|
|
19
|
+
export * from './components/Label.js';
|
|
20
|
+
export * from './components/Legend.js';
|
|
21
|
+
export * from './components/Listbox.js';
|
|
22
|
+
export * from './components/ListboxOption.js';
|
|
23
|
+
export * from './components/Menu.js';
|
|
24
|
+
export * from './components/MenuButton.js';
|
|
25
|
+
export * from './components/MenuHeading.js';
|
|
26
|
+
export * from './components/MenuItem.js';
|
|
27
|
+
export * from './components/MenuItems.js';
|
|
28
|
+
export * from './components/MenuSection.js';
|
|
29
|
+
export * from './components/MenuSeparator.js';
|
|
30
|
+
export * from './components/Popover.js';
|
|
31
|
+
export * from './components/PopoverBackdrop.js';
|
|
32
|
+
export * from './components/PopoverButton.js';
|
|
33
|
+
export * from './components/PopoverGroup.js';
|
|
34
|
+
export * from './components/PopoverPanel.js';
|
|
35
|
+
export * from './components/Radio.js';
|
|
36
|
+
export * from './components/RadioField.js';
|
|
37
|
+
export * from './components/RadioGroup.js';
|
|
38
|
+
export * from './components/Spinner.js';
|
|
39
|
+
export * from './components/Table.js';
|
|
40
|
+
export * from './components/TableBody.js';
|
|
41
|
+
export * from './components/TableCaption.js';
|
|
42
|
+
export * from './components/TableCell.js';
|
|
43
|
+
export * from './components/TableFoot.js';
|
|
44
|
+
export * from './components/TableHead.js';
|
|
45
|
+
export * from './components/TableHeader.js';
|
|
46
|
+
export * from './components/TableRow.js';
|
|
47
|
+
export * from './components/Text.js';
|
|
48
|
+
export * from './components/Textarea.js';
|
|
49
|
+
export * from './components/useField.js';
|
|
50
|
+
export * from './components/useFieldName.js';
|
|
51
|
+
export * from './components/useForm.js';
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {type Config as TailwindConfig} from 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
import {DEFAULT_STOP, type DEFAULT_STOPS} from './internals/constants.js';
|
|
4
|
+
import {createPalette} from './internals/createPalette.js';
|
|
5
|
+
import {resolveModule} from './internals/resolveModule.js';
|
|
6
|
+
|
|
7
|
+
let defaultCreateTailwindConfigOptions = {
|
|
8
|
+
content: ['./{.storybook,app,source,stories,tests}/**/*.{js,jsx,ts,tsx,mdx}', '@jakubmazanec/ui'],
|
|
9
|
+
colors: {
|
|
10
|
+
gray: '#6c6e79',
|
|
11
|
+
neutral: '#6c6e79', // copy of "gray"
|
|
12
|
+
red: '#d1002f',
|
|
13
|
+
danger: '#d1002f', // copy of "red"
|
|
14
|
+
orange: {
|
|
15
|
+
hex: '#c33909',
|
|
16
|
+
hueShift: 1,
|
|
17
|
+
},
|
|
18
|
+
warning: {
|
|
19
|
+
hex: '#c33909',
|
|
20
|
+
hueShift: 1,
|
|
21
|
+
}, // copy of "orange"
|
|
22
|
+
yellow: {
|
|
23
|
+
swatches: [
|
|
24
|
+
{hex: '#fffffa', stop: 10},
|
|
25
|
+
{hex: '#fffef0', stop: 25},
|
|
26
|
+
{hex: '#fffbdb', stop: 50},
|
|
27
|
+
{hex: '#fff3b8', stop: 100},
|
|
28
|
+
{hex: '#ffe06f', stop: 200},
|
|
29
|
+
{hex: '#ffc72d', stop: 300},
|
|
30
|
+
{hex: '#e69d00', stop: 400},
|
|
31
|
+
{hex: '#9e6300', stop: 500},
|
|
32
|
+
{hex: '#805701', stop: 600},
|
|
33
|
+
{hex: '#614700', stop: 700},
|
|
34
|
+
{hex: '#3d3000', stop: 800},
|
|
35
|
+
{hex: '#1f1a00', stop: 900},
|
|
36
|
+
{hex: '#0f0e00', stop: 950},
|
|
37
|
+
{hex: '#0a0a00', stop: 975},
|
|
38
|
+
{hex: '#050500', stop: 990},
|
|
39
|
+
],
|
|
40
|
+
hex: '#9e6300',
|
|
41
|
+
hueShift: 3,
|
|
42
|
+
},
|
|
43
|
+
green: '#0a7e22',
|
|
44
|
+
teal: {
|
|
45
|
+
hex: '#007c65',
|
|
46
|
+
hueShift: 5,
|
|
47
|
+
},
|
|
48
|
+
blue: '#006dca',
|
|
49
|
+
primary: '#006dca', // copy of "blue"
|
|
50
|
+
violet: '#8649e1',
|
|
51
|
+
pink: {
|
|
52
|
+
hex: '#b229b9',
|
|
53
|
+
hueShift: 10,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
} satisfies CreateTailwindConfigOptions;
|
|
57
|
+
|
|
58
|
+
export type CreateTailwindConfigOptions = {
|
|
59
|
+
content?: string[] | undefined;
|
|
60
|
+
colors?: Record<
|
|
61
|
+
string,
|
|
62
|
+
| string
|
|
63
|
+
| {
|
|
64
|
+
swatches: Array<{hex: string; stop: (typeof DEFAULT_STOPS)[number]}>;
|
|
65
|
+
hueShift?: number;
|
|
66
|
+
saturationShift?: number;
|
|
67
|
+
}
|
|
68
|
+
| {hex: string; hueShift?: number; saturationShift?: number}
|
|
69
|
+
>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export function createTailwindConfig({
|
|
73
|
+
content,
|
|
74
|
+
colors,
|
|
75
|
+
}: CreateTailwindConfigOptions = defaultCreateTailwindConfigOptions): TailwindConfig {
|
|
76
|
+
let themeColors = {
|
|
77
|
+
transparent: 'transparent',
|
|
78
|
+
current: 'currentColor',
|
|
79
|
+
white: '#fff',
|
|
80
|
+
black: '#000',
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
for (let [name, color] of Object.entries(colors ?? {})) {
|
|
84
|
+
if (typeof color === 'string') {
|
|
85
|
+
themeColors = {
|
|
86
|
+
...themeColors,
|
|
87
|
+
...createPalette({
|
|
88
|
+
name,
|
|
89
|
+
swatches: [
|
|
90
|
+
{
|
|
91
|
+
hex: color,
|
|
92
|
+
stop: DEFAULT_STOP,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
hueShift: 0,
|
|
96
|
+
saturationShift: 0,
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
} else if ('swatches' in color) {
|
|
100
|
+
themeColors = {
|
|
101
|
+
...themeColors,
|
|
102
|
+
...createPalette({
|
|
103
|
+
name,
|
|
104
|
+
swatches: color.swatches,
|
|
105
|
+
hueShift: color.hueShift ?? 0,
|
|
106
|
+
saturationShift: color.saturationShift ?? 0,
|
|
107
|
+
}),
|
|
108
|
+
};
|
|
109
|
+
} else if ('hex' in color) {
|
|
110
|
+
themeColors = {
|
|
111
|
+
...themeColors,
|
|
112
|
+
...createPalette({
|
|
113
|
+
name,
|
|
114
|
+
swatches: [{hex: color.hex, stop: DEFAULT_STOP}],
|
|
115
|
+
hueShift: color.hueShift ?? 0,
|
|
116
|
+
saturationShift: color.saturationShift ?? 0,
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let resolvedContent = [];
|
|
123
|
+
|
|
124
|
+
for (let contentPath of content ?? []) {
|
|
125
|
+
try {
|
|
126
|
+
if (contentPath.startsWith('.') || contentPath.startsWith('/')) {
|
|
127
|
+
resolvedContent.push(contentPath);
|
|
128
|
+
} else {
|
|
129
|
+
resolvedContent.push(`${resolveModule(contentPath)}/**`);
|
|
130
|
+
}
|
|
131
|
+
} catch {
|
|
132
|
+
// no-op, because we're catching error caused by `createRequire` not being a function in a browser environment
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
content: resolvedContent,
|
|
138
|
+
theme: {
|
|
139
|
+
colors: themeColors,
|
|
140
|
+
borderRadius: {
|
|
141
|
+
none: '0',
|
|
142
|
+
DEFAULT: '0.25rem',
|
|
143
|
+
'0.5': '0.125rem',
|
|
144
|
+
'1': '0.25rem',
|
|
145
|
+
'1.5': '0.375rem',
|
|
146
|
+
'2': '0.5rem',
|
|
147
|
+
'2.5': '0.625rem',
|
|
148
|
+
'3': '0.75rem',
|
|
149
|
+
'4': '1rem',
|
|
150
|
+
full: '9999px',
|
|
151
|
+
},
|
|
152
|
+
extend: {
|
|
153
|
+
spacing: {
|
|
154
|
+
13: '3.25rem',
|
|
155
|
+
15: '3.75rem',
|
|
156
|
+
17: '4.25rem',
|
|
157
|
+
18: '4.5rem',
|
|
158
|
+
19: '4.75rem',
|
|
159
|
+
21: '5.25rem',
|
|
160
|
+
22: '5.5rem',
|
|
161
|
+
23: '5.75rem',
|
|
162
|
+
25: '6.25rem',
|
|
163
|
+
26: '6.5rem',
|
|
164
|
+
27: '6.75rem',
|
|
165
|
+
29: '6.25rem',
|
|
166
|
+
30: '7.5rem',
|
|
167
|
+
34: '8.5rem',
|
|
168
|
+
38: '9.5rem',
|
|
169
|
+
40: '10rem',
|
|
170
|
+
},
|
|
171
|
+
fontFamily: {
|
|
172
|
+
sans: [
|
|
173
|
+
'InterVariable',
|
|
174
|
+
'ui-sans-serif',
|
|
175
|
+
'system-ui',
|
|
176
|
+
'sans-serif',
|
|
177
|
+
'"Apple Color Emoji"',
|
|
178
|
+
'"Segoe UI Emoji"',
|
|
179
|
+
'"Segoe UI Symbol"',
|
|
180
|
+
'"Noto Color Emoji"',
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
future: {
|
|
186
|
+
hoverOnlyWhenSupported: true,
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {extendTailwindMerge, twMerge} from 'tailwind-merge';
|
|
2
|
+
import {type Config as TailwindConfig} from 'tailwindcss';
|
|
3
|
+
|
|
4
|
+
const THEME_SCALES = [
|
|
5
|
+
'colors',
|
|
6
|
+
'spacing',
|
|
7
|
+
'blur',
|
|
8
|
+
'brightness',
|
|
9
|
+
'borderColor',
|
|
10
|
+
'borderRadius',
|
|
11
|
+
'borderSpacing',
|
|
12
|
+
'borderWidth',
|
|
13
|
+
'contrast',
|
|
14
|
+
'grayscale',
|
|
15
|
+
'hueRotate',
|
|
16
|
+
'invert',
|
|
17
|
+
'gap',
|
|
18
|
+
'gradientColorStops',
|
|
19
|
+
'gradientColorStopPositions',
|
|
20
|
+
'inset',
|
|
21
|
+
'margin',
|
|
22
|
+
'opacity',
|
|
23
|
+
'padding',
|
|
24
|
+
'saturate',
|
|
25
|
+
'scale',
|
|
26
|
+
'sepia',
|
|
27
|
+
'skew',
|
|
28
|
+
'space',
|
|
29
|
+
'translate',
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export function createTailwindMerge(tailwindConfig: TailwindConfig) {
|
|
33
|
+
if (!tailwindConfig.theme) {
|
|
34
|
+
return twMerge;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let tailwindMergeConfig: Parameters<typeof extendTailwindMerge>[0] = {
|
|
38
|
+
override: {theme: {}},
|
|
39
|
+
extend: {theme: {}},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
for (let scale of THEME_SCALES) {
|
|
43
|
+
if (!tailwindMergeConfig.override?.theme || !tailwindMergeConfig.extend?.theme) {
|
|
44
|
+
throw new Error('Creating Tailwind merge failed!');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (tailwindConfig.theme[scale]) {
|
|
48
|
+
let tailwindConfigScale = tailwindConfig.theme[scale] as Record<
|
|
49
|
+
string,
|
|
50
|
+
Record<string, string | unknown> | unknown
|
|
51
|
+
>;
|
|
52
|
+
let keys = Object.keys(tailwindConfigScale);
|
|
53
|
+
let combinedKeys = [];
|
|
54
|
+
|
|
55
|
+
for (let key of keys) {
|
|
56
|
+
if (
|
|
57
|
+
tailwindConfigScale[key] !== undefined &&
|
|
58
|
+
tailwindConfigScale[key] !== null &&
|
|
59
|
+
typeof tailwindConfigScale[key] === 'object'
|
|
60
|
+
) {
|
|
61
|
+
combinedKeys.push(
|
|
62
|
+
...Object.keys(tailwindConfigScale[key] as object)
|
|
63
|
+
.filter((value) => value !== 'DEFAULT')
|
|
64
|
+
.map((value) => `${key}-${value}`),
|
|
65
|
+
);
|
|
66
|
+
} else {
|
|
67
|
+
combinedKeys.push(key);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
tailwindMergeConfig.override.theme[scale] = combinedKeys;
|
|
72
|
+
} else if (tailwindConfig.theme.extend?.[scale]) {
|
|
73
|
+
let tailwindConfigScale = tailwindConfig.theme.extend[scale] as Record<
|
|
74
|
+
string,
|
|
75
|
+
Record<string, string | unknown> | unknown
|
|
76
|
+
>;
|
|
77
|
+
let keys = Object.keys(tailwindConfigScale);
|
|
78
|
+
let combinedKeys = [];
|
|
79
|
+
|
|
80
|
+
for (let key of keys) {
|
|
81
|
+
if (
|
|
82
|
+
tailwindConfigScale[key] !== undefined &&
|
|
83
|
+
tailwindConfigScale[key] !== null &&
|
|
84
|
+
typeof tailwindConfigScale[key] === 'object'
|
|
85
|
+
) {
|
|
86
|
+
combinedKeys.push(
|
|
87
|
+
...Object.keys(tailwindConfigScale[key] as object)
|
|
88
|
+
.filter((value) => value !== 'DEFAULT')
|
|
89
|
+
.map((value) => `${key}-${value}`),
|
|
90
|
+
);
|
|
91
|
+
} else {
|
|
92
|
+
combinedKeys.push(key);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
tailwindMergeConfig.extend.theme[scale] = combinedKeys;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return extendTailwindMerge(tailwindMergeConfig);
|
|
101
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {oklch} from 'culori';
|
|
2
|
+
|
|
3
|
+
import {isHex} from './isHex.js';
|
|
4
|
+
import {round} from './round.js';
|
|
5
|
+
|
|
6
|
+
export function createDisplayColor(hexColor: string, alphaPlaceholder?: boolean): string | null {
|
|
7
|
+
if (!hexColor || !isHex(hexColor)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let display = null;
|
|
12
|
+
let oklchColor = oklch(hexColor);
|
|
13
|
+
|
|
14
|
+
if (!oklchColor) {
|
|
15
|
+
throw new Error(`Couldn't convert "${hexColor}" to OKLCH!`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {l, c, h = 0} = oklchColor;
|
|
19
|
+
|
|
20
|
+
display = `oklch(${[
|
|
21
|
+
`${round(l * 100, 2)}%`,
|
|
22
|
+
round(c, 3),
|
|
23
|
+
round(h, 2),
|
|
24
|
+
`/`,
|
|
25
|
+
alphaPlaceholder ? `<alpha-value>` : 1,
|
|
26
|
+
].join(` `)})`;
|
|
27
|
+
|
|
28
|
+
return display;
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {DEFAULT_STOP, DEFAULT_STOPS} from './constants.js';
|
|
2
|
+
|
|
3
|
+
const MIN = 0;
|
|
4
|
+
const MAX = 100;
|
|
5
|
+
|
|
6
|
+
export function createDistributionValues(lightness: number, stop: number = DEFAULT_STOP) {
|
|
7
|
+
let stops: number[] = [...DEFAULT_STOPS].sort() as unknown as number[];
|
|
8
|
+
let newValues = [
|
|
9
|
+
{stop: 0, value: MAX},
|
|
10
|
+
{stop, value: lightness},
|
|
11
|
+
{stop: 1000, value: MIN},
|
|
12
|
+
];
|
|
13
|
+
let stopIndex = stops.indexOf(stop);
|
|
14
|
+
let firstHalf = stops.slice(0, stopIndex + 1);
|
|
15
|
+
let secondHalf = stops.slice(stopIndex);
|
|
16
|
+
|
|
17
|
+
for (let stopValue of firstHalf) {
|
|
18
|
+
if (stopValue !== 0 && stopValue !== stop) {
|
|
19
|
+
let percentage = (stopValue - 0) / (stop - 0);
|
|
20
|
+
let value = MAX - percentage * (MAX - lightness);
|
|
21
|
+
|
|
22
|
+
newValues.push({stop: stopValue, value: Math.round(value)});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (let stopValue of secondHalf) {
|
|
27
|
+
if (stopValue !== 1000 && stopValue !== stop) {
|
|
28
|
+
let percentage = (stopValue - stop) / (1000 - stop);
|
|
29
|
+
let value = lightness - percentage * (lightness - MIN);
|
|
30
|
+
|
|
31
|
+
newValues.push({stop: stopValue, value: Math.round(value)});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
newValues.sort((a, b) => a.stop - b.stop);
|
|
36
|
+
|
|
37
|
+
return newValues;
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {DEFAULT_STOP, DEFAULT_STOPS} from './constants.js';
|
|
2
|
+
|
|
3
|
+
export function createHueScale(tweak = 0, stop: number = DEFAULT_STOP) {
|
|
4
|
+
let stops: number[] = DEFAULT_STOPS as unknown as number[];
|
|
5
|
+
let index = stops.indexOf(stop);
|
|
6
|
+
|
|
7
|
+
if (index === -1) {
|
|
8
|
+
throw new Error(`Invalid parameter value: ${stop}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return stops.map((stop) => {
|
|
12
|
+
let diff = Math.abs(stops.indexOf(stop) - index);
|
|
13
|
+
let tweakValue = tweak ? diff * tweak : 0;
|
|
14
|
+
|
|
15
|
+
return {stop, tweak: tweakValue};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {DEFAULT_STOP, type DEFAULT_STOPS} from './constants.js';
|
|
2
|
+
import {createDisplayColor} from './createDisplayColor.js';
|
|
3
|
+
import {createSwatches} from './createSwatches.js';
|
|
4
|
+
|
|
5
|
+
export type CreatePaletteOptions<N extends string> = {
|
|
6
|
+
name: N;
|
|
7
|
+
swatches: Array<{hex: string; stop: number}>;
|
|
8
|
+
hueShift: number;
|
|
9
|
+
saturationShift: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type CreatePaletteReturn<N extends string> = {
|
|
13
|
+
[K in N]: {[J in (typeof DEFAULT_STOPS)[number]]: string};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function createPalette<const N extends string>({
|
|
17
|
+
name,
|
|
18
|
+
swatches,
|
|
19
|
+
hueShift,
|
|
20
|
+
saturationShift,
|
|
21
|
+
}: CreatePaletteOptions<N>): CreatePaletteReturn<N> {
|
|
22
|
+
let defaultSwatch = swatches.find((swatch) => swatch.stop === DEFAULT_STOP);
|
|
23
|
+
|
|
24
|
+
if (!defaultSwatch) {
|
|
25
|
+
throw new Error(`Swatches are missing color for stop "${DEFAULT_STOP}"!`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let allSwatches = createSwatches({
|
|
29
|
+
value: defaultSwatch.hex,
|
|
30
|
+
valueStop: DEFAULT_STOP,
|
|
31
|
+
h: hueShift,
|
|
32
|
+
s: saturationShift,
|
|
33
|
+
});
|
|
34
|
+
let palette = {};
|
|
35
|
+
|
|
36
|
+
allSwatches
|
|
37
|
+
.filter((swatch) => ![0, 1000].includes(swatch.stop))
|
|
38
|
+
.forEach((newSwatch) => {
|
|
39
|
+
let existingSwatch = swatches.find((swatch) => swatch.stop === newSwatch.stop);
|
|
40
|
+
|
|
41
|
+
if (existingSwatch) {
|
|
42
|
+
Object.assign(palette, {
|
|
43
|
+
[existingSwatch.stop]: createDisplayColor(existingSwatch.hex, true),
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
Object.assign(palette, {[newSwatch.stop]: createDisplayColor(newSwatch.hex, true)});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- false positive
|
|
51
|
+
return {
|
|
52
|
+
[name]: palette,
|
|
53
|
+
} as CreatePaletteReturn<N>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {DEFAULT_STOP, DEFAULT_STOPS} from './constants.js';
|
|
2
|
+
|
|
3
|
+
export function createSaturationScale(tweak = 0, stop: number = DEFAULT_STOP) {
|
|
4
|
+
let stops: number[] = DEFAULT_STOPS as unknown as number[];
|
|
5
|
+
let index = stops.indexOf(stop);
|
|
6
|
+
|
|
7
|
+
if (index === -1) {
|
|
8
|
+
throw new Error(`Invalid key value: ${stop}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return stops.map((stop) => {
|
|
12
|
+
let diff = Math.abs(stops.indexOf(stop) - index);
|
|
13
|
+
let tweakValue = tweak ? Math.round((diff + 1) * tweak * (1 + diff / 10)) : 0;
|
|
14
|
+
|
|
15
|
+
if (tweakValue > 100) {
|
|
16
|
+
return {stop, tweak: 100};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {stop, tweak: tweakValue};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {clamp} from './clamp.js';
|
|
2
|
+
import {createDistributionValues} from './createDistributionValues.js';
|
|
3
|
+
import {createHueScale} from './createHueScale.js';
|
|
4
|
+
import {createSaturationScale} from './createSaturationScale.js';
|
|
5
|
+
import {hexToHsl} from './hexToHsl.js';
|
|
6
|
+
import {hslToHex} from './hslToHex.js';
|
|
7
|
+
import {type PaletteConfig} from './PaletteConfig.js';
|
|
8
|
+
import {unsignedModulo} from './unsignedModulo.js';
|
|
9
|
+
|
|
10
|
+
export function createSwatches(palette: PaletteConfig) {
|
|
11
|
+
let hueScale = createHueScale(palette.h, palette.valueStop);
|
|
12
|
+
let saturationScale = createSaturationScale(palette.s, palette.valueStop);
|
|
13
|
+
let {h, s, l} = hexToHsl(palette.value);
|
|
14
|
+
let distributionScale = createDistributionValues(l, palette.valueStop);
|
|
15
|
+
|
|
16
|
+
let swatches = hueScale.map(({stop}, stopIndex) => {
|
|
17
|
+
let newH = unsignedModulo(h + hueScale[stopIndex]!.tweak, 360);
|
|
18
|
+
let newS = clamp(s + saturationScale[stopIndex]!.tweak, 0, 100);
|
|
19
|
+
let newL = clamp(distributionScale[stopIndex]!.value, 0.1, 99.9); // this is to make sure the first two or last two swatches (the first being total white and the last being total black) aren't the same lightness
|
|
20
|
+
let newHex = hslToHex(newH, newS, newL);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
stop,
|
|
24
|
+
hex: stop === palette.valueStop ? palette.value.toUpperCase() : newHex.toUpperCase(),
|
|
25
|
+
h: newH,
|
|
26
|
+
hScale: ((unsignedModulo(hueScale[stopIndex]!.tweak + 180, 360) - 180) / 180) * 50,
|
|
27
|
+
s: newS,
|
|
28
|
+
sScale: newS - 50,
|
|
29
|
+
l: newL,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return swatches;
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {hexToRgb} from './hexToRgb.js';
|
|
2
|
+
|
|
3
|
+
export function hexToHsl(rawHex: string) {
|
|
4
|
+
let hex = rawHex;
|
|
5
|
+
|
|
6
|
+
if (hex.length === 6 && !hex.startsWith(`#`)) {
|
|
7
|
+
hex = `#${hex}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let {r, g, b} = hexToRgb(hex);
|
|
11
|
+
|
|
12
|
+
r /= 255;
|
|
13
|
+
g /= 255;
|
|
14
|
+
b /= 255;
|
|
15
|
+
|
|
16
|
+
let cmin = Math.min(r, g, b);
|
|
17
|
+
let cmax = Math.max(r, g, b);
|
|
18
|
+
let delta = cmax - cmin;
|
|
19
|
+
let h = 0;
|
|
20
|
+
let s = 0;
|
|
21
|
+
let l = 0;
|
|
22
|
+
|
|
23
|
+
if (delta === 0) {
|
|
24
|
+
h = 0;
|
|
25
|
+
} else if (cmax === r) {
|
|
26
|
+
h = ((g - b) / delta) % 6;
|
|
27
|
+
} else if (cmax === g) {
|
|
28
|
+
h = (b - r) / delta + 2;
|
|
29
|
+
} else {
|
|
30
|
+
h = (r - g) / delta + 4;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h = Math.round(h * 60);
|
|
34
|
+
|
|
35
|
+
if (h < 0) {
|
|
36
|
+
h += 360;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
l = (cmax + cmin) / 2;
|
|
40
|
+
s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
41
|
+
s = +(s * 100).toFixed(1);
|
|
42
|
+
l = +(l * 100).toFixed(1);
|
|
43
|
+
|
|
44
|
+
return {h, s, l}; // values can be used like this: `hsl(${h}, ${s}%, ${l}%)`
|
|
45
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function hexToRgb(rawHex: string) {
|
|
2
|
+
let hex = rawHex;
|
|
3
|
+
|
|
4
|
+
if (hex.length === 6 && !hex.startsWith(`#`)) {
|
|
5
|
+
hex = `#${hex}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let r = `0`;
|
|
9
|
+
let g = `0`;
|
|
10
|
+
let b = `0`;
|
|
11
|
+
|
|
12
|
+
if (hex.length === 4) {
|
|
13
|
+
r = `0x${hex[1]}${hex[1]}`;
|
|
14
|
+
g = `0x${hex[2]}${hex[2]}`;
|
|
15
|
+
b = `0x${hex[3]}${hex[3]}`;
|
|
16
|
+
} else if (hex.length === 7) {
|
|
17
|
+
r = `0x${hex[1]}${hex[2]}`;
|
|
18
|
+
g = `0x${hex[3]}${hex[4]}`;
|
|
19
|
+
b = `0x${hex[5]}${hex[6]}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return {r: Number(r), g: Number(g), b: Number(b)};
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {hslToRgb} from './hslToRgb.js';
|
|
2
|
+
|
|
3
|
+
export function hslToHex(h: number, s: number, l: number) {
|
|
4
|
+
let {r, g, b} = hslToRgb(h, s, l);
|
|
5
|
+
|
|
6
|
+
let rHex = r.toString(16);
|
|
7
|
+
let gHex = g.toString(16);
|
|
8
|
+
let bHex = b.toString(16);
|
|
9
|
+
|
|
10
|
+
if (rHex.length === 1) {
|
|
11
|
+
rHex = `0${rHex}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (gHex.length === 1) {
|
|
15
|
+
gHex = `0${gHex}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (bHex.length === 1) {
|
|
19
|
+
bHex = `0${bHex}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return `#${rHex}${gHex}${bHex}`;
|
|
23
|
+
}
|