Giter Club home page Giter Club logo

widgets's Introduction

@dojo/widgets

Build Status codecov npm version

A suite of pre-built Dojo widgets, ready to use in your web application. These widgets are built using Dojo's widget authoring system (@dojo/framework/core).

Usage

To use @dojo/widgets in your project, you will need to install the package:

npm install @dojo/widgets

This package contains all of the widgets in this repo.

All of the widgets are on the same release schedule, that is to say, that we release all widgets at the same time. Minor releases may include new widgets and/or features, whereas patch releases may contain fixes to more than 1 widget.

To use a widget in your application, you will need to import each widget individually:

import Button from '@dojo/widgets/button';

Each widget module has a default export of the widget itself, as well as named exports for things such as properties specific to the widget:

import Button, { ButtonProperties } from '@dojo/widgets/button';

Because each widget is a separate module, when you create a release build of your application, you will only include the widgets that you have explicitly imported. This allows our dojo cli build tooling to make sure that the production build of your application only includes the widgets you use and is as small as possible.

Features

  • All widgets are supported in all evergreen browsers (Chrome, Edge, Firefox, IE11+, and Safari) as well as popular mobile browsers (Mobile Safari, Chrome on Android).

  • All widgets are designed to be accessible. If custom ARIA semantics are required, widgets have an aria property that may be passed an object with custom aria-* attributes.

  • All widgets are fully themeable. Example themes are available in the @dojo/themes repository.

  • All widgets support internationalization (i18n)

Widgets

Live examples of current widgets are available in the widget showcase.

Form widgets

Button

Calendar

Checkbox

CheckboxGroup

ComboBox

DateInput

EmailInput

FloatingActionButton

Form

Label

List

Listbox

NativeSelect

NumberInput

OutlinedButton

PasswordInput

Progress

Radio

RadioGroup

RaisedButton

RangeSlider

Select

Slider

Switch

TextArea

TextInput

TimePicker

Typeahead

Layout widgets

Accordion

Card

Header

HeaderCard

SlidePane

SplitPane

TabContainer

ThreeColumnLayout

TitlePane

TwoColumnLayout

Misc widgets

Avatar

BreadcrumbGroup

Chip

ChipTypeahead

ConstrainedInput

ContextMenu

ContextPopup

Grid

Dialog

GlobalEvent

Icon

LoadingIndicator

Pagination

Progress

Result

Snackbar

SpeedDial

TriggerPopup

Toolbar

Tooltip

Conventions

EventHandlers

You can register event handlers that get called when the corresponding events occur by passing the handlers into a widget's properties. The naming convention for event handlers is as follows:

  • if the parent of the widget has the power to decide if an event is successful, i.e. can cancel the event, then the child widget will call an event handler in the following format:

onRequest[X], e.g. for a close event, the event handler called by the child widget must be called onRequestClose

Here the child widget is requesting that the close event take place.

  • for events that will occur regardless of child/parent interaction, then the Request naming convention is dropped:

on[X], e.g. for a dismiss event, the event handler called by the child widget must be called onDismiss

Icons

We use font awesome for icons. Where a theme requires specific icons that are not part of the Font Awesome set, then those themes will ship their own icons.

Icon fonts are generated using IcoMoon. If a new icon is required, it is possible to upload the current dojoSelect.json from src/theme/fonts and then add new icons by selecting from the Font Awesome library. After selecting the new icons from the library, merge them down into the current icon set, then delete the rest of the Font Awesome icons that were added by IcoMoon. After this you can export and download them as a zip. Once downloaded you will also need to unzip them and replace the font files (svg, woff, ttf) in src/theme/fonts. Now download the new selection JSON file from the projects page of IcoMoon and replace the current dojoSelection.json file.

To make use of the new icons it is necessary to update the icon.m.css file in the theme folder with the new unicode icon like so:

.newIcon:before {
	content: "\f123";
}

Where \f123 is the unicode character for the new icon. To check the new icon works you can render it in the src/widgets/examples/icon/Basic.tsx to make sure everything renders correctly.

There is an icon widget that aids in creating in proper semantics and provides type-checking for the type of icon.

Coding conventions

px vs. em - we specify font sizes in px. When creating a widget, spacing (margin, padding) should be specified using px unless the design calls for proportional spacing, in which case em can be used.

Z-index layering

Widgets adhere to a basic convention for using specific ranges of z-index values based on function and visual context. This convention is followed in both individual widget CSS and in the Dojo theme styles. These values can be overridden in a custom theme if necessary since no z-index values are set in fixed styles.

