"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormProgressStep = exports.FormProgress = void 0;
const react_1 = __importStar(require("react"));
const aksel_icons_1 = require("@navikt/aksel-icons");
const button_1 = require("../../button");
const collapsible_1 = require("../../collapsible");
const stack_1 = require("../../primitives/stack");
const progress_bar_1 = require("../../progress-bar");
const stepper_1 = require("../../stepper");
const typography_1 = require("../../typography");
const i18n_hooks_1 = require("../../utils/i18n/i18n.hooks");
/**
 * Component for visualizing progression in a form with multiple steps.
 *
 * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/formprogress)
 * @see 🏷️ {@link FormProgressProps}
 *
 * @example
 * <FormProgress activeStep={2} totalSteps={3}>
 *   <FormProgress.Step completed href="#">Children</FormProgress.Step>
 *   <FormProgress.Step href="#">Personal information</FormProgress.Step>
 *   <FormProgress.Step interactive={false}>Summary</FormProgress.Step>
 * </FormProgress>
 */
exports.FormProgress = (0, react_1.forwardRef)((_a, ref) => {
    var { totalSteps, activeStep, open, onOpenChange, children, onStepChange, interactiveSteps, translations } = _a, rest = __rest(_a, ["totalSteps", "activeStep", "open", "onOpenChange", "children", "onStepChange", "interactiveSteps", "translations"]);
    const translate = (0, i18n_hooks_1.useI18n)("FormProgress", translations);
    return (react_1.default.createElement("div", Object.assign({ ref: ref }, rest),
        react_1.default.createElement(progress_bar_1.ProgressBar, { "aria-hidden": true, value: activeStep, valueMax: totalSteps, className: "aksel-form-progress__bar" }),
        react_1.default.createElement(collapsible_1.Collapsible, { lazy: true, open: open, onOpenChange: onOpenChange },
            react_1.default.createElement(stack_1.HStack, { justify: "space-between", align: "center" },
                react_1.default.createElement(typography_1.BodyShort, { as: "span" }, translate("step", { activeStep, totalSteps })),
                react_1.default.createElement(collapsible_1.Collapsible.Trigger, { asChild: true, "aria-expanded": undefined },
                    react_1.default.createElement(button_1.Button, { variant: "tertiary", size: "small", className: "aksel-form-progress__button", icon: react_1.default.createElement(aksel_icons_1.ChevronDownIcon, { "aria-hidden": true }) },
                        react_1.default.createElement("span", { className: "aksel-form-progress__btn-txt-hide" }, translate("hideAllSteps")),
                        react_1.default.createElement("span", { className: "aksel-form-progress__btn-txt-show" }, translate("showAllSteps"))))),
            react_1.default.createElement(collapsible_1.Collapsible.Content, { className: "aksel-form-progress__collapsible" },
                react_1.default.createElement("div", { className: "aksel-form-progress__collapsible-content" },
                    react_1.default.createElement("div", { className: "aksel-form-progress__stepper" },
                        react_1.default.createElement(stepper_1.Stepper, { activeStep: activeStep, onStepChange: onStepChange, interactive: interactiveSteps }, children)))))));
});
exports.FormProgress.Step = stepper_1.Stepper.Step;
exports.FormProgressStep = stepper_1.Stepper.Step;
exports.default = exports.FormProgress;
//# sourceMappingURL=FormProgress.js.map