diff --git a/TODO.md b/TODO.md index e35574c..05c16e9 100644 --- a/TODO.md +++ b/TODO.md @@ -12,7 +12,7 @@ - [X] RadioTickBox - Color - [ ] ColorPicker - - [X] Swatch + - [X] Swatch (unify with color picker? Swatch is basically a readonly color picker with click-to-copy behavior) - Code - [ ] CodeInput (extract to own package) - [X] CodeBlock (`react-refractor`) @@ -24,7 +24,7 @@ - Freeform - [X] MaskedTextInput - [X] MultilineTextInput - - [X] TextInput + - [X] TextInput (add click-to-copy prop) - Geo - [ ] Map - Information @@ -66,4 +66,9 @@ # Others - [X] Add `select-none` to input labels, etc. +- [ ] Add indicators to components (select, datetime input etc) - [ ] Test all components! +- [ ] Where to put the "click-to-copy" textboxes? Does `Swatch` + belong to this category? +- [ ] Add `aria-*` attributes to all components +- [ ] react-refractor, fix rendering on Lynx! diff --git a/categories/choice/react/package.json b/categories/choice/react/package.json index 46c5050..d261e0d 100644 --- a/categories/choice/react/package.json +++ b/categories/choice/react/package.json @@ -28,7 +28,6 @@ "react-dom": "^18.2.0", "react-test-renderer": "^18.2.0", "tslib": "^2.5.0", - "tsx": "^3.12.7", "typescript": "^4.9.5", "vitest": "^0.33.0" }, @@ -38,7 +37,7 @@ }, "scripts": { "prepublishOnly": "pridepack clean && pridepack build", - "build": "pridepack build && tsx scripts/build.ts", + "build": "pridepack build", "type-check": "pridepack check", "lint": "pridepack lint", "clean": "pridepack clean", @@ -63,7 +62,8 @@ }, "dependencies": { "@tesseract-design/web-base": "workspace:*", - "clsx": "^1.2.1" + "clsx": "^1.2.1", + "tailwindcss": "3.3.2" }, "types": "./dist/types/index.d.ts", "main": "./dist/cjs/production/index.js", @@ -77,13 +77,9 @@ "require": "./dist/cjs/production/index.js", "import": "./dist/esm/production/index.js", "types": "./dist/types/index.d.ts" - }, - "./dist/DropdownSelect.css": "./dist/DropdownSelect.css", - "./dist/MenuSelect.css": "./dist/MenuSelect.css", - "./dist/RadioButton.css": "./dist/RadioButton.css", - "./dist/RadioTickBox.css": "./dist/RadioTickBox.css" + } }, "typesVersions": { "*": {} } -} \ No newline at end of file +} diff --git a/categories/choice/react/scripts/build.ts b/categories/choice/react/scripts/build.ts deleted file mode 100644 index cda40be..0000000 --- a/categories/choice/react/scripts/build.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { copyFileSync, readFileSync, writeFileSync } from 'fs'; -import { resolve } from 'path'; - -const doCopy = (src: string, dest: string) => { - const trueSrc = resolve(src); - const trueDest = resolve(dest); - console.log('Copying...'); - console.log(`${trueSrc} -> ${trueDest}`); - copyFileSync(trueSrc, trueDest); - const packageJsonContents = readFileSync('./package.json', 'utf-8'); - const packageJson = JSON.parse(packageJsonContents); - packageJson.exports[dest] = dest; - const newPackageJsonContents = JSON.stringify(packageJson, null, 2); - console.log('Updating package.json...'); - writeFileSync('./package.json', newPackageJsonContents); - console.log('Done'); -} - -doCopy('./src/components/DropdownSelect/DropdownSelect.css', './dist/DropdownSelect.css'); -doCopy('./src/components/MenuSelect/MenuSelect.css', './dist/MenuSelect.css'); -doCopy('./src/components/RadioButton/RadioButton.css', './dist/RadioButton.css'); -doCopy('./src/components/RadioTickBox/RadioTickBox.css', './dist/RadioTickBox.css'); diff --git a/categories/choice/react/src/components/ComboBox/index.tsx b/categories/choice/react/src/components/ComboBox/index.tsx index 49bd0ab..9ed76ab 100644 --- a/categories/choice/react/src/components/ComboBox/index.tsx +++ b/categories/choice/react/src/components/ComboBox/index.tsx @@ -115,6 +115,34 @@ export const ComboBox = React.forwardRef( style={style} data-testid="base" > + {label && ( + <> + + {' '} + + )} ( }, )} /> - {label && ( - - )} {hint && (
option { - color: rgb(var(--color-positive)); - text-transform: none; - font-size: 1.333333em; -} - -.tesseract-design-dropdown-select option { - user-select: none; -} diff --git a/categories/choice/react/src/components/DropdownSelect/index.tsx b/categories/choice/react/src/components/DropdownSelect/index.tsx index a1b021b..ce53192 100644 --- a/categories/choice/react/src/components/DropdownSelect/index.tsx +++ b/categories/choice/react/src/components/DropdownSelect/index.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import { TextControl } from '@tesseract-design/web-base'; +import plugin from 'tailwindcss/plugin'; import clsx from 'clsx'; /** @@ -45,6 +46,28 @@ export interface DropdownSelectProps extends Omit { + addComponents({ + '.dropdown-select': { + '& optgroup': { + 'color': 'rgb(var(--color-positive) / 50%)', + 'text-transform': 'uppercase', + 'font-size': '0.75em', + 'margin-top': '0.5rem', + 'user-select': 'none', + }, + '& optgroup > option': { + 'color': 'rgb(var(--color-positive))', + 'text-transform': 'none', + 'font-size': '1.333333em', + }, + '& option': { + 'user-select': 'none', + }, + }, + }); +}); + /** * Component for selecting a single value from a dropdown. */ @@ -84,6 +107,34 @@ export const DropdownSelect = React.forwardRef + {label && ( + <> + + {' '} + + )} - {label && ( - - )} {hint && (
option { - color: rgb(var(--color-positive)); - text-transform: none; - font-size: 1.333333em; -} - -.tesseract-design-menu-select option { - user-select: none; -} diff --git a/categories/choice/react/src/components/MenuSelect/index.tsx b/categories/choice/react/src/components/MenuSelect/index.tsx index 583244d..e681f72 100644 --- a/categories/choice/react/src/components/MenuSelect/index.tsx +++ b/categories/choice/react/src/components/MenuSelect/index.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { TextControl } from '@tesseract-design/web-base'; import clsx from 'clsx'; +import plugin from 'tailwindcss/plugin'; /** * Derived HTML element of the {@link MenuSelect} component. @@ -49,6 +50,28 @@ export interface MenuSelectProps extends Omit { + addComponents({ + '.menu-select': { + '& optgroup': { + 'color': 'rgb(var(--color-positive) / 50%)', + 'text-transform': 'uppercase', + 'font-size': '0.75em', + 'margin-top': '0.5rem', + 'user-select': 'none', + }, + '& optgroup > option': { + 'color': 'rgb(var(--color-positive))', + 'text-transform': 'none', + 'font-size': '1.333333em', + }, + '& option': { + 'user-select': 'none', + }, + }, + }); +}); + /** * Component for selecting a single value from a menu. */ @@ -86,6 +109,34 @@ export const MenuSelect = React.forwardRef + {label && ( + <> + + {' '} + + )} - {label && ( - - )} {hint && (
+ {label && ( + <> + + {' '} + + )} - {label && ( - - )} {hint && (
+ {label && ( + <> + + {' '} + + )} )} - {label && ( - - )} {hint && (
( style={style} data-testid="base" > + {label && ( + <> + + {' '} + + )} ( }, )} /> - {label && ( - - )} {hint && (
+ {label && ( + <> + + {' '} + + )} - {label && ( - - )} {hint && (
+ {label && ( + <> + + {' '} + + )}