function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useState } from 'react';
import dayjs from 'dayjs';
import { PisellReservationSchedule } from "./PisellReservationSchedule";

/**
 * PisellReservationSchedule：预约营业日导航（上一天 / 日期文案 / 下一天）。
 * 多语言与日期格式依赖 LowCode 引擎 locale。详见组件目录下 docs/PisellReservationSchedule.md。
 */
var meta = {
  title: 'Data Entry/PisellReservationSchedule',
  component: PisellReservationSchedule,
  tags: ['autodocs'],
  parameters: {
    layout: 'padded',
    docs: {
      description: {
        component: '深色圆角营业日条：左右切换日历日，中间展示「今天（若当日）· 日期 · 星期」。可与 PisellTimeNavigator 组合为 PisellReservationScheduleBand。支持受控 `value` / `onChange(dayjs)`，以及 `minDate` / `maxDate`。'
      }
    }
  },
  argTypes: {
    value: {
      description: '当前选中日（受控），dayjs 或可解析字符串',
      control: 'text'
    },
    defaultValue: {
      description: '非受控初始日',
      control: 'text'
    },
    minDate: {
      description: '不可早于该日（含）',
      control: 'text'
    },
    maxDate: {
      description: '不可晚于该日（含）',
      control: 'text'
    },
    onChange: {
      action: 'onChange',
      description: '选中日变更，参数为 Dayjs（当日 0 点）'
    },
    className: {
      control: 'text'
    }
  }
};
export default meta;
export var Default = {
  args: {
    defaultValue: dayjs().format('YYYY-MM-DD')
  },
  decorators: [function (StoryComp) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        maxWidth: 440
      }
    }, /*#__PURE__*/React.createElement(StoryComp, null));
  }]
};
export var WithMinMax = {
  args: {
    defaultValue: dayjs().format('YYYY-MM-DD'),
    minDate: dayjs().startOf('day'),
    maxDate: dayjs().add(14, 'day').endOf('day')
  },
  decorators: [function (StoryComp) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        maxWidth: 440
      }
    }, /*#__PURE__*/React.createElement(StoryComp, null));
  }]
};
export var Controlled = {
  render: function ControlledRender() {
    var _useState = useState(dayjs().startOf('day')),
      _useState2 = _slicedToArray(_useState, 2),
      value = _useState2[0],
      setValue = _useState2[1];
    return /*#__PURE__*/React.createElement("div", {
      style: {
        maxWidth: 440
      }
    }, /*#__PURE__*/React.createElement(PisellReservationSchedule, {
      value: value,
      onChange: function onChange(d) {
        setValue(d);
        // eslint-disable-next-line no-console
        console.log('onChange', d.format('YYYY-MM-DD'));
      }
    }), /*#__PURE__*/React.createElement("p", {
      style: {
        marginTop: 12,
        fontSize: 12,
        color: '#666'
      }
    }, "\u5F53\u524D\uFF1A", value.format('YYYY-MM-DD dddd')));
  }
};