The range definitions are as follows:

  • 0 - 100: Any specific component layering, e.g. a caption over an image.
  • 100 - 200: Fixed position elements. Fixed headers and footers are clear examples of fixed page elements, but it could also include a drag-and-drop element in a drag state.
  • 200 - 300: Partial-page overlays such as Slide panes.
  • 300 - 400: Full-page overlays such as Dialogs.
  • 400 - 500: Body level popups, tooltips and alerts.

How to customize a widget

There are many ways in which you can customize the behavior and appearance of Dojo widgets. See the core README for examples of how to customize the theme or a specific CSS class of a widget.

Or can you write your own widget that extends an official widget.

Extending widgets

Because all Dojo widgets are Classes, you can simply extend the Class to add or change its behavior.

export class MyWidget extends Button {
...
}

Dojo widgets provide standard extension points to allow you to customize their behavior. For more details, please refer to the widget authoring system.

Individual widgets also provide certain types of extension points where applicable:

  • render*: Large render functions are split up into multiple smaller pieces that can be more easily overridden to create custom vdom.
  • getModifierClasses: Modify the array of conditionally applied classes like css.selected or css.disabled. Not all widgets include these extension points, and some have additional overridable methods.

Widget Variants

When writing a widget variant, ie. RaisedButton, you should ensure that you use theme.compose from the widget theme middleware. This allows your variant to interit css from it's base widget whilst allowing it to be themed separately.

How do I contribute?

We appreciate your interest! Please see the Dojo Meta Repository for the Contributing Guidelines and Style Guide.

Note that all changes to widgets should work with the dojo theme. To test this start the example page (instructions at Installation section) and select the dojo option at the top of the page.

Installation

To start working with this package, clone the repository and run npm install.

In order to build the project run npm run build.

Testing

Test cases MUST be written using Intern using the Object test interface and Assert assertion interface.

90% branch coverage MUST be provided for all code submitted to this repository, as reported by istanbul’s combined coverage results for all supported platforms.

To test locally in node run:

npm run test

Widget Examples

The Dojo widget examples application is located in src/examples.

To add a new example, create a directory that matches the directory name of the widget e.g. src/examples/src/widgets/text-input. Each widget must have an example called Basic.tsx and an entry in the src/examples/src/config.ts keyed by the name of the widget directory. The widget example should import widgets from @dojo/widgets and not via a relative import. It is very important that the config entry name (ie. text-input) matches the folder name / css file name of the widget otherwise the doc build will fail.

{
    'text-input: {
        filename: 'index',
        overview: {
            example: {
                module: BasicCheckbox,
                filename: 'Basic'
            }
        },
        examples: [
            {
                title: 'The example title',
                description: 'Optional example description',
                module: OtherCheckbox,
                filename: 'Other'
            }
        ]
    }
}
  • filename: The name of the widget module, defaults to index
  • overview: The configuration for the basic example including the imported Basic module and the example filename (has to be 'Basic')
  • examples: Additional examples for the widget, an array of configuration that specifies the title, description, module and example filename.

To view the examples locally run npm run dev in the root directory and navigate to http://localhost:9999, this starts the examples in watch mode and should update widget module are changed. Note that you do not have to install dependencies in the src/examples project, this will result in an error.

Widget Documentation

The widget examples and documentation is automatically generated by the examples application when built with the docs feature flag set to true. The site relies on a few conventions in order to be able do this:

  1. A widgets properties interface must be the name of the widget with a suffix of Properties, e.g. for text-input the properties interface would be TextInputProperties
  2. The widget properties must be exported to ensure they are visible in the generated widget documentation.
  3. All themeable styles must be added to the corresponding theme css module in src/theme and match the name of the widget directory e.g. text-input.m.css
  4. For properties description docs must be included inline above each property, e.g.
  5. All widgets must have a README.md file in their root directory.
interface ExampleProperties {
    /** This is the description for foo */
    foo: string;
    /** This is the description for bar */
    bar: string;
}

To build the documentation run npm run build:docs and to build and serve the documentation in watch mode run npm run build:docs:dev

Running the examples on Codesandbox

The examples also run on Codesanbox, to run the examples on the master branch go to https://codesandbox.io/s/github/dojo/widgets/tree/master/src/examples. To run the examples for a specific user/branch/tag adjust the url as required.

Licensing information

© 2018 JS Foundation. New BSD license.

widgets's People

Contributors

