GithubHelp home page GithubHelp logo

myxvisual / react-uwp Goto Github PK

View Code? Open in Web Editor NEW
1.2K 52.0 77.0 143.16 MB

📱⌨ React Components that Implement Microsoft's UWP Design & Fluent Design.

Home Page: https://react-uwp.com

License: MIT License

TypeScript 99.30% JavaScript 0.49% CSS 0.20%
uwp microsoft-uwp fluent microsoft-fluent uwp-design fluent-design react typescript javascript react-components

react-uwp's Introduction

img

cdnjs npm package Build Status

PeerDependencies Dependencies DevDependencies

React Components that Implement Microsoft's UWP Design & Fluent Design System.

img Visit react-uwp.com online to review the API, see the components in action with live. Or build the documentation to locally.

Installation

React-UWP is available as an npm package.

Use NPM to get React-UWP components and core styling. All you need is node.js and gulp.

npm install --save react-uwp

Usage

React-UWP components require a theme to be provided. The quickest way to get up and running is by using the Theme to inject the theme into your application context.then, you can use any of the components as demonstrated in documentation.

If you coding by Typescript, add ReactUWP namespace to tsconfig.json.

{
  "compilerOptions": {
    "typeRoots": [
      "./node_modules/@types"
    ],
    "filesGlob": [
      "**/*.ts",
      "**/*.tsx"
    ],
    "files": [
      "node_modules/react-uwp/index.d.ts" // add to here.
    ]
  }
}

./App.js

import * as React from "react";
import * as ReactDOM from "react-dom";
import { Theme as UWPThemeProvider, getTheme } from "react-uwp/Theme";
import MyComponent from "./MyComponent";

export class App extends React.Component {
  render() {
    return (
      <UWPThemeProvider
        theme={getTheme({
          themeName: "dark", // set custom theme
          accent: "#0078D7", // set accent color
          useFluentDesign: true, // sure you want use new fluent design.
          desktopBackgroundImage: "http://127.0.0.1:8092/staticimages/jennifer-bailey-10753.jpg" // set global desktop background image
        })}
      >
        <MyComponent />
      </UWPThemeProvider>
    )
  }
}

ReactDOM.render(
  <App />,
  document.getElementById("app")
);

./MyComponent.js

import * as React from "react";
import Button from "react-uwp/Button";

export default class MyComponent extends React.Component<void, void> {
  render() {
    return (
      <Button tooltip="Mini Tooltip" />
    )
  }
}

Notice: that in the above example, we used:

import Button from "react-uwp/Button";

instead of

import { Button } from "react-uwp";

This will make your build process faster and your build output smaller.

For a complete mapping of React-UWP components to import, see /src/index.ts inside the React-UWP npm package root directory.

Custom Theme

We have implemented a default theme to render all React-UWP components. Styling components to your liking is simple and hassle-free. This can be achieved in the following two ways:

Four Theme Style (Fluent Design & UWP Design)

img

react-uwp's People

Contributors

7coil avatar caffeine-driven avatar dafrok avatar dependabot[bot] avatar jokester avatar myxvisual avatar peterdanis avatar peterdavehello avatar wkich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-uwp's Issues

Propose to lock dependency versions (possibly with yarn)

Problem description

Dependencies installed with npm install may have incorrect versions, and cause build to fail.

Propose

Adding a npm-shrinkwrap.json or yarn.lock file with a build-able version should be enough.
This makes it easier for future contributiors to start (users of npm package will not be affacted).

showLabel prop on DOM element

Problem description

NavigationView passes the showLabel prop to DOM elements causing a warning:

Warning: React does not recognize the showLabel prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase showlabel instead. If you accidentally passed it from a parent component, remove it from the DOM element.

Link to minimal working code that reproduces the issue

Versions

  • React-UWP: 1.1.6
  • React: 3.2.14
  • Browser: Chrome

ColorPicker has some performance problems

Problem description

https://i.imgur.com/9Ud0X5z.png
I've had some problems with ColorPicker component for a while. It takes so much time to render in IE11 to the point where the browser freezes and lets the user stop the script. After it loads it takes just as much time to choose a different color. On Desktop Chrome the entire circle was gray for some time but it's fixed itself somehow for some reason. It stays gray on the Android version though. It's also a bit laggy on Firefox.

Link to minimal working code that reproduces the issue

located in the settings tab: https://webstickynotes.herokuapp.com/

Versions

  • React-UWP: 1.1.8
  • React: 16.3.2
  • Browser: Android Chrome, IE11, Desktop Chrome for some time before but works good for now for some reason

Get TS2320 and TS2415 in webpack with awesome-typescript-loader.

Problem description

Get TS2320 and TS2415 in webpack with awesome-typescript-loader.

Link to minimal working code that reproduces the issue

My code is same to this #issue:#36

