How to use the metal-state.Config.shapeOf function in metal-state

To help you get started, we’ve selected a few metal-state examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiferayCloud / marble / packages / marble-radio-group / src / RadioGroup.js View on Github external
*/
class RadioGroup extends Component {}

/**
 * State definition.
 * @static
 * @type {!Object}
 */
RadioGroup.STATE = {
  /**
   * The list of radio items
   * @type {?Array|undefined}
   * @default undefined
   */
  items: Config.arrayOf(
    Config.shapeOf({
      id: Config.string(),
      checked: Config.bool(),
      label: Config.string(),
      value: Config.string(),
    })
  ).required(),

  /**
   * The name param used on each radio
   * @type {?String}
   * @default undefined
   */
  name: Config.string().required(),

  /**
   * The style of the radio group
github LiferayCloud / marble / packages / marble-checkbox-group / src / CheckboxGroup.js View on Github external
*/
class CheckboxGroup extends Component {}

/**
 * State definition.
 * @static
 * @type {!Object}
 */
CheckboxGroup.STATE = {
  /**
   * The list of radio items
   * @type {?Array|undefined}
   * @default undefined
   */
  items: Config.arrayOf(
    Config.shapeOf({
      id: Config.string(),
      checked: Config.bool(),
      label: Config.string(),
      value: Config.string(),
    })
  ).required(),

  /**
   * The name param used on each radio
   * @type {?String}
   * @default undefined
   */
  name: Config.string().required(),

  /**
   * The style of the radio group
github LiferayCloud / marble / packages / marble-topbar / src / Topbar.js View on Github external
* @type {!Object}
 */
Topbar.STATE = {
  /**
   * Additional CSS classes to be added
   * @type {!String}
   * @default undefined
   */
  style: Config.string(),

  /**
   * Defines how the logo should look like
   * @type {?Object|undefined}
   * @default undefined
   */
  logo: Config.shapeOf({
    href: Config.string(),
    icon: Config.string(),
    image: Config.string(),
    text: Config.string(),
  }),

  /**
   * The list of menu items
   * @type {?Array|undefined}
   * @default undefined
   */
  items: Config.arrayOf(
    Config.shapeOf({
      href: Config.string(),
      label: Config.string(),
      selected: Config.bool(),
github LiferayCloud / marble / packages / marble-topbar / src / Topbar.js View on Github external
* @default undefined
   */
  logo: Config.shapeOf({
    href: Config.string(),
    icon: Config.string(),
    image: Config.string(),
    text: Config.string(),
  }),

  /**
   * The list of menu items
   * @type {?Array|undefined}
   * @default undefined
   */
  items: Config.arrayOf(
    Config.shapeOf({
      href: Config.string(),
      label: Config.string(),
      selected: Config.bool(),
      target: Config.string(),
      type: Config.string(),
      variant: Config.string(),
    })
  ).value([]),
};

Soy.register(Topbar, templates);

export {Topbar};
export default Topbar;