aciccarello avatar agubler avatar azu avatar bitpshr avatar bryanforbes avatar dylans avatar edhager avatar ericos avatar jameslmilner avatar kanefreeman avatar kitsonk avatar lzhoucs avatar maier49 avatar matt-gadd avatar msssk avatar mwistrand avatar nicknisi avatar pottedmeat avatar rishson avatar rorticus avatar samends avatar schontz avatar sebilasse avatar simonscholz avatar smhigley avatar tomdye avatar umaar avatar vansimke avatar xiaohulu 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

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

widgets's Issues

Create initial theme

Enhancement

All aesthetic-only styling for existing components should be pulled out into an initial theme. Currently, all styling for components exists in the base styles, which shouldn't be the case.

Tooltip widget

Specification

This widget provides tooltip behaviour.

Features

  • You specify the content for a tooltip.
  • Tooltip content can contain arbitrary vDOM nodes and widgets, e.g.

screen shot 2017-03-30 at 2 30 03 pm

- The tooltip can be positioned to open in different directions, _relative_ to the element that causes the tooltip to be shown, e.g. `{position: TooltipPosition.TopCenter}` would open a tooltip above the element.

screen shot 2017-03-30 at 2 32 50 pm

  • You can specify the event that will launch a tooltip. Usually this will be the hover of an element, but it could also be a click event etc.

Value-add of the widget (e.g. why use rather than just use VDom directly)
Ability to provide advanced styling and animation.

List of callback funcs that can be passed in props (if any)
onHide
onShow

Mouse/keyboard interactions (if any)
Depends on the content of the tooltip. If the tooltip contained widgets, then would you need to be able to tab into this content - or is this horrendous UX 🤔 This affects the acceptance criteria.

Mandatory/valid/empty/wait states (if any)
None

Is the widget controlled/uncontrolled
Controlled

List of any icons needed

Design input required (inc responsive design)
Look and feel of the tooltip, pointing arrow.

Any other considerations:

Questions

Acceptance criteria

When I perform an action that should make a tooltip appear, the tooltip appears, without obscuring the element that I was interacting with.
When I perform an action that should make the tooltip disappear, then when the tooltip is no longer shown, the focus should be on the element that had focus before the tooltip was shown.

Pixels vs relative units

Age old debate, and one I'm sure that we are all bored of, but we need to be consistent across our widgets regarding sizing in px vs em vs rem.
Things we need to decide upon:

  • are there any a11y implications of this choice?
  • is sizing a single Dojo 2 component on a website a priority for us, and how should we allow this?
  • when we consider our own themes, how do we want to work with breakpoints (media queries) and sizing, e.g. breakpoints in px or em or rem...

Addon support for TextInput

Specification

This widget builds on the existing textInput widget and allow the user to specify an 'addon'.

Below is an example of addons from bootstrap. It shows leading, trailing and multiple addons:

screen shot 2017-03-29 at 2 05 26 pm

Features

  • You can have both leading and trailing addons on a single textInput.
  • You can specify text, icon, or text + icon for either leading or trailing addons.
  • You can include form widgets such as a checkbox or radioCheckbox in an addon.

Value-add of the widget (e.g. why use rather than just use VDom directly)
builds on the existing textInput and offers visual prompts to aid completion, e.g. type of values accepted

List of callback funcs that can be passed in props (if any)
none

Mouse/keyboard interactions (if any)
possibility to show different tooltips when hovering over leading and trailing addons

Mandatory/valid/empty/wait states (if any)
none

Is the widget controlled/uncontrolled
as per textInput

List of any icons needed
any icon in font-awesome that we ship should be usable as either a leading or trailing icon.

Design input required
Need to consider how we style an invalid or mandatory input that has addons.
Need to consider using addons and putting a textInput into a wait state.
Need to consider how we style addons if the textInput is disabled.

Any other considerations:
Initial support will not include changing the icon based on validity of the textInput.
With an input of type search, will Addon provide all we need to effectively offer a Search widget?

Questions

Need to consider if the icons should be spoken as they are included for informative purposes.
Need to consider what happens if long text is specified for an addon. Do we ellid the text, always show, ..

Acceptance criteria

When I specify an addon with text and an invalid icon, then I expect the text to be rendered without the icon.
When I specify an addon with unicode text, then I expect it to render correctly (including adjusting for height of non-latin chars).

Form elements and submitting forms

If you had a form widget, with a child textInput and checkbox widgets, how would we collect up the current state of the children on an onsubmit event of the form?
Specifically, I think we need to think about how this would work if we made our form elements into uncontrolled components.

