Giter VIP home page Giter VIP logo

ebay / ebayui-core Goto Github PK

View Code? Open in Web Editor NEW
209.0 29.0 103.0 148.52 MB

Collection of Marko widgets; considered to be the core building blocks for all eBay components, pages & apps

Home Page: https://ebay.github.io/ebayui-core/

License: Other

JavaScript 4.86% Marko 6.69% Less 0.04% Shell 0.01% CSS 0.01% HTML 8.44% TypeScript 79.96%
ebay-components html accessibility marko components a11y nodejs javascript marko-widgets ebay mind-patterns ebay-skin

ebayui-core's Introduction

Build Status Coverage Status

eBayUI Core

Collection of Marko widgets; considered to be the core building blocks for all eBay components, pages & apps.

Requirements

Note: eBayUI Core components utilize Marko flags and, therefore, require <lasso-page/> to be added to any page which will have core components.

Note: @ebay/skin/global and @ebay/skin/marketsans are required to be loaded by your app for all modules to load correctly.

Note: In order for spread attributes to work properly, [email protected] at least is required

Browser Policy

All components are developed and tested cross-browser using BrowserStack, in accordance with our official eBay Browser Policy.

Accessibility (A11Y)

We take accessibility very seriously. Very seriously indeed. Therefore, all components are built in accordance to the eBay MIND Patterns. These patterns, in turn, build on from the specifications provided by the WAI-ARIA Authoring Practices.

Components are built in a layered, progressively enhanced fashion, utilizing the following resources:

Each layer does its bit to enforce and enhance accessibility. We consider this level of support to be one of our chief selling points, and we hope you do too!

Components

Getting Started

The eBayUI core components are available as the @ebay/ebayui-core package on NPM.

Use npm or yarn to add the package dependency to your project:

npm add @ebay/ebayui-core

Upgrading to the latest versions

See the upgrade guide for more information

Custom Tags

Once the package dependency is added, the eBay customs tags are now available for use in your Marko templates. For example, to use an ebay-menu component:

template.marko

<ebay-menu text="Sort" type="radio">
    <@item>Price</@item>
    <@item>Time</@item>
    <@item>Distance</@item>
</ebay-menu>

Attributes

Attributes provide initial state for a component. We can see that the menu has text and type attributes:

template.marko

<ebay-menu text="Sort" type="radio">
    <@item>Price</@item>
    <@item>Time</@item>
    <@item>Distance</@item>
</ebay-menu>

Passing new attributes to an ebayui component will always reset it's internal state. If you want to persist this state yourself, events are exposed which allow you to synchronize the state into your own components, for example:

class {
    onCreate() {
        this.state = {
            dialogIsOpen: false
        }
    }

    handleDialogClose() {
        this.state.dialogIsOpen = false;
    }

    handleDialogOpen() {
        this.state.dialogIsOpen = true;
    }
}

<ebay-lightbox-dialog
    open=state.dialogIsOpen
    on-open('handleDialogOpen')
    on-close('handleDialogClose')>
    ...
</ebay-lightbox-dialog>

Pass-Through Attributes

HTML attributes can be used on any component, and they will be passed through to the most prominent tag of the component. The most prominent tag is usually the root or form control, but individual components will note if it varies for specific cases.

Example of static usage:

<ebay-button id="my-button"/>

For using pass-through attributes dynamically, they should be sent through the html-attributes attribute:

$ const myAttributes = { id: 'my-button' };
<ebay-button html-attributes=myAttributes/>

Static and dynamic pass-through attributes can be used simultaneously (html-attributes takes precedence in conflicts):

$ const myAttributes = { id: 'my-button' };
<ebay-button html-attributes=myAttributes type="submit"/>

Events

Events can also be handled using Marko syntax:

template.marko

<ebay-menu text="Sort" type="radio" on-change("onMenuChange")>
    <@item>Price</@item>
    <@item>Time</@item>
    <@item>Distance</@item>
</ebay-menu>

Releases & Milestones

For upcoming roadmap and release history, please refer to our releases and milestones pages.

Versioning

The ebayui-core package follows strict Semantic Versioning.

Given a version number MAJOR.MINOR.PATCH:

  • MAJOR version is incremented when we make incompatible API changes
  • MINOR version is incremented when we add functionality in a backwards-compatible manner
  • PATCH version is incremented when we make backwards-compatible bug fixes.

Deprecations

Deprecations will be communicated via release notes, so please ensure that you read those carefully. In general, expect any deprecated feature to be removed in the next major version. However, in some cases we may wait a while longer.

Issues

Please use our issues page to ask questions, report issues or submit feature requests.

