How to use nav-frontend-js-utils - 10 common examples

To help you get started, we’ve selected a few nav-frontend-js-utils 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 navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-skjema / src / checkbox.tsx View on Github external
render() {
        const { className, label, id, feil, checkboxRef, ...other } = this.props;
        const inputId = id || guid();
        // tslint:disable:react-a11y-role-has-required-aria-props
        return (
            <div>
                <input id="{inputId}" type="checkbox">
                <label>{label}</label>
                
            </div>
        );
    }
}
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-popover / src / popover.tsx View on Github external
break;
            case PopoverOrientering.UnderVenstre:
                left = ankerOffset.left;
                top = ankerOffset.top + ankerOffset.height + avstandTilAnker;
                break;
            case PopoverOrientering.Under:
                left = ankerOffset.left + (ankerOffset.width / 2) - (popoverOffset.width / 2);
                top = ankerOffset.top + ankerOffset.height + avstandTilAnker;
                break;
            default: // PopoverOrientering.Over
                left = ankerOffset.left + (ankerOffset.width / 2) - (popoverOffset.width / 2);
                top = ankerOffset.top - avstandTilAnker - popoverOffset.height;
                break;
        }

        const viewPortDimensions = getViewportDimensions();

        left = Math.max(0, left);
        left = Math.min(Math.abs(left), Math.abs(viewPortDimensions.w - popoverOffset.width));

        const pilLeft = ankerOffset.left + (ankerOffset.width / 2) - left - 1;

        return { left, top, pilLeft };
    }
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-lesmerpanel / src / lesmerpanel.tsx View on Github external
render() {
        const {
            intro,
            children,
            apneTekst,
            lukkTekst,
            id = guid(),
            ...other
        } = this.props;
        const domProps = omit(other, 'border', 'onOpen', 'defaultApen');

        return (
            <div id="{id}">
                <div>
                    {intro}
                </div>
                <div>
                    
                        <div>
                            {children}
                        </div>
                    </div></div>
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-toggle / src / toggle-gruppe-pure.tsx View on Github external
render() {
        const renderProps = omit(this.props, 'className', 'children', 'kompakt', 'toggles', 'defaultToggles');
        return (
            <div>
                {
                    this.props.toggles.map((toggle, i) =&gt;
                        
                    )
                }
            </div>
        );
    }
}
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-toggle / src / toggle-knapp-pure.tsx View on Github external
render() {
        const renderProps = omit(this.props, 'children', 'pressed', 'kompakt', 'isRequired');
        const knappId = guid();
        return (
            <button aria-pressed="{this.props.pressed}" id="{knappId}" type="button">
                {this.props.children}
            </button>
        );
    }
}
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-veileder / src / veileder.js View on Github external
render() {
        const { children, tekst, ...other } = this.props;
        const domProps = nav_frontend_js_utils_1.omit({ ...other }, 'center', 'nomask', 'says', 'color', 'transparent', 'width', 'type', 'fargetema', 'storrelse');
        return (React.createElement("div", Object.assign({ className: cls(this.props) }, domProps),
            React.createElement("div", { className: frameCls(this.props) }, children),
            tekst && this.renderSnakkeboble()));
    }
}
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-tabs / src / tabs.tsx View on Github external
render() {
        const domProps = omit(this.props, 'tabs', 'onChange', 'defaultAktiv', 'ref');

        return (
             this.pure = pure}
                onChange={(e, index) =&gt; this.setActiveTab(e, index)}
                {...domProps}
            &gt;
                {this.renderTabs()}
            
        );
    }
}
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-stegindikator / src / stegindikator.tsx View on Github external
render() {
        const domProps = omit(
            this.props,
            'steg',
            'children',
            'visLabel',
            'kompakt',
            'onChange',
            'onBeforeChange',
            'autoResponsiv',
            'aktivtSteg'
        );

        return (
            <div>
                <ol> { this.list = list; }}</ol></div>
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-toggle / src / toggle-knapp.tsx View on Github external
render() {
        const renderProps = omit(this.props, 'children', 'pressed');
        return (
            
                {this.props.children}
            
        );
    }
}
github navikt / nav-frontend-moduler / packages / node_modules / nav-frontend-toggle / src / toggle-gruppe.tsx View on Github external
render() {
        const { className, ...other } = this.props;
        const renderProps = omit(other, 'children', 'multiSelect', 'toggles');
        const toggles = this.state.toggles.map((toggle, i) =&gt; ({
            ...toggle,
            kompakt: this.props.kompakt,
            onClick: (e) =&gt; this.handleClick(e, i, toggle.onClick)
        }));

        return (
            
        );
    }
}