Skip to content

Commit

Permalink
milestone/001 - core components (#38)
Browse files Browse the repository at this point in the history
* task/TUP-272 - core components fixup (#7)

* feat(core-components): copy & polish from cepv2

These comp…s:
- were copied from cepv2
- were made more modular
- have react-based dependencies

Not cepv2 comp…s were copied, because some are not easy to make modular.

Comp…s were copied May 4, 2022. Some have since changed in CEPv2, e.g.:
- Button
- Paginator
- (maybe) Message

* feat(comp…s): cepv2 update but w/ new styles paths

Source: TACC/Core-Portal#639

* feat(comp…s): 2nd cepv2 update (no path updates)

* feat(comp…s): cepv2 update: button tests, unmerged

Source: TACC/Core-Portal#640

* fix(comp…s): fix core-styles paths (libs → lib)

* feat(comp…s): update all paths to core-styles src

Some of these may be able to use dist... I haven't checked yet.

* feat(comp…s): fix paths that can use styles dist

One of the paths is still src/lib/_imports. CMS has this problem often.

To use src/lib/_imports instead of dist, see TUP-274.

* fix(styles): all src/lib imports to use rel. paths

Avoid users needing resolution paths specific to core-styles hierarchy.

* fix(styles): src/lib rel. paths need no _imports/

Hotfix previous commit: aab21ba
"fix(styles): all src/lib imports to use rel. paths"

* fix(tup-ui): load CSS from correct path

* Convert Button and dependencies to TS

* Add reactstrap global

* Replace temporary Message component to exports

* Use Button from core-components in tup-ui

* Added babel-plugin-postcss for core-components

* Formatting

* linting

* Formatting

* Task/tup 272  core components vite (#8)

* Vite library build for core-components

* Icon allows react node children

* Add testing-library/react

* Fix tests

* Fix test

* Formatting

* vite output directory

* clean tup-ui on build

Co-authored-by: Wesley Bomar <wbomar@tacc.utexas.edu>

* task/TUP-280 -- UI patterns (#12)

* Add UI-Patterns app

* Section exports from core-components

* DescriptionList

* Messages

* Paginator

* Pill

* Dropdown selector

* Same tsconfig settings in tup-ui

* Show more

* Section and Infinite Scroll Table

* Add components for Sidebar (disabled)

* Add react-router-dom v6

* Sidebar

* Formatting and linting

* linting for core-components

* task/TUP-280, 282, 283 -- UI patterns (fixes), CSS vars, styles (#14)

* Add UI-Patterns app

* Section exports from core-components

* DescriptionList

* Messages

* Paginator

* Pill

* Dropdown selector

* Same tsconfig settings in tup-ui

* Show more

* Section and Infinite Scroll Table

* Add components for Sidebar (disabled)

* Add react-router-dom v6

* Sidebar

* Formatting and linting

* linting for core-components

* fix(core-components): import failures

1. Load from `src/lib/_imports/`:
    - Can't load core-styles from its `dist`.
    - I don't know why.
    - I do know `.gitignore` is not the problem.\*

    \* I tested disabling it's `dist` entry.

2. Add required CSS file from Portal:
    - Portal used `components/bootstrap.form.css`.
    - CMS did not, but CMS started Core Styles.
    - So Core Styles did not have `…/bootstrap.form.css`.

* fix(core-styles): dist ignore comment, README typo

1. Fix the comment about dist in `.gitignore`.
2. Fix the path inaccuracy in `README`.

* fix(core-components): css syntax & missing values

* feat: postcss config & deps

Tested only with:
- `nx build core-components`
- `nx serve ui-patterns`

* fix(core-components): do not use scss

* docs(core-styles): css lint & syntax highlight

* fix(core-styles): missing css vars from portal

* fix(core-components): explicitely import css vars

* fix(core-components): no css var within calc()

Such a variable cannot be reduced:
https://github.com/postcss/postcss-calc#usage

Without reduction, i.e. if var stays, var definition must be preserved:
https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-properties#preserve

If var preserved, then we may be unable to avoid duplicate vars:
vitejs/vite#4448 (comment)

* fix(ui-patterns): add missing button patterns

Patterns were recently added to portal: tertiary, active, loading.

They had a couple active state bugs, which I also fixed:
- wrong sample code in UI Pattern for Active button
- class typo in Button.module.css

* fix(core-styles): explicit var import for patterns

This should be done to all core-styles stylesheets.

But that will have an uncertain effect on CMS.

So for now, just make this work for core-components.

* fix:(ui-patterns): show actual class name passed

Mimicked by: TACC/Core-Portal#663

* fix(core-styles): add missing font family vars

* fix(ui-patterns): explicit var import for patterns

Just like I did earlier for core-components: 4c0bf2b.

* chore(ui-patterns): do not import unused styles

* chore(tup-ui): do not import unused styles

* docs(ui-patterns): link to ITCSS organization doc

* docs(tup-ui): link to ITCSS organization doc

* feat(core-styles): add o-fixed-header-table

* feat(core-components): use o-fixed-header-table

Use o-fixed-header-table for InfiniteScrollTable via core-styles.

* feat(core-styles): cortal icons

* fix(core-components): icon styles, font, props

* fix(ui-patterns): missing space between buttons

* feat(core-styles): components/bootstrap.modal.css

* feat: install bootstrap ^4.6.0

* fix(ui-patterns): global css (inc. bootstrap)

also, re-document (simpler, broader) index.css

* fix(core-components): hide Spinner Loading... text

* fix(core-components): do not use Reactstrap Button

* fix(core-components): (wip) tsx button prop limits

Restrict combinations of button props type and size.

Works only in file. Does not work in practice:
- Use <Button> with bad props in Button.tsx, VS Code complains.
- Use <Button> with bad props in UIPatternsButton.tsx, VS Code ignores.

Also, removed related test cases, cuz TypeScript prevents need, right?

* fix(core-styles): auto width for size-less buttons

Set a default width for buttons that:
- have no width
- have no size
- are not links

This resolves ac5dcf8 having removed default size.

* fix(core-components): mostly no use native button

- Do not use native button for typical buttons.
- The close button for Messages is atypical.

* fix(core-components): ShowMore Button type

This was not completely converted from Reactstrap to Core Component.

* fix(ui-patterns): nx format:write

* fix(core-components): nx format:write

* fix(core-styles): nx format:write

* fix: match reactstrap version to bootstrap version

* Revert "fix(core-components): hide Spinner Loading... text"

This reverts commit d5bfc79.

Since commit 4a873cb," Loading..." text is automatically hidden.
- Reactstrap 9 and Bootstrap 5 use ".visually-hidden" class.
- Rectstrap 8 and Bootstrap 4 uses ".sr-only" class.

To avoid other unexpected bugs, I suggest same Bootstrap as CEPv2.

Or… we reveal and fix any bugs (reference Bootstrap 4 → 5 migration).

* fix(core-styles): vertically align button content

Why `c-button` not `cortal.icon`?
- This must be applied to the text and icon elements to work.

Why not use inline-flex et cetera?
- Because sibling buttons vertical alignment broken when I tried it.

Inspiration: TACC/Core-Portal@307c54a

* fix(tup-ui): style links, no use wb-link

Style hyperlinks. Remove unused "wb-link" classes.

* fix(core-components): message no override .wb-link

1. Message need not overwrite ".wb-link" (class dropped in 08ad3da).
2. Add an active state. \*

\* Design does not care to distinguish link states.

* fix(ui-patterns): activeClassN… react-r…-dom ver.

Use same react-router-dom version as CEPv2 to make activeClassName work.
- downgrade react-router-dom
- use switch and component props

* fix(core-components): Sidebar styles

1. Remove unused class "nav-content".
2. Use anchor tag pseduo classes to overwrite "elements.css".
3. Add missing style for nav content.

Depends on: e859114 (i.e. previous commit)

* feat(core-components): simpler Sidebar styles

1. No "content" wrapper div.
2. Move "content" wrapper div styles to link.
3. Move text padding to icon.
  - Because the padding exists only because icon exists.
  - Required adding a Sidebar "icon" class.

Builds off: 2243276 (i.e. previous commit)

* chore(ui-patterns): nx format:write

* chore(core-comp…s): load form css at dist not src

* chore(core-comp…s): load css settings from dist

Co-authored-by: Joon-Yee Chuah <jchuah@tacc.utexas.edu>

* fix(core-components): missing dependency, dependency alternative (#13)

* fix(core-components): CSS and Dependency imports

* chore(tup-ui): minimize #13 diff

* chore(core-components): minimize diff ie remove space

* task/TUP - 284 -- core wrappers (#15)

* Port tapis-ui/_wrappers

* UIPatternsComplexWizard

* Fix components to switch rather than route

* Field array of field arrays step

* Simple wizard

* Formatting and linting

* Fix wizard continue

* Fix complex wizards value loading

* Clarity on initialvalues vs defaultvalues in simple wizard

* Formatting

* Fix unit tests

* fix collapse icon

* Replace ErrorMessage component with formtext

* Fix config files

* Formatting

* Add validation to wizards

* Bump react-router-dom to v6.3.0

* Version bump reactstrap

* navlink active classname

Co-authored-by: Wesley Bomar <wbomar@tacc.utexas.edu>
Co-authored-by: Wesley B <62723358+wesleyboar@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 25, 2022
1 parent 673c0c8 commit 9a1e061
Show file tree
Hide file tree
Showing 234 changed files with 20,224 additions and 5,311 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
"files": ["*.js", "*.jsx"],
Expand Down
14 changes: 14 additions & 0 deletions .postcssrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins:
postcss-preset-env:
# https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env#stage
stage: false

# https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-preset-env/FEATURES.md
features:
custom-properties:
# https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-properties#options
preserve: false
custom-media-queries: true
media-query-ranges: true
custom-selectors: true
nesting-rules: true
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@


# Tacc

This project was generated using [Nx](https://nx.dev).

Things to try:

- `npx nx serve tup-ui` to run the app
- `npx nx build core-components` to create a distributable library for the core components.
- `npx nx build core-styles` to build the style library.
Expand Down Expand Up @@ -84,8 +83,6 @@ Run `nx graph` to see a diagram of the dependencies of your projects.

Visit the [Nx Documentation](https://nx.dev) to learn more.



## ☁ Nx Cloud

### Distributed Computation Caching & Distributed Task Execution
Expand Down
2 changes: 1 addition & 1 deletion apps/tup-ui/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"options": {
"commands": [
{
"command": "npx vite build"
"command": "npx vite build --emptyOutDir"
}
],
"cwd": "apps/tup-ui"
Expand Down
12 changes: 8 additions & 4 deletions apps/tup-ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { Message } from '@tacc/core-components';
import { Button, Message } from '@tacc/core-components';

function App() {
const [count, setCount] = useState(0);
Expand All @@ -8,11 +8,15 @@ function App() {
<div className="App">
<header className="App-header">
<p>Hello Vite + React!</p>
<Message />
<Message type="warning">Core-Components Message</Message>
<p>
<button type="button" onClick={() => setCount((count) => count + 1)}>
<Button
onClick={() => setCount((count) => count + 1)}
size="long"
type="primary"
>
count is: {count}
</button>
</Button>
</p>
<p>
Edit <code>App.tsx</code> and save to test HMR updates.
Expand Down
7 changes: 3 additions & 4 deletions apps/tup-ui/src/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* SETTINGS */
@import url('@tacc/core-styles/dist/settings/border.css');
/* below, import local styles (if any) */
/* ITCSS Organization */
/* SEE: https://confluence.tacc.utexas.edu/x/IAA9Cw */

/* GENERIC */
/* @import url('@tacc/core-styles/dist/generics/*.css'); */
Expand All @@ -11,7 +10,7 @@
/* below, import local styles (if any) */

/* OBJECTS */
@import url('@tacc/core-styles/dist/objects/o-flex-item-table-wrap.css');
/* @import url('@tacc/core-styles/dist/objects/*.css'); */
/* below, import local styles (if any) */

/* COMPONENTS */
Expand Down
4 changes: 2 additions & 2 deletions apps/tup-ui/src/styles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Global stylesheets may `@import` project stylesheets, e.g.:
**`index.css`**

```
@import url('styles/.../settings/color.css');
@import url('@tacc/core-styles/.../settings/color.css');
```

### Import from Component Stylesheets
Expand All @@ -24,7 +24,7 @@ Component stylesheets may `@import` project stylesheets, e.g.:
**`components/(.../)SomeProjectComponent.module.css`**

```
@import url('styles/tools/media-queries.css');
@import url('@tacc/core-styles/.../tools/media-queries.css');
@media screen and (--short-and-above) and (--medium-and-above) {
selector {
Expand Down
1 change: 0 additions & 1 deletion apps/tup-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
Expand Down
11 changes: 11 additions & 0 deletions apps/ui-patterns/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
[
"@nrwl/react/babel",
{
"runtime": "automatic"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions apps/ui-patterns/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
13 changes: 13 additions & 0 deletions apps/ui-patterns/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions apps/ui-patterns/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'ui-patterns',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/ui-patterns',
};
56 changes: 56 additions & 0 deletions apps/ui-patterns/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/ui-patterns/src",
"projectType": "application",
"targets": {
"serve": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx vite"
}
],
"cwd": "apps/ui-patterns"
}
},
"build": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx vite build --emptyOutDir"
}
],
"cwd": "apps/ui-patterns"
}
},
"preview": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx vite preview"
}
],
"cwd": "apps/ui-patterns"
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/ui-patterns/**/*.{ts,tsx,js,jsx}"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/apps/ui-patterns"],
"options": {
"jestConfig": "apps/ui-patterns/jest.config.ts",
"passWithNoTests": true
}
}
},
"tags": []
}
15 changes: 15 additions & 0 deletions apps/ui-patterns/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import UIPatterns from './UIPatterns';

const App: React.FC = () => {
return (
<Router>
<Routes>
<Route path="/" element={<UIPatterns />} />
</Routes>
</Router>
);
};

export default App;
5 changes: 5 additions & 0 deletions apps/ui-patterns/src/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TACC Core Portal - UIPatterns

This is a temporary (for-dev-eyes-only) solution to allow isolated testing of UI components.

The long term solution is an [automated UI Pattern Library](https://confluence.tacc.utexas.edu/x/FADMBQ).
18 changes: 18 additions & 0 deletions apps/ui-patterns/src/app/UIPatterns.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Block */

.container {
/* FAQ: Only defined so "Elements: Tags" can be styled */
}

/* Elements */

.list-item {
font-size: 14px;
margin-top: 20px;
}

/* Elements: Tags */

.container dt > small {
display: block;
}
76 changes: 76 additions & 0 deletions apps/ui-patterns/src/app/UIPatterns.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from 'react';
import { Section } from '@tacc/core-components';
import UIPatternsMessage from './UIPatternsMessage';
import UIPatternsSection from './UIPatternsSection';
import UIPatternsDescriptionList from './UIPatternsDescriptionList';
import UIPatternsDropdownSelector from './UIPatternsDropdownSelector';
import UIPatternsPill from './UIPatternsPill';
import UIPatternsShowMore from './UIPatternsShowMore';
import UIPatternsPaginator from './UIPatternsPaginator';
import UIPatternsButton from './UIPatternsButton';
import UIPatternsSidebar from './UIPatternsSidebar';
import UIPatternsWizard from './UIPatternsWizard';
import UIPatternsComplexWizard from './UIPatternsComplexWizard';
import styles from './UIPatterns.module.css';

const UIPatterns: React.FC = () => {
return (
<Section
introMessageName="UI"
className={styles.container}
header="UI Patterns"
content={
<>
<div className={styles['list-item']}>
<h6>Section</h6>
<UIPatternsSection />
</div>
<div className={styles['list-item']}>
<h6>Message &amp; Notification</h6>
<UIPatternsMessage />
</div>
<div className={styles['list-item']}>
<h6>DropdownSelector</h6>
<UIPatternsDropdownSelector />
</div>
<div className={styles['list-item']}>
<h6>DescriptionList</h6>
<UIPatternsDescriptionList />
</div>
<div className={styles['list-item']}>
<h6>Pills</h6>
<UIPatternsPill />
</div>
<div className={styles['list-item']}>
<h6>Show More</h6>
<UIPatternsShowMore />
</div>
<div className={styles['list-item']}>
<h6>Paginator</h6>
<UIPatternsPaginator />
</div>
<div className={styles['list-item']}>
<h6>Button</h6>
<UIPatternsButton />
</div>
<div className={styles['list-item']}>
<h6>Sidebar</h6>
<UIPatternsSidebar />
</div>
<div className={styles['list-item']}>
<h6>Wizard</h6>
<UIPatternsWizard />
</div>
<div className={styles['list-item']}>
<h6>Complex Wizard</h6>
<UIPatternsComplexWizard />
</div>
</>
}
contentLayoutName="oneColumn"
contentShouldScroll
/>
);
};

export default UIPatterns;
Loading

0 comments on commit 9a1e061

Please sign in to comment.