@bikdotai/bik-component-library 0.0.868-beta.7 → 0.0.868-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/button/themes.js +2 -2
- package/dist/cjs/components/button/themes.js.map +1 -1
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js +1 -1
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/agent-builder/constants/tools.d.ts +0 -1
- package/dist/esm/components/agent-builder/constants/tools.js +18 -18
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/button/themes.js +2 -1
- package/dist/esm/components/button/themes.js.map +1 -1
- package/dist/esm/components/schedule-builder/StartDateTimePicker.d.ts +7 -0
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js +1 -0
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js.map +1 -1
- package/dist/esm/components/schedule-builder/index.d.ts +1 -0
- package/dist/esm/index.js +198 -196
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=[{key:"tool",label:"Tools"},{key:"subagent",label:"Sub-agent"},{key:"variable",label:"Variables"}];var t=(e=>(e.Manifest="manifest",e.Shopify="shopify",e.Bigcommerce="bigcommerce",e.Shipstation="shipstation",e.Skio="skio",e.Gorgias="gorgias",e.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=[{key:"tool",label:"Tools"},{key:"subagent",label:"Sub-agent"},{key:"variable",label:"Variables"}];var t=(e=>(e.Manifest="manifest",e.Shopify="shopify",e.Bigcommerce="bigcommerce",e.Shipstation="shipstation",e.Skio="skio",e.Gorgias="gorgias",e.Integration="integration",e.RestApi="rest_api",e.EmailHandover="email_handover",e.Slack="slack",e))(t||{});const O={manifest:"Manifest",shopify:"Shopify",bigcommerce:"BigCommerce",shipstation:"ShipStation",skio:"Skio",gorgias:"Gorgias",integration:"Integration",rest_api:"Rest API",email_handover:"Email",slack:"Slack"},o={rest_api:"REST API",email_handover:"Send email",slack:"Send Slack message"},_=["rest_api","email_handover","slack"],i={manifest:0,shopify:1,bigcommerce:2,skio:3,gorgias:4,shipstation:6,slack:7,email_handover:8,rest_api:9},s=["shopify","bigcommerce","shipstation","skio","gorgias","integration"],E=new Set(s),S=e=>E.has(e),a=["shipstation","integration"],R=new Set(a),r=e=>R.has(e),I="more_integrations",c="More Integrations",N=10,T=Object.keys(i).length,g=e=>i[e]??T,A={email_handover:"send_email",slack:"send_slack_message"};exports.CATEGORIES=n;exports.CONFIG_TOOL_SOURCES=A;exports.INTEGRATION_SOURCES=s;exports.MORE_INTEGRATIONS_KEY=I;exports.MORE_INTEGRATIONS_LABEL=c;exports.MORE_INTEGRATIONS_RANK=N;exports.MORE_INTEGRATION_SOURCES=a;exports.TOOL_ACTION_LABELS=o;exports.TOOL_ACTION_SOURCES=_;exports.TOOL_SOURCE_LABELS=O;exports.TOOL_SOURCE_RANK=i;exports.ToolSource=t;exports.isIntegrationSource=S;exports.isMoreIntegrationSource=r;exports.toolSourceRank=g;
|
|
2
2
|
//# sourceMappingURL=tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sources":["../../../../../src/components/agent-builder/constants/tools.ts"],"sourcesContent":["import type { ToolSource as ModelToolSource } from '@bikdotai/bik-models/ai-agents/models/agent-tool';\nimport type { FunctionComponent, SVGAttributes } from 'react';\n\n/**\n * Static tool-related constants for the builder's Step 3 (tools & sub-agents):\n * the reference-picker category tabs and the per-source display labels. Kept here\n * (rather than inline in the picker / serialization utils) so the labels a user\n * sees are all in one obvious place.\n */\n\n/** A reference-picker category tab. */\nexport type Category = 'tool' | 'subagent' | 'variable';\n\n/** Category tabs shown at the root of the `@` reference picker. */\nexport const CATEGORIES: { key: Category; label: string }[] = [\n\t{ key: 'tool', label: 'Tools' },\n\t{ key: 'subagent', label: 'Sub-agent' },\n\t{ key: 'variable', label: 'Variables' },\n];\n\n/**\n * Every tool \"source\" the builder renders an icon / label / picker entry for.\n * Enum VALUES are the backend's canonical read-only `source` wire strings\n * (`app/agents/config/schema.py` → `ToolSource`, derived from `tool_key`): the\n * configurable tools are `email_handover` / `rest_api` / `slack`, every native\n * tool is `manifest`. `shopify` / `integration` are legacy bik-models sources\n * kept for back-compat (the backend now collapses natives to `manifest`).\n * Dynamic/unknown sources are looked up leniently — see `toolSourceLabel` and\n * `sourceIcon`.\n *\n * This is the RUNTIME mirror of the canonical `@bikdotai/bik-models` `ToolSource`\n * union (the shape the backend persists as `AgentToolDoc.source`). We keep an\n * enum — not a re-export of the type — because the members are needed at runtime\n * for labels, ranks, icons and `===` comparisons; a type-only union can't do\n * that. The two are kept in lock-step by {@link ToolSourceMatchesBikModels}\n * below, which fails to compile if they ever drift.\n */\nexport enum ToolSource {\n\tManifest = 'manifest',\n\tShopify = 'shopify',\n\tBigcommerce = 'bigcommerce',\n\tShipstation = 'shipstation',\n\tSkio = 'skio',\n\tGorgias = 'gorgias',\n\tAftership = 'aftership',\n\tIntegration = 'integration',\n\tRestApi = 'rest_api',\n\tEmailHandover = 'email_handover',\n\tSlack = 'slack',\n}\n\n/**\n * Compile-time guard that {@link ToolSource} stays a faithful mirror of the\n * canonical `@bikdotai/bik-models` `ToolSource` union. If a source is added to\n * (or removed from) either side without the other, `AssertTrue` receives `false`\n * and this type stops compiling — so the runtime enum can never silently diverge\n * from what the backend persists as `AgentToolDoc.source`. The tuple wrappers\n * (`[…]`) stop the conditionals from distributing over the unions, so it checks\n * set-equality in both directions.\n *\n * Type-only (erased at build): a drift shows up as a compile error on\n * `ToolSourceMatchesBikModels` telling you to reconcile this enum with\n * `@bikdotai/bik-models` (bump the dep and/or the enum).\n */\ntype AssertTrue<T extends true> = T;\ntype ToolSourceMatchesBikModels = AssertTrue<\n\t[`${ToolSource}`] extends [ModelToolSource]\n\t\t? [ModelToolSource] extends [`${ToolSource}`]\n\t\t\t? true\n\t\t\t: false\n\t\t: false\n>;\n\n/**\n * Display labels for the known tool sources — the CATEGORY/integration name, used\n * for the picker's source headers (drill-in groups), the empty-state source\n * buttons and the mention-chip prefix. A source is a category (\"Slack\") you drill\n * into; the specific addable action inside it (\"Send Slack message\") is\n * `TOOL_ACTION_LABELS`. Unknown sources fall back to the raw key (see\n * `toolSourceLabel`).\n */\nexport const TOOL_SOURCE_LABELS: Record<ToolSource, string> = {\n\t[ToolSource.Manifest]: 'Manifest',\n\t[ToolSource.Shopify]: 'Shopify',\n\t[ToolSource.Bigcommerce]: 'BigCommerce',\n\t[ToolSource.Shipstation]: 'ShipStation',\n\t[ToolSource.Skio]: 'Skio',\n\t[ToolSource.Gorgias]: 'Gorgias',\n\t[ToolSource.Aftership]: 'AfterShip',\n\t[ToolSource.Integration]: 'Integration',\n\t[ToolSource.RestApi]: 'Rest API',\n\t[ToolSource.EmailHandover]: 'Email',\n\t[ToolSource.Slack]: 'Slack',\n};\n\n/**\n * The addable action inside a configurable/rest source — shown as the \"add\" row\n * in the `@` picker (below any existing instances) and the empty-state button.\n * Distinct from `TOOL_SOURCE_LABELS`, which names the category the action lives in\n * (e.g. category \"Slack\" → action \"Send Slack message\").\n */\nexport const TOOL_ACTION_LABELS: Partial<Record<ToolSource, string>> = {\n\t[ToolSource.RestApi]: 'REST API',\n\t[ToolSource.EmailHandover]: 'Send email',\n\t[ToolSource.Slack]: 'Send Slack message',\n};\n\n/** A tool source's brand-glyph component. */\nexport type IconComp = FunctionComponent<SVGAttributes<SVGElement>>;\n\n/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */\nexport interface SourceIcon {\n\tIcon: IconComp;\n\tw: number;\n\th: number;\n}\n\n/**\n * A built-in \"tool\" that opens a config drawer (Rest API / email handover /\n * Slack) rather than inserting a mention. Surfaced as an empty-state source\n * button in the Tools section and as a row in the `@`-picker Tools view; picking\n * it opens the drawer and never writes into the instructions text.\n */\nexport interface ToolAction {\n\tsource: ToolSource;\n\tlabel: string;\n\ticon?: SourceIcon;\n\t/** Open this tool's config drawer. */\n\tonSelect: () => void;\n\t/**\n\t * Integration connection state for this source. `undefined` = no connection\n\t * gating (default). `false` = the store hasn't connected this integration →\n\t * the `@` picker shows a \"Connect\" row that calls {@link onConnect} instead of\n\t * drilling in / offering \"Create new\". `true` = connected (renders normally).\n\t * Set by the consumer via `config.integrationStatus` (today: Slack only).\n\t */\n\tconnected?: boolean;\n\t/** Open the parent's connect flow for this source (used when `connected === false`). */\n\tonConnect?: () => void;\n}\n\n/** Sources of the built-in drawer tools, in display order. */\nexport const TOOL_ACTION_SOURCES: ToolSource[] = [\n\tToolSource.RestApi,\n\tToolSource.EmailHandover,\n\tToolSource.Slack,\n];\n\n/**\n * Fixed display rank for the `@`-picker's tool-source groups (lower = higher). The\n * picker sorts its source rows by this so adding/updating a tool never reshuffles\n * them. Manifest (the native tools) leads; any source not listed here\n * (dynamic/unknown, e.g. Integration) sorts AFTER Slack, keeping its discovery\n * order among the rest (Array.sort is stable).\n */\nexport const TOOL_SOURCE_RANK: Partial<Record<ToolSource, number>> = {\n\t[ToolSource.Manifest]: 0,\n\t[ToolSource.Shopify]: 1,\n\t// BigCommerce / Skio / Gorgias / AfterShip are their OWN top-level rows; rank\n\t// orders them so adding/updating a tool never reshuffles them.\n\t[ToolSource.Bigcommerce]: 2,\n\t[ToolSource.Skio]: 3,\n\t[ToolSource.Gorgias]: 4,\n\t[ToolSource.Aftership]: 5,\n\t// ShipStation lives under the \"More Integrations\" umbrella; its rank only\n\t// orders it inside that drill-in view (never shown at the root).\n\t[ToolSource.Shipstation]: 6,\n\t[ToolSource.Slack]: 7,\n\t// Send Email then REST API sit after the integration sources at the top level.\n\t[ToolSource.EmailHandover]: 8,\n\t[ToolSource.RestApi]: 9,\n};\n\n/**\n * External integration / vendor sources. Each renders as its OWN top-level\n * drill-in group in the picker — even when it has a single tool — so the vendor\n * reads as its own discoverable, connectable unit (never collapsed to a lone\n * leaf; see the single-leaf flatten in `MentionPicker`). Deliberately excludes\n * `Manifest` (the built-in natives) and the config/rest action sources (Rest API\n * / Email / Slack), whose single capability is surfaced flat.\n */\nexport const INTEGRATION_SOURCES: ToolSource[] = [\n\tToolSource.Shopify,\n\tToolSource.Bigcommerce,\n\tToolSource.Shipstation,\n\tToolSource.Skio,\n\tToolSource.Gorgias,\n\tToolSource.Aftership,\n\tToolSource.Integration,\n];\n\nconst INTEGRATION_SOURCE_SET = new Set<string>(INTEGRATION_SOURCES);\n\n/** True for an external integration/vendor source (never collapsed to a single leaf). */\nexport const isIntegrationSource = (source: string): boolean =>\n\tINTEGRATION_SOURCE_SET.has(source);\n\n/**\n * Vendor integrations that live UNDER the \"More Integrations\" umbrella in the `@`\n * picker (a single top-level row → their list), instead of each being its own\n * root row. Shopify, BigCommerce, Skio, Gorgias and AfterShip stay top-level\n * sources of their own; only the less-common vendors (ShipStation) and the\n * generic catch-all Integration are tucked away here.\n */\nexport const MORE_INTEGRATION_SOURCES: ToolSource[] = [\n\tToolSource.Shipstation,\n\tToolSource.Integration,\n];\n\nconst MORE_INTEGRATION_SOURCE_SET = new Set<string>(MORE_INTEGRATION_SOURCES);\n\n/** True for a source shown under the \"More Integrations\" umbrella. */\nexport const isMoreIntegrationSource = (source: string): boolean =>\n\tMORE_INTEGRATION_SOURCE_SET.has(source);\n\n/**\n * Synthetic picker key / label / rank for the \"More Integrations\" umbrella row.\n * The rank lives here (not in {@link TOOL_SOURCE_RANK}) because that map is keyed\n * by the drift-guarded {@link ToolSource} enum — the backend's canonical wire\n * strings — and `more_integrations` is a picker-only key, not a real source.\n */\nexport const MORE_INTEGRATIONS_KEY = 'more_integrations';\nexport const MORE_INTEGRATIONS_LABEL = 'More Integrations';\n/** Always last — sits after every named top-level source (REST API, rank 9). */\nexport const MORE_INTEGRATIONS_RANK = 10;\n\nconst UNRANKED_SOURCE_RANK = Object.keys(TOOL_SOURCE_RANK).length;\n\n/** Sort rank for a source string; unknown sources rank after all known ones. */\nexport const toolSourceRank = (source: string): number =>\n\tTOOL_SOURCE_RANK[source as ToolSource] ?? UNRANKED_SOURCE_RANK;\n\n/**\n * `tool_key` of a configurable shared-drawer tool (email / Slack). Lives here (not\n * in AgentBuilder.model) so this leaf constants file has no back-edge to the model\n * — the dependency stays one-way (model → constants), avoiding a circular import.\n */\nexport type ConfigToolKey = 'send_email' | 'send_slack_message';\n\n/**\n * Drawer sources rendered by the shared dynamic panel (`ConfigToolPanel`), each\n * mapped to its backend `tool_key`. Rest API is absent — it has a bespoke panel.\n */\nexport const CONFIG_TOOL_SOURCES: Partial<Record<ToolSource, ConfigToolKey>> = {\n\t[ToolSource.EmailHandover]: 'send_email',\n\t[ToolSource.Slack]: 'send_slack_message',\n};\n"],"names":["CATEGORIES","ToolSource","TOOL_SOURCE_LABELS","TOOL_ACTION_LABELS","TOOL_ACTION_SOURCES","TOOL_SOURCE_RANK","INTEGRATION_SOURCES","INTEGRATION_SOURCE_SET","isIntegrationSource","source","MORE_INTEGRATION_SOURCES","MORE_INTEGRATION_SOURCE_SET","isMoreIntegrationSource","MORE_INTEGRATIONS_KEY","MORE_INTEGRATIONS_LABEL","MORE_INTEGRATIONS_RANK","UNRANKED_SOURCE_RANK","toolSourceRank","CONFIG_TOOL_SOURCES"],"mappings":"gFAcO,MAAMA,EAAiD,CAC7D,CAAE,IAAK,OAAQ,MAAO,OAAA,EACtB,CAAE,IAAK,WAAY,MAAO,WAAA,EAC1B,CAAE,IAAK,WAAY,MAAO,WAAA,CAC3B,EAmBO,IAAKC,GAAAA,IACXA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,YAAc,cACdA,EAAA,YAAc,cACdA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,UAAY,YACZA,EAAA,YAAc,cACdA,EAAA,QAAU,WACVA,EAAA,cAAgB,iBAChBA,EAAA,MAAQ,QAXGA,IAAAA,GAAA,CAAA,CAAA,EA4CL,MAAMC,EAAiD,CAC5D,SAAsB,WACtB,QAAqB,UACrB,YAAyB,cACzB,YAAyB,cACzB,KAAkB,OAClB,QAAqB,UACrB,UAAuB,YACvB,YAAyB,cACzB,SAAqB,WACrB,eAA2B,QAC3B,MAAmB,OACrB,EAQaC,EAA0D,CACrE,SAAqB,WACrB,eAA2B,aAC3B,MAAmB,oBACrB,EAqCaC,EAAoC,CAChD,WACA,iBACA,OACD,EASaC,EAAwD,CACnE,SAAsB,EACtB,QAAqB,EAGrB,YAAyB,EACzB,KAAkB,EAClB,QAAqB,EACrB,UAAuB,EAGvB,YAAyB,EACzB,MAAmB,EAEnB,eAA2B,EAC3B,SAAqB,CACvB,EAUaC,EAAoC,CAChD,UACA,cACA,cACA,OACA,UACA,YACA,aACD,EAEMC,EAAyB,IAAI,IAAYD,CAAmB,EAGrDE,EAAuBC,GACnCF,EAAuB,IAAIE,CAAM,EASrBC,EAAyC,CACrD,cACA,aACD,EAEMC,EAA8B,IAAI,IAAYD,CAAwB,EAG/DE,EAA2BH,GACvCE,EAA4B,IAAIF,CAAM,EAQ1BI,EAAwB,oBACxBC,EAA0B,oBAE1BC,EAAyB,GAEhCC,EAAuB,OAAO,KAAKX,CAAgB,EAAE,OAG9CY,EAAkBR,GAC9BJ,EAAiBI,CAAoB,GAAKO,EAa9BE,EAAkE,CAC7E,eAA2B,aAC3B,MAAmB,oBACrB"}
|
|
1
|
+
{"version":3,"file":"tools.js","sources":["../../../../../src/components/agent-builder/constants/tools.ts"],"sourcesContent":["import type { ToolSource as ModelToolSource } from '@bikdotai/bik-models/ai-agents/models/agent-tool';\nimport type { FunctionComponent, SVGAttributes } from 'react';\n\n/**\n * Static tool-related constants for the builder's Step 3 (tools & sub-agents):\n * the reference-picker category tabs and the per-source display labels. Kept here\n * (rather than inline in the picker / serialization utils) so the labels a user\n * sees are all in one obvious place.\n */\n\n/** A reference-picker category tab. */\nexport type Category = 'tool' | 'subagent' | 'variable';\n\n/** Category tabs shown at the root of the `@` reference picker. */\nexport const CATEGORIES: { key: Category; label: string }[] = [\n\t{ key: 'tool', label: 'Tools' },\n\t{ key: 'subagent', label: 'Sub-agent' },\n\t{ key: 'variable', label: 'Variables' },\n];\n\n/**\n * Every tool \"source\" the builder renders an icon / label / picker entry for.\n * Enum VALUES are the backend's canonical read-only `source` wire strings\n * (`app/agents/config/schema.py` → `ToolSource`, derived from `tool_key`): the\n * configurable tools are `email_handover` / `rest_api` / `slack`, every native\n * tool is `manifest`. `shopify` / `integration` are legacy bik-models sources\n * kept for back-compat (the backend now collapses natives to `manifest`).\n * Dynamic/unknown sources are looked up leniently — see `toolSourceLabel` and\n * `sourceIcon`.\n *\n * This is the RUNTIME mirror of the canonical `@bikdotai/bik-models` `ToolSource`\n * union (the shape the backend persists as `AgentToolDoc.source`). We keep an\n * enum — not a re-export of the type — because the members are needed at runtime\n * for labels, ranks, icons and `===` comparisons; a type-only union can't do\n * that. The two are kept in lock-step by {@link ToolSourceMatchesBikModels}\n * below, which fails to compile if they ever drift.\n */\nexport enum ToolSource {\n\tManifest = 'manifest',\n\tShopify = 'shopify',\n\tBigcommerce = 'bigcommerce',\n\tShipstation = 'shipstation',\n\tSkio = 'skio',\n\tGorgias = 'gorgias',\n\t// Aftership = 'aftership',\n\tIntegration = 'integration',\n\tRestApi = 'rest_api',\n\tEmailHandover = 'email_handover',\n\tSlack = 'slack',\n}\n\n/**\n * Compile-time guard that {@link ToolSource} stays a faithful mirror of the\n * canonical `@bikdotai/bik-models` `ToolSource` union. If a source is added to\n * (or removed from) either side without the other, `AssertTrue` receives `false`\n * and this type stops compiling — so the runtime enum can never silently diverge\n * from what the backend persists as `AgentToolDoc.source`. The tuple wrappers\n * (`[…]`) stop the conditionals from distributing over the unions, so it checks\n * set-equality in both directions.\n *\n * Type-only (erased at build): a drift shows up as a compile error on\n * `ToolSourceMatchesBikModels` telling you to reconcile this enum with\n * `@bikdotai/bik-models` (bump the dep and/or the enum).\n */\ntype AssertTrue<T extends true> = T;\ntype ToolSourceMatchesBikModels = AssertTrue<\n\t[`${ToolSource}`] extends [ModelToolSource]\n\t\t? [ModelToolSource] extends [`${ToolSource}`]\n\t\t\t? true\n\t\t\t: false\n\t\t: false\n>;\n\n/**\n * Display labels for the known tool sources — the CATEGORY/integration name, used\n * for the picker's source headers (drill-in groups), the empty-state source\n * buttons and the mention-chip prefix. A source is a category (\"Slack\") you drill\n * into; the specific addable action inside it (\"Send Slack message\") is\n * `TOOL_ACTION_LABELS`. Unknown sources fall back to the raw key (see\n * `toolSourceLabel`).\n */\nexport const TOOL_SOURCE_LABELS: Record<ToolSource, string> = {\n\t[ToolSource.Manifest]: 'Manifest',\n\t[ToolSource.Shopify]: 'Shopify',\n\t[ToolSource.Bigcommerce]: 'BigCommerce',\n\t[ToolSource.Shipstation]: 'ShipStation',\n\t[ToolSource.Skio]: 'Skio',\n\t[ToolSource.Gorgias]: 'Gorgias',\n\t// [ToolSource.Aftership]: 'AfterShip',\n\t[ToolSource.Integration]: 'Integration',\n\t[ToolSource.RestApi]: 'Rest API',\n\t[ToolSource.EmailHandover]: 'Email',\n\t[ToolSource.Slack]: 'Slack',\n};\n\n/**\n * The addable action inside a configurable/rest source — shown as the \"add\" row\n * in the `@` picker (below any existing instances) and the empty-state button.\n * Distinct from `TOOL_SOURCE_LABELS`, which names the category the action lives in\n * (e.g. category \"Slack\" → action \"Send Slack message\").\n */\nexport const TOOL_ACTION_LABELS: Partial<Record<ToolSource, string>> = {\n\t[ToolSource.RestApi]: 'REST API',\n\t[ToolSource.EmailHandover]: 'Send email',\n\t[ToolSource.Slack]: 'Send Slack message',\n};\n\n/** A tool source's brand-glyph component. */\nexport type IconComp = FunctionComponent<SVGAttributes<SVGElement>>;\n\n/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */\nexport interface SourceIcon {\n\tIcon: IconComp;\n\tw: number;\n\th: number;\n}\n\n/**\n * A built-in \"tool\" that opens a config drawer (Rest API / email handover /\n * Slack) rather than inserting a mention. Surfaced as an empty-state source\n * button in the Tools section and as a row in the `@`-picker Tools view; picking\n * it opens the drawer and never writes into the instructions text.\n */\nexport interface ToolAction {\n\tsource: ToolSource;\n\tlabel: string;\n\ticon?: SourceIcon;\n\t/** Open this tool's config drawer. */\n\tonSelect: () => void;\n\t/**\n\t * Integration connection state for this source. `undefined` = no connection\n\t * gating (default). `false` = the store hasn't connected this integration →\n\t * the `@` picker shows a \"Connect\" row that calls {@link onConnect} instead of\n\t * drilling in / offering \"Create new\". `true` = connected (renders normally).\n\t * Set by the consumer via `config.integrationStatus` (today: Slack only).\n\t */\n\tconnected?: boolean;\n\t/** Open the parent's connect flow for this source (used when `connected === false`). */\n\tonConnect?: () => void;\n}\n\n/** Sources of the built-in drawer tools, in display order. */\nexport const TOOL_ACTION_SOURCES: ToolSource[] = [\n\tToolSource.RestApi,\n\tToolSource.EmailHandover,\n\tToolSource.Slack,\n];\n\n/**\n * Fixed display rank for the `@`-picker's tool-source groups (lower = higher). The\n * picker sorts its source rows by this so adding/updating a tool never reshuffles\n * them. Manifest (the native tools) leads; any source not listed here\n * (dynamic/unknown, e.g. Integration) sorts AFTER Slack, keeping its discovery\n * order among the rest (Array.sort is stable).\n */\nexport const TOOL_SOURCE_RANK: Partial<Record<ToolSource, number>> = {\n\t[ToolSource.Manifest]: 0,\n\t[ToolSource.Shopify]: 1,\n\t// BigCommerce / Skio / Gorgias / AfterShip are their OWN top-level rows; rank\n\t// orders them so adding/updating a tool never reshuffles them.\n\t[ToolSource.Bigcommerce]: 2,\n\t[ToolSource.Skio]: 3,\n\t[ToolSource.Gorgias]: 4,\n\t// [ToolSource.Aftership]: 5,\n\t// ShipStation lives under the \"More Integrations\" umbrella; its rank only\n\t// orders it inside that drill-in view (never shown at the root).\n\t[ToolSource.Shipstation]: 6,\n\t[ToolSource.Slack]: 7,\n\t// Send Email then REST API sit after the integration sources at the top level.\n\t[ToolSource.EmailHandover]: 8,\n\t[ToolSource.RestApi]: 9,\n};\n\n/**\n * External integration / vendor sources. Each renders as its OWN top-level\n * drill-in group in the picker — even when it has a single tool — so the vendor\n * reads as its own discoverable, connectable unit (never collapsed to a lone\n * leaf; see the single-leaf flatten in `MentionPicker`). Deliberately excludes\n * `Manifest` (the built-in natives) and the config/rest action sources (Rest API\n * / Email / Slack), whose single capability is surfaced flat.\n */\nexport const INTEGRATION_SOURCES: ToolSource[] = [\n\tToolSource.Shopify,\n\tToolSource.Bigcommerce,\n\tToolSource.Shipstation,\n\tToolSource.Skio,\n\tToolSource.Gorgias,\n\t// ToolSource.Aftership,\n\tToolSource.Integration,\n];\n\nconst INTEGRATION_SOURCE_SET = new Set<string>(INTEGRATION_SOURCES);\n\n/** True for an external integration/vendor source (never collapsed to a single leaf). */\nexport const isIntegrationSource = (source: string): boolean =>\n\tINTEGRATION_SOURCE_SET.has(source);\n\n/**\n * Vendor integrations that live UNDER the \"More Integrations\" umbrella in the `@`\n * picker (a single top-level row → their list), instead of each being its own\n * root row. Shopify, BigCommerce, Skio, Gorgias and AfterShip stay top-level\n * sources of their own; only the less-common vendors (ShipStation) and the\n * generic catch-all Integration are tucked away here.\n */\nexport const MORE_INTEGRATION_SOURCES: ToolSource[] = [\n\tToolSource.Shipstation,\n\tToolSource.Integration,\n];\n\nconst MORE_INTEGRATION_SOURCE_SET = new Set<string>(MORE_INTEGRATION_SOURCES);\n\n/** True for a source shown under the \"More Integrations\" umbrella. */\nexport const isMoreIntegrationSource = (source: string): boolean =>\n\tMORE_INTEGRATION_SOURCE_SET.has(source);\n\n/**\n * Synthetic picker key / label / rank for the \"More Integrations\" umbrella row.\n * The rank lives here (not in {@link TOOL_SOURCE_RANK}) because that map is keyed\n * by the drift-guarded {@link ToolSource} enum — the backend's canonical wire\n * strings — and `more_integrations` is a picker-only key, not a real source.\n */\nexport const MORE_INTEGRATIONS_KEY = 'more_integrations';\nexport const MORE_INTEGRATIONS_LABEL = 'More Integrations';\n/** Always last — sits after every named top-level source (REST API, rank 9). */\nexport const MORE_INTEGRATIONS_RANK = 10;\n\nconst UNRANKED_SOURCE_RANK = Object.keys(TOOL_SOURCE_RANK).length;\n\n/** Sort rank for a source string; unknown sources rank after all known ones. */\nexport const toolSourceRank = (source: string): number =>\n\tTOOL_SOURCE_RANK[source as ToolSource] ?? UNRANKED_SOURCE_RANK;\n\n/**\n * `tool_key` of a configurable shared-drawer tool (email / Slack). Lives here (not\n * in AgentBuilder.model) so this leaf constants file has no back-edge to the model\n * — the dependency stays one-way (model → constants), avoiding a circular import.\n */\nexport type ConfigToolKey = 'send_email' | 'send_slack_message';\n\n/**\n * Drawer sources rendered by the shared dynamic panel (`ConfigToolPanel`), each\n * mapped to its backend `tool_key`. Rest API is absent — it has a bespoke panel.\n */\nexport const CONFIG_TOOL_SOURCES: Partial<Record<ToolSource, ConfigToolKey>> = {\n\t[ToolSource.EmailHandover]: 'send_email',\n\t[ToolSource.Slack]: 'send_slack_message',\n};\n"],"names":["CATEGORIES","ToolSource","TOOL_SOURCE_LABELS","TOOL_ACTION_LABELS","TOOL_ACTION_SOURCES","TOOL_SOURCE_RANK","INTEGRATION_SOURCES","INTEGRATION_SOURCE_SET","isIntegrationSource","source","MORE_INTEGRATION_SOURCES","MORE_INTEGRATION_SOURCE_SET","isMoreIntegrationSource","MORE_INTEGRATIONS_KEY","MORE_INTEGRATIONS_LABEL","MORE_INTEGRATIONS_RANK","UNRANKED_SOURCE_RANK","toolSourceRank","CONFIG_TOOL_SOURCES"],"mappings":"gFAcO,MAAMA,EAAiD,CAC7D,CAAE,IAAK,OAAQ,MAAO,OAAA,EACtB,CAAE,IAAK,WAAY,MAAO,WAAA,EAC1B,CAAE,IAAK,WAAY,MAAO,WAAA,CAC3B,EAmBO,IAAKC,GAAAA,IACXA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,YAAc,cACdA,EAAA,YAAc,cACdA,EAAA,KAAO,OACPA,EAAA,QAAU,UAEVA,EAAA,YAAc,cACdA,EAAA,QAAU,WACVA,EAAA,cAAgB,iBAChBA,EAAA,MAAQ,QAXGA,IAAAA,GAAA,CAAA,CAAA,EA4CL,MAAMC,EAAiD,CAC5D,SAAsB,WACtB,QAAqB,UACrB,YAAyB,cACzB,YAAyB,cACzB,KAAkB,OAClB,QAAqB,UAErB,YAAyB,cACzB,SAAqB,WACrB,eAA2B,QAC3B,MAAmB,OACrB,EAQaC,EAA0D,CACrE,SAAqB,WACrB,eAA2B,aAC3B,MAAmB,oBACrB,EAqCaC,EAAoC,CAChD,WACA,iBACA,OACD,EASaC,EAAwD,CACnE,SAAsB,EACtB,QAAqB,EAGrB,YAAyB,EACzB,KAAkB,EAClB,QAAqB,EAIrB,YAAyB,EACzB,MAAmB,EAEnB,eAA2B,EAC3B,SAAqB,CACvB,EAUaC,EAAoC,CAChD,UACA,cACA,cACA,OACA,UAEA,aACD,EAEMC,EAAyB,IAAI,IAAYD,CAAmB,EAGrDE,EAAuBC,GACnCF,EAAuB,IAAIE,CAAM,EASrBC,EAAyC,CACrD,cACA,aACD,EAEMC,EAA8B,IAAI,IAAYD,CAAwB,EAG/DE,EAA2BH,GACvCE,EAA4B,IAAIF,CAAM,EAQ1BI,EAAwB,oBACxBC,EAA0B,oBAE1BC,EAAyB,GAEhCC,EAAuB,OAAO,KAAKX,CAAgB,EAAE,OAG9CY,EAAkBR,GAC9BJ,EAAiBI,CAAoB,GAAKO,EAa9BE,EAAkE,CAC7E,eAA2B,aAC3B,MAAmB,oBACrB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
transparent 5px,
|
|
3
3
|
transparent 10px`:`6px,
|
|
4
4
|
transparent 6px,
|
|
5
|
-
transparent 12px`,
|
|
5
|
+
transparent 12px`,p=(t,n)=>{const e=parseInt(t.replace("#",""),16),a=Math.round(2.55*n),i=(e>>16)-a,u=(e>>8&255)-a,s=(e&255)-a;return`#${(16777216+(Math.max(i,0)<<16)+(Math.max(u,0)<<8)+Math.max(s,0)).toString(16).slice(1)}`},O=(t,n)=>{const e=parseInt(t.replace("#",""),16),a=Math.round(2.55*n),i=(e>>16)+a,u=(e>>8&255)+a,s=(e&255)+a;return`#${(16777216+(Math.min(i,255)<<16)+(Math.min(u,255)<<8)+Math.min(s,255)).toString(16).slice(1)}`},R=(t,n)=>t==="ai"?`background: ${r.COLORS.surface.aiLight};`:t==="text"?"background-color:transparent;":t==="special"||t==="secondaryGray"?"":!n&&t!=="primary"?`background-color: #000000;
|
|
6
6
|
opacity: 0.03;`:"",k=(t,n)=>n?"":`text-decoration-line: underline;
|
|
7
7
|
text-decoration-color: ${r.COLORS.content.brand};`,h=(t,n)=>n?"":t==="primary"?`background-color: ${r.COLORS.stroke.warning.lightAlt};`:"background-color: rgba(255, 255, 255, 0.1)",x=(t,n,e)=>t==="special"?`background-color: ${r.COLORS.background.base}; ${o(n,r.COLORS.stroke.primary)}`:t==="secondaryGray"?o(n,r.COLORS.stroke.primary):n==="chip"?"background-color: transparent;":t==="primary"||t==="destructive"?e?"background-color: rgba(255,255,255,0.3);":`background-color: ${r.COLORS.background.inactive};`:t==="secondary"?e?o(n,"rgba(255, 255, 255, 0.5)"):o(n,r.COLORS.stroke.primary):"",m=(t,n,e=d(t,!1))=>`
|
|
8
8
|
.line-top {
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
text-decoration-color: ${r.COLORS.content.brand};`;if(t==="special")return`background-color: ${r.COLORS.background.brandLight}; ${o(n,r.COLORS.stroke.brandLightAlt)}`;if(t==="secondaryGray"||t==="tertiaryGray")return`background-color: ${r.COLORS.surface.hovered}; ${o(n,r.COLORS.stroke.primary)}`;if(n==="chip")return`border: 1px solid ${r.COLORS.stroke.brandLightAlt};
|
|
63
63
|
background-color: ${r.COLORS.background.brandLight};`;if(t==="primary"||t==="destructive")return e?`background-color: ${r.COLORS.background.warning.vibrant} !important;
|
|
64
64
|
box-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);
|
|
65
|
-
`:"box-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);";if(t==="secondary"||t==="tertiary"||t
|
|
65
|
+
`:"box-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);";if(t==="secondary"||t==="tertiary"||t.startsWith("dash"))return e?`background-color: ${r.COLORS.background.inverseLight} !important;`:`background-color: ${r.COLORS.background.brandLight};`},$=(t,n,e,a)=>t==="special"?`background-color: ${r.COLORS.background.brandVeryLight};`:t==="secondaryGray"?`background-color: ${r.COLORS.surface.subdued};`:n==="chip"?`background-color: ${r.COLORS.background.base};`:t==="primary"?a?`background-color: ${O(a,50)};`:`background-color: ${e?r.COLORS.background.warning.vibrant:r.COLORS.background.brandLight};`:t==="destructive"?`background-color: ${r.COLORS.background.negative.light};`:"background-color: transparent;",v=(t,n,e)=>t==="special"?o(n,r.COLORS.stroke.brandLightAlt):t==="secondaryGray"?o(n,r.COLORS.stroke.primary):n==="chip"?"border: none;":t==="secondary"?e?o(n,r.COLORS.content.secondary):o(n,r.COLORS.stroke.brandLightAlt):"",B=(t,n)=>t==="secondaryGray"?r.COLORS.content.secondary:n?t==="primary"?r.COLORS.content.primary:r.COLORS.content.primaryInverse:t==="destructive"?r.COLORS.content.negative:r.COLORS.content.brand,G=(t,n,e,a,i,u)=>{if(t==="chip")return a?r.COLORS.content.inactive:u?r.COLORS.content.primary:r.COLORS.content.secondary;if(i)return"transparent";if(n==="special")return a?r.COLORS.content.inactive:r.COLORS.background.inverseLight;if(n==="secondaryGray")return a?r.COLORS.content.inactive:r.COLORS.content.secondary;if(n==="primary"||n==="destructive")return e?a?"rgba(255, 255, 255, 0.5)":r.COLORS.content.primary:a?r.COLORS.content.inactive:r.COLORS.content.primaryInverse;if(n==="secondary")return e?a?"rgba(255, 255, 255, 0.5)":r.COLORS.content.primaryInverse:a?r.COLORS.content.inactive:r.COLORS.content.brand;if(n==="tertiary")return e?a?"rgba(255, 255, 255, 0.5)":r.COLORS.content.primaryInverse:a?r.COLORS.content.inactive:r.COLORS.content.brand;if(n==="tertiaryGray"||n.startsWith("dash"))return a?r.COLORS.content.inactive:r.COLORS.content.secondary};exports.GetButtonTextComponent=C;exports.SpinnerColorMap=B;exports.generateDisabledStyling=x;exports.generateInverseHoverBackground=h;exports.getBackgroundColor=l;exports.getBorder=b;exports.getBorderColor=d;exports.getButtonIconColor=G;exports.getClickEffect=y;exports.getColor=L;exports.getDashedBorderStyling=m;exports.getDisabledTextColor=f;exports.getHoverButtonBackground=R;exports.getHoverButtonBackgroundCustom=p;exports.getHoverButtonTextDecorationStyle=k;exports.getLinearGradientValue=g;exports.getLoadingBackground=$;exports.getLoadingBorder=v;exports.getLoadingButtonBackgroundCustom=O;exports.getPadding=S;exports.strokeStyle=o;
|
|
66
66
|
//# sourceMappingURL=themes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.js","sources":["../../../../src/components/button/themes.tsx"],"sourcesContent":["import { COLORS } from '@src/constants/Theme';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tButtonLarge,\n\tButtonLargeAI,\n\tButtonRegular,\n\tButtonRegularAI,\n} from '../TypographyStyle';\nimport { Size, Type } from './model';\n\nexport const getBackgroundColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n\tbuttonColor?: string,\n): string => {\n\tif (type === 'special') return COLORS.background.brandVeryLight;\n\tif (type === 'secondaryGray') return 'transparent';\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn 'transparent';\n\t\t}\n\t\treturn darkMode ? COLORS.surface.hovered : COLORS.surface.subdued;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn buttonColor\n\t\t\t\t? buttonColor\n\t\t\t\t: inverse\n\t\t\t\t? COLORS.background.warning.vibrant\n\t\t\t\t: COLORS.background.inverseLight;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.background.negative.vibrant;\n\t\tcase 'tertiary':\n\t\t\treturn 'transparent';\n\t\tdefault:\n\t\t\treturn 'transparent';\n\t}\n};\n\nexport const getColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n): string => {\n\tif (type === 'special') return COLORS.background.inverseLight;\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn inverse ? COLORS.content.inactive : COLORS.content.brand;\n\t\t}\n\t\treturn darkMode ? COLORS.content.primary : COLORS.content.secondary;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn inverse ? COLORS.content.primary : COLORS.content.primaryInverse;\n\t\tcase 'tertiaryGray':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.content.primaryInverse;\n\t\tcase 'dashBold':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'dashRegular':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'ai':\n\t\t\treturn COLORS.content.ai;\n\t\tdefault:\n\t\t\treturn inverse ? COLORS.content.primaryInverse : COLORS.stroke.brand;\n\t}\n};\n\nexport const getDisabledTextColor = (inverse?: boolean) => {\n\tif (inverse) {\n\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t}\n\treturn COLORS.content.inactive;\n};\n\nexport const getPadding = (type: Type, size: Size) => {\n\tif (type === 'text') {\n\t\treturn '0px';\n\t} else if (size === 'xs') {\n\t\treturn '4px 6px';\n\t} else if (size === 'chip') {\n\t\treturn '4px 8px';\n\t} else if (size === 'small') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '6px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '6px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '6px 12px';\n\t\t}\n\t} else if (size === 'medium') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '10px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '10px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '10px 12px';\n\t\t}\n\t} else if (size === 'large') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '14px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '14px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '14px 12px';\n\t\t}\n\t}\n};\nexport const GetButtonTextComponent = (\n\tsize: Size,\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (!disabled && type === 'ai') {\n\t\tif (size === 'small') {\n\t\t\treturn ButtonRegularAI;\n\t\t} else {\n\t\t\treturn ButtonLargeAI;\n\t\t}\n\t}\n\n\tif (type === 'dashRegular') {\n\t\treturn BodySecondary;\n\t}\n\tif (size === 'chip' || size === 'xs') {\n\t\treturn BodyCaption;\n\t} else if (size === 'small') {\n\t\treturn ButtonRegular;\n\t}\n\treturn ButtonLarge;\n};\n\nexport const getBorderColor = (\n\ttype: Type,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (error) {\n\t\treturn COLORS.stroke.negative.vibrant;\n\t}\n\n\tif (inverse) {\n\t\treturn COLORS.surface.standard;\n\t}\n\tif (type == 'secondary') {\n\t\treturn COLORS.stroke.brand;\n\t}\n\treturn COLORS.content.placeholder;\n};\n\nexport const strokeStyle = (size: Size, color: string, width = 1): string =>\n\tsize === 'xs'\n\t\t? `box-shadow: inset 0 0 0 ${width}px ${color}; border: none;`\n\t\t: `border: ${width}px solid ${color};`;\n\nexport const getBorder = (\n\tversion: '1.0' | '2.0' | '3.0',\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (type == 'text') {\n\t\treturn 'border: none;';\n\t}\n\tif (type === 'special') {\n\t\treturn strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: ${version === '2.0' ? 0.5 : 1}px solid ${\n\t\t\tCOLORS.stroke.primary\n\t\t};`;\n\t}\n\tif (inverse) {\n\t\tif (type === 'secondary') {\n\t\t\treturn strokeStyle(\n\t\t\t\tsize,\n\t\t\t\tgetBorderColor(type, inverse, error),\n\t\t\t\tversion === '2.0' ? 0.5 : 1,\n\t\t\t);\n\t\t}\n\t\treturn 'border: none;';\n\t}\n\n\tif (type === 'secondary') {\n\t\treturn strokeStyle(\n\t\t\tsize,\n\t\t\tgetBorderColor(type, false, error),\n\t\t\tversion === '2.0' ? 0.5 : 1,\n\t\t);\n\t}\n\treturn 'border: none;';\n};\n\nexport const getLinearGradientValue = (size: Size): string => {\n\tif (size === 'medium') {\n\t\treturn `5px,\n\t\ttransparent 5px,\n\t\ttransparent 10px`;\n\t}\n\treturn `6px,\n\t\ttransparent 6px,\n\t\ttransparent 12px`;\n};\n\n/**\n * Adjusts the brightness of a given hex color by a specified percentage.\n * Below function is used to generate a hover effect for button backgrounds.\n *\n * @param {string} color - The hex color code to be adjusted (e.g., \"#ff0000\").\n * @param {number} percent - The percentage by which to darken the color. Positive values darken the color.\n * @returns {string} - The adjusted hex color code.\n *\n * @example\n * // Darken the color #ff0000 (red) by 10%\n * const darkerRed = getHoverButtonBackgroundCustom(\"#ff0000\", 10);\n * console.log(darkerRed); // Output might be \"#e60000\"\n */\n\nexport const getHoverButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) - amt,\n\t\tG = ((num >> 8) & 0x00ff) - amt,\n\t\tB = (num & 0x0000ff) - amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.max(R, 0) << 16) +\n\t\t(Math.max(G, 0) << 8) +\n\t\tMath.max(B, 0)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\n/**\n * Generates a new color by adjusting the brightness of the given color by a specified percentage.\n *\n * @param color - The original color in hexadecimal format (e.g., \"#RRGGBB\").\n * @param percent - The percentage to adjust the brightness. Positive values will lighten the color, while negative values will darken it.\n * @returns The new color in hexadecimal format after adjusting the brightness.\n *\n * @example\n * // Lighten the color by 20%\n * const newColor = getLoadingButtonBackgroundCustom(\"#ff0000\", 20); // \"#ff3333\"\n *\n * @example\n * // Darken the color by 10%\n * const newColor = getLoadingButtonBackgroundCustom(\"#00ff00\", -10); // \"#00e600\"\n */\nexport const getLoadingButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) + amt,\n\t\tG = ((num >> 8) & 0x00ff) + amt,\n\t\tB = (num & 0x0000ff) + amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.min(R, 255) << 16) +\n\t\t(Math.min(G, 255) << 8) +\n\t\tMath.min(B, 255)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\nexport const getHoverButtonBackground = (type: Type, inverse?: boolean) => {\n\tif (type === 'ai') {\n\t\treturn `background: ${COLORS.surface.aiLight};`;\n\t}\n\n\tif (type === 'text') {\n\t\treturn `background-color:transparent;`;\n\t}\n\tif (type === 'special' || type === 'secondaryGray') {\n\t\treturn '';\n\t}\n\tif (!inverse && type !== 'primary') {\n\t\treturn `background-color: #000000;\n\t\t\t\topacity: 0.03;`;\n\t}\n\n\treturn ``;\n};\n\nexport const getHoverButtonTextDecorationStyle = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\treturn `text-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n};\n\nexport const generateInverseHoverBackground = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\tif (type === 'primary') {\n\t\treturn `background-color: ${COLORS.stroke.warning.lightAlt};`;\n\t}\n\treturn `background-color: rgba(255, 255, 255, 0.1)`;\n};\n\nexport const generateDisabledStyling = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.base}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.primary,\n\t\t)}`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: transparent;`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\treturn inverse\n\t\t\t? 'background-color: rgba(255,255,255,0.3);'\n\t\t\t: `background-color: ${COLORS.background.inactive};`;\n\t} else if (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? strokeStyle(size, 'rgba(255, 255, 255, 0.5)')\n\t\t\t: strokeStyle(size, COLORS.stroke.primary);\n\t}\n\treturn '';\n};\n\nexport const getDashedBorderStyling = (\n\ttype: Type,\n\tsize: Size,\n\tborderColor: string = getBorderColor(type, false),\n) => {\n\treturn `\n\t.line-top {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-right {\n\t\tposition: absolute;\n\t\tright: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-bottom {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tbottom: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-left {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t`;\n};\n\nexport const getClickEffect = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'text') {\n\t\treturn `background-color: ${COLORS.background.brandLight};\n\t\t\ttext-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n\t}\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandLight}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.brandLightAlt,\n\t\t)}`;\n\t}\n\tif (type === 'secondaryGray' || type === 'tertiaryGray') {\n\t\treturn `background-color: ${COLORS.surface.hovered}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.primary,\n\t\t)}`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: 1px solid ${COLORS.stroke.brandLightAlt};\n\t\tbackground-color: ${COLORS.background.brandLight};`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\treturn `background-color: ${COLORS.background.warning.vibrant} !important;\n\t\t\tbox-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);\n\t\t\t`;\n\t\t}\n\t\treturn 'box-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);';\n\t} else if (\n\t\ttype === 'secondary' ||\n\t\ttype === 'tertiary' ||\n\t\ttype === 'tertiaryGray' ||\n\t\ttype.startsWith('dash')\n\t) {\n\t\treturn inverse\n\t\t\t? `background-color: ${COLORS.background.inverseLight} !important;`\n\t\t\t: `background-color: ${COLORS.background.brandLight};`;\n\t}\n};\nexport const getLoadingBackground = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tbuttonColor?: string,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandVeryLight};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `background-color: ${COLORS.surface.subdued};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: ${COLORS.background.base};`;\n\t}\n\tif (type === 'primary') {\n\t\tif (buttonColor) {\n\t\t\treturn `background-color: ${getLoadingButtonBackgroundCustom(\n\t\t\t\tbuttonColor,\n\t\t\t\t50,\n\t\t\t)};`;\n\t\t}\n\t\treturn `background-color: ${\n\t\t\tinverse ? COLORS.background.warning.vibrant : COLORS.background.brandLight\n\t\t};`;\n\t}\n\tif (type === 'destructive') {\n\t\treturn `background-color: ${COLORS.background.negative.light};`;\n\t}\n\treturn 'background-color: transparent;';\n};\n\nexport const getLoadingBorder = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'special') {\n\t\treturn strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: none;`;\n\t}\n\tif (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? strokeStyle(size, COLORS.content.secondary)\n\t\t\t: strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\treturn '';\n};\n\nexport const SpinnerColorMap = (type: Type, inverse?: boolean) => {\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\tif (inverse) {\n\t\tif (type === 'primary') {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t}\n\tif (type === 'destructive') {\n\t\treturn COLORS.content.negative;\n\t}\n\treturn COLORS.content.brand;\n};\n\nexport const getButtonIconColor = (\n\tsize: Size,\n\ttype: Type,\n\tinverse?: boolean,\n\tdisabled?: boolean,\n\tisLoading?: boolean,\n\tdarkMode?: boolean,\n) => {\n\tif (size === 'chip') {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t} else if (darkMode) {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n\tif (isLoading) {\n\t\treturn 'transparent';\n\t}\n\tif (type === 'special') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.background.inverseLight;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.content.secondary;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t} else if (type === 'secondary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiaryGray' || type.startsWith('dash')) {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n};\n"],"names":["getBackgroundColor","type","size","inverse","darkMode","buttonColor","COLORS","getColor","getDisabledTextColor","getPadding","GetButtonTextComponent","disabled","ButtonRegularAI","ButtonLargeAI","BodySecondary","BodyCaption","ButtonRegular","ButtonLarge","getBorderColor","error","strokeStyle","color","width","getBorder","version","getLinearGradientValue","getHoverButtonBackgroundCustom","percent","num","amt","R","G","B","getLoadingButtonBackgroundCustom","getHoverButtonBackground","getHoverButtonTextDecorationStyle","generateInverseHoverBackground","generateDisabledStyling","getDashedBorderStyling","borderColor","getClickEffect","getLoadingBackground","getLoadingBorder","SpinnerColorMap","getButtonIconColor","isLoading"],"mappings":"+JAWaA,EAAqB,CACjCC,EACAC,EACAC,EACAC,EACAC,IACY,CACZ,GAAIJ,IAAS,UAAW,OAAOK,EAAAA,OAAO,WAAW,eACjD,GAAIL,IAAS,gBAAiB,MAAO,cAErC,GAAIC,IAAS,OACZ,OAAID,IAAS,OACL,cAEDG,EAAWE,EAAAA,OAAO,QAAQ,QAAUA,EAAAA,OAAO,QAAQ,QAE3D,OAAQL,EAAA,CACP,IAAK,UACJ,OAAOI,IAEJF,EACAG,EAAAA,OAAO,WAAW,QAAQ,QAC1BA,SAAO,WAAW,cACtB,IAAK,cACJ,OAAOA,EAAAA,OAAO,WAAW,SAAS,QACnC,IAAK,WACJ,MAAO,cACR,QACC,MAAO,aAAA,CAEV,EAEaC,EAAW,CACvBN,EACAC,EACAC,EACAC,IACY,CACZ,GAAIH,IAAS,UAAW,OAAOK,EAAAA,OAAO,WAAW,aACjD,GAAIL,IAAS,gBAAiB,OAAOK,EAAAA,OAAO,QAAQ,UAEpD,GAAIJ,IAAS,OACZ,OAAID,IAAS,OACLE,EAAUG,EAAAA,OAAO,QAAQ,SAAWA,EAAAA,OAAO,QAAQ,MAEpDF,EAAWE,EAAAA,OAAO,QAAQ,QAAUA,EAAAA,OAAO,QAAQ,UAE3D,OAAQL,EAAA,CACP,IAAK,UACJ,OAAOE,EAAUG,EAAAA,OAAO,QAAQ,QAAUA,EAAAA,OAAO,QAAQ,eAC1D,IAAK,eACJ,OAAOA,EAAAA,OAAO,QAAQ,UACvB,IAAK,cACJ,OAAOA,EAAAA,OAAO,QAAQ,eACvB,IAAK,WACJ,OAAOA,EAAAA,OAAO,QAAQ,UACvB,IAAK,cACJ,OAAOA,EAAA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IE,EACCQ,EACI,2BAEDL,EAAAA,OAAO,QAAQ,eAEnBK,EACIL,EAAAA,OAAO,QAAQ,SAEhBA,EAAAA,OAAO,QAAQ,MACvB,GAAWL,IAAS,WACnB,OAAIE,EACCQ,EACI,2BAEDL,EAAAA,OAAO,QAAQ,eAEnBK,EACIL,EAAAA,OAAO,QAAQ,SAEhBA,EAAAA,OAAO,QAAQ,SACZL,IAAS,gBAAkBA,EAAK,WAAW,MAAM,EAC3D,OAAIU,EACIL,EAAAA,OAAO,QAAQ,SAEhBA,EAAAA,OAAO,QAAQ,SAExB"}
|
|
1
|
+
{"version":3,"file":"themes.js","sources":["../../../../src/components/button/themes.tsx"],"sourcesContent":["import { COLORS } from '@src/constants/Theme';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tButtonLarge,\n\tButtonLargeAI,\n\tButtonRegular,\n\tButtonRegularAI,\n} from '../TypographyStyle';\nimport { Size, Type } from './model';\n\nexport const getBackgroundColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n\tbuttonColor?: string,\n): string => {\n\tif (type === 'special') return COLORS.background.brandVeryLight;\n\tif (type === 'secondaryGray') return 'transparent';\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn 'transparent';\n\t\t}\n\t\treturn darkMode ? COLORS.surface.hovered : COLORS.surface.subdued;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn buttonColor\n\t\t\t\t? buttonColor\n\t\t\t\t: inverse\n\t\t\t\t? COLORS.background.warning.vibrant\n\t\t\t\t: COLORS.background.inverseLight;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.background.negative.vibrant;\n\t\tcase 'tertiary':\n\t\t\treturn 'transparent';\n\t\tdefault:\n\t\t\treturn 'transparent';\n\t}\n};\n\nexport const getColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n): string => {\n\tif (type === 'special') return COLORS.background.inverseLight;\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn inverse ? COLORS.content.inactive : COLORS.content.brand;\n\t\t}\n\t\treturn darkMode ? COLORS.content.primary : COLORS.content.secondary;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn inverse ? COLORS.content.primary : COLORS.content.primaryInverse;\n\t\tcase 'tertiaryGray':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.content.primaryInverse;\n\t\tcase 'dashBold':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'dashRegular':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'ai':\n\t\t\treturn COLORS.content.ai;\n\t\tdefault:\n\t\t\treturn inverse ? COLORS.content.primaryInverse : COLORS.stroke.brand;\n\t}\n};\n\nexport const getDisabledTextColor = (inverse?: boolean) => {\n\tif (inverse) {\n\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t}\n\treturn COLORS.content.inactive;\n};\n\nexport const getPadding = (type: Type, size: Size) => {\n\tif (type === 'text') {\n\t\treturn '0px';\n\t} else if (size === 'xs') {\n\t\treturn '4px 6px';\n\t} else if (size === 'chip') {\n\t\treturn '4px 8px';\n\t} else if (size === 'small') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '6px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '6px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '6px 12px';\n\t\t}\n\t} else if (size === 'medium') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '10px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '10px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '10px 12px';\n\t\t}\n\t} else if (size === 'large') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '14px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '14px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '14px 12px';\n\t\t}\n\t}\n};\nexport const GetButtonTextComponent = (\n\tsize: Size,\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (!disabled && type === 'ai') {\n\t\tif (size === 'small') {\n\t\t\treturn ButtonRegularAI;\n\t\t} else {\n\t\t\treturn ButtonLargeAI;\n\t\t}\n\t}\n\n\tif (type === 'dashRegular') {\n\t\treturn BodySecondary;\n\t}\n\tif (size === 'chip' || size === 'xs') {\n\t\treturn BodyCaption;\n\t} else if (size === 'small') {\n\t\treturn ButtonRegular;\n\t}\n\treturn ButtonLarge;\n};\n\nexport const getBorderColor = (\n\ttype: Type,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (error) {\n\t\treturn COLORS.stroke.negative.vibrant;\n\t}\n\n\tif (inverse) {\n\t\treturn COLORS.surface.standard;\n\t}\n\tif (type == 'secondary') {\n\t\treturn COLORS.stroke.brand;\n\t}\n\treturn COLORS.content.placeholder;\n};\n\nexport const strokeStyle = (size: Size, color: string, width = 1): string =>\n\tsize === 'xs'\n\t\t? `box-shadow: inset 0 0 0 ${width}px ${color}; border: none;`\n\t\t: `border: ${width}px solid ${color};`;\n\nexport const getBorder = (\n\tversion: '1.0' | '2.0' | '3.0',\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (type == 'text') {\n\t\treturn 'border: none;';\n\t}\n\tif (type === 'special') {\n\t\treturn strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: ${version === '2.0' ? 0.5 : 1}px solid ${\n\t\t\tCOLORS.stroke.primary\n\t\t};`;\n\t}\n\tif (inverse) {\n\t\tif (type === 'secondary') {\n\t\t\treturn strokeStyle(\n\t\t\t\tsize,\n\t\t\t\tgetBorderColor(type, inverse, error),\n\t\t\t\tversion === '2.0' ? 0.5 : 1,\n\t\t\t);\n\t\t}\n\t\treturn 'border: none;';\n\t}\n\n\tif (type === 'secondary') {\n\t\treturn strokeStyle(\n\t\t\tsize,\n\t\t\tgetBorderColor(type, false, error),\n\t\t\tversion === '2.0' ? 0.5 : 1,\n\t\t);\n\t}\n\treturn 'border: none;';\n};\n\nexport const getLinearGradientValue = (size: Size): string => {\n\tif (size === 'medium') {\n\t\treturn `5px,\n\t\ttransparent 5px,\n\t\ttransparent 10px`;\n\t}\n\treturn `6px,\n\t\ttransparent 6px,\n\t\ttransparent 12px`;\n};\n\n/**\n * Adjusts the brightness of a given hex color by a specified percentage.\n * Below function is used to generate a hover effect for button backgrounds.\n *\n * @param {string} color - The hex color code to be adjusted (e.g., \"#ff0000\").\n * @param {number} percent - The percentage by which to darken the color. Positive values darken the color.\n * @returns {string} - The adjusted hex color code.\n *\n * @example\n * // Darken the color #ff0000 (red) by 10%\n * const darkerRed = getHoverButtonBackgroundCustom(\"#ff0000\", 10);\n * console.log(darkerRed); // Output might be \"#e60000\"\n */\n\nexport const getHoverButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) - amt,\n\t\tG = ((num >> 8) & 0x00ff) - amt,\n\t\tB = (num & 0x0000ff) - amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.max(R, 0) << 16) +\n\t\t(Math.max(G, 0) << 8) +\n\t\tMath.max(B, 0)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\n/**\n * Generates a new color by adjusting the brightness of the given color by a specified percentage.\n *\n * @param color - The original color in hexadecimal format (e.g., \"#RRGGBB\").\n * @param percent - The percentage to adjust the brightness. Positive values will lighten the color, while negative values will darken it.\n * @returns The new color in hexadecimal format after adjusting the brightness.\n *\n * @example\n * // Lighten the color by 20%\n * const newColor = getLoadingButtonBackgroundCustom(\"#ff0000\", 20); // \"#ff3333\"\n *\n * @example\n * // Darken the color by 10%\n * const newColor = getLoadingButtonBackgroundCustom(\"#00ff00\", -10); // \"#00e600\"\n */\nexport const getLoadingButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) + amt,\n\t\tG = ((num >> 8) & 0x00ff) + amt,\n\t\tB = (num & 0x0000ff) + amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.min(R, 255) << 16) +\n\t\t(Math.min(G, 255) << 8) +\n\t\tMath.min(B, 255)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\nexport const getHoverButtonBackground = (type: Type, inverse?: boolean) => {\n\tif (type === 'ai') {\n\t\treturn `background: ${COLORS.surface.aiLight};`;\n\t}\n\n\tif (type === 'text') {\n\t\treturn `background-color:transparent;`;\n\t}\n\tif (type === 'special' || type === 'secondaryGray') {\n\t\treturn '';\n\t}\n\tif (!inverse && type !== 'primary') {\n\t\treturn `background-color: #000000;\n\t\t\t\topacity: 0.03;`;\n\t}\n\n\treturn ``;\n};\n\nexport const getHoverButtonTextDecorationStyle = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\treturn `text-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n};\n\nexport const generateInverseHoverBackground = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\tif (type === 'primary') {\n\t\treturn `background-color: ${COLORS.stroke.warning.lightAlt};`;\n\t}\n\treturn `background-color: rgba(255, 255, 255, 0.1)`;\n};\n\nexport const generateDisabledStyling = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.base}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.primary,\n\t\t)}`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: transparent;`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\treturn inverse\n\t\t\t? 'background-color: rgba(255,255,255,0.3);'\n\t\t\t: `background-color: ${COLORS.background.inactive};`;\n\t} else if (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? strokeStyle(size, 'rgba(255, 255, 255, 0.5)')\n\t\t\t: strokeStyle(size, COLORS.stroke.primary);\n\t}\n\treturn '';\n};\n\nexport const getDashedBorderStyling = (\n\ttype: Type,\n\tsize: Size,\n\tborderColor: string = getBorderColor(type, false),\n) => {\n\treturn `\n\t.line-top {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-right {\n\t\tposition: absolute;\n\t\tright: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-bottom {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tbottom: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-left {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t`;\n};\n\nexport const getClickEffect = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'text') {\n\t\treturn `background-color: ${COLORS.background.brandLight};\n\t\t\ttext-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n\t}\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandLight}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.brandLightAlt,\n\t\t)}`;\n\t}\n\tif (type === 'secondaryGray' || type === 'tertiaryGray') {\n\t\treturn `background-color: ${COLORS.surface.hovered}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.primary,\n\t\t)}`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: 1px solid ${COLORS.stroke.brandLightAlt};\n\t\tbackground-color: ${COLORS.background.brandLight};`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\treturn `background-color: ${COLORS.background.warning.vibrant} !important;\n\t\t\tbox-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);\n\t\t\t`;\n\t\t}\n\t\treturn 'box-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);';\n\t} else if (\n\t\ttype === 'secondary' ||\n\t\ttype === 'tertiary' ||\n\t\t// type === 'tertiaryGray' ||\n\t\ttype.startsWith('dash')\n\t) {\n\t\treturn inverse\n\t\t\t? `background-color: ${COLORS.background.inverseLight} !important;`\n\t\t\t: `background-color: ${COLORS.background.brandLight};`;\n\t}\n};\nexport const getLoadingBackground = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tbuttonColor?: string,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandVeryLight};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `background-color: ${COLORS.surface.subdued};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: ${COLORS.background.base};`;\n\t}\n\tif (type === 'primary') {\n\t\tif (buttonColor) {\n\t\t\treturn `background-color: ${getLoadingButtonBackgroundCustom(\n\t\t\t\tbuttonColor,\n\t\t\t\t50,\n\t\t\t)};`;\n\t\t}\n\t\treturn `background-color: ${\n\t\t\tinverse ? COLORS.background.warning.vibrant : COLORS.background.brandLight\n\t\t};`;\n\t}\n\tif (type === 'destructive') {\n\t\treturn `background-color: ${COLORS.background.negative.light};`;\n\t}\n\treturn 'background-color: transparent;';\n};\n\nexport const getLoadingBorder = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'special') {\n\t\treturn strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: none;`;\n\t}\n\tif (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? strokeStyle(size, COLORS.content.secondary)\n\t\t\t: strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\treturn '';\n};\n\nexport const SpinnerColorMap = (type: Type, inverse?: boolean) => {\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\tif (inverse) {\n\t\tif (type === 'primary') {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t}\n\tif (type === 'destructive') {\n\t\treturn COLORS.content.negative;\n\t}\n\treturn COLORS.content.brand;\n};\n\nexport const getButtonIconColor = (\n\tsize: Size,\n\ttype: Type,\n\tinverse?: boolean,\n\tdisabled?: boolean,\n\tisLoading?: boolean,\n\tdarkMode?: boolean,\n) => {\n\tif (size === 'chip') {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t} else if (darkMode) {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n\tif (isLoading) {\n\t\treturn 'transparent';\n\t}\n\tif (type === 'special') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.background.inverseLight;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.content.secondary;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t} else if (type === 'secondary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiaryGray' || type.startsWith('dash')) {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n};\n"],"names":["getBackgroundColor","type","size","inverse","darkMode","buttonColor","COLORS","getColor","getDisabledTextColor","getPadding","GetButtonTextComponent","disabled","ButtonRegularAI","ButtonLargeAI","BodySecondary","BodyCaption","ButtonRegular","ButtonLarge","getBorderColor","error","strokeStyle","color","width","getBorder","version","getLinearGradientValue","getHoverButtonBackgroundCustom","percent","num","amt","R","G","B","getLoadingButtonBackgroundCustom","getHoverButtonBackground","getHoverButtonTextDecorationStyle","generateInverseHoverBackground","generateDisabledStyling","getDashedBorderStyling","borderColor","getClick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EACI,2BAEDL,EAAAA,OAAO,QAAQ,eAEnBK,EACIL,EAAAA,OAAO,QAAQ,SAEhBA,EAAAA,OAAO,QAAQ,SACZL,IAAS,gBAAkBA,EAAK,WAAW,MAAM,EAC3D,OAAIU,EACIL,EAAAA,OAAO,QAAQ,SAEhBA,EAAAA,OAAO,QAAQ,SAExB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),D=require("react"),m=require("../../constants/Theme.js"),q=require("../combo-box/ComboBox.js"),p=require("../TypographyStyle.js"),i=require("./ScheduleBuilder.styled.js"),P=require("../datePicker/DatePickerWrapper.js"),w=require("../datePicker/model.js"),R=require("../dropdown/Dropdown.js"),h=30,d=c=>{const l=c.trim();if(!l)return null;const o=l.match(/^(\d{1,2})(?::(\d{1,2}))?$/);if(!o)return null;const s=Number(o[1]),a=o[2]===void 0?0:Number(o[2]);return s<1||s>12||a>59?null:{hours:String(s),minutes:String(a)}},k=({date:c,onDateChange:l,hours:o,minutes:s,isAm:a,onTimeChange:S,onMeridiemChange:y,onTimeInvalidBlur:x,timeErrorMessage:T,dateLabel:M="Start date",minDate:j,"data-test":f})=>{const b=D.useMemo(()=>{const e=[];for(let n=1;n<=12;n+=1)for(let u=0;u<60;u+=h)e.push(`${n}:${String(u).padStart(2,"0")}`);const t=e.filter(n=>n.startsWith("12:"));return[...t,...e.filter(n=>!t.includes(n))].map(n=>({value:n}))},[]),g=o!==""&&s!==""?`${o}:${String(s).padStart(2,"0")}`:void 0,v=[{label:"AM",value:"am",selected:a},{label:"PM",value:"pm",selected:!a}];return r.jsxs(i.FieldsRow,{"data-test":f,children:[r.jsxs(i.DateFieldColumn,{children:[r.jsx(i.FieldLabel,{children:r.jsxs(p.BodySecondary,{color:m.COLORS.content.primary,children:[M,r.jsx(i.RequiredMark,{children:" *"})]})}),r.jsx(i.DatePickerSlot,{children:r.jsx(P.DatePickerWrapper,{val:c,onChange:e=>{const t=Array.isArray(e)?e[0]:e;t&&l(t)},displayFormat:"dd MMM yyyy",dateButtonType:w.DateButtonType.LARGE,calendarProps:{minDate:j},pickerStyles:{top:8,zIndex:4}})})]}),r.jsxs(i.TimeFieldColumn,{children:[r.jsx(i.FieldLabel,{children:r.jsxs(p.BodySecondary,{color:m.COLORS.content.primary,children:["Time",r.jsx(i.RequiredMark,{children:" *"})]})}),r.jsxs(i.TimeInputRow,{children:[r.jsx(i.TimeDropdownSlot,{children:r.jsx(q.ComboBox,{"data-test":"recurrence-time",value:g??"",options:b,placeholder:"hh:mm",errorMessage:T||void 0,validate:e=>!!d(e),sanitize:e=>e.replace(/[^\d:]/g,"").slice(0,5),format:e=>{const t=d(e);return t?`${t.hours}:${t.minutes.padStart(2,"0")}`:e},onChange:e=>{const t=d(e);t&&S(t)},onInvalidBlur:x})}),r.jsx(i.MeridiemDropdownSlot,{"data-test":"recurrence-meridiem",children:r.jsx(R.Dropdown,{size:"default",isSearchable:!1,isMultiSelect:!1,options:v,value:a?"AM":"PM",buttonWidth:"100%",width:"84px",placeHolderHeight:"48px",placeHolder:"AM",onSelect:e=>{const t=Array.isArray(e)?e[0]:e;y(t?.value!=="pm")}})})]})]})]})};exports.StartDateTimePicker=k;exports.TIME_STEP_MINUTES=h;exports.parseTimeText=d;
|
|
2
2
|
//# sourceMappingURL=StartDateTimePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartDateTimePicker.js","sources":["../../../../src/components/schedule-builder/StartDateTimePicker.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { COLORS } from '../../constants/Theme';\nimport { ComboBox } from '../combo-box';\nimport { DateButtonType, DatePickerWrapper } from '../datePicker';\nimport { Dropdown, DropdownOption, SingleOption } from '../dropdown';\nimport { BodySecondary } from '../TypographyStyle';\nimport {\n\tDateFieldColumn,\n\tDatePickerSlot,\n\tFieldLabel,\n\tFieldsRow,\n\tMeridiemDropdownSlot,\n\tRequiredMark,\n\tTimeDropdownSlot,\n\tTimeFieldColumn,\n\tTimeInputRow,\n} from './ScheduleBuilder.styled';\n\n/** Step between offered times, in minutes. */\nconst TIME_STEP_MINUTES = 30;\n\n/**\n * Reads a typed 12-hour time.\n *\n * Accepts \"9\", \"9:5\" and \"09:05\" so the merchant can type naturally; am/pm sits\n * on its own dropdown, so only 1-12 is valid here. Returns null while the text is\n * incomplete, which is what keeps the field editable mid-entry.\n */\nexport const parseTimeText = (\n\ttext: string,\n): { hours: string; minutes: string } | null => {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return null;\n\n\tconst match = trimmed.match(/^(\\d{1,2})(?::(\\d{1,2}))?$/);\n\tif (!match) return null;\n\n\tconst hours = Number(match[1]);\n\t// Minutes are optional: \"9\" means 9:00.\n\tconst minutes = match[2] === undefined ? 0 : Number(match[2]);\n\n\tif (hours < 1 || hours > 12) return null;\n\tif (minutes > 59) return null;\n\n\treturn { hours: String(hours), minutes: String(minutes) };\n};\n\nexport interface StartDateTimePickerProps {\n\t/** The chosen date. Time-of-day is carried separately by hours/minutes/isAm. */\n\tdate?: Date;\n\tonDateChange: (date: Date) => void;\n\t/** 12-hour clock, \"1\"–\"12\". Empty string while nothing is chosen. */\n\thours: string;\n\t/** \"0\"–\"59\". Empty string while nothing is chosen. */\n\tminutes: string;\n\tisAm: boolean;\n\t/** Fires only for a parseable time, so partial typing does not clear state. */\n\tonTimeChange: (time: { hours: string; minutes: string }) => void;\n\tonMeridiemChange: (isAm: boolean) => void;\n\t/** Called when focus leaves an unparseable time, for the caller to validate. */\n\tonTimeInvalidBlur?: () => void;\n\t/** Shown under the time field. The caller owns validation. */\n\ttimeErrorMessage?: string;\n\t/** \"Start date\" when a recurrence follows, plain \"Date\" otherwise. */\n\tdateLabel?: string;\n\tminDate?: Date;\n\t'data-test'?: string;\n}\n\n/**\n * The start date and time-of-day row.\n *\n * Date and time are separate props rather than one Date because the time is\n * edited as text and can be mid-entry (\"9:\" is not a time yet) — folding it into\n * a Date would force a guess about what an incomplete entry means.\n */\nexport const StartDateTimePicker: React.FC<StartDateTimePickerProps> = ({\n\tdate,\n\tonDateChange,\n\thours,\n\tminutes,\n\tisAm,\n\tonTimeChange,\n\tonMeridiemChange,\n\tonTimeInvalidBlur,\n\ttimeErrorMessage,\n\tdateLabel = 'Start date',\n\tminDate,\n\t'data-test': dataTest,\n}) => {\n\t/**\n\t * Times offered in the picker, at TIME_STEP_MINUTES steps. 12 leads the day in\n\t * 12-hour time, so it sorts to the front rather than after 11.\n\t */\n\tconst timeOptions = useMemo(() => {\n\t\tconst values: string[] = [];\n\t\tfor (let hour = 1; hour <= 12; hour += 1) {\n\t\t\tfor (let minute = 0; minute < 60; minute += TIME_STEP_MINUTES) {\n\t\t\t\tvalues.push(`${hour}:${String(minute).padStart(2, '0')}`);\n\t\t\t}\n\t\t}\n\t\tconst twelves = values.filter((value) => value.startsWith('12:'));\n\t\treturn [\n\t\t\t...twelves,\n\t\t\t...values.filter((value) => !twelves.includes(value)),\n\t\t].map((value) => ({ value }));\n\t}, []);\n\n\tconst selectedTimeLabel =\n\t\thours !== '' && minutes !== ''\n\t\t\t? `${hours}:${String(minutes).padStart(2, '0')}`\n\t\t\t: undefined;\n\n\tconst meridiemDropdownOptions: SingleOption[] = [\n\t\t{ label: 'AM', value: 'am', selected: isAm },\n\t\t{ label: 'PM', value: 'pm', selected: !isAm },\n\t];\n\n\treturn (\n\t\t<FieldsRow data-test={dataTest}>\n\t\t\t<DateFieldColumn>\n\t\t\t\t<FieldLabel>\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t{dateLabel}\n\t\t\t\t\t\t<RequiredMark> *</RequiredMark>\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</FieldLabel>\n\t\t\t\t<DatePickerSlot>\n\t\t\t\t\t<DatePickerWrapper\n\t\t\t\t\t\tval={date}\n\t\t\t\t\t\tonChange={(value: Date | Date[]) => {\n\t\t\t\t\t\t\tconst dateValue = Array.isArray(value) ? value[0] : value;\n\t\t\t\t\t\t\tif (dateValue) onDateChange(dateValue);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tdisplayFormat=\"dd MMM yyyy\"\n\t\t\t\t\t\tdateButtonType={DateButtonType.LARGE}\n\t\t\t\t\t\tcalendarProps={{ minDate }}\n\t\t\t\t\t\tpickerStyles={{ top: 8, zIndex: 4 }}\n\t\t\t\t\t/>\n\t\t\t\t</DatePickerSlot>\n\t\t\t</DateFieldColumn>\n\t\t\t<TimeFieldColumn>\n\t\t\t\t<FieldLabel>\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\tTime\n\t\t\t\t\t\t<RequiredMark> *</RequiredMark>\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</FieldLabel>\n\t\t\t\t{/*\n Top-aligned: the time field's error message sits inside its own slot,\n so centring would drop AM/PM as the message appears.\n */}\n\t\t\t\t<TimeInputRow>\n\t\t\t\t\t<TimeDropdownSlot>\n\t\t\t\t\t\t<ComboBox\n\t\t\t\t\t\t\tdata-test=\"recurrence-time\"\n\t\t\t\t\t\t\tvalue={selectedTimeLabel ?? ''}\n\t\t\t\t\t\t\toptions={timeOptions}\n\t\t\t\t\t\t\tplaceholder=\"hh:mm\"\n\t\t\t\t\t\t\terrorMessage={timeErrorMessage || undefined}\n\t\t\t\t\t\t\tvalidate={(text) => !!parseTimeText(text)}\n\t\t\t\t\t\t\tsanitize={(text) => text.replace(/[^\\d:]/g, '').slice(0, 5)}\n\t\t\t\t\t\t\tformat={(text) => {\n\t\t\t\t\t\t\t\tconst parsed = parseTimeText(text);\n\t\t\t\t\t\t\t\tif (!parsed) return text;\n\t\t\t\t\t\t\t\treturn `${parsed.hours}:${parsed.minutes.padStart(2, '0')}`;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonChange={(text) => {\n\t\t\t\t\t\t\t\tconst parsed = parseTimeText(text);\n\t\t\t\t\t\t\t\tif (!parsed) return;\n\t\t\t\t\t\t\t\tonTimeChange(parsed);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonInvalidBlur={onTimeInvalidBlur}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TimeDropdownSlot>\n\t\t\t\t\t<MeridiemDropdownSlot data-test=\"recurrence-meridiem\">\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\tisSearchable={false}\n\t\t\t\t\t\t\tisMultiSelect={false}\n\t\t\t\t\t\t\toptions={meridiemDropdownOptions}\n\t\t\t\t\t\t\tvalue={isAm ? 'AM' : 'PM'}\n\t\t\t\t\t\t\tbuttonWidth=\"100%\"\n\t\t\t\t\t\t\twidth=\"84px\"\n\t\t\t\t\t\t\tplaceHolderHeight=\"48px\"\n\t\t\t\t\t\t\tplaceHolder=\"AM\"\n\t\t\t\t\t\t\tonSelect={(\n\t\t\t\t\t\t\t\tselected: DropdownOption | DropdownOption[] | null,\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst normalized = (\n\t\t\t\t\t\t\t\t\tArray.isArray(selected) ? selected[0] : selected\n\t\t\t\t\t\t\t\t) as SingleOption | null;\n\t\t\t\t\t\t\t\tonMeridiemChange(normalized?.value !== 'pm');\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MeridiemDropdownSlot>\n\t\t\t\t</TimeInputRow>\n\t\t\t</TimeFieldColumn>\n\t\t</FieldsRow>\n\t);\n};\n"],"names":["TIME_STEP_MINUTES","parseTimeText","text","trimmed","match","hours","minutes","StartDateTimePicker","date","onDateChange","isAm","onTimeChange","onMeridiemChange","onTimeInvalidBlur","timeErrorMessage","dateLabel","minDate","dataTest","timeOptions","useMemo","values","hour","minute","twelves","value","selectedTimeLabel","meridiemDropdownOptions","jsxs","FieldsRow","DateFieldColumn","jsx","FieldLabel","BodySecondary","COLORS","RequiredMark","DatePickerSlot","DatePickerWrapper","dateValue","DateButtonType","TimeFieldColumn","TimeInputRow","TimeDropdownSlot","ComboBox","parsed","MeridiemDropdownSlot","Dropdown","selected","normalized"],"mappings":"yZAmBMA,EAAoB,GASbC,EACZC,GAC+C,CAC/C,MAAMC,EAAUD,EAAK,KAAA,EACrB,GAAI,CAACC,EAAS,OAAO,KAErB,MAAMC,EAAQD,EAAQ,MAAM,4BAA4B,EACxD,GAAI,CAACC,EAAO,OAAO,KAEnB,MAAMC,EAAQ,OAAOD,EAAM,CAAC,CAAC,EAEvBE,EAAUF,EAAM,CAAC,IAAM,OAAY,EAAI,OAAOA,EAAM,CAAC,CAAC,EAG5D,OADIC,EAAQ,GAAKA,EAAQ,IACrBC,EAAU,GAAW,KAElB,CAAE,MAAO,OAAOD,CAAK,EAAG,QAAS,OAAOC,CAAO,CAAA,CACvD,EA+BaC,EAA0D,CAAC,CACvE,KAAAC,EACA,aAAAC,EACA,MAAAJ,EACA,QAAAC,EACA,KAAAI,EACA,aAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,UAAAC,EAAY,aACZ,QAAAC,EACA,YAAaC,CACd,IAAM,CAKL,MAAMC,EAAcC,EAAAA,QAAQ,IAAM,CACjC,MAAMC,EAAmB,CAAA,EACzB,QAASC,EAAO,EAAGA,GAAQ,GAAIA,GAAQ,EACtC,QAASC,EAAS,EAAGA,EAAS,GAAIA,GAAUtB,EAC3CoB,EAAO,KAAK,GAAGC,CAAI,IAAI,OAAOC,CAAM,EAAE,SAAS,EAAG,GAAG,CAAC,EAAE,EAG1D,MAAMC,EAAUH,EAAO,OAAQI,GAAUA,EAAM,WAAW,KAAK,CAAC,EAChE,MAAO,CACN,GAAGD,EACH,GAAGH,EAAO,OAAQI,GAAU,CAACD,EAAQ,SAASC,CAAK,CAAC,CAAA,EACnD,IAAKA,IAAW,CAAE,MAAAA,GAAQ,CAC7B,EAAG,CAAA,CAAE,EA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P,EACT,YAAY,QACZ,aAAcJ,GAAoB,OAClC,SAAWZ,GAAS,CAAC,CAACD,EAAcC,CAAI,EACxC,SAAWA,GAASA,EAAK,QAAQ,UAAW,EAAE,EAAE,MAAM,EAAG,CAAC,EAC1D,OAASA,GAAS,CACjB,MAAMyC,EAAS1C,EAAcC,CAAI,EACjC,OAAKyC,EACE,GAAGA,EAAO,KAAK,IAAIA,EAAO,QAAQ,SAAS,EAAG,GAAG,CAAC,GADrCzC,CAErB,EACA,SAAWA,GAAS,CACnB,MAAMyC,EAAS1C,EAAcC,CAAI,EAC5ByC,GACLhC,EAAagC,CAAM,CACpB,EACA,cAAe9B,CAAA,CAAA,EAEjB,EACAiB,EAAAA,IAACc,EAAAA,qBAAA,CAAqB,YAAU,sBAC/B,SAAAd,EAAAA,IAACe,EAAAA,SAAA,CACA,KAAK,UACL,aAAc,GACd,cAAe,GACf,QAASnB,EACT,MAAOhB,EAAO,KAAO,KACrB,YAAY,OACZ,MAAM,OACN,kBAAkB,OAClB,YAAY,KACZ,SACCoC,GACI,CACJ,MAAMC,EACL,MAAM,QAAQD,CAAQ,EAAIA,EAAS,CAAC,EAAIA,EAEzClC,EAAiBmC,GAAY,QAAU,IAAI,CAC5C,CAAA,CAAA,CACD,CACD,CAAA,CAAA,CACD,CAAA,CAAA,CACD,CAAA,EACD,CAEF"}
|
|
1
|
+
{"version":3,"file":"StartDateTimePicker.js","sources":["../../../../src/components/schedule-builder/StartDateTimePicker.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { COLORS } from '../../constants/Theme';\nimport { ComboBox } from '../combo-box';\nimport { DateButtonType, DatePickerWrapper } from '../datePicker';\nimport { Dropdown, DropdownOption, SingleOption } from '../dropdown';\nimport { BodySecondary } from '../TypographyStyle';\nimport {\n\tDateFieldColumn,\n\tDatePickerSlot,\n\tFieldLabel,\n\tFieldsRow,\n\tMeridiemDropdownSlot,\n\tRequiredMark,\n\tTimeDropdownSlot,\n\tTimeFieldColumn,\n\tTimeInputRow,\n} from './ScheduleBuilder.styled';\n\n/**\n * Step between offered times, in minutes.\n *\n * Exported because a host seeding a default time has to round onto the same step\n * — otherwise the seeded value is not one of the options the dropdown offers.\n */\nexport const TIME_STEP_MINUTES = 30;\n\n/**\n * Reads a typed 12-hour time.\n *\n * Accepts \"9\", \"9:5\" and \"09:05\" so the merchant can type naturally; am/pm sits\n * on its own dropdown, so only 1-12 is valid here. Returns null while the text is\n * incomplete, which is what keeps the field editable mid-entry.\n */\nexport const parseTimeText = (\n\ttext: string,\n): { hours: string; minutes: string } | null => {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return null;\n\n\tconst match = trimmed.match(/^(\\d{1,2})(?::(\\d{1,2}))?$/);\n\tif (!match) return null;\n\n\tconst hours = Number(match[1]);\n\t// Minutes are optional: \"9\" means 9:00.\n\tconst minutes = match[2] === undefined ? 0 : Number(match[2]);\n\n\tif (hours < 1 || hours > 12) return null;\n\tif (minutes > 59) return null;\n\n\treturn { hours: String(hours), minutes: String(minutes) };\n};\n\nexport interface StartDateTimePickerProps {\n\t/** The chosen date. Time-of-day is carried separately by hours/minutes/isAm. */\n\tdate?: Date;\n\tonDateChange: (date: Date) => void;\n\t/** 12-hour clock, \"1\"–\"12\". Empty string while nothing is chosen. */\n\thours: string;\n\t/** \"0\"–\"59\". Empty string while nothing is chosen. */\n\tminutes: string;\n\tisAm: boolean;\n\t/** Fires only for a parseable time, so partial typing does not clear state. */\n\tonTimeChange: (time: { hours: string; minutes: string }) => void;\n\tonMeridiemChange: (isAm: boolean) => void;\n\t/** Called when focus leaves an unparseable time, for the caller to validate. */\n\tonTimeInvalidBlur?: () => void;\n\t/** Shown under the time field. The caller owns validation. */\n\ttimeErrorMessage?: string;\n\t/** \"Start date\" when a recurrence follows, plain \"Date\" otherwise. */\n\tdateLabel?: string;\n\tminDate?: Date;\n\t'data-test'?: string;\n}\n\n/**\n * The start date and time-of-day row.\n *\n * Date and time are separate props rather than one Date because the time is\n * edited as text and can be mid-entry (\"9:\" is not a time yet) — folding it into\n * a Date would force a guess about what an incomplete entry means.\n */\nexport const StartDateTimePicker: React.FC<StartDateTimePickerProps> = ({\n\tdate,\n\tonDateChange,\n\thours,\n\tminutes,\n\tisAm,\n\tonTimeChange,\n\tonMeridiemChange,\n\tonTimeInvalidBlur,\n\ttimeErrorMessage,\n\tdateLabel = 'Start date',\n\tminDate,\n\t'data-test': dataTest,\n}) => {\n\t/**\n\t * Times offered in the picker, at TIME_STEP_MINUTES steps. 12 leads the day in\n\t * 12-hour time, so it sorts to the front rather than after 11.\n\t */\n\tconst timeOptions = useMemo(() => {\n\t\tconst values: string[] = [];\n\t\tfor (let hour = 1; hour <= 12; hour += 1) {\n\t\t\tfor (let minute = 0; minute < 60; minute += TIME_STEP_MINUTES) {\n\t\t\t\tvalues.push(`${hour}:${String(minute).padStart(2, '0')}`);\n\t\t\t}\n\t\t}\n\t\tconst twelves = values.filter((value) => value.startsWith('12:'));\n\t\treturn [\n\t\t\t...twelves,\n\t\t\t...values.filter((value) => !twelves.includes(value)),\n\t\t].map((value) => ({ value }));\n\t}, []);\n\n\tconst selectedTimeLabel =\n\t\thours !== '' && minutes !== ''\n\t\t\t? `${hours}:${String(minutes).padStart(2, '0')}`\n\t\t\t: undefined;\n\n\tconst meridiemDropdownOptions: SingleOption[] = [\n\t\t{ label: 'AM', value: 'am', selected: isAm },\n\t\t{ label: 'PM', value: 'pm', selected: !isAm },\n\t];\n\n\treturn (\n\t\t<FieldsRow data-test={dataTest}>\n\t\t\t<DateFieldColumn>\n\t\t\t\t<FieldLabel>\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t{dateLabel}\n\t\t\t\t\t\t<RequiredMark> *</RequiredMark>\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</FieldLabel>\n\t\t\t\t<DatePickerSlot>\n\t\t\t\t\t<DatePickerWrapper\n\t\t\t\t\t\tval={date}\n\t\t\t\t\t\tonChange={(value: Date | Date[]) => {\n\t\t\t\t\t\t\tconst dateValue = Array.isArray(value) ? value[0] : value;\n\t\t\t\t\t\t\tif (dateValue) onDateChange(dateValue);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tdisplayFormat=\"dd MMM yyyy\"\n\t\t\t\t\t\tdateButtonType={DateButtonType.LARGE}\n\t\t\t\t\t\tcalendarProps={{ minDate }}\n\t\t\t\t\t\tpickerStyles={{ top: 8, zIndex: 4 }}\n\t\t\t\t\t/>\n\t\t\t\t</DatePickerSlot>\n\t\t\t</DateFieldColumn>\n\t\t\t<TimeFieldColumn>\n\t\t\t\t<FieldLabel>\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\tTime\n\t\t\t\t\t\t<RequiredMark> *</RequiredMark>\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</FieldLabel>\n\t\t\t\t{/*\n Top-aligned: the time field's error message sits inside its own slot,\n so centring would drop AM/PM as the message appears.\n */}\n\t\t\t\t<TimeInputRow>\n\t\t\t\t\t<TimeDropdownSlot>\n\t\t\t\t\t\t<ComboBox\n\t\t\t\t\t\t\tdata-test=\"recurrence-time\"\n\t\t\t\t\t\t\tvalue={selectedTimeLabel ?? ''}\n\t\t\t\t\t\t\toptions={timeOptions}\n\t\t\t\t\t\t\tplaceholder=\"hh:mm\"\n\t\t\t\t\t\t\terrorMessage={timeErrorMessage || undefined}\n\t\t\t\t\t\t\tvalidate={(text) => !!parseTimeText(text)}\n\t\t\t\t\t\t\tsanitize={(text) => text.replace(/[^\\d:]/g, '').slice(0, 5)}\n\t\t\t\t\t\t\tformat={(text) => {\n\t\t\t\t\t\t\t\tconst parsed = parseTimeText(text);\n\t\t\t\t\t\t\t\tif (!parsed) return text;\n\t\t\t\t\t\t\t\treturn `${parsed.hours}:${parsed.minutes.padStart(2, '0')}`;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonChange={(text) => {\n\t\t\t\t\t\t\t\tconst parsed = parseTimeText(text);\n\t\t\t\t\t\t\t\tif (!parsed) return;\n\t\t\t\t\t\t\t\tonTimeChange(parsed);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonInvalidBlur={onTimeInvalidBlur}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TimeDropdownSlot>\n\t\t\t\t\t<MeridiemDropdownSlot data-test=\"recurrence-meridiem\">\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\tisSearchable={false}\n\t\t\t\t\t\t\tisMultiSelect={false}\n\t\t\t\t\t\t\toptions={meridiemDropdownOptions}\n\t\t\t\t\t\t\tvalue={isAm ? 'AM' : 'PM'}\n\t\t\t\t\t\t\tbuttonWidth=\"100%\"\n\t\t\t\t\t\t\twidth=\"84px\"\n\t\t\t\t\t\t\tplaceHolderHeight=\"48px\"\n\t\t\t\t\t\t\tplaceHolder=\"AM\"\n\t\t\t\t\t\t\tonSelect={(\n\t\t\t\t\t\t\t\tselected: DropdownOption | DropdownOption[] | null,\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst normalized = (\n\t\t\t\t\t\t\t\t\tArray.isArray(selected) ? selected[0] : selected\n\t\t\t\t\t\t\t\t) as SingleOption | null;\n\t\t\t\t\t\t\t\tonMeridiemChange(normalized?.value !== 'pm');\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MeridiemDropdownSlot>\n\t\t\t\t</TimeInputRow>\n\t\t\t</TimeFieldColumn>\n\t\t</FieldsRow>\n\t);\n};\n"],"names":["TIME_STEP_MINUTES","parseTimeText","text","trimmed","match","hours","minutes","StartDateTimePicker","date","onDateChange","isAm","onTimeChange","onMeridiemChange","onTimeInvalidBlur","timeErrorMessage","dateLabel","minDate","dataTest","timeOptions","useMemo","values","hour","minute","twelves","value","selectedTimeLabel","meridiemDropdownOptions","jsxs","FieldsRow","DateFieldColumn","jsx","FieldLabel","BodySecondary","COLORS","RequiredMark","DatePickerSlot","DatePickerWrapper","dateValue","DateButtonType","TimeFieldColumn","TimeInputRow","TimeDropdownSlot","ComboBox","parsed","MeridiemDropdownSlot","Dropdown","selected","normalized"],"mappings":"yZAwBaA,EAAoB,GASpBC,EACZC,GAC+C,CAC/C,MAAMC,EAAUD,EAAK,KAAA,EACrB,GAAI,CAACC,EAAS,OAAO,KAErB,MAAMC,EAAQD,EAAQ,MAAM,4BAA4B,EACxD,GAAI,CAACC,EAAO,OAAO,KAEnB,MAAMC,EAAQ,OAAOD,EAAM,CAAC,CAAC,EAEvBE,EAAUF,EAAM,CAAC,IAAM,OAAY,EAAI,OAAOA,EAAM,CAAC,CAAC,EAG5D,OADIC,EAAQ,GAAKA,EAAQ,IACrBC,EAAU,GAAW,KAElB,CAAE,MAAO,OAAOD,CAAK,EAAG,QAAS,OAAOC,CAAO,CAAA,CACvD,EA+BaC,EAA0D,CAAC,CACvE,KAAAC,EACA,aAAAC,EACA,MAAAJ,EACA,QAAAC,EACA,KAAAI,EACA,aAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,UAAAC,EAAY,aACZ,QAAAC,EACA,YAAaC,CACd,IAAM,CAKL,MAAMC,EAAcC,EAAAA,QAAQ,IAAM,CACjC,MAAMC,EAAmB,CAAA,EACzB,QAASC,EAAO,EAAGA,GAAQ,GAAIA,GAAQ,EACtC,QAASC,EAAS,EAAGA,EAAS,GAAIA,GAAUtB,EAC3CoB,EAAO,KAAK,GAAGC,CAAI,IAAI,OAAOC,CAAM,EAAE,SAAS,EAAG,GAAG,CAAC,EAAE,EAG1D,MAAMC,EAAUH,EAAO,OAAQI,GAAUA,EAAM,WAAW,KAAK,CAAC,EAChE,MAAO,CACN,GAAGD,EACH,GAAGH,EAAO,OAAQI,GAAU,CAACD,EAAQ,SAASC,CAAK,CAAC,CAAA,EACnD,IAAKA,IAAW,CAAE,MAAAA,GAAQ,CAC7B,EAAG,CAAA,CAAE,EAECC,EACLpB,IAAU,IAAMC,IAAY,GACzB,GAAGD,CAAK,IA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