To help track your issue, our admins will assign it with one or more coloured labels:

  • Black: Issue Type (e.g. bug, question, test case)
  • White: Resolution (e.g. wont fix, invalid, duplicate)
  • Gray: Status (e.g. backlog, in progress, help wanted)
  • Red: Blocker (e.g. dependency, discussion, design)
  • Green: Module (e.g. button, radio, dialog)
  • Blue: Aspect (e.g. build, documentation, website)
  • Yellow: Semver Guidance (e.g. breaking change, backwards compatible)
  • Purple: Sprint (e.g. sprint 1, sprint 2, etc)

Contributing

Looking to contribute to eBay UI? Please visit our contributing page for more information.

License

Copyright (c) 2018 eBay Inc.

Use of this source code is governed by a MIT-style license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.

USE OF SOME COMPONENTS REQUIRES A SEPARATE, NON-OPEN-SOURCE LICENSE FROM THIRD PARTIES

The data visualization components and the charting components of the eBayUI library are designed to use one or more HighCharts® software products. HighCharts® is a registered trademark of HighSoft AS. HighSoft AS is not affiliated with Ebay. Ebay provides no warranties of any kind (e.g., of merchantability, fitness for a particular purpose, and noninfringement), whether express or implied, with respect to the HighCharts® software products that the data visualization components and the charting components are designed to use.

COMMERCIAL USE OF HIGHCHARTS® SOFTWARE PRODUCTS REQUIRES A PAID LICENSE PROVIDED BY HIGHSOFT AS. While many components of the eBayUI library are licensed under the MIT License, the HighCharts® software products which the data visualization components and charting components of the EbayUI library are designed to use are NOT licensed under the MIT License or any other open source license. Rights pertaining to HighCharts® software products (e.g., including, but not limited to, rights to use, install, distribute, publish, merge, duplicate, and modify) are governed by the terms of one or more proprietary license agreements that are available online at http://www.highcharts.com or by the terms of custom license agreements that HighSoft AS may negotiate with its customers at its own discretion. While HighSoft AS may choose to license HighCharts® software products for non-commercial use at no cost, IT IS THE RESPONSIBILITY OF ANY PARTY THAT WISHES TO USE HIGHCHARTS® SOFTWARE PRODUCTS TO VERIFY THE TERMS OF SUCH A LICENSE WITH HIGHSOFT AS. NOTWITHSTANDING ANY PROVISION OF THIS LICENSE, PARTIES WHO ARE NOT LICENSED BY HIGHSOFT AS (OR ITS SUCCESSORS OR ASSIGNS) TO USE HIGHCHARTS® SOFTWARE PRODUCTS ARE NOT LICENSED TO USE THE DATA VISUALIZATION COMPONENTS AND THE CHARTING COMPONENTS OF THE EBAYUI LIBRARY.

This notice shall be included in all copies or substantial portions of the Software.

ebayui-core's People

Contributors

agliga avatar artblue avatar austingardner avatar benc3467 avatar biaspr avatar cestdiego avatar darkwebdev avatar dasarianudeep avatar dependabot[bot] avatar dkallus avatar dylanpiercey avatar etcaton avatar figueiredo-lucas avatar github-actions[bot] avatar henriquelimas avatar ianmcburnie avatar lokeshrishi avatar lulavalva avatar martin-ebay avatar mkchang avatar msendlakowski avatar pranaykondekar avatar prashantashok avatar rachelvillamin avatar saiponnada avatar seangates avatar sendlo avatar sharma46bhawana avatar tws2000 avatar yomed 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

ebayui-core's Issues

Build: Rename build script to make clear it's optimized for CI machine only

The build script makes some assumptions about it's env and leaves the env in a v4 state. So running this script back to back locally causes an error (because it assume v3 state). This is because it's optimized for CI machine, not local. Let's rename the script to make this obvious. I propose cibuild or cijob or the like.

Related to: #52

Tests: run all tests against Marko v4

All tests (server and browser) should ideally run against both v3 and v4. We may want to limit the v4 testing to CI (like with the integration suite), since it modifies dependencies.

Scoped CSS capabilities per-component

The current Skin scoped CSS does not provide scoping for individual components which are used from the eBayUI Core library. It only provides scoping when Skin is used in isolation (no eBayUI components).

Therefore, we need to provide a way to scope the individual components when they are used within a project.

Some ideas:

  1. Allow a specifically scoped .ds6 version of the Skin css within each component
  2. Create a special scoped class on the main container when a certain flag is encountered
  3. Use ARC to provide a wholly separate component path
  4. Copy the corresponding Skin module CSS into a local LESS file for each component

Please let me know if any of you have questions about the reasons, and please chime in if you have an idea about possible solutions.

Marko 4 unrecognized tag thrown for nested tag transformers