Versions

  • React-UWP: 1.1.8
  • React:16.2
  • Browser: Electron
ERROR in [at-loader] ./node_modules/react-uwp/CheckBox/index.d.ts:13:18
    TS2320: Interface 'CheckBoxProps' cannot simultaneously extend types 'DataProps' and 'HTMLAttributes<HTMLDivElement>'.
  Named property 'defaultChecked' of types 'DataProps' and 'HTMLAttributes<HTMLDivElement>' are not identical.

ERROR in [at-loader] ./node_modules/react-uwp/ScrollBar/index.d.ts:19:22
    TS2415: Class 'ScrollBar' incorrectly extends base class 'Component<ScrollBarProps, ScrollBarState>'.
  Types of property 'refs' are incompatible.
    Type '{ view?: HTMLDivElement | undefined; thumb?: HTMLDivElement | undefined; }' is not assignable to type '{ [key: string]: ReactInstance; }'.
      Property 'view' is incompatible with index signature.
        Type 'HTMLDivElement | undefined' is not assignable to type 'ReactInstance'.
          Type 'undefined' is not assignable to type 'ReactInstance'.

titleWrapperStyle / Modal Form with Inputs

Problem description

I'm trying to create a modal with form inputs like so:
image
I'm using the ContentDialog currently:

<ContentDialog
  className='dialog'
  defaultShow={visible}
  statusBarTitle={'Add Visit'}
  showCloseButton={true}
  primaryButtonText={'Add'}
  secondaryButtonText={'Close'}
  contentNode={
    <div>
      <div>
        <span>Country</span>
        <TextBox />
      </div>
      <div>
        <span>State</span>
        <TextBox />
      </div>
      <div>
        <span>City</span>
        <TextBox />
      </div>
      <div>
        <span>Start</span>
        <CalendarDatePicker />
      </div>
      <div>
        <span>End</span>
        <CalendarDatePicker />
      </div>
    </div>
  }
/>

but that leaves a massive gap where the title property should go. Am I using the correct component? If so, could i get titleWrapperStyle exposed as a property on ContentDialog so i can set display: none; on it.

Link to minimal working code that reproduces the issue

see above

Versions

  • React-UWP: 1.1.9
  • React: 16.3.2
  • Browser: Chrome 67.0.3396.87

Cross-Origin Request Blocked (segmdl2.eot) Firefox

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdnjs.cloudflare.com/ajax/libs/react-uwp/1.1.0/fonts/segmdl2.eot. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

FireFox seems to have this issue and can be assessed using firefox and going to https://www.react-uwp.com/ in the console.

Get many error about namespace 'ReactUWP' in webpack

Problem description

Link to minimal working code that reproduces the issue

Versions

  • React-UWP: v1.1.8
  • React: 16.2.0
  • Browser: Electron(Chrome)

My tsconfig.json:

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "jsx": "react",
    "sourceMap": true,
    "outDir": "./dist/",
    "strict": true, 
    "noImplicitAny": true,
    "typeRoots": [
      "./node_modules/@types"
    ],
    "filesGlob": [
      "**/*.ts",
      "**/*.tsx"
    ],
    "files": [
      "./node_modules/react-uwp/index.d.ts"
    ]
  },
  "include": [
    "./src/**/*"
  ]
}

My webpack.config.js

module.exports = {
    entry: "./src/index.tsx",
    output: {
        filename: "bundle.js",
        path: __dirname + "/dist"
    },

    // Enable sourcemaps for debugging webpack's output.
    devtool: "source-map",
    target: "electron-renderer",

    resolve: {
        // Add '.ts' and '.tsx' as resolvable extensions.
        extensions: [".ts", ".tsx", ".js", ".json"]
    },

    module: {
        rules: [
            // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
            {
                test: /\.tsx?$/,
                loader: "awesome-typescript-loader"
            },

            // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
            {
                enforce: "pre",
                test: /\.js$/,
                loader: "source-map-loader"
            },
            {
                test: /\.css$/,
                loader: "css-loader"
            },
            {
                test: /\.scss$/,
                use: [{
                    loader: "style-loader" // creates style nodes from JS strings 
                }, {
                    loader: "css-loader" // translates CSS into CommonJS 
                }, {
                    loader: "sass-loader" // compiles Sass to CSS 
                }]
                // loader: ExtractTextPlugin.extract("style", 'css!sass')
            }
        ]
    },

    // When importing a module whose path matches one of the following, just
    // assume a corresponding global variable exists and use that instead.
    // This is important because it allows us to avoid bundling all of our
    // dependencies, which allows browsers to cache those libraries between builds.
    // externals: {
    //     "react": "React",
    //     "react-dom": "ReactDOM"
    // },
};

Error in compile:


[at-loader] Using [email protected] from typescript and "tsconfig.json" from E:\node\react-start/tsconfig.json.