The answer may be simple, but I'd like to know the way forward so I can add 'form widget support' as a spec item for the form element issues.

@smhigley @bitpshr @tomdye - another one for you lot i'm afraid 😄

Custom Element Wrapper - Dialog

Enhancement

Dialog is the only widget that landed prior to the custom element support, so need to retrospectively create the custom element wrapper.

Form component

Enhancement

Create a Form component that uses core/request for submission. Example usage.

Specification

Callback props (can also be overridden in an extended Form):

preventSubmit(): boolean;
getData(): any;
onBeforeSubmit(event: Event): void;
onSubmit(event: Event): void;
onAfterSubmit(response: Response): void;

Interaction
None.

States
A Form will most likely be created by a parent component that also creates the child form components. For example, an App component may create a Form and put a TextInput inside it. In this scenario, the App component would be responsible for running validation logic on the TextInput. The common parent component would use preventSubmit to check child element validity (which it should already have cached).

Value add
If we just used a regular HTML <form>, the user would have to do the following for every form in an app:

  1. Listen for submit and cancel it
  2. Use dojo/core/request to build a custom request
  3. Conditionally issue that request based on child validity

The Form component would be a conveninece wrapper around this functionality.

Controlled or uncontrolled
The Form itself is uncontrolled and can support either controlled or uncontrolled form elements.

Icons
None.

Responsive design
None.

Dialog never receives `role` attribute.

Bug

The Dialog widgets uses a const enum to set the role attribute on the dialog node; however, this value will always be the enum number, not the string it represents. For example, role defaults to Role.dialog, which will always 0 rather than dialog. As such, Maquette completely ignores the attribute since it is not a string.

Consider dropping the index.html per example

Nearly all the example index.html's are identical apart from the require they make to the actual example module. I get the feeling this may be a maintenance burden in the future.

Perhaps we should just have one index.html somewhere near the root that takes the module id of the example as a query string.

Textarea widget

Enhancement
Related to #5

Features:

  • Includes styles for disabled, required, valid, and invalid states
  • accepts callback functions for:
    • onBlur
    • onChange
    • onClick
    • onFocus
    • onInput
    • onKeyDown
    • onKeyPress
    • onKeyUp
    • onMouseDown
    • onMouseUp
    • onTouchStart
    • onTouchEnd
    • onTouchCancel
  • value is controlled by the parent component (example included)

ComboBox

Enhancement

Create a ComboBox-style widget with an option to flag unmatched values (thus satisfying both a dijit/form/ComboBox and a dijit/form/FilteringSelect).

To underscore or not

Discussion

Do people feel that we should prefix private functions / variables with an underscore.
Currently, I believe that our guidelines are to prefix private variables, but I have noticed a few PR's being raised with prefixed functions too. The key here is that we need to be consistent in our approach across our repos.

Text Input Widget

Enhancement
Related to #5

Features:

  • Includes styles for disabled, required, valid, and invalid states
  • accepts callback functions for onInput, onChange, onFocus, and onBlur
  • value is controlled by the parent component (example included)

Future changes:

  • Could use better styles for certain states, a "wait" state, and perhaps icons

a11y State

@kitsonk commented on Wed Nov 16 2016


@agubler commented on Fri Mar 10 2017

Do we have any more information about what this entails? If there is an enhancement here, should it be in @dojo/widgets?


@kitsonk commented on Fri Mar 10 2017

Apologies.

Any widget should have defined when it uses ARIA states to help make the widget more accessible and that the widget should have tests to ensure that the ARIA State matches the visual state of the widget throughout any lifecycle.


@agubler commented on Fri Mar 10 2017

@kitsonk should we move this widgets?

`on<Action>` vs. `onRequest<Action>`

Enhancement

Components should consistently use on<Action> style property names instead of onRequest<Action> style property names. Even though the latter is technically more accurate, it's also more verbose and can be slightly confusing.

Package Version: latest

Changes to children should invalidate the parent

Bug

I ran into a use case where the children of a parent component were changing, but the parent component wasn't re-rendering since it wasn't invalidated, as no properties were changing.

Package Version: latest

Code

Let's say I have three components: a ComboBox which creates a Menu with some Items inside it:

...
render() {
	const { results } = this.properties;

	const resultItems = results.map(result => w(Item, { label: result.label }));

	return v('div', {}, [ w(Menu, {}, resultItems) ]);
}
...

Expected behavior:

