How to use the bobril.assign function in bobril

To help you get started, we’ve selected a few bobril 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 keeema / bobrilstrap / components / dropdown.ts View on Github external
function updateButtonDataForDropdown(
  originalButtonData: IButtonData
): IButtonData {
  let buttonData = b.assign({}, originalButtonData);
  buttonData.variant =
    originalButtonData.variant !== undefined
      ? originalButtonData.variant
      : ButtonVariant.Dropdown;
  buttonData.aria = b.assign({}, buttonData.aria) as IAria;
  if (buttonData.aria !== undefined) buttonData.aria.haspopup = true;
  return buttonData;
}
github keeema / bobrilstrap / components / button.ts View on Github external
}

    if (ctx.data.disabled) {
      if (ctx.data.tag === ButtonTag.A) {
        b.style(me, buttonStyles.disabled);
      } else {
        me.attrs["disabled"] = "disabled";
      }
    }

    if (
      ctx.data.variant === ButtonVariant.Dropdown ||
      ctx.data.variant === ButtonVariant.DropdownNav
    ) {
      ctx.data = b.assign({}, ctx.data);
      ctx.data.data = b.assign({}, ctx.data.data) as IData;
      ctx.data.aria = b.assign({}, ctx.data.aria) as IAria;

      ctx.data.aria.haspopup = true;
      ctx.data.data.toggle = "dropdown";
      b.style(me, dropdownStyles.dropdownToggle);

      if (ctx.data.tag !== ButtonTag.Input) mergeToChildren(me, " ");

      mergeToChildren(me, Span({ style: helpers.caret }));
    } else if (ctx.data.variant === ButtonVariant.NavbarToggle) {
      ctx.data = b.assign({}, ctx.data);
      ctx.data.data = b.assign({}, ctx.data.data);
      b.style(me, navStyles.navbarToggle);
    }

    mergeToChildren(
github keeema / bobrilstrap / components / button.ts View on Github external
function resolveTag(ctx: ICtx): string {
  if (ctx.data.tag === undefined) {
    ctx.data = b.assign(
      {
        tag:
          ctx.data.variant === ButtonVariant.Navbar ||
          ctx.data.variant === ButtonVariant.DropdownNav
            ? ButtonTag.A
            : ButtonTag.Button
      },
      ctx.data
    );
  }

  switch (ctx.data.tag) {
    case ButtonTag.A:
      return "a";
    case ButtonTag.Input:
      return "input";
github keeema / bobrilstrap / components / alert.ts View on Github external
const animation = ctx.data.animation === undefined || ctx.data.animation;
    const nativeDismiss =
      ctx.data.nativeDismiss === undefined || ctx.data.nativeDismiss;

    if (ctx.data.dismissButton) {
      b.style(
        me,
        alertStyles.alertDismissable,
        !!animation && alertStyles.fade,
        !!animation && alertStyles.in
      );

      const buttonData = b.assign({}, ctx.data.dismissButton, {
        alert: true,
        data: nativeDismiss
          ? b.assign({}, ctx.data.dismissButton.data, { dismiss: "alert" })
          : ctx.data.dismissButton.data,
        option: ButtonOption.Close
      } as IButtonData);

      if (!buttonData.children) {
        mergeToChildren(
          buttonData,
          Span({ aria: { hidden: true } }, "×"),
          true
        );
      }

      const dismissButton = Button(buttonData);
      mergeToChildren(me, dismissButton, true);
    }
  },
github keeema / bobrilstrap / example / common / sidebarItems.ts View on Github external
...ctx.data.items.map((item, i) => {
        const data = b.assign(
          {
            nextId:
              i < ctx.data.items.length - 1
                ? ctx.data.items[i + 1].targetId
                : ctx.data.nextId
          },
          item
        );
        return sideBarItem(data);
      }),
      ctx.data.topTargetId &&
github keeema / bobrilstrap / components / button.ts View on Github external
ctx.data.variant === ButtonVariant.DropdownNav
    ) {
      ctx.data = b.assign({}, ctx.data);
      ctx.data.data = b.assign({}, ctx.data.data) as IData;
      ctx.data.aria = b.assign({}, ctx.data.aria) as IAria;

      ctx.data.aria.haspopup = true;
      ctx.data.data.toggle = "dropdown";
      b.style(me, dropdownStyles.dropdownToggle);

      if (ctx.data.tag !== ButtonTag.Input) mergeToChildren(me, " ");

      mergeToChildren(me, Span({ style: helpers.caret }));
    } else if (ctx.data.variant === ButtonVariant.NavbarToggle) {
      ctx.data = b.assign({}, ctx.data);
      ctx.data.data = b.assign({}, ctx.data.data);
      b.style(me, navStyles.navbarToggle);
    }

    mergeToChildren(
      me,
      ctx.data.srOnly && Span({ style: helpers.srOnly }, ctx.data.srOnly)
    );
  }
});
github keeema / bobrilstrap / components / dropdown.ts View on Github external
function updateButtonDataForDropdown(
  originalButtonData: IButtonData
): IButtonData {
  let buttonData = b.assign({}, originalButtonData);
  buttonData.variant =
    originalButtonData.variant !== undefined
      ? originalButtonData.variant
      : ButtonVariant.Dropdown;
  buttonData.aria = b.assign({}, buttonData.aria) as IAria;
  if (buttonData.aria !== undefined) buttonData.aria.haspopup = true;
  return buttonData;
}
github keeema / bobrilstrap / components / button.ts View on Github external
if (ctx.data.disabled) {
      if (ctx.data.tag === ButtonTag.A) {
        b.style(me, buttonStyles.disabled);
      } else {
        me.attrs["disabled"] = "disabled";
      }
    }

    if (
      ctx.data.variant === ButtonVariant.Dropdown ||
      ctx.data.variant === ButtonVariant.DropdownNav
    ) {
      ctx.data = b.assign({}, ctx.data);
      ctx.data.data = b.assign({}, ctx.data.data) as IData;
      ctx.data.aria = b.assign({}, ctx.data.aria) as IAria;

      ctx.data.aria.haspopup = true;
      ctx.data.data.toggle = "dropdown";
      b.style(me, dropdownStyles.dropdownToggle);

      if (ctx.data.tag !== ButtonTag.Input) mergeToChildren(me, " ");

      mergeToChildren(me, Span({ style: helpers.caret }));
    } else if (ctx.data.variant === ButtonVariant.NavbarToggle) {
      ctx.data = b.assign({}, ctx.data);
      ctx.data.data = b.assign({}, ctx.data.data);
      b.style(me, navStyles.navbarToggle);
    }

    mergeToChildren(
      me,