@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-action-react", | "name": "@tesseract-design/web-action-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-blob-react", | "name": "@tesseract-design/web-blob-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-choice-react", | "name": "@tesseract-design/web-choice-react", | ||||
"version": "0.0.1", | |||||
"version": "0.0.2", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -14,13 +14,26 @@ import { | |||||
it, | it, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
DropdownSelect, | DropdownSelect, | ||||
DropdownSelectDerivedElement, | DropdownSelectDerivedElement, | ||||
dropdownSelectPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('dropdownSelectPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
dropdownSelectPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('DropdownSelect', () => { | describe('DropdownSelect', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,8 +1,8 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { TextControl } from '@tesseract-design/web-base'; | import { TextControl } from '@tesseract-design/web-base'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
/** | /** | ||||
* Derived HTML element of the {@link DropdownSelect} component. | * Derived HTML element of the {@link DropdownSelect} component. | ||||
@@ -43,7 +43,7 @@ export interface DropdownSelectProps extends Omit<React.HTMLProps<DropdownSelect | |||||
hiddenLabel?: boolean, | hiddenLabel?: boolean, | ||||
} | } | ||||
export const dropdownSelectPlugin = plugin(({ addComponents }) => { | |||||
export const dropdownSelectPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.dropdown-select': { | '.dropdown-select': { | ||||
'& optgroup': { | '& optgroup': { | ||||
@@ -63,7 +63,7 @@ export const dropdownSelectPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for selecting a single value from a dropdown. | * Component for selecting a single value from a dropdown. | ||||
@@ -14,13 +14,26 @@ import { | |||||
it, | it, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
MenuSelect, | MenuSelect, | ||||
MenuSelectDerivedElement, | MenuSelectDerivedElement, | ||||
menuSelectPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('menuSelectPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
menuSelectPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('MenuSelect', () => { | describe('MenuSelect', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,8 +1,8 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { TextControl } from '@tesseract-design/web-base'; | import { TextControl } from '@tesseract-design/web-base'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
/** | /** | ||||
* Derived HTML element of the {@link MenuSelect} component. | * Derived HTML element of the {@link MenuSelect} component. | ||||
@@ -51,7 +51,7 @@ export interface MenuSelectProps extends Omit<React.HTMLProps<MenuSelectDerivedE | |||||
startingHeight?: number | string, | startingHeight?: number | string, | ||||
} | } | ||||
export const menuSelectPlugin = plugin(({ addComponents }) => { | |||||
export const menuSelectPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.menu-select': { | '.menu-select': { | ||||
'& optgroup': { | '& optgroup': { | ||||
@@ -71,7 +71,7 @@ export const menuSelectPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for selecting a single value from a menu. | * Component for selecting a single value from a menu. | ||||
@@ -14,13 +14,26 @@ import { | |||||
afterEach, | afterEach, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
RadioButton, | RadioButton, | ||||
RadioButtonDerivedElement, | RadioButtonDerivedElement, | ||||
radioButtonPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('radioButtonPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
radioButtonPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('RadioButton', () => { | describe('RadioButton', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,8 +1,8 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import { Button } from '@tesseract-design/web-base'; | import { Button } from '@tesseract-design/web-base'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
/** | /** | ||||
* Derived HTML element of the {@link RadioButton} component. | * Derived HTML element of the {@link RadioButton} component. | ||||
@@ -39,7 +39,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<RadioBu | |||||
variant?: Button.Variant; | variant?: Button.Variant; | ||||
} | } | ||||
export const radioButtonPlugin = plugin(({ addComponents }) => { | |||||
export const radioButtonPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.radio-button': { | '.radio-button': { | ||||
'& + label > :first-child > :first-child': { | '& + label > :first-child > :first-child': { | ||||
@@ -50,7 +50,7 @@ export const radioButtonPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for selecting a single value from an array of choices grouped by name. | * Component for selecting a single value from an array of choices grouped by name. | ||||
@@ -13,13 +13,26 @@ import { | |||||
afterEach, | afterEach, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
RadioTickBox, | RadioTickBox, | ||||
RadioTickBoxDerivedElement, | RadioTickBoxDerivedElement, | ||||
radioTickBoxPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('radioTickBoxPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
radioTickBoxPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('RadioTickBox', () => { | describe('RadioTickBox', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,7 +1,7 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
/** | /** | ||||
* Derived HTML element of the {@link RadioTickBox} component. | * Derived HTML element of the {@link RadioTickBox} component. | ||||
@@ -22,7 +22,7 @@ export interface RadioTickBoxProps extends Omit<React.InputHTMLAttributes<RadioT | |||||
subtext?: React.ReactNode; | subtext?: React.ReactNode; | ||||
} | } | ||||
export const radioTickBoxPlugin = plugin(({ addComponents }) => { | |||||
export const radioTickBoxPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.radio-tick-box': { | '.radio-tick-box': { | ||||
'& + label + label > :first-child > :first-child': { | '& + label + label > :first-child > :first-child': { | ||||
@@ -33,7 +33,7 @@ export const radioTickBoxPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for selecting a single value from an array of choices grouped by name. | * Component for selecting a single value from an array of choices grouped by name. | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-color-react", | "name": "@tesseract-design/web-color-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,6 +1,6 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
/** | /** | ||||
* Derived HTML element of the {@link ColorPicker} component. | * Derived HTML element of the {@link ColorPicker} component. | ||||
@@ -15,7 +15,7 @@ export interface ColorPickerProps extends Omit<React.HTMLProps<ColorPickerDerive | |||||
size?: 'small' | 'medium' | 'large'; | size?: 'small' | 'medium' | 'large'; | ||||
} | } | ||||
export const colorPickerPlugin = plugin(({ addComponents }) => { | |||||
export const colorPickerPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.color-picker': { | '.color-picker': { | ||||
'&::-webkit-color-swatch-wrapper': { | '&::-webkit-color-swatch-wrapper': { | ||||
@@ -29,7 +29,7 @@ export const colorPickerPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for picking a color. | * Component for picking a color. | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-formatted-react", | "name": "@tesseract-design/web-formatted-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-freeform-react", | "name": "@tesseract-design/web-freeform-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-information-react", | "name": "@tesseract-design/web-information-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-multichoice-react", | "name": "@tesseract-design/web-multichoice-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -14,13 +14,26 @@ import { | |||||
it, | it, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
MenuMultiSelect, | MenuMultiSelect, | ||||
MenuMultiSelectDerivedElement, | MenuMultiSelectDerivedElement, | ||||
menuMultiSelectPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('menuMultiSelectPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
menuMultiSelectPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('MenuMultiSelect', () => { | describe('MenuMultiSelect', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,7 +1,7 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { TextControl } from '@tesseract-design/web-base'; | import { TextControl } from '@tesseract-design/web-base'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
/** | /** | ||||
@@ -51,7 +51,7 @@ export interface MenuMultiSelectProps extends Omit<React.HTMLProps<MenuMultiSele | |||||
startingHeight?: number | string, | startingHeight?: number | string, | ||||
} | } | ||||
export const menuMultiSelectPlugin = plugin(({ addComponents, }) => { | |||||
export const menuMultiSelectPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.menu-multi-select': { | '.menu-multi-select': { | ||||
'& optgroup': { | '& optgroup': { | ||||
@@ -71,7 +71,7 @@ export const menuMultiSelectPlugin = plugin(({ addComponents, }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for inputting textual values. | * Component for inputting textual values. | ||||
@@ -1,9 +1,9 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { TagsInput } from './internal'; | import { TagsInput } from './internal'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useClientSide, useFallbackId, useProxyInput } from '@modal-sh/react-utils'; | import { useClientSide, useFallbackId, useProxyInput } from '@modal-sh/react-utils'; | ||||
import { TextControl } from '@tesseract-design/web-base'; | import { TextControl } from '@tesseract-design/web-base'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
export const AVAILABLE_TAG_INPUT_SEPARATORS = ['comma', 'newline', 'semicolon'] as const; | export const AVAILABLE_TAG_INPUT_SEPARATORS = ['comma', 'newline', 'semicolon'] as const; | ||||
@@ -92,7 +92,7 @@ export interface TagInputProps extends Omit<React.HTMLProps<TagInputDerivedEleme | |||||
valueSeparator?: TagInputSeparator, | valueSeparator?: TagInputSeparator, | ||||
} | } | ||||
export const tagInputPlugin = plugin(({ addComponents }) => { | |||||
export const tagInputPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.tag-input': { | '.tag-input': { | ||||
'&[data-size] label + * + div': { | '&[data-size] label + * + div': { | ||||
@@ -207,7 +207,7 @@ export const tagInputPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for inputting textual values. | * Component for inputting textual values. | ||||
@@ -14,13 +14,26 @@ import { | |||||
afterEach, | afterEach, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
ToggleButton, | ToggleButton, | ||||
ToggleButtonDerivedElement, | ToggleButtonDerivedElement, | ||||
toggleButtonPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('toggleButtonPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
toggleButtonPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('ToggleButton', () => { | describe('ToggleButton', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,7 +1,7 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import { Button } from '@tesseract-design/web-base'; | import { Button } from '@tesseract-design/web-base'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
/** | /** | ||||
@@ -43,7 +43,7 @@ export interface ToggleButtonProps extends Omit<React.InputHTMLAttributes<Toggle | |||||
indeterminate?: boolean; | indeterminate?: boolean; | ||||
} | } | ||||
export const toggleButtonPlugin = plugin(({ addComponents, }) => { | |||||
export const toggleButtonPlugin: PluginCreator = ({ addComponents, }) => { | |||||
addComponents({ | addComponents({ | ||||
'.toggle-button': { | '.toggle-button': { | ||||
'& + label > :first-child > :first-child': { | '& + label > :first-child > :first-child': { | ||||
@@ -60,7 +60,7 @@ export const toggleButtonPlugin = plugin(({ addComponents, }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for toggling a Boolean value. | * Component for toggling a Boolean value. | ||||
@@ -13,13 +13,26 @@ import { | |||||
afterEach, | afterEach, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
ToggleSwitch, | ToggleSwitch, | ||||
ToggleSwitchDerivedElement, | ToggleSwitchDerivedElement, | ||||
toggleSwitchPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('toggleSwitchPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
toggleSwitchPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('ToggleSwitch', () => { | describe('ToggleSwitch', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,6 +1,6 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
/** | /** | ||||
@@ -34,7 +34,7 @@ export interface ToggleSwitchProps extends Omit<React.InputHTMLAttributes<Toggle | |||||
uncheckedLabel?: React.ReactNode; | uncheckedLabel?: React.ReactNode; | ||||
} | } | ||||
export const toggleSwitchPlugin = plugin(({ addComponents }) => { | |||||
export const toggleSwitchPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.toggle-switch': { | '.toggle-switch': { | ||||
'& + label + label + label > :first-child': { | '& + label + label + label > :first-child': { | ||||
@@ -153,7 +153,7 @@ export const toggleSwitchPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for toggling a Boolean value in an appearance of a toggle switch. | * Component for toggling a Boolean value in an appearance of a toggle switch. | ||||
@@ -13,13 +13,26 @@ import { | |||||
afterEach, | afterEach, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
ToggleTickBox, | ToggleTickBox, | ||||
ToggleTickBoxDerivedElement, | ToggleTickBoxDerivedElement, | ||||
toggleTickBoxPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('toggleTickBoxPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
toggleTickBoxPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('ToggleTickBox', () => { | describe('ToggleTickBox', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,6 +1,6 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
/** | /** | ||||
@@ -26,7 +26,7 @@ export interface ToggleTickBoxProps extends Omit<React.InputHTMLAttributes<Toggl | |||||
indeterminate?: boolean; | indeterminate?: boolean; | ||||
} | } | ||||
export const toggleTickBoxPlugin = plugin(({ addComponents, }) => { | |||||
export const toggleTickBoxPlugin: PluginCreator = ({ addComponents, }) => { | |||||
addComponents({ | addComponents({ | ||||
'.toggle-tick-box': { | '.toggle-tick-box': { | ||||
'& + label + label > :first-child > :first-child': { | '& + label + label > :first-child > :first-child': { | ||||
@@ -43,7 +43,7 @@ export const toggleTickBoxPlugin = plugin(({ addComponents, }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for toggling a Boolean value with the appearance of a tick box. | * Component for toggling a Boolean value with the appearance of a tick box. | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-navigation-react", | "name": "@tesseract-design/web-navigation-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-number-react", | "name": "@tesseract-design/web-number-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -14,13 +14,26 @@ import { | |||||
afterEach, | afterEach, | ||||
} from 'vitest'; | } from 'vitest'; | ||||
import matchers from '@testing-library/jest-dom/matchers'; | import matchers from '@testing-library/jest-dom/matchers'; | ||||
import { PluginAPI } from 'tailwindcss/types/config'; | |||||
import { | import { | ||||
NumberSpinner, | NumberSpinner, | ||||
NumberSpinnerDerivedElement, | NumberSpinnerDerivedElement, | ||||
numberSpinnerPlugin, | |||||
} from '.'; | } from '.'; | ||||
expect.extend(matchers); | expect.extend(matchers); | ||||
describe('numberSpinnerPlugin', () => { | |||||
it('adds component styles', () => { | |||||
const pluginApi = { | |||||
addComponents: vi.fn(), | |||||
} as unknown as PluginAPI; | |||||
numberSpinnerPlugin(pluginApi); | |||||
expect(pluginApi.addComponents).toBeCalledTimes(1); | |||||
}); | |||||
}); | |||||
describe('NumberSpinner', () => { | describe('NumberSpinner', () => { | ||||
afterEach(() => { | afterEach(() => { | ||||
cleanup(); | cleanup(); | ||||
@@ -1,7 +1,7 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { TextControl } from '@tesseract-design/web-base'; | import { TextControl } from '@tesseract-design/web-base'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useBrowser, useClientSide, useFallbackId } from '@modal-sh/react-utils'; | import { useBrowser, useClientSide, useFallbackId } from '@modal-sh/react-utils'; | ||||
/** | /** | ||||
@@ -59,7 +59,7 @@ export interface NumberSpinnerProps extends Omit<React.HTMLProps<NumberSpinnerDe | |||||
initialStepDelay?: number, | initialStepDelay?: number, | ||||
} | } | ||||
export const numberSpinnerPlugin = plugin(({ addComponents, }) => { | |||||
export const numberSpinnerPlugin: PluginCreator = ({ addComponents, }) => { | |||||
addComponents({ | addComponents({ | ||||
'.number-spinner': { | '.number-spinner': { | ||||
'&[data-browser="chrome"] > input::-webkit-inner-spin-button': { | '&[data-browser="chrome"] > input::-webkit-inner-spin-button': { | ||||
@@ -80,7 +80,7 @@ export const numberSpinnerPlugin = plugin(({ addComponents, }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for inputting discrete numeric values. | * Component for inputting discrete numeric values. | ||||
@@ -1,6 +1,6 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useBrowser } from '@modal-sh/react-utils'; | import { useBrowser } from '@modal-sh/react-utils'; | ||||
const filterOptions = (children: React.ReactNode): React.ReactNode => { | const filterOptions = (children: React.ReactNode): React.ReactNode => { | ||||
@@ -66,7 +66,7 @@ export interface SliderProps extends Omit<React.HTMLProps<HTMLInputElement>, 'ty | |||||
length?: React.CSSProperties['width']; | length?: React.CSSProperties['width']; | ||||
} | } | ||||
export const sliderPlugin = plugin(({ addComponents }) => { | |||||
export const sliderPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.slider': { | '.slider': { | ||||
'& > input': { | '& > input': { | ||||
@@ -226,7 +226,7 @@ export const sliderPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for inputting continuous numeric values. | * Component for inputting continuous numeric values. | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"name": "@tesseract-design/web-temporal-react", | "name": "@tesseract-design/web-temporal-react", | ||||
"version": "0.0.1", | |||||
"version": "0.1.0", | |||||
"files": [ | "files": [ | ||||
"dist", | "dist", | ||||
"src" | "src" | ||||
@@ -1,7 +1,7 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { TextControl } from '@tesseract-design/web-base'; | import { TextControl } from '@tesseract-design/web-base'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
/** | /** | ||||
@@ -47,7 +47,7 @@ export interface DateDropdownProps extends Omit<React.HTMLProps<DateDropdownDeri | |||||
length?: number, | length?: number, | ||||
} | } | ||||
export const dateDropdownPlugin = plugin(({ addComponents }) => { | |||||
export const dateDropdownPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.date-dropdown': { | '.date-dropdown': { | ||||
'& > input::-webkit-calendar-picker-indicator': { | '& > input::-webkit-calendar-picker-indicator': { | ||||
@@ -71,7 +71,7 @@ export const dateDropdownPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for inputting date values. | * Component for inputting date values. | ||||
@@ -1,7 +1,7 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { TextControl } from '@tesseract-design/web-base'; | import { TextControl } from '@tesseract-design/web-base'; | ||||
import clsx from 'clsx'; | import clsx from 'clsx'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { PluginCreator } from 'tailwindcss/types/config'; | |||||
import { useFallbackId } from '@modal-sh/react-utils'; | import { useFallbackId } from '@modal-sh/react-utils'; | ||||
/** | /** | ||||
@@ -65,7 +65,7 @@ export interface TimeSpinnerProps extends Omit<React.HTMLProps<TimeSpinnerDerive | |||||
step?: Step | string, | step?: Step | string, | ||||
} | } | ||||
export const timeSpinnerPlugin = plugin(({ addComponents }) => { | |||||
export const timeSpinnerPlugin: PluginCreator = ({ addComponents }) => { | |||||
addComponents({ | addComponents({ | ||||
'.time-spinner': { | '.time-spinner': { | ||||
'& > input::-webkit-calendar-picker-indicator': { | '& > input::-webkit-calendar-picker-indicator': { | ||||
@@ -89,7 +89,7 @@ export const timeSpinnerPlugin = plugin(({ addComponents }) => { | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
}); | |||||
}; | |||||
/** | /** | ||||
* Component for inputting time values. | * Component for inputting time values. | ||||
@@ -1,5 +1,6 @@ | |||||
import {Config} from 'tailwindcss'; | import {Config} from 'tailwindcss'; | ||||
import defaultTheme from 'tailwindcss/defaultTheme'; | import defaultTheme from 'tailwindcss/defaultTheme'; | ||||
import plugin from 'tailwindcss/plugin'; | |||||
import { | import { | ||||
radioButtonPlugin, | radioButtonPlugin, | ||||
menuSelectPlugin, | menuSelectPlugin, | ||||
@@ -31,6 +32,7 @@ const config: Config = { | |||||
'./.storybook/**/*.html', | './.storybook/**/*.html', | ||||
], | ], | ||||
theme: { | theme: { | ||||
// TODO put into a tesseract plugin | |||||
fontFamily: { | fontFamily: { | ||||
sans: ['var(--font-sans)', ...defaultTheme.fontFamily.sans], | sans: ['var(--font-sans)', ...defaultTheme.fontFamily.sans], | ||||
headings: ['var(--font-headings)', ...defaultTheme.fontFamily.sans], | headings: ['var(--font-headings)', ...defaultTheme.fontFamily.sans], | ||||
@@ -98,20 +100,20 @@ const config: Config = { | |||||
}, | }, | ||||
}, | }, | ||||
plugins: [ | plugins: [ | ||||
radioButtonPlugin, | |||||
menuSelectPlugin, | |||||
radioTickBoxPlugin, | |||||
dropdownSelectPlugin, | |||||
colorPickerPlugin, | |||||
menuMultiSelectPlugin, | |||||
tagInputPlugin, | |||||
toggleButtonPlugin, | |||||
toggleSwitchPlugin, | |||||
toggleTickBoxPlugin, | |||||
numberSpinnerPlugin, | |||||
sliderPlugin, | |||||
dateDropdownPlugin, | |||||
timeSpinnerPlugin, | |||||
plugin(radioButtonPlugin), | |||||
plugin(menuSelectPlugin), | |||||
plugin(radioTickBoxPlugin), | |||||
plugin(dropdownSelectPlugin), | |||||
plugin(colorPickerPlugin), | |||||
plugin(menuMultiSelectPlugin), | |||||
plugin(tagInputPlugin), | |||||
plugin(toggleButtonPlugin), | |||||
plugin(toggleSwitchPlugin), | |||||
plugin(toggleTickBoxPlugin), | |||||
plugin(numberSpinnerPlugin), | |||||
plugin(sliderPlugin), | |||||
plugin(dateDropdownPlugin), | |||||
plugin(timeSpinnerPlugin), | |||||
], | ], | ||||
}; | }; | ||||