I'd expect the Menu to re-render since its children changed. I know this is difficult because, as @agubler pointed out, the children aren't even processed since the Menu hasn't changed based on its properties. Still, from a high level, children of a component could definitely change because of something other than an immediate parent property, as is the case here.

Actual behavior:

The Items created will change based on the updated results property on the ComboBox. But because they are put as children inside an unchanging Menu component, the Menu doesn't re-render, so the Items don't re-render.

Widgets README

Enhancement

Now we are starting to get a few completed components, we should think about the Widgets README in terms of the details and structure needed.

Should we use the `file.m.css` naming convention for css-module files

Enhancement

When working with Dojo 2 I have found that there are occasions where we do not want to run some css files through our css-module process.
Examples include the widgets.css file containing all styles for amd loaders and I have found, the theme.css file we need to generate per theme for the same reason.

We currently have exception rules for widget.css and variables.css in our grunt build pipeline but no such approach for our webpack-build.

TabPane

Enhancement

Create a TabPane component.

Note that features such as showing tabs that don't fit within available real estate in a menu can be added at a later time.

Specification

Callback props:

activeIndex?: number;
loadingIndex?: number;
tabs?: TabConfig[];
onRequestTabChange?(index: number): void;
onRequestTabClose?(tabs: TabConfig[]): void;

Interaction

  • Clicking on a tab triggers onRequestTabChange
  • Clicking on a tab close button triggers onRequestTabClose

States
None.

Value add
A TabPane would solve the common UX issue of needing to show multiple sets of information as designated by the currently selected tab.

Controlled or uncontrolled
Controlled.

Icons

  • Close Icon

Responsive design
None, until dictated by initial theme mockups from @itorrey.

Release process for individual widgets

Enhancement

As well as an uber release of @dojo/widgets we would like to have individual packages for each of the widgets such that they can be consumed on a more granular level.