[at-loader] Checking started in a separate process...
Hash: 05b497a214cabf9f5d1b
Version: webpack 3.10.0
Time: 6365ms
        Asset     Size  Chunks                    Chunk Names
    bundle.js   997 kB       0  [emitted]  [big]  main
bundle.js.map  1.13 MB       0  [emitted]         main
  [28] ./src/index.tsx 337 bytes {0} [built]
  [39] ./src/Test.tsx 807 bytes {0} [built]
  [52] (webpack)/buildin/amd-define.js 88 bytes {0} [built]
    + 89 hidden modules

WARNING in ./node_modules/react-uwp/styles/fonts/segoe-mdl2-assets/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../../../src/styles/fonts/segoe-mdl2-assets/index.ts': Error: Can't resolve '../../../../src/styles/fonts/segoe-mdl2-assets/index.ts' in 'E:\node\react-start\node_modules\react-uwp\styles\fonts\segoe-mdl2-assets'
 @ ./node_modules/react-uwp/Theme/index.js 40:26-70
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/nodeJS/IS_NODE_ENV.js
(Emitted value instead of an instance of Error) Cannot find source file '../../../src/common/nodeJS/IS_NODE_ENV.ts': Error: Can't resolve '../../../src/common/nodeJS/IS_NODE_ENV.ts' in 'E:\node\react-start\node_modules\react-uwp\common\nodeJS'
 @ ./node_modules/react-uwp/Theme/index.js 41:20-59
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/react/isUnitlessNumber.js
(Emitted value instead of an instance of Error) Cannot find source file '../../../src/common/react/isUnitlessNumber.ts': Error: Can't resolve '../../../src/common/react/isUnitlessNumber.ts' in 'E:\node\react-start\node_modules\react-uwp\common\react'
 @ ./node_modules/react-uwp/styles/StyleManager.js 14:25-68
 @ ./node_modules/react-uwp/Theme/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Button/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Button/index.tsx': Error: Can't resolve '../../src/Button/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Button'
 @ ./src/Test.tsx 6:17-44
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Icon/icons.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Icon/icons.ts': Error: Can't resolve '../../src/Icon/icons.ts' in 'E:\node\react-start\node_modules\react-uwp\Icon'
 @ ./node_modules/react-uwp/Icon/index.js 33:14-32
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Icon/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Icon/index.tsx': Error: Can't resolve '../../src/Icon/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Icon'
 @ ./node_modules/react-uwp/Button/index.js 33:13-31
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Theme/getBaseCSSText.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Theme/getBaseCSSText.tsx': Error: Can't resolve '../../src/Theme/getBaseCSSText.tsx' in 'E:\node\react-start\node_modules\react-uwp\Theme'
 @ ./node_modules/react-uwp/Theme/index.js 38:23-50
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Theme/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Theme/index.tsx': Error: Can't resolve '../../src/Theme/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Theme'
 @ ./src/Test.tsx 5:16-42
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Toast/ToastWrapper.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Toast/ToastWrapper.tsx': Error: Can't resolve '../../src/Toast/ToastWrapper.tsx' in 'E:\node\react-start\node_modules\react-uwp\Toast'
 @ ./node_modules/react-uwp/Theme/index.js 37:21-53
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/Tooltip/index.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/Tooltip/index.tsx': Error: Can't resolve '../../src/Tooltip/index.tsx' in 'E:\node\react-start\node_modules\react-uwp\Tooltip'
 @ ./node_modules/react-uwp/Button/index.js 34:16-37
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/prefixAll.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/common/prefixAll.ts': Error: Can't resolve '../../src/common/prefixAll.ts' in 'E:\node\react-start\node_modules\react-uwp\common'
 @ ./node_modules/react-uwp/styles/getTheme.js 15:18-48
 @ ./node_modules/react-uwp/Theme/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/setStyleToElement.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/common/setStyleToElement.ts': Error: Can't resolve '../../src/common/setStyleToElement.ts' in 'E:\node\react-start\node_modules\react-uwp\common'
 @ ./node_modules/react-uwp/ElementState.js 33:26-63
 @ ./node_modules/react-uwp/PseudoClasses.js
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/common/spreadObject.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/common/spreadObject.ts': Error: Can't resolve '../../src/common/spreadObject.ts' in 'E:\node\react-start\node_modules\react-uwp\common'
 @ ./node_modules/react-uwp/PseudoClasses.js 34:21-53
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/StyleManager.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/StyleManager.ts': Error: Can't resolve '../../src/styles/StyleManager.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 32:21-54
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/darkTheme.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/darkTheme.ts': Error: Can't resolve '../../src/styles/darkTheme.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 33:18-48
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/generateAcrylicTexture.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/generateAcrylicTexture.ts': Error: Can't resolve '../../src/styles/generateAcrylicTexture.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 39:31-74
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/styles/getTheme.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/styles/getTheme.ts': Error: Can't resolve '../../src/styles/getTheme.ts' in 'E:\node\react-start\node_modules\react-uwp\styles'
 @ ./node_modules/react-uwp/Theme/index.js 34:17-46
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/ElementState.js
(Emitted value instead of an instance of Error) Cannot find source file '../src/ElementState.tsx': Error: Can't resolve '../src/ElementState.tsx' in 'E:\node\react-start\node_modules\react-uwp'
 @ ./node_modules/react-uwp/PseudoClasses.js 33:21-46
 @ ./node_modules/react-uwp/Button/index.js
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/PseudoClasses.js
(Emitted value instead of an instance of Error) Cannot find source file '../src/PseudoClasses.tsx': Error: Can't resolve '../src/PseudoClasses.tsx' in 'E:\node\react-start\node_modules\react-uwp'
 @ ./node_modules/react-uwp/Button/index.js 32:22-49
 @ ./src/Test.tsx
 @ ./src/index.tsx

