"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Admonition = Admonition;
exports.Button = Button;
exports.Content = Content;
exports.Icon = Icon;
exports.Outer = Outer;
exports.Row = Row;
exports.Text = Text;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _useTheme = require("../theme/use-theme.js");
var _index = require("../typography/index.js");
var _index2 = require("../button/index.js");
var _CircleInfo = require("../icons/CircleInfo.js");
var _CircleX = require("../icons/CircleX.js");
var _Warning = require("../icons/Warning.js");
var _Emoji = require("../icons/Emoji.js");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const AdmonitionContext = /*#__PURE__*/(0, _react.createContext)({
  type: 'info'
});
AdmonitionContext.displayName = 'AdmonitionContext';
const ICON_MAP = {
  info: _CircleInfo.CircleInfo_Stroke2_Corner0_Rounded,
  tip: _CircleInfo.CircleInfo_Stroke2_Corner0_Rounded,
  warning: _Warning.Warning_Stroke2_Corner0_Rounded,
  error: _CircleX.CircleX_Stroke2_Corner0_Rounded,
  apology: _Emoji.EmojiSad_Stroke2_Corner0_Rounded
};
function Icon() {
  const theme = (0, _useTheme.useTheme)();
  const {
    type
  } = (0, _react.useContext)(AdmonitionContext);
  const IconComponent = ICON_MAP[type];
  const fillMap = {
    info: theme.colors.textSecondary,
    tip: theme.colors.primary,
    warning: theme.colors.warning,
    error: theme.colors.error,
    apology: theme.colors.textSecondary
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
    fill: fillMap[type],
    size: "md"
  });
}
Icon.displayName = 'Admonition.Icon';
function Content({
  children,
  style
}) {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    style: [styles.content, style],
    children: children
  });
}
Content.displayName = 'Admonition.Content';
function Text({
  children,
  style
}) {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Text, {
    style: style ? [styles.text, style] : styles.text,
    children: children
  });
}
Text.displayName = 'Admonition.Text';
function Button({
  children,
  ...props
}) {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Button, {
    size: "small",
    ...props,
    children: children
  });
}
Button.displayName = 'Admonition.Button';
function Row({
  children,
  style
}) {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    style: [styles.row, style],
    children: children
  });
}
Row.displayName = 'Admonition.Row';
function Outer({
  children,
  type = 'info',
  style
}) {
  const theme = (0, _useTheme.useTheme)();
  const borderColorMap = {
    info: theme.colors.border,
    tip: theme.colors.primary,
    warning: theme.colors.warning,
    error: theme.colors.error,
    apology: theme.colors.border
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(AdmonitionContext.Provider, {
    value: {
      type
    },
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
      style: [styles.outer, {
        borderColor: borderColorMap[type],
        backgroundColor: theme.colors.background
      }, style],
      children: children
    })
  });
}
Outer.displayName = 'Admonition.Outer';

/**
 * Simple all-in-one Admonition component for common use cases.
 * For more control, compose with Outer, Row, Icon, Content, Text, and Button.
 */
function Admonition({
  children,
  type,
  style
}) {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Outer, {
    type: type,
    style: style,
    children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Row, {
      children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Content, {
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Text, {
          children: children
        })
      })]
    })
  });
}
Admonition.displayName = 'Admonition';
const styles = _reactNative.StyleSheet.create({
  outer: {
    padding: 12,
    borderRadius: 8,
    borderWidth: 1
  },
  row: {
    width: '100%',
    flexDirection: 'row',
    alignItems: 'flex-start',
    gap: 8
  },
  content: {
    gap: 8,
    flex: 1,
    minHeight: 20,
    justifyContent: 'center'
  },
  text: {
    fontSize: 14,
    lineHeight: 20,
    paddingRight: 12
  }
});
//# sourceMappingURL=index.js.map