When using a component that has nested tags that are created using the nested tag transformer (like <ebay-menu-item> rather than <ebay-menu:item>, Marko 4 will throw an error during the parse stage (which occurs before the transform stage) saying it found an unrecognized tag.

Solution:
Add an empty tag definition for all valid nested tags:

{
    "<ebay-menu-item>": {}
}

Unnecessarily transforming nested tag syntax

The nested tag transformer is a bit aggressive and renames all nested tags, even if they are already using Marko's nested tag syntax.

<ebay-menu>
    <ebay-menu:item>Item</ebay-menu:item>
</ebay-menu>

becomes:

<ebay-menu>
    <ebay:menu:item>Item</ebay:menu:item>
</ebay-menu>

Honestly, probably not much of an issue once #11 and #13 are fixed, but ran into this trying to work around those issues.

Build: allow local demo to optionally run on transpiled dist code

So that we can catch and fix bugs in all browsers, we need to be running the transpiled dist code in our local demo.

Running yarn start should add a transpile step to it's pipeline, and local demo should have capability to be running on the transpiled code in dist.

Related to: #59

Docs: show secondary button instead of raw button by default

Looks better if we show the secondary button instead of the raw button:

screen shot 2018-03-08 at 11 19 56 am

Also tempted for us to make secondary the default instead of raw. Raw button has practical aspects for people consuming skin directly (horrible imagery there!) - but perhaps not so useful in ebayui.

New Component: Tooltip

https://ebay.invisionapp.com/share/CWN9X1JF6MA#/screens/299234476

Some additional thoughts:

  • The component should allow the application to suggest a position to open the tooltip, but use JS to override that in order to keep the tooltip on page.
  • A11y guidelines:
  • Based on my implementation of tourtips in the past
    • It looks bad if there are many tourtips open on the page at the same time. They can even overlap each other. It would be good to add some management to prevent this.
    • Tourtips usually only show up once and then the user never sees them again (using local storage). We could create this functionality to prevent applications from having to duplicate it. Applications will probably also want ways to reset the timeout period.

Polyfill strategy

Bug Report

Details

Currently in IE there are two runtime features being used that are not polyfilled.

  1. Array.prototype.find (https://github.com/eBay/ebayui-core/blob/0.1.0/src/components/ebay-select/index.js#L31)
  2. Promise (used by Marko internally).

Possible Fix

  1. We should probably just avoid Array methods added post IE9 (moved to #50).
  2. I'm not sure if it was intended for Promise to sneak into the Marko codebase, @mlrawlings what are your thoughts? For now we could just include a promise polyfill with this library, or at least recommend a polyfill.

New Component: Icon

Placeholder issue created. More details to follow....

(basically a carbon copy of ebayui-image I think)

Components with nested transform tags don't work outside demos

The marko.json that specifies the nested tag transformer is only scoped to the demo and test components.

Any outside user of the components will not have their nested tags transformed:

ebay_listbox_tag({
        name: "name"
      }, out, 0, function renderBody(out, ebay_listbox0) {
      out.w("<ebay-listbox-option value=\"1\" label=\"Option 1\"></ebay-listbox-option><ebay-listbox-option value=\"2\" label=\"Option 2\" selected></ebay-listbox-option><ebay-listbox-option value=\"3\" label=\"Option 3\"></ebay-listbox-option>");
    });

Bug: Error when rendering empty listbox.

Bug Report

Details

Currently when the <ebay-listbox> is rendered without any options there is an error thrown from here.

Possible Fix

We should either update the component to support having no selected option (currently tries to select the default), or provide a better error message to users.

Notes

If the listbox will support having no options then we should also support a placeholder attribute or come up with something to display in that case.

Bug: Carousel Memory Leak

Bug Report

Details

Currently the carousel component is attaching a resize event to the window object that is not being cleaned up when the component is removed which will slowly leak memory.

Possible Fix

#10

Docs: listbox/select README consistency.

There are currently some inconsistencies with the ebay-listbox components README.md vs the other components:

  1. Headings contain code blocks.
  2. "Examples" used instead of "Usage".
  3. Headings prefixed with component name.

I'm not sure which format works best but I do believe we should make these consistent.


ebay-listbox readme
screen shot 2018-03-08 at 9 51 28 am

ebay-button readme
screen shot 2018-03-08 at 9 52 22 am

Tests: Improve integration and v4 testing

Porting over some notes from the old repo:

  • Improve cleanup in failure case
  • Use npm pack
  • Verify no errors in browser console
  • Move main functionality to standalone package
  • Investigate improvements to Marko to allow multiple versions to be installed at the same time
  • Improve local debugging of testing against v4

BUG: transform does not walk the tree of all nested tags

Currently the transform expects direct nested tags, and does not allow any other Marko tags.

For example, the <ebay-select> expects a direct nested tag <ebay-select-option>, and if you add any control tags, like <if()> or <for()>, you will break rendering.

The fix is to walk the entire tree of children tags and apply the transform to any tag that matches, regardless of whether the nested tag is an immediate child of the tag.

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.