How to use the bobril.styleDefEx 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 bobril / bobril-m / src / textFieldLabel.ts View on Github external
const rootStyle = b.styleDef([c.userSelectNone, c.positionAbsolute, {
    lineHeight: '22px',
    top: 38,
    transition: transitions.easeOut(),
    zIndex: 1, // Needed to display label above Chrome's autocomplete field background
    cursor: "text",
    transform: 'scale(1) translate3d(0, 0, 0)',
    transformOrigin: 'left top'
}]);

const disabledStyle = b.styleDefEx(rootStyle, {
    cursor: "default"
});

const shrinkStyle = b.styleDefEx(rootStyle, [c.pointerEventsNone, {
    transform: "perspective(1px) scale(0.75) translate3d(2px, -28px, 0)"
}]);

export const TextFieldLabel = (data: ITextFieldLabel) => {
    return b.style({ tag: "label", attrs: { htmlFor: data.htmlFor }, children: data.children }, rootStyle, data.disabled && disabledStyle, data.shrink && shrinkStyle, { color: data.color });
};
github bobril / bobril-m / src / textFieldLabel.ts View on Github external
shrink?: boolean;
    htmlFor?: string;
    color?: string;
}

const rootStyle = b.styleDef([c.userSelectNone, c.positionAbsolute, {
    lineHeight: '22px',
    top: 38,
    transition: transitions.easeOut(),
    zIndex: 1, // Needed to display label above Chrome's autocomplete field background
    cursor: "text",
    transform: 'scale(1) translate3d(0, 0, 0)',
    transformOrigin: 'left top'
}]);

const disabledStyle = b.styleDefEx(rootStyle, {
    cursor: "default"
});

const shrinkStyle = b.styleDefEx(rootStyle, [c.pointerEventsNone, {
    transform: "perspective(1px) scale(0.75) translate3d(2px, -28px, 0)"
}]);

export const TextFieldLabel = (data: ITextFieldLabel) => {
    return b.style({ tag: "label", attrs: { htmlFor: data.htmlFor }, children: data.children }, rootStyle, data.disabled && disabledStyle, data.shrink && shrinkStyle, { color: data.color });
};
github bobril / bobril-m / src / toggle.ts View on Github external
}]);

let rippleStyle = b.styleDef([c.positionAbsolute, c.noTapHighlight, c.circle, {
    backgroundColor: "#000",
}]);

let trackToggledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: () => colorUtils.withTransparency(styles.strPrimary1Color, 0.5)
});

let thumbToggledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.primary1Color,
    left: toggleTrackWidth,
});

let trackDisabledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: styles.primary3Color
});

let thumbDisabledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.borderColor,
});

export const Toggle = b.createComponent({
    init(ctx: IToggleCtx) {
        ctx.focusFromKeyboard = false;
        ctx.down = false;
        ctx.rippleStart = 0;
    },
    render(ctx: IToggleCtx, me: b.IBobrilNode) {
        let d = ctx.data;
        let disabled = d.disabled;
github bobril / bobril-m / src / toggle.ts View on Github external
}]);

let trackToggledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: () => colorUtils.withTransparency(styles.strPrimary1Color, 0.5)
});

let thumbToggledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.primary1Color,
    left: toggleTrackWidth,
});

let trackDisabledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: styles.primary3Color
});

let thumbDisabledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.borderColor,
});

export const Toggle = b.createComponent({
    init(ctx: IToggleCtx) {
        ctx.focusFromKeyboard = false;
        ctx.down = false;
        ctx.rippleStart = 0;
    },
    render(ctx: IToggleCtx, me: b.IBobrilNode) {
        let d = ctx.data;
        let disabled = d.disabled;
        let checked = d.checked;
        let focusFromKeyboard = ctx.focusFromKeyboard;
        let hasRipple = ctx.rippleStart != 0;
        let t: number = 0;
github bobril / bobril-m / src / toggle.ts View on Github external
left: 0,
    width: toggleSize,
    height: toggleSize,
    lineHeight: '24px',
    backgroundColor: styles.accent2Color,
}]);

let rippleStyle = b.styleDef([c.positionAbsolute, c.noTapHighlight, c.circle, {
    backgroundColor: "#000",
}]);

let trackToggledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: () => colorUtils.withTransparency(styles.strPrimary1Color, 0.5)
});

let thumbToggledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.primary1Color,
    left: toggleTrackWidth,
});

let trackDisabledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: styles.primary3Color
});

let thumbDisabledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.borderColor,
});

export const Toggle = b.createComponent({
    init(ctx: IToggleCtx) {
        ctx.focusFromKeyboard = false;
        ctx.down = false;
github bobril / bobril-m / src / textFieldHint.ts View on Github external
import * as transitions from "./transitions";
import * as c from "./styleConsts";

export interface ITextFieldHint {
    children?: b.IBobrilChildren;
    show?: boolean;
}

const rootStyle = b.styleDef([c.positionAbsolute, {
    color: styles.disabledColor,
    transition: transitions.easeOut(),
    opacity: 0,
    bottom: 12
}]);

const showStyle = b.styleDefEx(rootStyle, {
    opacity: 1
});

export const TextFieldHint = (data: ITextFieldHint) => {
    return b.styledDiv(data.children, rootStyle, data.show !== false && showStyle);
};
github bobril / bobril-m / src / badge.ts View on Github external
top: 0,
  right: 0,
  fontWeight: "medium",
  fontSize: radius,
  width: radius2x,
  height: radius2x,
  backgroundColor: styles.alternateTextColor,
  color: styles.textColor,
}]);

const primaryStyle = b.styleDefEx(badgeStyle, {
  backgroundColor: styles.accent1Color,
  color: styles.alternateTextColor
});

const secondaryStyle = b.styleDefEx(badgeStyle, {
  backgroundColor: styles.primary1Color,
  color: styles.alternateTextColor
});

export const Badge = b.createComponent({
  render(ctx: IBadgeCtx, me: b.IBobrilNode) {
    const d = ctx.data;
    b.style(me, rootStyle);
    me.children = [
      d.children,
      b.styledDiv(d.badgeContent, badgeStyle, d.primary && primaryStyle, d.secondary && secondaryStyle)
    ];
  }
});
github bobril / bobril-m / src / toggle.ts View on Github external
let thumbStyle = b.styleDef([c.positionAbsolute, c.noTapHighlight, styles.zDepthShadows[0], c.circle, {
    transition: transitions.easeOut(),
    top: 1,
    left: 0,
    width: toggleSize,
    height: toggleSize,
    lineHeight: '24px',
    backgroundColor: styles.accent2Color,
}]);

let rippleStyle = b.styleDef([c.positionAbsolute, c.noTapHighlight, c.circle, {
    backgroundColor: "#000",
}]);

let trackToggledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: () => colorUtils.withTransparency(styles.strPrimary1Color, 0.5)
});

let thumbToggledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.primary1Color,
    left: toggleTrackWidth,
});

let trackDisabledStyle = b.styleDefEx(trackStyle, {
    backgroundColor: styles.primary3Color
});

let thumbDisabledStyle = b.styleDefEx(thumbStyle, {
    backgroundColor: styles.borderColor,
});
github bobril / bobril-m / src / badge.ts View on Github external
flexDirection: 'row',
  flexWrap: 'wrap',
  justifyContent: 'center',
  alignContent: 'center',
  alignItems: 'center',
  top: 0,
  right: 0,
  fontWeight: "medium",
  fontSize: radius,
  width: radius2x,
  height: radius2x,
  backgroundColor: styles.alternateTextColor,
  color: styles.textColor,
}]);

const primaryStyle = b.styleDefEx(badgeStyle, {
  backgroundColor: styles.accent1Color,
  color: styles.alternateTextColor
});

const secondaryStyle = b.styleDefEx(badgeStyle, {
  backgroundColor: styles.primary1Color,
  color: styles.alternateTextColor
});

export const Badge = b.createComponent({
  render(ctx: IBadgeCtx, me: b.IBobrilNode) {
    const d = ctx.data;
    b.style(me, rootStyle);
    me.children = [
      d.children,
      b.styledDiv(d.badgeContent, badgeStyle, d.primary && primaryStyle, d.secondary && secondaryStyle)