WARNING in ./node_modules/react-uwp/RenderToBody.js
(Emitted value instead of an instance of Error) Cannot find source file '../src/RenderToBody.tsx': Error: Can't resolve '../src/RenderToBody.tsx' in 'E:\node\react-start\node_modules\react-uwp'
 @ ./node_modules/react-uwp/Theme/index.js 36:21-47
 @ ./src/Test.tsx
 @ ./src/index.tsx

ERROR in [at-loader] ./node_modules/react-uwp/Button/index.d.ts:23:16 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:9:13 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:11:32 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:12:35 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:19:17 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:28:31 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:29:32 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:32:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:33:33 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:34:42 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:34:87 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:35:34 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:36:29 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:39:16 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:46:30 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:46:70 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:47:35 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:48:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:48:68 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Theme/index.d.ts:49:41 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/Toast/ToastWrapper.d.ts:17:16 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:19:12 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:36:17 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:40:26 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:62:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/StyleManager.d.ts:68:28 
    TS2503: Cannot find namespace 'ReactUWP'.

ERROR in [at-loader] ./node_modules/react-uwp/styles/getTheme.d.ts:11:62 
    TS2503: Cannot find namespace 'ReactUWP'.

顺便问一句,我能说中文吗(英语捉急)?

Production Suitability

Hey, can i run it in production for a small website? Are there any major bugs left unresolved? I am exploring various ump javascript libraries. Can you suggest some other alternatives that you might have came across?

canvas.toBlob does not exist on edge.

On edge, canvas.toBlob does not exist, but there's a similar (but not same) method named canvas.msToBlob.

To erase the error, I wrote some dirty workaround:

HTMLCanvasElement.prototype.toBlob = function(callback) {
  callback(this.msToBlob());
}

but it's not a good solution, maybe we need a better way to deal with it?

Problems of react-uwp in Electron.

  • React-UWP: 1.1.8
  • React: 16.3.2
  • Browser: Electron 2.0.0 so...Probably chromium

I would like to use this design ui. So I applied it according to the guide for my electron project. The background image works well for photos, but the components have no css at all.

So when I applied it to the React test project for testing, the code and method are the same but very well applied.
As a result of comparing the two projects, we found that the style tag added to the head part of the resulting html code is not added.
I do not know if I've applied it to other electron projects, but the problem has not been solved.

I wonder if there is any way to solve this problem.
The electrons used are electron-react-boilerplate and electron-react-webpack-boilerplate.

Issues with DropDownMenu Component

Problem description

They way DropDownMenu is currently built, it won't work with a lot of form libraries. Also, it has severe restrictions that a standard <select> has not.