For example a button could be published to @dojo/widgetButton. and later imported into a project via import createButton from @dojo/widgetButton/createButton`.

Foundational Widgets

@kitsonk commented on Tue May 17 2016

This issue is to discuss what widgets should be part of the foundational widgets, potentially located in this package, or in related packages, as we begin to develop the "out of the box" widgets.

Currently we have. Many of these were just created to be able to try to prototype and solve problems that other widgets may need and might be questionable in the final set:

  • Button - Analog of <button>
  • Container - Simply "owns" other widgets
  • Dijit - A wrapper class for Dojo 1 Dijits
  • LayoutContainer - Does a level of layout on contained widgets
  • List - A simple list UI component
  • Panel - A simple container
  • ResizePanel - Provides a handle that allows one of the contained widgets to be resized
  • TabbedPanel - All children owned are displayed as tabs
  • TextInput - Analog of <input type="text">
  • Widget - A generic "dumb" widget the includes all the foundational widget functionality and can render a tag and some content.

@mwistrand commented on Mon Jun 27 2016

Something comparable to dijit/popup whose sole purpose is to manage z-indices currently in use could also be very useful (essential?).


@dylans commented on Mon Jun 27 2016

A fair number of our clients like to extend dijit/Toolbar or other Menu components to create things like Ribbon bars or other UIs to contain various tabs/buttons/other commands. It would probably overlap with a fair amount of functionality from Panel/ResizePanel/TabbedPanel.


@dylans commented on Thu Jun 30 2016

Dojo 2 text inputs should support masking of input based on data format/constraints and should support i18n for that as well


@dylans commented on Sun Jul 03 2016

Does not belong in the core widgets repo, but a few of our big users rely heavily on the rich text editor. Either need a modern version of dijit/Editor, or need to wrap something else such as Trix which takes a vdom approach to RTE. A key feature is doing a decent job when pasting from Word.


@dylans commented on Fri Sep 30 2016

Some thoughts on validation patterns and other things that are commonly found in widget systems:

  • invalid
  • incomplete
  • masking
  • constraints
  • localized (e.g. validated within a user's locale)
  • display of state to users

@kitsonk commented on Tue Oct 04 2016

When appropriate we should turn this into an Epic and create the separate issues to track progress.


@agubler commented on Thu Feb 02 2017

@dylans do we think this should be moved to widgets?


@dylans commented on Thu Feb 02 2017

@agubler yes, the challenge is that ZenHub doesn't currently support moving epics from what I can tell, so I hadn't gotten around to re-creating the ticket yet. #85 should also be moved.

List of widgets

@kitsonk commented on Tue Nov 01 2016

We need to specify a list of tentative foundational widgets, so we can whittle them down and figure out the priority order to build them. We should create a table in the following format:

Class Name Description Type Sub Widget Classes
ClassName A simple description of the widget Simple/Composite/Container Sub or Child Widget Classes

@bitpshr commented on Sat Dec 17 2016

Form Components

Class Name Description
Form* Form component allowing for easy getting and setting of child component values
Select Drop down component with optional support for multiple selection
Button Button component with optional support for icons
ComboBox Combination of a drop down component and a text input
DateBox Combination of a calendar drop down component and a text input
TextInput* Text-based input supporting email, number, password, tel, url, and custom patterns
RadioButton* Styled radio button component
CheckBox* Styled checkbox component
FileInput* Styled component supporting regular and drag and drop file uploads
Slider Component allowing for in-range value selection by moving a slider up or down

* Makes use of corresponding HTML element

Layout Components

Class Name Description
TabbedPanel Tab-controlled container component
AccordionPanel Collapsable container component
SlidePanel Container component that can slide in and out of window

Misc. Components

Class Name Description
Dialog Closable, optionally modal window that displays information or other components
Menu Collapsable list of action items that can each be disabled
Tooltip Label that appears on hover of another component
Header Responsive horizontal toolbar that can show logo, menus, or action items
Progress Component displaying percentage completion

@smhigley commented on Sun Dec 18 2016

I like it! I would just propose a couple very minor changes:

  • Button and Slider could use the corresponding native <button> and <input type="range"> elements
  • FileInput probably won't be able to use a styled HTML element alone if we want drag and drop functionality
  • I think Select should be split into a native single-select dropdown and a separate multi-select component. WebAIM recommends against using the native multi-select box for accessibility, so we could use checkboxes under the hood to achieve the same functionality.

@dylans commented on Tue Dec 20 2016

Other suggestions (summarized from another thread):

  • User resizable panel/region (e.g. like that found in https://user.sitepen.com/~kkelly/app-example/_build/src/ )
  • Dialog should also be modeless in addition to modal (e.g. FloatingPane from Dojo 1)
  • Should probably decouple DatePicker/icon/dropdown so users can show in various states)
  • Slider horizontal and vertical?
  • Switch (e.g. on/off found on mobile)
  • Constraints on DatePicker
  • TimePicker ?
  • Menu on desktop vs. mobile will probably behave quite differently... may also want the hamburger style menu on desktop)

@smhigley The HTML5 slider doesn't give much in the way of CSS styling, or does it?

Also agree that FileInput via HTML DnD is important.


@smhigley commented on Tue Dec 20 2016

@dylans See http://codepen.io/smhigley/pen/ObWbdy for CSS styling examples with the native range input. It's also possible to switch horizontal/vertical with CSS.


@dylans commented on Tue Dec 20 2016

@dylans See http://codepen.io/smhigley/pen/ObWbdy for CSS styling examples with the native range input. It's also possible to switch horizontal/vertical with CSS.

👍 nice!

Loading indicators

I think we should leave it up to widget authors to provide placeholder content if they wish.

There are times when a spinner may be useful. Should we provide the ability to include a spinner in a generic way, e.g. after time has elapsed: set a spinner on a widget, where we could offer things like:

  • spinner calculates the widget dimensions in order to position itself in the centre of the widget
  • the user does not have include the spinner icon explicitly
  • the user could select from a range of spinner animations/icons
  • the spinner provides optional fade in/out animations
  • the spinner provides an optional dimmer (darkened overlay on widget content)

Nesting structure for widgets

We need to decide on if we will sub-divide our widgets.
3 possible options (please suggest others):

  1. don't subdivide:
    All widgets live in dojo/widgets/src. All are published as @dojo/widgets/createSomeWidget.

  2. Use atomic design as out nesting structure:
    Widgets live in dojo/widgets/src/atoms, dojo/widgets/src/molecules etc and are published as @dojo/widgets/atoms/createTextBox etc

  3. Use previous dojo1 type divisions:
    Widgets live in dojo/widgets/src/form, dojo/widgets/src/layout etc and are published as @dojo/widgets/layout/createSlidePane etc

Of course, we can adhere to 1 repo convention but publish under another if we so desired.

Delivery of icons

@smhigley @bitpshr @tomdye another topic for investigation.
We will have need for icons in our widgets.
How will we ship these icons? (icon font, svg, other..)?
If icon-font:

  • will we create our own or use a 3rd part icon font?
  • how will we use within css?
  • how will we deal with FOUT issues on load, fallback and a11y concerns?

If svg:

  • where will we get our icons from?
  • should we consider animated svgs?
  • is the 'get parent colour' issue, still an issue?
  • should we bitmap or rely on http2 for performant loading?

Current opinion (please challenge):

Can I get your current preferences and reasoning please?

Document controlled form components

From #38:

For beta we will have a form widget that works with controlled components only.
We will document this restriction.
At a later date, we will raise an issue on widget-core for a way to handle uncontrolled components also.

This ticket is to add relevant documentation to the readme.

Move all files for a widget to be in single folder

Move all the files (widget files, test, example) under a top level folder for each widget.

/widgets/src/combobox
should contain:
/tests
/example
all of the widget files, e.g. ComboBox.ts and /styles

Uniform validation approach for form components

We need to consider if we plan to add mandatory and status indicators to our form fields.

By 'mandatory' I mean the usual '*' denotation for 'this form element must have a value'.
By 'status' I mean an indicator in/by the field to show that the current value is valid, e.g. here.

If we include these indicators, then some things to bear in mind:

  • These indicators should not adversely impact a11y support.
  • We need to consider how we would implement if we also allow for addons - see also
  • We need to consider a 'wait state' for status (if validation of the current value is async).

Should we provide generic css?

Whilst we will provide out-the-box themes for Dojo 2, are we planning on providing generic css, along the lines of:

  • typography
  • layout (flex)
  • breakpoints

etc..
I'm thinking in terms of providing non-theme specific classes like this.

Currently, my opinion is that we should provide these css files for importing into widgets. I currently think of Dojo 2 themes as being variations (in terms of colours, corners, gradients etc) on a set of Dojo 2 - wide defaults (the generic css).

CSS imports should have a `.css` extension

Enhancement

Currently when importing css files into our widgets we cannot use a .css extension such that our cli-build can intercept the request and provide the correct file. We should really be consistent across app development with the cli and widget development with grunt tooling in that we should use .css extensions everywhere.

a11y Testing

@kitsonk commented on Wed Nov 16 2016


@agubler commented on Fri Mar 10 2017

I think that this should certainly be a concern for @dojo/widgets, perhaps be good to have some more details too.


@kitsonk commented on Fri Mar 10 2017

Apologies.

More details, we should leverage intern-a11y to integrate a11y tests into for each widget and make them part of the test suite. We should ensure that all widgets include tests the express expected results for:

  • Screen Reader Expected Results
  • Express expected rolls
  • Are navigable via a keyboard with expected results
  • Have appropriate focus during navigation

@agubler commented on Fri Mar 10 2017

I think we should move this to @dojo/widgets unless you have any objections

Add font awesome for icons and create icon.css

Tasks:

  • add fa to our codebase
  • implement in at least 1 widget

Questions:
Where should we implement an icon to test the integration?
Do we need to replace the down and up arrows on ComboBox and TitlePane or keep as text content?
Should we use as few icons as possible or use in as many places as possible for a consistent look and feel?
We could always add 'type' to Dialog e.g. error|warn|info and have nice icons by the dialog content header..

Move components up a level?

Now that widgets have been split from widget-core, I think we should move the contents of /components up a level into src. Or do we really want things to be @dojo/widgets/components/createFoo ?

Select Widget

Enhancement
Related to #5

Features:

  • Includes styles for disabled/readonly, required, valid, and invalid states
  • accepts callback functions for:
    • onBlur
    • onChange
    • onClick
    • onFocus
    • onKeyDown
    • onKeyPress
    • onKeyUp
    • onMouseDown
    • onMouseUp
    • onTouchStart
    • onTouchEnd
    • onTouchCancel
  • Options are added in an object with format { [key: string]: value: string }
  • value is controlled by the parent component (example included)

Use `root` classname consistently for outermost HTMLElement of widgets

@tomdye commented on Tue Mar 14 2017

Enhancement

Do we feel that it would be advantageous to consistently use root as the outermost classname for all of our dojo 2 widgets?

  • Would provide a consistent way to pass overrideClasses to widget outer HTMLElement.
  • Would lower the barrier to entry to applying classes to 'black box' widgets.
  • Allows the widget author to determine the root element in the case of widgets such as Dialog
  • Allows spacing type rules to be applied safely to a widget with greater ease.

Example

/* myLayout.css */
.marginClass {
   margin: 10px;
}
import * as myLayout from './myLayout.css';

/* can safely target the root class */
w(Button, { overrideClasses: { root: myLayout.marginClass } });

@tomdye commented on Tue Mar 14 2017

@rishson Do we feel this is beta1 or beta2? I suspect the latter.


@matt-gadd commented on Fri Mar 17 2017

@tomdye this is in the wrong repo no?


@tomdye commented on Fri Mar 17 2017

correct, can it be moved to widgets or do i have to create a new one?

Specifications for widgets

Hi all.
Going forward, I think we need much clearer intentions when creating widgets. What I'd like to propose is:

  1. each widget 'spec' is a separate issue (and PR)
  2. spec lists features needed for initial version, and things excluded for now

What I'd like to do, is create initial issues for all in-flight widgets and have a standard set of features that either do or do not need to be completed, e.g.

Template spec is now on the wiki for this repo.

Menu widget

Create a menu widget.

Initial thoughts: menu as in 'full width page header that contains links to other pages | dropdowns | logos | searchbox etc.

Spec:

  • list of callback funcs that can be passed in props
    some kind of 'onHide' or 'onPageScroll' that indicates when the menu would be scrolled off screen (so controlling component can reduce hight etc)

  • mouse/keyboard interactions (if any)
    as per individual controls passed to menu

  • mandatory/valid/empty/wait states (if any)
    as per individual controls passed to menu

  • value-add of the widget (e.g. why use rather than just use VDom directly)
    ability to easily style to make sticky, align to top, bottom, left, right..
    responsive on mobile
    ability to vertically align items of different heights (for a horizontal menu)

  • is the widget controlled/uncontrolled
    I am imagining that you would pass the menu child widgets, therefore it is controlled.

  • list of any icons needed
    none

  • is the widget responsive
    yes, on mobile, this widget should shrink to a hamburger menu

Add Form Widgets

@smhigley commented on Fri Dec 09 2016

Enhancement

Related to #2. Update existing textinput and button components to be accessible, and add the following basic form widgets based on #85:

  • Email/number/password/etc to existing textInput
  • Checkbox
  • Radio buttons
  • Select box
  • Textarea

Switch widget

This widget should offer toggle switch behaviour,

Specification

screen shot 2017-03-21 at 4 34 51 pm

Features

  • The widget can be enabled/disabled
  • The widget can have leading/trailing labels
  • The widget labels can contain icons
  • The widget labels can contain unicode text
  • Clicking on a leading label will put the switch in the 'off' position (if it was in the 'on' position)
  • Clicking on a trailing label will put the switch in the 'on' position (if it was in the 'off' position)
  • Clicking on the switch itself, will toggle the switch between the 'on' and 'off' position.

Value-add of the widget (e.g. why use rather than just use VDom directly)
builds on the existing checkBox and offers a mobile visual look/feel and ux.

List of callback funcs that can be passed in props (if any)
as for checkBox

Mouse/keyboard interactions (if any)
possibility to show different tooltips when hovering over leading and trailing labels

Mandatory/valid/empty/wait states (if any)
none

Is the widget controlled/uncontrolled
as per checkBox

List of any icons needed
any icon in font-awesome that we ship should be usable as either a leading or trailing label.

Design input required

Any other considerations:

Questions

Acceptance criteria
When I specify an label with text and an invalid icon, then I expect the text to be rendered without the icon.
When I specify a label with unicode text, then I expect it to render correctly (including adjusting for height of non-latin chars).

Commentary
@smhigley suggested we incorporate this into the checkbox widget. Would it be preferable to extend that widget, so that you could change the styling by passing in a prop, e.g. {switch: true}?

Would the above approach have any appreciable effect on the size of our widgets, in that you you get 2-for-1 with a switch-checkbox?

If this is to be a standalone widget (e.g. not an extension of checkbox) then I'll add a full specification to this issue.

Ability to publish single widget to npm

@rishson commented on Wed Jan 25 2017

Publish a widget to npm using the grunt-dojo2 pipeline.
The enhancement should publish a single widget that has been through the existing dist process.
Questions: How will we deal with git tags?


@agubler commented on Thu Feb 02 2017

@rishson Do we still need this and #178?


@agubler commented on Wed Feb 08 2017

@rishson bump on the question above and whether this should be in dojo/widgets now?


@rishson commented on Wed Feb 08 2017

Closed #178 in favour of this one.

Improve unit testing of Widgets

Enhancement

We need a good set of unit tests for a widget, that can be run against a virtual DOM (e.g. JSDOM) as well as a unit test in the native DOM without being a functional test. We should only use intended public APIs and generate the events/use synthetic events to drive the tests instead of relying upon driving functionality to provide full unit coverage of the widgets.

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.