Three main points:

  • You cannot assign a default onChange listener from a lib (e.g. from formik or redux-form, because onChangeValue just returns the value, not a normal form field event
  • If the form re-renders, the selected option is lost - and there is no way to set it. You would have to reshuffle the values prop in order to display the correct selected option again?
  • Values equal display text
    • For example, you can assign <option> elements a value and a text. So the value can be independent of the display text (which is good for Intl). With the current architecture, you would have to map the return value for all languages to get a programmatic value you can work with.

Is there any chance to rebuild the component as a standard select field? Or maybe just include a select field that is hidden, and extract the options from there?

Link to minimal working code that reproduces the issue

n. a.

Versions

  • React-UWP: 1.1.8
  • React: 16.3.2
  • Browser: all

Performance improvement

Problem description

The official site has really pool performance

Link to minimal working code that reproduces the issue

https://www.react-uwp.com/

Versions

  • React-UWP: You know
  • React: You know
  • Browser: macOS Sierra, latest Chrome

When I open the official site, it gets stuck too often, and the animation frame drops frequently, it looks beautiful, but I'm afraid it won't works well in mobile devices.

Cannot find namespace 'ReactUWP'.

Problem description

By following topic on your website I get started.
But I am getting an error message as "Cannot find namespace 'ReactUWP'."

Link to minimal working code that reproduces the issue

Versions

  • React-UWP:"^1.2.0"
  • React:"^16.4.1",
  • Browser: Chrome Version 67.0.3396.99 (Official Build) (64-bit)

加油!

非常喜欢你的UIstyle。
但是不知道为什么只有250个star !
加油,坚持!

navigationBottomNodes.props.visited overwrite by the NavigationView

源码上看,NavigationView内部自己管理哪些navigationNodes要处于visited的状态
但有时候,NavigationView的调用者并不希望有visitied效果,比如windows10的开始菜单,底部的按钮有的是'链接'(如设置),有的会点击后会出现菜单(如关机).
但目前,NavigationView总是会有visited效果

<NavigationView
  navigationBottomNodes={[<SplitViewCommand key={"123123123"} icon="Shuffle" visited={false} />]}
/>

在看NavigationView源码之前,我认为只要给SplitViewCommandvisited设置false,就不可能被visited

How to make the CommandBar's background transparent?

Problem description

According to the UWP app, "Photo" of Windows10 (version 1709), the CommandBar's background is transparent(or maybe acrylic). I want that kind of CommandBar, but I failed. Here's my code:

<CommandBar
  content={("Bar Foo")}
  labelPosition="right"
  primaryCommands={[
          <AppBarButton icon="Shuffle" key="1" label="Shuffle" />,
    ]}
  style={{ background: 'transparent'}}
//  style={{ background: theme.acrylicTexture60.background }}
/>
<CommandBar
  content={("Bar Foo")}
  labelPosition="right"
  primaryCommands={[
          <AppBarButton icon="Shuffle" key="1" label="Shuffle" />,
    ]}
  contentStyle={{ background: 'transparent'}}
/>

I think it's more elegant to overwritten the components' default style with CSS file, instead of "CSS in JS".

bug in ssr in version 1.1.1

Hi,
I recently updated the dependency to 1.1.1 and it seems there is bug in it while performing ssr due use of document to generate default style if none is present.
Here is the code i ran:


 <ApolloProvider client={this.apollo}>
          <UWPThemeProvider
            theme={getTheme({
              themeName: 'dark', // set custom theme
              accent: '#0078D7', // set accent color
              useFluentDesign: true, // sure you want use new fluent design.
              userAgent: this.props.userAgent
            })}>
          <ComposedComponent {...this.props}/>
          </UWPThemeProvider>
        </ApolloProvider>

The error thrown while fetching the ssr page is:

ReferenceError: document is not defined
at StyleManager.setupStyleElement (C:\Code\consert\frontend\node_modules\react-uwp\styles\StyleManager.js:37:38)
at new StyleManager (C:\Code\consert\frontend\node_modules\react-uwp\styles\StyleManager.js:120:14)
at Theme._this.bindNewThemeMethods (C:\Code\consert\frontend\node_modules\react-uwp\Theme\index.js:130:32)
at Theme.render (C:\Code\consert\frontend\node_modules\react-uwp\Theme\index.js:326:14)
at C:\Code\consert\frontend\node_modules\react-dom\lib\ReactCompositeComponent.js:795:21

Note that issue happens only while doing ssr. While this code works perfectly fine with version 1.1.0

Convert DropDownMenu to select element

Since DropDownMenu does not use <select /> element and <option /> element this does not allow the usage of keys making it difficult to locate a selection without reimplementing a value targeting handler event in DropDownMenu. I am unsure whether the intentions of the design were focused on limited number of values/options or an oversight when using an implementation of the TextField/TextBox component.

No acrylic textures - documentation needed...

As you can see, there's no acrylic texture, just a darkened overlay:

IMG

I have followed your "Getting Started" code as closely as I can, but couldn't figure out how to create the acrylic textures.

class App extends React.Component {
  render() {
    return (
      <div className="App">
        <UWPThemeProvider
          style={{height:'100%'}}
          theme={getTheme({
            themeName: 'dark',
            accent: '#0078D7',
            useFluentDesign: true,
            desktopBackgroundImage: 'https://openphoto.net/volumes//zotz/20080618/openphotonet_P6180310.JPG'
          })}
          needGenerateAcrylic={true}
        >
          <ShellComponent />
        </UWPThemeProvider>
      </div>
    );
  }
}

export default class ShellComponent extends React.Component {
    static contextTypes = { theme: PropTypes.object };
    context: { theme: ReactUWP.ThemeType };

    render() {
        const { theme } = this.context;
        if (theme == null) {
            return; 
        }
               
        const navigationTopNodes = [
            <SplitViewCommand label="Home" icon={'\uE716'} key="home"/>,
            <SplitViewCommand label="Print" icon="PrintLegacy" key="print"/>
        ];
        const navigationBottomNode = [
            <SplitViewCommand label="Settings" icon={'\uE713'} key="settings"/>,
            <SplitViewCommand label="CalendarDay" icon={'\uE161'} key="calendar"/>
        ];
        
        return (           
                <NavigationView
                    pageTitle="Test Ltd."
                    displayMode="overlay"
                    defaultExpanded={true}
                    autoResize={false}                 
                    style={{height: '100vh'}}
                    navigationTopNodes={navigationTopNodes}
                    navigationBottomNodes={navigationBottomNode}
                    focusNavigationNodeIndex={1}
                >                
                </NavigationView>
        ); 
    }
}

Any idea of what is wrong? Thanks!

Broken fonts and images

Problem description

There some broken fonts and images on the website (not sure if this is the right repo for reporting).

https://www.react-uwp.com/HEAD/static/segmdl2.woff2   
https://www.react-uwp.com/HEAD/static/segmdl2.woff   
https://www.react-uwp.com/HEAD/static/segmdl2.ttf  

RadioButtonGroup

No RadioButtonGroup??

In RadioButton component, it mentioned about RadioButtonGroup. I've tried to search for it, but it turns out nothing. Without it, the RadioButton would be useless. Is it available yet?

NavigationView initWidth not working as expected

@myxvisual Hi,
Apparently, setting NavigationView initWidth property has no effect whatsoever. If my understanding is correct, then it is used for setting initial width of navigation view. Also, expanded width is working properly.
Here is the code:

<NavigationView style={{height: '100vh', margin: 10}} displayMode="overlay" autoResize={true} background="none" initWidth={100} expandedWidth={200} navigationTopNodes={navigationTopNodes} > </NavigationView>

backgroundimage not working

Problem description

When I set background image it shows: "TypeError: Cannot convert undefined or null to object"

return <UWPThemeProvider
            theme={getTheme({
                themeName: "light", // set custom theme
                accent: "#0078D7", // set accent color
                useFluentDesign: true, // sure you want use new fluent design.
                desktopBackgroundImage: "http://127.0.0.1:3000/static/images/bg1.jpg" // set global desktop background image
            })}
        >

Here is whole error message:


TypeError: Cannot convert undefined or null to object
Theme._this.sureNeedGenerateAcrylic
node_modules/react-uwp/Theme/index.js:197
  194 | if (needGenerateAcrylic &&
  195 |     newTheme.desktopBackgroundImage === currTheme.desktopBackgroundImage) {
  196 |     if (currTheme.useFluentDesign) {
> 197 |         Object.assign(currTheme.isDarkTheme ? _this.cacheDarkAcrylicTextures : _this.cacheLightAcrylicTextures, {
  198 |             acrylicTexture40: currTheme.acrylicTexture40,
  199 |             acrylicTexture60: currTheme.acrylicTexture60,
  200 |             acrylicTexture80: currTheme.acrylicTexture80
View compiled
Theme../node_modules/react-uwp/Theme/index.js.Theme.componentWillReceiveProps
node_modules/react-uwp/Theme/index.js:294
  291 | var _this = this;
  292 | var theme = nextProps.theme;
  293 | var currTheme = this.state.currTheme;
> 294 | var needGenerateAcrylic = this.sureNeedGenerateAcrylic(theme);
  295 | if (nextProps && nextProps.theme && !this.props.autoSaveTheme) {
  296 |     if (theme.accent !== currTheme.accent ||
  297 |         theme.themeName !== currTheme.themeName ||
View compiled
callComponentWillReceiveProps
node_modules/react-dom/cjs/react-dom.development.js:6389
  6386 | function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) {
  6387 |   startPhaseTimer(workInProgress, 'componentWillReceiveProps');
  6388 |   var oldState = instance.state;
> 6389 |   instance.componentWillReceiveProps(newProps, newContext);
  6390 |   stopPhaseTimer();
  6391 | 
  6392 |   // Simulate an async bailout/interruption by invoking lifecycle twice.
View compiled

Link to minimal working code that reproduces the issue

Versions

  • React-UWP: 1.1.8
  • React: 16.2.0
  • Browser:

DropDownMenu running onChangeValue despite no changes

If you click on the DropDownMenu and do not select anything or select the same value it will run the onChange function despite no changes causing unnecessary dispatches/rerenders when using redux.

I tried to remedy the issue by preventing any actions if the value is the same as currently selected:

handleValueChange = val => {
  if (this.state.selectedValue !== val) {
    this.setState({ selectedValue: val })
  }
}
<DropDownMenu
  defaultValue={this.state.selectedValue}
  values={this.state.values}
  onChangeValue={this.handleValueChange}
/>

The problem with this approach is that while it does prevent unnecessary onChangeValue runs it locks the component in a valueless state when you toggle the component and click outside the options. Pitfall of not using <select>/<option />?

Add external SVG as Icon

hi!
thanks for the exceptional work!

Is there any possibility of adding an SVG file as an icon in the SplitViewCommand?
Thank you!
Sorry if I'm posting in an inappropriate place, but I do not know where to check.

Examples Addition

Hi,
I was just trying to use the library with next.js. And, I think react-uwp integration with it is not as straightforward. The main problem lies in injecting application context managed by framework. As seen on this issue .
Thus, I looked in to their example repo and found material ui project theme example , and I guess integration will be quite similar. But, I am currently working on different priority right now.
Also, I think that developing an integration example with it and creating a pull request for addition in examples directory of next.js will create the further awarness for this project.
Adding, an examples directory like that of next.js in react-uwp project for would be a nice idea. I have seen the docs directory having one, but the name sound slight un-intitutive to me. Don't you think 'examples' as root directory name and 'docs' as sub directory name would be a better option? At some place in doc antcores is mentioned, can you include its source code too as an example too?

Typings not working

Problem description

typings error -

Cannot find namespace 'ReactUWP'.

"typeRoots": [ "./node_modules/@types", "./node_modules/react-uwp" // add to here. ], // .... "include": [ "./node_modules/react-uwp/index.d.ts" // or add to here. ]

both the above methods not working

  • React-UWP:1.1.8
  • React: 16.2.0
  • Browser: Chrome

Support for server side rendering(SSR)?

Trying to use the library on a server side rendered app but so far these errors have caused the app to crash.

  • react-uwp/styles/fonts/segoe-mdl2-assets/index.js uses document
  • react-uwp/Theme/index.js uses window
  • react-uwp/common/prefixAll.js uses window and navigator

There doesn't seem to be any webpack config to allow detection of environment so I just replaced the variables with empty objects for the time being to check it out.

Custom Tab titles rendering as all the same

Problem description

Custom Tab titles are rendering as all the same.
Thought maybe it was the icons and tried switching to text only (did not fix the issue).
I just noticed they are being funky on docs too.

Versions

  • React-UWP: ^1.1.9
  • React: ^16.4.1
  • Browser: 67.0.3396.99 (Official Build) (64-bit)
    screen shot 2018-08-08 at 12 49 21 am
    screen shot 2018-08-08 at 12 47 36 am
    screen shot 2018-08-08 at 12 47 54 am

[1.0.9]README.md中示例代码缺失引入getTheme

README.md中示例代码缺失getTheme

Missing import "getTheme" in README.md

Version: 1.0.9

ERROR:

import Theme as UWPThemeProvider from "react-uwp/Theme";

RIGHT(According to website document provided by Author):

import Theme as UWPThemeProvider, { getTheme } from "react-uwp/Theme";

另外我本人是使用的这种方式引入:

import  { Theme as UWPThemeProvider, getTheme } from "react-uwp/Theme";

作者加油,持续关注中,准备在内部一个DEMO中用用看你这个主题。有条件的话看看能不能Pull点代码上来。

文档

弱弱的问一句,为何没有中文文档?
E文看的灰常不习惯啊

Switching theme failed

Problem description

<UWPThemeProvider
            theme={getTheme({
              themeName: "light", // set custom theme
              accent: "#0078D7", // set accent color
              useFluentDesign: true, // sure you want use new fluent design.,
              desktopBackgroundImage: BackgroundImg,
            })}
          >
.....

当有背景图,且needGenerateAcrylic为true(默认为true),切换黑白主题时会出错

theme.saveTheme(
                    getTheme({
                      themeName: theme.themeName === "light" ? "dark" : "light",
                      accent: theme.accent,
                      useFluentDesign: theme.useFluentDesign,
                      desktopBackgroundImage: theme.desktopBackgroundImage
                    })
                  )

出问题的代码在这里

cacheDarkAcrylicTextures ,cacheLightAcrylicTextures 总是为undefined,这会导致Object.assign出错

[Server Side Rendering] Client side styles removing autoprefixes

warning.js:36 Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
 (client) );overflow-y:hidden;" data-reactid="69">
 (server) );overflow-y:hidden;-webkit-transition:a

I haven't dove too deep into the style handling of the components but DropDownMenu drops prefixes generated by react on the server side when hydrated on the client side. Is this potentially a result of document` object not available on the server side?

  • React-UWP: 1.1.0
  • React: 15.5.3
  • Browser: Chrome 61.0.3159.0 (Official Build) canary (64-bit)

Interface 'CheckBoxProps' cannot simultaneously extend types 'DataProps' and 'HTMLAttributes<HTMLDivElement>'. Named property 'defaultChecked' of types 'DataProps' and 'HTMLAttributes<HTMLDivElement>' are not identical.

Problem description

使用create-react-app --scripts-version=react-scripts-ts创建的空项目
使用readme的代码

编译时出现的问题

 "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts-ts": "2.10.0",
    "react-uwp": "^1.1.8"
  },
  "scripts": {
    "start": "react-scripts-ts start",
    "build": "react-scripts-ts build",
    "test": "react-scripts-ts test --env=jsdom",
    "eject": "react-scripts-ts eject"
  },
  "devDependencies": {
    "@types/jest": "^22.0.1",
    "@types/node": "^9.3.0",
    "@types/react": "^16.0.34",
    "@types/react-dom": "^16.0.3"
  }

Font license issue

Excerpt from the Segoe MDL2 icons article https://msdn.microsoft.com/windows/uwp/style/segoe-ui-symbol-font

How do I get this font?
To obtain Segoe MDL2 Assets, you must install Windows 10.

And as stated in microsoft typography faq https://www.microsoft.com/typography/faq/faq11.htm

What can I do with the fonts supplied with Microsoft products?
The fonts are governed by the same restrictions as the products they are supplied with. You are not allowed to copy, redistribute or reverse engineer the font files. For full details see the license agreement supplied with the product.

That is: Segoe MDL2 font is not suited for MIT-licensed project or any other project at all because it can't be shipped with it

I'm looking forward to your response about this issue because i really like this project, but these issues can get users into some troubles

Links to custom theme and inline style are broken

In the README.md on this repo, but also wherever the Custom theme is linked on the React UWP web site, these links are broken and are giving 404s:

https://www.react-uwp.com/styles/styling-components/custom-theme
https://www.react-uwp.com/styles/styling-components/use-inlinestyle-replace-the-default-style

This project looks really exciting, but it's difficult to even begin implementing the theme in an HTML5 UWP app. Is Typescript required, or is it possible to code in pure JavaScript? The documentation looks a bit ambiguous on this. I don't suppose there's any way of providing compiled versions of a basic JS library with accompanying HTML and CSS as a quick start for developers? Sorry to be a noob...

Typings Issue: `Interface 'ImageProps' cannot simultaneously extend types ...`

Problem description

Simple app won't build due to typings issue.

The error at the end of the Webpack build process is:

ERROR in [at-loader] ./node_modules/react-uwp/Image/index.d.ts:18:18
    TS2320: Interface 'ImageProps' cannot simultaneously extend types 'DataProps' and 'HTMLAttributes<HTMLDivElement>'.
  Named property 'placeholder' of types 'DataProps' and 'HTMLAttributes<HTMLDivElement>' are not identical.

Link to minimal working code that reproduces the issue

// tsconfig.json
{
    "compilerOptions": {
        "outDir": "./lib/",
        "sourceMap": true,
        "noImplicitReturns": true,
        "module": "commonjs",
        "target": "es5",
        "jsx": "react",
        "lib": [
            "es2018",
            "dom"
        ],
        "experimentalDecorators": true,
        "noEmitOnError": true,
        "typeRoots": [
            "./node_modules/@types"
        ]
    },
    "include": [
        "./src/**/*"
    ],
    "filesGlob": [
        "**/*.ts",
        "**/*.tsx"
      ],
      "files": [
        "node_modules/react-uwp/index.d.ts"
      ]
}
// index.tsx
import * as React from 'react';
import * as ReactDOM from 'react-dom';

import { App } from './App';

ReactDOM.render(<App/>, document.querySelector('#main'));
// App.tsx
import * as React from 'react';

import { Theme as UWPThemeProvider, getTheme } from 'react-uwp/theme';

import Test from './components/Test';

export class App extends React.Component
{
    render()
    {
        return (
            <UWPThemeProvider
                theme={getTheme({
                    themeName: 'dark',
                    accent: '#0078D7',
                    useFluentDesign: true,
                    desktopBackgroundImage: 'http://localhost:4444/banff_hockey.jpeg',
                })}
            >
                This is a test:
                <Test />
            </UWPThemeProvider>
        )
    }
}
// Test.tsx
import * as React from 'react';
import Button from 'react-uwp/Button';

export default class Test extends React.Component<{}, {}>
{
    render()
    {
        return (
            <Button tooltip="Test button" />
        );
    }
}

Versions

  • React-UWP: 1.1.9
  • React: 16.4.1

Sample project using Electron-react-bolierplate

I am trying to use Electron-react-boilerplate with React-UWP.
but React-UWP doen't work when I run above project.
I cannot find css according to React-UWP component. I found there are differences between Electron-boilder-plate and normal React project. In normal React Project, I can find runtime generated '.css' in index.html, but electron doesn't.
How can I add this runtime generated CSS to my index.html?
Could you provide a sample project?

Versions

  • React-UWP: 1.1.8
  • React: 16.2.0
  • Browser: Electron

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.